content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/python # -*- coding: utf-8 -*- """ mw_util.py Set of helper functions while dealing with MediaWiki. str2cat Adds prefix Category if string doesn't have it. """ def str2cat(category): """Return a category name starting with Category.""" prefix = "Category:" if not category.startswith(prefix): category = "%s%s" % (prefix, category) return category.replace(' ', '_')
""" mw_util.py Set of helper functions while dealing with MediaWiki. str2cat Adds prefix Category if string doesn't have it. """ def str2cat(category): """Return a category name starting with Category.""" prefix = 'Category:' if not category.startswith(prefix): category = '%s%s' % (prefix, category) return category.replace(' ', '_')
# Space : O(n) # Time : O(n**2) class Solution: def jump(self, nums: List[int]) -> int: n = len(nums) dp = [10**5] * n dp[0] = 0 if n == 1: return 0 for i in range(n): for j in range(nums[i]): dp[j+i+1] = min(dp[j+i+1], dp[i] + 1) if j+i+1 == n-1: return dp[-1] return dp[-1]
class Solution: def jump(self, nums: List[int]) -> int: n = len(nums) dp = [10 ** 5] * n dp[0] = 0 if n == 1: return 0 for i in range(n): for j in range(nums[i]): dp[j + i + 1] = min(dp[j + i + 1], dp[i] + 1) if j + i + 1 == n - 1: return dp[-1] return dp[-1]
# -*- coding: utf-8 -*- """ Created on 2018-03- @author: Frank Dip """ s = "hello boy" for i,j in enumerate(s): print(i, j)
""" Created on 2018-03- @author: Frank Dip """ s = 'hello boy' for (i, j) in enumerate(s): print(i, j)
while True: a = input() if int(a) == 42: break; print(int(a))
while True: a = input() if int(a) == 42: break print(int(a))
# -*- coding: utf-8 -*- # Contributors : [[email protected],[email protected], # [email protected], # [email protected] ] class CoefficientNotinRangeError(Exception): """ Class to throw exception when a coefficient is not in the specified range """ def __init__(self, coefficient, coeff_type="Default", range_min=0, range_max=1): self.range_max = range_max self.range_min = range_min self.coeff_type = coeff_type self.coefficient = coefficient super().__init__() def __str__(self): return '''\"{0}\" coefficient of value {1} is not in range {2} and {3}'''.format( self.coeff_type, self.coefficient, self.range_min, self.range_max) class InvalidImageArrayError(Exception): """ Class to throw exception when an image is not valid """ def __init__(self, image_type="PIL"): self.image_type = image_type super().__init__() def __str__(self): return "Image is not a {} Image".format(self.image_type) class CrucialValueNotFoundError(Exception): """ Class to throw exception when an expected value is not found """ def __init__(self, operation, value_type="sample"): self.value_type = value_type self.operation = operation super().__init__() def __str__(self): return "\"{0}\" value not found for the \"{1}\" mentioned".format( self.value_type, self.operation) class OperationNotFoundOrImplemented(Exception): """ Class to throw exception when an operation is not found """ def __init__(self, module, class_name): self.module = module self.class_name = class_name super().__init__() def __str__(self): return "\"{0}\" not found or implemented in the module \"{1}\"".format( self.class_name, self.module) class ConfigurationError(Exception): """ Class to throw exception when a configuration is not right """ def __init__(self, exception_string) -> None: self.exception_string = exception_string super().__init__() def __str__(self) -> str: return self.exception_string
class Coefficientnotinrangeerror(Exception): """ Class to throw exception when a coefficient is not in the specified range """ def __init__(self, coefficient, coeff_type='Default', range_min=0, range_max=1): self.range_max = range_max self.range_min = range_min self.coeff_type = coeff_type self.coefficient = coefficient super().__init__() def __str__(self): return '"{0}" coefficient of value {1} is not in range {2} and {3}'.format(self.coeff_type, self.coefficient, self.range_min, self.range_max) class Invalidimagearrayerror(Exception): """ Class to throw exception when an image is not valid """ def __init__(self, image_type='PIL'): self.image_type = image_type super().__init__() def __str__(self): return 'Image is not a {} Image'.format(self.image_type) class Crucialvaluenotfounderror(Exception): """ Class to throw exception when an expected value is not found """ def __init__(self, operation, value_type='sample'): self.value_type = value_type self.operation = operation super().__init__() def __str__(self): return '"{0}" value not found for the "{1}" mentioned'.format(self.value_type, self.operation) class Operationnotfoundorimplemented(Exception): """ Class to throw exception when an operation is not found """ def __init__(self, module, class_name): self.module = module self.class_name = class_name super().__init__() def __str__(self): return '"{0}" not found or implemented in the module "{1}"'.format(self.class_name, self.module) class Configurationerror(Exception): """ Class to throw exception when a configuration is not right """ def __init__(self, exception_string) -> None: self.exception_string = exception_string super().__init__() def __str__(self) -> str: return self.exception_string
class Solution: """ @param matrix: A 2D-array of integers @return: an integer """ def longestContinuousIncreasingSubsequence2(self, matrix): # write your code here if not matrix or not matrix[0]: return 0 m, n = len(matrix), len(matrix[0]) visited = [[0] * n for _ in range(m)] result = 0 for i in range(m): for j in range(n): self.dfs(matrix, i, j, visited) result = max(result, visited[i][j]) return result def dfs(self, matrix, i, j, visited): if visited[i][j] != 0: return visited[i][j] = 1 m, n = len(matrix), len(matrix[0]) dx = [0, 0, 1, -1] dy = [1, -1, 0, 0] for k in range(4): nx, ny = i + dx[k], j + dy[k] if 0 <= nx < len(matrix) and 0 <= ny < len(matrix[0]) and matrix[nx][ny] < matrix[i][j]: self.dfs(matrix, nx, ny, visited) visited[i][j] = max(visited[i][j], visited[nx][ny] + 1) # result = 1 # visited = [[-1] * len(matrix[0]) for _ in range(len(matrix))] # for i in range(len(matrix)): # for j in range(len(matrix[0])): # if visited[i][j] != -1: # result = max(visited[i][j], result) # continue # self.search(visited, matrix, i, j) # result = max(visited[i][j], result) # return result # def search(self, visited, matrix, x, y): # visited[x][y] = 1 # dx = [0, 0, -1, 1] # dy = [1, -1, 0, 0] # for i in range(4): # nx = dx[i] + x # ny = dy[i] + y # if 0 <= nx < len(matrix) and 0 <= ny < len(matrix[0]) and visited[nx][ny] == -1: # if matrix[x][y] > matrix[nx][ny]: # self.search(visited, matrix, nx, ny) # visited[x][y] = max(visited[x][y], visited[nx][ny] + 1)
class Solution: """ @param matrix: A 2D-array of integers @return: an integer """ def longest_continuous_increasing_subsequence2(self, matrix): if not matrix or not matrix[0]: return 0 (m, n) = (len(matrix), len(matrix[0])) visited = [[0] * n for _ in range(m)] result = 0 for i in range(m): for j in range(n): self.dfs(matrix, i, j, visited) result = max(result, visited[i][j]) return result def dfs(self, matrix, i, j, visited): if visited[i][j] != 0: return visited[i][j] = 1 (m, n) = (len(matrix), len(matrix[0])) dx = [0, 0, 1, -1] dy = [1, -1, 0, 0] for k in range(4): (nx, ny) = (i + dx[k], j + dy[k]) if 0 <= nx < len(matrix) and 0 <= ny < len(matrix[0]) and (matrix[nx][ny] < matrix[i][j]): self.dfs(matrix, nx, ny, visited) visited[i][j] = max(visited[i][j], visited[nx][ny] + 1)
__version__ = '0.0.7' def get_version(): return __version__
__version__ = '0.0.7' def get_version(): return __version__
# -*- coding: utf-8 -*- """ solace.views ~~~~~~~~~~~~ All the view functions are implemented in this package. :copyright: (c) 2009 by Plurk Inc., see AUTHORS for more details. :license: BSD, see LICENSE for more details. """
""" solace.views ~~~~~~~~~~~~ All the view functions are implemented in this package. :copyright: (c) 2009 by Plurk Inc., see AUTHORS for more details. :license: BSD, see LICENSE for more details. """
class BaseASHException(Exception): """A base exception handler for the ASH ecosystem.""" def __init__(self, *args): if args: self.message = args[0] else: self.message = self.__doc__ def __str__(self): return self.message class DuplicateObject(BaseASHException): """Raised because you attempted to create and add an object, using the exact same id's as a pre-existing one.""" class ObjectMismatch(BaseASHException): """Raised because you attempted add a message to a member, but that member didn't create that message.""" class LogicError(BaseASHException): """Raised because internal logic has failed. Please create an issue in the github.""" class MissingGuildPermissions(BaseASHException): """I need both permissions to kick & ban people from this guild in order to work!"""
class Baseashexception(Exception): """A base exception handler for the ASH ecosystem.""" def __init__(self, *args): if args: self.message = args[0] else: self.message = self.__doc__ def __str__(self): return self.message class Duplicateobject(BaseASHException): """Raised because you attempted to create and add an object, using the exact same id's as a pre-existing one.""" class Objectmismatch(BaseASHException): """Raised because you attempted add a message to a member, but that member didn't create that message.""" class Logicerror(BaseASHException): """Raised because internal logic has failed. Please create an issue in the github.""" class Missingguildpermissions(BaseASHException): """I need both permissions to kick & ban people from this guild in order to work!"""
#Question:1 # Initializing matrix matrix = [] # Taking input from user of rows and column row = int(input("Enter the number of rows:")) column = int(input("Enter the number of columns:")) print("Enter the elements row wise:") # Getting elements of matrix from user for i in range(row): a =[] for j in range (column): a.append(int(input())) matrix.append(a) print() # Printing user entered matrix print("Entered Matrix is: ") for i in range(row): for j in range(column): print(matrix[i][j], end = " ") print() print() #Printing prime numbers of matrix: print("The prime numbers in the matrix are: ") for i in range(row): for j in range(column): if( matrix[i][j] > 1): for p in range(2, matrix[i][j]): if(matrix[i][j] % p) == 0: break else: print(matrix[i][j])
matrix = [] row = int(input('Enter the number of rows:')) column = int(input('Enter the number of columns:')) print('Enter the elements row wise:') for i in range(row): a = [] for j in range(column): a.append(int(input())) matrix.append(a) print() print('Entered Matrix is: ') for i in range(row): for j in range(column): print(matrix[i][j], end=' ') print() print() print('The prime numbers in the matrix are: ') for i in range(row): for j in range(column): if matrix[i][j] > 1: for p in range(2, matrix[i][j]): if matrix[i][j] % p == 0: break else: print(matrix[i][j])
devices = \ { # ------------------------------------------------------------------------- # NXP ARM7TDMI devices Series LPC21xx, LPC22xx, LPC23xx, LPC24xx "lpc2129": { "defines": ["__ARM_LPC2000__"], "linkerscript": "arm7/lpc/linker/lpc2129.ld", "size": { "flash": 262144, "ram": 16384 }, }, "lpc2368": { "defines": ["__ARM_LPC2000__", "__ARM_LPC23_24__"], "linkerscript": "arm7/lpc/linker/lpc2368.ld", "size": { "flash": 524288, "ram": 32768 }, }, "lpc2468": { "defines": ["__ARM_LPC2000__", "__ARM_LPC23_24__"], "linkerscript": "arm7/lpc/linker/lpc2468.ld", "size": { "flash": 524288, "ram": 65536 }, }, # ------------------------------------------------------------------------- # NXP Cortex-M0 devices Series LPC11xx and LPC11Cxx "lpc1112_301": { "defines": ["__ARM_LPC11XX__",], "linkerscript": "cortex_m0/lpc/linker/lpc1112_301.ld", "size": { "flash": 16384, "ram": 8192 }, }, "lpc1114_301": { "defines": ["__ARM_LPC11XX__",], "linkerscript": "cortex_m0/lpc/linker/lpc1114_301.ld", "size": { "flash": 32768, "ram": 8192 }, }, "lpc1115_303": { "defines": ["__ARM_LPC11XX__",], "linkerscript": "cortex_m0/lpc/linker/lpc1115_303.ld", "size": { "flash": 65536, "ram": 8192 }, }, # Integrated CAN transceiver "lpc11c22_301": { "defines": ["__ARM_LPC11XX__", "__ARM_LPC11CXX__"], "linkerscript": "cortex_m0/lpc/linker/lpc11c22.ld", "size": { "flash": 16384, "ram": 8192 }, }, # Integrated CAN transceiver "lpc11c24_301": { "defines": ["__ARM_LPC11XX__", "__ARM_LPC11CXX__"], "linkerscript": "cortex_m0/lpc/linker/lpc11c24.ld", "size": { "flash": 32768, "ram": 8192 }, }, # ------------------------------------------------------------------------- # NXP Cortex-M3 devices Series LPC13xx # TODO # ------------------------------------------------------------------------- "lpc1343": { "defines": ["__ARM_LPC13XX__",], "linkerscript": "cortex_m3/lpc/linker/lpc1343.ld", "size": { "flash": 32768, "ram":8192 }, }, "lpc1769": { "defines": ["__ARM_LPC17XX__"], "linkerscript": "cortex_m3/lpc/linker/lpc1769.ld", "size": { "flash": 524288, "ram": 65536 }, # 32kB local SRAM + 2x16kB AHB SRAM }, # ------------------------------------------------------------------------- # AT91SAM7S "at91sam7s32": { "defines": ["__ARM_AT91__", "__ARM_AT91SAM7S__", "__ARM_AT91SAM7S32__"], "linkerscript": "arm7/at91/linker/at91sam7s32.ld", "size": { "flash": 32768, "ram": 4096 }, }, "at91sam7s321": { "defines": ["__ARM_AT91__", "__ARM_AT91SAM7S__", "__ARM_AT91SAM7S321__"], "linkerscript": "arm7/at91/linker/at91sam7s32.ld", "size": { "flash": 32768, "ram": 8192 }, }, "at91sam7s64": { "defines": ["__ARM_AT91__", "__ARM_AT91SAM7S__", "__ARM_AT91SAM7S64__"], "linkerscript": "arm7/at91/linker/at91sam7s64.ld", "size": { "flash": 65536, "ram": 16384 }, }, "at91sam7s128": { "defines": ["__ARM_AT91__", "__ARM_AT91SAM7S__", "__ARM_AT91SAM7S128__"], "linkerscript": "arm7/at91/linker/at91sam7s128.ld", "size": { "flash": 131072, "ram": 32768 }, }, "at91sam7s256": { "defines": ["__ARM_AT91__", "__ARM_AT91SAM7S__", "__ARM_AT91SAM7S256__"], "linkerscript": "arm7/at91/linker/at91sam7s256.ld", "size": { "flash": 262144, "ram": 65536 }, }, "at91sam7s512": { "defines": ["__ARM_AT91__", "__ARM_AT91SAM7S__", "__ARM_AT91SAM7S512__"], "linkerscript": "arm7/at91/linker/at91sam7s512.ld", "size": { "flash": 524288, "ram": 65536 }, }, # ------------------------------------------------------------------------- # AT91SAM7X "at91sam7x128": { "defines": ["__ARM_AT91__", "__ARM_AT91SAM7X__"], "linkerscript": "arm7/at91/linker/at91sam7x128.ld", "size": { "flash": 131072, "ram": 32768 }, }, "at91sam7x256": { "defines": ["__ARM_AT91__", "__ARM_AT91SAM7X__"], "linkerscript": "arm7/at91/linker/at91sam7x256.ld", "size": { "flash": 262144, "ram": 65536 }, }, "at91sam7x512": { "defines": ["__ARM_AT91__", "__ARM_AT91SAM7X__"], "linkerscript": "arm7/at91/linker/at91sam7x512.ld", "size": { "flash": 524288, "ram": 131072 }, }, # ------------------------------------------------------------------------- # STM32F103 p s # # Pins (p): # T | 36 pins # C | 48 pins # R | 64 pins # V | 100 pins # Z | 144 pins # # Size (s): # 4 | 16 kB Flash, 6 kB RAM low density line (T, C, R) # 6 | 32 kB Flash, 10 kB RAM # 8 | 64 kB Flash, 20 kB RAM medium density (T, C, R, V) # B | 128 kB Flash, 20 kB RAM # C | 256 kB Flash, 48 kB RAM high density (R, V, Z) # D | 384 kB Flash, 64 kB RAM # E | 512 kB Flash, 64 kB RAM # F | 768 kB Flash, 96 kB RAM xl density (R, V, Z) # G | 1 MB Flash, 96 kB RAM # "stm32f103_4": { "defines": ["__STM32F103__", "__ARM_STM32__", "STM32F10X", "STM32F10X_LD", "STM32_LOW_DENSITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f103_4.ld", "size": { "flash": 16384, "ram": 6144 }, }, "stm32f103_6": { "defines": ["__STM32F103__", "__ARM_STM32__", "STM32F10X", "STM32F10X_LD", "STM32_LOW_DENSITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f103_6.ld", "size": { "flash": 32768, "ram": 10240 }, }, "stm32f103_8": { "defines": ["__STM32F103__", "__ARM_STM32__", "STM32F10X", "STM32F10X_MD", "STM32_MEDIUM_DENSITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f103_8.ld", "size": { "flash": 65536, "ram": 20480 }, }, "stm32f103_b": { "defines": ["__STM32F103__", "__ARM_STM32__", "STM32F10X", "STM32F10X_MD", "STM32_MEDIUM_DENSITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f103_b.ld", "size": { "flash": 131072, "ram": 20480 }, }, "stm32f103_c": { "defines": ["__STM32F103__", "__ARM_STM32__", "STM32F10X", "STM32F10X_HD", "STM32_HIGH_DENSITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f103_c.ld", "size": { "flash": 262144, "ram": 49152 }, }, "stm32f103_d": { "defines": ["__STM32F103__", "__ARM_STM32__", "STM32F10X", "STM32F10X_HD", "STM32_HIGH_DENSITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f103_d.ld", "size": { "flash": 393216, "ram": 65536 }, }, "stm32f103_e": { "defines": ["__STM32F103__", "__ARM_STM32__", "STM32F10X", "STM32F10X_HD", "STM32_HIGH_DENSITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f103_e.ld", "size": { "flash": 524288, "ram": 65536 }, }, "stm32f103_f": { "defines": ["__STM32F103__", "__ARM_STM32__", "STM32F10X", "STM32F10X_XL", "STM32_XL_DENSITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f103_f.ld", "size": { "flash": 786432, "ram": 98304 }, }, "stm32f103_g": { "defines": ["__STM32F103__", "__ARM_STM32__", "STM32F10X", "STM32F10X_XL", "STM32_XL_DENSITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f103_g.ld", "size": { "flash": 1048576, "ram": 98304 }, }, # STM32F105 p s (pins: R, V) # # Size (s): # 8 | 64 kB Flash, 20 kB RAM # B | 128 kB Flash, 32 kB RAM # C | 256 kB Flash, 64 kB RAM # "stm32f105_8": { "defines": ["__STM32F105__", "__ARM_STM32__", "STM32F10X", "STM32F10X_CL", "STM32_CONNECTIVITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f105_8.ld", "size": { "flash": 65536, "ram": 20480 }, }, "stm32f105_b": { "defines": ["__STM32F105__", "__ARM_STM32__", "STM32F10X", "STM32F10X_CL", "STM32_CONNECTIVITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f105_b.ld", "size": { "flash": 131072, "ram": 32768 }, }, "stm32f105_c": { "defines": ["__STM32F105__", "__ARM_STM32__", "STM32F10X", "STM32F10X_CL", "STM32_CONNECTIVITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f105_c.ld", "size": { "flash": 262144, "ram": 65536 }, }, # STM32F107 p s (pins: R, V) # # Size (s): # B | 128 kB Flash, 48 kB RAM # C | 256 kB Flash, 64 kB RAM # "stm32f107_b": { "defines": ["__STM32F107__", "__ARM_STM32__", "STM32F10X", "STM32F10X_CL", "STM32_CONNECTIVITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f107_b.ld", "size": { "flash": 131072, "ram": 49152 }, }, "stm32f107_c": { "defines": ["__STM32F107__", "__ARM_STM32__", "STM32F10X", "STM32F10X_CL", "STM32_CONNECTIVITY"], "linkerscript": "cortex_m3/stm32/linker/stm32f107_c.ld", "size": { "flash": 262144, "ram": 65536 }, }, # ------------------------------------------------------------------------- # STM32F205 p s # # Pins (p): # R | 64 pins # V | 100 pins # Z | 144 pins # # Size (s): # B | 128 kB Flash, 48+16 kB RAM (R, V) # C | 256 kB Flash, 80+16 kB RAM (R, V, Z) # E | 512 kB Flash, 112+16 kB RAM (R, V, Z) # F | 768 kB Flash, 112+16 kB RAM (R, V, Z) # G | 1 MB Flash, 112+16 kB RAM (R, V, Z) # "stm32f205_b": { "defines": ["__STM32F205__", "__ARM_STM32__", "STM32F2XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f205_b.ld", "size": { "flash": 131072, "ram": 49152 }, }, "stm32f205_c": { "defines": ["__STM32F205__", "__ARM_STM32__", "STM32F2XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f205_c.ld", "size": { "flash": 262144, "ram": 81920 }, }, "stm32f205_e": { "defines": ["__STM32F205__", "__ARM_STM32__", "STM32F2XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f205_e.ld", "size": { "flash": 524288, "ram": 114688 }, }, "stm32f205_f": { "defines": ["__STM32F205__", "__ARM_STM32__", "STM32F2XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f205_f.ld", "size": { "flash": 786432, "ram": 114688 }, }, "stm32f205_g": { "defines": ["__STM32F205__", "__ARM_STM32__", "STM32F2XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f205_g.ld", "size": { "flash": 1048576, "ram": 114688 }, }, # STM32F207 p s # # Pins (p): # V | 100 pins # Z | 144 pins # I | 176 pins # # Size (s): # C | 256 kB Flash, 112+16 kB RAM # E | 512 kB Flash, 112+16 kB RAM # F | 768 kB Flash, 112+16 kB RAM # G | 1 MB Flash, 112+16 kB RAM # "stm32f207_c": { "defines": ["__STM32F207__", "__ARM_STM32__", "STM32F2XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f207_c.ld", "size": { "flash": 262144, "ram": 114688 }, }, "stm32f207_e": { "defines": ["__STM32F207__", "__ARM_STM32__", "STM32F2XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f207_e.ld", "size": { "flash": 524288, "ram": 114688 }, }, "stm32f207_f": { "defines": ["__STM32F207__", "__ARM_STM32__", "STM32F2XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f207_f.ld", "size": { "flash": 786432, "ram": 114688 }, }, "stm32f207_g": { "defines": ["__STM32F207__", "__ARM_STM32__", "STM32F2XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f207_g.ld", "size": { "flash": 1048576, "ram": 114688 }, }, # ------------------------------------------------------------------------- # STM32F405 p s # # Pins (p): # R | 64 pins # V | 100 pins # Z | 144 pins # # Size (s): # G | 1 MB Flash, 112+64+16 kB RAM # "stm32f405_g": { "defines": ["__STM32F405__", "__ARM_STM32__", "STM32F4XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f4xx_g.ld", "size": { "flash": 1048576, "ram": 114688 }, }, # STM32F407 p s # # Pins (p): # V | 100 pins # Z | 144 pins # I | 176 pins # # Size (s): # E | 512 kB Flash, 112+64+16 kB RAM # G | 1 MB Flash, 112+64+16 kB RAM # "stm32f407_e": { "defines": ["__STM32F407__", "__ARM_STM32__", "STM32F4XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f4xx_e.ld", "size": { "flash": 524288, "ram": 114688 }, }, "stm32f407_g": { "defines": ["__STM32F407__", "__ARM_STM32__", "STM32F4XX"], "linkerscript": "cortex_m3/stm32/linker/stm32f4xx_g.ld", "size": { "flash": 1048576, "ram": 114688 }, }, # ------------------------------------------------------------------------- # STM32 F3 Series # ARM Cortex-M4F MCU + FPU # STM32F302 p s # # Pins (p): # C | 48 pins # R | 64 pins # V | 100 pins # # Size (s): # B | 128 kB Flash, 8 + 40 kB RAM # C | 256 kB Flash, 8 + 40 kB RAM # "stm32f303_b": { "defines": ["__STM32F303__", "__ARM_STM32__", "STM32F3XX", "STM32F30X"], "linkerscript": "cortex_m3/stm32/linker/stm32f3xx_b.ld", "size": { "flash": 131072, "ram": 40960 }, }, "stm32f303_c": { "defines": ["__STM32F303__", "__ARM_STM32__", "STM32F3XX", "STM32F30X"], "linkerscript": "cortex_m3/stm32/linker/stm32f3xx_c.ld", "size": { "flash": 262144, "ram": 40960 }, }, }
devices = {'lpc2129': {'defines': ['__ARM_LPC2000__'], 'linkerscript': 'arm7/lpc/linker/lpc2129.ld', 'size': {'flash': 262144, 'ram': 16384}}, 'lpc2368': {'defines': ['__ARM_LPC2000__', '__ARM_LPC23_24__'], 'linkerscript': 'arm7/lpc/linker/lpc2368.ld', 'size': {'flash': 524288, 'ram': 32768}}, 'lpc2468': {'defines': ['__ARM_LPC2000__', '__ARM_LPC23_24__'], 'linkerscript': 'arm7/lpc/linker/lpc2468.ld', 'size': {'flash': 524288, 'ram': 65536}}, 'lpc1112_301': {'defines': ['__ARM_LPC11XX__'], 'linkerscript': 'cortex_m0/lpc/linker/lpc1112_301.ld', 'size': {'flash': 16384, 'ram': 8192}}, 'lpc1114_301': {'defines': ['__ARM_LPC11XX__'], 'linkerscript': 'cortex_m0/lpc/linker/lpc1114_301.ld', 'size': {'flash': 32768, 'ram': 8192}}, 'lpc1115_303': {'defines': ['__ARM_LPC11XX__'], 'linkerscript': 'cortex_m0/lpc/linker/lpc1115_303.ld', 'size': {'flash': 65536, 'ram': 8192}}, 'lpc11c22_301': {'defines': ['__ARM_LPC11XX__', '__ARM_LPC11CXX__'], 'linkerscript': 'cortex_m0/lpc/linker/lpc11c22.ld', 'size': {'flash': 16384, 'ram': 8192}}, 'lpc11c24_301': {'defines': ['__ARM_LPC11XX__', '__ARM_LPC11CXX__'], 'linkerscript': 'cortex_m0/lpc/linker/lpc11c24.ld', 'size': {'flash': 32768, 'ram': 8192}}, 'lpc1343': {'defines': ['__ARM_LPC13XX__'], 'linkerscript': 'cortex_m3/lpc/linker/lpc1343.ld', 'size': {'flash': 32768, 'ram': 8192}}, 'lpc1769': {'defines': ['__ARM_LPC17XX__'], 'linkerscript': 'cortex_m3/lpc/linker/lpc1769.ld', 'size': {'flash': 524288, 'ram': 65536}}, 'at91sam7s32': {'defines': ['__ARM_AT91__', '__ARM_AT91SAM7S__', '__ARM_AT91SAM7S32__'], 'linkerscript': 'arm7/at91/linker/at91sam7s32.ld', 'size': {'flash': 32768, 'ram': 4096}}, 'at91sam7s321': {'defines': ['__ARM_AT91__', '__ARM_AT91SAM7S__', '__ARM_AT91SAM7S321__'], 'linkerscript': 'arm7/at91/linker/at91sam7s32.ld', 'size': {'flash': 32768, 'ram': 8192}}, 'at91sam7s64': {'defines': ['__ARM_AT91__', '__ARM_AT91SAM7S__', '__ARM_AT91SAM7S64__'], 'linkerscript': 'arm7/at91/linker/at91sam7s64.ld', 'size': {'flash': 65536, 'ram': 16384}}, 'at91sam7s128': {'defines': ['__ARM_AT91__', '__ARM_AT91SAM7S__', '__ARM_AT91SAM7S128__'], 'linkerscript': 'arm7/at91/linker/at91sam7s128.ld', 'size': {'flash': 131072, 'ram': 32768}}, 'at91sam7s256': {'defines': ['__ARM_AT91__', '__ARM_AT91SAM7S__', '__ARM_AT91SAM7S256__'], 'linkerscript': 'arm7/at91/linker/at91sam7s256.ld', 'size': {'flash': 262144, 'ram': 65536}}, 'at91sam7s512': {'defines': ['__ARM_AT91__', '__ARM_AT91SAM7S__', '__ARM_AT91SAM7S512__'], 'linkerscript': 'arm7/at91/linker/at91sam7s512.ld', 'size': {'flash': 524288, 'ram': 65536}}, 'at91sam7x128': {'defines': ['__ARM_AT91__', '__ARM_AT91SAM7X__'], 'linkerscript': 'arm7/at91/linker/at91sam7x128.ld', 'size': {'flash': 131072, 'ram': 32768}}, 'at91sam7x256': {'defines': ['__ARM_AT91__', '__ARM_AT91SAM7X__'], 'linkerscript': 'arm7/at91/linker/at91sam7x256.ld', 'size': {'flash': 262144, 'ram': 65536}}, 'at91sam7x512': {'defines': ['__ARM_AT91__', '__ARM_AT91SAM7X__'], 'linkerscript': 'arm7/at91/linker/at91sam7x512.ld', 'size': {'flash': 524288, 'ram': 131072}}, 'stm32f103_4': {'defines': ['__STM32F103__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_LD', 'STM32_LOW_DENSITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f103_4.ld', 'size': {'flash': 16384, 'ram': 6144}}, 'stm32f103_6': {'defines': ['__STM32F103__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_LD', 'STM32_LOW_DENSITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f103_6.ld', 'size': {'flash': 32768, 'ram': 10240}}, 'stm32f103_8': {'defines': ['__STM32F103__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_MD', 'STM32_MEDIUM_DENSITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f103_8.ld', 'size': {'flash': 65536, 'ram': 20480}}, 'stm32f103_b': {'defines': ['__STM32F103__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_MD', 'STM32_MEDIUM_DENSITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f103_b.ld', 'size': {'flash': 131072, 'ram': 20480}}, 'stm32f103_c': {'defines': ['__STM32F103__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_HD', 'STM32_HIGH_DENSITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f103_c.ld', 'size': {'flash': 262144, 'ram': 49152}}, 'stm32f103_d': {'defines': ['__STM32F103__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_HD', 'STM32_HIGH_DENSITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f103_d.ld', 'size': {'flash': 393216, 'ram': 65536}}, 'stm32f103_e': {'defines': ['__STM32F103__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_HD', 'STM32_HIGH_DENSITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f103_e.ld', 'size': {'flash': 524288, 'ram': 65536}}, 'stm32f103_f': {'defines': ['__STM32F103__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_XL', 'STM32_XL_DENSITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f103_f.ld', 'size': {'flash': 786432, 'ram': 98304}}, 'stm32f103_g': {'defines': ['__STM32F103__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_XL', 'STM32_XL_DENSITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f103_g.ld', 'size': {'flash': 1048576, 'ram': 98304}}, 'stm32f105_8': {'defines': ['__STM32F105__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_CL', 'STM32_CONNECTIVITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f105_8.ld', 'size': {'flash': 65536, 'ram': 20480}}, 'stm32f105_b': {'defines': ['__STM32F105__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_CL', 'STM32_CONNECTIVITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f105_b.ld', 'size': {'flash': 131072, 'ram': 32768}}, 'stm32f105_c': {'defines': ['__STM32F105__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_CL', 'STM32_CONNECTIVITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f105_c.ld', 'size': {'flash': 262144, 'ram': 65536}}, 'stm32f107_b': {'defines': ['__STM32F107__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_CL', 'STM32_CONNECTIVITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f107_b.ld', 'size': {'flash': 131072, 'ram': 49152}}, 'stm32f107_c': {'defines': ['__STM32F107__', '__ARM_STM32__', 'STM32F10X', 'STM32F10X_CL', 'STM32_CONNECTIVITY'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f107_c.ld', 'size': {'flash': 262144, 'ram': 65536}}, 'stm32f205_b': {'defines': ['__STM32F205__', '__ARM_STM32__', 'STM32F2XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f205_b.ld', 'size': {'flash': 131072, 'ram': 49152}}, 'stm32f205_c': {'defines': ['__STM32F205__', '__ARM_STM32__', 'STM32F2XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f205_c.ld', 'size': {'flash': 262144, 'ram': 81920}}, 'stm32f205_e': {'defines': ['__STM32F205__', '__ARM_STM32__', 'STM32F2XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f205_e.ld', 'size': {'flash': 524288, 'ram': 114688}}, 'stm32f205_f': {'defines': ['__STM32F205__', '__ARM_STM32__', 'STM32F2XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f205_f.ld', 'size': {'flash': 786432, 'ram': 114688}}, 'stm32f205_g': {'defines': ['__STM32F205__', '__ARM_STM32__', 'STM32F2XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f205_g.ld', 'size': {'flash': 1048576, 'ram': 114688}}, 'stm32f207_c': {'defines': ['__STM32F207__', '__ARM_STM32__', 'STM32F2XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f207_c.ld', 'size': {'flash': 262144, 'ram': 114688}}, 'stm32f207_e': {'defines': ['__STM32F207__', '__ARM_STM32__', 'STM32F2XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f207_e.ld', 'size': {'flash': 524288, 'ram': 114688}}, 'stm32f207_f': {'defines': ['__STM32F207__', '__ARM_STM32__', 'STM32F2XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f207_f.ld', 'size': {'flash': 786432, 'ram': 114688}}, 'stm32f207_g': {'defines': ['__STM32F207__', '__ARM_STM32__', 'STM32F2XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f207_g.ld', 'size': {'flash': 1048576, 'ram': 114688}}, 'stm32f405_g': {'defines': ['__STM32F405__', '__ARM_STM32__', 'STM32F4XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f4xx_g.ld', 'size': {'flash': 1048576, 'ram': 114688}}, 'stm32f407_e': {'defines': ['__STM32F407__', '__ARM_STM32__', 'STM32F4XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f4xx_e.ld', 'size': {'flash': 524288, 'ram': 114688}}, 'stm32f407_g': {'defines': ['__STM32F407__', '__ARM_STM32__', 'STM32F4XX'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f4xx_g.ld', 'size': {'flash': 1048576, 'ram': 114688}}, 'stm32f303_b': {'defines': ['__STM32F303__', '__ARM_STM32__', 'STM32F3XX', 'STM32F30X'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f3xx_b.ld', 'size': {'flash': 131072, 'ram': 40960}}, 'stm32f303_c': {'defines': ['__STM32F303__', '__ARM_STM32__', 'STM32F3XX', 'STM32F30X'], 'linkerscript': 'cortex_m3/stm32/linker/stm32f3xx_c.ld', 'size': {'flash': 262144, 'ram': 40960}}}
WALK_UP = 4 WALK_DOWN = 3 WALK_RIGHT = 2 WALK_LEFT = 1 NO_OP = 0 SHOOT = 5 WALK_ACTIONS = [WALK_UP, WALK_DOWN, WALK_RIGHT, WALK_LEFT] ACTIONS = [NO_OP, WALK_LEFT, WALK_RIGHT, WALK_DOWN, WALK_UP, SHOOT]
walk_up = 4 walk_down = 3 walk_right = 2 walk_left = 1 no_op = 0 shoot = 5 walk_actions = [WALK_UP, WALK_DOWN, WALK_RIGHT, WALK_LEFT] actions = [NO_OP, WALK_LEFT, WALK_RIGHT, WALK_DOWN, WALK_UP, SHOOT]
# Day Six: Lanternfish file = open("input/06.txt").readlines() ages = [] for num in file[0].split(","): ages.append(int(num)) for day in range(80): for i, fish in enumerate(ages): if fish == 0: ages[i] = 6 ages.append(9) else: ages[i] = fish-1 print(len(ages)) # ages: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ages = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for num in file[0].split(","): ages[int(num)] += 1 for day in range(256): for i, age in enumerate(ages): if i == 0: ages[7] += ages[0] ages[9] += ages[0] ages[0] -= ages[0] else: ages[i-1] += ages[i] ages[i] -= ages[i] print(sum(ages))
file = open('input/06.txt').readlines() ages = [] for num in file[0].split(','): ages.append(int(num)) for day in range(80): for (i, fish) in enumerate(ages): if fish == 0: ages[i] = 6 ages.append(9) else: ages[i] = fish - 1 print(len(ages)) ages = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for num in file[0].split(','): ages[int(num)] += 1 for day in range(256): for (i, age) in enumerate(ages): if i == 0: ages[7] += ages[0] ages[9] += ages[0] ages[0] -= ages[0] else: ages[i - 1] += ages[i] ages[i] -= ages[i] print(sum(ages))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # https://leetcode.com/problems/subarray-sum-equals-k/description/ # I think it is a sub-problem of: https://leetcode.com/problems/path-sum-iii/description/ class Solution(object): def subarraySum(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ counts = {0:1} sofar = 0 ret = 0 for num in nums: sofar += num complement = sofar - k ret += counts.get(complement, 0) counts.setdefault(sofar, 0) counts[sofar] += 1 return ret solution = Solution() assert solution.subarraySum([1,1,1], 2) == 2
class Solution(object): def subarray_sum(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ counts = {0: 1} sofar = 0 ret = 0 for num in nums: sofar += num complement = sofar - k ret += counts.get(complement, 0) counts.setdefault(sofar, 0) counts[sofar] += 1 return ret solution = solution() assert solution.subarraySum([1, 1, 1], 2) == 2
# Time: O(nlogn) # Space: O(n) class Solution(object): def relativeSortArray(self, arr1, arr2): """ :type arr1: List[int] :type arr2: List[int] :rtype: List[int] """ lookup = {v: i for i, v in enumerate(arr2)} return sorted(arr1, key=lambda i: lookup.get(i, len(arr2)+i))
class Solution(object): def relative_sort_array(self, arr1, arr2): """ :type arr1: List[int] :type arr2: List[int] :rtype: List[int] """ lookup = {v: i for (i, v) in enumerate(arr2)} return sorted(arr1, key=lambda i: lookup.get(i, len(arr2) + i))
#Horas-minutos e Segundos valor = int(input()) horas = 0 minutos = 0 segundos = 0 valorA = valor contador = segundos while(contador <= valorA): if contador > 0: segundos += 1 if segundos >= 60: minutos += 1 segundos = 0 if minutos >= 60: horas += 1 minutos = 0 contador+=1 print("{}:{}:{}".format(horas,minutos,segundos))
valor = int(input()) horas = 0 minutos = 0 segundos = 0 valor_a = valor contador = segundos while contador <= valorA: if contador > 0: segundos += 1 if segundos >= 60: minutos += 1 segundos = 0 if minutos >= 60: horas += 1 minutos = 0 contador += 1 print('{}:{}:{}'.format(horas, minutos, segundos))
#!/usr/bin/env python # Author: Omid Mashayekhi <[email protected]> # ssh -i ~/.ssh/omidm-sing-key-pair-us-west-2.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@<ip> # US West (Northern California) Region # EC2_LOCATION = 'us-west-1' # NIMBUS_AMI = 'ami-50201815' # UBUNTU_AMI = 'ami-660c3023' # KEY_NAME = 'omidm-sing-key-pair-us-west-1' # SECURITY_GROUP = 'nimbus_sg_uswest1' # EC2 configurations # US West (Oregon) Region EC2_LOCATION = 'us-west-2' UBUNTU_AMI = 'ami-fa9cf1ca' NIMBUS_AMI = 'ami-4f5c392f' CONTROLLER_INSTANCE_TYPE = 'c3.4xlarge' WORKER_INSTANCE_TYPE = 'c3.2xlarge' PLACEMENT = 'us-west-2a' # None PLACEMENT_GROUP = 'nimbus-cluster' # None / '*' SECURITY_GROUP = 'nimbus_sg_uswest2' KEY_NAME = 'sing-key-pair-us-west-2' PRIVATE_KEY = '/home/omidm/.ssh/' + KEY_NAME + '.pem' CONTROLLER_NUM = 1 WORKER_NUM = 100 #Environment variables DBG_MODE = 'warn' # 'error' TTIMER_LEVEL = 'l1' # 'l0' # Controller configurations ASSIGNER_THREAD_NUM = 8 BATCH_ASSIGN_NUM = 200 COMMAND_BATCH_SIZE = 10000 DEACTIVATE_CONTROLLER_TEMPLATE = False DEACTIVATE_COMPLEX_MEMOIZATION = False DEACTIVATE_BINDING_MEMOIZATION = False DEACTIVATE_WORKER_TEMPLATE = False DEACTIVATE_MEGA_RCR_JOB = False DEACTIVATE_CASCADED_BINDING = False ACTIVATE_LB = False ACTIVATE_FT = False LB_PERIOD = 60 FT_PERIOD = 600 FIRST_PORT = 5800 SPLIT_ARGS = str(WORKER_NUM) + ' 1 1' # '2 2 2' '4 4 4' # Worker configurations OTHREAD_NUM = 8 APPLICATION = 'lr' # 'lr' 'k-means' 'water' 'heat' DEACTIVATE_EXECUTION_TEMPLATE = False DEACTIVATE_CACHE_MANAGER = False DEACTIVATE_VDATA_MANAGER = False DISABLE_HYPERTHREADING = False RUN_WITH_TASKSET = False WORKER_TASKSET = '0-1,4-5' # '0-3,8-11' # Application configurations # lr and k-means DIMENSION = 10 CLUSTER_NUM = 2 ITERATION_NUM = 30 PARTITION_PER_CORE = 10 PARTITION_NUM = WORKER_NUM * OTHREAD_NUM * PARTITION_PER_CORE # 8000 REDUCTION_PARTITION_NUM = WORKER_NUM SAMPLE_NUM_M = 544 # PARTITION_NUM / 1000000.0 SPIN_WAIT_US = 0 # 4000 # 4000 * (100 / WORKER_NUM) DEACTIVATE_AUTOMATIC_REDUCTION = True DEACTIVATE_REDUCTION_COMBINER = False # water SIMULATION_SCALE = 512 PART_X = 4 PART_Y = 4 PART_Z = 4 PROJ_PART_X = 4 PROJ_PART_Y = 4 PROJ_PART_Z = 4 FRAME_NUMBER = 1 ITERATION_BATCH = 1 MAX_ITERATION = 100 WATER_LEVEL = 0.35 PROJECTION_SMART_LEVEL = 0 NO_PROJ_BOTTLENECK = False GLOBAL_WRITE = False # heat ITER_NUM = 30 NX = 800 NY = 800 NZ = 800 PNX = 2 PNY = 2 PNZ = 2 BW = 1 SW_US = 0
ec2_location = 'us-west-2' ubuntu_ami = 'ami-fa9cf1ca' nimbus_ami = 'ami-4f5c392f' controller_instance_type = 'c3.4xlarge' worker_instance_type = 'c3.2xlarge' placement = 'us-west-2a' placement_group = 'nimbus-cluster' security_group = 'nimbus_sg_uswest2' key_name = 'sing-key-pair-us-west-2' private_key = '/home/omidm/.ssh/' + KEY_NAME + '.pem' controller_num = 1 worker_num = 100 dbg_mode = 'warn' ttimer_level = 'l1' assigner_thread_num = 8 batch_assign_num = 200 command_batch_size = 10000 deactivate_controller_template = False deactivate_complex_memoization = False deactivate_binding_memoization = False deactivate_worker_template = False deactivate_mega_rcr_job = False deactivate_cascaded_binding = False activate_lb = False activate_ft = False lb_period = 60 ft_period = 600 first_port = 5800 split_args = str(WORKER_NUM) + ' 1 1' othread_num = 8 application = 'lr' deactivate_execution_template = False deactivate_cache_manager = False deactivate_vdata_manager = False disable_hyperthreading = False run_with_taskset = False worker_taskset = '0-1,4-5' dimension = 10 cluster_num = 2 iteration_num = 30 partition_per_core = 10 partition_num = WORKER_NUM * OTHREAD_NUM * PARTITION_PER_CORE reduction_partition_num = WORKER_NUM sample_num_m = 544 spin_wait_us = 0 deactivate_automatic_reduction = True deactivate_reduction_combiner = False simulation_scale = 512 part_x = 4 part_y = 4 part_z = 4 proj_part_x = 4 proj_part_y = 4 proj_part_z = 4 frame_number = 1 iteration_batch = 1 max_iteration = 100 water_level = 0.35 projection_smart_level = 0 no_proj_bottleneck = False global_write = False iter_num = 30 nx = 800 ny = 800 nz = 800 pnx = 2 pny = 2 pnz = 2 bw = 1 sw_us = 0
# SPDX-FileCopyrightText: Aresys S.r.l. <[email protected]> # SPDX-License-Identifier: MIT """ Constants module ---------------- Example of usage: .. code-block:: python import arepytools.constants as cst print(cst.LIGHT_SPEED) """ # Speed of light LIGHT_SPEED = 299792458.0 """ Speed of light in vacuum (m/s). """ # Units of measure SECOND_STR = 's' """ Second symbol. """ HERTZ_STR = 'Hz' """ Hertz symbol. """ JOULE_STR = 'j' """ Joule symbol. """ DEGREE_STR = 'deg' """ Degree symbol. """ RAD_STR = 'rad' """ Radian symbol. """ UTC_STR = 'Utc' """ Coordinated Universal Time abbreviation. """ METER_STR = 'm' """ Meter symbol. """ # Metric prefixes KILO = 1e3 """ Number of units in one kilounit (kilounits-to-units conversion factor). """ MEGA = KILO**2 """ Number of units in one megaunit (megaunits-to-units conversion factor). """ GIGA = KILO**3 """ Number of units in one gigaunit (gigaunits-to-units conversion factor). """ MILLI = KILO**-1 """ Number of units in one milliunit (milliunits-to-units conversion factor). """ MICRO = KILO**-2 """ Number of units in one microunit (microunits-to-units conversion factor). """ NANO = KILO**-3 """ Number of units in one nanounit (nanounits-to-units conversion factor). """ PICO = KILO**-4 """ Number of units in one picounit (picounits-to-units conversion factor). """
""" Constants module ---------------- Example of usage: .. code-block:: python import arepytools.constants as cst print(cst.LIGHT_SPEED) """ light_speed = 299792458.0 '\nSpeed of light in vacuum (m/s).\n' second_str = 's' '\nSecond symbol.\n' hertz_str = 'Hz' '\nHertz symbol.\n' joule_str = 'j' '\nJoule symbol.\n' degree_str = 'deg' '\nDegree symbol.\n' rad_str = 'rad' '\nRadian symbol.\n' utc_str = 'Utc' '\nCoordinated Universal Time abbreviation.\n' meter_str = 'm' '\nMeter symbol.\n' kilo = 1000.0 '\nNumber of units in one kilounit (kilounits-to-units conversion factor).\n' mega = KILO ** 2 '\nNumber of units in one megaunit (megaunits-to-units conversion factor).\n' giga = KILO ** 3 '\nNumber of units in one gigaunit (gigaunits-to-units conversion factor).\n' milli = KILO ** (-1) '\nNumber of units in one milliunit (milliunits-to-units conversion factor).\n' micro = KILO ** (-2) '\nNumber of units in one microunit (microunits-to-units conversion factor).\n' nano = KILO ** (-3) '\nNumber of units in one nanounit (nanounits-to-units conversion factor).\n' pico = KILO ** (-4) '\nNumber of units in one picounit (picounits-to-units conversion factor).\n'
# Copyright: 2006 Marien Zwart <[email protected]> # License: BSD/GPL2 #base class __all__ = ("PackageError", "InvalidPackageName", "MetadataException", "InvalidDependency", "ChksumBase", "MissingChksum", "ParseChksumError") class PackageError(ValueError): pass class InvalidPackageName(PackageError): pass class MetadataException(PackageError): def __init__(self, pkg, attr, error): Exception.__init__(self, "Metadata Exception: pkg %s, attr %s\nerror: %s" % (pkg, attr, error)) self.pkg, self.attr, self.error = pkg, attr, error class InvalidDependency(PackageError): pass class ChksumBase(Exception): pass class MissingChksum(ChksumBase): def __init__(self, filename): ChksumBase.__init__(self, "Missing chksum data for %r" % filename) self.file = filename class ParseChksumError(ChksumBase): def __init__(self, filename, error, missing=False): if missing: ChksumBase.__init__(self, "Failed parsing %r chksum; data isn't available: %s" % (filename, error)) else: ChksumBase.__init__(self, "Failed parsing %r chksum due to %s" % (filename, error)) self.file = filename self.error = error self.missing = missing
__all__ = ('PackageError', 'InvalidPackageName', 'MetadataException', 'InvalidDependency', 'ChksumBase', 'MissingChksum', 'ParseChksumError') class Packageerror(ValueError): pass class Invalidpackagename(PackageError): pass class Metadataexception(PackageError): def __init__(self, pkg, attr, error): Exception.__init__(self, 'Metadata Exception: pkg %s, attr %s\nerror: %s' % (pkg, attr, error)) (self.pkg, self.attr, self.error) = (pkg, attr, error) class Invaliddependency(PackageError): pass class Chksumbase(Exception): pass class Missingchksum(ChksumBase): def __init__(self, filename): ChksumBase.__init__(self, 'Missing chksum data for %r' % filename) self.file = filename class Parsechksumerror(ChksumBase): def __init__(self, filename, error, missing=False): if missing: ChksumBase.__init__(self, "Failed parsing %r chksum; data isn't available: %s" % (filename, error)) else: ChksumBase.__init__(self, 'Failed parsing %r chksum due to %s' % (filename, error)) self.file = filename self.error = error self.missing = missing
# # PySNMP MIB module CISCO-ENTITY-ASSET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ENTITY-ASSET-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:56:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") entPhysicalIndex, = mibBuilder.importSymbols("ENTITY-MIB", "entPhysicalIndex") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") ModuleIdentity, IpAddress, iso, MibIdentifier, NotificationType, Counter64, Gauge32, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, ObjectIdentity, TimeTicks, Counter32, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "IpAddress", "iso", "MibIdentifier", "NotificationType", "Counter64", "Gauge32", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "ObjectIdentity", "TimeTicks", "Counter32", "Integer32") TextualConvention, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString") ciscoEntityAssetMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 92)) ciscoEntityAssetMIB.setRevisions(('2003-09-18 00:00', '2002-07-23 16:00', '1999-06-02 16:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoEntityAssetMIB.setRevisionsDescriptions(('Some of the Objects have been deprecated since these are available in ENTITY-MIB(RFC 2737). 1. Following Objects have been deprecated. ceAssetOEMString : superceded by entPhysicalMfgName ceAssetSerialNumber : superceded by entPhysicalSerialNum ceAssetOrderablePartNumber: superceded by entPhysicalModelName ceAssetHardwareRevision : superceded by entPhysicalHardwareRev ceAssetFirmwareID : superceded by entPhysicalFirmwareRev ceAssetFirmwareRevision : superceded by entPhysicalFirmwareRev ceAssetSoftwareID : superceded by entPhysicalSoftwareRev ceAssetSoftwareRevision : superceded by entPhysicalSoftwareRev ceAssetAlias : superceded by entPhysicalAlias ceAssetTag : superceded by entPhysicalAssetID ceAssetIsFRU : superceded by entPhysicalIsFRU. 2. ceAssetEntityGroup has been deprecated.', 'Split the MIB objects of this MIB into two object groups.', 'Initial version of this MIB module.',)) if mibBuilder.loadTexts: ciscoEntityAssetMIB.setLastUpdated('200309180000Z') if mibBuilder.loadTexts: ciscoEntityAssetMIB.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoEntityAssetMIB.setContactInfo('Cisco Systems Customer Service Postal: Cisco Systems, Inc. 170 West Tasman Drive San Jose, CA 95134-1706 USA Tel: +1 408 526 4000 E-mail: [email protected]') if mibBuilder.loadTexts: ciscoEntityAssetMIB.setDescription('Monitor the asset information of items in the ENTITY-MIB (RFC 2037) entPhysical table.') ciscoEntityAssetMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 1)) ceAssetTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1), ) if mibBuilder.loadTexts: ceAssetTable.setStatus('current') if mibBuilder.loadTexts: ceAssetTable.setDescription('This table lists the orderable part number, serial number, hardware revision, manufacturing assembly number and revision, firmwareID and revision if any, and softwareID and revision if any, of relevant entities listed in the ENTITY-MIB entPhysicalTable. Entities for which none of this data is available are not listed in this table. This is a sparse table so some of these variables may not exist for a particular entity at a particular time. For example, a powered-off module does not have softwareID and revision; a power-supply would probably never have firmware or software information. Although the data may have other items encoded in it (for example manufacturing-date in the serial number) please treat all data items as monolithic. Do not decompose them or parse them. Use only string equals and unequals operations on them.') ceAssetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1), ).setIndexNames((0, "ENTITY-MIB", "entPhysicalIndex")) if mibBuilder.loadTexts: ceAssetEntry.setStatus('current') if mibBuilder.loadTexts: ceAssetEntry.setDescription('An entAssetEntry entry describes the asset-tracking related data for an entity.') ceAssetOEMString = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 1), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetOEMString.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetOEMString.setDescription('This variable indicates the Original Equipment Manufacturer of the entity.') ceAssetSerialNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 2), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetSerialNumber.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetSerialNumber.setDescription('This variable indicates the serial number of the entity.') ceAssetOrderablePartNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 3), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetOrderablePartNumber.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetOrderablePartNumber.setDescription('This variable indicates the part number you can use to order the entity.') ceAssetHardwareRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 4), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetHardwareRevision.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetHardwareRevision.setDescription('This variable indicates the engineering design revision of the hardware of the entity.') ceAssetMfgAssyNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 5), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetMfgAssyNumber.setStatus('current') if mibBuilder.loadTexts: ceAssetMfgAssyNumber.setDescription("This variable indicates the manufacturing assembly number, which is the 'hardware' identification.") ceAssetMfgAssyRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 6), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetMfgAssyRevision.setStatus('current') if mibBuilder.loadTexts: ceAssetMfgAssyRevision.setDescription('This variable indicates the revision of the entity, within the ceAssetMfgAssyNumber.') ceAssetFirmwareID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 7), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetFirmwareID.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetFirmwareID.setDescription("This variable indicates the firmware installed on this entity. For IOS devices, this variable's value is in the IOS Image Naming Convention format. IOS Image Naming Convention Software images are named according to a scheme that identifies what's in the image and what platform it runs on. The names have three parts, separated by dashes: e.g. xxxx-yyyy-ww. xxxx = Platform yyyy = Features ww = Where it executes from and if compressed ") ceAssetFirmwareRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 8), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetFirmwareRevision.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetFirmwareRevision.setDescription("This variable indicates the revision of firmware installed on this entity. For IOS devices, this variable's value is in the NGRP external customer-visible format. NGRP external customer-visible revision strings have this format: 'x.y (z [p] ) [A] [ [ u ( v [ p ] ) ] ] [ q ]', where: - x.y Combination of two 1-2 digit numerics separated by a '.' that identify the Software major release - z 1-3 digit numeric that identifies the maintenance release of x.y - A 1-3 alpha letters, designator of the release train. - u 1-2 digit numeric that identifies the version of the ED-specific code - v 1-2 digit numeric that identifies the maintenance release of the ED-specific code - v 1-2 digit numeric that identifies the maintenance release of the ED-specific code - p 1 alpha letter that identifies the unusual special case SW Line Stop Fast Re-build by the Release Ops team to replace the posted/shipping release in CCO and Mfg with a version containing a critical catastrophic defect fix that cannot wait until the next maintenance release - q 3 alphanumeric optional suffix used as an indicator in the image banner by the SW Line Stop Re-build process used unusual special case situation when the renumber build has occurred but the images have not been released (value always blank unless these special circumstances require its use). ") ceAssetSoftwareID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 9), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetSoftwareID.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetSoftwareID.setDescription("This variable indicates the software installed on this entity. For IOS devices, this variable's value is in the IOS Image Naming Convention format. IOS Image Naming Convention --------------------------- Software images are named according to a scheme that identifies what's in the image and what platform it runs on. The names have three parts, separated by dashes: e.g. xxxx-yyyy-ww. xxxx = Platform yyyy = Features ww = Where it executes from and if compressed ") ceAssetSoftwareRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 10), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetSoftwareRevision.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetSoftwareRevision.setDescription("This variable indicates the revision of software installed on this entity. For IOS devices, this variable's value is in the NGRP external customer-visible format. NGRP external customer-visible revision strings have this format: 'x.y (z [p] ) [A] [ [ u ( v [ p ] ) ] ] [ q ]', where: - x.y Combination of two 1-2 digit numerics separated by a '.' that identify the Software major release - z 1-3 digit numeric that identifies the maintenance release of x.y - A 1-3 alpha letters, designator of the release train. - u 1-2 digit numeric that identifies the version of the ED-specific code - v 1-2 digit numeric that identifies the maintenance release of the ED-specific code - p 1 alpha letter that identifies the unusual special case SW Line Stop Fast Re-build by the Release Ops team to replace the posted/shipping release in CCO and Mfg with a version containing a critical catastrophic defect fix that cannot wait until the next maintenance release - q 3 alphanumeric optional suffix used as an indicator in the image banner by the SW Line Stop Re-build process used unusual special case situation when the renumber build has occurred but the images have not been released (value always blank unless these special circumstances require its use). ") ceAssetCLEI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 11), SnmpAdminString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(10, 10), ))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetCLEI.setReference('Bellcore Technical reference GR-485-CORE, COMMON LANGUAGE Equipment Processes and Guidelines, Issue 2, October, 1995.') if mibBuilder.loadTexts: ceAssetCLEI.setStatus('current') if mibBuilder.loadTexts: ceAssetCLEI.setDescription('This object represents the CLEI (Common Language Equipment Identifier) code for the physical entity. If the physical entity is not present in the system, or does not have an associated CLEI code, then the value of this object will be a zero-length string.') ceAssetAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 12), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ceAssetAlias.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetAlias.setDescription("This object is an 'alias' name for the physical entity as specified by a network manager, and provides a non-volatile 'handle' for the physical entity. On the first instantiation of an physical entity, the value of entPhysicalAlias associated with that entity is set to the zero-length string. However, agent may set the value to a locally unique default value, instead of a zero-length string. If write access is implemented for an instance of entPhysicalAlias, and a value is written into the instance, the agent must retain the supplied value in the entPhysicalAlias instance associated with the same physical entity for as long as that entity remains instantiated. This includes instantiations across all re-initializations/reboots of the network management system, including those which result in a change of the physical entity's entPhysicalIndex value.") ceAssetTag = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 13), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ceAssetTag.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetTag.setDescription("This object is a user-assigned asset tracking identifier for the physical entity as specified by a network manager, and provides non-volatile storage of this information. On the first instantiation of an physical entity, the value of ceasAssetID associated with that entity is set to the zero-length string. Not every physical component will have a asset tracking identifier, or even need one. Physical entities for which the associated value of the ceAssetIsFRU object is equal to 'false' (e.g., the repeater ports within a repeater module), do not need their own unique asset tracking identifier. An agent does not have to provide write access for such entities, and may instead return a zero-length string. If write access is implemented for an instance of ceasAssetID, and a value is written into the instance, the agent must retain the supplied value in the ceasAssetID instance associated with the same physical entity for as long as that entity remains instantiated. This includes instantiations across all re-initializations/reboots of the network management system, including those which result in a change of the physical entity's entPhysicalIndex value. If no asset tracking information is associated with the physical component, then this object will contain a zero- length string.") ceAssetIsFRU = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 14), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceAssetIsFRU.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetIsFRU.setDescription("This object indicates whether or not this physical entity is considered a 'field replaceable unit' by the vendor. If this object contains the value 'true' then the corresponding entPhysicalEntry identifies a field replaceable unit. For all entPhysicalEntries which represent components that are permanently contained within a field replaceable unit, the value 'false' should be returned for this object.") ciscoEntityAssetMIBNotificationsPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 2)) ciscoEntityAssetMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 2, 0)) ciscoEntityAssetMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 3)) ciscoEntityAssetMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 1)) ciscoEntityAssetMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2)) ciscoEntityAssetMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 1, 1)).setObjects(("CISCO-ENTITY-ASSET-MIB", "ceAssetGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoEntityAssetMIBCompliance = ciscoEntityAssetMIBCompliance.setStatus('deprecated') if mibBuilder.loadTexts: ciscoEntityAssetMIBCompliance.setDescription('An ENTITY-MIB implementation that lists entities with asset information in its entPhysicalTable must implement this group.') ciscoEntityAssetMIBComplianceRev1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 1, 2)).setObjects(("CISCO-ENTITY-ASSET-MIB", "ceAssetGroupRev1"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetEntityGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoEntityAssetMIBComplianceRev1 = ciscoEntityAssetMIBComplianceRev1.setStatus('deprecated') if mibBuilder.loadTexts: ciscoEntityAssetMIBComplianceRev1.setDescription('An ENTITY-MIB implementation that lists entities with asset information in its entPhysicalTable must implement this group.') ciscoEntityAssetMIBComplianceRev2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 1, 3)).setObjects(("CISCO-ENTITY-ASSET-MIB", "ceAssetGroupRev2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoEntityAssetMIBComplianceRev2 = ciscoEntityAssetMIBComplianceRev2.setStatus('current') if mibBuilder.loadTexts: ciscoEntityAssetMIBComplianceRev2.setDescription('An ENTITY-MIB implementation that lists entities with asset information in its entPhysicalTable must implement this group.') ceAssetGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2, 1)).setObjects(("CISCO-ENTITY-ASSET-MIB", "ceAssetOEMString"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetSerialNumber"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetOrderablePartNumber"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetHardwareRevision"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetMfgAssyNumber"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetMfgAssyRevision"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetFirmwareID"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetFirmwareRevision"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetSoftwareID"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetSoftwareRevision"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetCLEI"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetAlias"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetTag"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetIsFRU")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ceAssetGroup = ceAssetGroup.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetGroup.setDescription('The collection of objects which are used to describe and monitor asset-related data of ENTITY-MIB entPhysicalTable items.') ceAssetGroupRev1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2, 2)).setObjects(("CISCO-ENTITY-ASSET-MIB", "ceAssetOEMString"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetMfgAssyNumber"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetMfgAssyRevision"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetFirmwareID"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetSoftwareID"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetCLEI")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ceAssetGroupRev1 = ceAssetGroupRev1.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetGroupRev1.setDescription('The collection of objects which are used to describe and monitor asset-related extension data of ENTITY-MIB (RFC 2737) entPhysicalTable items.') ceAssetEntityGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2, 3)).setObjects(("CISCO-ENTITY-ASSET-MIB", "ceAssetOrderablePartNumber"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetSerialNumber"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetHardwareRevision"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetFirmwareRevision"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetSoftwareRevision"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetAlias"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetTag"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetIsFRU")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ceAssetEntityGroup = ceAssetEntityGroup.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetEntityGroup.setDescription('The collection of objects which are duplicated from the objects in the entPhysicalTable of ENTITY-MIB (RFC 2737).') ceAssetGroupRev2 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2, 4)).setObjects(("CISCO-ENTITY-ASSET-MIB", "ceAssetMfgAssyNumber"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetMfgAssyRevision"), ("CISCO-ENTITY-ASSET-MIB", "ceAssetCLEI")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ceAssetGroupRev2 = ceAssetGroupRev2.setStatus('current') if mibBuilder.loadTexts: ceAssetGroupRev2.setDescription('The collection of objects which are used to describe and monitor asset-related extension data of ENTITY-MIB (RFC 2737) entPhysicalTable items.') mibBuilder.exportSymbols("CISCO-ENTITY-ASSET-MIB", ciscoEntityAssetMIBComplianceRev1=ciscoEntityAssetMIBComplianceRev1, ciscoEntityAssetMIB=ciscoEntityAssetMIB, ceAssetTag=ceAssetTag, ciscoEntityAssetMIBGroups=ciscoEntityAssetMIBGroups, ceAssetFirmwareRevision=ceAssetFirmwareRevision, ceAssetAlias=ceAssetAlias, ciscoEntityAssetMIBNotifications=ciscoEntityAssetMIBNotifications, ceAssetGroup=ceAssetGroup, PYSNMP_MODULE_ID=ciscoEntityAssetMIB, ceAssetCLEI=ceAssetCLEI, ceAssetMfgAssyNumber=ceAssetMfgAssyNumber, ceAssetSerialNumber=ceAssetSerialNumber, ceAssetHardwareRevision=ceAssetHardwareRevision, ceAssetGroupRev2=ceAssetGroupRev2, ciscoEntityAssetMIBComplianceRev2=ciscoEntityAssetMIBComplianceRev2, ciscoEntityAssetMIBObjects=ciscoEntityAssetMIBObjects, ceAssetEntry=ceAssetEntry, ciscoEntityAssetMIBCompliances=ciscoEntityAssetMIBCompliances, ciscoEntityAssetMIBCompliance=ciscoEntityAssetMIBCompliance, ceAssetSoftwareRevision=ceAssetSoftwareRevision, ceAssetIsFRU=ceAssetIsFRU, ciscoEntityAssetMIBConformance=ciscoEntityAssetMIBConformance, ceAssetOEMString=ceAssetOEMString, ceAssetFirmwareID=ceAssetFirmwareID, ceAssetTable=ceAssetTable, ceAssetEntityGroup=ceAssetEntityGroup, ciscoEntityAssetMIBNotificationsPrefix=ciscoEntityAssetMIBNotificationsPrefix, ceAssetSoftwareID=ceAssetSoftwareID, ceAssetGroupRev1=ceAssetGroupRev1, ceAssetOrderablePartNumber=ceAssetOrderablePartNumber, ceAssetMfgAssyRevision=ceAssetMfgAssyRevision)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint') (cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt') (ent_physical_index,) = mibBuilder.importSymbols('ENTITY-MIB', 'entPhysicalIndex') (snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString') (module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup') (module_identity, ip_address, iso, mib_identifier, notification_type, counter64, gauge32, bits, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, object_identity, time_ticks, counter32, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'IpAddress', 'iso', 'MibIdentifier', 'NotificationType', 'Counter64', 'Gauge32', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'ObjectIdentity', 'TimeTicks', 'Counter32', 'Integer32') (textual_convention, truth_value, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'DisplayString') cisco_entity_asset_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 92)) ciscoEntityAssetMIB.setRevisions(('2003-09-18 00:00', '2002-07-23 16:00', '1999-06-02 16:00')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoEntityAssetMIB.setRevisionsDescriptions(('Some of the Objects have been deprecated since these are available in ENTITY-MIB(RFC 2737). 1. Following Objects have been deprecated. ceAssetOEMString : superceded by entPhysicalMfgName ceAssetSerialNumber : superceded by entPhysicalSerialNum ceAssetOrderablePartNumber: superceded by entPhysicalModelName ceAssetHardwareRevision : superceded by entPhysicalHardwareRev ceAssetFirmwareID : superceded by entPhysicalFirmwareRev ceAssetFirmwareRevision : superceded by entPhysicalFirmwareRev ceAssetSoftwareID : superceded by entPhysicalSoftwareRev ceAssetSoftwareRevision : superceded by entPhysicalSoftwareRev ceAssetAlias : superceded by entPhysicalAlias ceAssetTag : superceded by entPhysicalAssetID ceAssetIsFRU : superceded by entPhysicalIsFRU. 2. ceAssetEntityGroup has been deprecated.', 'Split the MIB objects of this MIB into two object groups.', 'Initial version of this MIB module.')) if mibBuilder.loadTexts: ciscoEntityAssetMIB.setLastUpdated('200309180000Z') if mibBuilder.loadTexts: ciscoEntityAssetMIB.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoEntityAssetMIB.setContactInfo('Cisco Systems Customer Service Postal: Cisco Systems, Inc. 170 West Tasman Drive San Jose, CA 95134-1706 USA Tel: +1 408 526 4000 E-mail: [email protected]') if mibBuilder.loadTexts: ciscoEntityAssetMIB.setDescription('Monitor the asset information of items in the ENTITY-MIB (RFC 2037) entPhysical table.') cisco_entity_asset_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 1)) ce_asset_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1)) if mibBuilder.loadTexts: ceAssetTable.setStatus('current') if mibBuilder.loadTexts: ceAssetTable.setDescription('This table lists the orderable part number, serial number, hardware revision, manufacturing assembly number and revision, firmwareID and revision if any, and softwareID and revision if any, of relevant entities listed in the ENTITY-MIB entPhysicalTable. Entities for which none of this data is available are not listed in this table. This is a sparse table so some of these variables may not exist for a particular entity at a particular time. For example, a powered-off module does not have softwareID and revision; a power-supply would probably never have firmware or software information. Although the data may have other items encoded in it (for example manufacturing-date in the serial number) please treat all data items as monolithic. Do not decompose them or parse them. Use only string equals and unequals operations on them.') ce_asset_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1)).setIndexNames((0, 'ENTITY-MIB', 'entPhysicalIndex')) if mibBuilder.loadTexts: ceAssetEntry.setStatus('current') if mibBuilder.loadTexts: ceAssetEntry.setDescription('An entAssetEntry entry describes the asset-tracking related data for an entity.') ce_asset_oem_string = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 1), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetOEMString.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetOEMString.setDescription('This variable indicates the Original Equipment Manufacturer of the entity.') ce_asset_serial_number = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 2), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetSerialNumber.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetSerialNumber.setDescription('This variable indicates the serial number of the entity.') ce_asset_orderable_part_number = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 3), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetOrderablePartNumber.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetOrderablePartNumber.setDescription('This variable indicates the part number you can use to order the entity.') ce_asset_hardware_revision = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 4), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetHardwareRevision.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetHardwareRevision.setDescription('This variable indicates the engineering design revision of the hardware of the entity.') ce_asset_mfg_assy_number = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 5), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetMfgAssyNumber.setStatus('current') if mibBuilder.loadTexts: ceAssetMfgAssyNumber.setDescription("This variable indicates the manufacturing assembly number, which is the 'hardware' identification.") ce_asset_mfg_assy_revision = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 6), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetMfgAssyRevision.setStatus('current') if mibBuilder.loadTexts: ceAssetMfgAssyRevision.setDescription('This variable indicates the revision of the entity, within the ceAssetMfgAssyNumber.') ce_asset_firmware_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 7), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetFirmwareID.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetFirmwareID.setDescription("This variable indicates the firmware installed on this entity. For IOS devices, this variable's value is in the IOS Image Naming Convention format. IOS Image Naming Convention Software images are named according to a scheme that identifies what's in the image and what platform it runs on. The names have three parts, separated by dashes: e.g. xxxx-yyyy-ww. xxxx = Platform yyyy = Features ww = Where it executes from and if compressed ") ce_asset_firmware_revision = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 8), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetFirmwareRevision.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetFirmwareRevision.setDescription("This variable indicates the revision of firmware installed on this entity. For IOS devices, this variable's value is in the NGRP external customer-visible format. NGRP external customer-visible revision strings have this format: 'x.y (z [p] ) [A] [ [ u ( v [ p ] ) ] ] [ q ]', where: - x.y Combination of two 1-2 digit numerics separated by a '.' that identify the Software major release - z 1-3 digit numeric that identifies the maintenance release of x.y - A 1-3 alpha letters, designator of the release train. - u 1-2 digit numeric that identifies the version of the ED-specific code - v 1-2 digit numeric that identifies the maintenance release of the ED-specific code - v 1-2 digit numeric that identifies the maintenance release of the ED-specific code - p 1 alpha letter that identifies the unusual special case SW Line Stop Fast Re-build by the Release Ops team to replace the posted/shipping release in CCO and Mfg with a version containing a critical catastrophic defect fix that cannot wait until the next maintenance release - q 3 alphanumeric optional suffix used as an indicator in the image banner by the SW Line Stop Re-build process used unusual special case situation when the renumber build has occurred but the images have not been released (value always blank unless these special circumstances require its use). ") ce_asset_software_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 9), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetSoftwareID.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetSoftwareID.setDescription("This variable indicates the software installed on this entity. For IOS devices, this variable's value is in the IOS Image Naming Convention format. IOS Image Naming Convention --------------------------- Software images are named according to a scheme that identifies what's in the image and what platform it runs on. The names have three parts, separated by dashes: e.g. xxxx-yyyy-ww. xxxx = Platform yyyy = Features ww = Where it executes from and if compressed ") ce_asset_software_revision = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 10), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetSoftwareRevision.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetSoftwareRevision.setDescription("This variable indicates the revision of software installed on this entity. For IOS devices, this variable's value is in the NGRP external customer-visible format. NGRP external customer-visible revision strings have this format: 'x.y (z [p] ) [A] [ [ u ( v [ p ] ) ] ] [ q ]', where: - x.y Combination of two 1-2 digit numerics separated by a '.' that identify the Software major release - z 1-3 digit numeric that identifies the maintenance release of x.y - A 1-3 alpha letters, designator of the release train. - u 1-2 digit numeric that identifies the version of the ED-specific code - v 1-2 digit numeric that identifies the maintenance release of the ED-specific code - p 1 alpha letter that identifies the unusual special case SW Line Stop Fast Re-build by the Release Ops team to replace the posted/shipping release in CCO and Mfg with a version containing a critical catastrophic defect fix that cannot wait until the next maintenance release - q 3 alphanumeric optional suffix used as an indicator in the image banner by the SW Line Stop Re-build process used unusual special case situation when the renumber build has occurred but the images have not been released (value always blank unless these special circumstances require its use). ") ce_asset_clei = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 11), snmp_admin_string().subtype(subtypeSpec=constraints_union(value_size_constraint(0, 0), value_size_constraint(10, 10)))).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetCLEI.setReference('Bellcore Technical reference GR-485-CORE, COMMON LANGUAGE Equipment Processes and Guidelines, Issue 2, October, 1995.') if mibBuilder.loadTexts: ceAssetCLEI.setStatus('current') if mibBuilder.loadTexts: ceAssetCLEI.setDescription('This object represents the CLEI (Common Language Equipment Identifier) code for the physical entity. If the physical entity is not present in the system, or does not have an associated CLEI code, then the value of this object will be a zero-length string.') ce_asset_alias = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 12), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ceAssetAlias.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetAlias.setDescription("This object is an 'alias' name for the physical entity as specified by a network manager, and provides a non-volatile 'handle' for the physical entity. On the first instantiation of an physical entity, the value of entPhysicalAlias associated with that entity is set to the zero-length string. However, agent may set the value to a locally unique default value, instead of a zero-length string. If write access is implemented for an instance of entPhysicalAlias, and a value is written into the instance, the agent must retain the supplied value in the entPhysicalAlias instance associated with the same physical entity for as long as that entity remains instantiated. This includes instantiations across all re-initializations/reboots of the network management system, including those which result in a change of the physical entity's entPhysicalIndex value.") ce_asset_tag = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 13), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ceAssetTag.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetTag.setDescription("This object is a user-assigned asset tracking identifier for the physical entity as specified by a network manager, and provides non-volatile storage of this information. On the first instantiation of an physical entity, the value of ceasAssetID associated with that entity is set to the zero-length string. Not every physical component will have a asset tracking identifier, or even need one. Physical entities for which the associated value of the ceAssetIsFRU object is equal to 'false' (e.g., the repeater ports within a repeater module), do not need their own unique asset tracking identifier. An agent does not have to provide write access for such entities, and may instead return a zero-length string. If write access is implemented for an instance of ceasAssetID, and a value is written into the instance, the agent must retain the supplied value in the ceasAssetID instance associated with the same physical entity for as long as that entity remains instantiated. This includes instantiations across all re-initializations/reboots of the network management system, including those which result in a change of the physical entity's entPhysicalIndex value. If no asset tracking information is associated with the physical component, then this object will contain a zero- length string.") ce_asset_is_fru = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 92, 1, 1, 1, 14), truth_value()).setMaxAccess('readonly') if mibBuilder.loadTexts: ceAssetIsFRU.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetIsFRU.setDescription("This object indicates whether or not this physical entity is considered a 'field replaceable unit' by the vendor. If this object contains the value 'true' then the corresponding entPhysicalEntry identifies a field replaceable unit. For all entPhysicalEntries which represent components that are permanently contained within a field replaceable unit, the value 'false' should be returned for this object.") cisco_entity_asset_mib_notifications_prefix = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 2)) cisco_entity_asset_mib_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 2, 0)) cisco_entity_asset_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 3)) cisco_entity_asset_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 1)) cisco_entity_asset_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2)) cisco_entity_asset_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 1, 1)).setObjects(('CISCO-ENTITY-ASSET-MIB', 'ceAssetGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_entity_asset_mib_compliance = ciscoEntityAssetMIBCompliance.setStatus('deprecated') if mibBuilder.loadTexts: ciscoEntityAssetMIBCompliance.setDescription('An ENTITY-MIB implementation that lists entities with asset information in its entPhysicalTable must implement this group.') cisco_entity_asset_mib_compliance_rev1 = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 1, 2)).setObjects(('CISCO-ENTITY-ASSET-MIB', 'ceAssetGroupRev1'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetEntityGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_entity_asset_mib_compliance_rev1 = ciscoEntityAssetMIBComplianceRev1.setStatus('deprecated') if mibBuilder.loadTexts: ciscoEntityAssetMIBComplianceRev1.setDescription('An ENTITY-MIB implementation that lists entities with asset information in its entPhysicalTable must implement this group.') cisco_entity_asset_mib_compliance_rev2 = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 1, 3)).setObjects(('CISCO-ENTITY-ASSET-MIB', 'ceAssetGroupRev2')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_entity_asset_mib_compliance_rev2 = ciscoEntityAssetMIBComplianceRev2.setStatus('current') if mibBuilder.loadTexts: ciscoEntityAssetMIBComplianceRev2.setDescription('An ENTITY-MIB implementation that lists entities with asset information in its entPhysicalTable must implement this group.') ce_asset_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2, 1)).setObjects(('CISCO-ENTITY-ASSET-MIB', 'ceAssetOEMString'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetSerialNumber'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetOrderablePartNumber'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetHardwareRevision'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetMfgAssyNumber'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetMfgAssyRevision'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetFirmwareID'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetFirmwareRevision'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetSoftwareID'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetSoftwareRevision'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetCLEI'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetAlias'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetTag'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetIsFRU')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ce_asset_group = ceAssetGroup.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetGroup.setDescription('The collection of objects which are used to describe and monitor asset-related data of ENTITY-MIB entPhysicalTable items.') ce_asset_group_rev1 = object_group((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2, 2)).setObjects(('CISCO-ENTITY-ASSET-MIB', 'ceAssetOEMString'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetMfgAssyNumber'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetMfgAssyRevision'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetFirmwareID'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetSoftwareID'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetCLEI')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ce_asset_group_rev1 = ceAssetGroupRev1.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetGroupRev1.setDescription('The collection of objects which are used to describe and monitor asset-related extension data of ENTITY-MIB (RFC 2737) entPhysicalTable items.') ce_asset_entity_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2, 3)).setObjects(('CISCO-ENTITY-ASSET-MIB', 'ceAssetOrderablePartNumber'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetSerialNumber'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetHardwareRevision'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetFirmwareRevision'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetSoftwareRevision'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetAlias'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetTag'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetIsFRU')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ce_asset_entity_group = ceAssetEntityGroup.setStatus('deprecated') if mibBuilder.loadTexts: ceAssetEntityGroup.setDescription('The collection of objects which are duplicated from the objects in the entPhysicalTable of ENTITY-MIB (RFC 2737).') ce_asset_group_rev2 = object_group((1, 3, 6, 1, 4, 1, 9, 9, 92, 3, 2, 4)).setObjects(('CISCO-ENTITY-ASSET-MIB', 'ceAssetMfgAssyNumber'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetMfgAssyRevision'), ('CISCO-ENTITY-ASSET-MIB', 'ceAssetCLEI')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ce_asset_group_rev2 = ceAssetGroupRev2.setStatus('current') if mibBuilder.loadTexts: ceAssetGroupRev2.setDescription('The collection of objects which are used to describe and monitor asset-related extension data of ENTITY-MIB (RFC 2737) entPhysicalTable items.') mibBuilder.exportSymbols('CISCO-ENTITY-ASSET-MIB', ciscoEntityAssetMIBComplianceRev1=ciscoEntityAssetMIBComplianceRev1, ciscoEntityAssetMIB=ciscoEntityAssetMIB, ceAssetTag=ceAssetTag, ciscoEntityAssetMIBGroups=ciscoEntityAssetMIBGroups, ceAssetFirmwareRevision=ceAssetFirmwareRevision, ceAssetAlias=ceAssetAlias, ciscoEntityAssetMIBNotifications=ciscoEntityAssetMIBNotifications, ceAssetGroup=ceAssetGroup, PYSNMP_MODULE_ID=ciscoEntityAssetMIB, ceAssetCLEI=ceAssetCLEI, ceAssetMfgAssyNumber=ceAssetMfgAssyNumber, ceAssetSerialNumber=ceAssetSerialNumber, ceAssetHardwareRevision=ceAssetHardwareRevision, ceAssetGroupRev2=ceAssetGroupRev2, ciscoEntityAssetMIBComplianceRev2=ciscoEntityAssetMIBComplianceRev2, ciscoEntityAssetMIBObjects=ciscoEntityAssetMIBObjects, ceAssetEntry=ceAssetEntry, ciscoEntityAssetMIBCompliances=ciscoEntityAssetMIBCompliances, ciscoEntityAssetMIBCompliance=ciscoEntityAssetMIBCompliance, ceAssetSoftwareRevision=ceAssetSoftwareRevision, ceAssetIsFRU=ceAssetIsFRU, ciscoEntityAssetMIBConformance=ciscoEntityAssetMIBConformance, ceAssetOEMString=ceAssetOEMString, ceAssetFirmwareID=ceAssetFirmwareID, ceAssetTable=ceAssetTable, ceAssetEntityGroup=ceAssetEntityGroup, ciscoEntityAssetMIBNotificationsPrefix=ciscoEntityAssetMIBNotificationsPrefix, ceAssetSoftwareID=ceAssetSoftwareID, ceAssetGroupRev1=ceAssetGroupRev1, ceAssetOrderablePartNumber=ceAssetOrderablePartNumber, ceAssetMfgAssyRevision=ceAssetMfgAssyRevision)
def egcd(a, b): if a==0: return b, 0, 1 else: gcd, x, y = egcd(b%a, a) return gcd, y-(b//a)*x, x if __name__ == '__main__': a = int(input('Enter a: ')) b = int(input('Enter b: ')) gcd, x, y = egcd(a, b) print(egcd(a,b)) if gcd!=1: print("M.I. doesn't exist") else: print('M.I. of b under modulo a is: ', (x%b + b)%b)
def egcd(a, b): if a == 0: return (b, 0, 1) else: (gcd, x, y) = egcd(b % a, a) return (gcd, y - b // a * x, x) if __name__ == '__main__': a = int(input('Enter a: ')) b = int(input('Enter b: ')) (gcd, x, y) = egcd(a, b) print(egcd(a, b)) if gcd != 1: print("M.I. doesn't exist") else: print('M.I. of b under modulo a is: ', (x % b + b) % b)
class Engine(object): """Engine""" def __init__(self, rest): self.rest = rest def list(self, params=None): return self.rest.get('engines', params) def create(self, data=None): return self.rest.post('engines', data) def get(self, name): return self.rest.get('engines/' + name) def update(self, name, data=None): return self.rest.put('engines/' + name, data=data) def delete(self, name): return self.rest.delete('engines/' + name)
class Engine(object): """Engine""" def __init__(self, rest): self.rest = rest def list(self, params=None): return self.rest.get('engines', params) def create(self, data=None): return self.rest.post('engines', data) def get(self, name): return self.rest.get('engines/' + name) def update(self, name, data=None): return self.rest.put('engines/' + name, data=data) def delete(self, name): return self.rest.delete('engines/' + name)
def app(environ, start_response): s = "" for i in environ['QUERY_STRING'].split("&"): s = s + i + "\r\n" start_response("200 OK", [ ("Content-Type", "text/plain"), ("Content-Length", str(len(s))) ]) return [bytes(s, 'utf-8')]
def app(environ, start_response): s = '' for i in environ['QUERY_STRING'].split('&'): s = s + i + '\r\n' start_response('200 OK', [('Content-Type', 'text/plain'), ('Content-Length', str(len(s)))]) return [bytes(s, 'utf-8')]
deck_test = { "kategori 1": ["kartuA", "kartuB", "kartuC", "kartuD"], "kategori 2": ["kartuE", "kartuF", "kartuG", "kartuH"], "kategori 3": ["kartuI", "kartuJ", "kartuK", "kartuL"], # "kategori 4": ["kartuM", "kartuN", "kartuO", "kartuP"], # "kategori 5": ["kartuQ", "kartuR", "kartuS", "kartuT"], } deck_used = { "nasi": ["nasi goreng", "nasi uduk", "nasi kuning", "nasi kucing"], "air": ["air putih", "air santan", "air susu", "air tajin"], "benda lengkung": ["busur", "karet", "tampah", "jembatan"], "minuman": ["kopi", "teh", "cincau", "boba"], "sumber tenaga": ["listrik", "bensin", "matahari", "karbohidrat"], "manisan": ["permen", "coklat", "gula", "tebu"], "tempat tinggal": ["hotel", "apartemen", "rumah", "emperan"] }
deck_test = {'kategori 1': ['kartuA', 'kartuB', 'kartuC', 'kartuD'], 'kategori 2': ['kartuE', 'kartuF', 'kartuG', 'kartuH'], 'kategori 3': ['kartuI', 'kartuJ', 'kartuK', 'kartuL']} deck_used = {'nasi': ['nasi goreng', 'nasi uduk', 'nasi kuning', 'nasi kucing'], 'air': ['air putih', 'air santan', 'air susu', 'air tajin'], 'benda lengkung': ['busur', 'karet', 'tampah', 'jembatan'], 'minuman': ['kopi', 'teh', 'cincau', 'boba'], 'sumber tenaga': ['listrik', 'bensin', 'matahari', 'karbohidrat'], 'manisan': ['permen', 'coklat', 'gula', 'tebu'], 'tempat tinggal': ['hotel', 'apartemen', 'rumah', 'emperan']}
data = [int(input()), input()] if 10 <= data[0] <= 15 and data[1] == "f": print("YES") else: print("NO")
data = [int(input()), input()] if 10 <= data[0] <= 15 and data[1] == 'f': print('YES') else: print('NO')
class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int: res = cnt = 0 for i in nums: if i: cnt += 1 else: if cnt: res = max(res, cnt) cnt = 0 return max(res, cnt)
class Solution: def find_max_consecutive_ones(self, nums: List[int]) -> int: res = cnt = 0 for i in nums: if i: cnt += 1 elif cnt: res = max(res, cnt) cnt = 0 return max(res, cnt)
n = int(input()) while True: s,z =0,n while z>0: s+=z%10 z//=10 if n%s==0: print(n) break n+=1
n = int(input()) while True: (s, z) = (0, n) while z > 0: s += z % 10 z //= 10 if n % s == 0: print(n) break n += 1
n = int(input()) k = n >> 1 ans = 1 for i in range(n-k+1,n+1): ans *= i for i in range(1,k+1): ans //= i print (ans)
n = int(input()) k = n >> 1 ans = 1 for i in range(n - k + 1, n + 1): ans *= i for i in range(1, k + 1): ans //= i print(ans)
# # PySNMP MIB module DVMRP-STD-MIB-UNI (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DVMRP-STD-MIB-UNI # Produced by pysmi-0.3.4 at Mon Apr 29 18:40:19 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint") InterfaceIndex, InterfaceIndexOrZero = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex", "InterfaceIndexOrZero") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance") Integer32, TimeTicks, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, MibIdentifier, Unsigned32, ModuleIdentity, iso, IpAddress, Bits, ObjectIdentity, Gauge32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "TimeTicks", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "MibIdentifier", "Unsigned32", "ModuleIdentity", "iso", "IpAddress", "Bits", "ObjectIdentity", "Gauge32", "Counter32") TextualConvention, DisplayString, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "RowStatus") usdDvmrpExperiment, = mibBuilder.importSymbols("Unisphere-Data-Experiment", "usdDvmrpExperiment") dvmrpStdMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1)) dvmrpStdMIB.setRevisions(('1999-10-19 12:00',)) if mibBuilder.loadTexts: dvmrpStdMIB.setLastUpdated('9910191200Z') if mibBuilder.loadTexts: dvmrpStdMIB.setOrganization('IETF IDMR Working Group.') dvmrpMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1)) dvmrp = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1)) dvmrpScalar = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1)) dvmrpVersionString = MibScalar((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1, 1), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpVersionString.setStatus('current') dvmrpGenerationId = MibScalar((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpGenerationId.setStatus('current') dvmrpNumRoutes = MibScalar((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNumRoutes.setStatus('current') dvmrpReachableRoutes = MibScalar((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpReachableRoutes.setStatus('current') dvmrpInterfaceTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2), ) if mibBuilder.loadTexts: dvmrpInterfaceTable.setStatus('current') dvmrpInterfaceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1), ).setIndexNames((0, "DVMRP-STD-MIB-UNI", "dvmrpInterfaceIfIndex")) if mibBuilder.loadTexts: dvmrpInterfaceEntry.setStatus('current') dvmrpInterfaceIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: dvmrpInterfaceIfIndex.setStatus('current') dvmrpInterfaceLocalAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 2), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: dvmrpInterfaceLocalAddress.setStatus('current') dvmrpInterfaceMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 31)).clone(1)).setMaxAccess("readcreate") if mibBuilder.loadTexts: dvmrpInterfaceMetric.setStatus('current') dvmrpInterfaceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: dvmrpInterfaceStatus.setStatus('current') dvmrpInterfaceRcvBadPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpInterfaceRcvBadPkts.setStatus('current') dvmrpInterfaceRcvBadRoutes = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpInterfaceRcvBadRoutes.setStatus('current') dvmrpInterfaceSentRoutes = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpInterfaceSentRoutes.setStatus('current') dvmrpInterfaceInterfaceKey = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 8), SnmpAdminString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: dvmrpInterfaceInterfaceKey.setStatus('current') dvmrpInterfaceInterfaceKeyVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 9), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: dvmrpInterfaceInterfaceKeyVersion.setStatus('current') dvmrpNeighborTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3), ) if mibBuilder.loadTexts: dvmrpNeighborTable.setStatus('current') dvmrpNeighborEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1), ).setIndexNames((0, "DVMRP-STD-MIB-UNI", "dvmrpNeighborIfIndex"), (0, "DVMRP-STD-MIB-UNI", "dvmrpNeighborAddress")) if mibBuilder.loadTexts: dvmrpNeighborEntry.setStatus('current') dvmrpNeighborIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: dvmrpNeighborIfIndex.setStatus('current') dvmrpNeighborAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 2), IpAddress()) if mibBuilder.loadTexts: dvmrpNeighborAddress.setStatus('current') dvmrpNeighborUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 3), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborUpTime.setStatus('current') dvmrpNeighborExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborExpiryTime.setStatus('current') dvmrpNeighborGenerationId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborGenerationId.setStatus('current') dvmrpNeighborMajorVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborMajorVersion.setStatus('current') dvmrpNeighborMinorVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborMinorVersion.setStatus('current') dvmrpNeighborCapabilities = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 8), Bits().clone(namedValues=NamedValues(("leaf", 0), ("prune", 1), ("generationID", 2), ("mtrace", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborCapabilities.setStatus('current') dvmrpNeighborRcvRoutes = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborRcvRoutes.setStatus('current') dvmrpNeighborRcvBadPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborRcvBadPkts.setStatus('current') dvmrpNeighborRcvBadRoutes = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborRcvBadRoutes.setStatus('current') dvmrpNeighborState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("oneway", 1), ("active", 2), ("ignoring", 3), ("down", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpNeighborState.setStatus('current') dvmrpRouteTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4), ) if mibBuilder.loadTexts: dvmrpRouteTable.setStatus('current') dvmrpRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1), ).setIndexNames((0, "DVMRP-STD-MIB-UNI", "dvmrpRouteSource"), (0, "DVMRP-STD-MIB-UNI", "dvmrpRouteSourceMask")) if mibBuilder.loadTexts: dvmrpRouteEntry.setStatus('current') dvmrpRouteSource = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 1), IpAddress()) if mibBuilder.loadTexts: dvmrpRouteSource.setStatus('current') dvmrpRouteSourceMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 2), IpAddress()) if mibBuilder.loadTexts: dvmrpRouteSourceMask.setStatus('current') dvmrpRouteUpstreamNeighbor = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 3), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpRouteUpstreamNeighbor.setStatus('current') dvmrpRouteIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 4), InterfaceIndexOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpRouteIfIndex.setStatus('current') dvmrpRouteMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpRouteMetric.setStatus('current') dvmrpRouteExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 6), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpRouteExpiryTime.setStatus('current') dvmrpRouteUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 7), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpRouteUpTime.setStatus('current') dvmrpRouteNextHopTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5), ) if mibBuilder.loadTexts: dvmrpRouteNextHopTable.setStatus('current') dvmrpRouteNextHopEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1), ).setIndexNames((0, "DVMRP-STD-MIB-UNI", "dvmrpRouteNextHopSource"), (0, "DVMRP-STD-MIB-UNI", "dvmrpRouteNextHopSourceMask"), (0, "DVMRP-STD-MIB-UNI", "dvmrpRouteNextHopIfIndex")) if mibBuilder.loadTexts: dvmrpRouteNextHopEntry.setStatus('current') dvmrpRouteNextHopSource = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1, 1), IpAddress()) if mibBuilder.loadTexts: dvmrpRouteNextHopSource.setStatus('current') dvmrpRouteNextHopSourceMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1, 2), IpAddress()) if mibBuilder.loadTexts: dvmrpRouteNextHopSourceMask.setStatus('current') dvmrpRouteNextHopIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1, 3), InterfaceIndex()) if mibBuilder.loadTexts: dvmrpRouteNextHopIfIndex.setStatus('current') dvmrpRouteNextHopType = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("leaf", 1), ("branch", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpRouteNextHopType.setStatus('current') dvmrpPruneTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6), ) if mibBuilder.loadTexts: dvmrpPruneTable.setStatus('current') dvmrpPruneEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1), ).setIndexNames((0, "DVMRP-STD-MIB-UNI", "dvmrpPruneGroup"), (0, "DVMRP-STD-MIB-UNI", "dvmrpPruneSource"), (0, "DVMRP-STD-MIB-UNI", "dvmrpPruneSourceMask")) if mibBuilder.loadTexts: dvmrpPruneEntry.setStatus('current') dvmrpPruneGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1, 1), IpAddress()) if mibBuilder.loadTexts: dvmrpPruneGroup.setStatus('current') dvmrpPruneSource = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1, 2), IpAddress()) if mibBuilder.loadTexts: dvmrpPruneSource.setStatus('current') dvmrpPruneSourceMask = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1, 3), IpAddress()) if mibBuilder.loadTexts: dvmrpPruneSourceMask.setStatus('current') dvmrpPruneExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dvmrpPruneExpiryTime.setStatus('current') dvmrpTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 0)) dvmrpNeighborLoss = NotificationType((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 0, 1)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpInterfaceLocalAddress"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborState")) if mibBuilder.loadTexts: dvmrpNeighborLoss.setStatus('current') dvmrpNeighborNotPruning = NotificationType((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 0, 2)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpInterfaceLocalAddress"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborCapabilities")) if mibBuilder.loadTexts: dvmrpNeighborNotPruning.setStatus('current') dvmrpMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2)) dvmrpMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 1)) dvmrpMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2)) dvmrpMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 1, 1)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpGeneralGroup"), ("DVMRP-STD-MIB-UNI", "dvmrpInterfaceGroup"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborGroup"), ("DVMRP-STD-MIB-UNI", "dvmrpRoutingGroup"), ("DVMRP-STD-MIB-UNI", "dvmrpTreeGroup"), ("DVMRP-STD-MIB-UNI", "dvmrpSecurityGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrpMIBCompliance = dvmrpMIBCompliance.setStatus('current') dvmrpGeneralGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 2)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpVersionString"), ("DVMRP-STD-MIB-UNI", "dvmrpGenerationId"), ("DVMRP-STD-MIB-UNI", "dvmrpNumRoutes"), ("DVMRP-STD-MIB-UNI", "dvmrpReachableRoutes")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrpGeneralGroup = dvmrpGeneralGroup.setStatus('current') dvmrpInterfaceGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 3)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpInterfaceLocalAddress"), ("DVMRP-STD-MIB-UNI", "dvmrpInterfaceMetric"), ("DVMRP-STD-MIB-UNI", "dvmrpInterfaceStatus"), ("DVMRP-STD-MIB-UNI", "dvmrpInterfaceRcvBadPkts"), ("DVMRP-STD-MIB-UNI", "dvmrpInterfaceRcvBadRoutes"), ("DVMRP-STD-MIB-UNI", "dvmrpInterfaceSentRoutes")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrpInterfaceGroup = dvmrpInterfaceGroup.setStatus('current') dvmrpNeighborGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 4)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpNeighborUpTime"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborExpiryTime"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborGenerationId"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborMajorVersion"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborMinorVersion"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborCapabilities"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborRcvRoutes"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborRcvBadPkts"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborRcvBadRoutes"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborState")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrpNeighborGroup = dvmrpNeighborGroup.setStatus('current') dvmrpRoutingGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 5)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpRouteUpstreamNeighbor"), ("DVMRP-STD-MIB-UNI", "dvmrpRouteIfIndex"), ("DVMRP-STD-MIB-UNI", "dvmrpRouteMetric"), ("DVMRP-STD-MIB-UNI", "dvmrpRouteExpiryTime"), ("DVMRP-STD-MIB-UNI", "dvmrpRouteUpTime"), ("DVMRP-STD-MIB-UNI", "dvmrpRouteNextHopType")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrpRoutingGroup = dvmrpRoutingGroup.setStatus('current') dvmrpSecurityGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 6)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpInterfaceInterfaceKey"), ("DVMRP-STD-MIB-UNI", "dvmrpInterfaceInterfaceKeyVersion")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrpSecurityGroup = dvmrpSecurityGroup.setStatus('current') dvmrpTreeGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 7)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpPruneExpiryTime")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrpTreeGroup = dvmrpTreeGroup.setStatus('current') dvmrpNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 8)).setObjects(("DVMRP-STD-MIB-UNI", "dvmrpNeighborLoss"), ("DVMRP-STD-MIB-UNI", "dvmrpNeighborNotPruning")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrpNotificationGroup = dvmrpNotificationGroup.setStatus('current') mibBuilder.exportSymbols("DVMRP-STD-MIB-UNI", dvmrpInterfaceRcvBadRoutes=dvmrpInterfaceRcvBadRoutes, dvmrpNeighborMinorVersion=dvmrpNeighborMinorVersion, dvmrpNeighborUpTime=dvmrpNeighborUpTime, dvmrpNeighborEntry=dvmrpNeighborEntry, dvmrpReachableRoutes=dvmrpReachableRoutes, dvmrpInterfaceIfIndex=dvmrpInterfaceIfIndex, dvmrpNeighborAddress=dvmrpNeighborAddress, dvmrpPruneGroup=dvmrpPruneGroup, dvmrpPruneExpiryTime=dvmrpPruneExpiryTime, dvmrpMIBCompliances=dvmrpMIBCompliances, dvmrpRouteUpTime=dvmrpRouteUpTime, dvmrpInterfaceInterfaceKey=dvmrpInterfaceInterfaceKey, dvmrp=dvmrp, dvmrpNeighborExpiryTime=dvmrpNeighborExpiryTime, dvmrpNeighborRcvBadRoutes=dvmrpNeighborRcvBadRoutes, dvmrpInterfaceSentRoutes=dvmrpInterfaceSentRoutes, dvmrpRouteSource=dvmrpRouteSource, dvmrpRouteNextHopTable=dvmrpRouteNextHopTable, dvmrpRouteNextHopSourceMask=dvmrpRouteNextHopSourceMask, dvmrpRouteNextHopIfIndex=dvmrpRouteNextHopIfIndex, dvmrpTraps=dvmrpTraps, dvmrpNeighborNotPruning=dvmrpNeighborNotPruning, dvmrpNeighborState=dvmrpNeighborState, dvmrpRouteTable=dvmrpRouteTable, dvmrpNeighborRcvRoutes=dvmrpNeighborRcvRoutes, dvmrpScalar=dvmrpScalar, dvmrpMIBGroups=dvmrpMIBGroups, dvmrpRouteIfIndex=dvmrpRouteIfIndex, dvmrpInterfaceLocalAddress=dvmrpInterfaceLocalAddress, dvmrpNeighborCapabilities=dvmrpNeighborCapabilities, dvmrpRouteNextHopSource=dvmrpRouteNextHopSource, dvmrpRouteNextHopType=dvmrpRouteNextHopType, dvmrpInterfaceRcvBadPkts=dvmrpInterfaceRcvBadPkts, dvmrpRouteSourceMask=dvmrpRouteSourceMask, dvmrpNotificationGroup=dvmrpNotificationGroup, dvmrpInterfaceInterfaceKeyVersion=dvmrpInterfaceInterfaceKeyVersion, dvmrpSecurityGroup=dvmrpSecurityGroup, PYSNMP_MODULE_ID=dvmrpStdMIB, dvmrpRouteEntry=dvmrpRouteEntry, dvmrpNeighborTable=dvmrpNeighborTable, dvmrpRouteUpstreamNeighbor=dvmrpRouteUpstreamNeighbor, dvmrpPruneSource=dvmrpPruneSource, dvmrpGeneralGroup=dvmrpGeneralGroup, dvmrpNeighborRcvBadPkts=dvmrpNeighborRcvBadPkts, dvmrpNeighborLoss=dvmrpNeighborLoss, dvmrpStdMIB=dvmrpStdMIB, dvmrpPruneSourceMask=dvmrpPruneSourceMask, dvmrpRouteExpiryTime=dvmrpRouteExpiryTime, dvmrpNeighborMajorVersion=dvmrpNeighborMajorVersion, dvmrpRouteNextHopEntry=dvmrpRouteNextHopEntry, dvmrpInterfaceMetric=dvmrpInterfaceMetric, dvmrpNeighborGroup=dvmrpNeighborGroup, dvmrpInterfaceEntry=dvmrpInterfaceEntry, dvmrpPruneEntry=dvmrpPruneEntry, dvmrpNeighborIfIndex=dvmrpNeighborIfIndex, dvmrpInterfaceStatus=dvmrpInterfaceStatus, dvmrpPruneTable=dvmrpPruneTable, dvmrpGenerationId=dvmrpGenerationId, dvmrpMIBConformance=dvmrpMIBConformance, dvmrpInterfaceTable=dvmrpInterfaceTable, dvmrpInterfaceGroup=dvmrpInterfaceGroup, dvmrpRouteMetric=dvmrpRouteMetric, dvmrpRoutingGroup=dvmrpRoutingGroup, dvmrpVersionString=dvmrpVersionString, dvmrpMIBCompliance=dvmrpMIBCompliance, dvmrpNeighborGenerationId=dvmrpNeighborGenerationId, dvmrpNumRoutes=dvmrpNumRoutes, dvmrpTreeGroup=dvmrpTreeGroup, dvmrpMIBObjects=dvmrpMIBObjects)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_union, constraints_intersection, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueRangeConstraint') (interface_index, interface_index_or_zero) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex', 'InterfaceIndexOrZero') (snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString') (notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance') (integer32, time_ticks, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, mib_identifier, unsigned32, module_identity, iso, ip_address, bits, object_identity, gauge32, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'TimeTicks', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'MibIdentifier', 'Unsigned32', 'ModuleIdentity', 'iso', 'IpAddress', 'Bits', 'ObjectIdentity', 'Gauge32', 'Counter32') (textual_convention, display_string, row_status) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString', 'RowStatus') (usd_dvmrp_experiment,) = mibBuilder.importSymbols('Unisphere-Data-Experiment', 'usdDvmrpExperiment') dvmrp_std_mib = module_identity((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1)) dvmrpStdMIB.setRevisions(('1999-10-19 12:00',)) if mibBuilder.loadTexts: dvmrpStdMIB.setLastUpdated('9910191200Z') if mibBuilder.loadTexts: dvmrpStdMIB.setOrganization('IETF IDMR Working Group.') dvmrp_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1)) dvmrp = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1)) dvmrp_scalar = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1)) dvmrp_version_string = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1, 1), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpVersionString.setStatus('current') dvmrp_generation_id = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpGenerationId.setStatus('current') dvmrp_num_routes = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1, 3), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNumRoutes.setStatus('current') dvmrp_reachable_routes = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 1, 4), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpReachableRoutes.setStatus('current') dvmrp_interface_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2)) if mibBuilder.loadTexts: dvmrpInterfaceTable.setStatus('current') dvmrp_interface_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1)).setIndexNames((0, 'DVMRP-STD-MIB-UNI', 'dvmrpInterfaceIfIndex')) if mibBuilder.loadTexts: dvmrpInterfaceEntry.setStatus('current') dvmrp_interface_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 1), interface_index()) if mibBuilder.loadTexts: dvmrpInterfaceIfIndex.setStatus('current') dvmrp_interface_local_address = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 2), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: dvmrpInterfaceLocalAddress.setStatus('current') dvmrp_interface_metric = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 31)).clone(1)).setMaxAccess('readcreate') if mibBuilder.loadTexts: dvmrpInterfaceMetric.setStatus('current') dvmrp_interface_status = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 4), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: dvmrpInterfaceStatus.setStatus('current') dvmrp_interface_rcv_bad_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpInterfaceRcvBadPkts.setStatus('current') dvmrp_interface_rcv_bad_routes = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpInterfaceRcvBadRoutes.setStatus('current') dvmrp_interface_sent_routes = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpInterfaceSentRoutes.setStatus('current') dvmrp_interface_interface_key = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 8), snmp_admin_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: dvmrpInterfaceInterfaceKey.setStatus('current') dvmrp_interface_interface_key_version = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 2, 1, 9), integer32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: dvmrpInterfaceInterfaceKeyVersion.setStatus('current') dvmrp_neighbor_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3)) if mibBuilder.loadTexts: dvmrpNeighborTable.setStatus('current') dvmrp_neighbor_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1)).setIndexNames((0, 'DVMRP-STD-MIB-UNI', 'dvmrpNeighborIfIndex'), (0, 'DVMRP-STD-MIB-UNI', 'dvmrpNeighborAddress')) if mibBuilder.loadTexts: dvmrpNeighborEntry.setStatus('current') dvmrp_neighbor_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 1), interface_index()) if mibBuilder.loadTexts: dvmrpNeighborIfIndex.setStatus('current') dvmrp_neighbor_address = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 2), ip_address()) if mibBuilder.loadTexts: dvmrpNeighborAddress.setStatus('current') dvmrp_neighbor_up_time = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 3), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborUpTime.setStatus('current') dvmrp_neighbor_expiry_time = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 4), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborExpiryTime.setStatus('current') dvmrp_neighbor_generation_id = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborGenerationId.setStatus('current') dvmrp_neighbor_major_version = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborMajorVersion.setStatus('current') dvmrp_neighbor_minor_version = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborMinorVersion.setStatus('current') dvmrp_neighbor_capabilities = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 8), bits().clone(namedValues=named_values(('leaf', 0), ('prune', 1), ('generationID', 2), ('mtrace', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborCapabilities.setStatus('current') dvmrp_neighbor_rcv_routes = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 9), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborRcvRoutes.setStatus('current') dvmrp_neighbor_rcv_bad_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 10), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborRcvBadPkts.setStatus('current') dvmrp_neighbor_rcv_bad_routes = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 11), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborRcvBadRoutes.setStatus('current') dvmrp_neighbor_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 3, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('oneway', 1), ('active', 2), ('ignoring', 3), ('down', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpNeighborState.setStatus('current') dvmrp_route_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4)) if mibBuilder.loadTexts: dvmrpRouteTable.setStatus('current') dvmrp_route_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1)).setIndexNames((0, 'DVMRP-STD-MIB-UNI', 'dvmrpRouteSource'), (0, 'DVMRP-STD-MIB-UNI', 'dvmrpRouteSourceMask')) if mibBuilder.loadTexts: dvmrpRouteEntry.setStatus('current') dvmrp_route_source = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 1), ip_address()) if mibBuilder.loadTexts: dvmrpRouteSource.setStatus('current') dvmrp_route_source_mask = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 2), ip_address()) if mibBuilder.loadTexts: dvmrpRouteSourceMask.setStatus('current') dvmrp_route_upstream_neighbor = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 3), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpRouteUpstreamNeighbor.setStatus('current') dvmrp_route_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 4), interface_index_or_zero()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpRouteIfIndex.setStatus('current') dvmrp_route_metric = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 32))).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpRouteMetric.setStatus('current') dvmrp_route_expiry_time = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 6), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpRouteExpiryTime.setStatus('current') dvmrp_route_up_time = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 4, 1, 7), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpRouteUpTime.setStatus('current') dvmrp_route_next_hop_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5)) if mibBuilder.loadTexts: dvmrpRouteNextHopTable.setStatus('current') dvmrp_route_next_hop_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1)).setIndexNames((0, 'DVMRP-STD-MIB-UNI', 'dvmrpRouteNextHopSource'), (0, 'DVMRP-STD-MIB-UNI', 'dvmrpRouteNextHopSourceMask'), (0, 'DVMRP-STD-MIB-UNI', 'dvmrpRouteNextHopIfIndex')) if mibBuilder.loadTexts: dvmrpRouteNextHopEntry.setStatus('current') dvmrp_route_next_hop_source = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1, 1), ip_address()) if mibBuilder.loadTexts: dvmrpRouteNextHopSource.setStatus('current') dvmrp_route_next_hop_source_mask = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1, 2), ip_address()) if mibBuilder.loadTexts: dvmrpRouteNextHopSourceMask.setStatus('current') dvmrp_route_next_hop_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1, 3), interface_index()) if mibBuilder.loadTexts: dvmrpRouteNextHopIfIndex.setStatus('current') dvmrp_route_next_hop_type = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 5, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('leaf', 1), ('branch', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpRouteNextHopType.setStatus('current') dvmrp_prune_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6)) if mibBuilder.loadTexts: dvmrpPruneTable.setStatus('current') dvmrp_prune_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1)).setIndexNames((0, 'DVMRP-STD-MIB-UNI', 'dvmrpPruneGroup'), (0, 'DVMRP-STD-MIB-UNI', 'dvmrpPruneSource'), (0, 'DVMRP-STD-MIB-UNI', 'dvmrpPruneSourceMask')) if mibBuilder.loadTexts: dvmrpPruneEntry.setStatus('current') dvmrp_prune_group = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1, 1), ip_address()) if mibBuilder.loadTexts: dvmrpPruneGroup.setStatus('current') dvmrp_prune_source = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1, 2), ip_address()) if mibBuilder.loadTexts: dvmrpPruneSource.setStatus('current') dvmrp_prune_source_mask = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1, 3), ip_address()) if mibBuilder.loadTexts: dvmrpPruneSourceMask.setStatus('current') dvmrp_prune_expiry_time = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 6, 1, 4), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dvmrpPruneExpiryTime.setStatus('current') dvmrp_traps = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 0)) dvmrp_neighbor_loss = notification_type((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 0, 1)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceLocalAddress'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborState')) if mibBuilder.loadTexts: dvmrpNeighborLoss.setStatus('current') dvmrp_neighbor_not_pruning = notification_type((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 1, 1, 0, 2)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceLocalAddress'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborCapabilities')) if mibBuilder.loadTexts: dvmrpNeighborNotPruning.setStatus('current') dvmrp_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2)) dvmrp_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 1)) dvmrp_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2)) dvmrp_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 1, 1)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpGeneralGroup'), ('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceGroup'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborGroup'), ('DVMRP-STD-MIB-UNI', 'dvmrpRoutingGroup'), ('DVMRP-STD-MIB-UNI', 'dvmrpTreeGroup'), ('DVMRP-STD-MIB-UNI', 'dvmrpSecurityGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrp_mib_compliance = dvmrpMIBCompliance.setStatus('current') dvmrp_general_group = object_group((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 2)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpVersionString'), ('DVMRP-STD-MIB-UNI', 'dvmrpGenerationId'), ('DVMRP-STD-MIB-UNI', 'dvmrpNumRoutes'), ('DVMRP-STD-MIB-UNI', 'dvmrpReachableRoutes')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrp_general_group = dvmrpGeneralGroup.setStatus('current') dvmrp_interface_group = object_group((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 3)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceLocalAddress'), ('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceMetric'), ('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceStatus'), ('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceRcvBadPkts'), ('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceRcvBadRoutes'), ('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceSentRoutes')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrp_interface_group = dvmrpInterfaceGroup.setStatus('current') dvmrp_neighbor_group = object_group((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 4)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpNeighborUpTime'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborExpiryTime'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborGenerationId'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborMajorVersion'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborMinorVersion'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborCapabilities'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborRcvRoutes'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborRcvBadPkts'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborRcvBadRoutes'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborState')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrp_neighbor_group = dvmrpNeighborGroup.setStatus('current') dvmrp_routing_group = object_group((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 5)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpRouteUpstreamNeighbor'), ('DVMRP-STD-MIB-UNI', 'dvmrpRouteIfIndex'), ('DVMRP-STD-MIB-UNI', 'dvmrpRouteMetric'), ('DVMRP-STD-MIB-UNI', 'dvmrpRouteExpiryTime'), ('DVMRP-STD-MIB-UNI', 'dvmrpRouteUpTime'), ('DVMRP-STD-MIB-UNI', 'dvmrpRouteNextHopType')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrp_routing_group = dvmrpRoutingGroup.setStatus('current') dvmrp_security_group = object_group((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 6)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceInterfaceKey'), ('DVMRP-STD-MIB-UNI', 'dvmrpInterfaceInterfaceKeyVersion')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrp_security_group = dvmrpSecurityGroup.setStatus('current') dvmrp_tree_group = object_group((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 7)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpPruneExpiryTime')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrp_tree_group = dvmrpTreeGroup.setStatus('current') dvmrp_notification_group = notification_group((1, 3, 6, 1, 4, 1, 4874, 3, 2, 1, 1, 2, 2, 8)).setObjects(('DVMRP-STD-MIB-UNI', 'dvmrpNeighborLoss'), ('DVMRP-STD-MIB-UNI', 'dvmrpNeighborNotPruning')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dvmrp_notification_group = dvmrpNotificationGroup.setStatus('current') mibBuilder.exportSymbols('DVMRP-STD-MIB-UNI', dvmrpInterfaceRcvBadRoutes=dvmrpInterfaceRcvBadRoutes, dvmrpNeighborMinorVersion=dvmrpNeighborMinorVersion, dvmrpNeighborUpTime=dvmrpNeighborUpTime, dvmrpNeighborEntry=dvmrpNeighborEntry, dvmrpReachableRoutes=dvmrpReachableRoutes, dvmrpInterfaceIfIndex=dvmrpInterfaceIfIndex, dvmrpNeighborAddress=dvmrpNeighborAddress, dvmrpPruneGroup=dvmrpPruneGroup, dvmrpPruneExpiryTime=dvmrpPruneExpiryTime, dvmrpMIBCompliances=dvmrpMIBCompliances, dvmrpRouteUpTime=dvmrpRouteUpTime, dvmrpInterfaceInterfaceKey=dvmrpInterfaceInterfaceKey, dvmrp=dvmrp, dvmrpNeighborExpiryTime=dvmrpNeighborExpiryTime, dvmrpNeighborRcvBadRoutes=dvmrpNeighborRcvBadRoutes, dvmrpInterfaceSentRoutes=dvmrpInterfaceSentRoutes, dvmrpRouteSource=dvmrpRouteSource, dvmrpRouteNextHopTable=dvmrpRouteNextHopTable, dvmrpRouteNextHopSourceMask=dvmrpRouteNextHopSourceMask, dvmrpRouteNextHopIfIndex=dvmrpRouteNextHopIfIndex, dvmrpTraps=dvmrpTraps, dvmrpNeighborNotPruning=dvmrpNeighborNotPruning, dvmrpNeighborState=dvmrpNeighborState, dvmrpRouteTable=dvmrpRouteTable, dvmrpNeighborRcvRoutes=dvmrpNeighborRcvRoutes, dvmrpScalar=dvmrpScalar, dvmrpMIBGroups=dvmrpMIBGroups, dvmrpRouteIfIndex=dvmrpRouteIfIndex, dvmrpInterfaceLocalAddress=dvmrpInterfaceLocalAddress, dvmrpNeighborCapabilities=dvmrpNeighborCapabilities, dvmrpRouteNextHopSource=dvmrpRouteNextHopSource, dvmrpRouteNextHopType=dvmrpRouteNextHopType, dvmrpInterfaceRcvBadPkts=dvmrpInterfaceRcvBadPkts, dvmrpRouteSourceMask=dvmrpRouteSourceMask, dvmrpNotificationGroup=dvmrpNotificationGroup, dvmrpInterfaceInterfaceKeyVersion=dvmrpInterfaceInterfaceKeyVersion, dvmrpSecurityGroup=dvmrpSecurityGroup, PYSNMP_MODULE_ID=dvmrpStdMIB, dvmrpRouteEntry=dvmrpRouteEntry, dvmrpNeighborTable=dvmrpNeighborTable, dvmrpRouteUpstreamNeighbor=dvmrpRouteUpstreamNeighbor, dvmrpPruneSource=dvmrpPruneSource, dvmrpGeneralGroup=dvmrpGeneralGroup, dvmrpNeighborRcvBadPkts=dvmrpNeighborRcvBadPkts, dvmrpNeighborLoss=dvmrpNeighborLoss, dvmrpStdMIB=dvmrpStdMIB, dvmrpPruneSourceMask=dvmrpPruneSourceMask, dvmrpRouteExpiryTime=dvmrpRouteExpiryTime, dvmrpNeighborMajorVersion=dvmrpNeighborMajorVersion, dvmrpRouteNextHopEntry=dvmrpRouteNextHopEntry, dvmrpInterfaceMetric=dvmrpInterfaceMetric, dvmrpNeighborGroup=dvmrpNeighborGroup, dvmrpInterfaceEntry=dvmrpInterfaceEntry, dvmrpPruneEntry=dvmrpPruneEntry, dvmrpNeighborIfIndex=dvmrpNeighborIfIndex, dvmrpInterfaceStatus=dvmrpInterfaceStatus, dvmrpPruneTable=dvmrpPruneTable, dvmrpGenerationId=dvmrpGenerationId, dvmrpMIBConformance=dvmrpMIBConformance, dvmrpInterfaceTable=dvmrpInterfaceTable, dvmrpInterfaceGroup=dvmrpInterfaceGroup, dvmrpRouteMetric=dvmrpRouteMetric, dvmrpRoutingGroup=dvmrpRoutingGroup, dvmrpVersionString=dvmrpVersionString, dvmrpMIBCompliance=dvmrpMIBCompliance, dvmrpNeighborGenerationId=dvmrpNeighborGenerationId, dvmrpNumRoutes=dvmrpNumRoutes, dvmrpTreeGroup=dvmrpTreeGroup, dvmrpMIBObjects=dvmrpMIBObjects)
mesh_meshes_begin = 0 mesh_mp_score_a = 1 mesh_mp_score_b = 2 mesh_load_window = 3 mesh_checkbox_off = 4 mesh_checkbox_on = 5 mesh_white_plane = 6 mesh_white_dot = 7 mesh_player_dot = 8 mesh_flag_infantry = 9 mesh_flag_archers = 10 mesh_flag_cavalry = 11 mesh_inv_slot = 12 mesh_mp_ingame_menu = 13 mesh_mp_inventory_left = 14 mesh_mp_inventory_right = 15 mesh_mp_inventory_choose = 16 mesh_mp_inventory_slot_glove = 17 mesh_mp_inventory_slot_horse = 18 mesh_mp_inventory_slot_armor = 19 mesh_mp_inventory_slot_helmet = 20 mesh_mp_inventory_slot_boot = 21 mesh_mp_inventory_slot_empty = 22 mesh_mp_inventory_slot_equip = 23 mesh_mp_inventory_left_arrow = 24 mesh_mp_inventory_right_arrow = 25 mesh_mp_ui_host_main = 26 mesh_mp_ui_command_panel = 27 mesh_mp_ui_command_border_l = 28 mesh_mp_ui_command_border_r = 29 mesh_mp_ui_welcome_panel = 30 mesh_flag_project_sw = 31 mesh_flag_project_vg = 32 mesh_flag_project_kh = 33 mesh_flag_project_nd = 34 mesh_flag_project_rh = 35 mesh_flag_project_sr = 36 mesh_flag_projects_end = 37 mesh_flag_project_sw_miss = 38 mesh_flag_project_vg_miss = 39 mesh_flag_project_kh_miss = 40 mesh_flag_project_nd_miss = 41 mesh_flag_project_rh_miss = 42 mesh_flag_project_sr_miss = 43 mesh_flag_project_misses_end = 44 mesh_banner_a01 = 45 mesh_banner_a02 = 46 mesh_banner_a03 = 47 mesh_banner_a04 = 48 mesh_banner_a05 = 49 mesh_banner_a06 = 50 mesh_banner_a07 = 51 mesh_banner_a08 = 52 mesh_banner_a09 = 53 mesh_banner_a10 = 54 mesh_banner_a11 = 55 mesh_banner_a12 = 56 mesh_banner_a13 = 57 mesh_banner_a14 = 58 mesh_banner_a15 = 59 mesh_banner_a16 = 60 mesh_banner_a17 = 61 mesh_banner_a18 = 62 mesh_banner_a19 = 63 mesh_banner_a20 = 64 mesh_banner_a21 = 65 mesh_banner_b01 = 66 mesh_banner_b02 = 67 mesh_banner_b03 = 68 mesh_banner_b04 = 69 mesh_banner_b05 = 70 mesh_banner_b06 = 71 mesh_banner_b07 = 72 mesh_banner_b08 = 73 mesh_banner_b09 = 74 mesh_banner_b10 = 75 mesh_banner_b11 = 76 mesh_banner_b12 = 77 mesh_banner_b13 = 78 mesh_banner_b14 = 79 mesh_banner_b15 = 80 mesh_banner_b16 = 81 mesh_banner_b17 = 82 mesh_banner_b18 = 83 mesh_banner_b19 = 84 mesh_banner_b20 = 85 mesh_banner_b21 = 86 mesh_banner_c01 = 87 mesh_banner_c02 = 88 mesh_banner_c03 = 89 mesh_banner_c04 = 90 mesh_banner_c05 = 91 mesh_banner_c06 = 92 mesh_banner_c07 = 93 mesh_banner_c08 = 94 mesh_banner_c09 = 95 mesh_banner_c10 = 96 mesh_banner_c11 = 97 mesh_banner_c12 = 98 mesh_banner_c13 = 99 mesh_banner_c14 = 100 mesh_banner_c15 = 101 mesh_banner_c16 = 102 mesh_banner_c17 = 103 mesh_banner_c18 = 104 mesh_banner_c19 = 105 mesh_banner_c20 = 106 mesh_banner_c21 = 107 mesh_banner_d01 = 108 mesh_banner_d02 = 109 mesh_banner_d03 = 110 mesh_banner_d04 = 111 mesh_banner_d05 = 112 mesh_banner_d06 = 113 mesh_banner_d07 = 114 mesh_banner_d08 = 115 mesh_banner_d09 = 116 mesh_banner_d10 = 117 mesh_banner_d11 = 118 mesh_banner_d12 = 119 mesh_banner_d13 = 120 mesh_banner_d14 = 121 mesh_banner_d15 = 122 mesh_banner_d16 = 123 mesh_banner_d17 = 124 mesh_banner_d18 = 125 mesh_banner_d19 = 126 mesh_banner_d20 = 127 mesh_banner_d21 = 128 mesh_banner_e01 = 129 mesh_banner_e02 = 130 mesh_banner_e03 = 131 mesh_banner_e04 = 132 mesh_banner_e05 = 133 mesh_banner_e06 = 134 mesh_banner_e07 = 135 mesh_banner_e08 = 136 mesh_banner_kingdom_a = 137 mesh_banner_kingdom_b = 138 mesh_banner_kingdom_c = 139 mesh_banner_kingdom_d = 140 mesh_banner_kingdom_e = 141 mesh_banner_kingdom_f = 142 mesh_banner_f21 = 143 mesh_banners_default_a = 144 mesh_banners_default_b = 145 mesh_banners_default_c = 146 mesh_banners_default_d = 147 mesh_banners_default_e = 148 mesh_troop_label_banner = 149 mesh_ui_kingdom_shield_1 = 150 mesh_ui_kingdom_shield_2 = 151 mesh_ui_kingdom_shield_3 = 152 mesh_ui_kingdom_shield_4 = 153 mesh_ui_kingdom_shield_5 = 154 mesh_ui_kingdom_shield_6 = 155 mesh_mouse_arrow_down = 156 mesh_mouse_arrow_right = 157 mesh_mouse_arrow_left = 158 mesh_mouse_arrow_up = 159 mesh_mouse_arrow_plus = 160 mesh_mouse_left_click = 161 mesh_mouse_right_click = 162 mesh_main_menu_background = 163 mesh_loading_background = 164 mesh_white_bg_plane_a = 165 mesh_cb_ui_main = 166 mesh_cb_ui_maps_scene_french_farm = 167 mesh_cb_ui_maps_scene_landshut = 168 mesh_cb_ui_maps_scene_river_crossing = 169 mesh_cb_ui_maps_scene_spanish_village = 170 mesh_cb_ui_maps_scene_strangefields = 171 mesh_cb_ui_maps_scene_01 = 172 mesh_cb_ui_maps_scene_02 = 173 mesh_cb_ui_maps_scene_03 = 174 mesh_cb_ui_maps_scene_04 = 175 mesh_cb_ui_maps_scene_05 = 176 mesh_cb_ui_maps_scene_06 = 177 mesh_cb_ui_maps_scene_07 = 178 mesh_cb_ui_maps_scene_08 = 179 mesh_cb_ui_maps_scene_09 = 180 mesh_ui_kingdom_shield_7 = 181 mesh_flag_project_rb = 182 mesh_flag_project_rb_miss = 183 mesh_ui_kingdom_shield_neutral = 184 mesh_ui_team_select_shield_aus = 185 mesh_ui_team_select_shield_bri = 186 mesh_ui_team_select_shield_fra = 187 mesh_ui_team_select_shield_pru = 188 mesh_ui_team_select_shield_rus = 189 mesh_ui_team_select_shield_reb = 190 mesh_ui_team_select_shield_neu = 191 mesh_construct_mesh_stakes = 192 mesh_construct_mesh_stakes2 = 193 mesh_construct_mesh_sandbags = 194 mesh_construct_mesh_cdf_tri = 195 mesh_construct_mesh_gabion = 196 mesh_construct_mesh_fence = 197 mesh_construct_mesh_plank = 198 mesh_construct_mesh_earthwork = 199 mesh_construct_mesh_explosives = 200 mesh_bonus_icon_melee = 201 mesh_bonus_icon_accuracy = 202 mesh_bonus_icon_speed = 203 mesh_bonus_icon_reload = 204 mesh_bonus_icon_artillery = 205 mesh_bonus_icon_commander = 206 mesh_arty_icon_take_ammo = 207 mesh_arty_icon_put_ammo = 208 mesh_arty_icon_ram = 209 mesh_arty_icon_move_up = 210 mesh_arty_icon_take_control = 211 mesh_item_select_no_select = 212 mesh_mm_spyglass_ui = 213 mesh_target_plate = 214 mesh_scn_mp_arabian_harbour_select = 215 mesh_scn_mp_arabian_village_select = 216 mesh_scn_mp_ardennes_select = 217 mesh_scn_mp_avignon_select = 218 mesh_scn_mp_bordino_select = 219 mesh_scn_mp_champs_elysees_select = 220 mesh_scn_mp_columbia_farm_select = 221 mesh_scn_mp_european_city_summer_select = 222 mesh_scn_mp_european_city_winter_select = 223 mesh_scn_mp_fort_beaver_select = 224 mesh_scn_mp_fort_boyd_select = 225 mesh_scn_mp_fort_fleetwood_select = 226 mesh_scn_mp_fort_lyon_select = 227 mesh_scn_mp_fort_refleax_select = 228 mesh_scn_mp_fort_vincey_select = 229 mesh_scn_mp_french_farm_select = 230 mesh_scn_mp_german_village_select = 231 mesh_scn_mp_hougoumont_select = 232 mesh_scn_mp_hungarian_plains_select = 233 mesh_scn_mp_la_haye_sainte_select = 234 mesh_scn_mp_landshut_select = 235 mesh_scn_mp_minden_select = 236 mesh_scn_mp_oaksfield_select = 237 mesh_scn_mp_quatre_bras_select = 238 mesh_scn_mp_river_crossing_select = 239 mesh_scn_mp_roxburgh_select = 240 mesh_scn_mp_russian_village_select = 241 mesh_scn_mp_schemmerbach_select = 242 mesh_scn_mp_slovenian_village_select = 243 mesh_scn_mp_spanish_farm_select = 244 mesh_scn_mp_spanish_mountain_pass_select = 245 mesh_scn_mp_spanish_village_select = 246 mesh_scn_mp_strangefields_select = 247 mesh_scn_mp_swamp_select = 248 mesh_scn_mp_walloon_farm_select = 249 mesh_scn_mp_testing_map_select = 250 mesh_scn_mp_random_plain_select = 251 mesh_scn_mp_random_steppe_select = 252 mesh_scn_mp_random_desert_select = 253 mesh_scn_mp_random_snow_select = 254 mesh_meshes_end = 255
mesh_meshes_begin = 0 mesh_mp_score_a = 1 mesh_mp_score_b = 2 mesh_load_window = 3 mesh_checkbox_off = 4 mesh_checkbox_on = 5 mesh_white_plane = 6 mesh_white_dot = 7 mesh_player_dot = 8 mesh_flag_infantry = 9 mesh_flag_archers = 10 mesh_flag_cavalry = 11 mesh_inv_slot = 12 mesh_mp_ingame_menu = 13 mesh_mp_inventory_left = 14 mesh_mp_inventory_right = 15 mesh_mp_inventory_choose = 16 mesh_mp_inventory_slot_glove = 17 mesh_mp_inventory_slot_horse = 18 mesh_mp_inventory_slot_armor = 19 mesh_mp_inventory_slot_helmet = 20 mesh_mp_inventory_slot_boot = 21 mesh_mp_inventory_slot_empty = 22 mesh_mp_inventory_slot_equip = 23 mesh_mp_inventory_left_arrow = 24 mesh_mp_inventory_right_arrow = 25 mesh_mp_ui_host_main = 26 mesh_mp_ui_command_panel = 27 mesh_mp_ui_command_border_l = 28 mesh_mp_ui_command_border_r = 29 mesh_mp_ui_welcome_panel = 30 mesh_flag_project_sw = 31 mesh_flag_project_vg = 32 mesh_flag_project_kh = 33 mesh_flag_project_nd = 34 mesh_flag_project_rh = 35 mesh_flag_project_sr = 36 mesh_flag_projects_end = 37 mesh_flag_project_sw_miss = 38 mesh_flag_project_vg_miss = 39 mesh_flag_project_kh_miss = 40 mesh_flag_project_nd_miss = 41 mesh_flag_project_rh_miss = 42 mesh_flag_project_sr_miss = 43 mesh_flag_project_misses_end = 44 mesh_banner_a01 = 45 mesh_banner_a02 = 46 mesh_banner_a03 = 47 mesh_banner_a04 = 48 mesh_banner_a05 = 49 mesh_banner_a06 = 50 mesh_banner_a07 = 51 mesh_banner_a08 = 52 mesh_banner_a09 = 53 mesh_banner_a10 = 54 mesh_banner_a11 = 55 mesh_banner_a12 = 56 mesh_banner_a13 = 57 mesh_banner_a14 = 58 mesh_banner_a15 = 59 mesh_banner_a16 = 60 mesh_banner_a17 = 61 mesh_banner_a18 = 62 mesh_banner_a19 = 63 mesh_banner_a20 = 64 mesh_banner_a21 = 65 mesh_banner_b01 = 66 mesh_banner_b02 = 67 mesh_banner_b03 = 68 mesh_banner_b04 = 69 mesh_banner_b05 = 70 mesh_banner_b06 = 71 mesh_banner_b07 = 72 mesh_banner_b08 = 73 mesh_banner_b09 = 74 mesh_banner_b10 = 75 mesh_banner_b11 = 76 mesh_banner_b12 = 77 mesh_banner_b13 = 78 mesh_banner_b14 = 79 mesh_banner_b15 = 80 mesh_banner_b16 = 81 mesh_banner_b17 = 82 mesh_banner_b18 = 83 mesh_banner_b19 = 84 mesh_banner_b20 = 85 mesh_banner_b21 = 86 mesh_banner_c01 = 87 mesh_banner_c02 = 88 mesh_banner_c03 = 89 mesh_banner_c04 = 90 mesh_banner_c05 = 91 mesh_banner_c06 = 92 mesh_banner_c07 = 93 mesh_banner_c08 = 94 mesh_banner_c09 = 95 mesh_banner_c10 = 96 mesh_banner_c11 = 97 mesh_banner_c12 = 98 mesh_banner_c13 = 99 mesh_banner_c14 = 100 mesh_banner_c15 = 101 mesh_banner_c16 = 102 mesh_banner_c17 = 103 mesh_banner_c18 = 104 mesh_banner_c19 = 105 mesh_banner_c20 = 106 mesh_banner_c21 = 107 mesh_banner_d01 = 108 mesh_banner_d02 = 109 mesh_banner_d03 = 110 mesh_banner_d04 = 111 mesh_banner_d05 = 112 mesh_banner_d06 = 113 mesh_banner_d07 = 114 mesh_banner_d08 = 115 mesh_banner_d09 = 116 mesh_banner_d10 = 117 mesh_banner_d11 = 118 mesh_banner_d12 = 119 mesh_banner_d13 = 120 mesh_banner_d14 = 121 mesh_banner_d15 = 122 mesh_banner_d16 = 123 mesh_banner_d17 = 124 mesh_banner_d18 = 125 mesh_banner_d19 = 126 mesh_banner_d20 = 127 mesh_banner_d21 = 128 mesh_banner_e01 = 129 mesh_banner_e02 = 130 mesh_banner_e03 = 131 mesh_banner_e04 = 132 mesh_banner_e05 = 133 mesh_banner_e06 = 134 mesh_banner_e07 = 135 mesh_banner_e08 = 136 mesh_banner_kingdom_a = 137 mesh_banner_kingdom_b = 138 mesh_banner_kingdom_c = 139 mesh_banner_kingdom_d = 140 mesh_banner_kingdom_e = 141 mesh_banner_kingdom_f = 142 mesh_banner_f21 = 143 mesh_banners_default_a = 144 mesh_banners_default_b = 145 mesh_banners_default_c = 146 mesh_banners_default_d = 147 mesh_banners_default_e = 148 mesh_troop_label_banner = 149 mesh_ui_kingdom_shield_1 = 150 mesh_ui_kingdom_shield_2 = 151 mesh_ui_kingdom_shield_3 = 152 mesh_ui_kingdom_shield_4 = 153 mesh_ui_kingdom_shield_5 = 154 mesh_ui_kingdom_shield_6 = 155 mesh_mouse_arrow_down = 156 mesh_mouse_arrow_right = 157 mesh_mouse_arrow_left = 158 mesh_mouse_arrow_up = 159 mesh_mouse_arrow_plus = 160 mesh_mouse_left_click = 161 mesh_mouse_right_click = 162 mesh_main_menu_background = 163 mesh_loading_background = 164 mesh_white_bg_plane_a = 165 mesh_cb_ui_main = 166 mesh_cb_ui_maps_scene_french_farm = 167 mesh_cb_ui_maps_scene_landshut = 168 mesh_cb_ui_maps_scene_river_crossing = 169 mesh_cb_ui_maps_scene_spanish_village = 170 mesh_cb_ui_maps_scene_strangefields = 171 mesh_cb_ui_maps_scene_01 = 172 mesh_cb_ui_maps_scene_02 = 173 mesh_cb_ui_maps_scene_03 = 174 mesh_cb_ui_maps_scene_04 = 175 mesh_cb_ui_maps_scene_05 = 176 mesh_cb_ui_maps_scene_06 = 177 mesh_cb_ui_maps_scene_07 = 178 mesh_cb_ui_maps_scene_08 = 179 mesh_cb_ui_maps_scene_09 = 180 mesh_ui_kingdom_shield_7 = 181 mesh_flag_project_rb = 182 mesh_flag_project_rb_miss = 183 mesh_ui_kingdom_shield_neutral = 184 mesh_ui_team_select_shield_aus = 185 mesh_ui_team_select_shield_bri = 186 mesh_ui_team_select_shield_fra = 187 mesh_ui_team_select_shield_pru = 188 mesh_ui_team_select_shield_rus = 189 mesh_ui_team_select_shield_reb = 190 mesh_ui_team_select_shield_neu = 191 mesh_construct_mesh_stakes = 192 mesh_construct_mesh_stakes2 = 193 mesh_construct_mesh_sandbags = 194 mesh_construct_mesh_cdf_tri = 195 mesh_construct_mesh_gabion = 196 mesh_construct_mesh_fence = 197 mesh_construct_mesh_plank = 198 mesh_construct_mesh_earthwork = 199 mesh_construct_mesh_explosives = 200 mesh_bonus_icon_melee = 201 mesh_bonus_icon_accuracy = 202 mesh_bonus_icon_speed = 203 mesh_bonus_icon_reload = 204 mesh_bonus_icon_artillery = 205 mesh_bonus_icon_commander = 206 mesh_arty_icon_take_ammo = 207 mesh_arty_icon_put_ammo = 208 mesh_arty_icon_ram = 209 mesh_arty_icon_move_up = 210 mesh_arty_icon_take_control = 211 mesh_item_select_no_select = 212 mesh_mm_spyglass_ui = 213 mesh_target_plate = 214 mesh_scn_mp_arabian_harbour_select = 215 mesh_scn_mp_arabian_village_select = 216 mesh_scn_mp_ardennes_select = 217 mesh_scn_mp_avignon_select = 218 mesh_scn_mp_bordino_select = 219 mesh_scn_mp_champs_elysees_select = 220 mesh_scn_mp_columbia_farm_select = 221 mesh_scn_mp_european_city_summer_select = 222 mesh_scn_mp_european_city_winter_select = 223 mesh_scn_mp_fort_beaver_select = 224 mesh_scn_mp_fort_boyd_select = 225 mesh_scn_mp_fort_fleetwood_select = 226 mesh_scn_mp_fort_lyon_select = 227 mesh_scn_mp_fort_refleax_select = 228 mesh_scn_mp_fort_vincey_select = 229 mesh_scn_mp_french_farm_select = 230 mesh_scn_mp_german_village_select = 231 mesh_scn_mp_hougoumont_select = 232 mesh_scn_mp_hungarian_plains_select = 233 mesh_scn_mp_la_haye_sainte_select = 234 mesh_scn_mp_landshut_select = 235 mesh_scn_mp_minden_select = 236 mesh_scn_mp_oaksfield_select = 237 mesh_scn_mp_quatre_bras_select = 238 mesh_scn_mp_river_crossing_select = 239 mesh_scn_mp_roxburgh_select = 240 mesh_scn_mp_russian_village_select = 241 mesh_scn_mp_schemmerbach_select = 242 mesh_scn_mp_slovenian_village_select = 243 mesh_scn_mp_spanish_farm_select = 244 mesh_scn_mp_spanish_mountain_pass_select = 245 mesh_scn_mp_spanish_village_select = 246 mesh_scn_mp_strangefields_select = 247 mesh_scn_mp_swamp_select = 248 mesh_scn_mp_walloon_farm_select = 249 mesh_scn_mp_testing_map_select = 250 mesh_scn_mp_random_plain_select = 251 mesh_scn_mp_random_steppe_select = 252 mesh_scn_mp_random_desert_select = 253 mesh_scn_mp_random_snow_select = 254 mesh_meshes_end = 255
# hanoi: int -> int # calcula el numero de movimientos necesarios aara mover # una torre de n discos de una vara a otra # usando 3 varas y siguiendo las restricciones del puzzle hanoi # ejemplo: hanoi(0) debe dar 0, hanoi(1) debe dar 1, hanoi(2) debe dar 3 def hanoi(n): if n < 2: return n else: return 1+ 2* hanoi(n-1) #test assert hanoi(0) == 0 assert hanoi(1) == 1 assert hanoi(4) == 15 assert hanoi(5) == 31
def hanoi(n): if n < 2: return n else: return 1 + 2 * hanoi(n - 1) assert hanoi(0) == 0 assert hanoi(1) == 1 assert hanoi(4) == 15 assert hanoi(5) == 31
class Solution(object): def alienOrder(self, words): """ :type words: List[str] :rtype: str """
class Solution(object): def alien_order(self, words): """ :type words: List[str] :rtype: str """
# BUG Can live for several minutes after decapitation # Either change death-time or remove need for head entirely """ TODO BAK-AAAW # BUG If you read me as a seperate code-tag you are a dumb, dumb, dumb crawler. ''' TODO Include me with bak-aaaw too! ''' """
""" TODO BAK-AAAW # BUG If you read me as a seperate code-tag you are a dumb, dumb, dumb crawler. ''' TODO Include me with bak-aaaw too! ''' """
date = input("enter the date: ").split() dd = int(date[0]) yyyy = int(date[2]) mm = date[1] l = [] l.append(yyyy) l.append(mm) l.append(dd) t = tuple(l) print(t)
date = input('enter the date: ').split() dd = int(date[0]) yyyy = int(date[2]) mm = date[1] l = [] l.append(yyyy) l.append(mm) l.append(dd) t = tuple(l) print(t)
menu_item=0 namelist = [] while menu_item != 9: print("----------------------------") print("1. Mencetak List") print("2. Menambahkan nama ke dalam list") print("3. Menghapus nama dari list") print("4. Mengubah data dari dalam list") print("9. Keluar") menu_item= int(input("Pilih menu: ")) if menu_item == 1: current = 0 if len(namelist) > 0: while current < len(namelist): print(current, ".", namelist[current]) current = current + 1 else: print("List Kosong") elif menu_item == 2: name = input("Masukkan nama: ") namelist.append(name) elif menu_item == 3: del_name = input("Nama yang ingin dihapus: ") if del_name in namelist: #namelist.remove(del_name) dapat digunakan item_number = namelist.index(del_name) del namelist[item_number] #Kode di atas hanya menghapus nama pertama yang ada. #Kode di bawah ini menghapus semua nama """ while del_name in namelist: item_number = namelist.index(del_name) del namelist[item_number] """ else: print(del_name, "tidak ditemukan") elif menu_item == 4: old_name = input("Nama apa yang ingin diubah: ") if old_name in namelist: item_number = namelist.index(old_name) new_name = input("Nama baru: ") namelist[item_number] = new_name else: print(old_name, "tidak ditemukan") print("Selamat tinggal")
menu_item = 0 namelist = [] while menu_item != 9: print('----------------------------') print('1. Mencetak List') print('2. Menambahkan nama ke dalam list') print('3. Menghapus nama dari list') print('4. Mengubah data dari dalam list') print('9. Keluar') menu_item = int(input('Pilih menu: ')) if menu_item == 1: current = 0 if len(namelist) > 0: while current < len(namelist): print(current, '.', namelist[current]) current = current + 1 else: print('List Kosong') elif menu_item == 2: name = input('Masukkan nama: ') namelist.append(name) elif menu_item == 3: del_name = input('Nama yang ingin dihapus: ') if del_name in namelist: item_number = namelist.index(del_name) del namelist[item_number] '\n\t\t\twhile del_name in namelist:\n\t\t\t\titem_number = namelist.index(del_name)\n\t\t\t\tdel namelist[item_number]\n\t\t\t' else: print(del_name, 'tidak ditemukan') elif menu_item == 4: old_name = input('Nama apa yang ingin diubah: ') if old_name in namelist: item_number = namelist.index(old_name) new_name = input('Nama baru: ') namelist[item_number] = new_name else: print(old_name, 'tidak ditemukan') print('Selamat tinggal')
# # baseparser.py # # Base class for Modbus message parser # class ModbusBaseParser: """Base class for Modbus message parsing. """ def __init__(self): pass def msgs_from_bytes(self, b): """Parse messages from a byte string """
class Modbusbaseparser: """Base class for Modbus message parsing. """ def __init__(self): pass def msgs_from_bytes(self, b): """Parse messages from a byte string """
a, b = input().split() a = int(a) b = int(b) if a > b: print(">") elif a < b: print("<") else: print("==")
(a, b) = input().split() a = int(a) b = int(b) if a > b: print('>') elif a < b: print('<') else: print('==')
n = int(input("Enter a number: ")) for i in range(1, n+1): count = 0 for j in range(1, n+1): if i%j==0: count= count+1 if count==2: print(i)
n = int(input('Enter a number: ')) for i in range(1, n + 1): count = 0 for j in range(1, n + 1): if i % j == 0: count = count + 1 if count == 2: print(i)
#what is python #added by @Dima print("What is Data Types?") print("_______________________________________________________") print("Collections of data put together like array ") print("________________________________________________________") print("there are four data types in the Python ") print("________________________________________________________") print("""1)--List is a collection which is ordered and changeable. Allows duplicate members.""") print("________________________________________________________") print("""2)--Tuple is a collection which is ordered and unchangeable Allows duplicate members.""") print("________________________________________________________") print("""3)--Set is a collection which is unordered and unindexed. No duplicate members.""") print("________________________________________________________") print("""3)--Dictionary is a collection which is unordered, changeable and indexed. No duplicate members.""") input("press close to exit")
print('What is Data Types?') print('_______________________________________________________') print('Collections of data put together like array ') print('________________________________________________________') print('there are four data types in the Python ') print('________________________________________________________') print('1)--List is a collection which is ordered and changeable.\n Allows duplicate members.') print('________________________________________________________') print('2)--Tuple is a collection which is ordered and unchangeable\n Allows duplicate members.') print('________________________________________________________') print('3)--Set is a collection which is unordered and unindexed.\n No duplicate members.') print('________________________________________________________') print('3)--Dictionary is a collection which is unordered,\n changeable and indexed. No duplicate members.') input('press close to exit')
format = "%(asctime)s - %(levelname)s - %(name)s - %(message)s" minimal_format = "%(message)s" def _get_formatter_and_handler(use_minimal_format: bool = False): logging_dict = { "version": 1, "disable_existing_loggers": True, "formatters": { "colored": { "()": "coloredlogs.ColoredFormatter", "format": minimal_format if use_minimal_format else format, "datefmt": "%m-%d %H:%M:%S", } }, "handlers": { "console": { "class": "logging.StreamHandler", "formatter": "colored", }, }, "loggers": {}, } return logging_dict def get_logging_config(django_log_level: str, wkz_log_level: str): logging_dict = _get_formatter_and_handler() logging_dict["loggers"] = { "django": { "handlers": ["console"], "level": django_log_level, }, "wizer": { "handlers": ["console"], "level": wkz_log_level, }, } return logging_dict
format = '%(asctime)s - %(levelname)s - %(name)s - %(message)s' minimal_format = '%(message)s' def _get_formatter_and_handler(use_minimal_format: bool=False): logging_dict = {'version': 1, 'disable_existing_loggers': True, 'formatters': {'colored': {'()': 'coloredlogs.ColoredFormatter', 'format': minimal_format if use_minimal_format else format, 'datefmt': '%m-%d %H:%M:%S'}}, 'handlers': {'console': {'class': 'logging.StreamHandler', 'formatter': 'colored'}}, 'loggers': {}} return logging_dict def get_logging_config(django_log_level: str, wkz_log_level: str): logging_dict = _get_formatter_and_handler() logging_dict['loggers'] = {'django': {'handlers': ['console'], 'level': django_log_level}, 'wizer': {'handlers': ['console'], 'level': wkz_log_level}} return logging_dict
#!/bin/python3 # Set .union() Operation # https://www.hackerrank.com/challenges/py-set-union/problem if __name__ == '__main__': n = int(input()) students_n = set(map(int, input().split())) b = int(input()) students_b = set(map(int, input().split())) print(len(students_n | students_b))
if __name__ == '__main__': n = int(input()) students_n = set(map(int, input().split())) b = int(input()) students_b = set(map(int, input().split())) print(len(students_n | students_b))
def ddd(): for i in 'fasdffghdfghjhfgj': yield i a = ddd() print(next(a)) print(next(a)) print(next(a)) print(next(a)) print(next(a))
def ddd(): for i in 'fasdffghdfghjhfgj': yield i a = ddd() print(next(a)) print(next(a)) print(next(a)) print(next(a)) print(next(a))
# Customer States C_CALLING = 0 C_WAITING = 1 C_IN_VEHICLE = 2 C_ARRIVED = 3 C_DISAPPEARED = 4 # Vehicle States V_IDLE = 0 V_CRUISING = 1 V_OCCUPIED = 2 V_ASSIGNED = 3 V_OFF_DUTY = 4
c_calling = 0 c_waiting = 1 c_in_vehicle = 2 c_arrived = 3 c_disappeared = 4 v_idle = 0 v_cruising = 1 v_occupied = 2 v_assigned = 3 v_off_duty = 4
# app seettings EC2_ACCESS_ID = 'A***Q' EC2_ACCESS_KEY = 'R***I' YCSB_SIZE =0 MCROUTER_NOISE = 0 MEMCACHED_OD_SIZE = 1 MEMCACHED_SPOT_SIZE = 0 G_M_MIN = 7.5*1024 G_M_MAX = 7.5*1024 G_C_MIN = 2 G_C_MAX = 2 M_DEFAULT = 7.5*1024 C_DEFAULT = 2 G_M_MIN_2 = 7.5*1024 G_M_MAX_2 = 7.5*1024 G_C_MIN_2 = 2 G_C_MAX_2 = 2 M_DEFAULT_2 = 7.5*1024 C_DEFAULT_2 = 2
ec2_access_id = 'A***Q' ec2_access_key = 'R***I' ycsb_size = 0 mcrouter_noise = 0 memcached_od_size = 1 memcached_spot_size = 0 g_m_min = 7.5 * 1024 g_m_max = 7.5 * 1024 g_c_min = 2 g_c_max = 2 m_default = 7.5 * 1024 c_default = 2 g_m_min_2 = 7.5 * 1024 g_m_max_2 = 7.5 * 1024 g_c_min_2 = 2 g_c_max_2 = 2 m_default_2 = 7.5 * 1024 c_default_2 = 2
# B_R_R # M_S_A_W """ Coding Problem on Iterators and Generators: First, using Iterators, we will write a code that pass in a sentence and print out all words in the sentence in line. Then, we will do the same thing with generators. """ class Sentence: def __init__(self, sentence): self.sentence=sentence self.index=0 self.words=self.sentence.split() def __iter__(self): return self def __next__(self): if self.index>=len(self.words): raise StopIteration index=self.index self.index+=1 return self.words[index] my_sent=Sentence("Bo nomi parvardigori olamiyon og'oz kardam") for sent in my_sent: print(sent) # Below is generators code: def my_sentence(sentence): for word in sentence.split(): yield word my_sent=my_sentence("Bo nomi Xudovandi Karim sar kardam") for sent in my_sent: print(sent)
""" Coding Problem on Iterators and Generators: First, using Iterators, we will write a code that pass in a sentence and print out all words in the sentence in line. Then, we will do the same thing with generators. """ class Sentence: def __init__(self, sentence): self.sentence = sentence self.index = 0 self.words = self.sentence.split() def __iter__(self): return self def __next__(self): if self.index >= len(self.words): raise StopIteration index = self.index self.index += 1 return self.words[index] my_sent = sentence("Bo nomi parvardigori olamiyon og'oz kardam") for sent in my_sent: print(sent) def my_sentence(sentence): for word in sentence.split(): yield word my_sent = my_sentence('Bo nomi Xudovandi Karim sar kardam') for sent in my_sent: print(sent)
def read_input(): n = int(input()) return ( [input() for _ in range(n)], input() ) def find_position(matrix, symbol): for i in range(len(matrix)): line = matrix[i] if symbol in line: return (i, line.index(symbol)) return None (matrix, symbol) = read_input() result = find_position(matrix, symbol) if result: (row, col) = result print(f'({row}, {col})') else: print(f'{symbol} does not occur in the matrix')
def read_input(): n = int(input()) return ([input() for _ in range(n)], input()) def find_position(matrix, symbol): for i in range(len(matrix)): line = matrix[i] if symbol in line: return (i, line.index(symbol)) return None (matrix, symbol) = read_input() result = find_position(matrix, symbol) if result: (row, col) = result print(f'({row}, {col})') else: print(f'{symbol} does not occur in the matrix')
# (c) Copyright 2018 Palantir Technologies Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. def sanitize_identifier(identifier): # type: (str) -> str """ Get santized identifier name for identifiers which happen to be python keywords. """ keywords = ( "and", "as", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "exec", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "not", "or", "pass", "print", "raise", "return", "try", "while", "with", "yield", ) return "{}_".format(identifier) if identifier in keywords else identifier
def sanitize_identifier(identifier): """ Get santized identifier name for identifiers which happen to be python keywords. """ keywords = ('and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield') return '{}_'.format(identifier) if identifier in keywords else identifier
class Solution: def isValidSudoku(self, board): """ :type board: List[List[str]] :rtype: bool """ rows = [set() for _ in range(9)] cols = [set() for _ in range(9)] subboxes = [set() for _ in range(9)] for i, row in enumerate(board): for j, elem in enumerate(row): if elem == '.': continue if elem in rows[i]: return False if elem in cols[j]: return False if elem in subboxes[i // 3 * 3 + j // 3]: return False rows[i].add(elem) cols[j].add(elem) subboxes[i // 3 * 3 + j // 3].add(elem) return True
class Solution: def is_valid_sudoku(self, board): """ :type board: List[List[str]] :rtype: bool """ rows = [set() for _ in range(9)] cols = [set() for _ in range(9)] subboxes = [set() for _ in range(9)] for (i, row) in enumerate(board): for (j, elem) in enumerate(row): if elem == '.': continue if elem in rows[i]: return False if elem in cols[j]: return False if elem in subboxes[i // 3 * 3 + j // 3]: return False rows[i].add(elem) cols[j].add(elem) subboxes[i // 3 * 3 + j // 3].add(elem) return True
#string: temperatura Gc = float(input("Digite grados Centigrados: ")) Gk = (Gc + 273.15) print("el valor de los grados kelvin es el siguiente: ",Gk)
gc = float(input('Digite grados Centigrados: ')) gk = Gc + 273.15 print('el valor de los grados kelvin es el siguiente: ', Gk)
class Triangular: ### Constructor ### def __init__(self, init, end, center=None, peak=1, floor=0): # initialize attributes self._init = init self._end = end if center: #using property to test if its bewtween init and end self.center = center else: self._center = (end + init) / 2 self._peak = peak self._floor = floor ### Desctructor ### def __close__(self): # releases attributes self._init = None self._end = None self._center = None self._peak = None self._floor = None ### Getters and Setter (as Properties) ### ## init @property def init(self): return self._init @init.setter def init(self, init): if type(init) == float or type(init) == int: self._init = init else: raise ValueError( 'Error: Function initial element must be float or integer') ## end @property def end(self): return self._end @end.setter def end(self, end): if type(end) == float or type(end) == int: self._end = end else: raise ValueError( 'Error: Function end element must be float or integer') ## center @property def center(self): return self._center @center.setter def center(self, center): if type(center) == float or type(center) == int: if center > self._init and center < self._end: self._center = center else: raise ValueError( 'Error: Center of the function must be between init and end' ) else: raise ValueError( 'Error: Function center element must be float or integer') ## peak @property def peak(self): return self._peak @peak.setter def peak(self, peak): if type(peak) == float or type(peak) == int: self._peak = peak else: raise ValueError( 'Error: Function peak element must be float or integer') ## floor @property def floor(self): return self._floor @floor.setter def floor(self, floor): if type(floor) == float or type(floor) == int: self._floor = floor else: raise ValueError( 'Error: Function floor element must be float or integer') ### Methods ### def function(self, x): if x <= self._init: return self._floor elif x <= self._center: delta_y = self._peak - self._floor delta_x = self._center - self._init slope = delta_y / delta_x return slope * (x - self._init) + self._floor elif x <= self._end: delta_y = self._floor - self._peak delta_x = self._end - self._center slope = delta_y / delta_x return slope * (x - self._center) + self._peak else: return self._floor
class Triangular: def __init__(self, init, end, center=None, peak=1, floor=0): self._init = init self._end = end if center: self.center = center else: self._center = (end + init) / 2 self._peak = peak self._floor = floor def __close__(self): self._init = None self._end = None self._center = None self._peak = None self._floor = None @property def init(self): return self._init @init.setter def init(self, init): if type(init) == float or type(init) == int: self._init = init else: raise value_error('Error: Function initial element must be float or integer') @property def end(self): return self._end @end.setter def end(self, end): if type(end) == float or type(end) == int: self._end = end else: raise value_error('Error: Function end element must be float or integer') @property def center(self): return self._center @center.setter def center(self, center): if type(center) == float or type(center) == int: if center > self._init and center < self._end: self._center = center else: raise value_error('Error: Center of the function must be between init and end') else: raise value_error('Error: Function center element must be float or integer') @property def peak(self): return self._peak @peak.setter def peak(self, peak): if type(peak) == float or type(peak) == int: self._peak = peak else: raise value_error('Error: Function peak element must be float or integer') @property def floor(self): return self._floor @floor.setter def floor(self, floor): if type(floor) == float or type(floor) == int: self._floor = floor else: raise value_error('Error: Function floor element must be float or integer') def function(self, x): if x <= self._init: return self._floor elif x <= self._center: delta_y = self._peak - self._floor delta_x = self._center - self._init slope = delta_y / delta_x return slope * (x - self._init) + self._floor elif x <= self._end: delta_y = self._floor - self._peak delta_x = self._end - self._center slope = delta_y / delta_x return slope * (x - self._center) + self._peak else: return self._floor
# Python - 3.6.0 test.describe('Fixed tests') test.assert_equals(whatday(1), 'Sunday') test.assert_equals(whatday(2), 'Monday') test.assert_equals(whatday(3), 'Tuesday') test.assert_equals(whatday(8), 'Wrong, please enter a number between 1 and 7') test.assert_equals(whatday(20), 'Wrong, please enter a number between 1 and 7')
test.describe('Fixed tests') test.assert_equals(whatday(1), 'Sunday') test.assert_equals(whatday(2), 'Monday') test.assert_equals(whatday(3), 'Tuesday') test.assert_equals(whatday(8), 'Wrong, please enter a number between 1 and 7') test.assert_equals(whatday(20), 'Wrong, please enter a number between 1 and 7')
def last_vowel(s): """(str) -> str Return the last vowel in s if one exists; otherwise, return None. >>> last_vowel("cauliflower") "e" >>> last_vowel("pfft") None """ i = len(s) - 1 while i >= 0: if s[i] in 'aeiouAEIOU': return s[i] i = i - 1 return None def get_answer(prompt): ''' (str) -> str Use prompt to ask the user for a "yes" or "no" answer and continue asking until the user gives a valid response. Return the answer. ''' answer = input(prompt) while not (answer == 'yes' or answer == 'no'): answer = input(prompt) return answer def up_to_vowel(s): ''' (str) -> str Return a substring of a s from index 0 up to but not including the first bowel in s. >>> up_to_vowel('hello') 'h' >>> up_to_vowel('there') 'th' >>> up_to_vowel('cs') 'cs' ''' before_vowel = '' i = 0 while i < len(s) and not (s[i] in 'aeiouAEIOU'): before_vowel = before_vowel + s[i] i = i + 1 return before_vowel
def last_vowel(s): """(str) -> str Return the last vowel in s if one exists; otherwise, return None. >>> last_vowel("cauliflower") "e" >>> last_vowel("pfft") None """ i = len(s) - 1 while i >= 0: if s[i] in 'aeiouAEIOU': return s[i] i = i - 1 return None def get_answer(prompt): """ (str) -> str Use prompt to ask the user for a "yes" or "no" answer and continue asking until the user gives a valid response. Return the answer. """ answer = input(prompt) while not (answer == 'yes' or answer == 'no'): answer = input(prompt) return answer def up_to_vowel(s): """ (str) -> str Return a substring of a s from index 0 up to but not including the first bowel in s. >>> up_to_vowel('hello') 'h' >>> up_to_vowel('there') 'th' >>> up_to_vowel('cs') 'cs' """ before_vowel = '' i = 0 while i < len(s) and (not s[i] in 'aeiouAEIOU'): before_vowel = before_vowel + s[i] i = i + 1 return before_vowel
# # PySNMP MIB module TPLINK-PORTMIRROR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-PORTMIRROR-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:25:34 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") SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") ModuleIdentity, TimeTicks, Counter32, Gauge32, IpAddress, Unsigned32, Counter64, Bits, iso, ObjectIdentity, MibIdentifier, NotificationType, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "TimeTicks", "Counter32", "Gauge32", "IpAddress", "Unsigned32", "Counter64", "Bits", "iso", "ObjectIdentity", "MibIdentifier", "NotificationType", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") tplinkMgmt, = mibBuilder.importSymbols("TPLINK-MIB", "tplinkMgmt") tplinkPortMirrorMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 11863, 6, 11)) tplinkPortMirrorMIB.setRevisions(('2012-12-14 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: tplinkPortMirrorMIB.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: tplinkPortMirrorMIB.setLastUpdated('201212140000Z') if mibBuilder.loadTexts: tplinkPortMirrorMIB.setOrganization('TPLINK') if mibBuilder.loadTexts: tplinkPortMirrorMIB.setContactInfo('www.tplink.com.cn') if mibBuilder.loadTexts: tplinkPortMirrorMIB.setDescription('The config of the port mirror.') tplinkPortMirrorMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1)) tplinkPortMirrorMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 11863, 6, 11, 2)) tpPortMirrorTable = MibTable((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1), ) if mibBuilder.loadTexts: tpPortMirrorTable.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorTable.setDescription('') tpPortMirrorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1), ).setIndexNames((0, "TPLINK-PORTMIRROR-MIB", "tpPortMirrorSession")) if mibBuilder.loadTexts: tpPortMirrorEntry.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorEntry.setDescription('') tpPortMirrorSession = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tpPortMirrorSession.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorSession.setDescription('This object indicates the session number of the mirror group.') tpPortMirrorDestination = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 2), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tpPortMirrorDestination.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorDestination.setDescription(' This object indicates a destination port which monitors specified ports on the switch, should be given as 1/0/1. Note: The member of LAG cannot be assigned as a destination port.') tpPortMirrorIngressSource = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 3), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tpPortMirrorIngressSource.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorIngressSource.setDescription(" This object indicates a list of the source ports. Any packets received from these ports will be copyed to the assigned destination port. This should be given as 1/0/1,1/0/2-12. Note: The ports in other sessions and destination port can't add to this list.") tpPortMirrorEgressSource = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 4), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tpPortMirrorEgressSource.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorEgressSource.setDescription(" This object indicates a list of the source ports. Any packets sended out from these ports will be copyed to the assigned destination ports.This should be given as 1/0/1,1/0/2-12. Note: The ports in other sessions and destination port can't add to this list.") tpPortMirrorBothSource = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 5), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tpPortMirrorBothSource.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorBothSource.setDescription(" This object indicates a list of the source ports. Any packets received or sended out from these ports will be copyed to the assigned destination ports.This should be given as 1/0/1,1/0/2-12. Note: The ports in other sessions and destination port can't add to this list.") tpPortMirrorSessionState = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("negative", 1), ("active", 2), ("clear", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: tpPortMirrorSessionState.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorSessionState.setDescription(' This object indicates the state of mirror session.If a session has been assigned both destination port and source ports, then the value of this object changes to active(2). Otherwise the value of this object is to be negative(1). When the value of this object is assigned to clear(3), then the configuration of this session will be cleared, and the state changes to negative(1). Be aware of that only clear(3) can be assigned to this object.') mibBuilder.exportSymbols("TPLINK-PORTMIRROR-MIB", tpPortMirrorIngressSource=tpPortMirrorIngressSource, tpPortMirrorTable=tpPortMirrorTable, tpPortMirrorBothSource=tpPortMirrorBothSource, tplinkPortMirrorMIBNotifications=tplinkPortMirrorMIBNotifications, tpPortMirrorEgressSource=tpPortMirrorEgressSource, tpPortMirrorSessionState=tpPortMirrorSessionState, tplinkPortMirrorMIBObjects=tplinkPortMirrorMIBObjects, tpPortMirrorEntry=tpPortMirrorEntry, tpPortMirrorDestination=tpPortMirrorDestination, tplinkPortMirrorMIB=tplinkPortMirrorMIB, tpPortMirrorSession=tpPortMirrorSession, PYSNMP_MODULE_ID=tplinkPortMirrorMIB)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueRangeConstraint', 'ValueSizeConstraint') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (module_identity, time_ticks, counter32, gauge32, ip_address, unsigned32, counter64, bits, iso, object_identity, mib_identifier, notification_type, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'TimeTicks', 'Counter32', 'Gauge32', 'IpAddress', 'Unsigned32', 'Counter64', 'Bits', 'iso', 'ObjectIdentity', 'MibIdentifier', 'NotificationType', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') (tplink_mgmt,) = mibBuilder.importSymbols('TPLINK-MIB', 'tplinkMgmt') tplink_port_mirror_mib = module_identity((1, 3, 6, 1, 4, 1, 11863, 6, 11)) tplinkPortMirrorMIB.setRevisions(('2012-12-14 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: tplinkPortMirrorMIB.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: tplinkPortMirrorMIB.setLastUpdated('201212140000Z') if mibBuilder.loadTexts: tplinkPortMirrorMIB.setOrganization('TPLINK') if mibBuilder.loadTexts: tplinkPortMirrorMIB.setContactInfo('www.tplink.com.cn') if mibBuilder.loadTexts: tplinkPortMirrorMIB.setDescription('The config of the port mirror.') tplink_port_mirror_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1)) tplink_port_mirror_mib_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 11863, 6, 11, 2)) tp_port_mirror_table = mib_table((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1)) if mibBuilder.loadTexts: tpPortMirrorTable.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorTable.setDescription('') tp_port_mirror_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1)).setIndexNames((0, 'TPLINK-PORTMIRROR-MIB', 'tpPortMirrorSession')) if mibBuilder.loadTexts: tpPortMirrorEntry.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorEntry.setDescription('') tp_port_mirror_session = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: tpPortMirrorSession.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorSession.setDescription('This object indicates the session number of the mirror group.') tp_port_mirror_destination = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 2), octet_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: tpPortMirrorDestination.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorDestination.setDescription(' This object indicates a destination port which monitors specified ports on the switch, should be given as 1/0/1. Note: The member of LAG cannot be assigned as a destination port.') tp_port_mirror_ingress_source = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 3), octet_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: tpPortMirrorIngressSource.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorIngressSource.setDescription(" This object indicates a list of the source ports. Any packets received from these ports will be copyed to the assigned destination port. This should be given as 1/0/1,1/0/2-12. Note: The ports in other sessions and destination port can't add to this list.") tp_port_mirror_egress_source = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 4), octet_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: tpPortMirrorEgressSource.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorEgressSource.setDescription(" This object indicates a list of the source ports. Any packets sended out from these ports will be copyed to the assigned destination ports.This should be given as 1/0/1,1/0/2-12. Note: The ports in other sessions and destination port can't add to this list.") tp_port_mirror_both_source = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 5), octet_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: tpPortMirrorBothSource.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorBothSource.setDescription(" This object indicates a list of the source ports. Any packets received or sended out from these ports will be copyed to the assigned destination ports.This should be given as 1/0/1,1/0/2-12. Note: The ports in other sessions and destination port can't add to this list.") tp_port_mirror_session_state = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 11, 1, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('negative', 1), ('active', 2), ('clear', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: tpPortMirrorSessionState.setStatus('current') if mibBuilder.loadTexts: tpPortMirrorSessionState.setDescription(' This object indicates the state of mirror session.If a session has been assigned both destination port and source ports, then the value of this object changes to active(2). Otherwise the value of this object is to be negative(1). When the value of this object is assigned to clear(3), then the configuration of this session will be cleared, and the state changes to negative(1). Be aware of that only clear(3) can be assigned to this object.') mibBuilder.exportSymbols('TPLINK-PORTMIRROR-MIB', tpPortMirrorIngressSource=tpPortMirrorIngressSource, tpPortMirrorTable=tpPortMirrorTable, tpPortMirrorBothSource=tpPortMirrorBothSource, tplinkPortMirrorMIBNotifications=tplinkPortMirrorMIBNotifications, tpPortMirrorEgressSource=tpPortMirrorEgressSource, tpPortMirrorSessionState=tpPortMirrorSessionState, tplinkPortMirrorMIBObjects=tplinkPortMirrorMIBObjects, tpPortMirrorEntry=tpPortMirrorEntry, tpPortMirrorDestination=tpPortMirrorDestination, tplinkPortMirrorMIB=tplinkPortMirrorMIB, tpPortMirrorSession=tpPortMirrorSession, PYSNMP_MODULE_ID=tplinkPortMirrorMIB)
File = open("File PROTEK/Data2.txt", "w") while True: nim = input('Masukan NIM:') nama = input('Masukan Nama:') alamat = input('Masukan Alamat:') print('') File.write(nim + '|' + nama + '|' + alamat + '\n') repeat = input('Apakah ingin memasukan data lagi?(y/n):') print('') if(repeat in {'n','N'}): File.close() break
file = open('File PROTEK/Data2.txt', 'w') while True: nim = input('Masukan NIM:') nama = input('Masukan Nama:') alamat = input('Masukan Alamat:') print('') File.write(nim + '|' + nama + '|' + alamat + '\n') repeat = input('Apakah ingin memasukan data lagi?(y/n):') print('') if repeat in {'n', 'N'}: File.close() break
# Lv-677_Ivan_Vaulin # Task2. Write a script that checks the login that the user enters. # If the login is "First", then greet the users. If the login is different, send an error message. # (need to use loop while) user_name = input('Hello, please input your Log in:') while user_name != 'First': user_name = input('Error: wrong username, please try one more time. Username:') else: print('Greeting. Access granted!!!', user_name)
user_name = input('Hello, please input your Log in:') while user_name != 'First': user_name = input('Error: wrong username, please try one more time. Username:') else: print('Greeting. Access granted!!!', user_name)
""" 1272. Remove Interval Medium Given a sorted list of disjoint intervals, each interval intervals[i] = [a, b] represents the set of real numbers x such that a <= x < b. We remove the intersections between any interval in intervals and the interval toBeRemoved. Return a sorted list of intervals after all such removals. Example 1: Input: intervals = [[0,2],[3,4],[5,7]], toBeRemoved = [1,6] Output: [[0,1],[6,7]] Example 2: Input: intervals = [[0,5]], toBeRemoved = [2,3] Output: [[0,2],[3,5]] Example 3: Input: intervals = [[-5,-4],[-3,-2],[1,2],[3,5],[8,9]], toBeRemoved = [-1,4] Output: [[-5,-4],[-3,-2],[4,5],[8,9]] Constraints: 1 <= intervals.length <= 10^4 -10^9 <= intervals[i][0] < intervals[i][1] <= 10^9 """ class Solution: def removeInterval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: res = [] for a, b in intervals: if a < toBeRemoved[0]: res.append([a, min(b, toBeRemoved[0])]) if b > toBeRemoved[1]: res.append([max(a, toBeRemoved[1]), b]) return res class Solution: def removeInterval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: res = [] for a, b in intervals: if a < toBeRemoved[0]: res += [a, min(b, toBeRemoved[0])], if b > toBeRemoved[1]: res += [max(a, toBeRemoved[1]), b], return res
""" 1272. Remove Interval Medium Given a sorted list of disjoint intervals, each interval intervals[i] = [a, b] represents the set of real numbers x such that a <= x < b. We remove the intersections between any interval in intervals and the interval toBeRemoved. Return a sorted list of intervals after all such removals. Example 1: Input: intervals = [[0,2],[3,4],[5,7]], toBeRemoved = [1,6] Output: [[0,1],[6,7]] Example 2: Input: intervals = [[0,5]], toBeRemoved = [2,3] Output: [[0,2],[3,5]] Example 3: Input: intervals = [[-5,-4],[-3,-2],[1,2],[3,5],[8,9]], toBeRemoved = [-1,4] Output: [[-5,-4],[-3,-2],[4,5],[8,9]] Constraints: 1 <= intervals.length <= 10^4 -10^9 <= intervals[i][0] < intervals[i][1] <= 10^9 """ class Solution: def remove_interval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: res = [] for (a, b) in intervals: if a < toBeRemoved[0]: res.append([a, min(b, toBeRemoved[0])]) if b > toBeRemoved[1]: res.append([max(a, toBeRemoved[1]), b]) return res class Solution: def remove_interval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: res = [] for (a, b) in intervals: if a < toBeRemoved[0]: res += ([a, min(b, toBeRemoved[0])],) if b > toBeRemoved[1]: res += ([max(a, toBeRemoved[1]), b],) return res
# -*- coding: UTF-8 -*- # Copyright 2013 Felix Friedrich, Felix Schwarz # Copyright 2015, 2019 Felix Schwarz # The source code in this file is licensed under the MIT license. # SPDX-License-Identifier: MIT __all__ = ['Result'] class Result(object): def __init__(self, value, **data): self.value = value self.data = data def __repr__(self): klassname = self.__class__.__name__ extra_data = [repr(self.value)] for key, value in sorted(self.data.items()): extra_data.append('%s=%r' % (key, value)) return '%s(%s)' % (klassname, ', '.join(extra_data)) def __eq__(self, other): if isinstance(other, self.value.__class__): return self.value == other elif hasattr(other, 'value'): return self.value == other.value return False def __ne__(self, other): return not self.__eq__(other) def __bool__(self): return bool(self.value) # Python 2 compatibility __nonzero__ = __bool__ def __len__(self): return len(self.value) def __getattr__(self, key): if key in self.data: return self.data[key] elif key.startswith('set_'): attr_name = key[4:] if attr_name in self.data: return self.__build_setter(attr_name) klassname = self.__class__.__name__ msg = '%r object has no attribute %r' % (klassname, key) raise AttributeError(msg) def __build_setter(self, attr_name): def setter(value): self.data[attr_name] = value setter.__name__ = 'set_'+attr_name return setter def __setattr__(self, key, value): if key in ('data', 'value'): # instance attributes, set by constructor self.__dict__[key] = value return if key not in self.data: raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, key)) setter = getattr(self, 'set_'+key) setter(value)
__all__ = ['Result'] class Result(object): def __init__(self, value, **data): self.value = value self.data = data def __repr__(self): klassname = self.__class__.__name__ extra_data = [repr(self.value)] for (key, value) in sorted(self.data.items()): extra_data.append('%s=%r' % (key, value)) return '%s(%s)' % (klassname, ', '.join(extra_data)) def __eq__(self, other): if isinstance(other, self.value.__class__): return self.value == other elif hasattr(other, 'value'): return self.value == other.value return False def __ne__(self, other): return not self.__eq__(other) def __bool__(self): return bool(self.value) __nonzero__ = __bool__ def __len__(self): return len(self.value) def __getattr__(self, key): if key in self.data: return self.data[key] elif key.startswith('set_'): attr_name = key[4:] if attr_name in self.data: return self.__build_setter(attr_name) klassname = self.__class__.__name__ msg = '%r object has no attribute %r' % (klassname, key) raise attribute_error(msg) def __build_setter(self, attr_name): def setter(value): self.data[attr_name] = value setter.__name__ = 'set_' + attr_name return setter def __setattr__(self, key, value): if key in ('data', 'value'): self.__dict__[key] = value return if key not in self.data: raise attribute_error("'%s' object has no attribute '%s'" % (self.__class__.__name__, key)) setter = getattr(self, 'set_' + key) setter(value)
# Test that systemctl will accept service names both with or without suffix. def test_dot_service(sysvenv): service = sysvenv.create_service("foo") service.will_do("status", 3) service.direct_enable() out, err, status = sysvenv.systemctl("status", "foo.service") assert status == 3 assert service.did("status")
def test_dot_service(sysvenv): service = sysvenv.create_service('foo') service.will_do('status', 3) service.direct_enable() (out, err, status) = sysvenv.systemctl('status', 'foo.service') assert status == 3 assert service.did('status')
num_list = [] num_list.append(1) num_list.append(2) num_list.append(3) print(num_list[1])
num_list = [] num_list.append(1) num_list.append(2) num_list.append(3) print(num_list[1])
class BaseModule: """ Base module class to be extended by feature modules. """ command_char = '' # To be updated in subclasses module_name = '' module_description = '' commands = [] def __init__(self, user_cmd_char): """ Sets command prefix while initializing. :param user_cmd_char: command prefix. """ self.command_char = user_cmd_char def get_module_name(self): """ Returns name of the module. :return: name of the module in string. """ return self.module_name def get_module_description(self): """ Returns description of the module. :return: description of the module in string. """ return self.module_description def get_all_commands(self): """ Returns all commands of the module. :return: commands of the module in string list. """ return self.commands async def parse_command(self, bundle): """ Decides which command should be executed and calls it. To be implemented on subclasses. :param bundle Dictionary passed in from caller. :return: no return value. """ pass
class Basemodule: """ Base module class to be extended by feature modules. """ command_char = '' module_name = '' module_description = '' commands = [] def __init__(self, user_cmd_char): """ Sets command prefix while initializing. :param user_cmd_char: command prefix. """ self.command_char = user_cmd_char def get_module_name(self): """ Returns name of the module. :return: name of the module in string. """ return self.module_name def get_module_description(self): """ Returns description of the module. :return: description of the module in string. """ return self.module_description def get_all_commands(self): """ Returns all commands of the module. :return: commands of the module in string list. """ return self.commands async def parse_command(self, bundle): """ Decides which command should be executed and calls it. To be implemented on subclasses. :param bundle Dictionary passed in from caller. :return: no return value. """ pass
#!/usr/bin/env python # Paths VIDEOS_PATH = '~/Desktop/Downloaded Youtube Videos' VIDEOS_PATH_WIN = '/mnt/e/Alex/Videos/Youtube'
videos_path = '~/Desktop/Downloaded Youtube Videos' videos_path_win = '/mnt/e/Alex/Videos/Youtube'
# Variables that contain the user credentials to access Twitter API ACCESS_TOKEN ="< Enter your Twitter Access Token >" ACCESS_TOKEN_SECRET ="< Enter your Access Token Secret >" CONSUMER_KEY = "< Enter Consumer Key >" CONSUMER_SECRET = "< Enter Consumer Key Secret >"
access_token = '< Enter your Twitter Access Token >' access_token_secret = '< Enter your Access Token Secret >' consumer_key = '< Enter Consumer Key >' consumer_secret = '< Enter Consumer Key Secret >'
""" https://adventofcode.com/2018/day/4 """ def readFile(): with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: l = [line[:-1] for line in f.readlines()] l.sort() return l class Guard: def __init__(self, id): self.id = int(id) self.idStr = id self.timeAsleep = 0 self.minutes = [0 for min in range(60)] def sleep(self, start, end): self.timeAsleep += (end - start) for i in range(start, end): self.minutes[i] += 1 def evaluateLines(vals : list): curID = -1 start = -1 guards = {} for val in vals: timestamp = val[1:17] event = val[19:] if "#" in event: curID = event.split()[1][1:] if curID not in guards: guards[curID] = Guard(curID) elif event == "falls asleep": start = int(timestamp[14:16]) else: # event == "wakes up" end = int(timestamp[14:16]) guards[curID].sleep(start, end) return guards def part1(guards : dict): maxID = "" maxSleep = 0 for guard in guards: if guards[guard].timeAsleep > maxSleep: maxSleep = guards[guard].timeAsleep maxID = guard guard = guards[maxID] return guard.id * guard.minutes.index(max(guard.minutes)) def part2(guards : dict): maxID = "" maxAmount = 0 for guard in guards: cur = max(guards[guard].minutes) if cur > maxAmount: maxAmount = cur maxID = guard guard = guards[maxID] return guard.id * guard.minutes.index(max(guard.minutes)) if __name__ == "__main__": vals = readFile() guards = evaluateLines(vals) print(f"Part 1: {part1(guards)}") print(f"Part 2: {part2(guards)}")
""" https://adventofcode.com/2018/day/4 """ def read_file(): with open(f"{__file__.rstrip('code.py')}input.txt", 'r') as f: l = [line[:-1] for line in f.readlines()] l.sort() return l class Guard: def __init__(self, id): self.id = int(id) self.idStr = id self.timeAsleep = 0 self.minutes = [0 for min in range(60)] def sleep(self, start, end): self.timeAsleep += end - start for i in range(start, end): self.minutes[i] += 1 def evaluate_lines(vals: list): cur_id = -1 start = -1 guards = {} for val in vals: timestamp = val[1:17] event = val[19:] if '#' in event: cur_id = event.split()[1][1:] if curID not in guards: guards[curID] = guard(curID) elif event == 'falls asleep': start = int(timestamp[14:16]) else: end = int(timestamp[14:16]) guards[curID].sleep(start, end) return guards def part1(guards: dict): max_id = '' max_sleep = 0 for guard in guards: if guards[guard].timeAsleep > maxSleep: max_sleep = guards[guard].timeAsleep max_id = guard guard = guards[maxID] return guard.id * guard.minutes.index(max(guard.minutes)) def part2(guards: dict): max_id = '' max_amount = 0 for guard in guards: cur = max(guards[guard].minutes) if cur > maxAmount: max_amount = cur max_id = guard guard = guards[maxID] return guard.id * guard.minutes.index(max(guard.minutes)) if __name__ == '__main__': vals = read_file() guards = evaluate_lines(vals) print(f'Part 1: {part1(guards)}') print(f'Part 2: {part2(guards)}')
ft_name = 'points' featuretype_api = datastore_api.featuretype(name=ft_name, data={ "featureType": { "circularArcPresent": False, "enabled": True, "forcedDecimal": False, "maxFeatures": 0, "name": ft_name, "nativeName": ft_name, "numDecimals": 0, "overridingServiceSRS": False, "padWithZeros": False, "projectionPolicy": "FORCE_DECLARED", "serviceConfiguration": False, "skipNumberMatched": False, "srs": "EPSG:404000", "title": ft_name, "attributes": { "attribute": { "binding": "java.lang.String", "maxOccurs": 1, "minOccurs": 0, "name": "point", "nillable": True } }, "keywords": { "string": [ "features", ft_name ] }, "latLonBoundingBox": { "maxx": -68.036694, "maxy": 49.211179, "minx": -124.571077, "miny": 25.404663, "crs": "EPSG:4326" }, "nativeBoundingBox": { "minx": -90, "maxx": 90, "miny": -180, "maxy": 180, "crs": "EPSG:4326" }, } })
ft_name = 'points' featuretype_api = datastore_api.featuretype(name=ft_name, data={'featureType': {'circularArcPresent': False, 'enabled': True, 'forcedDecimal': False, 'maxFeatures': 0, 'name': ft_name, 'nativeName': ft_name, 'numDecimals': 0, 'overridingServiceSRS': False, 'padWithZeros': False, 'projectionPolicy': 'FORCE_DECLARED', 'serviceConfiguration': False, 'skipNumberMatched': False, 'srs': 'EPSG:404000', 'title': ft_name, 'attributes': {'attribute': {'binding': 'java.lang.String', 'maxOccurs': 1, 'minOccurs': 0, 'name': 'point', 'nillable': True}}, 'keywords': {'string': ['features', ft_name]}, 'latLonBoundingBox': {'maxx': -68.036694, 'maxy': 49.211179, 'minx': -124.571077, 'miny': 25.404663, 'crs': 'EPSG:4326'}, 'nativeBoundingBox': {'minx': -90, 'maxx': 90, 'miny': -180, 'maxy': 180, 'crs': 'EPSG:4326'}}})
# Time: O(k * n^2) # Space: O(n^2) class Solution(object): def knightProbability(self, N, K, r, c): """ :type N: int :type K: int :type r: int :type c: int :rtype: float """ directions = \ [[ 1, 2], [ 1, -2], [ 2, 1], [ 2, -1], \ [-1, 2], [-1, -2], [-2, 1], [-2, -1]] dp = [[[1 for _ in xrange(N)] for _ in xrange(N)] for _ in xrange(2)] for step in xrange(1, K+1): for i in xrange(N): for j in xrange(N): dp[step%2][i][j] = 0 for direction in directions: rr, cc = i+direction[0], j+direction[1] if 0 <= cc < N and 0 <= rr < N: dp[step%2][i][j] += 0.125 * dp[(step-1)%2][rr][cc] return dp[K%2][r][c]
class Solution(object): def knight_probability(self, N, K, r, c): """ :type N: int :type K: int :type r: int :type c: int :rtype: float """ directions = [[1, 2], [1, -2], [2, 1], [2, -1], [-1, 2], [-1, -2], [-2, 1], [-2, -1]] dp = [[[1 for _ in xrange(N)] for _ in xrange(N)] for _ in xrange(2)] for step in xrange(1, K + 1): for i in xrange(N): for j in xrange(N): dp[step % 2][i][j] = 0 for direction in directions: (rr, cc) = (i + direction[0], j + direction[1]) if 0 <= cc < N and 0 <= rr < N: dp[step % 2][i][j] += 0.125 * dp[(step - 1) % 2][rr][cc] return dp[K % 2][r][c]
class Solution: def spiralMatrixIII(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: step = sign = 1 result = [[r0, c0]] r, c = r0, c0 while len(result) < R*C: for _ in range(step): c += sign if 0 <= r < R and 0 <= c < C: result.append([r, c]) for _ in range(step): r += sign if 0 <= r < R and 0 <= c < C: result.append([r, c]) step += 1 sign *= -1 return result
class Solution: def spiral_matrix_iii(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: step = sign = 1 result = [[r0, c0]] (r, c) = (r0, c0) while len(result) < R * C: for _ in range(step): c += sign if 0 <= r < R and 0 <= c < C: result.append([r, c]) for _ in range(step): r += sign if 0 <= r < R and 0 <= c < C: result.append([r, c]) step += 1 sign *= -1 return result
# -*- coding: utf-8 -*- def includeme(config): config.register_service_factory('.services.user.rename_user_factory', name='rename_user') config.include('.views') config.add_route('admin_index', '/') config.add_route('admin_admins', '/admins') config.add_route('admin_badge', '/badge') config.add_route('admin_features', '/features') config.add_route('admin_cohorts', '/features/cohorts') config.add_route('admin_cohorts_edit', '/features/cohorts/{id}') config.add_route('admin_groups', '/groups') config.add_route('admin_groups_csv', '/groups.csv') config.add_route('admin_nipsa', '/nipsa') config.add_route('admin_staff', '/staff') config.add_route('admin_users', '/users') config.add_route('admin_users_activate', '/users/activate') config.add_route('admin_users_delete', '/users/delete') config.add_route('admin_users_rename', '/users/rename')
def includeme(config): config.register_service_factory('.services.user.rename_user_factory', name='rename_user') config.include('.views') config.add_route('admin_index', '/') config.add_route('admin_admins', '/admins') config.add_route('admin_badge', '/badge') config.add_route('admin_features', '/features') config.add_route('admin_cohorts', '/features/cohorts') config.add_route('admin_cohorts_edit', '/features/cohorts/{id}') config.add_route('admin_groups', '/groups') config.add_route('admin_groups_csv', '/groups.csv') config.add_route('admin_nipsa', '/nipsa') config.add_route('admin_staff', '/staff') config.add_route('admin_users', '/users') config.add_route('admin_users_activate', '/users/activate') config.add_route('admin_users_delete', '/users/delete') config.add_route('admin_users_rename', '/users/rename')
## Iterative approach - BFS - Using Queue # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def invertTree(self, root: TreeNode) -> TreeNode: # ITERATIVE - USING QUEUE if root is None: return None queue = deque([root]) while queue: current = queue.popleft() current.left, current.right = current.right, current.left if current.left: queue.append(current.left) if current.right: queue.append(current.right) return root
class Solution: def invert_tree(self, root: TreeNode) -> TreeNode: if root is None: return None queue = deque([root]) while queue: current = queue.popleft() (current.left, current.right) = (current.right, current.left) if current.left: queue.append(current.left) if current.right: queue.append(current.right) return root
class ExtractJSON: @staticmethod def get_json(path:str) -> str: """ Return an extract JSON from a file """ try: return open(path, "r").readlines()[0] except ValueError: print("ERROR: file not found.") exit(-1) return None
class Extractjson: @staticmethod def get_json(path: str) -> str: """ Return an extract JSON from a file """ try: return open(path, 'r').readlines()[0] except ValueError: print('ERROR: file not found.') exit(-1) return None
motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) motorcycles[0] = 'ducati' print(motorcycles) motorcycles.append('honda') print(motorcycles) motorcycles = [] motorcycles.append('suzuki') motorcycles.append('honda') motorcycles.append('bmw') print(motorcycles) motorcycles.insert(0, 'ducati') print(motorcycles) motorcycles.insert(2, 'yamaha') print(motorcycles) del motorcycles[3] print(motorcycles) print('\npop example') popped = motorcycles.pop() print(motorcycles) print(popped) print('\npop from first position') popped = motorcycles.pop(0) print(motorcycles) print(popped) print('\nappend at the end and remove by value: only removes first ocurrence') motorcycles.append('suzuki') motorcycles.remove('suzuki') print(motorcycles) print('\nremove by value using var') remove_this = 'yamaha' motorcycles.remove(remove_this) print(motorcycles)
motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) motorcycles[0] = 'ducati' print(motorcycles) motorcycles.append('honda') print(motorcycles) motorcycles = [] motorcycles.append('suzuki') motorcycles.append('honda') motorcycles.append('bmw') print(motorcycles) motorcycles.insert(0, 'ducati') print(motorcycles) motorcycles.insert(2, 'yamaha') print(motorcycles) del motorcycles[3] print(motorcycles) print('\npop example') popped = motorcycles.pop() print(motorcycles) print(popped) print('\npop from first position') popped = motorcycles.pop(0) print(motorcycles) print(popped) print('\nappend at the end and remove by value: only removes first ocurrence') motorcycles.append('suzuki') motorcycles.remove('suzuki') print(motorcycles) print('\nremove by value using var') remove_this = 'yamaha' motorcycles.remove(remove_this) print(motorcycles)
# -*- coding: utf-8 -*- class StaticBase(object): """ Base class for StaticModel framework class. .. todo:: KDJ: What is the reason this class exists? Can it be merged with StaticModel? """ def __init__(self): if self.__class__ is StaticBase: raise NotImplementedError self.inInitial = False def initial(self): """ """ msg = "Class needs to implement 'initial' method" raise NotImplementedError(msg) def setDebug(self): """ """ msg = "Class needs to implement 'setDebug' method" raise NotImplementedError(msg) def _inInitial(self): return self.inInitial def _setInInitial(self, value): assert isinstance(value, bool) self.inInitial = value
class Staticbase(object): """ Base class for StaticModel framework class. .. todo:: KDJ: What is the reason this class exists? Can it be merged with StaticModel? """ def __init__(self): if self.__class__ is StaticBase: raise NotImplementedError self.inInitial = False def initial(self): """ """ msg = "Class needs to implement 'initial' method" raise not_implemented_error(msg) def set_debug(self): """ """ msg = "Class needs to implement 'setDebug' method" raise not_implemented_error(msg) def _in_initial(self): return self.inInitial def _set_in_initial(self, value): assert isinstance(value, bool) self.inInitial = value
# # PySNMP MIB module HP-ICF-LAYER3VLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-LAYER3VLAN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:21:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion") hpSwitch, = mibBuilder.importSymbols("HP-ICF-OID", "hpSwitch") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") Gauge32, TimeTicks, Bits, Unsigned32, Counter32, ObjectIdentity, Integer32, IpAddress, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, ModuleIdentity, NotificationType, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "TimeTicks", "Bits", "Unsigned32", "Counter32", "ObjectIdentity", "Integer32", "IpAddress", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "ModuleIdentity", "NotificationType", "MibIdentifier") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") hpicfLayer3VlanConfigMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70)) hpicfLayer3VlanConfigMIB.setRevisions(('2010-03-23 00:00',)) if mibBuilder.loadTexts: hpicfLayer3VlanConfigMIB.setLastUpdated('201003230000Z') if mibBuilder.loadTexts: hpicfLayer3VlanConfigMIB.setOrganization('HP Networking') hpicfLayer3VlanConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 1)) hpicfLayer3VlanConfigConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2)) hpicfLayer3VlanConfigTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 1, 1), ) if mibBuilder.loadTexts: hpicfLayer3VlanConfigTable.setStatus('current') hpicfLayer3VlanConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: hpicfLayer3VlanConfigEntry.setStatus('current') hpicfLayer3VlanStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('enable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpicfLayer3VlanStatus.setStatus('current') hpicfL3VlanConfigMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2, 1)) hpicfLayer3VlanConfigMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2, 2)) hpicfL3VlanConfigMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2, 1, 1)).setObjects(("HP-ICF-LAYER3VLAN-MIB", "hpicfLayer3VlanConfigGroup"), ("HP-ICF-LAYER3VLAN-MIB", "hpicfLayer3VlanConfigGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpicfL3VlanConfigMIBCompliance = hpicfL3VlanConfigMIBCompliance.setStatus('current') hpicfLayer3VlanConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2, 2, 1)).setObjects(("HP-ICF-LAYER3VLAN-MIB", "hpicfLayer3VlanStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpicfLayer3VlanConfigGroup = hpicfLayer3VlanConfigGroup.setStatus('current') mibBuilder.exportSymbols("HP-ICF-LAYER3VLAN-MIB", hpicfLayer3VlanConfig=hpicfLayer3VlanConfig, PYSNMP_MODULE_ID=hpicfLayer3VlanConfigMIB, hpicfLayer3VlanConfigTable=hpicfLayer3VlanConfigTable, hpicfLayer3VlanConfigConformance=hpicfLayer3VlanConfigConformance, hpicfLayer3VlanConfigGroup=hpicfLayer3VlanConfigGroup, hpicfLayer3VlanStatus=hpicfLayer3VlanStatus, hpicfL3VlanConfigMIBCompliance=hpicfL3VlanConfigMIBCompliance, hpicfLayer3VlanConfigMIB=hpicfLayer3VlanConfigMIB, hpicfLayer3VlanConfigEntry=hpicfLayer3VlanConfigEntry, hpicfLayer3VlanConfigMIBGroups=hpicfLayer3VlanConfigMIBGroups, hpicfL3VlanConfigMIBCompliances=hpicfL3VlanConfigMIBCompliances)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion') (hp_switch,) = mibBuilder.importSymbols('HP-ICF-OID', 'hpSwitch') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup') (gauge32, time_ticks, bits, unsigned32, counter32, object_identity, integer32, ip_address, counter64, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, module_identity, notification_type, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'TimeTicks', 'Bits', 'Unsigned32', 'Counter32', 'ObjectIdentity', 'Integer32', 'IpAddress', 'Counter64', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'ModuleIdentity', 'NotificationType', 'MibIdentifier') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') hpicf_layer3_vlan_config_mib = module_identity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70)) hpicfLayer3VlanConfigMIB.setRevisions(('2010-03-23 00:00',)) if mibBuilder.loadTexts: hpicfLayer3VlanConfigMIB.setLastUpdated('201003230000Z') if mibBuilder.loadTexts: hpicfLayer3VlanConfigMIB.setOrganization('HP Networking') hpicf_layer3_vlan_config = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 1)) hpicf_layer3_vlan_config_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2)) hpicf_layer3_vlan_config_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 1, 1)) if mibBuilder.loadTexts: hpicfLayer3VlanConfigTable.setStatus('current') hpicf_layer3_vlan_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 1, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: hpicfLayer3VlanConfigEntry.setStatus('current') hpicf_layer3_vlan_status = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 1, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone('enable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpicfLayer3VlanStatus.setStatus('current') hpicf_l3_vlan_config_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2, 1)) hpicf_layer3_vlan_config_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2, 2)) hpicf_l3_vlan_config_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2, 1, 1)).setObjects(('HP-ICF-LAYER3VLAN-MIB', 'hpicfLayer3VlanConfigGroup'), ('HP-ICF-LAYER3VLAN-MIB', 'hpicfLayer3VlanConfigGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpicf_l3_vlan_config_mib_compliance = hpicfL3VlanConfigMIBCompliance.setStatus('current') hpicf_layer3_vlan_config_group = object_group((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 70, 2, 2, 1)).setObjects(('HP-ICF-LAYER3VLAN-MIB', 'hpicfLayer3VlanStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpicf_layer3_vlan_config_group = hpicfLayer3VlanConfigGroup.setStatus('current') mibBuilder.exportSymbols('HP-ICF-LAYER3VLAN-MIB', hpicfLayer3VlanConfig=hpicfLayer3VlanConfig, PYSNMP_MODULE_ID=hpicfLayer3VlanConfigMIB, hpicfLayer3VlanConfigTable=hpicfLayer3VlanConfigTable, hpicfLayer3VlanConfigConformance=hpicfLayer3VlanConfigConformance, hpicfLayer3VlanConfigGroup=hpicfLayer3VlanConfigGroup, hpicfLayer3VlanStatus=hpicfLayer3VlanStatus, hpicfL3VlanConfigMIBCompliance=hpicfL3VlanConfigMIBCompliance, hpicfLayer3VlanConfigMIB=hpicfLayer3VlanConfigMIB, hpicfLayer3VlanConfigEntry=hpicfLayer3VlanConfigEntry, hpicfLayer3VlanConfigMIBGroups=hpicfLayer3VlanConfigMIBGroups, hpicfL3VlanConfigMIBCompliances=hpicfL3VlanConfigMIBCompliances)
class BaseClient(object): def __init__(self, username, password, randsalt): ## password = {MD5(pwrd) for old clients, SHA256(pwrd + salt) for new clients} ## randsalt = {"" for old clients, random 16-byte binary string for new clients} ## (here "old" means user was registered over an unencrypted link, without salt) self.set_user_pwrd_salt(username, (password, randsalt)) ## note: do not call on Client instances prior to login def has_legacy_password(self): return (len(self.randsalt) == 0) def set_user_pwrd_salt(self, user_name = "", pwrd_hash_salt = ("", "")): assert(type(pwrd_hash_salt) == tuple) self.username = user_name self.password = pwrd_hash_salt[0] self.randsalt = pwrd_hash_salt[1] def set_pwrd_salt(self, pwrd_hash_salt): assert(type(pwrd_hash_salt) == tuple) self.password = pwrd_hash_salt[0] self.randsalt = pwrd_hash_salt[1]
class Baseclient(object): def __init__(self, username, password, randsalt): self.set_user_pwrd_salt(username, (password, randsalt)) def has_legacy_password(self): return len(self.randsalt) == 0 def set_user_pwrd_salt(self, user_name='', pwrd_hash_salt=('', '')): assert type(pwrd_hash_salt) == tuple self.username = user_name self.password = pwrd_hash_salt[0] self.randsalt = pwrd_hash_salt[1] def set_pwrd_salt(self, pwrd_hash_salt): assert type(pwrd_hash_salt) == tuple self.password = pwrd_hash_salt[0] self.randsalt = pwrd_hash_salt[1]
TITLE = "Metadata extractor" SAVE = "Save" OPEN = "Open" EXTRACT = "Extract" DELETE = "Delete" META_TITLE = "title" META_NAMES = "names" META_CONTENT = "content" META_LOCATIONS = "locations" META_KEYWORD = "keyword" META_REF = "reference" TYPE_TXT = "txt" TYPE_ISO19115v2 = "iso19115v2" TYPE_FGDC = "fgdc" LABLE_NAME = "Name" LABLE_ORGANISATION = "Organisation" LABLE_PHONE = "Phone" LABLE_FACS = "Facs" LABLE_DELIVERY_POINT = "Delivery point" LABLE_CITY = "City" LABLE_AREA = "Area" LABLE_POSTAL_CODE = "Postal code" LABLE_COUNTRY = "Country" LABLE_EMAIL = "Email" LABLE_TYPE = "Type" LABLE_WEST = "West" LABLE_EAST = "East" LABLE_NORTH = "North" LABLE_SOUTH = "South" LABLE_LINK = "Link" LABLE_ORIGIN = "Origin" LABLE_TITLE = "Title" LABLE_DATE = "Date" LABLE_DATE_BEGIN = "Date begin" LABLE_DATE_END = "Date end" LABLE_DESCRIPT_ABSTRACT = "Abstract" LABLE_DESCRIPT_PURPOSE = "Purpose" LABLE_DESCRIPT_SUPPLEMENTAL = "Supplemental" LABLE_STATUS_PROGRESS = "Progress" LABLE_POSTAL_STATUS_UPDATE = "Update" LABLE_ACCESS = "Access" LABLE_UUID = "UUID" LABLE_CB_UUID = "Generate random UUID" LABLE_LOCATION = "Locations" LABLE_KEY_WORD = "Key words" DIALOG_TITLE_ABOUT = "About" DIALOG_TITLE_SETTINGS = "Settings" DIALOG_BTN_OK = "OK" LABLE_ABOUT_NAME = "Name" LABLE_ABOUT_VERSION = "Version" LABLE_ABOUT_AUTHOR = "Author" LABLE_HOME_PAGE = "Home page" TOOLTIP_DELETE_ELEMENT = "Delete element" TOOLTIP_ADD_REFERENCE = "Add reference" TOOLTIP_ADD_LOCATION = "Add location" TOOLTIP_ADD_KEYWORD = "Add keyword" TOOLTIP_ADD_PERSON = "Add person" TOOLTIP_OPEN_PDF = "Open PDF" TOOLTIP_SAVE_METADATA = "Save metadata" TOOLTIP_EXTRACT_METADATA = "Extract metadata" TAB_CONTROL = "Control" TAB_INFO = "Info" TAB_CONTACT = "Contact" TAB_PERSON = "Person" TAB_KEYWORD = "Keyword" TAB_LOCATION = "Location" TAB_REFERENCE = "Reference" BTN_ADD = "Add" MENU_ABOUT = "About" MENU_EXIT = "Exit" MENU_FILE = "&File" MENU_QUESTION = "&?" MENU_HELP = "Help" MENU_LOAD = "Load" MENU_FILE_LOAD = "Load file" MENU_EXTRACT = "Extract" MENU_SAVE = "Save" MENU_OPEN = "Open" MENU_SETTINGS = "Settings" MENU_TOOLTIP_HELP = "Help" MENU_TOOLTIP_ABOUT = "About" MENU_TOOLTIP_OPEN_PDF = "Open pdf file" MENU_TOOLTIP_LOAD_METADATA = "Load metadata" MENU_TOOLTIP_LOAD_FILE_METADATA = "Load file metadata" MENU_TOOLTIP_EXTRACT_METADATA = "Extract metadata" MENU_TOOLTIP_SAVE_METADATA = "Save file with metadata" MENU_TOOLTIP_EXIT = "Exit application" MENU_TOOLTIP_SETTINGS = "Settings" ICON_CLOSE = "data/icons/close.png" ICON_OPEN = "data/icons/open.png" ICON_SAVE = "data/icons/save.png" ICON_PROCESS = "data/icons/process.png" ICON_LOAD = "data/icons/load.png"
title = 'Metadata extractor' save = 'Save' open = 'Open' extract = 'Extract' delete = 'Delete' meta_title = 'title' meta_names = 'names' meta_content = 'content' meta_locations = 'locations' meta_keyword = 'keyword' meta_ref = 'reference' type_txt = 'txt' type_iso19115v2 = 'iso19115v2' type_fgdc = 'fgdc' lable_name = 'Name' lable_organisation = 'Organisation' lable_phone = 'Phone' lable_facs = 'Facs' lable_delivery_point = 'Delivery point' lable_city = 'City' lable_area = 'Area' lable_postal_code = 'Postal code' lable_country = 'Country' lable_email = 'Email' lable_type = 'Type' lable_west = 'West' lable_east = 'East' lable_north = 'North' lable_south = 'South' lable_link = 'Link' lable_origin = 'Origin' lable_title = 'Title' lable_date = 'Date' lable_date_begin = 'Date begin' lable_date_end = 'Date end' lable_descript_abstract = 'Abstract' lable_descript_purpose = 'Purpose' lable_descript_supplemental = 'Supplemental' lable_status_progress = 'Progress' lable_postal_status_update = 'Update' lable_access = 'Access' lable_uuid = 'UUID' lable_cb_uuid = 'Generate random UUID' lable_location = 'Locations' lable_key_word = 'Key words' dialog_title_about = 'About' dialog_title_settings = 'Settings' dialog_btn_ok = 'OK' lable_about_name = 'Name' lable_about_version = 'Version' lable_about_author = 'Author' lable_home_page = 'Home page' tooltip_delete_element = 'Delete element' tooltip_add_reference = 'Add reference' tooltip_add_location = 'Add location' tooltip_add_keyword = 'Add keyword' tooltip_add_person = 'Add person' tooltip_open_pdf = 'Open PDF' tooltip_save_metadata = 'Save metadata' tooltip_extract_metadata = 'Extract metadata' tab_control = 'Control' tab_info = 'Info' tab_contact = 'Contact' tab_person = 'Person' tab_keyword = 'Keyword' tab_location = 'Location' tab_reference = 'Reference' btn_add = 'Add' menu_about = 'About' menu_exit = 'Exit' menu_file = '&File' menu_question = '&?' menu_help = 'Help' menu_load = 'Load' menu_file_load = 'Load file' menu_extract = 'Extract' menu_save = 'Save' menu_open = 'Open' menu_settings = 'Settings' menu_tooltip_help = 'Help' menu_tooltip_about = 'About' menu_tooltip_open_pdf = 'Open pdf file' menu_tooltip_load_metadata = 'Load metadata' menu_tooltip_load_file_metadata = 'Load file metadata' menu_tooltip_extract_metadata = 'Extract metadata' menu_tooltip_save_metadata = 'Save file with metadata' menu_tooltip_exit = 'Exit application' menu_tooltip_settings = 'Settings' icon_close = 'data/icons/close.png' icon_open = 'data/icons/open.png' icon_save = 'data/icons/save.png' icon_process = 'data/icons/process.png' icon_load = 'data/icons/load.png'
class SpaceAge(object): def __init__(self, seconds): self.seconds = seconds def on_earth(self): return round(self.seconds / 31557600, 2) def on_mercury(self): earth = self.on_earth() return round(earth / 0.2408467, 2) def on_venus(self): return round(self.seconds/ 31557600 / 0.61519726, 2) def on_mars(self): earth = self.on_earth() return round(earth / 1.8808158, 2) def on_jupiter(self): earth = self.on_earth() return round(earth / 11.862615, 2) def on_saturn(self): earth = self.on_earth() return round(earth / 29.447498, 2) def on_uranus(self): earth = self.on_earth() return round(earth / 84.016846, 2) def on_neptune(self): earth = self.on_earth() return round(earth / 164.79132, 2)
class Spaceage(object): def __init__(self, seconds): self.seconds = seconds def on_earth(self): return round(self.seconds / 31557600, 2) def on_mercury(self): earth = self.on_earth() return round(earth / 0.2408467, 2) def on_venus(self): return round(self.seconds / 31557600 / 0.61519726, 2) def on_mars(self): earth = self.on_earth() return round(earth / 1.8808158, 2) def on_jupiter(self): earth = self.on_earth() return round(earth / 11.862615, 2) def on_saturn(self): earth = self.on_earth() return round(earth / 29.447498, 2) def on_uranus(self): earth = self.on_earth() return round(earth / 84.016846, 2) def on_neptune(self): earth = self.on_earth() return round(earth / 164.79132, 2)
class Tester(object): def __init__(self): self.results = dict() self.params = dict() self.problem_data = dict() def set_params(self, params): self.params = params
class Tester(object): def __init__(self): self.results = dict() self.params = dict() self.problem_data = dict() def set_params(self, params): self.params = params
class Solution(object): def find132pattern(self, nums): """ :type nums: List[int] :rtype: bool """ stack = [] s3 = -float("inf") for n in nums[::-1]: if n < s3: return True while stack and stack[-1] < n: s3 = stack.pop() stack.append(n) return False
class Solution(object): def find132pattern(self, nums): """ :type nums: List[int] :rtype: bool """ stack = [] s3 = -float('inf') for n in nums[::-1]: if n < s3: return True while stack and stack[-1] < n: s3 = stack.pop() stack.append(n) return False
class SlackResponseTool: @classmethod def response2is_ok(cls, response): return response["ok"] is True @classmethod def response2j_resopnse(cls, response): return response.data
class Slackresponsetool: @classmethod def response2is_ok(cls, response): return response['ok'] is True @classmethod def response2j_resopnse(cls, response): return response.data
#!/usr/bin/env python NAME = 'Cloudflare (Cloudflare Inc.)' def is_waf(self): # This should be given first priority (most reliable) if self.matchcookie('__cfduid'): return True # Not all servers return cloudflare-nginx, only nginx ones if self.matchheader(('server', 'cloudflare-nginx')) or self.matchheader(('server', 'cloudflare')): return True # Found a new nice fingerprint for cloudflare if self.matchheader(('cf-ray', '.*')): return True return False
name = 'Cloudflare (Cloudflare Inc.)' def is_waf(self): if self.matchcookie('__cfduid'): return True if self.matchheader(('server', 'cloudflare-nginx')) or self.matchheader(('server', 'cloudflare')): return True if self.matchheader(('cf-ray', '.*')): return True return False
s = input() K = int(input()) n = len(s) substr = set() for i in range(n): for j in range(i + 1, i + 1 + K): if j <= n: substr.add(s[i:j]) substr = sorted(list(substr)) print(substr[K - 1])
s = input() k = int(input()) n = len(s) substr = set() for i in range(n): for j in range(i + 1, i + 1 + K): if j <= n: substr.add(s[i:j]) substr = sorted(list(substr)) print(substr[K - 1])
def exc(): a=10 b=0 try: c=a/b except(ZeroDivisionError ): print("Divide by zero") exc()
def exc(): a = 10 b = 0 try: c = a / b except ZeroDivisionError: print('Divide by zero') exc()
""" More list manipulations """ def split(in_list, index): """ Parameters ---------- in_list: list index: int Returns ---------- Two lists, splitting in_list by 'index' Examples ---------- >>> split(['a', 'b', 'c', 'd'], 3) (['a', 'b', 'c'], ['d']) """ list1 = in_list[:index] list2 = in_list[index:] return list1, list2
""" More list manipulations """ def split(in_list, index): """ Parameters ---------- in_list: list index: int Returns ---------- Two lists, splitting in_list by 'index' Examples ---------- >>> split(['a', 'b', 'c', 'd'], 3) (['a', 'b', 'c'], ['d']) """ list1 = in_list[:index] list2 = in_list[index:] return (list1, list2)
__version__ = "0.3.43" def doc_version(): """Use this number in the documentation to avoid triggering updates of the whole documentation each time the last part of the version is changed.""" parts = __version__.split(".") return parts[0] + "." + parts[1]
__version__ = '0.3.43' def doc_version(): """Use this number in the documentation to avoid triggering updates of the whole documentation each time the last part of the version is changed.""" parts = __version__.split('.') return parts[0] + '.' + parts[1]
""" Bars Module """ def starbar(num): print('*' * num) def hashbar(num): print('#' * num) def simplebar(num): print('-' * num)
""" Bars Module """ def starbar(num): print('*' * num) def hashbar(num): print('#' * num) def simplebar(num): print('-' * num)
A, B, K = map(int, input().split()) for i, num in enumerate(range(A, B + 1)): if i + 1 > K: break print(num) x = [] for i, num in enumerate(range(B, A-1, -1)): if i + 1 > K: break x.append(num) x.sort() k = B - A +1 for i in x: if k < 2 * K: k += 1 else: print(i)
(a, b, k) = map(int, input().split()) for (i, num) in enumerate(range(A, B + 1)): if i + 1 > K: break print(num) x = [] for (i, num) in enumerate(range(B, A - 1, -1)): if i + 1 > K: break x.append(num) x.sort() k = B - A + 1 for i in x: if k < 2 * K: k += 1 else: print(i)
s = sum(range(1, 101)) ** 2 ss = sum(list(map(lambda x: x ** 2, range(1, 101)))) print(s - ss)
s = sum(range(1, 101)) ** 2 ss = sum(list(map(lambda x: x ** 2, range(1, 101)))) print(s - ss)
#-*- coding: utf-8 -*- class SQLForge: """ SQLForge This class is in charge of providing methods to craft SQL queries. Basically, the methods already implemented fit with most of the DBMS. """ def __init__(self, context): """ Constructor context: context to associate the forge with. """ self.context = context def wrap_bisec(self, sql): """ Wrap a bisection-based query. This method must be overridden to provide a way to use bisection given a DBMS. There is no universal way to perform this, so it has to be implemented in each DBMS plugin. """ raise NotImplementedError('You must define the wrap_bisec() method') def wrap_string(self, string): """ Wraps a string. This method encode the given string and/or add delimiters if required. """ if self.context.require_string_encoding(): out = 'CHAR(' for car in string: out += str(ord(car))+',' out = out[:-1] + ')' else: return "%c%s%c" % (self.context.get_string_delimiter(),string,self.context.get_string_delimiter()) return out def wrap_sql(self, sql): """ Wraps SQL query This method wraps an SQL query given the specified context. """ q = self.context.get_string_delimiter() if self.context.is_blind(): if self.context.require_truncate(): if self.context.in_string(): return "%c OR (%s=%s) %s" % (q,sql,self.wrap_field(self.context.get_default_value()),self.context.get_comment()) elif self.context.in_int(): return "%s OR (%s)=%s %s" % (self.context.get_default_value(), sql, self.wrap_field(self.context.get_default_value()), self.context.getComment()) else: if self.context.in_string(): return "%c OR (%s=%s) AND %c1%c=%c1" % (q,sql,self.wrap_field(self.context.get_default_value()),q,q,q) elif self.context.in_int(): return "%s OR (%s)=%s " % (self.context.get_default_value(), sql,self.wrap_field(self.context.get_default_value())) else: if self.context.require_truncate(): if self.context.in_string(): return "%c AND 1=0 UNION %s %s" % (q, sql, self.context.getComment()) elif self.context.in_int(): return "%s AND 1=0 UNION %s %s" % (self.context.get_default_value(), sql, self.context.get_comment()) else: if self.context.in_string(): return "%c AND 1=0 UNION %s" % (q, sql) elif self.context.in_int(): return "%s AND 1=0 UNION %s" % (self.context.get_default_value(), sql) def wrap_field(self,field): """ Wrap a field with delimiters if required. """ q = self.context.get_string_delimiter() if self.context.in_string(): return "%c%s%c" % (q,field,q) else: return "%s"%field def wrap_ending_field(self, field): """ Wrap the last field with a delimiter if required. """ q = self.context.get_string_delimiter() if self.context.in_string(): return "%c%s" % (q,field) else: return "%s"%field def string_len(self, string): """ Forge a piece of SQL retrieving the length of a string. """ return "LENGTH(%s)" % string def get_char(self, string, pos): """ Forge a piece of SQL returning the n-th character of a string. """ return "SUBSTRING(%s,%d,1)" % (string,pos) def concat_str(self, str1, str2): """ Forge a piece of SQL concatenating two strings. """ return "CONCAT(%s,%s)" % (str1, str2) def ascii(self, char): """ Forge a piece of SQL returning the ascii code of a character. """ return "ASCII(%s)" % char def count(self, records): """ Forge a piece of SQL returning the number of rows from a set of records. """ sql= "(SELECT COUNT(*) FROM (%s) AS T1)" % records return sql def take(self,records, index): """ Forge a piece of SQL returning the n-th record of a set. """ return "(%s LIMIT %d,1)" % (records, index) def select_all(self, table, db): """ Forge a piece of SQL returning all records of a given table. """ return "(SELECT * FROM %s.%s)" % (db, table) def get_table_field_record(self, field, table, db, pos): """ Forge a piece of SQL returning one record with one column from a table. """ return "(SELECT %s FROM (SELECT * FROM %s.%s) as t0 LIMIT %d,1)"%(field,db,table,pos) def forge_cdt(self, val, cmp): """ Forge a piece of SQL creating a condition. """ return "(%s)<%d" % (val,cmp) def forge_second_query(self, sql): """ Basic inband query builder. Builds the second part of an inband injection (following the UNION). """ query = 'SELECT ' columns= [] fields = self.context.get_inband_fields() tag = self.context.get_inband_tag() for i in range(len(fields)): if i==self.context.get_inband_target(): columns.append(self.concat_str(self.wrap_string(tag),self.concat_str(sql, self.wrap_string(tag)))) else: if fields[i]=='s': columns.append(self.wrap_string('0')) elif fields[i]=='i': columns.append('0') return query + ','.join(columns) def get_version(self): """ Forge a piece of SQL returning the DBMS version. Must be overridden by each DBMS plugin. """ raise NotImplementedError('You must provide the get_version() method.') def get_user(self): """ Forge a piece of SQL returning the current username. """ return 'username()' def get_current_database(self): """ Forge a piece of SQL returning the current database name. """ return 'database()' def get_databases(self): """ Forge a piece of SQL returning all the known databases. """ raise NotImplementedError('You must define the "get_databases" function.') def get_database(self, id): """ Forge a piece of SQL returning the name of the id-th database. """ return self.take(self.get_databases(), id) def get_nb_databases(self): """ Forge a piece of SQL returning the number of databases. """ return self.count(self.get_databases()) def get_database_name(self, id): """ Forge a piece of SQL returning the name of id-th database. """ return self.take(self.get_databases(),id) def get_tables(self,db): """ Forge a piece of SQL returning all the tables of the provided database (db). db: target database name. """ raise NotImplementedError('You must provide the get_tables() method.') def get_nb_tables(self,db): """ Forge a piece of SQL returning the number of tables. db: target database name. """ return self.count(self.get_tables(db)) def get_table_name(self, id, db): """ Forge a piece of SQL returning the name of a table. id: table index db: target database name. """ return self.take(self.get_tables(db), id) def get_fields(self, table, db): """ Forge a piece of SQL returning all the existing fields of a table. table: target table name db: target database name """ raise NotImplementedError('You must provide the get_fields() method.') def get_nb_fields(self, table, db): """ Forge a piece of SQL returning the number of fields. table: target table name db: target database name """ return self.count(self.get_fields(table,db)) def get_field_name(self, table, id, db): """ Forge a piece of SQL returning the field name table: target table name db: target database name id: field index """ return self.take(self.get_fields(table, db), id) def get_string_len(self, sql): """ Forge a piece of SQL returning the length of a string/subquery. sql: source string or sql """ return self.string_len(sql) def get_string_char(self, sql, pos): """ Forge a piece of SQL returning the ascii code of a string/sql sql: source string or sql pos: character position """ return self.ascii(self.get_char(sql, pos))
class Sqlforge: """ SQLForge This class is in charge of providing methods to craft SQL queries. Basically, the methods already implemented fit with most of the DBMS. """ def __init__(self, context): """ Constructor context: context to associate the forge with. """ self.context = context def wrap_bisec(self, sql): """ Wrap a bisection-based query. This method must be overridden to provide a way to use bisection given a DBMS. There is no universal way to perform this, so it has to be implemented in each DBMS plugin. """ raise not_implemented_error('You must define the wrap_bisec() method') def wrap_string(self, string): """ Wraps a string. This method encode the given string and/or add delimiters if required. """ if self.context.require_string_encoding(): out = 'CHAR(' for car in string: out += str(ord(car)) + ',' out = out[:-1] + ')' else: return '%c%s%c' % (self.context.get_string_delimiter(), string, self.context.get_string_delimiter()) return out def wrap_sql(self, sql): """ Wraps SQL query This method wraps an SQL query given the specified context. """ q = self.context.get_string_delimiter() if self.context.is_blind(): if self.context.require_truncate(): if self.context.in_string(): return '%c OR (%s=%s) %s' % (q, sql, self.wrap_field(self.context.get_default_value()), self.context.get_comment()) elif self.context.in_int(): return '%s OR (%s)=%s %s' % (self.context.get_default_value(), sql, self.wrap_field(self.context.get_default_value()), self.context.getComment()) elif self.context.in_string(): return '%c OR (%s=%s) AND %c1%c=%c1' % (q, sql, self.wrap_field(self.context.get_default_value()), q, q, q) elif self.context.in_int(): return '%s OR (%s)=%s ' % (self.context.get_default_value(), sql, self.wrap_field(self.context.get_default_value())) elif self.context.require_truncate(): if self.context.in_string(): return '%c AND 1=0 UNION %s %s' % (q, sql, self.context.getComment()) elif self.context.in_int(): return '%s AND 1=0 UNION %s %s' % (self.context.get_default_value(), sql, self.context.get_comment()) elif self.context.in_string(): return '%c AND 1=0 UNION %s' % (q, sql) elif self.context.in_int(): return '%s AND 1=0 UNION %s' % (self.context.get_default_value(), sql) def wrap_field(self, field): """ Wrap a field with delimiters if required. """ q = self.context.get_string_delimiter() if self.context.in_string(): return '%c%s%c' % (q, field, q) else: return '%s' % field def wrap_ending_field(self, field): """ Wrap the last field with a delimiter if required. """ q = self.context.get_string_delimiter() if self.context.in_string(): return '%c%s' % (q, field) else: return '%s' % field def string_len(self, string): """ Forge a piece of SQL retrieving the length of a string. """ return 'LENGTH(%s)' % string def get_char(self, string, pos): """ Forge a piece of SQL returning the n-th character of a string. """ return 'SUBSTRING(%s,%d,1)' % (string, pos) def concat_str(self, str1, str2): """ Forge a piece of SQL concatenating two strings. """ return 'CONCAT(%s,%s)' % (str1, str2) def ascii(self, char): """ Forge a piece of SQL returning the ascii code of a character. """ return 'ASCII(%s)' % char def count(self, records): """ Forge a piece of SQL returning the number of rows from a set of records. """ sql = '(SELECT COUNT(*) FROM (%s) AS T1)' % records return sql def take(self, records, index): """ Forge a piece of SQL returning the n-th record of a set. """ return '(%s LIMIT %d,1)' % (records, index) def select_all(self, table, db): """ Forge a piece of SQL returning all records of a given table. """ return '(SELECT * FROM %s.%s)' % (db, table) def get_table_field_record(self, field, table, db, pos): """ Forge a piece of SQL returning one record with one column from a table. """ return '(SELECT %s FROM (SELECT * FROM %s.%s) as t0 LIMIT %d,1)' % (field, db, table, pos) def forge_cdt(self, val, cmp): """ Forge a piece of SQL creating a condition. """ return '(%s)<%d' % (val, cmp) def forge_second_query(self, sql): """ Basic inband query builder. Builds the second part of an inband injection (following the UNION). """ query = 'SELECT ' columns = [] fields = self.context.get_inband_fields() tag = self.context.get_inband_tag() for i in range(len(fields)): if i == self.context.get_inband_target(): columns.append(self.concat_str(self.wrap_string(tag), self.concat_str(sql, self.wrap_string(tag)))) elif fields[i] == 's': columns.append(self.wrap_string('0')) elif fields[i] == 'i': columns.append('0') return query + ','.join(columns) def get_version(self): """ Forge a piece of SQL returning the DBMS version. Must be overridden by each DBMS plugin. """ raise not_implemented_error('You must provide the get_version() method.') def get_user(self): """ Forge a piece of SQL returning the current username. """ return 'username()' def get_current_database(self): """ Forge a piece of SQL returning the current database name. """ return 'database()' def get_databases(self): """ Forge a piece of SQL returning all the known databases. """ raise not_implemented_error('You must define the "get_databases" function.') def get_database(self, id): """ Forge a piece of SQL returning the name of the id-th database. """ return self.take(self.get_databases(), id) def get_nb_databases(self): """ Forge a piece of SQL returning the number of databases. """ return self.count(self.get_databases()) def get_database_name(self, id): """ Forge a piece of SQL returning the name of id-th database. """ return self.take(self.get_databases(), id) def get_tables(self, db): """ Forge a piece of SQL returning all the tables of the provided database (db). db: target database name. """ raise not_implemented_error('You must provide the get_tables() method.') def get_nb_tables(self, db): """ Forge a piece of SQL returning the number of tables. db: target database name. """ return self.count(self.get_tables(db)) def get_table_name(self, id, db): """ Forge a piece of SQL returning the name of a table. id: table index db: target database name. """ return self.take(self.get_tables(db), id) def get_fields(self, table, db): """ Forge a piece of SQL returning all the existing fields of a table. table: target table name db: target database name """ raise not_implemented_error('You must provide the get_fields() method.') def get_nb_fields(self, table, db): """ Forge a piece of SQL returning the number of fields. table: target table name db: target database name """ return self.count(self.get_fields(table, db)) def get_field_name(self, table, id, db): """ Forge a piece of SQL returning the field name table: target table name db: target database name id: field index """ return self.take(self.get_fields(table, db), id) def get_string_len(self, sql): """ Forge a piece of SQL returning the length of a string/subquery. sql: source string or sql """ return self.string_len(sql) def get_string_char(self, sql, pos): """ Forge a piece of SQL returning the ascii code of a string/sql sql: source string or sql pos: character position """ return self.ascii(self.get_char(sql, pos))
class Solution(object): def generateParenthesis(self, n): # corner case if n == 0: return [] # level: tree level # openCount: open bracket count def dfs(level, n1, n2, n, stack, ret, openCount): if level == 2 * n: ret.append("".join(stack[:])) # dfs if n1 < n: stack.append("(") dfs(level + 1, n1 + 1, n2, n, stack, ret, openCount + 1) stack.pop() if openCount >= 1 and n2 < n: stack.append(")") dfs(level + 1, n1, n2 + 1, n, stack, ret, openCount - 1) stack.pop() stack = list() ret = list() dfs(0, 0, 0, n, stack, ret, 0) return ret
class Solution(object): def generate_parenthesis(self, n): if n == 0: return [] def dfs(level, n1, n2, n, stack, ret, openCount): if level == 2 * n: ret.append(''.join(stack[:])) if n1 < n: stack.append('(') dfs(level + 1, n1 + 1, n2, n, stack, ret, openCount + 1) stack.pop() if openCount >= 1 and n2 < n: stack.append(')') dfs(level + 1, n1, n2 + 1, n, stack, ret, openCount - 1) stack.pop() stack = list() ret = list() dfs(0, 0, 0, n, stack, ret, 0) return ret
def find(n: int): for i in range(1, 1000001): total = 0 for j in str(i): total += int(j) total += i if total == n: print(i) return print(0) find(int(input()))
def find(n: int): for i in range(1, 1000001): total = 0 for j in str(i): total += int(j) total += i if total == n: print(i) return print(0) find(int(input()))
if True: pass else: x = 3
if True: pass else: x = 3
print("Welcome to the Band Name Generator.") city_name =input("What's name of the city you grew up in?\n") pet_name =input("What's your pet's name?\n") print("Your band name could be Bristole Rabbit")
print('Welcome to the Band Name Generator.') city_name = input("What's name of the city you grew up in?\n") pet_name = input("What's your pet's name?\n") print('Your band name could be Bristole Rabbit')
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """ abcabcbb i j {} """ seen = set() best = 0 i = 0 for j in range(0, len(s)): end_char = s[j] while end_char in seen: start_char = s[i] seen.remove(start_char) i += 1 seen.add(end_char) best = max(best, len(seen)) return best
class Solution: def length_of_longest_substring(self, s: str) -> int: """ abcabcbb i j {} """ seen = set() best = 0 i = 0 for j in range(0, len(s)): end_char = s[j] while end_char in seen: start_char = s[i] seen.remove(start_char) i += 1 seen.add(end_char) best = max(best, len(seen)) return best
#!/usr/bin/env python # encoding: utf-8 __title__ = "Arithmatic Coding" __author__ = "Waleed Yaser ([email protected])" __version__ = "1.0" """ Arithmatic Coding ~~~~~~~~~~~~~~~~~ A class for implementing Arithmatic coding. constructor takes 3 parameters: *symbols list *probalities list *terminator charachter There are 2 calable methods: *Compress: take the word to compress and return code. *Decompress: takes the compressed code and return word. require: *python 2.7 """ class ArithmaticCoding: def __init__(self, symbols, probs, terminator): """ Construct the probability range table in dictionaries data type. """ self.symbols = symbols self.probs = probs self.__InitRangeTable() self.terminator = terminator # End of word. def __InitRangeTable(self): """ Complete the probability range table ============================================= Symbol | Probability | Range low | Range high ============================================= | | | ============================================= """ self.rangeLow = {} self.rangeHigh = {} rangeStart = 0 for i in xrange(len(self.symbols)): s = self.symbols[i] self.rangeLow[s] = rangeStart rangeStart += self.probs[i] self.rangeHigh[s] = rangeStart def Compress(self, word): """ Compress given word into Arimatic code and return code. """ lowOld = 0.0 highOld = 1.0 _range = 1.0 # Iterate through the word to find the final range. for c in word: low = lowOld + _range * self.rangeLow[c] high = lowOld + _range * self.rangeHigh[c] _range = high - low # Updete old low & hihh lowOld = low highOld = high # Generating code word for encoder. code = ["0", "."] # Binary fractional number k = 2 # kth binary fraction bit value = self.__GetBinaryFractionValue("".join(code)) while(value < low): # Assign 1 to the kth binary fraction bit code.append('1') value = self.__GetBinaryFractionValue("".join(code)) if (value > high): # Replace the kth bit by 0 code[k] = '0' value = self.__GetBinaryFractionValue("".join(code)) k += 1 return value def Decompress(self, code): """ Uncompress given Arimatic code and return word. """ s = "" # flag to stop the while loop result = "" while (s != self.terminator): # find the key which has low <= code and high > code for key, value in self.rangeLow.iteritems(): if (code >= self.rangeLow[key] and code < self.rangeHigh[key]): result += key # Append key to the result # update low, high, code low = self.rangeLow[key] high = self.rangeHigh[key] _range = high - low code = (code - low)/_range # chech for the terminator if (key == self.terminator): s = key break return result def __GetBinaryFractionValue(self, binaryFraction): """ Compute the binary fraction value using the formula of: (2^-1) * 1st bit + (2^-2) * 2nd bit + ... """ value = 0 power = 1 # Git the fraction bits after "." fraction = binaryFraction.split('.')[1] # Compute the formula value for i in fraction: value += ((2 ** (-power)) * int(i)) power += 1 return value
__title__ = 'Arithmatic Coding' __author__ = 'Waleed Yaser ([email protected])' __version__ = '1.0' '\n Arithmatic Coding\n ~~~~~~~~~~~~~~~~~\n A class for implementing Arithmatic coding.\n\n constructor takes 3 parameters:\n *symbols list\n *probalities list\n *terminator charachter\n\n There are 2 calable methods:\n *Compress: take the word to compress and return code.\n *Decompress: takes the compressed code and return word.\n\n require:\n *python 2.7\n' class Arithmaticcoding: def __init__(self, symbols, probs, terminator): """ Construct the probability range table in dictionaries data type. """ self.symbols = symbols self.probs = probs self.__InitRangeTable() self.terminator = terminator def ___init_range_table(self): """ Complete the probability range table ============================================= Symbol | Probability | Range low | Range high ============================================= | | | ============================================= """ self.rangeLow = {} self.rangeHigh = {} range_start = 0 for i in xrange(len(self.symbols)): s = self.symbols[i] self.rangeLow[s] = rangeStart range_start += self.probs[i] self.rangeHigh[s] = rangeStart def compress(self, word): """ Compress given word into Arimatic code and return code. """ low_old = 0.0 high_old = 1.0 _range = 1.0 for c in word: low = lowOld + _range * self.rangeLow[c] high = lowOld + _range * self.rangeHigh[c] _range = high - low low_old = low high_old = high code = ['0', '.'] k = 2 value = self.__GetBinaryFractionValue(''.join(code)) while value < low: code.append('1') value = self.__GetBinaryFractionValue(''.join(code)) if value > high: code[k] = '0' value = self.__GetBinaryFractionValue(''.join(code)) k += 1 return value def decompress(self, code): """ Uncompress given Arimatic code and return word. """ s = '' result = '' while s != self.terminator: for (key, value) in self.rangeLow.iteritems(): if code >= self.rangeLow[key] and code < self.rangeHigh[key]: result += key low = self.rangeLow[key] high = self.rangeHigh[key] _range = high - low code = (code - low) / _range if key == self.terminator: s = key break return result def ___get_binary_fraction_value(self, binaryFraction): """ Compute the binary fraction value using the formula of: (2^-1) * 1st bit + (2^-2) * 2nd bit + ... """ value = 0 power = 1 fraction = binaryFraction.split('.')[1] for i in fraction: value += 2 ** (-power) * int(i) power += 1 return value
class Settings: info = { "version": "0.2.0", "description": "Python library which allows to read, modify, create and run EnergyPlus files and simulations." } groups = { 'simulation_parameters': [ 'Timestep', 'Version', 'SimulationControl', 'ShadowCalculations', 'SurfaceConvectionAlgorithm:Outside', 'SurfaceConvectionAlgorithm:Inside' 'GlobalGeometryRules', 'HeatBalanceAlgorithm' ], 'building': [ 'Site:Location', 'Building' ], 'climate': [ 'SizingPeriod:DesignDay', 'Site:GroundTemperature:BuildingSurface', ], 'schedules': [ 'ScheduleTypeLimits', 'ScheduleDayHourly', 'ScheduleDayInterval', 'ScheduleWeekDaily', 'ScheduleWeekCompact', 'ScheduleConstant', 'ScheduleFile', 'ScheduleDayList', 'ScheduleYear', 'ScheduleCompact' ], 'construction': [ 'Material', 'Material:NoMass', 'Material:AirGap', 'WindowMaterial:SimpleGlazingSystem', 'WindowMaterial:Glazing', 'WindowMaterial:Gas', 'WindowMaterial:Gap', 'Construction' ], 'internal_gains': [ 'People', 'Lights', 'ElectricEquipment', ], 'airflow': [ 'ZoneInfiltration:DesignFlowRate', 'ZoneVentilation:DesignFlowRate' ], 'zone': [ 'BuildingSurface:Detailed', ], 'zone_control': [ 'ZoneControl:Thermostat', 'ThermostatSetpoint:SingleHeating', 'ThermostatSetpoint:SingleCooling', 'ThermostatSetpoint:SingleHeatingOrCooling', 'ThermostatSetpoint:DualSetpoint', ], 'systems': [ 'Zone:IdealAirLoadsSystem', 'HVACTemplate:Zone:IdealLoadsAirSystem' ], 'outputs': [ 'Output:SQLite', 'Output:Table:SummaryReports' ] }
class Settings: info = {'version': '0.2.0', 'description': 'Python library which allows to read, modify, create and run EnergyPlus files and simulations.'} groups = {'simulation_parameters': ['Timestep', 'Version', 'SimulationControl', 'ShadowCalculations', 'SurfaceConvectionAlgorithm:Outside', 'SurfaceConvectionAlgorithm:InsideGlobalGeometryRules', 'HeatBalanceAlgorithm'], 'building': ['Site:Location', 'Building'], 'climate': ['SizingPeriod:DesignDay', 'Site:GroundTemperature:BuildingSurface'], 'schedules': ['ScheduleTypeLimits', 'ScheduleDayHourly', 'ScheduleDayInterval', 'ScheduleWeekDaily', 'ScheduleWeekCompact', 'ScheduleConstant', 'ScheduleFile', 'ScheduleDayList', 'ScheduleYear', 'ScheduleCompact'], 'construction': ['Material', 'Material:NoMass', 'Material:AirGap', 'WindowMaterial:SimpleGlazingSystem', 'WindowMaterial:Glazing', 'WindowMaterial:Gas', 'WindowMaterial:Gap', 'Construction'], 'internal_gains': ['People', 'Lights', 'ElectricEquipment'], 'airflow': ['ZoneInfiltration:DesignFlowRate', 'ZoneVentilation:DesignFlowRate'], 'zone': ['BuildingSurface:Detailed'], 'zone_control': ['ZoneControl:Thermostat', 'ThermostatSetpoint:SingleHeating', 'ThermostatSetpoint:SingleCooling', 'ThermostatSetpoint:SingleHeatingOrCooling', 'ThermostatSetpoint:DualSetpoint'], 'systems': ['Zone:IdealAirLoadsSystem', 'HVACTemplate:Zone:IdealLoadsAirSystem'], 'outputs': ['Output:SQLite', 'Output:Table:SummaryReports']}
DEBUG = False SECRET_KEY = '3tJhmR0XFbSOUG02Wpp7' CSRF_ENABLED = True CSRF_SESSION_LKEY = 'e8uXRmxo701QarZiXxGf'
debug = False secret_key = '3tJhmR0XFbSOUG02Wpp7' csrf_enabled = True csrf_session_lkey = 'e8uXRmxo701QarZiXxGf'
''' Statement Given a month - an integer from 1 to 12, print the number of days in it in the year 2017. Example input #1 1 (January) Example output #1 31 Example input #2 2 (February) Example output #2 28 ''' month = int(input()) if month == 2: print(28) elif month < 8: if month % 2 == 0: print(30) else: print(31) else: if month % 2 == 0: print(31) else: print(30)
""" Statement Given a month - an integer from 1 to 12, print the number of days in it in the year 2017. Example input #1 1 (January) Example output #1 31 Example input #2 2 (February) Example output #2 28 """ month = int(input()) if month == 2: print(28) elif month < 8: if month % 2 == 0: print(30) else: print(31) elif month % 2 == 0: print(31) else: print(30)
# Challenge No 9 Intermediate # https://www.reddit.com/r/dailyprogrammer/comments/pu1y6/2172012_challenge_9_intermediate/ # Take a string, scan file for string, and replace with another string def main(): pass def f_r(): fn = input('Please input filename: ') sstring = input('Please input string to search: ') rstring = input('Please input string to replace: ') with open(fn, 'r') as f: filedata = f.read() filedata = filedata.replace(sstring, rstring) with open(fn, 'w') as f: f.write(filedata) # To print line by line: # with open('*.txt', 'r') as f: # for line in f: # print(line) if __name__ == '__main__': main()
def main(): pass def f_r(): fn = input('Please input filename: ') sstring = input('Please input string to search: ') rstring = input('Please input string to replace: ') with open(fn, 'r') as f: filedata = f.read() filedata = filedata.replace(sstring, rstring) with open(fn, 'w') as f: f.write(filedata) if __name__ == '__main__': main()
list1=[2,3,8,5,9,2,7,4] i=0 print("before list",list1) while i<len(list1): j=0 while j<i: if list1[i]<list1[j]: temp=list1[i] list1[i]=list1[j] list1[j]=temp j+=1 i+=1 print("after",list1)
list1 = [2, 3, 8, 5, 9, 2, 7, 4] i = 0 print('before list', list1) while i < len(list1): j = 0 while j < i: if list1[i] < list1[j]: temp = list1[i] list1[i] = list1[j] list1[j] = temp j += 1 i += 1 print('after', list1)
class TimezoneTool: @classmethod def tzdb2abbreviation(cls, tzdb): if tzdb == "Asia/Seoul": return "KST" if tzdb == "America/Los_Angeles": return "ET" raise NotImplementedError({"tzdb":tzdb})
class Timezonetool: @classmethod def tzdb2abbreviation(cls, tzdb): if tzdb == 'Asia/Seoul': return 'KST' if tzdb == 'America/Los_Angeles': return 'ET' raise not_implemented_error({'tzdb': tzdb})
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Jan 6 13:43:13 2017 @author: ktt """ def flatten(py_list): flat = [] for k in py_list: if k not in [None, (), [], {}]: if isinstance(k, list): flat.extend(flatten(k)) else: flat.append(k) return flat
""" Created on Fri Jan 6 13:43:13 2017 @author: ktt """ def flatten(py_list): flat = [] for k in py_list: if k not in [None, (), [], {}]: if isinstance(k, list): flat.extend(flatten(k)) else: flat.append(k) return flat