content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
JournalFame = {"4" : 1200, "5" : 2400, "6" : 4800, "7" : 9600, "8" : 19200} FameGenerated = {"4": {"2Hweapon":720, "1Hweapon":540, "BigArmor":360, "SmallArmor":180}, "5": {"2Hweapon":2880, "1Hweapon":2160, "BigArmor":1440, "SmallArmor":720}, "6": {"2Hweapon":8640, "1Hweapon":6480, "BigArmor":4320, "SmallArmor":2160}, "7": {"2Hweapon":20640, "1Hweapon":15480, "BigArmor":10320, "SmallArmor":5160}, "8": {"2Hweapon":44640, "1Hweapon":33480, "BigArmor":22320, "SmallArmor":11160}} treeType = {"B" : "Blacksmith", "I" : "Imbuer", "F" : "Fletcher"} itemType = {"BattleAxe" : "1Hweapon", "Halberd" : "2Hweapon", "Great_Axe" : "2Hweapon", "Boots" : "SmallArmor", "Shield" : "SmallArmor", "1H_Crossbow" : "1Hweapon", "2H_Crossbow" : "2Hweapon", "Armor" : "BigArmor", "1H_Hammer" : "1Hweapon", "2H_Hammer" : "2Hweapon", "Helmet" : "SmallArmor", "1H_Mace" : "1Hweapon", "2H_Mace" : "2Hweapon", "1H_Sword" : "1Hweapon", "2H_Sword" : "2Hweapon", "Robe" : "BigArmor", "Sandals" : "SmallArmor", "Cowl" : "SmallArmor", "1H_Damage_Staff" : "1Hweapon", "2H_Damage_Staff" : "2Hweapon", "1H_Holy_Staff" : "1Hweapon", "2H_Holy_Staff" : "2Hweapon", "SpellTome" : "SmallArmor", "Torch" : "SmallArmor", "1H_Nature_Staff" : "1Hweapon", "2H_Nature_staff" : "2Hweapon", "1H_Dagger" : "1Hweapon", "2H_Dagger" : "2Hweapon", "Claws" : "2Hweapon", "Staff" : "2Hweapon", "1H_Spear" : "1Hweapon", "Pike" : "2Hweapon", "Glaive" : "2Hweapon", "Jacket" : "BigArmor", "Shoes" : "SmallArmor", "Hood" : "SmallArmor"} itemTree = {"BattleAxe" : "Blacksmith", "Halberd" : "Blacksmith", "Great_Axe" : "Blacksmith", "Boots" : "Blacksmith", "Shield" : "Blacksmith", "1H_Crossbow" : "Blacksmith", "2H_Crossbow" : "Blacksmith", "Armor" : "Blacksmith", "1H_Hammer" : "Blacksmith", "2H_Hammer" : "Blacksmith", "Helmet" : "Blacksmith", "1H_Mace" : "Blacksmith", "2H_Mace" : "Blacksmith", "1H_Sword" : "Blacksmith", "2H_Sword" : "Blacksmith", "Robe" : "Imbuer", "Sandals" : "Imbuer", "Cowl" : "Imbuer", "1H_Damage_Staff" : "Imbuer", "2H_Damage_Staff" : "Imbuer", "1H_Holy_Staff" : "Imbuer", "2H_Holy_Staff" : "Imbuer", "SpellTome" : "Imbuer", "Torch" : "Fletcher", "1H_Nature_Staff" : "Fletcher", "2H_Nature_staff" : "Fletcher", "1H_Dagger" : "Fletcher", "2H_Dagger" : "Fletcher", "Claws" : "Fletcher", "Staff" : "Fletcher", "1H_Spear" : "Fletcher", "Pike" : "Fletcher", "Glaive" : "Fletcher", "Jacket" : "Fletcher", "Shoes" : "Fletcher", "Hood" : "Fletcher"} clothCost = {"BattleAxe" : 0, "Halberd" : 0, "Great_Axe" : 0, "Boots" : 0, "Shield" : 0, "1H_Crossbow" : 0, "2H_Crossbow" : 0, "Armor" : 0, "1H_Hammer" : 0, "2H_Hammer" : 12, "Helmet" : 0, "1H_Mace" : 8, "2H_Mace" : 12, "1H_Sword" : 0, "2H_Sword" : 0, "Robe" : 16, "Sandals" : 8, "Cowl" : 8, "1H_Damage_Staff" : 0, "2H_Damage_Staff" : 0, "1H_Holy_Staff" : 8, "2H_Holy_Staff" : 12, "SpellTome" : 4, "Torch" : 4, "1H_Nature_Staff" : 8, "2H_Nature_staff" : 12, "1H_Dagger" : 0, "2H_Dagger" : 0, "Claws" : 0, "Staff" : 0, "1H_Spear" : 0, "Pike" : 0, "Glaive" : 0, "Jacket" : 0, "Shoes" : 0, "Hood" : 0} metalCost = {"BattleAxe" : 16, "Halberd" : 12, "Great_Axe" : 20, "Boots" : 8, "Shield" : 4, "1H_Crossbow" : 8, "2H_Crossbow" : 12, "Armor" : 16, "1H_Hammer" : 24, "2H_Hammer" : 20, "Helmet" : 8, "1H_Mace" : 16, "2H_Mace" : 20, "1H_Sword" : 16, "2H_Sword" : 20, "Robe" : 0, "Sandals" : 0, "Cowl" : 0, "1H_Damage_Staff" : 8, "2H_Damage_Staff" : 12, "1H_Holy_Staff" : 0, "2H_Holy_Staff" : 0, "SpellTome" : 0, "Torch" : 0, "1H_Nature_Staff" : 0, "2H_Nature_staff" : 0, "1H_Dagger" : 12, "2H_Dagger" : 16, "Claws" : 12, "Staff" : 12, "1H_Spear" : 8, "Pike" : 12, "Glaive" : 20, "Jacket" : 0, "Shoes" : 0, "Hood" : 0} woodCost = {"BattleAxe" : 8, "Halberd" : 20, "Great_Axe" : 12, "Boots" : 0, "Shield" : 4, "1H_Crossbow" : 16, "2H_Crossbow" : 20, "Armor" : 0, "1H_Hammer" : 0, "2H_Hammer" : 0, "Helmet" : 0, "1H_Mace" : 0, "2H_Mace" : 0, "1H_Sword" : 0, "2H_Sword" : 0, "Robe" : 0, "Sandals" : 0, "Cowl" : 0, "1H_Damage_Staff" : 16, "2H_Damage_Staff" : 20, "1H_Holy_Staff" : 16, "2H_Holy_Staff" : 20, "SpellTome" : 0, "Torch" : 4, "1H_Nature_Staff" : 16, "2H_Nature_staff" : 20, "1H_Dagger" : 0, "2H_Dagger" : 0, "Claws" : 0, "Staff" : 0, "1H_Spear" : 16, "Pike" : 20, "Glaive" : 12, "Jacket" : 0, "Shoes" : 0, "Hood" : 0} leatherCost = {"BattleAxe" : 0, "Halberd" : 0, "Great_Axe" : 0, "Boots" : 0, "Shield" : 0, "1H_Crossbow" : 0, "2H_Crossbow" : 0, "Armor" : 0, "1H_Hammer" : 0, "2H_Hammer" : 0, "Helmet" : 0, "1H_Mace" : 0, "2H_Mace" : 0, "1H_Sword" : 8, "2H_Sword" : 12, "Robe" : 0, "Sandals" : 0, "Cowl" : 0, "1H_Damage_Staff" : 0, "2H_Damage_Staff" : 0, "1H_Holy_Staff" : 0, "2H_Holy_Staff" : 0, "SpellTome" : 4, "Torch" : 0, "1H_Nature_Staff" : 0, "2H_Nature_staff" : 0, "1H_Dagger" : 12, "2H_Dagger" : 16, "Claws" : 20, "Staff" : 20, "1H_Spear" : 0, "Pike" : 0, "Glaive" : 0, "Jacket" : 16, "Shoes" : 8, "Hood" : 8} craftedItems = {"BattleAxe" : 0, "Halberd" : 0, "Great_Axe" : 0, "Boots" : 0, "Shield" : 0, "1H_Crossbow" : 0, "2H_Crossbow" : 0, "Armor" : 0, "1H_Hammer" : 0, "2H_Hammer" : 0, "Helmet" : 0, "1H_Mace" : 0, "2H_Mace" : 0, "1H_Sword" : 0, "2H_Sword" : 0, "Robe" : 0, "Sandals" : 0, "Cowl" : 0, "1H_Damage_Staff" : 0, "2H_Damage_Staff" : 0, "1H_Holy_Staff" : 0, "2H_Holy_Staff" : 0, "SpellTome" : 0, "Torch" : 0, "1H_Nature_Staff" : 0, "2H_Nature_staff" : 0, "1H_Dagger" : 0, "2H_Dagger" : 0, "Claws" : 0, "Staff" : 0, "1H_Spear" : 0, "Pike" : 0, "Glaive" : 0, "Jacket" : 0, "Shoes" : 0, "Hood" : 0} RRR = {"N" : 0.248, "Y" : 0.479} focusMessage = {"N" : "Focus was not used", "Y" : "Focus was used"}
journal_fame = {'4': 1200, '5': 2400, '6': 4800, '7': 9600, '8': 19200} fame_generated = {'4': {'2Hweapon': 720, '1Hweapon': 540, 'BigArmor': 360, 'SmallArmor': 180}, '5': {'2Hweapon': 2880, '1Hweapon': 2160, 'BigArmor': 1440, 'SmallArmor': 720}, '6': {'2Hweapon': 8640, '1Hweapon': 6480, 'BigArmor': 4320, 'SmallArmor': 2160}, '7': {'2Hweapon': 20640, '1Hweapon': 15480, 'BigArmor': 10320, 'SmallArmor': 5160}, '8': {'2Hweapon': 44640, '1Hweapon': 33480, 'BigArmor': 22320, 'SmallArmor': 11160}} tree_type = {'B': 'Blacksmith', 'I': 'Imbuer', 'F': 'Fletcher'} item_type = {'BattleAxe': '1Hweapon', 'Halberd': '2Hweapon', 'Great_Axe': '2Hweapon', 'Boots': 'SmallArmor', 'Shield': 'SmallArmor', '1H_Crossbow': '1Hweapon', '2H_Crossbow': '2Hweapon', 'Armor': 'BigArmor', '1H_Hammer': '1Hweapon', '2H_Hammer': '2Hweapon', 'Helmet': 'SmallArmor', '1H_Mace': '1Hweapon', '2H_Mace': '2Hweapon', '1H_Sword': '1Hweapon', '2H_Sword': '2Hweapon', 'Robe': 'BigArmor', 'Sandals': 'SmallArmor', 'Cowl': 'SmallArmor', '1H_Damage_Staff': '1Hweapon', '2H_Damage_Staff': '2Hweapon', '1H_Holy_Staff': '1Hweapon', '2H_Holy_Staff': '2Hweapon', 'SpellTome': 'SmallArmor', 'Torch': 'SmallArmor', '1H_Nature_Staff': '1Hweapon', '2H_Nature_staff': '2Hweapon', '1H_Dagger': '1Hweapon', '2H_Dagger': '2Hweapon', 'Claws': '2Hweapon', 'Staff': '2Hweapon', '1H_Spear': '1Hweapon', 'Pike': '2Hweapon', 'Glaive': '2Hweapon', 'Jacket': 'BigArmor', 'Shoes': 'SmallArmor', 'Hood': 'SmallArmor'} item_tree = {'BattleAxe': 'Blacksmith', 'Halberd': 'Blacksmith', 'Great_Axe': 'Blacksmith', 'Boots': 'Blacksmith', 'Shield': 'Blacksmith', '1H_Crossbow': 'Blacksmith', '2H_Crossbow': 'Blacksmith', 'Armor': 'Blacksmith', '1H_Hammer': 'Blacksmith', '2H_Hammer': 'Blacksmith', 'Helmet': 'Blacksmith', '1H_Mace': 'Blacksmith', '2H_Mace': 'Blacksmith', '1H_Sword': 'Blacksmith', '2H_Sword': 'Blacksmith', 'Robe': 'Imbuer', 'Sandals': 'Imbuer', 'Cowl': 'Imbuer', '1H_Damage_Staff': 'Imbuer', '2H_Damage_Staff': 'Imbuer', '1H_Holy_Staff': 'Imbuer', '2H_Holy_Staff': 'Imbuer', 'SpellTome': 'Imbuer', 'Torch': 'Fletcher', '1H_Nature_Staff': 'Fletcher', '2H_Nature_staff': 'Fletcher', '1H_Dagger': 'Fletcher', '2H_Dagger': 'Fletcher', 'Claws': 'Fletcher', 'Staff': 'Fletcher', '1H_Spear': 'Fletcher', 'Pike': 'Fletcher', 'Glaive': 'Fletcher', 'Jacket': 'Fletcher', 'Shoes': 'Fletcher', 'Hood': 'Fletcher'} cloth_cost = {'BattleAxe': 0, 'Halberd': 0, 'Great_Axe': 0, 'Boots': 0, 'Shield': 0, '1H_Crossbow': 0, '2H_Crossbow': 0, 'Armor': 0, '1H_Hammer': 0, '2H_Hammer': 12, 'Helmet': 0, '1H_Mace': 8, '2H_Mace': 12, '1H_Sword': 0, '2H_Sword': 0, 'Robe': 16, 'Sandals': 8, 'Cowl': 8, '1H_Damage_Staff': 0, '2H_Damage_Staff': 0, '1H_Holy_Staff': 8, '2H_Holy_Staff': 12, 'SpellTome': 4, 'Torch': 4, '1H_Nature_Staff': 8, '2H_Nature_staff': 12, '1H_Dagger': 0, '2H_Dagger': 0, 'Claws': 0, 'Staff': 0, '1H_Spear': 0, 'Pike': 0, 'Glaive': 0, 'Jacket': 0, 'Shoes': 0, 'Hood': 0} metal_cost = {'BattleAxe': 16, 'Halberd': 12, 'Great_Axe': 20, 'Boots': 8, 'Shield': 4, '1H_Crossbow': 8, '2H_Crossbow': 12, 'Armor': 16, '1H_Hammer': 24, '2H_Hammer': 20, 'Helmet': 8, '1H_Mace': 16, '2H_Mace': 20, '1H_Sword': 16, '2H_Sword': 20, 'Robe': 0, 'Sandals': 0, 'Cowl': 0, '1H_Damage_Staff': 8, '2H_Damage_Staff': 12, '1H_Holy_Staff': 0, '2H_Holy_Staff': 0, 'SpellTome': 0, 'Torch': 0, '1H_Nature_Staff': 0, '2H_Nature_staff': 0, '1H_Dagger': 12, '2H_Dagger': 16, 'Claws': 12, 'Staff': 12, '1H_Spear': 8, 'Pike': 12, 'Glaive': 20, 'Jacket': 0, 'Shoes': 0, 'Hood': 0} wood_cost = {'BattleAxe': 8, 'Halberd': 20, 'Great_Axe': 12, 'Boots': 0, 'Shield': 4, '1H_Crossbow': 16, '2H_Crossbow': 20, 'Armor': 0, '1H_Hammer': 0, '2H_Hammer': 0, 'Helmet': 0, '1H_Mace': 0, '2H_Mace': 0, '1H_Sword': 0, '2H_Sword': 0, 'Robe': 0, 'Sandals': 0, 'Cowl': 0, '1H_Damage_Staff': 16, '2H_Damage_Staff': 20, '1H_Holy_Staff': 16, '2H_Holy_Staff': 20, 'SpellTome': 0, 'Torch': 4, '1H_Nature_Staff': 16, '2H_Nature_staff': 20, '1H_Dagger': 0, '2H_Dagger': 0, 'Claws': 0, 'Staff': 0, '1H_Spear': 16, 'Pike': 20, 'Glaive': 12, 'Jacket': 0, 'Shoes': 0, 'Hood': 0} leather_cost = {'BattleAxe': 0, 'Halberd': 0, 'Great_Axe': 0, 'Boots': 0, 'Shield': 0, '1H_Crossbow': 0, '2H_Crossbow': 0, 'Armor': 0, '1H_Hammer': 0, '2H_Hammer': 0, 'Helmet': 0, '1H_Mace': 0, '2H_Mace': 0, '1H_Sword': 8, '2H_Sword': 12, 'Robe': 0, 'Sandals': 0, 'Cowl': 0, '1H_Damage_Staff': 0, '2H_Damage_Staff': 0, '1H_Holy_Staff': 0, '2H_Holy_Staff': 0, 'SpellTome': 4, 'Torch': 0, '1H_Nature_Staff': 0, '2H_Nature_staff': 0, '1H_Dagger': 12, '2H_Dagger': 16, 'Claws': 20, 'Staff': 20, '1H_Spear': 0, 'Pike': 0, 'Glaive': 0, 'Jacket': 16, 'Shoes': 8, 'Hood': 8} crafted_items = {'BattleAxe': 0, 'Halberd': 0, 'Great_Axe': 0, 'Boots': 0, 'Shield': 0, '1H_Crossbow': 0, '2H_Crossbow': 0, 'Armor': 0, '1H_Hammer': 0, '2H_Hammer': 0, 'Helmet': 0, '1H_Mace': 0, '2H_Mace': 0, '1H_Sword': 0, '2H_Sword': 0, 'Robe': 0, 'Sandals': 0, 'Cowl': 0, '1H_Damage_Staff': 0, '2H_Damage_Staff': 0, '1H_Holy_Staff': 0, '2H_Holy_Staff': 0, 'SpellTome': 0, 'Torch': 0, '1H_Nature_Staff': 0, '2H_Nature_staff': 0, '1H_Dagger': 0, '2H_Dagger': 0, 'Claws': 0, 'Staff': 0, '1H_Spear': 0, 'Pike': 0, 'Glaive': 0, 'Jacket': 0, 'Shoes': 0, 'Hood': 0} rrr = {'N': 0.248, 'Y': 0.479} focus_message = {'N': 'Focus was not used', 'Y': 'Focus was used'}
class ExtraException(Exception): def __init__(self, message: str = None, **kwargs): if message: self.message = message self.extra = kwargs super().__init__(message, kwargs) def __str__(self) -> str: return self.message class PackageNotFoundError(ExtraException, LookupError): message = 'package not found' class InvalidFieldsError(ExtraException, ValueError): message = 'invalid fields'
class Extraexception(Exception): def __init__(self, message: str=None, **kwargs): if message: self.message = message self.extra = kwargs super().__init__(message, kwargs) def __str__(self) -> str: return self.message class Packagenotfounderror(ExtraException, LookupError): message = 'package not found' class Invalidfieldserror(ExtraException, ValueError): message = 'invalid fields'
class Solution: # @param A : list of integers # @return an integer ''' Facebook Codelab No hints or solutions needed N light bulbs are connected by a wire. Each bulb has a switch associated with it, however due to faulty wiring, a switch also changes the state of all the bulbs to the right of current bulb. Given an initial state of all bulbs, find the minimum number of switches you have to press to turn on all the bulbs. You can press the same switch multiple times. Input : [0 1 0 1] Return : 4 ''' def bulbs(self, A): if A is None: return None if len(A) == 0: return 0 cnt = 0 rightFlipped = False for i, v in enumerate(A): if v ^ rightFlipped: continue else: A[i] = 1 cnt += 1 rightFlipped = not rightFlipped return cnt if __name__ == "__main__": A = [3, 0, 1, 0]
class Solution: """ Facebook Codelab No hints or solutions needed N light bulbs are connected by a wire. Each bulb has a switch associated with it, however due to faulty wiring, a switch also changes the state of all the bulbs to the right of current bulb. Given an initial state of all bulbs, find the minimum number of switches you have to press to turn on all the bulbs. You can press the same switch multiple times. Input : [0 1 0 1] Return : 4 """ def bulbs(self, A): if A is None: return None if len(A) == 0: return 0 cnt = 0 right_flipped = False for (i, v) in enumerate(A): if v ^ rightFlipped: continue else: A[i] = 1 cnt += 1 right_flipped = not rightFlipped return cnt if __name__ == '__main__': a = [3, 0, 1, 0]
def main(): recursion() def recursion(): count = [0] num = b(5, 2, count) print(num) # print(sum(count)) print(count[0]) def b(n, k, count): # count.append(1) ## count the number of stack frame count[0] += 1 if k == 0 or k == n: print('Base Case!') return 2 else: return b(n-1, k-1, count) + b(n-1, k, count) if __name__ == '__main__': main()
def main(): recursion() def recursion(): count = [0] num = b(5, 2, count) print(num) print(count[0]) def b(n, k, count): count[0] += 1 if k == 0 or k == n: print('Base Case!') return 2 else: return b(n - 1, k - 1, count) + b(n - 1, k, count) if __name__ == '__main__': main()
# # @lc app=leetcode.cn id=547 lang=python3 # # [547] friend-circles # None # @lc code=end
None
class CaseInsensitiveKey( object ): def __init__( self, key ): self.key = key def __hash__( self ): return hash( self.key.lower() ) def __eq__( self, other ): return self.key.lower() == other.key.lower() def __str__( self ): return self.key GROK_PATTERN_CONF = dict() # Basic String GROK_PATTERN_CONF[ CaseInsensitiveKey( 'String' ) ] = 'DATA' # DATA or NOTSPACE ? GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Quote String' ) ] = 'QS' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'UUID' ) ] = 'UUID' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Log Level' ) ] = 'LOGLEVEL' # Networking GROK_PATTERN_CONF[ CaseInsensitiveKey( 'IP' ) ] = 'IP' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Host/Domain' ) ] = 'HOST' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Host:Port' ) ] = 'HOSTPORT' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'IP or Host/Domain' ) ] = 'IPORHOST' # Path GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Full URL' ) ] = 'URI' # http://www.google.com?search=mj GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Url Path' ) ] = 'URIPATHPARAM' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Unix Path' ) ] = 'UNIXPATH' # Json # GROK_PATTERN_CONF[ CaseInsensitiveKey( 'json' ) ] = # Number GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Number' ) ] = 'NUMBER' # Integer/Long OR Float/Double GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Integer/Long' ) ] = 'INT' # GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Float/Double' ) ] = # Date GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Year' ) ] = 'YEAR' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Month' ) ] = 'MONTH' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Month Number' ) ] = 'MONTHNUM' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Day' ) ] = 'DAY' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Hour' ) ] = 'HOUR' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Minute' ) ] = 'MINUTE' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'Second' ) ] = 'SECOND' # GROK_PATTERN_CONF[ CaseInsensitiveKey( ) ] = 'TZ' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'ISO8601' ) ] = 'TIMESTAMP_ISO8601' GROK_PATTERN_CONF[ CaseInsensitiveKey( 'HTTPDATE' ) ] = 'HTTPDATE' # GROK_PATTERN_CONF[ CaseInsensitiveKey( 'custom' ) ] = # custom # TODO # GROK_PATTERN_CONF = { # # Basic String # 'String': 'DATA', # DATA or NOTSPACE ? # 'Quote String': 'QS', # 'UUID': 'UUID', # 'Log Level': 'LOGLEVEL', # # Networking # 'IP': 'IP', # 'Host/Domain': 'HOST', # 'Host:Port': 'HOSTPORT', # 'IP or Host/Domain': 'IPORHOST', # # Path # 'Full URL': 'URI', # http://www.google.com?search=mj # 'Url Path': 'URIPATHPARAM', # 'Unix Path': 'UNIXPATH', # # Json # 'json': '', # TODO json regular expression # # Number # 'Number': 'NUMBER', # Integer/Long OR Float/Double # 'Integer/Long': 'INT', # 'Float/Double': '', # # Date # 'Year': 'YEAR', # 'Month': 'MONTH', # 'Month Number': 'MONTHNUM', # 'Day': 'DAY', # 'Hour': 'HOUR', # 'Minute': 'MINUTE', # 'Second': 'SECOND', # '': 'TZ', # 'ISO8601': 'TIMESTAMP_ISO8601', # 'HTTPDATE': 'HTTPDATE', # 'custom': '', # custom # TODO # }
class Caseinsensitivekey(object): def __init__(self, key): self.key = key def __hash__(self): return hash(self.key.lower()) def __eq__(self, other): return self.key.lower() == other.key.lower() def __str__(self): return self.key grok_pattern_conf = dict() GROK_PATTERN_CONF[case_insensitive_key('String')] = 'DATA' GROK_PATTERN_CONF[case_insensitive_key('Quote String')] = 'QS' GROK_PATTERN_CONF[case_insensitive_key('UUID')] = 'UUID' GROK_PATTERN_CONF[case_insensitive_key('Log Level')] = 'LOGLEVEL' GROK_PATTERN_CONF[case_insensitive_key('IP')] = 'IP' GROK_PATTERN_CONF[case_insensitive_key('Host/Domain')] = 'HOST' GROK_PATTERN_CONF[case_insensitive_key('Host:Port')] = 'HOSTPORT' GROK_PATTERN_CONF[case_insensitive_key('IP or Host/Domain')] = 'IPORHOST' GROK_PATTERN_CONF[case_insensitive_key('Full URL')] = 'URI' GROK_PATTERN_CONF[case_insensitive_key('Url Path')] = 'URIPATHPARAM' GROK_PATTERN_CONF[case_insensitive_key('Unix Path')] = 'UNIXPATH' GROK_PATTERN_CONF[case_insensitive_key('Number')] = 'NUMBER' GROK_PATTERN_CONF[case_insensitive_key('Integer/Long')] = 'INT' GROK_PATTERN_CONF[case_insensitive_key('Year')] = 'YEAR' GROK_PATTERN_CONF[case_insensitive_key('Month')] = 'MONTH' GROK_PATTERN_CONF[case_insensitive_key('Month Number')] = 'MONTHNUM' GROK_PATTERN_CONF[case_insensitive_key('Day')] = 'DAY' GROK_PATTERN_CONF[case_insensitive_key('Hour')] = 'HOUR' GROK_PATTERN_CONF[case_insensitive_key('Minute')] = 'MINUTE' GROK_PATTERN_CONF[case_insensitive_key('Second')] = 'SECOND' GROK_PATTERN_CONF[case_insensitive_key('ISO8601')] = 'TIMESTAMP_ISO8601' GROK_PATTERN_CONF[case_insensitive_key('HTTPDATE')] = 'HTTPDATE'
class ValueResolver: def resolve(self, value): if value.kind() == "id": string = self._resolve_id_value(value) elif value.kind() == "node": string = f"Node({self.resolve(value.value)}.value)" elif value.kind() == "arc": string = f"Arc({self.resolve(value.source)}, {self.resolve(value.target)}, {self.resolve(value.weight)}.value, \"{value.type}\")" elif value.kind() == "graph": string = self._resolve_graph_value(value) elif value.kind() == "num": string = f"Num({value.value})" elif value.kind() == "logic": string = f"Logic({value.value})" elif value.kind() == "nope": string = "Nope()" elif value.kind() == "fun_call": string = self._resolve_fun_call(value.fun_call) elif value.kind() == "binary_operation.summation": string = self._resolve_summation(value) elif value.kind() == "binary_operation.subtraction": string = self._resolve_subtraction(value) elif value.kind() == "binary_operation.multiplication": string = self._resolve_multiplication(value) elif value.kind() == "binary_operation.division": string = self._resolve_division(value) elif value.kind() == "binary_operation.and": string = self._resolve_and(value) elif value.kind() == "binary_operation.or": string = self._resolve_or(value) elif value.kind() == "unary_operation.not": string = self._resolve_not(value) elif value.kind() == "binary_operation.equal": string = self._resolve_equal(value) elif value.kind() == "binary_operation.not_equal": string = self._resolve_not_equal(value) elif value.kind() == "binary_operation.greater_or_equal": string = self._resolve_greater_or_equal(value) elif value.kind() == "binary_operation.less_or_equal": string = self._resolve_less_or_equal(value) elif value.kind() == "binary_operation.greater": string = self._resolve_greater(value) elif value.kind() == "binary_operation.less": string = self._resolve_less(value) string += f".cast(\"{value.cast_type}\")" if value.cast_type else "" string += f"[{int(value.index.value)}]" if value.index else "" return string def _resolve_fun_call(self, statement): return f"{statement.name}({self._resolve_array(statement.args)})" def _resolve_summation(self, statement): return f"{self.resolve(statement.left)}.summation({self.resolve(statement.right)})" def _resolve_subtraction(self, statement): return f"{self.resolve(statement.left)}.subtraction({self.resolve(statement.right)})" def _resolve_multiplication(self, statement): return f"{self.resolve(statement.left)}.multiplication({self.resolve(statement.right)})" def _resolve_division(self, statement): return f"{self.resolve(statement.left)}.division({self.resolve(statement.right)})" def _resolve_and(self, statement): return f"{self.resolve(statement.left)}.and_({self.resolve(statement.right)})" def _resolve_or(self, statement): return f"{self.resolve(statement.left)}.or_({self.resolve(statement.right)})" def _resolve_not(self, statement): return f"{self.resolve(statement.target)}.not_()" def _resolve_equal(self, statement): return f"{self.resolve(statement.left)}.equal({self.resolve(statement.right)})" def _resolve_not_equal(self, statement): return f"{self.resolve(statement.left)}.not_equal({self.resolve(statement.right)})" def _resolve_greater_or_equal(self, statement): return f"{self.resolve(statement.left)}.greater_or_equal({self.resolve(statement.right)})" def _resolve_less_or_equal(self, statement): return f"{self.resolve(statement.left)}.less_or_equal({self.resolve(statement.right)})" def _resolve_greater(self, statement): return f"{self.resolve(statement.left)}.greater({self.resolve(statement.right)})" def _resolve_less(self, statement): return f"{self.resolve(statement.left)}.less({self.resolve(statement.right)})" def _resolve_id_value(self, statement): if statement.index is not None: return statement.name + f"[int({self.resolve(statement.index)}.value)]" else: return statement.name def _resolve_graph_value(self, value): return f"Graph([{self._resolve_array(value.elements)}])" def _resolve_array(self, values): values_ = [self.resolve(value) for value in values] return ", ".join(values_)
class Valueresolver: def resolve(self, value): if value.kind() == 'id': string = self._resolve_id_value(value) elif value.kind() == 'node': string = f'Node({self.resolve(value.value)}.value)' elif value.kind() == 'arc': string = f'Arc({self.resolve(value.source)}, {self.resolve(value.target)}, {self.resolve(value.weight)}.value, "{value.type}")' elif value.kind() == 'graph': string = self._resolve_graph_value(value) elif value.kind() == 'num': string = f'Num({value.value})' elif value.kind() == 'logic': string = f'Logic({value.value})' elif value.kind() == 'nope': string = 'Nope()' elif value.kind() == 'fun_call': string = self._resolve_fun_call(value.fun_call) elif value.kind() == 'binary_operation.summation': string = self._resolve_summation(value) elif value.kind() == 'binary_operation.subtraction': string = self._resolve_subtraction(value) elif value.kind() == 'binary_operation.multiplication': string = self._resolve_multiplication(value) elif value.kind() == 'binary_operation.division': string = self._resolve_division(value) elif value.kind() == 'binary_operation.and': string = self._resolve_and(value) elif value.kind() == 'binary_operation.or': string = self._resolve_or(value) elif value.kind() == 'unary_operation.not': string = self._resolve_not(value) elif value.kind() == 'binary_operation.equal': string = self._resolve_equal(value) elif value.kind() == 'binary_operation.not_equal': string = self._resolve_not_equal(value) elif value.kind() == 'binary_operation.greater_or_equal': string = self._resolve_greater_or_equal(value) elif value.kind() == 'binary_operation.less_or_equal': string = self._resolve_less_or_equal(value) elif value.kind() == 'binary_operation.greater': string = self._resolve_greater(value) elif value.kind() == 'binary_operation.less': string = self._resolve_less(value) string += f'.cast("{value.cast_type}")' if value.cast_type else '' string += f'[{int(value.index.value)}]' if value.index else '' return string def _resolve_fun_call(self, statement): return f'{statement.name}({self._resolve_array(statement.args)})' def _resolve_summation(self, statement): return f'{self.resolve(statement.left)}.summation({self.resolve(statement.right)})' def _resolve_subtraction(self, statement): return f'{self.resolve(statement.left)}.subtraction({self.resolve(statement.right)})' def _resolve_multiplication(self, statement): return f'{self.resolve(statement.left)}.multiplication({self.resolve(statement.right)})' def _resolve_division(self, statement): return f'{self.resolve(statement.left)}.division({self.resolve(statement.right)})' def _resolve_and(self, statement): return f'{self.resolve(statement.left)}.and_({self.resolve(statement.right)})' def _resolve_or(self, statement): return f'{self.resolve(statement.left)}.or_({self.resolve(statement.right)})' def _resolve_not(self, statement): return f'{self.resolve(statement.target)}.not_()' def _resolve_equal(self, statement): return f'{self.resolve(statement.left)}.equal({self.resolve(statement.right)})' def _resolve_not_equal(self, statement): return f'{self.resolve(statement.left)}.not_equal({self.resolve(statement.right)})' def _resolve_greater_or_equal(self, statement): return f'{self.resolve(statement.left)}.greater_or_equal({self.resolve(statement.right)})' def _resolve_less_or_equal(self, statement): return f'{self.resolve(statement.left)}.less_or_equal({self.resolve(statement.right)})' def _resolve_greater(self, statement): return f'{self.resolve(statement.left)}.greater({self.resolve(statement.right)})' def _resolve_less(self, statement): return f'{self.resolve(statement.left)}.less({self.resolve(statement.right)})' def _resolve_id_value(self, statement): if statement.index is not None: return statement.name + f'[int({self.resolve(statement.index)}.value)]' else: return statement.name def _resolve_graph_value(self, value): return f'Graph([{self._resolve_array(value.elements)}])' def _resolve_array(self, values): values_ = [self.resolve(value) for value in values] return ', '.join(values_)
######################## ### Feature combine ### ######################## #Combine Units: df_tcad = merge_extraction(dfs=[df_tcad,df_units,gdf_16],val=['dba','type1','units','low','high','units_from_type','est_from_type','shape_area']) replace_nan(df_tcad,['units_x','units_y','low','high'],val=0,reverse=True) #Don't fill in any unit estimates from improvement data yet (will do that in handle missing) (the low high estimate ranges) df_tcad.units_y = np.where(df_tcad.est_from_type, np.nan, df_tcad.units_y) #Fill in missing in known data from 2016 with type data df_tcad.units_x.fillna(df_tcad.units_y,inplace=True) #Known units column df_tcad['known']= np.where(df_tcad.units_x.notnull(), True,False) #Where type data is larger then 2016 take the new value #df_tcad.units_x = np.where((df_tcad.units_x < df_tcad.units_y), df_tcad.units_y, df_tcad.units_x) #Get rid of type values del df_tcad['units_y'] #Combine Locations: df_tcad = merge_extraction(dfs=[df_tcad,gdf,df_locs],on='prop_id',val=['land_use','X','Y','geometry','shape_area']) df_tcad.X_y.fillna(df_tcad.X_x,inplace=True) df_tcad.Y_y.fillna(df_tcad.Y_x,inplace=True) df_tcad.Y_x.fillna(df_tcad.Y_y,inplace=True) df_tcad.X_x.fillna(df_tcad.X_y,inplace=True) del df_tcad['X_y'] del df_tcad['Y_y'] df_tcad = df_tcad.merge(df_con,left_on='geo_id',right_on='TCAD ID',how='left') df_tcad.Y_x.fillna(df_tcad.Latitude,inplace=True) df_tcad.X_x.fillna(df_tcad.Longitude,inplace=True) del df_tcad['Latitude'] del df_tcad['Longitude'] #Known location column df_tcad['known_loc']= np.where(df_tcad.X_x.notnull(), True,False) #Residential criteria res = ['A1','A2','A3','A4','A5','B1','B2','B3','B4','E2','M1','XA'] res_type = ['ALT LIVING CTR', 'DORMITORY HIRISE', 'DORMITORY', 'APARTMENT 5-25', 'LUXURY HI-RISE APTS 100+', 'APARTMENT 100+', 'GARAGE APARTMENT', 'Accessory Dwelling Unit' 'FOURPLEX', 'MOHO DOUBLE PP'] #got rid of detail only res_code = ['100','113','150','160','210','220','230','240','330'] df_tcad['res'] = df_tcad.code2.isin(res) df_tcad['res'] = (df_tcad.res | (df_tcad.hs=='T') | df_tcad.type1.isin(res_type) | (df_tcad.type1.str.contains('CONDO',na=False)) | (df_tcad.type1.str.contains('DWELLING',na=False)) | (df_tcad.desc.str.contains('APARTMENT',na=False)) | (df_tcad.desc.str.contains('APARTMENT',na=False)) | df_tcad.type1.str.contains('APARTMENT',na=False) | df_tcad.type1.str.contains('APT',na=False) | df_tcad.type1.str.contains('DORM',na=False) | (df_tcad.type1.str.contains('MOHO',na=False))) #df_tcad['res'] = (df_tcad.res | df_tcad.type1.isin(res_type) | (df_tcad.type1.str.contains('CONDO',na=False)) | (df_tcad.type1.str.contains('DWELLING',na=False)) | ((df_tcad.desc.str.contains('CONDO',na=False))&(~df_tcad.desc.str.contains('CONDO',na=False))) | (df_tcad.desc.str.contains('APARTMENT',na=False)))) #apts = df_tcad.loc[ df_tcad.type1.str.contains('APARTMENT',na=False) | df_tcad.type1.str.contains('APT',na=False) | df_tcad.type1.str.contains('DORM',na=False)| (df_tcad.type1.str.contains('CONDO',na=False))]
df_tcad = merge_extraction(dfs=[df_tcad, df_units, gdf_16], val=['dba', 'type1', 'units', 'low', 'high', 'units_from_type', 'est_from_type', 'shape_area']) replace_nan(df_tcad, ['units_x', 'units_y', 'low', 'high'], val=0, reverse=True) df_tcad.units_y = np.where(df_tcad.est_from_type, np.nan, df_tcad.units_y) df_tcad.units_x.fillna(df_tcad.units_y, inplace=True) df_tcad['known'] = np.where(df_tcad.units_x.notnull(), True, False) del df_tcad['units_y'] df_tcad = merge_extraction(dfs=[df_tcad, gdf, df_locs], on='prop_id', val=['land_use', 'X', 'Y', 'geometry', 'shape_area']) df_tcad.X_y.fillna(df_tcad.X_x, inplace=True) df_tcad.Y_y.fillna(df_tcad.Y_x, inplace=True) df_tcad.Y_x.fillna(df_tcad.Y_y, inplace=True) df_tcad.X_x.fillna(df_tcad.X_y, inplace=True) del df_tcad['X_y'] del df_tcad['Y_y'] df_tcad = df_tcad.merge(df_con, left_on='geo_id', right_on='TCAD ID', how='left') df_tcad.Y_x.fillna(df_tcad.Latitude, inplace=True) df_tcad.X_x.fillna(df_tcad.Longitude, inplace=True) del df_tcad['Latitude'] del df_tcad['Longitude'] df_tcad['known_loc'] = np.where(df_tcad.X_x.notnull(), True, False) res = ['A1', 'A2', 'A3', 'A4', 'A5', 'B1', 'B2', 'B3', 'B4', 'E2', 'M1', 'XA'] res_type = ['ALT LIVING CTR', 'DORMITORY HIRISE', 'DORMITORY', 'APARTMENT 5-25', 'LUXURY HI-RISE APTS 100+', 'APARTMENT 100+', 'GARAGE APARTMENT', 'Accessory Dwelling UnitFOURPLEX', 'MOHO DOUBLE PP'] res_code = ['100', '113', '150', '160', '210', '220', '230', '240', '330'] df_tcad['res'] = df_tcad.code2.isin(res) df_tcad['res'] = df_tcad.res | (df_tcad.hs == 'T') | df_tcad.type1.isin(res_type) | df_tcad.type1.str.contains('CONDO', na=False) | df_tcad.type1.str.contains('DWELLING', na=False) | df_tcad.desc.str.contains('APARTMENT', na=False) | df_tcad.desc.str.contains('APARTMENT', na=False) | df_tcad.type1.str.contains('APARTMENT', na=False) | df_tcad.type1.str.contains('APT', na=False) | df_tcad.type1.str.contains('DORM', na=False) | df_tcad.type1.str.contains('MOHO', na=False)
exports = { "name": "Earth", "aspects": { "amulets": [ { "item": "scholar", "effect": "health", "description": "Into the earth is the answer. " "Into the earth lies existance. " "Into the earth lies death and memory. " "Less health for opponents" }, { "item": "stargazer", "effect": "hit", "description": "The stars blesses our earth. " "More accurate attacks" } ], "potions": [ { "item": "justice", "effect": "health", "description": "In the tomb, ancient spirits scream " "for justice. Less health for opponents" }, { "item": "blood", "effect": "hit", "description": "Into the earth, lies the blood of " "our ancestors. Raised hit ratio" } ] }, "traces": ['taurus', 'virgo', 'capricorn'] }
exports = {'name': 'Earth', 'aspects': {'amulets': [{'item': 'scholar', 'effect': 'health', 'description': 'Into the earth is the answer. Into the earth lies existance. Into the earth lies death and memory. Less health for opponents'}, {'item': 'stargazer', 'effect': 'hit', 'description': 'The stars blesses our earth. More accurate attacks'}], 'potions': [{'item': 'justice', 'effect': 'health', 'description': 'In the tomb, ancient spirits scream for justice. Less health for opponents'}, {'item': 'blood', 'effect': 'hit', 'description': 'Into the earth, lies the blood of our ancestors. Raised hit ratio'}]}, 'traces': ['taurus', 'virgo', 'capricorn']}
def perfect_number(number): printing = "It's not so perfect." checker = number nums = 0 proper_devisors_sum = 0 for num in range(1, int(checker)): if int(checker) % num == 0: nums += int(num) if nums == int(checker): printing = "We have a perfect number!" return printing print(perfect_number(str(input())))
def perfect_number(number): printing = "It's not so perfect." checker = number nums = 0 proper_devisors_sum = 0 for num in range(1, int(checker)): if int(checker) % num == 0: nums += int(num) if nums == int(checker): printing = 'We have a perfect number!' return printing print(perfect_number(str(input())))
# Get all available modules # help("modules") module_names = [ "micropython", "uhashlib", "uselect", "_onewire", "sys", "uheapq", "ustruct", "builtins", "uarray", "uio", "utime", "cmath", "ubinascii", "ujson", "utimeq", "firmware", "ubluetooth", "umachine", "uzlib", "gc", "ucollections", "uos", "hub", "uctypes", "urandom", "math", "uerrno", "ure" ] # List of objects to be processed. object_list_todo = list() object_list_done = list() # Loop over the builtin modules. for object_name in module_names: # Add them to the object list to be processed. object_list_todo.append((object_name, __import__(object_name))) object_list_done.append(object_name) # Loop over all objects. while len(object_list_todo) > 0: object_name, object_handle = object_list_todo.pop(0) # Reserve space in map, and ensure checks for whether we already have this module pass. object_map = dict() # Get contents of object. object_entries = dir(object_handle) # Loop over all entries in the object. for object_entry in object_entries: # Add them to the map for output. object_map[object_entry] = (type(getattr(object_handle, object_entry)).__name__, str(getattr(object_handle, object_entry))) # Add them to the object list to be processed. if (not object_entry in object_list_done): # Add them to the list for further processing if they are not a base type. if ((not isinstance(getattr(object_handle, object_entry), (str, float, int, list, dict, set))) and (not type(getattr(object_handle, object_entry)).__name__ == "function")): object_list_todo.append((object_entry, getattr(object_handle, object_entry))) object_list_done.append(object_entry) print("{} = {}".format(object_name, object_map))
module_names = ['micropython', 'uhashlib', 'uselect', '_onewire', 'sys', 'uheapq', 'ustruct', 'builtins', 'uarray', 'uio', 'utime', 'cmath', 'ubinascii', 'ujson', 'utimeq', 'firmware', 'ubluetooth', 'umachine', 'uzlib', 'gc', 'ucollections', 'uos', 'hub', 'uctypes', 'urandom', 'math', 'uerrno', 'ure'] object_list_todo = list() object_list_done = list() for object_name in module_names: object_list_todo.append((object_name, __import__(object_name))) object_list_done.append(object_name) while len(object_list_todo) > 0: (object_name, object_handle) = object_list_todo.pop(0) object_map = dict() object_entries = dir(object_handle) for object_entry in object_entries: object_map[object_entry] = (type(getattr(object_handle, object_entry)).__name__, str(getattr(object_handle, object_entry))) if not object_entry in object_list_done: if not isinstance(getattr(object_handle, object_entry), (str, float, int, list, dict, set)) and (not type(getattr(object_handle, object_entry)).__name__ == 'function'): object_list_todo.append((object_entry, getattr(object_handle, object_entry))) object_list_done.append(object_entry) print('{} = {}'.format(object_name, object_map))
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Summary Functions\n", "\n", "def get_summ_combined_county_annual(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns seller details such as addresses\n", "\n", " >>>get_summ_combined_county_annual('OH', 'Summit')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'combined_county_annual?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_county + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " combined_county_annual_df = json_normalize(requests.get(full_url).json())\n", " return combined_county_annual_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", " \n", " \n", "def get_summ_combined_county_monthly(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns seller details such as addresses\n", "\n", " >>>get_summ_combined_county_monthly('OH', 'Summit')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'combined_county_monthly?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_county + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " combined_county_monthly_df = json_normalize(requests.get(full_url).json())\n", " return combined_county_monthly_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", " \n", "def get_summ_total_pharmacies_county(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns all pharmacy totals by county (Will be large and could take extra time to load)\n", "\n", " >>>get_summ_total_pharmacies_county('OH', 'Summit')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_pharmacies_county?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_county + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " total_pharmacies_county_df = json_normalize(requests.get(full_url).json())\n", " return total_pharmacies_county_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", " \n", "def get_summ_total_manufacturers_county(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns all Manufacturer totals by county (Will be large and could take extra time to load)\n", "\n", " >>>get_summ_total_manufacturers_county('OH', 'Summit')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_manufacturers_county?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_county + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " total_manufacturers_county_df = json_normalize(requests.get(full_url).json())\n", " return total_manufacturers_county_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", " \n", "def get_summ_total_distributors_county(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns all Distributor totals by county (Will be large and could take extra time to load)\n", "\n", " >>>get_summ_total_distributors_county('OH', 'Summit')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_distributors_county?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_county + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " total_distributors_county_df = json_normalize(requests.get(full_url).json())\n", " return total_distributors_county_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", " \n", "def get_summ_total_pharmacies_state(state,verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns all pharmacy totals by state (Will be large and could take extra time to load)\n", "\n", " >>>get_summ_total_pharmacies_state('OH')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_pharmacies_state?'\n", " add_state = 'state=' + state\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " total_pharmacies_state_df = json_normalize(requests.get(full_url).json())\n", " return total_pharmacies_state_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", " \n", "def get_summ_total_manufacturers_state(state,verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns all Manufacturer totals by state (Will be large and could take extra time to load) \n", "\n", " >>>get_summ_total_manufacturers_state('OH', 'Summit')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_manufacturers_state?'\n", " add_state = 'state=' + state\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " total_manufacturers_state_df = json_normalize(requests.get(full_url).json())\n", " return total_manufacturers_state_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", " \n", "def get_summ_total_distributors_state(state,verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns all Distributor totals by state (Will be large and could take extra time to load) \n", "\n", " >>>get_summ_total_distributors_state('OH', 'Summit')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_distributors_state?'\n", " add_state = 'state=' + state\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " total_distributors_state_df = json_normalize(requests.get(full_url).json())\n", " return total_distributors_state_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL and state are correct: ', full_url)\n", "\n", "def get_summ_combined_buyer_annual(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns summarized annual dosages of pharmacies and practitioners by state and county \n", "\n", " >>>get_summ_combined_buyer_annual('OH', 'Summit')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'combined_buyer_annual?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_county + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " combined_buyer_annual_df = json_normalize(requests.get(full_url).json())\n", " return combined_buyer_annual_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", " \n", "def get_summ_combined_buyer_monthly(state, year, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", " Returns dosages by pharmacy or practitioner by county, state, and yea \n", "\n", " >>>get_summ_combined_buyer_monthly('OH', 'Summit')\n", " EXAMPLE OUTPUT\n", " '''\n", "\n", " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'combined_buyer_monthly?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_year = '&year=' + year\n", " add_key = '&key=' + key\n", " full_url = base_url + function_url + add_state + add_county + add_year + add_key\n", "\n", " if verification == True:\n", " print(full_url)\n", " combined_buyer_monthly_df = json_normalize(requests.get(full_url).json())\n", " return combined_buyer_monthly_df\n", " else:\n", " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", " " ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.9" } }, "nbformat": 4, "nbformat_minor": 4 }
{'cells': [{'cell_type': 'code', 'execution_count': null, 'metadata': {}, 'outputs': [], 'source': ['# Summary Functions\n', '\n', "def get_summ_combined_county_annual(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns seller details such as addresses\n', '\n', " >>>get_summ_combined_county_annual('OH', 'Summit')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'combined_county_annual?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_county + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' combined_county_annual_df = json_normalize(requests.get(full_url).json())\n', ' return combined_county_annual_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", ' \n', ' \n', "def get_summ_combined_county_monthly(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns seller details such as addresses\n', '\n', " >>>get_summ_combined_county_monthly('OH', 'Summit')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'combined_county_monthly?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_county + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' combined_county_monthly_df = json_normalize(requests.get(full_url).json())\n', ' return combined_county_monthly_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", ' \n', "def get_summ_total_pharmacies_county(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns all pharmacy totals by county (Will be large and could take extra time to load)\n', '\n', " >>>get_summ_total_pharmacies_county('OH', 'Summit')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_pharmacies_county?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_county + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' total_pharmacies_county_df = json_normalize(requests.get(full_url).json())\n', ' return total_pharmacies_county_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", ' \n', "def get_summ_total_manufacturers_county(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns all Manufacturer totals by county (Will be large and could take extra time to load)\n', '\n', " >>>get_summ_total_manufacturers_county('OH', 'Summit')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_manufacturers_county?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_county + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' total_manufacturers_county_df = json_normalize(requests.get(full_url).json())\n', ' return total_manufacturers_county_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", ' \n', "def get_summ_total_distributors_county(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns all Distributor totals by county (Will be large and could take extra time to load)\n', '\n', " >>>get_summ_total_distributors_county('OH', 'Summit')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_distributors_county?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_county + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' total_distributors_county_df = json_normalize(requests.get(full_url).json())\n', ' return total_distributors_county_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", ' \n', "def get_summ_total_pharmacies_state(state,verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns all pharmacy totals by state (Will be large and could take extra time to load)\n', '\n', " >>>get_summ_total_pharmacies_state('OH')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_pharmacies_state?'\n", " add_state = 'state=' + state\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' total_pharmacies_state_df = json_normalize(requests.get(full_url).json())\n', ' return total_pharmacies_state_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", ' \n', "def get_summ_total_manufacturers_state(state,verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns all Manufacturer totals by state (Will be large and could take extra time to load) \n', '\n', " >>>get_summ_total_manufacturers_state('OH', 'Summit')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_manufacturers_state?'\n", " add_state = 'state=' + state\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' total_manufacturers_state_df = json_normalize(requests.get(full_url).json())\n', ' return total_manufacturers_state_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", ' \n', "def get_summ_total_distributors_state(state,verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns all Distributor totals by state (Will be large and could take extra time to load) \n', '\n', " >>>get_summ_total_distributors_state('OH', 'Summit')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'total_distributors_state?'\n", " add_state = 'state=' + state\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' total_distributors_state_df = json_normalize(requests.get(full_url).json())\n', ' return total_distributors_state_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL and state are correct: ', full_url)\n", '\n', "def get_summ_combined_buyer_annual(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns summarized annual dosages of pharmacies and practitioners by state and county \n', '\n', " >>>get_summ_combined_buyer_annual('OH', 'Summit')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'combined_buyer_annual?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_county + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' combined_buyer_annual_df = json_normalize(requests.get(full_url).json())\n', ' return combined_buyer_annual_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", ' \n', "def get_summ_combined_buyer_monthly(state, year, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns dosages by pharmacy or practitioner by county, state, and yea \n', '\n', " >>>get_summ_combined_buyer_monthly('OH', 'Summit')\n", ' EXAMPLE OUTPUT\n', " '''\n", '\n', " base_url = 'https://arcos-api.ext.nile.works/v1/'\n", " function_url = 'combined_buyer_monthly?'\n", " add_state = 'state=' + state\n", " add_county = '&county=' + county\n", " add_year = '&year=' + year\n", " add_key = '&key=' + key\n", ' full_url = base_url + function_url + add_state + add_county + add_year + add_key\n', '\n', ' if verification == True:\n', ' print(full_url)\n', ' combined_buyer_monthly_df = json_normalize(requests.get(full_url).json())\n', ' return combined_buyer_monthly_df\n', ' else:\n', " print('Problem encountered, not returning data:')\n", " print('Either verification == False')\n", " print('Or problem with API encountered, please verify URL, state and county are correct: ', full_url)\n", ' ']}], 'metadata': {'kernelspec': {'display_name': 'Python 3', 'language': 'python', 'name': 'python3'}, 'language_info': {'codemirror_mode': {'name': 'ipython', 'version': 3}, 'file_extension': '.py', 'mimetype': 'text/x-python', 'name': 'python', 'nbconvert_exporter': 'python', 'pygments_lexer': 'ipython3', 'version': '3.6.9'}}, 'nbformat': 4, 'nbformat_minor': 4}
# -*- coding: utf-8 -*- class ProxyMiddleware(object): def __init__(self, proxy_url): self.proxy_url = proxy_url def process_request(self, request, spider): request.meta['proxy'] = self.proxy_url @classmethod def from_crawler(cls, crawler): return cls( proxy_url=crawler.settings.get('PROXY_URL') )
class Proxymiddleware(object): def __init__(self, proxy_url): self.proxy_url = proxy_url def process_request(self, request, spider): request.meta['proxy'] = self.proxy_url @classmethod def from_crawler(cls, crawler): return cls(proxy_url=crawler.settings.get('PROXY_URL'))
if 5 == 2: print("aaaa") print("sjjdjdd") else : print("else")
if 5 == 2: print('aaaa') print('sjjdjdd') else: print('else')
n = int(input()) print('*' * (2*n+1)) print('.' + '*' + ' ' * (2*n - 3) + '*' + '.') for i in range(1, n-1): print('.' + '.' * i + '*' + '@' * ((2*n-3) -2*i) + '*' + '.' * i + '.') print('.' * n +'*' + '.' * n) for i in range(1, n-1): print('.' * ((n)-i) + '*' + ' ' * (i-1) + '@' + ' ' * (i-1) + '*' + '.' * ((n)-i)) print('.' + '*' + '@' * (2*n-3) + '*' + '.') print('*' * (2*n+1))
n = int(input()) print('*' * (2 * n + 1)) print('.' + '*' + ' ' * (2 * n - 3) + '*' + '.') for i in range(1, n - 1): print('.' + '.' * i + '*' + '@' * (2 * n - 3 - 2 * i) + '*' + '.' * i + '.') print('.' * n + '*' + '.' * n) for i in range(1, n - 1): print('.' * (n - i) + '*' + ' ' * (i - 1) + '@' + ' ' * (i - 1) + '*' + '.' * (n - i)) print('.' + '*' + '@' * (2 * n - 3) + '*' + '.') print('*' * (2 * n + 1))
class Enum: def __init__(self,list): self.list = list def enume(self): for index, val in enumerate(self.list,start=1): print(index,val) e1 = Enum([5,15,45,4,53]) e1.enume()
class Enum: def __init__(self, list): self.list = list def enume(self): for (index, val) in enumerate(self.list, start=1): print(index, val) e1 = enum([5, 15, 45, 4, 53]) e1.enume()
class UserState(object): def __init__(self, user_id): self.user_id = user_id self.conversation_context = {} self.conversation_started = False self.user = None self.ingredient_cuisine = None self.recipe = None
class Userstate(object): def __init__(self, user_id): self.user_id = user_id self.conversation_context = {} self.conversation_started = False self.user = None self.ingredient_cuisine = None self.recipe = None
class Solution: def findKthNumber(self, n: int, k: int) -> int: cur = 1 k -= 1 while k > 0: step, first, last = 0, cur, cur + 1 while first <= n: step += min(last, n + 1) - first first *= 10 last *= 10 if k >= step: k -= step cur += 1 else: cur *= 10 k -= 1 return cur
class Solution: def find_kth_number(self, n: int, k: int) -> int: cur = 1 k -= 1 while k > 0: (step, first, last) = (0, cur, cur + 1) while first <= n: step += min(last, n + 1) - first first *= 10 last *= 10 if k >= step: k -= step cur += 1 else: cur *= 10 k -= 1 return cur
mylines = [] with open('resume.txt', 'rt') as myfile: for myline in myfile: mylines.append(myline) print("Name: ", end="") for c in mylines[0]: if c == "|": break; else: print(c, end="")
mylines = [] with open('resume.txt', 'rt') as myfile: for myline in myfile: mylines.append(myline) print('Name: ', end='') for c in mylines[0]: if c == '|': break else: print(c, end='')
class Interaction: current_os = -1 logger = None def __init__(self, current_os, logger): self.current_os = current_os self.logger = logger def print_info(self): self.logger.raw("This is interaction with Maya") # framework interactions def schema_item_double_click(self, param): self.logger.raw(("Double click on schema item", param))
class Interaction: current_os = -1 logger = None def __init__(self, current_os, logger): self.current_os = current_os self.logger = logger def print_info(self): self.logger.raw('This is interaction with Maya') def schema_item_double_click(self, param): self.logger.raw(('Double click on schema item', param))
class GameObject: # this is a generic object: the player, a monster, an item, the stairs... # it's always represented by a character on screen. def __init__(self, x, y, char, color): self.x = x self.y = y self.char = char self.color = color def move(self, dx, dy, tile_map): # move by the given amount, IFF the tile is not blocked tile = tile_map[self.x + dx][self.y + dy] if not tile.blocked: self.x += dx self.y += dy def draw(self, console, visible_tiles, bg=None): # draw the character that represents this object at its position if visible_tiles is None or (self.x, self.y) in visible_tiles: console.draw_char(self.x, self.y, self.char, self.color, bg=bg) def clear(self, console, bg=None): # erase the character that represents this object console.draw_char(self.x, self.y, ' ', self.color, bg=bg)
class Gameobject: def __init__(self, x, y, char, color): self.x = x self.y = y self.char = char self.color = color def move(self, dx, dy, tile_map): tile = tile_map[self.x + dx][self.y + dy] if not tile.blocked: self.x += dx self.y += dy def draw(self, console, visible_tiles, bg=None): if visible_tiles is None or (self.x, self.y) in visible_tiles: console.draw_char(self.x, self.y, self.char, self.color, bg=bg) def clear(self, console, bg=None): console.draw_char(self.x, self.y, ' ', self.color, bg=bg)
class Institution(object): institution_name = None website = None industry = None type = None headquarters = None company_size = None founded = None def __init__(self, name=None, website=None, industry=None, type=None, headquarters=None, company_size=None, founded=None): self.name = name self.website = website self.industry = industry self.type = type self.headquarters = headquarters self.company_size = company_size self.founded = founded class Experience(Institution): from_date = None to_date = None description = None position_title = None duration = None def __init__(self, from_date = None, to_date = None, description = None, position_title = None, duration = None, location = None): self.from_date = from_date self.to_date = to_date self.description = description self.position_title = position_title self.duration = duration self.location = location def __repr__(self): return "{position_title} at {company} from {from_date} to {to_date} for {duration} based at {location}".format( from_date = self.from_date, to_date = self.to_date, position_title = self.position_title, company = self.institution_name, duration = self.duration, location = self.location) def __str__(self): return "{company}, {location}\n {position_title}\n{from_date} - {to_date}".format( from_date = self.from_date, to_date = self.to_date, position_title = ('\n').join(self.position_title), company = self.institution_name, location = list(set(self.location))) class Education(Institution): from_date = None to_date = None description = None degree = None def __init__(self, from_date = None, to_date = None, description = None, degree = None): self.from_date = from_date self.to_date = to_date self.description = description self.degree = degree def __repr__(self): return "{degree} at {company} from {from_date} to {to_date}".format( from_date = self.from_date, to_date = self.to_date, degree = self.degree, company = self.institution_name) def __str__(self): return "{company}, {degree}\n{from_date} - {to_date}".format( from_date = self.from_date[-2:], to_date = self.to_date[-2:], degree = self.degree, company = self.institution_name) class Scraper(object): driver = None def is_signed_in(self): try: self.driver.find_element_by_id("profile-nav-item") return True except: pass return False def __find_element_by_class_name__(self, class_name): try: self.driver.find_element_by_class_name(class_name) return True except: pass return False
class Institution(object): institution_name = None website = None industry = None type = None headquarters = None company_size = None founded = None def __init__(self, name=None, website=None, industry=None, type=None, headquarters=None, company_size=None, founded=None): self.name = name self.website = website self.industry = industry self.type = type self.headquarters = headquarters self.company_size = company_size self.founded = founded class Experience(Institution): from_date = None to_date = None description = None position_title = None duration = None def __init__(self, from_date=None, to_date=None, description=None, position_title=None, duration=None, location=None): self.from_date = from_date self.to_date = to_date self.description = description self.position_title = position_title self.duration = duration self.location = location def __repr__(self): return '{position_title} at {company} from {from_date} to {to_date} for {duration} based at {location}'.format(from_date=self.from_date, to_date=self.to_date, position_title=self.position_title, company=self.institution_name, duration=self.duration, location=self.location) def __str__(self): return '{company}, {location}\n {position_title}\n{from_date} - {to_date}'.format(from_date=self.from_date, to_date=self.to_date, position_title='\n'.join(self.position_title), company=self.institution_name, location=list(set(self.location))) class Education(Institution): from_date = None to_date = None description = None degree = None def __init__(self, from_date=None, to_date=None, description=None, degree=None): self.from_date = from_date self.to_date = to_date self.description = description self.degree = degree def __repr__(self): return '{degree} at {company} from {from_date} to {to_date}'.format(from_date=self.from_date, to_date=self.to_date, degree=self.degree, company=self.institution_name) def __str__(self): return '{company}, {degree}\n{from_date} - {to_date}'.format(from_date=self.from_date[-2:], to_date=self.to_date[-2:], degree=self.degree, company=self.institution_name) class Scraper(object): driver = None def is_signed_in(self): try: self.driver.find_element_by_id('profile-nav-item') return True except: pass return False def __find_element_by_class_name__(self, class_name): try: self.driver.find_element_by_class_name(class_name) return True except: pass return False
#!/usr/bin/env python3 def insertion_sort(lst): #times for i in range(1,len(lst)): #n - 1 while i > 0 and lst[i-1] > lst[i]: #(n - 1)n lst[i], lst[i-1] = lst[i-1], lst[i] #(n - 1)n/2 i -= 1 #1 return lst print(insertion_sort([6, 4, 3, 8, 5]))
def insertion_sort(lst): for i in range(1, len(lst)): while i > 0 and lst[i - 1] > lst[i]: (lst[i], lst[i - 1]) = (lst[i - 1], lst[i]) i -= 1 return lst print(insertion_sort([6, 4, 3, 8, 5]))
def access_required(): pass
def access_required(): pass
class cacheFilesManagerInterface: def __init__(self, cacheRootPath, resourcesRootPath): super().__init__() def createCacheFiles (self, fileInfo): raise NotImplementedError() def deleteCacheFiles (self, fileInfo): raise NotImplementedError() def getCacheFile (self, fileUID, chunkNumber): raise NotImplementedError() def restoreFileFromCache (self, fileInfo): raise NotImplementedError() def copyFileIntoChunks (self, cachedFileInfo): raise NotImplementedError() def writeChunkContent (self, content, fileName): raise NotImplementedError()
class Cachefilesmanagerinterface: def __init__(self, cacheRootPath, resourcesRootPath): super().__init__() def create_cache_files(self, fileInfo): raise not_implemented_error() def delete_cache_files(self, fileInfo): raise not_implemented_error() def get_cache_file(self, fileUID, chunkNumber): raise not_implemented_error() def restore_file_from_cache(self, fileInfo): raise not_implemented_error() def copy_file_into_chunks(self, cachedFileInfo): raise not_implemented_error() def write_chunk_content(self, content, fileName): raise not_implemented_error()
#!/usr/bin/python # -*- encoding: utf-8; py-indent-offset: 4 -*- # +------------------------------------------------------------------+ # | ____ _ _ __ __ _ __ | # | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | # | | |___| | | | __/ (__| < | | | | . \ | # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | # | | # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | # +------------------------------------------------------------------+ # # This file is part of Check_MK. # The official homepage is at http://mathias-kettner.de/check_mk. # # check_mk is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation in version 2. check_mk is distributed # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU General Public License for more de- # tails. You should have received a copy of the GNU General Public # License along with GNU Make; see the file COPYING. If not, write # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301 USA. # This file contains the defaults settings for almost all configuration # variables that can be overridden in main.mk. Some configuration # variables are preset in checks/* as well. monitoring_core = "nagios" # other option: "cmc" agent_port = 6556 agent_ports = [] snmp_ports = [] # UDP ports used for SNMP tcp_connect_timeout = 5.0 use_dns_cache = True # prevent DNS by using own cache file delay_precompile = False # delay Python compilation to Nagios execution restart_locking = "abort" # also possible: "wait", None check_submission = "file" # alternative: "pipe" aggr_summary_hostname = "%s-s" agent_min_version = 0 # warn, if plugin has not at least version check_max_cachefile_age = 0 # per default do not use cache files when checking cluster_max_cachefile_age = 90 # secs. piggyback_max_cachefile_age = 3600 # secs piggyback_translation = [] # Ruleset for translating piggyback host names simulation_mode = False agent_simulator = False perfdata_format = "pnp" # also possible: "standard" check_mk_perfdata_with_times = True debug_log = False # deprecated monitoring_host = None # deprecated max_num_processes = 50 fallback_agent_output_encoding = 'latin1' # SNMP communities and encoding has_inline_snmp = False # is set to True by inline_snmp module, when available use_inline_snmp = True non_inline_snmp_hosts = [] # Ruleset to disable Inline-SNMP per host when # use_inline_snmp is enabled. snmp_limit_oid_range = [] # Ruleset to recduce fetched OIDs of a check, only inline SNMP record_inline_snmp_stats = False snmp_default_community = 'public' snmp_communities = [] snmp_timing = [] snmp_character_encodings = [] explicit_snmp_communities = {} # override the rule based configuration # RRD creation (only with CMC) cmc_log_rrdcreation = None # also: "terse", "full" cmc_host_rrd_config = [] # Rule for per-host configuration of RRDs cmc_service_rrd_config = [] # Rule for per-service configuration of RRDs # Inventory and inventory checks inventory_check_interval = None # Nagios intervals (4h = 240) inventory_check_severity = 1 # warning inventory_check_do_scan = True # include SNMP scan for SNMP devices inventory_max_cachefile_age = 120 # seconds inventory_check_autotrigger = True # Automatically trigger inv-check after automation-inventory always_cleanup_autochecks = None # For compatiblity with old configuration periodic_discovery = [] # Nagios templates and other settings concerning generation # of Nagios configuration files. No need to change these values. # Better adopt the content of the templates host_template = 'check_mk_host' cluster_template = 'check_mk_cluster' pingonly_template = 'check_mk_pingonly' active_service_template = 'check_mk_active' inventory_check_template = 'check_mk_inventory' passive_service_template = 'check_mk_passive' passive_service_template_perf = 'check_mk_passive_perf' summary_service_template = 'check_mk_summarized' service_dependency_template = 'check_mk' default_host_group = 'check_mk' generate_hostconf = True generate_dummy_commands = True dummy_check_commandline = 'echo "ERROR - you did an active check on this service - please disable active checks" && exit 1' nagios_illegal_chars = '`;~!$%^&*|\'"<>?,()=' # Data to be defined in main.mk checks = [] static_checks = {} check_parameters = [] checkgroup_parameters = {} inv_parameters = {} # for HW/SW-Inventory legacy_checks = [] # non-WATO variant of legacy checks active_checks = {} # WATO variant for fully formalized checks special_agents = {} # WATO variant for datasource_programs custom_checks = [] # WATO variant for free-form custom checks without formalization all_hosts = [] host_paths = {} snmp_hosts = [ (['snmp'], ALL_HOSTS) ] tcp_hosts = [ (['tcp'], ALL_HOSTS), (NEGATE, ['snmp'], ALL_HOSTS), (['!ping'], ALL_HOSTS) ] bulkwalk_hosts = [] snmpv2c_hosts = [] snmp_without_sys_descr = [] snmpv3_contexts = [] usewalk_hosts = [] dyndns_hosts = [] # use host name as ip address for these hosts primary_address_family = [] ignored_checktypes = [] # exclude from inventory ignored_services = [] # exclude from inventory ignored_checks = [] # exclude from inventory host_groups = [] service_groups = [] service_contactgroups = [] service_notification_periods = [] # deprecated, will be removed soon. host_notification_periods = [] # deprecated, will be removed soon. host_contactgroups = [] parents = [] define_hostgroups = None define_servicegroups = None define_contactgroups = None contactgroup_members = {} contacts = {} timeperiods = {} # needed for WATO clusters = {} clustered_services = [] clustered_services_of = {} # new in 1.1.4 clustered_services_mapping = [] # new for 1.2.5i1 Wato Rule datasource_programs = [] service_aggregations = [] service_dependencies = [] non_aggregated_hosts = [] aggregate_check_mk = False aggregation_output_format = "multiline" # new in 1.1.6. Possible also: "multiline" summary_host_groups = [] summary_service_groups = [] # service groups for aggregated services summary_service_contactgroups = [] # service contact groups for aggregated services summary_host_notification_periods = [] summary_service_notification_periods = [] ipaddresses = {} # mapping from hostname to IPv4 address ipv6addresses = {} # mapping from hostname to IPv6 address only_hosts = None distributed_wato_site = None # used by distributed WATO extra_host_conf = {} extra_summary_host_conf = {} extra_service_conf = {} extra_summary_service_conf = {} extra_nagios_conf = "" service_descriptions = {} donation_hosts = [] donation_command = 'mail -r checkmk@yoursite.de -s "Host donation %s" donatehosts@mathias-kettner.de' % check_mk_version scanparent_hosts = [ ( ALL_HOSTS ) ] host_attributes = {} # needed by WATO, ignored by Check_MK ping_levels = [] # special parameters for host/PING check_command host_check_commands = [] # alternative host check instead of check_icmp check_mk_exit_status = [] # Rule for specifying CMK's exit status in case of various errors check_mk_agent_target_versions = [] # Rule for defining expected version for agents check_periods = [] snmp_check_interval = [] inv_exports = {} # Rulesets for inventory export hooks notification_parameters = {} # Rulesets for parameters of notification scripts use_new_descriptions_for = [] host_icons_and_actions = [] # Custom user icons / actions to be configured service_icons_and_actions = [] # Custom user icons / actions to be configured # Rulesets for agent bakery agent_config = {} bake_agents_on_restart = False
monitoring_core = 'nagios' agent_port = 6556 agent_ports = [] snmp_ports = [] tcp_connect_timeout = 5.0 use_dns_cache = True delay_precompile = False restart_locking = 'abort' check_submission = 'file' aggr_summary_hostname = '%s-s' agent_min_version = 0 check_max_cachefile_age = 0 cluster_max_cachefile_age = 90 piggyback_max_cachefile_age = 3600 piggyback_translation = [] simulation_mode = False agent_simulator = False perfdata_format = 'pnp' check_mk_perfdata_with_times = True debug_log = False monitoring_host = None max_num_processes = 50 fallback_agent_output_encoding = 'latin1' has_inline_snmp = False use_inline_snmp = True non_inline_snmp_hosts = [] snmp_limit_oid_range = [] record_inline_snmp_stats = False snmp_default_community = 'public' snmp_communities = [] snmp_timing = [] snmp_character_encodings = [] explicit_snmp_communities = {} cmc_log_rrdcreation = None cmc_host_rrd_config = [] cmc_service_rrd_config = [] inventory_check_interval = None inventory_check_severity = 1 inventory_check_do_scan = True inventory_max_cachefile_age = 120 inventory_check_autotrigger = True always_cleanup_autochecks = None periodic_discovery = [] host_template = 'check_mk_host' cluster_template = 'check_mk_cluster' pingonly_template = 'check_mk_pingonly' active_service_template = 'check_mk_active' inventory_check_template = 'check_mk_inventory' passive_service_template = 'check_mk_passive' passive_service_template_perf = 'check_mk_passive_perf' summary_service_template = 'check_mk_summarized' service_dependency_template = 'check_mk' default_host_group = 'check_mk' generate_hostconf = True generate_dummy_commands = True dummy_check_commandline = 'echo "ERROR - you did an active check on this service - please disable active checks" && exit 1' nagios_illegal_chars = '`;~!$%^&*|\'"<>?,()=' checks = [] static_checks = {} check_parameters = [] checkgroup_parameters = {} inv_parameters = {} legacy_checks = [] active_checks = {} special_agents = {} custom_checks = [] all_hosts = [] host_paths = {} snmp_hosts = [(['snmp'], ALL_HOSTS)] tcp_hosts = [(['tcp'], ALL_HOSTS), (NEGATE, ['snmp'], ALL_HOSTS), (['!ping'], ALL_HOSTS)] bulkwalk_hosts = [] snmpv2c_hosts = [] snmp_without_sys_descr = [] snmpv3_contexts = [] usewalk_hosts = [] dyndns_hosts = [] primary_address_family = [] ignored_checktypes = [] ignored_services = [] ignored_checks = [] host_groups = [] service_groups = [] service_contactgroups = [] service_notification_periods = [] host_notification_periods = [] host_contactgroups = [] parents = [] define_hostgroups = None define_servicegroups = None define_contactgroups = None contactgroup_members = {} contacts = {} timeperiods = {} clusters = {} clustered_services = [] clustered_services_of = {} clustered_services_mapping = [] datasource_programs = [] service_aggregations = [] service_dependencies = [] non_aggregated_hosts = [] aggregate_check_mk = False aggregation_output_format = 'multiline' summary_host_groups = [] summary_service_groups = [] summary_service_contactgroups = [] summary_host_notification_periods = [] summary_service_notification_periods = [] ipaddresses = {} ipv6addresses = {} only_hosts = None distributed_wato_site = None extra_host_conf = {} extra_summary_host_conf = {} extra_service_conf = {} extra_summary_service_conf = {} extra_nagios_conf = '' service_descriptions = {} donation_hosts = [] donation_command = 'mail -r checkmk@yoursite.de -s "Host donation %s" donatehosts@mathias-kettner.de' % check_mk_version scanparent_hosts = [ALL_HOSTS] host_attributes = {} ping_levels = [] host_check_commands = [] check_mk_exit_status = [] check_mk_agent_target_versions = [] check_periods = [] snmp_check_interval = [] inv_exports = {} notification_parameters = {} use_new_descriptions_for = [] host_icons_and_actions = [] service_icons_and_actions = [] agent_config = {} bake_agents_on_restart = False
#Command line program that performs various conversions def errorMsg(ErrorCode): #Assigning menu methods as values to dictionary keys codes = { 1: MainMenu, 2: CurrencyConverter, 3: TemperatureConverter, 4: MassConverter, 5: LengthConverter } #Extracting the method from dictionary using key, NOTE get() is dictionary function func = codes.get(ErrorCode) #Error message which will be displayed if the input is bad print("\nUnrecognized action! Try again.\n") return func() def ExitProgram(): print("\nExiting Program.") #CURRENCY def convertEuroDin(euros): try: course = 119.643 #Current euro course convert = float(euros) * course print("Euro to din conversion:",round(convert,3)) CurrencyConverter() except ValueError: errorMsg(2) def convertDinEuro(din): try: course = 119.643 convert = float(din) / course print("Dinar to euro conversion:",round(convert,3)) CurrencyConverter() except ValueError: errorMsg(2) #TEMPERATURE def convertC(f): try: celsius = (float(f)-32)*5/9 print(f,"Fahrenheits in Celsius is:",round(celsius,2)) TemperatureConverter() except ValueError: errorMsg(3) def convertF(c): try: fahrenheit = float(c) * 9/5 + 32 print(c,"Celsiuses in Fahrenheits is:",round(fahrenheit,2)) TemperatureConverter() except ValueError: errorMsg(3) #MASS def convertKg(lb): try: kg = float(lb) * 0.45359237 print(lb,"Pound is equal to",round(kg,2),"Kilograms.") MassConverter() except ValueError: errorMsg(4) def convertLb(kg): try: lb = float(kg) / 0.45359237 print(kg,"Kilogram is equal to",round(lb,2),"Pound.") MassConverter() except ValueError: errorMsg(4) #LENGTH def convertM(ft): #Convert ft to m try: meter=float(ft) * 0.3048 print(ft,"Feet is equal to",round(meter,2),"Meter.") LengthConverter() except ValueError: errorMsg(5) def convertFt(m): try: feet=float(m) / 0.3048 print(m,"Meter is equal to",round(feet,2),"Feet.") LengthConverter() except ValueError: errorMsg(5) def convertCm(inch): try: cm = float(inch) * 2.54 print(inch,"Inch is equal to",round(cm,2),"Centimeter.") LengthConverter() except ValueError: errorMsg(5) def convertInch(cm): try: inch=float(cm) / 2.54 print(cm,"Centimeter is equal to",round(inch,2),"Inch.") LengthConverter() except ValueError: errorMsg(5) def convertMi(km): try: miles = float(km) / 1.609344 print(km,"Kilometer in miles is:",int(miles)) LengthConverter() except ValueError: errorMsg(5) def convertKm(mi): try: kms = float(mi) * 1.609344 print(mi,"Mile in kilometers is:",int(kms)) LengthConverter() except ValueError: errorMsg(5) #Handling inputs as menu options for each section, following functions are menu itself def CurrencyConverter(): option=str.capitalize(input("\n1 - Convert Euros to Din\n2 - Convert Din to Euro\nM:Main Menu\nChoose option:")) if option == '1': euro=input("\nEnter ammount of euros:") convertEuroDin(euro) elif option == '2': dinar = input("\nEnter ammount of dinars:") convertDinEuro(dinar) elif option == 'M': MainMenu() else: errorMsg(2) def TemperatureConverter(): option = str.capitalize(input("\n1 - Convert Fahrenheits to Celsius\n2 - Convert Celsius to Fahrenheit\nM:Main Menu\nChoose option:")) if option == '1': f = input("\nEnter fahrenheits:") convertC(f) elif option == '2': c = input("\nEnter celsiuses:") convertF(c) elif option == 'M': MainMenu() else: errorMsg(3) def MassConverter(): option = str.capitalize(input("\n1 - Convert kg to lb\n2 - Convert lb to kg\nM:Main Menu\nChoose option:")) if option == '1': kg = input("\nEnter kilograms:") convertLb(kg) elif option == '2': lb = input("\nEnter pounds:") convertKg(lb) elif option == 'M': MainMenu() else: errorMsg(4) def LengthConverter(): option = str.capitalize(input("\n1 - Convert m to ft\n2 - Convert ft to m\n3 - Convert cm to inch\n4 - Convert inch to cm\n5 - Convert km to miles\n6 - Convert miles to km\nM:Main Menu\nChoose option:")) if option == '1': meter = input("\nEnter meters:") convertFt(meter) elif option == '2': feet = input("\nEnter feets:") convertM(feet) elif option == '3': cm = input("\nEnter centimeters:") convertInch(cm) elif option == '4': inch = input("\nEnter inches:") convertCm(inch) elif option == '5': km = input("\nEnter kilometers:") convertMi(km) elif option == '6': mile = input("\nEnter miles:") convertKm(mile) elif option == 'M': MainMenu() else: errorMsg(5) def MainMenu(): option = str.capitalize(input("\nAvailable programs:\n1:Currency Converter\n2:Temperature Converter\n3:Mass Converter\n4:Length Converter\nX:Exit Program\nChoose option:")) if option == '1': CurrencyConverter() elif option =='2': TemperatureConverter() elif option =='3': MassConverter() elif option =='4': LengthConverter() elif option == 'X': ExitProgram() else: errorMsg(1) #Main Program active = True while(active): #Main Menu which displays all available converions by sections MainMenu() active = False
def error_msg(ErrorCode): codes = {1: MainMenu, 2: CurrencyConverter, 3: TemperatureConverter, 4: MassConverter, 5: LengthConverter} func = codes.get(ErrorCode) print('\nUnrecognized action! Try again.\n') return func() def exit_program(): print('\nExiting Program.') def convert_euro_din(euros): try: course = 119.643 convert = float(euros) * course print('Euro to din conversion:', round(convert, 3)) currency_converter() except ValueError: error_msg(2) def convert_din_euro(din): try: course = 119.643 convert = float(din) / course print('Dinar to euro conversion:', round(convert, 3)) currency_converter() except ValueError: error_msg(2) def convert_c(f): try: celsius = (float(f) - 32) * 5 / 9 print(f, 'Fahrenheits in Celsius is:', round(celsius, 2)) temperature_converter() except ValueError: error_msg(3) def convert_f(c): try: fahrenheit = float(c) * 9 / 5 + 32 print(c, 'Celsiuses in Fahrenheits is:', round(fahrenheit, 2)) temperature_converter() except ValueError: error_msg(3) def convert_kg(lb): try: kg = float(lb) * 0.45359237 print(lb, 'Pound is equal to', round(kg, 2), 'Kilograms.') mass_converter() except ValueError: error_msg(4) def convert_lb(kg): try: lb = float(kg) / 0.45359237 print(kg, 'Kilogram is equal to', round(lb, 2), 'Pound.') mass_converter() except ValueError: error_msg(4) def convert_m(ft): try: meter = float(ft) * 0.3048 print(ft, 'Feet is equal to', round(meter, 2), 'Meter.') length_converter() except ValueError: error_msg(5) def convert_ft(m): try: feet = float(m) / 0.3048 print(m, 'Meter is equal to', round(feet, 2), 'Feet.') length_converter() except ValueError: error_msg(5) def convert_cm(inch): try: cm = float(inch) * 2.54 print(inch, 'Inch is equal to', round(cm, 2), 'Centimeter.') length_converter() except ValueError: error_msg(5) def convert_inch(cm): try: inch = float(cm) / 2.54 print(cm, 'Centimeter is equal to', round(inch, 2), 'Inch.') length_converter() except ValueError: error_msg(5) def convert_mi(km): try: miles = float(km) / 1.609344 print(km, 'Kilometer in miles is:', int(miles)) length_converter() except ValueError: error_msg(5) def convert_km(mi): try: kms = float(mi) * 1.609344 print(mi, 'Mile in kilometers is:', int(kms)) length_converter() except ValueError: error_msg(5) def currency_converter(): option = str.capitalize(input('\n1 - Convert Euros to Din\n2 - Convert Din to Euro\nM:Main Menu\nChoose option:')) if option == '1': euro = input('\nEnter ammount of euros:') convert_euro_din(euro) elif option == '2': dinar = input('\nEnter ammount of dinars:') convert_din_euro(dinar) elif option == 'M': main_menu() else: error_msg(2) def temperature_converter(): option = str.capitalize(input('\n1 - Convert Fahrenheits to Celsius\n2 - Convert Celsius to Fahrenheit\nM:Main Menu\nChoose option:')) if option == '1': f = input('\nEnter fahrenheits:') convert_c(f) elif option == '2': c = input('\nEnter celsiuses:') convert_f(c) elif option == 'M': main_menu() else: error_msg(3) def mass_converter(): option = str.capitalize(input('\n1 - Convert kg to lb\n2 - Convert lb to kg\nM:Main Menu\nChoose option:')) if option == '1': kg = input('\nEnter kilograms:') convert_lb(kg) elif option == '2': lb = input('\nEnter pounds:') convert_kg(lb) elif option == 'M': main_menu() else: error_msg(4) def length_converter(): option = str.capitalize(input('\n1 - Convert m to ft\n2 - Convert ft to m\n3 - Convert cm to inch\n4 - Convert inch to cm\n5 - Convert km to miles\n6 - Convert miles to km\nM:Main Menu\nChoose option:')) if option == '1': meter = input('\nEnter meters:') convert_ft(meter) elif option == '2': feet = input('\nEnter feets:') convert_m(feet) elif option == '3': cm = input('\nEnter centimeters:') convert_inch(cm) elif option == '4': inch = input('\nEnter inches:') convert_cm(inch) elif option == '5': km = input('\nEnter kilometers:') convert_mi(km) elif option == '6': mile = input('\nEnter miles:') convert_km(mile) elif option == 'M': main_menu() else: error_msg(5) def main_menu(): option = str.capitalize(input('\nAvailable programs:\n1:Currency Converter\n2:Temperature Converter\n3:Mass Converter\n4:Length Converter\nX:Exit Program\nChoose option:')) if option == '1': currency_converter() elif option == '2': temperature_converter() elif option == '3': mass_converter() elif option == '4': length_converter() elif option == 'X': exit_program() else: error_msg(1) active = True while active: main_menu() active = False
if __name__ == "__main__": Motifs = [ "TCGGGGGTTTTT", "CCGGTGACTTAC", "ACGGGGATTTTC", "TTGGGGACTTTT", "AAGGGGACTTCC", "TTGGGGACTTCC", "TCGGGGATTCAT", "TCGGGGATTCCT", "TAGGGGAACTAC", "TCGGGTATAACC", ]
if __name__ == '__main__': motifs = ['TCGGGGGTTTTT', 'CCGGTGACTTAC', 'ACGGGGATTTTC', 'TTGGGGACTTTT', 'AAGGGGACTTCC', 'TTGGGGACTTCC', 'TCGGGGATTCAT', 'TCGGGGATTCCT', 'TAGGGGAACTAC', 'TCGGGTATAACC']
fibs = {0: 0, 1: 1} def fib(n): if n in fibs: return fibs[n] if n % 2 == 0: fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2) return fibs[n] fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2) return fibs[n] # limit 100000
fibs = {0: 0, 1: 1} def fib(n): if n in fibs: return fibs[n] if n % 2 == 0: fibs[n] = (2 * fib(n / 2 - 1) + fib(n / 2)) * fib(n / 2) return fibs[n] fibs[n] = fib((n - 1) / 2) ** 2 + fib((n + 1) / 2) ** 2 return fibs[n]
t = int(input()) while t: X, Y = map(int, input().split()) while X>0 and Y>0 : if X>Y: if X%Y==0: X=Y break X = X%Y else: if Y%X==0: Y=X break Y = Y%X print(X+Y) t = t-1
t = int(input()) while t: (x, y) = map(int, input().split()) while X > 0 and Y > 0: if X > Y: if X % Y == 0: x = Y break x = X % Y else: if Y % X == 0: y = X break y = Y % X print(X + Y) t = t - 1
a = int(input()) b = int(input()) r = 0 if a < b: for x in range(a + 1, b): if x % 2 != 0: r += x elif a >= b: for x in range(a - 1, b, -1): if x % 2 != 0: r += x print(r)
a = int(input()) b = int(input()) r = 0 if a < b: for x in range(a + 1, b): if x % 2 != 0: r += x elif a >= b: for x in range(a - 1, b, -1): if x % 2 != 0: r += x print(r)
def regionQuery(self,P,eps): result = [] for d in self.dataSet: if (((d[0]-P[0])**2 + (d[1] - P[1])**2)**0.5)<=eps: result.append(d) return result def expandCluster(self,point,NeighbourPoints,C,eps,MinPts): C.addPoint(point) for p in NeighbourPoints: if p not in self.visited: self.visited.append(p) np = self.regionQuery(p,eps) if len(np) >= MinPts: for n in np: if n not in NeighbourPoints: NeighbourPoints.append(n) for c in self.Clusters: if not c.has(p): if not C.has(p): C.addPoint(p) if len(self.Clusters) == 0: if not C.has(p): C.addPoint(p) self.Clusters.append(C)
def region_query(self, P, eps): result = [] for d in self.dataSet: if ((d[0] - P[0]) ** 2 + (d[1] - P[1]) ** 2) ** 0.5 <= eps: result.append(d) return result def expand_cluster(self, point, NeighbourPoints, C, eps, MinPts): C.addPoint(point) for p in NeighbourPoints: if p not in self.visited: self.visited.append(p) np = self.regionQuery(p, eps) if len(np) >= MinPts: for n in np: if n not in NeighbourPoints: NeighbourPoints.append(n) for c in self.Clusters: if not c.has(p): if not C.has(p): C.addPoint(p) if len(self.Clusters) == 0: if not C.has(p): C.addPoint(p) self.Clusters.append(C)
def main(): n = int(input()) x = sorted(map(int, input().split())) q = int(input()) m = [int(input()) for _ in range(q)] for coin in m: l, r = -1, n while l + 1 < r: mid = (l + r) // 2 if x[mid] <= coin: l = mid else: r = mid print(l + 1) main()
def main(): n = int(input()) x = sorted(map(int, input().split())) q = int(input()) m = [int(input()) for _ in range(q)] for coin in m: (l, r) = (-1, n) while l + 1 < r: mid = (l + r) // 2 if x[mid] <= coin: l = mid else: r = mid print(l + 1) main()
with open("opcodes.txt") as f: code = tuple([int(x) for x in f.read().strip().split(',')]) def op1(code, a, b, c, pos): code[c] = a + b return pos+4 def op2(code, a, b, c, pos): code[c] = a * b return pos+4 def op3(code, a, pos): global sysID code[a] = sysID return pos+2 def op4(code, a, pos): global output output = a return pos+2 def op5(code, a, b, pos): return b if a != 0 else pos+3 def op6(code, a, b, pos): return b if a == 0 else pos+3 def op7(code, a, b, c, pos): code[c] = 1 if a < b else 0 return pos+4 def op8(code, a, b, c, pos): code[c] = 1 if a == b else 0 return pos+4 ops = [op1, op2, op3, op4, op5, op6, op7, op8] def run_code(code): pos = 0 while True: opcode = code[pos] % 100 a_mode = (code[pos] % 1000) // 100 b_mode = (code[pos] % 10000) // 1000 if opcode in [1,2,7,8]: a = code[code[pos+1]] if a_mode == 0 else code[pos+1] b = code[code[pos+2]] if b_mode == 0 else code[pos+2] c = code[pos+3] pos = ops[opcode-1](code, a, b, c, pos) elif opcode in [5, 6]: a = code[code[pos+1]] if a_mode == 0 else code[pos+1] b = code[code[pos+2]] if b_mode == 0 else code[pos+2] pos = ops[opcode-1](code, a, b, pos) elif opcode == 4: a = code[code[pos+1]] if a_mode == 0 else code[pos+1] pos = ops[3](code, a, pos) elif opcode == 3: pos = ops[2](code, code[pos+1], pos) else: if opcode != 99: print ("Unknown opcode:", opcode) break sysID = 1 output = None run_code(list(code)) print("Part 1:", output) sysID = 5 run_code(list(code)) print("Part 2:", output)
with open('opcodes.txt') as f: code = tuple([int(x) for x in f.read().strip().split(',')]) def op1(code, a, b, c, pos): code[c] = a + b return pos + 4 def op2(code, a, b, c, pos): code[c] = a * b return pos + 4 def op3(code, a, pos): global sysID code[a] = sysID return pos + 2 def op4(code, a, pos): global output output = a return pos + 2 def op5(code, a, b, pos): return b if a != 0 else pos + 3 def op6(code, a, b, pos): return b if a == 0 else pos + 3 def op7(code, a, b, c, pos): code[c] = 1 if a < b else 0 return pos + 4 def op8(code, a, b, c, pos): code[c] = 1 if a == b else 0 return pos + 4 ops = [op1, op2, op3, op4, op5, op6, op7, op8] def run_code(code): pos = 0 while True: opcode = code[pos] % 100 a_mode = code[pos] % 1000 // 100 b_mode = code[pos] % 10000 // 1000 if opcode in [1, 2, 7, 8]: a = code[code[pos + 1]] if a_mode == 0 else code[pos + 1] b = code[code[pos + 2]] if b_mode == 0 else code[pos + 2] c = code[pos + 3] pos = ops[opcode - 1](code, a, b, c, pos) elif opcode in [5, 6]: a = code[code[pos + 1]] if a_mode == 0 else code[pos + 1] b = code[code[pos + 2]] if b_mode == 0 else code[pos + 2] pos = ops[opcode - 1](code, a, b, pos) elif opcode == 4: a = code[code[pos + 1]] if a_mode == 0 else code[pos + 1] pos = ops[3](code, a, pos) elif opcode == 3: pos = ops[2](code, code[pos + 1], pos) else: if opcode != 99: print('Unknown opcode:', opcode) break sys_id = 1 output = None run_code(list(code)) print('Part 1:', output) sys_id = 5 run_code(list(code)) print('Part 2:', output)
# # PySNMP MIB module MSERIES-PORT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MSERIES-PORT-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:15:42 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") SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint") mseries, = mibBuilder.importSymbols("MSERIES-MIB", "mseries") PortMode, PortStatus, PortType = mibBuilder.importSymbols("MSERIES-TC", "PortMode", "PortStatus", "PortType") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") ModuleIdentity, NotificationType, MibIdentifier, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Bits, Counter64, ObjectIdentity, Unsigned32, iso, TimeTicks, Gauge32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "NotificationType", "MibIdentifier", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Bits", "Counter64", "ObjectIdentity", "Unsigned32", "iso", "TimeTicks", "Gauge32", "Counter32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") smartPort = ModuleIdentity((1, 3, 6, 1, 4, 1, 30826, 1, 3)) smartPort.setRevisions(('2014-02-12 13:44',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: smartPort.setRevisionsDescriptions(('The initial revision of the MSERIES Port MIB.',)) if mibBuilder.loadTexts: smartPort.setLastUpdated('201402121344Z') if mibBuilder.loadTexts: smartPort.setOrganization('SmartOptics') if mibBuilder.loadTexts: smartPort.setContactInfo('http://www.smartoptics.com') if mibBuilder.loadTexts: smartPort.setDescription('This is the enterprise specific Port MIB for SmartOptics M-Series.') smartPortObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1)) smartPortGeneral = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 1)) smartPortList = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2)) smartPortMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2)) smartPortGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 1)) smartPortCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 2)) smartPortTable = MibTable((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1), ) if mibBuilder.loadTexts: smartPortTable.setStatus('current') if mibBuilder.loadTexts: smartPortTable.setDescription('A port table.') smartPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1), ).setIndexNames((0, "MSERIES-PORT-MIB", "smartPortIndex")) if mibBuilder.loadTexts: smartPortEntry.setStatus('current') if mibBuilder.loadTexts: smartPortEntry.setDescription('An entry in the port list.') smartPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortIndex.setStatus('current') if mibBuilder.loadTexts: smartPortIndex.setDescription('A unique index for each port that corresponds to the index in the interface table') smartPortName = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortName.setStatus('current') if mibBuilder.loadTexts: smartPortName.setDescription('The name of the port.') smartPortAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smartPortAlias.setStatus('current') if mibBuilder.loadTexts: smartPortAlias.setDescription('User configurable Port Alias for the port. Not writeable in SmartOS v2.3') smartPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 4), PortType()).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortType.setStatus('current') if mibBuilder.loadTexts: smartPortType.setDescription('The type of port. rx(1) - Receiving port. tx(2) - Transmitting port. biDi(3) - Bidirectional port.') smartPortPower = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortPower.setStatus('current') if mibBuilder.loadTexts: smartPortPower.setDescription('The power level in units of 0.1 dBm.') smartPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 6), PortStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortStatus.setStatus('current') if mibBuilder.loadTexts: smartPortStatus.setDescription('The operational state for a port. idle(1) - The port is not activated down(2) - The port traffic is lost. up(3) - There is traffic on the port. high(4) - The port got to high power. low(5) - The port got to low power. eyeSafety(6) - The Line Tx port is in Eye Safety Mode. This means that either the connector on the Line Tx port is not inserted or that you have too strong reflection from the line fiber. cd(7) - Channel detected. ncd(8) - No channel detected.') smartPortMode = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 7), PortMode()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smartPortMode.setStatus('current') if mibBuilder.loadTexts: smartPortMode.setDescription("The Mode of the Port. normal (1) - The port is active. No alarms are beeing suppressed. service (2) . The port is in service mode and alarms are beeing suppressed. When service is ready smartPortMode should be set to 'normal' again. Not writeable in SmartOS v2.3") smartPortHighPowerAlarmThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smartPortHighPowerAlarmThreshold.setStatus('current') if mibBuilder.loadTexts: smartPortHighPowerAlarmThreshold.setDescription('The threshold for the High Power alarm. Not writeable in SmartOS v2.3') smartPortLowPowerAlarmThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 9), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smartPortLowPowerAlarmThreshold.setStatus('current') if mibBuilder.loadTexts: smartPortLowPowerAlarmThreshold.setDescription('The threshold for the Low Power alarm. Not writeable in SmartOS v2.3') smartPortListGroupV1 = ObjectGroup((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 1, 1)).setObjects(("MSERIES-PORT-MIB", "smartPortIndex"), ("MSERIES-PORT-MIB", "smartPortName"), ("MSERIES-PORT-MIB", "smartPortAlias"), ("MSERIES-PORT-MIB", "smartPortType"), ("MSERIES-PORT-MIB", "smartPortPower"), ("MSERIES-PORT-MIB", "smartPortStatus"), ("MSERIES-PORT-MIB", "smartPortMode"), ("MSERIES-PORT-MIB", "smartPortHighPowerAlarmThreshold"), ("MSERIES-PORT-MIB", "smartPortLowPowerAlarmThreshold")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): smartPortListGroupV1 = smartPortListGroupV1.setStatus('current') if mibBuilder.loadTexts: smartPortListGroupV1.setDescription('The Port List MIB objects v1.') smartPortBasicComplV1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 2, 1)).setObjects(("MSERIES-PORT-MIB", "smartPortListGroupV1")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): smartPortBasicComplV1 = smartPortBasicComplV1.setStatus('current') if mibBuilder.loadTexts: smartPortBasicComplV1.setDescription('Basic implementation requirements for the port MIB V1.') mibBuilder.exportSymbols("MSERIES-PORT-MIB", smartPortCompliances=smartPortCompliances, smartPortPower=smartPortPower, smartPortHighPowerAlarmThreshold=smartPortHighPowerAlarmThreshold, smartPortTable=smartPortTable, PYSNMP_MODULE_ID=smartPort, smartPortBasicComplV1=smartPortBasicComplV1, smartPortGeneral=smartPortGeneral, smartPortType=smartPortType, smartPortName=smartPortName, smartPortGroups=smartPortGroups, smartPortIndex=smartPortIndex, smartPort=smartPort, smartPortAlias=smartPortAlias, smartPortStatus=smartPortStatus, smartPortList=smartPortList, smartPortMode=smartPortMode, smartPortLowPowerAlarmThreshold=smartPortLowPowerAlarmThreshold, smartPortEntry=smartPortEntry, smartPortMIBConformance=smartPortMIBConformance, smartPortListGroupV1=smartPortListGroupV1, smartPortObjects=smartPortObjects)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint') (mseries,) = mibBuilder.importSymbols('MSERIES-MIB', 'mseries') (port_mode, port_status, port_type) = mibBuilder.importSymbols('MSERIES-TC', 'PortMode', 'PortStatus', 'PortType') (module_compliance, object_group, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'ObjectGroup', 'NotificationGroup') (module_identity, notification_type, mib_identifier, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, ip_address, bits, counter64, object_identity, unsigned32, iso, time_ticks, gauge32, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'NotificationType', 'MibIdentifier', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'IpAddress', 'Bits', 'Counter64', 'ObjectIdentity', 'Unsigned32', 'iso', 'TimeTicks', 'Gauge32', 'Counter32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') smart_port = module_identity((1, 3, 6, 1, 4, 1, 30826, 1, 3)) smartPort.setRevisions(('2014-02-12 13:44',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: smartPort.setRevisionsDescriptions(('The initial revision of the MSERIES Port MIB.',)) if mibBuilder.loadTexts: smartPort.setLastUpdated('201402121344Z') if mibBuilder.loadTexts: smartPort.setOrganization('SmartOptics') if mibBuilder.loadTexts: smartPort.setContactInfo('http://www.smartoptics.com') if mibBuilder.loadTexts: smartPort.setDescription('This is the enterprise specific Port MIB for SmartOptics M-Series.') smart_port_objects = mib_identifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1)) smart_port_general = mib_identifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 1)) smart_port_list = mib_identifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2)) smart_port_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2)) smart_port_groups = mib_identifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 1)) smart_port_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 2)) smart_port_table = mib_table((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1)) if mibBuilder.loadTexts: smartPortTable.setStatus('current') if mibBuilder.loadTexts: smartPortTable.setDescription('A port table.') smart_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1)).setIndexNames((0, 'MSERIES-PORT-MIB', 'smartPortIndex')) if mibBuilder.loadTexts: smartPortEntry.setStatus('current') if mibBuilder.loadTexts: smartPortEntry.setDescription('An entry in the port list.') smart_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: smartPortIndex.setStatus('current') if mibBuilder.loadTexts: smartPortIndex.setDescription('A unique index for each port that corresponds to the index in the interface table') smart_port_name = mib_table_column((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: smartPortName.setStatus('current') if mibBuilder.loadTexts: smartPortName.setDescription('The name of the port.') smart_port_alias = mib_table_column((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 3), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: smartPortAlias.setStatus('current') if mibBuilder.loadTexts: smartPortAlias.setDescription('User configurable Port Alias for the port. Not writeable in SmartOS v2.3') smart_port_type = mib_table_column((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 4), port_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: smartPortType.setStatus('current') if mibBuilder.loadTexts: smartPortType.setDescription('The type of port. rx(1) - Receiving port. tx(2) - Transmitting port. biDi(3) - Bidirectional port.') smart_port_power = mib_table_column((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: smartPortPower.setStatus('current') if mibBuilder.loadTexts: smartPortPower.setDescription('The power level in units of 0.1 dBm.') smart_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 6), port_status()).setMaxAccess('readonly') if mibBuilder.loadTexts: smartPortStatus.setStatus('current') if mibBuilder.loadTexts: smartPortStatus.setDescription('The operational state for a port. idle(1) - The port is not activated down(2) - The port traffic is lost. up(3) - There is traffic on the port. high(4) - The port got to high power. low(5) - The port got to low power. eyeSafety(6) - The Line Tx port is in Eye Safety Mode. This means that either the connector on the Line Tx port is not inserted or that you have too strong reflection from the line fiber. cd(7) - Channel detected. ncd(8) - No channel detected.') smart_port_mode = mib_table_column((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 7), port_mode()).setMaxAccess('readwrite') if mibBuilder.loadTexts: smartPortMode.setStatus('current') if mibBuilder.loadTexts: smartPortMode.setDescription("The Mode of the Port. normal (1) - The port is active. No alarms are beeing suppressed. service (2) . The port is in service mode and alarms are beeing suppressed. When service is ready smartPortMode should be set to 'normal' again. Not writeable in SmartOS v2.3") smart_port_high_power_alarm_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 8), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: smartPortHighPowerAlarmThreshold.setStatus('current') if mibBuilder.loadTexts: smartPortHighPowerAlarmThreshold.setDescription('The threshold for the High Power alarm. Not writeable in SmartOS v2.3') smart_port_low_power_alarm_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 9), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: smartPortLowPowerAlarmThreshold.setStatus('current') if mibBuilder.loadTexts: smartPortLowPowerAlarmThreshold.setDescription('The threshold for the Low Power alarm. Not writeable in SmartOS v2.3') smart_port_list_group_v1 = object_group((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 1, 1)).setObjects(('MSERIES-PORT-MIB', 'smartPortIndex'), ('MSERIES-PORT-MIB', 'smartPortName'), ('MSERIES-PORT-MIB', 'smartPortAlias'), ('MSERIES-PORT-MIB', 'smartPortType'), ('MSERIES-PORT-MIB', 'smartPortPower'), ('MSERIES-PORT-MIB', 'smartPortStatus'), ('MSERIES-PORT-MIB', 'smartPortMode'), ('MSERIES-PORT-MIB', 'smartPortHighPowerAlarmThreshold'), ('MSERIES-PORT-MIB', 'smartPortLowPowerAlarmThreshold')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): smart_port_list_group_v1 = smartPortListGroupV1.setStatus('current') if mibBuilder.loadTexts: smartPortListGroupV1.setDescription('The Port List MIB objects v1.') smart_port_basic_compl_v1 = module_compliance((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 2, 1)).setObjects(('MSERIES-PORT-MIB', 'smartPortListGroupV1')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): smart_port_basic_compl_v1 = smartPortBasicComplV1.setStatus('current') if mibBuilder.loadTexts: smartPortBasicComplV1.setDescription('Basic implementation requirements for the port MIB V1.') mibBuilder.exportSymbols('MSERIES-PORT-MIB', smartPortCompliances=smartPortCompliances, smartPortPower=smartPortPower, smartPortHighPowerAlarmThreshold=smartPortHighPowerAlarmThreshold, smartPortTable=smartPortTable, PYSNMP_MODULE_ID=smartPort, smartPortBasicComplV1=smartPortBasicComplV1, smartPortGeneral=smartPortGeneral, smartPortType=smartPortType, smartPortName=smartPortName, smartPortGroups=smartPortGroups, smartPortIndex=smartPortIndex, smartPort=smartPort, smartPortAlias=smartPortAlias, smartPortStatus=smartPortStatus, smartPortList=smartPortList, smartPortMode=smartPortMode, smartPortLowPowerAlarmThreshold=smartPortLowPowerAlarmThreshold, smartPortEntry=smartPortEntry, smartPortMIBConformance=smartPortMIBConformance, smartPortListGroupV1=smartPortListGroupV1, smartPortObjects=smartPortObjects)
# # Pelican_manager # __title__ = 'pelican_manager' __description__ = 'easy way to management pelican blog.' __url__ = 'https://github.com/xiaojieluo/pelican-manager' __version__ = '0.2.1' __build__ = 0x021801 __author__ = 'Xiaojie Luo' __author_email__ = 'xiaojieluoff@gmail.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2017 Xiaojie Luo' __cake__ = u'\u2728 \U0001f370 \u2728'
__title__ = 'pelican_manager' __description__ = 'easy way to management pelican blog.' __url__ = 'https://github.com/xiaojieluo/pelican-manager' __version__ = '0.2.1' __build__ = 137217 __author__ = 'Xiaojie Luo' __author_email__ = 'xiaojieluoff@gmail.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2017 Xiaojie Luo' __cake__ = u'✨ 🍰 ✨'
# my_script.py # enlarge function def enlarge(n): return n * 100
def enlarge(n): return n * 100
DEFINE = 'define' BEGIN = 'begin' SET = 'set!' LAMBDA = 'lambda' LET = 'let' LET_STAR = 'let*' LET_REC = 'letrec' OPEN_PARANT = '(' CLOSE_PARANT = ')' ADD = '+' SUB = '-' MULT = '*' DIV = '/' DOT = '.' QUOTE = 'quote' QUASIQUOTE = 'quasiquote' UNQUOTE = 'unquote' UNQUOTE_SPLICING = 'unquote-splicing' APPLY = 'apply' IF = 'if' COND = 'cond' DELAY = 'delay' FORCE = 'force' DEFAULT = 'default' SLEEP = 'sleep' RANDOM = 'random'
define = 'define' begin = 'begin' set = 'set!' lambda = 'lambda' let = 'let' let_star = 'let*' let_rec = 'letrec' open_parant = '(' close_parant = ')' add = '+' sub = '-' mult = '*' div = '/' dot = '.' quote = 'quote' quasiquote = 'quasiquote' unquote = 'unquote' unquote_splicing = 'unquote-splicing' apply = 'apply' if = 'if' cond = 'cond' delay = 'delay' force = 'force' default = 'default' sleep = 'sleep' random = 'random'
################################### # File Name : compare_identity_analysis.py ################################### #!/usr/bin/python3 def main(): print ("=== compare identity ===") print (999 is 999) x = 999; y = 999; print (x is y) z = 999; print (x is z) print (id(x)) print (id(y)) print (id(z)) if __name__ == "__main__": main()
def main(): print('=== compare identity ===') print(999 is 999) x = 999 y = 999 print(x is y) z = 999 print(x is z) print(id(x)) print(id(y)) print(id(z)) if __name__ == '__main__': main()
# # PySNMP MIB module FASTPATH-PFC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-PFC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:12:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection") fastPath, = mibBuilder.importSymbols("BROADCOM-REF-MIB", "fastPath") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Bits, NotificationType, ModuleIdentity, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, TimeTicks, iso, Counter64, Gauge32, Integer32, Unsigned32, IpAddress, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "NotificationType", "ModuleIdentity", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "TimeTicks", "iso", "Counter64", "Gauge32", "Integer32", "Unsigned32", "IpAddress", "Counter32") RowStatus, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TextualConvention") fastPathPFC = ModuleIdentity((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47)) if mibBuilder.loadTexts: fastPathPFC.setLastUpdated('200905220000Z') if mibBuilder.loadTexts: fastPathPFC.setOrganization('Broadcom Corporation') if mibBuilder.loadTexts: fastPathPFC.setContactInfo(' Customer Support Postal: Broadcom Corporation 100 Perimeter Park Drive Suite H Morrisville, NC 27560 Tel: +1 919 865 2700') if mibBuilder.loadTexts: fastPathPFC.setDescription('The MIB definitions Priority based Flow Control Feature.') agentPfcCfgGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1)) agentPfcTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1), ) if mibBuilder.loadTexts: agentPfcTable.setStatus('current') if mibBuilder.loadTexts: agentPfcTable.setDescription('A table providing configuration of PFC Profile per interface.') agentPfcEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1), ).setIndexNames((0, "FASTPATH-PFC-MIB", "agentPfcIntfIndex")) if mibBuilder.loadTexts: agentPfcEntry.setStatus('current') if mibBuilder.loadTexts: agentPfcEntry.setDescription('PFC Profile configuration for a port.') agentPfcIntfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: agentPfcIntfIndex.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfIndex.setDescription('This is a unique index for an entry in the agentPfcTable. A non-zero value indicates the ifIndex for the corresponding interface entry in the ifTable.') agentPfcIntfAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentPfcIntfAdminMode.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfAdminMode.setDescription('Enables/disables PFC profile on an interface.') agentPfcIntfPfcStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2))).clone(2)).setMaxAccess("readonly") if mibBuilder.loadTexts: agentPfcIntfPfcStatus.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfPfcStatus.setDescription('Shows the operational-status of PFC on an interface.') agentPfcTotalIntfPfcFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesRx.setStatus('current') if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesRx.setDescription('Total Received PFC Frames on this interface.') agentPfcTotalIntfPfcFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 5), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesTx.setStatus('current') if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesTx.setDescription('Total Transmitted PFC Frames on this interface.') agentPfcActionTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2), ) if mibBuilder.loadTexts: agentPfcActionTable.setStatus('current') if mibBuilder.loadTexts: agentPfcActionTable.setDescription('A table providing priority and action mappings configuration of PFC.') agentPfcActionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1), ).setIndexNames((0, "FASTPATH-PFC-MIB", "agentPfcIntfIndex"), (0, "FASTPATH-PFC-MIB", "agentPfcPriority")) if mibBuilder.loadTexts: agentPfcActionEntry.setStatus('current') if mibBuilder.loadTexts: agentPfcActionEntry.setDescription('PFC Action Profile configuration for a port.') agentPfcPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))) if mibBuilder.loadTexts: agentPfcPriority.setStatus('current') if mibBuilder.loadTexts: agentPfcPriority.setDescription('This is a unique index for an entry in the agentPfcActionTable. A non-zero value indicates the CosQueue Priority.') agentPfcAction = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("drop", 1), ("nodrop", 2))).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentPfcAction.setStatus('current') if mibBuilder.loadTexts: agentPfcAction.setDescription('Set Drop/No-Drop action in PFC profile for the corresponding priority.') agentPfcIntfStatsPerPriorityTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3), ) if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityTable.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityTable.setDescription('A table providing statistics of PFC per interface per priority.') agentPfcIntfStatsPerPriorityEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1), ).setIndexNames((0, "FASTPATH-PFC-MIB", "agentPfcIntfIndex"), (0, "FASTPATH-PFC-MIB", "agentPfcPriority")) if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityEntry.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityEntry.setDescription('PFC Stats for a priority and for a port.') agentPfcIntfPfcPriorityFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentPfcIntfPfcPriorityFramesRx.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfPfcPriorityFramesRx.setDescription('Received PFC Frames on this interface for a priority.') mibBuilder.exportSymbols("FASTPATH-PFC-MIB", agentPfcCfgGroup=agentPfcCfgGroup, agentPfcPriority=agentPfcPriority, agentPfcTotalIntfPfcFramesTx=agentPfcTotalIntfPfcFramesTx, agentPfcIntfIndex=agentPfcIntfIndex, agentPfcIntfStatsPerPriorityTable=agentPfcIntfStatsPerPriorityTable, agentPfcActionTable=agentPfcActionTable, agentPfcTable=agentPfcTable, agentPfcIntfStatsPerPriorityEntry=agentPfcIntfStatsPerPriorityEntry, PYSNMP_MODULE_ID=fastPathPFC, agentPfcIntfAdminMode=agentPfcIntfAdminMode, agentPfcAction=agentPfcAction, fastPathPFC=fastPathPFC, agentPfcTotalIntfPfcFramesRx=agentPfcTotalIntfPfcFramesRx, agentPfcIntfPfcPriorityFramesRx=agentPfcIntfPfcPriorityFramesRx, agentPfcEntry=agentPfcEntry, agentPfcIntfPfcStatus=agentPfcIntfPfcStatus, agentPfcActionEntry=agentPfcActionEntry)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection') (fast_path,) = mibBuilder.importSymbols('BROADCOM-REF-MIB', 'fastPath') (interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (bits, notification_type, module_identity, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, time_ticks, iso, counter64, gauge32, integer32, unsigned32, ip_address, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'NotificationType', 'ModuleIdentity', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'TimeTicks', 'iso', 'Counter64', 'Gauge32', 'Integer32', 'Unsigned32', 'IpAddress', 'Counter32') (row_status, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'DisplayString', 'TextualConvention') fast_path_pfc = module_identity((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47)) if mibBuilder.loadTexts: fastPathPFC.setLastUpdated('200905220000Z') if mibBuilder.loadTexts: fastPathPFC.setOrganization('Broadcom Corporation') if mibBuilder.loadTexts: fastPathPFC.setContactInfo(' Customer Support Postal: Broadcom Corporation 100 Perimeter Park Drive Suite H Morrisville, NC 27560 Tel: +1 919 865 2700') if mibBuilder.loadTexts: fastPathPFC.setDescription('The MIB definitions Priority based Flow Control Feature.') agent_pfc_cfg_group = mib_identifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1)) agent_pfc_table = mib_table((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1)) if mibBuilder.loadTexts: agentPfcTable.setStatus('current') if mibBuilder.loadTexts: agentPfcTable.setDescription('A table providing configuration of PFC Profile per interface.') agent_pfc_entry = mib_table_row((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1)).setIndexNames((0, 'FASTPATH-PFC-MIB', 'agentPfcIntfIndex')) if mibBuilder.loadTexts: agentPfcEntry.setStatus('current') if mibBuilder.loadTexts: agentPfcEntry.setDescription('PFC Profile configuration for a port.') agent_pfc_intf_index = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 1), interface_index()) if mibBuilder.loadTexts: agentPfcIntfIndex.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfIndex.setDescription('This is a unique index for an entry in the agentPfcTable. A non-zero value indicates the ifIndex for the corresponding interface entry in the ifTable.') agent_pfc_intf_admin_mode = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone(2)).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentPfcIntfAdminMode.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfAdminMode.setDescription('Enables/disables PFC profile on an interface.') agent_pfc_intf_pfc_status = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('inactive', 2))).clone(2)).setMaxAccess('readonly') if mibBuilder.loadTexts: agentPfcIntfPfcStatus.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfPfcStatus.setDescription('Shows the operational-status of PFC on an interface.') agent_pfc_total_intf_pfc_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 4), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesRx.setStatus('current') if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesRx.setDescription('Total Received PFC Frames on this interface.') agent_pfc_total_intf_pfc_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 5), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesTx.setStatus('current') if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesTx.setDescription('Total Transmitted PFC Frames on this interface.') agent_pfc_action_table = mib_table((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2)) if mibBuilder.loadTexts: agentPfcActionTable.setStatus('current') if mibBuilder.loadTexts: agentPfcActionTable.setDescription('A table providing priority and action mappings configuration of PFC.') agent_pfc_action_entry = mib_table_row((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1)).setIndexNames((0, 'FASTPATH-PFC-MIB', 'agentPfcIntfIndex'), (0, 'FASTPATH-PFC-MIB', 'agentPfcPriority')) if mibBuilder.loadTexts: agentPfcActionEntry.setStatus('current') if mibBuilder.loadTexts: agentPfcActionEntry.setDescription('PFC Action Profile configuration for a port.') agent_pfc_priority = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 7))) if mibBuilder.loadTexts: agentPfcPriority.setStatus('current') if mibBuilder.loadTexts: agentPfcPriority.setDescription('This is a unique index for an entry in the agentPfcActionTable. A non-zero value indicates the CosQueue Priority.') agent_pfc_action = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('drop', 1), ('nodrop', 2))).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentPfcAction.setStatus('current') if mibBuilder.loadTexts: agentPfcAction.setDescription('Set Drop/No-Drop action in PFC profile for the corresponding priority.') agent_pfc_intf_stats_per_priority_table = mib_table((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3)) if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityTable.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityTable.setDescription('A table providing statistics of PFC per interface per priority.') agent_pfc_intf_stats_per_priority_entry = mib_table_row((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1)).setIndexNames((0, 'FASTPATH-PFC-MIB', 'agentPfcIntfIndex'), (0, 'FASTPATH-PFC-MIB', 'agentPfcPriority')) if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityEntry.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityEntry.setDescription('PFC Stats for a priority and for a port.') agent_pfc_intf_pfc_priority_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1, 1), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentPfcIntfPfcPriorityFramesRx.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfPfcPriorityFramesRx.setDescription('Received PFC Frames on this interface for a priority.') mibBuilder.exportSymbols('FASTPATH-PFC-MIB', agentPfcCfgGroup=agentPfcCfgGroup, agentPfcPriority=agentPfcPriority, agentPfcTotalIntfPfcFramesTx=agentPfcTotalIntfPfcFramesTx, agentPfcIntfIndex=agentPfcIntfIndex, agentPfcIntfStatsPerPriorityTable=agentPfcIntfStatsPerPriorityTable, agentPfcActionTable=agentPfcActionTable, agentPfcTable=agentPfcTable, agentPfcIntfStatsPerPriorityEntry=agentPfcIntfStatsPerPriorityEntry, PYSNMP_MODULE_ID=fastPathPFC, agentPfcIntfAdminMode=agentPfcIntfAdminMode, agentPfcAction=agentPfcAction, fastPathPFC=fastPathPFC, agentPfcTotalIntfPfcFramesRx=agentPfcTotalIntfPfcFramesRx, agentPfcIntfPfcPriorityFramesRx=agentPfcIntfPfcPriorityFramesRx, agentPfcEntry=agentPfcEntry, agentPfcIntfPfcStatus=agentPfcIntfPfcStatus, agentPfcActionEntry=agentPfcActionEntry)
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class X86SystemVParameterManager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): # NOTE: Only works if it is call before the stack frame is made. esp = self.__emulator.registers['esp'] return self.__emulator.read_memory(esp + 4 * index + 0x4, 4) def __setitem__(self, index, value): # NOTE: Only works if it is call before the stack frame is made. esp = self.__emulator.registers['esp'] return self.__emulator.write_memory(esp + 4 * index + 0x4, 4, value) class X86SystemV(object): def __init__(self, emulator): self.__emulator = emulator self.__parameters = X86SystemVParameterManager(emulator) @property def parameters(self): return self.__parameters @property def return_value(self): return self.__emulator.registers['eax'] @return_value.setter def return_value(self, value): self.__emulator.registers['eax'] = value class X86_64SystemVParameterManager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): if index == 0: return self.__emulator.registers['rdi'] elif index == 1: return self.__emulator.registers['rsi'] elif index == 2: return self.__emulator.registers['rdx'] elif index == 3: return self.__emulator.registers['rcx'] elif index == 4: return self.__emulator.registers['r8'] elif index == 5: return self.__emulator.registers['r9'] else: raise NotImplementedError() def __setitem__(self, index, value): if index == 0: self.__emulator.registers['rdi'] = value elif index == 1: self.__emulator.registers['rsi'] = value elif index == 2: self.__emulator.registers['rdx'] = value elif index == 3: self.__emulator.registers['rcx'] = value elif index == 4: self.__emulator.registers['r8'] = value elif index == 5: self.__emulator.registers['r9'] = value else: raise NotImplementedError() class X86_64SystemV(object): def __init__(self, emulator): self.__emulator = emulator self.__parameters = X86_64SystemVParameterManager(emulator) @property def parameters(self): return self.__parameters @property def return_value(self): return self.__emulator.registers['rax'] @return_value.setter def return_value(self, value): self.__emulator.registers['rax'] = value class ArmSystemVParameterManager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): if index == 0: return self.__emulator.registers['r0'] elif index == 1: return self.__emulator.registers['r1'] elif index == 2: return self.__emulator.registers['r2'] elif index == 3: return self.__emulator.registers['r3'] else: raise NotImplementedError() def __setitem__(self, index, value): if index == 0: self.__emulator.registers['r0'] = value elif index == 1: self.__emulator.registers['r1'] = value elif index == 2: self.__emulator.registers['r2'] = value elif index == 3: self.__emulator.registers['r3'] = value else: raise NotImplementedError() class ArmSystemV(object): def __init__(self, emulator): self.__emulator = emulator self.__parameters = ArmSystemVParameterManager(emulator) @property def parameters(self): return self.__parameters @property def return_value(self): return self.__emulator.registers['r0'] @return_value.setter def return_value(self, value): self.__emulator.registers['r0'] = value
class X86Systemvparametermanager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): esp = self.__emulator.registers['esp'] return self.__emulator.read_memory(esp + 4 * index + 4, 4) def __setitem__(self, index, value): esp = self.__emulator.registers['esp'] return self.__emulator.write_memory(esp + 4 * index + 4, 4, value) class X86Systemv(object): def __init__(self, emulator): self.__emulator = emulator self.__parameters = x86_system_v_parameter_manager(emulator) @property def parameters(self): return self.__parameters @property def return_value(self): return self.__emulator.registers['eax'] @return_value.setter def return_value(self, value): self.__emulator.registers['eax'] = value class X86_64Systemvparametermanager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): if index == 0: return self.__emulator.registers['rdi'] elif index == 1: return self.__emulator.registers['rsi'] elif index == 2: return self.__emulator.registers['rdx'] elif index == 3: return self.__emulator.registers['rcx'] elif index == 4: return self.__emulator.registers['r8'] elif index == 5: return self.__emulator.registers['r9'] else: raise not_implemented_error() def __setitem__(self, index, value): if index == 0: self.__emulator.registers['rdi'] = value elif index == 1: self.__emulator.registers['rsi'] = value elif index == 2: self.__emulator.registers['rdx'] = value elif index == 3: self.__emulator.registers['rcx'] = value elif index == 4: self.__emulator.registers['r8'] = value elif index == 5: self.__emulator.registers['r9'] = value else: raise not_implemented_error() class X86_64Systemv(object): def __init__(self, emulator): self.__emulator = emulator self.__parameters = x86_64_system_v_parameter_manager(emulator) @property def parameters(self): return self.__parameters @property def return_value(self): return self.__emulator.registers['rax'] @return_value.setter def return_value(self, value): self.__emulator.registers['rax'] = value class Armsystemvparametermanager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): if index == 0: return self.__emulator.registers['r0'] elif index == 1: return self.__emulator.registers['r1'] elif index == 2: return self.__emulator.registers['r2'] elif index == 3: return self.__emulator.registers['r3'] else: raise not_implemented_error() def __setitem__(self, index, value): if index == 0: self.__emulator.registers['r0'] = value elif index == 1: self.__emulator.registers['r1'] = value elif index == 2: self.__emulator.registers['r2'] = value elif index == 3: self.__emulator.registers['r3'] = value else: raise not_implemented_error() class Armsystemv(object): def __init__(self, emulator): self.__emulator = emulator self.__parameters = arm_system_v_parameter_manager(emulator) @property def parameters(self): return self.__parameters @property def return_value(self): return self.__emulator.registers['r0'] @return_value.setter def return_value(self, value): self.__emulator.registers['r0'] = value
def resolve(): ''' code here ''' num_S, num_c = [int(item) for item in input().split()] delta = num_c - num_S *2 scc = 0 if num_S != 0: if num_c // 2 <= num_S : scc = num_c//2 else: scc = num_S scc += delta//4 else: scc = num_c//4 print(scc) if __name__ == "__main__": resolve()
def resolve(): """ code here """ (num_s, num_c) = [int(item) for item in input().split()] delta = num_c - num_S * 2 scc = 0 if num_S != 0: if num_c // 2 <= num_S: scc = num_c // 2 else: scc = num_S scc += delta // 4 else: scc = num_c // 4 print(scc) if __name__ == '__main__': resolve()
class Template(object): def __init__(self, usages, snippets, blocks): self.usages = usages self.snippets = snippets self.blocks = blocks def accept(self, visitor): visitor.visit_template(self) class Text(object): def __init__(self, text_token): self._token = text_token def get_token(self): return self._token token = property(get_token) def _get_content(self): return self._token.lexeme content = property(_get_content) def accept(self, visitor): visitor.visit_text(self) class CondBlock(object): def __init__(self, branches): self.branches = branches def accept(self, visitor): visitor.visit_cond(self) class ForBlock(object): def __init__(self, item_ident, list_expr, blocks, filter_cond=None): self.item_ident = item_ident self.list_expr = list_expr self.blocks = blocks self.filter_cond = filter_cond def accept(self, visitor): visitor.visit_for(self) class Snippet(object): def __init__(self, snippet_name, params, blocks): self.name = snippet_name self.params = params self.blocks = blocks def accept(self, visitor): visitor.visit_snippet(self) class SnippetCall(object): def __init__(self, snippet_name, args): self.name = snippet_name self.args = args def accept(self, visitor): visitor.visit_snippet_call(self) class Call(object): def __init__(self, callee, args): self.callee = callee self.args = args def accept(self, visitor): visitor.visit_call(self) class Use(object): def __init__(self, template_name, names): self.template_name = template_name self.names = names # names and aliases def accept(self, visitor): visitor.visit_use(self) class SingleToken(object): def __init__(self, token): self.token = token def accept(self, visitor): visitor.visit_expr(self) class Identifier(SingleToken): def __init__(self, identifier_token): SingleToken.__init__(self, identifier_token) def get_name(self): return self.token.lexeme class SimpleValue(SingleToken): def __init__(self, token): SingleToken.__init__(self, token) def get_value(self): raise Exception("Not implemented") class Bool(SimpleValue): def __init__(self, bool_token): SimpleValue.__init__(self, bool_token) def get_value(self): s = self.token.lexeme return s == "true" or s == "else" class String(SimpleValue): def __init__(self, str_token): SimpleValue.__init__(self, str_token) def get_value(self): return self.token.lexeme def get_string(self): return self.token.lexeme[1:-1].replace("\\'", "'") class Int(SimpleValue): def __init__(self, int_token): SimpleValue.__init__(self, int_token) def get_value(self): return int(self.token.lexeme) class Real(SimpleValue): def __init__(self, real_token): SimpleValue.__init__(self, real_token) def get_value(self): return float(self.token.lexeme) class QualifiedName(object): def __init__(self, identifier_tokens): self.identifier_tokens = identifier_tokens def accept(self, visitor): visitor.visit_expr(self) def get_name(self): return str(self) def __str__(self): return ".".join(list(map(lambda ident: ident.lexeme, self.identifier_tokens))) class LogicalBinExpr(object): def __init__(self, op, left, right): self.op = op self.left = left self.right = right def accept(self, visitor): visitor.visit_logical_bin(self) class LogicalRelation(object): def __init__(self, op, left, right): self.op = op self.left = left self.right = right def accept(self, visitor): visitor.visit_logical_rel(self) class Negation(object): def __init__(self, expr): self.expr = expr def accept(self, visitor): visitor.visit_negation(self) class BaseVisitor(object): def __init__(self): pass def visit_template(self, templ): pass def visit_text(self, text): pass def visit_cond(self, cond_block): pass def visit_for(self, for_block): pass def visit_snippet(self, snippet): pass def visit_snippet_call(self, snippet_call): pass def visit_use(self, use): pass def visit_call(self, func_call): pass def visit_expr(self, expr): pass def visit_logical_bin(self, logical_bin): pass def visit_logical_rel(self, logical_rel): pass def visit_negation(self, negation): pass
class Template(object): def __init__(self, usages, snippets, blocks): self.usages = usages self.snippets = snippets self.blocks = blocks def accept(self, visitor): visitor.visit_template(self) class Text(object): def __init__(self, text_token): self._token = text_token def get_token(self): return self._token token = property(get_token) def _get_content(self): return self._token.lexeme content = property(_get_content) def accept(self, visitor): visitor.visit_text(self) class Condblock(object): def __init__(self, branches): self.branches = branches def accept(self, visitor): visitor.visit_cond(self) class Forblock(object): def __init__(self, item_ident, list_expr, blocks, filter_cond=None): self.item_ident = item_ident self.list_expr = list_expr self.blocks = blocks self.filter_cond = filter_cond def accept(self, visitor): visitor.visit_for(self) class Snippet(object): def __init__(self, snippet_name, params, blocks): self.name = snippet_name self.params = params self.blocks = blocks def accept(self, visitor): visitor.visit_snippet(self) class Snippetcall(object): def __init__(self, snippet_name, args): self.name = snippet_name self.args = args def accept(self, visitor): visitor.visit_snippet_call(self) class Call(object): def __init__(self, callee, args): self.callee = callee self.args = args def accept(self, visitor): visitor.visit_call(self) class Use(object): def __init__(self, template_name, names): self.template_name = template_name self.names = names def accept(self, visitor): visitor.visit_use(self) class Singletoken(object): def __init__(self, token): self.token = token def accept(self, visitor): visitor.visit_expr(self) class Identifier(SingleToken): def __init__(self, identifier_token): SingleToken.__init__(self, identifier_token) def get_name(self): return self.token.lexeme class Simplevalue(SingleToken): def __init__(self, token): SingleToken.__init__(self, token) def get_value(self): raise exception('Not implemented') class Bool(SimpleValue): def __init__(self, bool_token): SimpleValue.__init__(self, bool_token) def get_value(self): s = self.token.lexeme return s == 'true' or s == 'else' class String(SimpleValue): def __init__(self, str_token): SimpleValue.__init__(self, str_token) def get_value(self): return self.token.lexeme def get_string(self): return self.token.lexeme[1:-1].replace("\\'", "'") class Int(SimpleValue): def __init__(self, int_token): SimpleValue.__init__(self, int_token) def get_value(self): return int(self.token.lexeme) class Real(SimpleValue): def __init__(self, real_token): SimpleValue.__init__(self, real_token) def get_value(self): return float(self.token.lexeme) class Qualifiedname(object): def __init__(self, identifier_tokens): self.identifier_tokens = identifier_tokens def accept(self, visitor): visitor.visit_expr(self) def get_name(self): return str(self) def __str__(self): return '.'.join(list(map(lambda ident: ident.lexeme, self.identifier_tokens))) class Logicalbinexpr(object): def __init__(self, op, left, right): self.op = op self.left = left self.right = right def accept(self, visitor): visitor.visit_logical_bin(self) class Logicalrelation(object): def __init__(self, op, left, right): self.op = op self.left = left self.right = right def accept(self, visitor): visitor.visit_logical_rel(self) class Negation(object): def __init__(self, expr): self.expr = expr def accept(self, visitor): visitor.visit_negation(self) class Basevisitor(object): def __init__(self): pass def visit_template(self, templ): pass def visit_text(self, text): pass def visit_cond(self, cond_block): pass def visit_for(self, for_block): pass def visit_snippet(self, snippet): pass def visit_snippet_call(self, snippet_call): pass def visit_use(self, use): pass def visit_call(self, func_call): pass def visit_expr(self, expr): pass def visit_logical_bin(self, logical_bin): pass def visit_logical_rel(self, logical_rel): pass def visit_negation(self, negation): pass
#take user inputs for Item code itemCode = input("Item Code : ") while itemCode != "1" and itemCode != "2" and itemCode != "3": print("Invalid Input!! Try again") itemCode = input("Item Code : ") #take user inputs for quantity quantity = input("Quantity : ") quantity = float(quantity) #take user inputs for customer type cType = input("Customer Type (L / N) : ") while cType != "L" and cType != "l" and cType != "N" and cType != "n": print("Invalid Input!! Try again") cType = input("Customer Type (L / N) : ") #calculate basic price if itemCode == "1": total = 530 * quantity elif itemCode == "2": total = 300 * quantity elif itemCode == "3": total = 950 * quantity #calculate discount if cType == "L" or cType == "l": discount = float(total * 25 / 100) else: discount = float(total * 5 / 100) #calculate total price total = total - discount #display the discount and total print("Discount : " + str(discount)) print("Total bill after the discount : " + str(total))
item_code = input('Item Code : ') while itemCode != '1' and itemCode != '2' and (itemCode != '3'): print('Invalid Input!! Try again') item_code = input('Item Code : ') quantity = input('Quantity : ') quantity = float(quantity) c_type = input('Customer Type (L / N) : ') while cType != 'L' and cType != 'l' and (cType != 'N') and (cType != 'n'): print('Invalid Input!! Try again') c_type = input('Customer Type (L / N) : ') if itemCode == '1': total = 530 * quantity elif itemCode == '2': total = 300 * quantity elif itemCode == '3': total = 950 * quantity if cType == 'L' or cType == 'l': discount = float(total * 25 / 100) else: discount = float(total * 5 / 100) total = total - discount print('Discount : ' + str(discount)) print('Total bill after the discount : ' + str(total))
#!/usr/bin/env python # -*- coding: utf-8 -*- # Keyword TOKEN_TYPE_IF = 0 TOKEN_TYPE_ELIF = 1 TOKEN_TYPE_ELSE = 2 TOKEN_TYPE_FOR = 3 TOKEN_TYPE_IN = 4 TOKEN_TYPE_WHILE = 5 TOKEN_TYPE_BREAK = 6 TOKEN_TYPE_NOT = 7 TOKEN_TYPE_AND = 8 TOKEN_TYPE_OR = 9 TOKEN_TYPE_RETURN = 10 TOKEN_TYPE_IMPORT = 11 TOKEN_TYPE_FUN = 12 TOKEN_TYPE_CLASS = 13 TOKEN_TYPE_LET = 14 TOKEN_TYPE_GLOBAL = 15 TOKEN_TYPE_TRUE = 16 TOKEN_TYPE_FALSE = 17 TOKEN_TYPE_CONTINUE = 18 TOKEN_TYPE_DEL = 19 keyword_strs = { 'if': TOKEN_TYPE_IF, 'elif': TOKEN_TYPE_ELIF, 'else': TOKEN_TYPE_ELSE, 'for': TOKEN_TYPE_FOR, 'in': TOKEN_TYPE_IN, 'while': TOKEN_TYPE_WHILE, 'break': TOKEN_TYPE_BREAK, 'not': TOKEN_TYPE_NOT, 'and': TOKEN_TYPE_AND, 'or': TOKEN_TYPE_OR, 'return': TOKEN_TYPE_RETURN, 'import': TOKEN_TYPE_IMPORT, 'fun': TOKEN_TYPE_FUN, 'class': TOKEN_TYPE_CLASS, 'let': TOKEN_TYPE_LET, 'global': TOKEN_TYPE_GLOBAL, 'True': TOKEN_TYPE_TRUE, 'False': TOKEN_TYPE_FALSE, 'continue': TOKEN_TYPE_CONTINUE, 'del': TOKEN_TYPE_DEL, } # Arithmetic operators TOKEN_TYPE_ADD = 20 TOKEN_TYPE_SUB = 21 TOKEN_TYPE_MUL = 22 TOKEN_TYPE_DIV = 23 TOKEN_TYPE_MOD = 24 # % TOKEN_TYPE_POWER = 25 # Logical operators TOKEN_TYPE_EQU = 26 TOKEN_TYPE_NEQU = 27 # != TOKEN_TYPE_GT = 28 TOKEN_TYPE_LT = 29 TOKEN_TYPE_GE = 30 TOKEN_TYPE_LE = 31 # Assigning operator TOKEN_TYPE_ASSIGN = 32 # Bitwise operator TOKEN_TYPE_LOGIC_AND = 33 TOKEN_TYPE_LOGIC_OR = 34 TOKEN_TYPE_LOGIC_XOR = 35 TOKEN_TYPE_LOGIC_NOT = 36 TOKEN_TYPE_LOGIC_SHL = 37 TOKEN_TYPE_LOGIC_SHR = 38 # Data type TOKEN_TYPE_NUM = 39 TOKEN_TYPE_STR = 40 # Others TOKEN_TYPE_COMMA = 41 TOKEN_TYPE_POINT = 42 TOKEN_TYPE_COLON = 43 # : TOKEN_TYPE_SEMICOLON = 44 # ;, ; is comment TOKEN_TYPE_LEFT_PARENT = 45 # ( TOKEN_TYPE_RIGHT_PARENT = 46 # ) TOKEN_TYPE_LEFT_BRACKET = 47 # [ TOKEN_TYPE_RIGHT_BRACKET = 48 # ] TOKEN_TYPE_LEFT_BRACE = 49 # { TOKEN_TYPE_RIGHT_BRACE = 50 # } TOKEN_TYPE_DOUBLE_QUOTATION = 51 TOKEN_TYPE_SINGLE_QUOTE = 52 # ' is anonymous function TOKEN_TYPE_EOF = 53 # The end of file TOKEN_TYPE_UNKNOWN = 54 # Extra TOKEN_TYPE_NIL = 55 # File start sign TOKEN_TYPE_ID = 56 TOKEN_TYPE_SPACER = 57 # ` TOKEN_TYPE_STR_LINES = 58 TOKEN_TYPE_SELF = 59
token_type_if = 0 token_type_elif = 1 token_type_else = 2 token_type_for = 3 token_type_in = 4 token_type_while = 5 token_type_break = 6 token_type_not = 7 token_type_and = 8 token_type_or = 9 token_type_return = 10 token_type_import = 11 token_type_fun = 12 token_type_class = 13 token_type_let = 14 token_type_global = 15 token_type_true = 16 token_type_false = 17 token_type_continue = 18 token_type_del = 19 keyword_strs = {'if': TOKEN_TYPE_IF, 'elif': TOKEN_TYPE_ELIF, 'else': TOKEN_TYPE_ELSE, 'for': TOKEN_TYPE_FOR, 'in': TOKEN_TYPE_IN, 'while': TOKEN_TYPE_WHILE, 'break': TOKEN_TYPE_BREAK, 'not': TOKEN_TYPE_NOT, 'and': TOKEN_TYPE_AND, 'or': TOKEN_TYPE_OR, 'return': TOKEN_TYPE_RETURN, 'import': TOKEN_TYPE_IMPORT, 'fun': TOKEN_TYPE_FUN, 'class': TOKEN_TYPE_CLASS, 'let': TOKEN_TYPE_LET, 'global': TOKEN_TYPE_GLOBAL, 'True': TOKEN_TYPE_TRUE, 'False': TOKEN_TYPE_FALSE, 'continue': TOKEN_TYPE_CONTINUE, 'del': TOKEN_TYPE_DEL} token_type_add = 20 token_type_sub = 21 token_type_mul = 22 token_type_div = 23 token_type_mod = 24 token_type_power = 25 token_type_equ = 26 token_type_nequ = 27 token_type_gt = 28 token_type_lt = 29 token_type_ge = 30 token_type_le = 31 token_type_assign = 32 token_type_logic_and = 33 token_type_logic_or = 34 token_type_logic_xor = 35 token_type_logic_not = 36 token_type_logic_shl = 37 token_type_logic_shr = 38 token_type_num = 39 token_type_str = 40 token_type_comma = 41 token_type_point = 42 token_type_colon = 43 token_type_semicolon = 44 token_type_left_parent = 45 token_type_right_parent = 46 token_type_left_bracket = 47 token_type_right_bracket = 48 token_type_left_brace = 49 token_type_right_brace = 50 token_type_double_quotation = 51 token_type_single_quote = 52 token_type_eof = 53 token_type_unknown = 54 token_type_nil = 55 token_type_id = 56 token_type_spacer = 57 token_type_str_lines = 58 token_type_self = 59
############################################################################### '''''' ############################################################################### # import unittest def testfunc(a, b, c, d=4, # another comment /, e: int = 5, # stuff f=6, g=7, h=8, *args, # morestuff i, j=10, # k k0=11, k1=110, k2=1100, l=12, # noqa: E741 m=13, # bonusstuff n=14, # morebonusstuff o=15, # ignore fee='fee', fie='fie', foe='foe', fum='fum', # subignore boo='boo', p=16, **kwargs, ): print( a, b, c, d, e, f, g, h, args, i, j, k0, k1, k2, l, m, n, o, p, kwargs ) # class CascadeTest(unittest.TestCase): # def test(self): # inputs = Inputs(testfunc) # self.assertEqual(inputs.stuff.f, 6) # inputs.stuff.f = 'myval' # self.assertEqual(inputs.stuff.f, 'myval') # self.assertEqual(inputs.f, 'myval') # inputs['k'] = 'myval' # self.assertEqual(inputs.k, 'myval') # self.assertEqual(inputs.morestuff.substuff.k, 'myval') # self.assertTrue(not hasattr(inputs, 'foo')) # self.assertTrue(not hasattr(inputs, '_c')) # # if __name__ == '__main__': # unittest.main() ############################################################################### ###############################################################################
"""""" def testfunc(a, b, c, d=4, /, e: int=5, f=6, g=7, h=8, *args, i, j=10, k0=11, k1=110, k2=1100, l=12, m=13, n=14, o=15, fee='fee', fie='fie', foe='foe', fum='fum', boo='boo', p=16, **kwargs): print(a, b, c, d, e, f, g, h, args, i, j, k0, k1, k2, l, m, n, o, p, kwargs)
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: retlisthead, retlistpos = None, None lv: int = 0 while l1 is not None or l2 is not None: v1, l1 = (l1.val, l1.next) if l1 is not None else (0, None) v2, l2 = (l2.val, l2.next) if l2 is not None else (0, None) v = v1 + v2 + lv lv = v // 10 node = ListNode(v % 10) if retlisthead is None: retlisthead = node else: retlistpos.next = node retlistpos = node if lv != 0: retlistpos.next = ListNode(lv) return retlisthead def NodeToList(l: ListNode) -> list: ret = list() while l is not None: ret.append(l.val) l = l.next return ret def ListToNode(l: list) -> ListNode: retlisthead, retlistpos = None, None for v in l: node = ListNode(v) if retlisthead is None: retlisthead = node else: retlistpos.next = node retlistpos = node return retlisthead if __name__ == "__main__": sol = Solution() l1 = ListToNode([2, 4, 3]) l2 = ListToNode([5, 6, 4]) print(NodeToList(sol.addTwoNumbers(l1, l2))) l1 = ListToNode([0]) l2 = ListToNode([0]) print(NodeToList(sol.addTwoNumbers(l1, l2))) l1 = ListToNode([9, 9, 9, 9, 9, 9, 9]) l2 = ListToNode([9, 9, 9, 9]) print(NodeToList(sol.addTwoNumbers(l1, l2)))
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: (retlisthead, retlistpos) = (None, None) lv: int = 0 while l1 is not None or l2 is not None: (v1, l1) = (l1.val, l1.next) if l1 is not None else (0, None) (v2, l2) = (l2.val, l2.next) if l2 is not None else (0, None) v = v1 + v2 + lv lv = v // 10 node = list_node(v % 10) if retlisthead is None: retlisthead = node else: retlistpos.next = node retlistpos = node if lv != 0: retlistpos.next = list_node(lv) return retlisthead def node_to_list(l: ListNode) -> list: ret = list() while l is not None: ret.append(l.val) l = l.next return ret def list_to_node(l: list) -> ListNode: (retlisthead, retlistpos) = (None, None) for v in l: node = list_node(v) if retlisthead is None: retlisthead = node else: retlistpos.next = node retlistpos = node return retlisthead if __name__ == '__main__': sol = solution() l1 = list_to_node([2, 4, 3]) l2 = list_to_node([5, 6, 4]) print(node_to_list(sol.addTwoNumbers(l1, l2))) l1 = list_to_node([0]) l2 = list_to_node([0]) print(node_to_list(sol.addTwoNumbers(l1, l2))) l1 = list_to_node([9, 9, 9, 9, 9, 9, 9]) l2 = list_to_node([9, 9, 9, 9]) print(node_to_list(sol.addTwoNumbers(l1, l2)))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]: Len = 0 tmp = root while tmp: Len+=1 tmp = tmp.next part_len = Len // k remain = Len % k res = [] for _ in range(k): head = ListNode(0) each = head for _ in range(part_len): node = ListNode(root.val) each.next = node each = each.next root = root.next if remain and root: remain_node = ListNode(root.val) each.next = remain_node if root: root = root.next remain -= 1 res.append(head.next) return res
class Solution: def split_list_to_parts(self, root: ListNode, k: int) -> List[ListNode]: len = 0 tmp = root while tmp: len += 1 tmp = tmp.next part_len = Len // k remain = Len % k res = [] for _ in range(k): head = list_node(0) each = head for _ in range(part_len): node = list_node(root.val) each.next = node each = each.next root = root.next if remain and root: remain_node = list_node(root.val) each.next = remain_node if root: root = root.next remain -= 1 res.append(head.next) return res
T = int(input()) for _ in range(T): s = input() n_1 = 0 for c in s: if c == '1': n_1 += 1 if n_1%2: print('WIN') else: print('LOSE')
t = int(input()) for _ in range(T): s = input() n_1 = 0 for c in s: if c == '1': n_1 += 1 if n_1 % 2: print('WIN') else: print('LOSE')
def obrnut(tekst): return tekst[::-1] def da_li_je_palindrom(tekst): return tekst == obrnut(tekst) nesto = input("Ukucja tekst: ") if(da_li_je_palindrom(nesto)): print("Da, to je palindrom") else: print("Ne to nije palindrom")
def obrnut(tekst): return tekst[::-1] def da_li_je_palindrom(tekst): return tekst == obrnut(tekst) nesto = input('Ukucja tekst: ') if da_li_je_palindrom(nesto): print('Da, to je palindrom') else: print('Ne to nije palindrom')
def arrayPartition(nums): nums.sort() suma=0 for i in range(0,len(nums),2): suma+=min(nums[i],nums[i+1]) return suma nums = [1,4,3,2] print(arrayPartition(nums))
def array_partition(nums): nums.sort() suma = 0 for i in range(0, len(nums), 2): suma += min(nums[i], nums[i + 1]) return suma nums = [1, 4, 3, 2] print(array_partition(nums))
# Write your solution here def spruce(n): row = "*" print("a spruce!") while n > 0: print(" " * (n-1) + row + " " * (n-1)) row += "**" n -= 1 l = int((len(row)-3)/2) print(" " * l + "*" + " " * l) # You can test your function by callil if __name__ == "__main__": spruce(5) spruce(4)
def spruce(n): row = '*' print('a spruce!') while n > 0: print(' ' * (n - 1) + row + ' ' * (n - 1)) row += '**' n -= 1 l = int((len(row) - 3) / 2) print(' ' * l + '*' + ' ' * l) if __name__ == '__main__': spruce(5) spruce(4)
class Node: def __init__(self,key): self.left = None self.right = None self.val = key def printInorder(root): if root: printInorder(root.left) print(root.val), printInorder(root.right) def printPostorder(root): if root: printPostorder(root.left) printPostorder(root.right) print(root.val), def printPreorder(root): if root: print(root.val), printPreorder(root.left) printPreorder(root.right) root = Node(1) root.left = Node(2) root.right = Node(3) root.left.left = Node(4) root.left.right = Node(5) print ("Preorder traversal of binary tree is") printPreorder(root) print ("\nInorder traversal of binary tree is") printInorder(root) print ("\nPostorder traversal of binary tree is") printPostorder(root)
class Node: def __init__(self, key): self.left = None self.right = None self.val = key def print_inorder(root): if root: print_inorder(root.left) (print(root.val),) print_inorder(root.right) def print_postorder(root): if root: print_postorder(root.left) print_postorder(root.right) (print(root.val),) def print_preorder(root): if root: (print(root.val),) print_preorder(root.left) print_preorder(root.right) root = node(1) root.left = node(2) root.right = node(3) root.left.left = node(4) root.left.right = node(5) print('Preorder traversal of binary tree is') print_preorder(root) print('\nInorder traversal of binary tree is') print_inorder(root) print('\nPostorder traversal of binary tree is') print_postorder(root)
with open("input.txt") as f: p1 = [] f.readline() line = f.readline() while line != "\n": p1.append(int(line.strip())) line = f.readline() f.readline() p2 = [] line = f.readline() while line != "": p2.append(int(line.strip())) line = f.readline() game_history = {} def serialize(hand): return ",".join(str(x) for x in hand) # returns 1 if p1 wins, 2 if p2 wins, 0 if p1 wins game immediately def play_round(p1, p2, game): entry = (serialize(p1), serialize(p2)) if entry in game_history[game]: return 0 game_history[game].add(entry) p1_card = p1.pop(0) p2_card = p2.pop(0) if len(p1) >= p1_card and len(p2) >= p2_card: round_winner = play_game(p1[:p1_card], p2[:p2_card], game+1) else: round_winner = 1 if p1_card > p2_card else 2 if round_winner == 1: p1.extend([p1_card, p2_card]) elif round_winner == 2: p2.extend([p2_card, p1_card]) return round_winner def play_game(p1, p2, game=0): game_history[game] = set() while len(p1) > 0 and len(p2) > 0: if play_round(p1, p2, game) == 0: return 1 return 1 if len(p1) > 0 else 2 winner = play_game(p1, p2) winner_hand = p2 if winner == 2 else p1 print(winner) print(p1) print(p2) print(sum(card * x for card, x in zip(winner_hand, range(len(winner_hand), 0, -1))))
with open('input.txt') as f: p1 = [] f.readline() line = f.readline() while line != '\n': p1.append(int(line.strip())) line = f.readline() f.readline() p2 = [] line = f.readline() while line != '': p2.append(int(line.strip())) line = f.readline() game_history = {} def serialize(hand): return ','.join((str(x) for x in hand)) def play_round(p1, p2, game): entry = (serialize(p1), serialize(p2)) if entry in game_history[game]: return 0 game_history[game].add(entry) p1_card = p1.pop(0) p2_card = p2.pop(0) if len(p1) >= p1_card and len(p2) >= p2_card: round_winner = play_game(p1[:p1_card], p2[:p2_card], game + 1) else: round_winner = 1 if p1_card > p2_card else 2 if round_winner == 1: p1.extend([p1_card, p2_card]) elif round_winner == 2: p2.extend([p2_card, p1_card]) return round_winner def play_game(p1, p2, game=0): game_history[game] = set() while len(p1) > 0 and len(p2) > 0: if play_round(p1, p2, game) == 0: return 1 return 1 if len(p1) > 0 else 2 winner = play_game(p1, p2) winner_hand = p2 if winner == 2 else p1 print(winner) print(p1) print(p2) print(sum((card * x for (card, x) in zip(winner_hand, range(len(winner_hand), 0, -1)))))
nota1 = int(input("escriba la prmera nota de su alumno:")) nota2 = int(input("escriba la segunda nota de su alumno:")) nota3 = int(input("escriba la tercera nota de su alumno:")) nota4 = int(input("escriba la cuarta nota de su alumno:")) media = (nota1 + nota2 + nota3 + nota4) / 4 print(media) sapo = True while sapo == True: if media >= 15: print("Alumno con talento") sapo = False if media in range(12,15): print("Con capacidad") if media < 12: print("Debe reorientarse") sapo = False if media> 20: print("esto es imposible ha debido haber un error introduciendo las notas") sapo = False
nota1 = int(input('escriba la prmera nota de su alumno:')) nota2 = int(input('escriba la segunda nota de su alumno:')) nota3 = int(input('escriba la tercera nota de su alumno:')) nota4 = int(input('escriba la cuarta nota de su alumno:')) media = (nota1 + nota2 + nota3 + nota4) / 4 print(media) sapo = True while sapo == True: if media >= 15: print('Alumno con talento') sapo = False if media in range(12, 15): print('Con capacidad') if media < 12: print('Debe reorientarse') sapo = False if media > 20: print('esto es imposible ha debido haber un error introduciendo las notas') sapo = False
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return an integer def minDepth(self, root): if root is None: return 0 # BFS queue1 = [] queue2 = [] queue1.append(root) queue2.append(1) while queue1: root = queue1.pop(0) depth = queue2.pop(0) if root.left is None and root.right is None: return depth if root.left is not None: queue1.append(root.left) queue2.append(depth + 1) if root.right is not None: queue1.append(root.right) queue2.append(depth + 1)
class Solution: def min_depth(self, root): if root is None: return 0 queue1 = [] queue2 = [] queue1.append(root) queue2.append(1) while queue1: root = queue1.pop(0) depth = queue2.pop(0) if root.left is None and root.right is None: return depth if root.left is not None: queue1.append(root.left) queue2.append(depth + 1) if root.right is not None: queue1.append(root.right) queue2.append(depth + 1)
# Python - 3.6.0 Test.describe('Basic tests') Test.assert_equals(sequence_sum(2, 6, 2), 12) Test.assert_equals(sequence_sum(1, 5, 1), 15) Test.assert_equals(sequence_sum(1, 5, 3), 5) Test.assert_equals(sequence_sum(0, 15, 3), 45) Test.assert_equals(sequence_sum(16, 15, 3), 0) Test.assert_equals(sequence_sum(2, 24, 22), 26) Test.assert_equals(sequence_sum(2, 2, 2), 2) Test.assert_equals(sequence_sum(2, 2, 1), 2) Test.assert_equals(sequence_sum(1, 15, 3), 35) Test.assert_equals(sequence_sum(15, 1, 3), 0)
Test.describe('Basic tests') Test.assert_equals(sequence_sum(2, 6, 2), 12) Test.assert_equals(sequence_sum(1, 5, 1), 15) Test.assert_equals(sequence_sum(1, 5, 3), 5) Test.assert_equals(sequence_sum(0, 15, 3), 45) Test.assert_equals(sequence_sum(16, 15, 3), 0) Test.assert_equals(sequence_sum(2, 24, 22), 26) Test.assert_equals(sequence_sum(2, 2, 2), 2) Test.assert_equals(sequence_sum(2, 2, 1), 2) Test.assert_equals(sequence_sum(1, 15, 3), 35) Test.assert_equals(sequence_sum(15, 1, 3), 0)
def test_atom_feed(app): app.get("/stream.atom") def test_rss_feed(app): app.get("/stream.rss")
def test_atom_feed(app): app.get('/stream.atom') def test_rss_feed(app): app.get('/stream.rss')
age = 12 if age < 4: print("Your admission cost is $0.") elif age < 18: print("Your admission cost is $25.") else: print("Your admission cost is $40.") age = 12 if age < 4: price = 0 elif age < 18: price = 25 print(f"Your admission cost is ${price}.") age = 12 if age < 4: price = 0 elif age < 18: price = 25 elif age < 65: price = 40 else: price = 20 print(f"Your admission cost is ${price}.") age = 12 if age < 4: price = 0 elif age < 18: price = 25 elif age < 65: price = 40 elif age >= 65: price = 20 print(f"Your admission cost is ${price}.")
age = 12 if age < 4: print('Your admission cost is $0.') elif age < 18: print('Your admission cost is $25.') else: print('Your admission cost is $40.') age = 12 if age < 4: price = 0 elif age < 18: price = 25 print(f'Your admission cost is ${price}.') age = 12 if age < 4: price = 0 elif age < 18: price = 25 elif age < 65: price = 40 else: price = 20 print(f'Your admission cost is ${price}.') age = 12 if age < 4: price = 0 elif age < 18: price = 25 elif age < 65: price = 40 elif age >= 65: price = 20 print(f'Your admission cost is ${price}.')
class Updated: def __init__(self, payload): self.tiers_added = payload['tiersAdded'] self.orb_count_diff = payload['orbCountDiff'] self.inventory_updates = payload['inventoryUpdates']
class Updated: def __init__(self, payload): self.tiers_added = payload['tiersAdded'] self.orb_count_diff = payload['orbCountDiff'] self.inventory_updates = payload['inventoryUpdates']
#2XX Success SUCESS_OK = 200 #4XX Error ERROR_BAD_REQUEST = 400 ERROR_UNAUTHORIZED = 401 ERROR_FORBIDDEN = 403 ERROR_NOT_FOUND = 404 #5xx ERROR_SERVER = 500
sucess_ok = 200 error_bad_request = 400 error_unauthorized = 401 error_forbidden = 403 error_not_found = 404 error_server = 500
s1 = "xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz" s2 = "xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb" # take 2 strings s1 and s2 including only letters from ato z. # Return a new sorted string, the longest possible, containing distinct letters def longest(s1, s2): s = sorted(set(s1 + s2)) return s
s1 = 'xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz' s2 = 'xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb' def longest(s1, s2): s = sorted(set(s1 + s2)) return s
def fc(claim, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim) def fdlc(claim): return fc(claim, s='dl') def scope(scope, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(suffix, scope)
def fc(claim, s=None): suffix = '-' + s if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim) def fdlc(claim): return fc(claim, s='dl') def scope(scope, s=None): suffix = '-' + s if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(suffix, scope)
# Given a string, use recursion to output a list of all the possible permutations of a string # If a character is repeated, treat all versions as distinct # Itertools does permutations def permute(s): out = [] # Base case is when there is only one letter if len(s) < 2: out = [s] else: # For every letter in string for i, letter in enumerate(s): # For every permutation resultingfromstep2 a nd3 for perm in permute(s[:i] + s[i+1:]): # add it to the output out += [let+perm] return out s = "abc" print(permute(s))
def permute(s): out = [] if len(s) < 2: out = [s] else: for (i, letter) in enumerate(s): for perm in permute(s[:i] + s[i + 1:]): out += [let + perm] return out s = 'abc' print(permute(s))
# from https://github.com/peteboyd/lammps_interface.git ATOMIC_MASSES = { "H": 1.00794, "He": 4.002602, "Li": 6.941, "Be": 9.012182, "B": 10.811, "C": 12.0107, "N": 14.0067, "O": 15.9994, "F": 18.9984032, "Ne": 20.1797, "Na": 22.98976928, "Mg": 24.3050, "Al": 26.9815386, "Si": 28.0855, "P": 30.973762, "S": 32.065, "Cl": 35.453, "Ar": 39.948, "K": 39.0983, "Ca": 40.078, "Sc": 44.955912, "Ti": 47.867, "V": 50.9415, "Cr": 51.9961, "Mn": 54.938045, "Fe": 55.845, "Co": 58.933195, "Ni": 58.6934, "Cu": 63.546, "Zn": 65.38, "Ga": 69.723, "Ge": 72.64, "As": 74.92160, "Se": 78.96, "Br": 79.904, "Kr": 83.798, "Rb": 85.4678, "Sr": 87.62, "Y": 88.90585, "Zr": 91.224, "Nb": 92.90638, "Mo": 95.96, "Tc": 98, "Ru": 101.07, "Rh": 102.90550, "Pd": 106.42, "Ag": 107.8682, "Cd": 112.411, "In": 114.818, "Sn": 118.710, "Sb": 121.760, "Te": 127.60, "I": 126.90447, "Xe": 131.293, "Cs": 132.9054519, "Ba": 137.327, "La": 138.90547, "Ce": 140.116, "Pr": 140.90765, "Nd": 144.242, "Pm": 145, "Sm": 150.36, "Eu": 151.964, "Gd": 157.25, "Tb": 158.92535, "Dy": 162.500, "Ho": 164.93032, "Er": 167.259, "Tm": 168.93421, "Yb": 173.054, "Lu": 174.9668, "Hf": 178.49, "Ta": 180.94788, "W": 183.84, "Re": 186.207, "Os": 190.23, "Ir": 192.217, "Pt": 195.084, "Au": 196.966569, "Hg": 200.59, "Tl": 204.3833, "Pb": 207.2, "Bi": 208.98040, "Po": 209, "At": 210, "Rn": 222, "Fr": 223, "Ra": 226, "Ac": 227, "Th": 232.03806, "Pa": 231.03588, "U": 238.02891, "Np": 237, "Pu": 244, "Am": 243, "Cm": 247, "Bk": 247, "Cf": 251, "Es": 252, "Fm": 257, "Md": 258, "No": 259, "Lr": 262, "Rf": 265, "Db": 268, "Sg": 271, "Bh": 272, "Hs": 270, "Mt": 276, "Ds": 281, "Rg": 280, "Cn": 285, "Uut": 284, "Uuq": 289, "Uup": 288, "Uuh": 293, "Uuo": 294 }
atomic_masses = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182, 'B': 10.811, 'C': 12.0107, 'N': 14.0067, 'O': 15.9994, 'F': 18.9984032, 'Ne': 20.1797, 'Na': 22.98976928, 'Mg': 24.305, 'Al': 26.9815386, 'Si': 28.0855, 'P': 30.973762, 'S': 32.065, 'Cl': 35.453, 'Ar': 39.948, 'K': 39.0983, 'Ca': 40.078, 'Sc': 44.955912, 'Ti': 47.867, 'V': 50.9415, 'Cr': 51.9961, 'Mn': 54.938045, 'Fe': 55.845, 'Co': 58.933195, 'Ni': 58.6934, 'Cu': 63.546, 'Zn': 65.38, 'Ga': 69.723, 'Ge': 72.64, 'As': 74.9216, 'Se': 78.96, 'Br': 79.904, 'Kr': 83.798, 'Rb': 85.4678, 'Sr': 87.62, 'Y': 88.90585, 'Zr': 91.224, 'Nb': 92.90638, 'Mo': 95.96, 'Tc': 98, 'Ru': 101.07, 'Rh': 102.9055, 'Pd': 106.42, 'Ag': 107.8682, 'Cd': 112.411, 'In': 114.818, 'Sn': 118.71, 'Sb': 121.76, 'Te': 127.6, 'I': 126.90447, 'Xe': 131.293, 'Cs': 132.9054519, 'Ba': 137.327, 'La': 138.90547, 'Ce': 140.116, 'Pr': 140.90765, 'Nd': 144.242, 'Pm': 145, 'Sm': 150.36, 'Eu': 151.964, 'Gd': 157.25, 'Tb': 158.92535, 'Dy': 162.5, 'Ho': 164.93032, 'Er': 167.259, 'Tm': 168.93421, 'Yb': 173.054, 'Lu': 174.9668, 'Hf': 178.49, 'Ta': 180.94788, 'W': 183.84, 'Re': 186.207, 'Os': 190.23, 'Ir': 192.217, 'Pt': 195.084, 'Au': 196.966569, 'Hg': 200.59, 'Tl': 204.3833, 'Pb': 207.2, 'Bi': 208.9804, 'Po': 209, 'At': 210, 'Rn': 222, 'Fr': 223, 'Ra': 226, 'Ac': 227, 'Th': 232.03806, 'Pa': 231.03588, 'U': 238.02891, 'Np': 237, 'Pu': 244, 'Am': 243, 'Cm': 247, 'Bk': 247, 'Cf': 251, 'Es': 252, 'Fm': 257, 'Md': 258, 'No': 259, 'Lr': 262, 'Rf': 265, 'Db': 268, 'Sg': 271, 'Bh': 272, 'Hs': 270, 'Mt': 276, 'Ds': 281, 'Rg': 280, 'Cn': 285, 'Uut': 284, 'Uuq': 289, 'Uup': 288, 'Uuh': 293, 'Uuo': 294}
def func(): print('func') def func2(): print('func2') def func3(): print('func3') __all__ = ['func2', 'func3']
def func(): print('func') def func2(): print('func2') def func3(): print('func3') __all__ = ['func2', 'func3']
__all__ = ('func', 'C') def func(): pass class C: pass
__all__ = ('func', 'C') def func(): pass class C: pass
DBPEDIA_URI = "http://dbpedia.org/sparql" # dsbox02.isi.edu # ELASTICSEARCH_URI "http://kg2018a.isi.edu:9200/my_wiki_content_first/_search" # SPARQL_URI = "http://dsbox02.isi.edu:8888/bigdata/namespace/wdq/sparql" # IDENTIFIER_WIKIFIER = "http://minds03.isi.edu:4444/get_properties" # DataMachines Nov 2019 ELASTICSEARCH_URI = "http://10.108.20.4:9200/my_wiki_content_first/_search" SPARQL_URI = "http://10.108.20.4:9966/bigdata/namespace/wdq/sparql" IDENTIFIER_WIKIFIER = "http://10.108.20.4:9000/get_properties" # old # sparql = SPARQLWrapper("http://sitaware.isi.edu:8080/bigdata/namespace/wdq/sparql") # sparql = SPARQLWrapper("https://query.wikidata.org/sparql") # sparqldb = SPARQLWrapper("http://dbpedia.org/sparql")
dbpedia_uri = 'http://dbpedia.org/sparql' elasticsearch_uri = 'http://10.108.20.4:9200/my_wiki_content_first/_search' sparql_uri = 'http://10.108.20.4:9966/bigdata/namespace/wdq/sparql' identifier_wikifier = 'http://10.108.20.4:9000/get_properties'
class Config(object): c_dim = 5 c2_dim = 8 celeba_crop_size = 178 rafd_crop_size = 256 image_size = 128 g_conv_dim = 64 d_conv_dim = 64 g_repeat_num = 6 d_repeat_num = 6 lambda_cls = 1 lambda_rec = 10 lambda_gp = 10 dataset = 'CelebA' batch_size = 16 num_iters = 200000 num_iters_decay = 100000 g_lr = 0.0001 d_lr = 0.0001 n_critic = 5 beta1 = 0.5 beta2 = 0.999 resume_iters = None selected_attrs = ['Black_Hair', 'Blond_Hair', 'Brown_Hair', 'Male', 'Young'] # Test configuration. test_iters = 200000 # Miscellaneous. num_workers = 1 mode = 'train' use_tensorboard = True # Directories. celeba_image_dir = 'data/CelebA_nocrop/images' attr_path = 'data/list_attr_celeba.txt' rafd_image_di = 'data/RaFD/train' log_dir = 'stargan/logs' model_save_dir = 'stargan/models' sample_dir = 'stargan/samples' result_dir = 'stargan/results' # Step size. log_step = 10 sample_step = 1000 model_save_step = 10000 lr_update_step = 1000 config = Config()
class Config(object): c_dim = 5 c2_dim = 8 celeba_crop_size = 178 rafd_crop_size = 256 image_size = 128 g_conv_dim = 64 d_conv_dim = 64 g_repeat_num = 6 d_repeat_num = 6 lambda_cls = 1 lambda_rec = 10 lambda_gp = 10 dataset = 'CelebA' batch_size = 16 num_iters = 200000 num_iters_decay = 100000 g_lr = 0.0001 d_lr = 0.0001 n_critic = 5 beta1 = 0.5 beta2 = 0.999 resume_iters = None selected_attrs = ['Black_Hair', 'Blond_Hair', 'Brown_Hair', 'Male', 'Young'] test_iters = 200000 num_workers = 1 mode = 'train' use_tensorboard = True celeba_image_dir = 'data/CelebA_nocrop/images' attr_path = 'data/list_attr_celeba.txt' rafd_image_di = 'data/RaFD/train' log_dir = 'stargan/logs' model_save_dir = 'stargan/models' sample_dir = 'stargan/samples' result_dir = 'stargan/results' log_step = 10 sample_step = 1000 model_save_step = 10000 lr_update_step = 1000 config = config()
li = input().split() dicti={} for i in li: if i not in dicti: dicti[i]=1 else: print(i)
li = input().split() dicti = {} for i in li: if i not in dicti: dicti[i] = 1 else: print(i)
formatter = "{} {} {} {}" #this gives 4 empty slots in the formatter variable print(formatter.format(1, 2, 3, 4)) #this fill the slots with 1234 print(formatter.format("one", "two", "three", "four")) #this fills the slots with one two three four print(formatter.format(True, False, False, True)) #this fills the slots with true false false true print(formatter.format(formatter, formatter, formatter, formatter)) #this calls the variable 4 times but does not fill, so 16 {} show up print(formatter.format( "Try your", "Own text here", "Maybe a poem", "Or a song about fear" )) #this calls up four different strings to fill the slots in the variable
formatter = '{} {} {} {}' print(formatter.format(1, 2, 3, 4)) print(formatter.format('one', 'two', 'three', 'four')) print(formatter.format(True, False, False, True)) print(formatter.format(formatter, formatter, formatter, formatter)) print(formatter.format('Try your', 'Own text here', 'Maybe a poem', 'Or a song about fear'))
class LavadoraFacade(object): def lavar(self): self._lavar = Lavar() self._lavar.subsistema_operation() def enjuagar(self): self._enjuagar = Enjuagar() self._enjuagar.subsistema_operation() def centrifugado(self): self._centrifugado = Centrifugado() self._centrifugado.subsistema_operation() def ciclo_completo(self): self._ciclo_completo = Completo() self._ciclo_completo.subsistema_operation() class Lavar(object): def subsistema_operation(self): print("Lavando...\nFinalizado!") class Enjuagar(object): def subsistema_operation(self): print("Enjuagando...\nFinalizado!") class Centrifugado(object): def subsistema_operation(self): print("Centrifugando...\nFinalizado!") class Completo(object): def subsistema_operation(self): print ("Lavando...\nEnjuagando...\nCentrifugando...\nFinalizado!") if __name__ == "__main__": print(LavadoraFacade().ciclo_completo())
class Lavadorafacade(object): def lavar(self): self._lavar = lavar() self._lavar.subsistema_operation() def enjuagar(self): self._enjuagar = enjuagar() self._enjuagar.subsistema_operation() def centrifugado(self): self._centrifugado = centrifugado() self._centrifugado.subsistema_operation() def ciclo_completo(self): self._ciclo_completo = completo() self._ciclo_completo.subsistema_operation() class Lavar(object): def subsistema_operation(self): print('Lavando...\nFinalizado!') class Enjuagar(object): def subsistema_operation(self): print('Enjuagando...\nFinalizado!') class Centrifugado(object): def subsistema_operation(self): print('Centrifugando...\nFinalizado!') class Completo(object): def subsistema_operation(self): print('Lavando...\nEnjuagando...\nCentrifugando...\nFinalizado!') if __name__ == '__main__': print(lavadora_facade().ciclo_completo())
#Given an array of integers, find and print the maximum number of integers you #can select from the array such that the absolute difference between any two of #the chosen integers is less than or equal to . For example, if your array is , #you can create two subarrays meeting the criterion: and . The maximum length #subarray has elements. list = input().split() list = [int(i) for i in list] list.sort() print(list) def pickingNumbers(list): # Write your code here maximum = [] maxim = 0 while len(list) > 1: if len(list) != 0: A = max(list) count_max = list.count(A) for j in range(count_max): list.remove(max(list)) maxim += count_max if len(list) == 0 and len(maximum) == 0: return count_max if len(list) != 0: B = max(list) count_max = list.count(B) maxim += count_max check = abs(A - B) if check <= 1: maximum.append(maxim) maxim = 0 return max(maximum) print(pickingNumbers(list))
list = input().split() list = [int(i) for i in list] list.sort() print(list) def picking_numbers(list): maximum = [] maxim = 0 while len(list) > 1: if len(list) != 0: a = max(list) count_max = list.count(A) for j in range(count_max): list.remove(max(list)) maxim += count_max if len(list) == 0 and len(maximum) == 0: return count_max if len(list) != 0: b = max(list) count_max = list.count(B) maxim += count_max check = abs(A - B) if check <= 1: maximum.append(maxim) maxim = 0 return max(maximum) print(picking_numbers(list))
# Python lists can be used as Arrays in Python # Creating an array things = ['pen', 'car', 'books'] print(things) # accessing the array element print(things[0]) # prints the first element of the array things # modifying the value of the array element things[1] = 'pencil' # second element of things, gets changed to pencil print(things[1]) # length/size of the array length = len(things) print(length) # length variable holds the size of the array which is in this case, 3 # looping through the array/lists for a in things: # iterating over each element of the array print(a) for i in range(len(things)): # iterating the variable i upto the length of array print(things[i]) # and then accessing the array element present at index i
things = ['pen', 'car', 'books'] print(things) print(things[0]) things[1] = 'pencil' print(things[1]) length = len(things) print(length) for a in things: print(a) for i in range(len(things)): print(things[i])
def isDivisibleBy(int, divisor): return int % divisor == 0; def doFizzBuzz(): for i in range(1, 101): isDivisibleByThree = isDivisibleBy(i, 3) isDivisibleByFive = isDivisibleBy(i, 5) if (isDivisibleByThree and isDivisibleByFive): print('fizzbuzz') elif isDivisibleByThree: print('fizz') elif isDivisibleByFive: print('buzz') else: print(i) doFizzBuzz()
def is_divisible_by(int, divisor): return int % divisor == 0 def do_fizz_buzz(): for i in range(1, 101): is_divisible_by_three = is_divisible_by(i, 3) is_divisible_by_five = is_divisible_by(i, 5) if isDivisibleByThree and isDivisibleByFive: print('fizzbuzz') elif isDivisibleByThree: print('fizz') elif isDivisibleByFive: print('buzz') else: print(i) do_fizz_buzz()
__all__ = ["analyze_traffic", "utils", "manage_resolutions", "url_regex_resolver", "get_popular_urls", "funnel_in_outs", "funnel_stats", "sankey_funnel", "frequent_funnel", "analyze_clicks", "analyze_timing"]
__all__ = ['analyze_traffic', 'utils', 'manage_resolutions', 'url_regex_resolver', 'get_popular_urls', 'funnel_in_outs', 'funnel_stats', 'sankey_funnel', 'frequent_funnel', 'analyze_clicks', 'analyze_timing']
# # PySNMP MIB module CISCO-FCIP-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FCIP-MGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:41:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint") ciscoExperiment, = mibBuilder.importSymbols("CISCO-SMI", "ciscoExperiment") DomainId, FcNameIdOrZero, FcNameId = mibBuilder.importSymbols("CISCO-ST-TC", "DomainId", "FcNameIdOrZero", "FcNameId") InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") Integer32, ModuleIdentity, NotificationType, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Gauge32, Unsigned32, TimeTicks, IpAddress, MibIdentifier, Counter32, ObjectIdentity, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "ModuleIdentity", "NotificationType", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Gauge32", "Unsigned32", "TimeTicks", "IpAddress", "MibIdentifier", "Counter32", "ObjectIdentity", "iso") RowStatus, DisplayString, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TextualConvention", "TruthValue") ciscoFcipMgmtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 10, 96)) ciscoFcipMgmtMIB.setRevisions(('2003-05-19 00:00', '2002-10-05 00:00',)) if mibBuilder.loadTexts: ciscoFcipMgmtMIB.setLastUpdated('200305190000Z') if mibBuilder.loadTexts: ciscoFcipMgmtMIB.setOrganization('Cisco Systems Inc.') ciscoFcipObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1)) cfmFcipConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2)) cfmFcipConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1)) cfmFcipNotification = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2)) cfmFcipNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2, 0)) class CfmFcEntityMode(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("ePortMode", 1), ("bPortMode", 2), ("other", 3)) cfmFcipDynIpConfType = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("slpv2", 1), ("none", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfmFcipDynIpConfType.setStatus('current') cfmFcipFabricWWN = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 2), FcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipFabricWWN.setStatus('current') cfmFcipEntityInstanceTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3), ) if mibBuilder.loadTexts: cfmFcipEntityInstanceTable.setStatus('current') cfmFcipEntityInstanceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId")) if mibBuilder.loadTexts: cfmFcipEntityInstanceEntry.setStatus('current') cfmFcipEntityId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cfmFcipEntityId.setStatus('current') cfmFcipEntityAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 2), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntityAddressType.setStatus('current') cfmFcipEntityAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 3), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntityAddress.setStatus('current') cfmFcipEntityTcpConnPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntityTcpConnPort.setStatus('current') cfmFcipEntitySACKOption = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntitySACKOption.setStatus('current') cfmFcipEntitySeqNumWrap = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 6), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipEntitySeqNumWrap.setStatus('current') cfmFcipEntityPHBSupport = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 7), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipEntityPHBSupport.setStatus('current') cfmFcipEntityStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntityStatus.setStatus('current') cfmFcipLinkTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4), ) if mibBuilder.loadTexts: cfmFcipLinkTable.setStatus('current') cfmFcipLinkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIndex")) if mibBuilder.loadTexts: cfmFcipLinkEntry.setStatus('current') cfmFcipLinkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cfmFcipLinkIndex.setStatus('current') cfmFcipLinkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkIfIndex.setStatus('current') cfmFcipLinkCost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkCost.setStatus('current') cfmFcipLinkLocalFcipEntityMode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 4), CfmFcEntityMode()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkLocalFcipEntityMode.setStatus('current') cfmFcipLinkRemFcipEntityWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 5), FcNameIdOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityWWN.setStatus('current') cfmFcipLinkRemFcipEntityId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityId.setStatus('current') cfmFcipLinkRemFcipEntityAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 7), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityAddrType.setStatus('current') cfmFcipLinkRemFcipEntityAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 8), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityAddress.setStatus('current') cfmFcipLinkRemFcipEntityMode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 9), CfmFcEntityMode()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityMode.setStatus('current') cfmFcipLinkStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 10), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkStatus.setStatus('current') cfmFcipTcpConnTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5), ) if mibBuilder.loadTexts: cfmFcipTcpConnTable.setStatus('current') cfmFcipTcpConnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIndex"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnLocalPort"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnRemPort")) if mibBuilder.loadTexts: cfmFcipTcpConnEntry.setStatus('current') cfmFcipTcpConnLocalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))) if mibBuilder.loadTexts: cfmFcipTcpConnLocalPort.setStatus('current') cfmFcipTcpConnRemPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))) if mibBuilder.loadTexts: cfmFcipTcpConnRemPort.setStatus('current') cfmFcipTcpConnPurpose = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("control", 1), ("data", 2), ("both", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipTcpConnPurpose.setStatus('current') cfmFcipTcpConnRWSize = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipTcpConnRWSize.setStatus('current') cfmFcipTcpConnMSS = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 5), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipTcpConnMSS.setStatus('current') cfmFcipTcpConnTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 6), Unsigned32()).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipTcpConnTimeOut.setStatus('current') cfmFcipDynamicRouteTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6), ) if mibBuilder.loadTexts: cfmFcipDynamicRouteTable.setStatus('current') cfmFcipDynamicRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteDID"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteIndex")) if mibBuilder.loadTexts: cfmFcipDynamicRouteEntry.setStatus('current') cfmFcipDynamicRouteIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cfmFcipDynamicRouteIndex.setStatus('current') cfmFcipDynamicRouteDID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 2), DomainId()) if mibBuilder.loadTexts: cfmFcipDynamicRouteDID.setStatus('current') cfmFcipDynamicRouteLinkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipDynamicRouteLinkIndex.setStatus('current') cfmFcipStaticRouteTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7), ) if mibBuilder.loadTexts: cfmFcipStaticRouteTable.setStatus('current') cfmFcipStaticRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtDID"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtIndex")) if mibBuilder.loadTexts: cfmFcipStaticRouteEntry.setStatus('current') cfmFcipStaRtIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cfmFcipStaRtIndex.setStatus('current') cfmFcipStaRtDID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 2), DomainId()) if mibBuilder.loadTexts: cfmFcipStaRtDID.setStatus('current') cfmFcipStaRtRemFcipEntWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 3), FcNameId()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntWWN.setStatus('current') cfmFcipStaRtRemFcipEntId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 4), Unsigned32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntId.setStatus('current') cfmFcipStaRtRemFcipEntAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 5), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntAddrType.setStatus('current') cfmFcipStaRtRemFcipEntAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 6), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntAddr.setStatus('current') cfmFcipStaRtStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 7), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtStatus.setStatus('current') cfmFcipLinkErrorsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8), ) if mibBuilder.loadTexts: cfmFcipLinkErrorsTable.setStatus('current') cfmFcipLinkErrorsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIndex")) if mibBuilder.loadTexts: cfmFcipLinkErrorsEntry.setStatus('current') cfmFcipLinkFcipLossofFcSynchs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 1), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipLossofFcSynchs.setStatus('current') cfmFcipLinkFcipSfNotRcv = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfNotRcv.setStatus('current') cfmFcipLinkFcipSfRespNotRcv = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfRespNotRcv.setStatus('current') cfmFcipLinkFcipSfRespMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfRespMismatch.setStatus('current') cfmFcipLinkFcipSfInvalidNonce = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfInvalidNonce.setStatus('current') cfmFcipLinkFcipDuplicateSfRcv = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 6), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipDuplicateSfRcv.setStatus('current') cfmFcipLinkFcipSfInvalidWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfInvalidWWN.setStatus('current') cfmFcipLinkFcipBB2LkaTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipBB2LkaTimeOut.setStatus('current') cfmFcipLinkFcipSntpTimeStampExp = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSntpTimeStampExp.setStatus('current') cfmFcipLinkTcpTooManyErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkTcpTooManyErrors.setStatus('current') cfmFcipLinkTcpKeepAliveTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkTcpKeepAliveTimeOut.setStatus('current') cfmFcipLinkTcpExDatagramsDropped = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkTcpExDatagramsDropped.setStatus('current') cfmFcipLinkTcpSaParamMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 13), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkTcpSaParamMismatch.setStatus('current') cfmFcipCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1)) cfmFcipGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2)) cfmFcipCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1, 1)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityScalarGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityInstanceGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaticRouteGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkErrorsGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipCompliance = cfmFcipCompliance.setStatus('current') cfmFcipEntityScalarGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 1)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipDynIpConfType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipFabricWWN")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipEntityScalarGroup = cfmFcipEntityScalarGroup.setStatus('current') cfmFcipEntityInstanceGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 2)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityAddressType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityAddress"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityTcpConnPort"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntitySACKOption"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntitySeqNumWrap"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityPHBSupport"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipEntityInstanceGroup = cfmFcipEntityInstanceGroup.setStatus('current') cfmFcipLinkGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 3)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIfIndex"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkCost"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkLocalFcipEntityMode"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityWWN"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityId"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityAddrType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityAddress"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityMode"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipLinkGroup = cfmFcipLinkGroup.setStatus('current') cfmFcipTcpConnGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 4)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnPurpose"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnRWSize"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnMSS"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnTimeOut")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipTcpConnGroup = cfmFcipTcpConnGroup.setStatus('current') cfmFcipDynamicRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 5)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteLinkIndex")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipDynamicRouteGroup = cfmFcipDynamicRouteGroup.setStatus('current') cfmFcipStaticRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 6)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntWWN"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntId"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntAddrType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntAddr"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipStaticRouteGroup = cfmFcipStaticRouteGroup.setStatus('current') cfmFcipLinkErrorsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 7)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipLossofFcSynchs"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfNotRcv"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfRespNotRcv"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfRespMismatch"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfInvalidNonce"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipDuplicateSfRcv"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfInvalidWWN"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipBB2LkaTimeOut"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSntpTimeStampExp"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpTooManyErrors"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpKeepAliveTimeOut"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpExDatagramsDropped"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpSaParamMismatch")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipLinkErrorsGroup = cfmFcipLinkErrorsGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-FCIP-MGMT-MIB", cfmFcipLinkFcipBB2LkaTimeOut=cfmFcipLinkFcipBB2LkaTimeOut, PYSNMP_MODULE_ID=ciscoFcipMgmtMIB, cfmFcipLinkTable=cfmFcipLinkTable, cfmFcipStaRtRemFcipEntAddrType=cfmFcipStaRtRemFcipEntAddrType, cfmFcipLinkRemFcipEntityAddrType=cfmFcipLinkRemFcipEntityAddrType, cfmFcipTcpConnPurpose=cfmFcipTcpConnPurpose, cfmFcipEntityStatus=cfmFcipEntityStatus, cfmFcipLinkFcipSfInvalidWWN=cfmFcipLinkFcipSfInvalidWWN, cfmFcipTcpConnTimeOut=cfmFcipTcpConnTimeOut, cfmFcipLinkTcpTooManyErrors=cfmFcipLinkTcpTooManyErrors, cfmFcipLinkGroup=cfmFcipLinkGroup, cfmFcipLinkEntry=cfmFcipLinkEntry, cfmFcipEntityAddress=cfmFcipEntityAddress, cfmFcipStaRtDID=cfmFcipStaRtDID, cfmFcipLinkErrorsEntry=cfmFcipLinkErrorsEntry, cfmFcipFabricWWN=cfmFcipFabricWWN, cfmFcipCompliance=cfmFcipCompliance, cfmFcipDynamicRouteEntry=cfmFcipDynamicRouteEntry, cfmFcipTcpConnEntry=cfmFcipTcpConnEntry, cfmFcipGroups=cfmFcipGroups, cfmFcipDynamicRouteDID=cfmFcipDynamicRouteDID, CfmFcEntityMode=CfmFcEntityMode, cfmFcipLinkStatus=cfmFcipLinkStatus, cfmFcipNotifications=cfmFcipNotifications, cfmFcipLinkRemFcipEntityId=cfmFcipLinkRemFcipEntityId, cfmFcipTcpConnGroup=cfmFcipTcpConnGroup, cfmFcipTcpConnMSS=cfmFcipTcpConnMSS, cfmFcipStaRtRemFcipEntAddr=cfmFcipStaRtRemFcipEntAddr, cfmFcipLinkErrorsTable=cfmFcipLinkErrorsTable, cfmFcipEntityPHBSupport=cfmFcipEntityPHBSupport, cfmFcipTcpConnRemPort=cfmFcipTcpConnRemPort, cfmFcipDynamicRouteTable=cfmFcipDynamicRouteTable, cfmFcipLinkLocalFcipEntityMode=cfmFcipLinkLocalFcipEntityMode, ciscoFcipMgmtMIB=ciscoFcipMgmtMIB, cfmFcipLinkFcipSfRespNotRcv=cfmFcipLinkFcipSfRespNotRcv, cfmFcipEntityId=cfmFcipEntityId, cfmFcipLinkTcpSaParamMismatch=cfmFcipLinkTcpSaParamMismatch, cfmFcipLinkFcipDuplicateSfRcv=cfmFcipLinkFcipDuplicateSfRcv, cfmFcipEntityInstanceTable=cfmFcipEntityInstanceTable, cfmFcipConfig=cfmFcipConfig, cfmFcipEntityAddressType=cfmFcipEntityAddressType, cfmFcipLinkFcipSntpTimeStampExp=cfmFcipLinkFcipSntpTimeStampExp, cfmFcipLinkFcipSfInvalidNonce=cfmFcipLinkFcipSfInvalidNonce, ciscoFcipObjects=ciscoFcipObjects, cfmFcipDynamicRouteLinkIndex=cfmFcipDynamicRouteLinkIndex, cfmFcipTcpConnLocalPort=cfmFcipTcpConnLocalPort, cfmFcipEntitySeqNumWrap=cfmFcipEntitySeqNumWrap, cfmFcipLinkRemFcipEntityWWN=cfmFcipLinkRemFcipEntityWWN, cfmFcipConformance=cfmFcipConformance, cfmFcipTcpConnRWSize=cfmFcipTcpConnRWSize, cfmFcipStaRtIndex=cfmFcipStaRtIndex, cfmFcipLinkRemFcipEntityAddress=cfmFcipLinkRemFcipEntityAddress, cfmFcipNotification=cfmFcipNotification, cfmFcipLinkTcpKeepAliveTimeOut=cfmFcipLinkTcpKeepAliveTimeOut, cfmFcipEntitySACKOption=cfmFcipEntitySACKOption, cfmFcipDynIpConfType=cfmFcipDynIpConfType, cfmFcipStaRtRemFcipEntWWN=cfmFcipStaRtRemFcipEntWWN, cfmFcipLinkFcipSfRespMismatch=cfmFcipLinkFcipSfRespMismatch, cfmFcipLinkFcipLossofFcSynchs=cfmFcipLinkFcipLossofFcSynchs, cfmFcipEntityInstanceEntry=cfmFcipEntityInstanceEntry, cfmFcipLinkTcpExDatagramsDropped=cfmFcipLinkTcpExDatagramsDropped, cfmFcipStaticRouteEntry=cfmFcipStaticRouteEntry, cfmFcipEntityScalarGroup=cfmFcipEntityScalarGroup, cfmFcipLinkRemFcipEntityMode=cfmFcipLinkRemFcipEntityMode, cfmFcipCompliances=cfmFcipCompliances, cfmFcipLinkIndex=cfmFcipLinkIndex, cfmFcipTcpConnTable=cfmFcipTcpConnTable, cfmFcipLinkCost=cfmFcipLinkCost, cfmFcipStaRtStatus=cfmFcipStaRtStatus, cfmFcipDynamicRouteGroup=cfmFcipDynamicRouteGroup, cfmFcipDynamicRouteIndex=cfmFcipDynamicRouteIndex, cfmFcipLinkFcipSfNotRcv=cfmFcipLinkFcipSfNotRcv, cfmFcipEntityTcpConnPort=cfmFcipEntityTcpConnPort, cfmFcipEntityInstanceGroup=cfmFcipEntityInstanceGroup, cfmFcipStaticRouteGroup=cfmFcipStaticRouteGroup, cfmFcipLinkErrorsGroup=cfmFcipLinkErrorsGroup, cfmFcipLinkIfIndex=cfmFcipLinkIfIndex, cfmFcipStaRtRemFcipEntId=cfmFcipStaRtRemFcipEntId, cfmFcipStaticRouteTable=cfmFcipStaticRouteTable)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint') (cisco_experiment,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoExperiment') (domain_id, fc_name_id_or_zero, fc_name_id) = mibBuilder.importSymbols('CISCO-ST-TC', 'DomainId', 'FcNameIdOrZero', 'FcNameId') (inet_address, inet_address_type) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddress', 'InetAddressType') (object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup') (integer32, module_identity, notification_type, counter64, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, gauge32, unsigned32, time_ticks, ip_address, mib_identifier, counter32, object_identity, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'ModuleIdentity', 'NotificationType', 'Counter64', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'Gauge32', 'Unsigned32', 'TimeTicks', 'IpAddress', 'MibIdentifier', 'Counter32', 'ObjectIdentity', 'iso') (row_status, display_string, textual_convention, truth_value) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'DisplayString', 'TextualConvention', 'TruthValue') cisco_fcip_mgmt_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 10, 96)) ciscoFcipMgmtMIB.setRevisions(('2003-05-19 00:00', '2002-10-05 00:00')) if mibBuilder.loadTexts: ciscoFcipMgmtMIB.setLastUpdated('200305190000Z') if mibBuilder.loadTexts: ciscoFcipMgmtMIB.setOrganization('Cisco Systems Inc.') cisco_fcip_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1)) cfm_fcip_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2)) cfm_fcip_config = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1)) cfm_fcip_notification = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2)) cfm_fcip_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2, 0)) class Cfmfcentitymode(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3)) named_values = named_values(('ePortMode', 1), ('bPortMode', 2), ('other', 3)) cfm_fcip_dyn_ip_conf_type = mib_scalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('slpv2', 1), ('none', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfmFcipDynIpConfType.setStatus('current') cfm_fcip_fabric_wwn = mib_scalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 2), fc_name_id_or_zero()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipFabricWWN.setStatus('current') cfm_fcip_entity_instance_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3)) if mibBuilder.loadTexts: cfmFcipEntityInstanceTable.setStatus('current') cfm_fcip_entity_instance_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId')) if mibBuilder.loadTexts: cfmFcipEntityInstanceEntry.setStatus('current') cfm_fcip_entity_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 1), unsigned32()) if mibBuilder.loadTexts: cfmFcipEntityId.setStatus('current') cfm_fcip_entity_address_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 2), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipEntityAddressType.setStatus('current') cfm_fcip_entity_address = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 3), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipEntityAddress.setStatus('current') cfm_fcip_entity_tcp_conn_port = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipEntityTcpConnPort.setStatus('current') cfm_fcip_entity_sack_option = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipEntitySACKOption.setStatus('current') cfm_fcip_entity_seq_num_wrap = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 6), truth_value()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipEntitySeqNumWrap.setStatus('current') cfm_fcip_entity_phb_support = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 7), truth_value()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipEntityPHBSupport.setStatus('current') cfm_fcip_entity_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 8), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipEntityStatus.setStatus('current') cfm_fcip_link_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4)) if mibBuilder.loadTexts: cfmFcipLinkTable.setStatus('current') cfm_fcip_link_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkIndex')) if mibBuilder.loadTexts: cfmFcipLinkEntry.setStatus('current') cfm_fcip_link_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 1), unsigned32()) if mibBuilder.loadTexts: cfmFcipLinkIndex.setStatus('current') cfm_fcip_link_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkIfIndex.setStatus('current') cfm_fcip_link_cost = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipLinkCost.setStatus('current') cfm_fcip_link_local_fcip_entity_mode = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 4), cfm_fc_entity_mode()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkLocalFcipEntityMode.setStatus('current') cfm_fcip_link_rem_fcip_entity_wwn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 5), fc_name_id_or_zero()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityWWN.setStatus('current') cfm_fcip_link_rem_fcip_entity_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityId.setStatus('current') cfm_fcip_link_rem_fcip_entity_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 7), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityAddrType.setStatus('current') cfm_fcip_link_rem_fcip_entity_address = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 8), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityAddress.setStatus('current') cfm_fcip_link_rem_fcip_entity_mode = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 9), cfm_fc_entity_mode()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityMode.setStatus('current') cfm_fcip_link_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 10), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipLinkStatus.setStatus('current') cfm_fcip_tcp_conn_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5)) if mibBuilder.loadTexts: cfmFcipTcpConnTable.setStatus('current') cfm_fcip_tcp_conn_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkIndex'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnLocalPort'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnRemPort')) if mibBuilder.loadTexts: cfmFcipTcpConnEntry.setStatus('current') cfm_fcip_tcp_conn_local_port = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))) if mibBuilder.loadTexts: cfmFcipTcpConnLocalPort.setStatus('current') cfm_fcip_tcp_conn_rem_port = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))) if mibBuilder.loadTexts: cfmFcipTcpConnRemPort.setStatus('current') cfm_fcip_tcp_conn_purpose = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('control', 1), ('data', 2), ('both', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipTcpConnPurpose.setStatus('current') cfm_fcip_tcp_conn_rw_size = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 4), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipTcpConnRWSize.setStatus('current') cfm_fcip_tcp_conn_mss = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 5), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipTcpConnMSS.setStatus('current') cfm_fcip_tcp_conn_time_out = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 6), unsigned32()).setUnits('seconds').setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipTcpConnTimeOut.setStatus('current') cfm_fcip_dynamic_route_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6)) if mibBuilder.loadTexts: cfmFcipDynamicRouteTable.setStatus('current') cfm_fcip_dynamic_route_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipDynamicRouteDID'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipDynamicRouteIndex')) if mibBuilder.loadTexts: cfmFcipDynamicRouteEntry.setStatus('current') cfm_fcip_dynamic_route_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 1), unsigned32()) if mibBuilder.loadTexts: cfmFcipDynamicRouteIndex.setStatus('current') cfm_fcip_dynamic_route_did = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 2), domain_id()) if mibBuilder.loadTexts: cfmFcipDynamicRouteDID.setStatus('current') cfm_fcip_dynamic_route_link_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 3), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipDynamicRouteLinkIndex.setStatus('current') cfm_fcip_static_route_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7)) if mibBuilder.loadTexts: cfmFcipStaticRouteTable.setStatus('current') cfm_fcip_static_route_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtDID'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtIndex')) if mibBuilder.loadTexts: cfmFcipStaticRouteEntry.setStatus('current') cfm_fcip_sta_rt_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 1), unsigned32()) if mibBuilder.loadTexts: cfmFcipStaRtIndex.setStatus('current') cfm_fcip_sta_rt_did = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 2), domain_id()) if mibBuilder.loadTexts: cfmFcipStaRtDID.setStatus('current') cfm_fcip_sta_rt_rem_fcip_ent_wwn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 3), fc_name_id()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntWWN.setStatus('current') cfm_fcip_sta_rt_rem_fcip_ent_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 4), unsigned32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntId.setStatus('current') cfm_fcip_sta_rt_rem_fcip_ent_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 5), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntAddrType.setStatus('current') cfm_fcip_sta_rt_rem_fcip_ent_addr = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 6), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntAddr.setStatus('current') cfm_fcip_sta_rt_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 7), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: cfmFcipStaRtStatus.setStatus('current') cfm_fcip_link_errors_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8)) if mibBuilder.loadTexts: cfmFcipLinkErrorsTable.setStatus('current') cfm_fcip_link_errors_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkIndex')) if mibBuilder.loadTexts: cfmFcipLinkErrorsEntry.setStatus('current') cfm_fcip_link_fcip_lossof_fc_synchs = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 1), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkFcipLossofFcSynchs.setStatus('current') cfm_fcip_link_fcip_sf_not_rcv = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 2), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkFcipSfNotRcv.setStatus('current') cfm_fcip_link_fcip_sf_resp_not_rcv = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 3), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkFcipSfRespNotRcv.setStatus('current') cfm_fcip_link_fcip_sf_resp_mismatch = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 4), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkFcipSfRespMismatch.setStatus('current') cfm_fcip_link_fcip_sf_invalid_nonce = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 5), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkFcipSfInvalidNonce.setStatus('current') cfm_fcip_link_fcip_duplicate_sf_rcv = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 6), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkFcipDuplicateSfRcv.setStatus('current') cfm_fcip_link_fcip_sf_invalid_wwn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 7), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkFcipSfInvalidWWN.setStatus('current') cfm_fcip_link_fcip_bb2_lka_time_out = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 8), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkFcipBB2LkaTimeOut.setStatus('current') cfm_fcip_link_fcip_sntp_time_stamp_exp = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 9), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkFcipSntpTimeStampExp.setStatus('current') cfm_fcip_link_tcp_too_many_errors = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 10), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkTcpTooManyErrors.setStatus('current') cfm_fcip_link_tcp_keep_alive_time_out = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 11), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkTcpKeepAliveTimeOut.setStatus('current') cfm_fcip_link_tcp_ex_datagrams_dropped = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 12), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkTcpExDatagramsDropped.setStatus('current') cfm_fcip_link_tcp_sa_param_mismatch = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 13), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfmFcipLinkTcpSaParamMismatch.setStatus('current') cfm_fcip_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1)) cfm_fcip_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2)) cfm_fcip_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1, 1)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityScalarGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityInstanceGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipDynamicRouteGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaticRouteGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkErrorsGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfm_fcip_compliance = cfmFcipCompliance.setStatus('current') cfm_fcip_entity_scalar_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 1)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipDynIpConfType'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipFabricWWN')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfm_fcip_entity_scalar_group = cfmFcipEntityScalarGroup.setStatus('current') cfm_fcip_entity_instance_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 2)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityAddressType'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityAddress'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityTcpConnPort'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntitySACKOption'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntitySeqNumWrap'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityPHBSupport'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfm_fcip_entity_instance_group = cfmFcipEntityInstanceGroup.setStatus('current') cfm_fcip_link_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 3)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkIfIndex'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkCost'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkLocalFcipEntityMode'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityWWN'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityId'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityAddrType'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityAddress'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityMode'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfm_fcip_link_group = cfmFcipLinkGroup.setStatus('current') cfm_fcip_tcp_conn_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 4)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnPurpose'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnRWSize'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnMSS'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnTimeOut')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfm_fcip_tcp_conn_group = cfmFcipTcpConnGroup.setStatus('current') cfm_fcip_dynamic_route_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 5)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipDynamicRouteLinkIndex')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfm_fcip_dynamic_route_group = cfmFcipDynamicRouteGroup.setStatus('current') cfm_fcip_static_route_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 6)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtRemFcipEntWWN'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtRemFcipEntId'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtRemFcipEntAddrType'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtRemFcipEntAddr'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfm_fcip_static_route_group = cfmFcipStaticRouteGroup.setStatus('current') cfm_fcip_link_errors_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 7)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipLossofFcSynchs'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfNotRcv'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfRespNotRcv'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfRespMismatch'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfInvalidNonce'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipDuplicateSfRcv'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfInvalidWWN'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipBB2LkaTimeOut'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSntpTimeStampExp'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkTcpTooManyErrors'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkTcpKeepAliveTimeOut'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkTcpExDatagramsDropped'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkTcpSaParamMismatch')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfm_fcip_link_errors_group = cfmFcipLinkErrorsGroup.setStatus('current') mibBuilder.exportSymbols('CISCO-FCIP-MGMT-MIB', cfmFcipLinkFcipBB2LkaTimeOut=cfmFcipLinkFcipBB2LkaTimeOut, PYSNMP_MODULE_ID=ciscoFcipMgmtMIB, cfmFcipLinkTable=cfmFcipLinkTable, cfmFcipStaRtRemFcipEntAddrType=cfmFcipStaRtRemFcipEntAddrType, cfmFcipLinkRemFcipEntityAddrType=cfmFcipLinkRemFcipEntityAddrType, cfmFcipTcpConnPurpose=cfmFcipTcpConnPurpose, cfmFcipEntityStatus=cfmFcipEntityStatus, cfmFcipLinkFcipSfInvalidWWN=cfmFcipLinkFcipSfInvalidWWN, cfmFcipTcpConnTimeOut=cfmFcipTcpConnTimeOut, cfmFcipLinkTcpTooManyErrors=cfmFcipLinkTcpTooManyErrors, cfmFcipLinkGroup=cfmFcipLinkGroup, cfmFcipLinkEntry=cfmFcipLinkEntry, cfmFcipEntityAddress=cfmFcipEntityAddress, cfmFcipStaRtDID=cfmFcipStaRtDID, cfmFcipLinkErrorsEntry=cfmFcipLinkErrorsEntry, cfmFcipFabricWWN=cfmFcipFabricWWN, cfmFcipCompliance=cfmFcipCompliance, cfmFcipDynamicRouteEntry=cfmFcipDynamicRouteEntry, cfmFcipTcpConnEntry=cfmFcipTcpConnEntry, cfmFcipGroups=cfmFcipGroups, cfmFcipDynamicRouteDID=cfmFcipDynamicRouteDID, CfmFcEntityMode=CfmFcEntityMode, cfmFcipLinkStatus=cfmFcipLinkStatus, cfmFcipNotifications=cfmFcipNotifications, cfmFcipLinkRemFcipEntityId=cfmFcipLinkRemFcipEntityId, cfmFcipTcpConnGroup=cfmFcipTcpConnGroup, cfmFcipTcpConnMSS=cfmFcipTcpConnMSS, cfmFcipStaRtRemFcipEntAddr=cfmFcipStaRtRemFcipEntAddr, cfmFcipLinkErrorsTable=cfmFcipLinkErrorsTable, cfmFcipEntityPHBSupport=cfmFcipEntityPHBSupport, cfmFcipTcpConnRemPort=cfmFcipTcpConnRemPort, cfmFcipDynamicRouteTable=cfmFcipDynamicRouteTable, cfmFcipLinkLocalFcipEntityMode=cfmFcipLinkLocalFcipEntityMode, ciscoFcipMgmtMIB=ciscoFcipMgmtMIB, cfmFcipLinkFcipSfRespNotRcv=cfmFcipLinkFcipSfRespNotRcv, cfmFcipEntityId=cfmFcipEntityId, cfmFcipLinkTcpSaParamMismatch=cfmFcipLinkTcpSaParamMismatch, cfmFcipLinkFcipDuplicateSfRcv=cfmFcipLinkFcipDuplicateSfRcv, cfmFcipEntityInstanceTable=cfmFcipEntityInstanceTable, cfmFcipConfig=cfmFcipConfig, cfmFcipEntityAddressType=cfmFcipEntityAddressType, cfmFcipLinkFcipSntpTimeStampExp=cfmFcipLinkFcipSntpTimeStampExp, cfmFcipLinkFcipSfInvalidNonce=cfmFcipLinkFcipSfInvalidNonce, ciscoFcipObjects=ciscoFcipObjects, cfmFcipDynamicRouteLinkIndex=cfmFcipDynamicRouteLinkIndex, cfmFcipTcpConnLocalPort=cfmFcipTcpConnLocalPort, cfmFcipEntitySeqNumWrap=cfmFcipEntitySeqNumWrap, cfmFcipLinkRemFcipEntityWWN=cfmFcipLinkRemFcipEntityWWN, cfmFcipConformance=cfmFcipConformance, cfmFcipTcpConnRWSize=cfmFcipTcpConnRWSize, cfmFcipStaRtIndex=cfmFcipStaRtIndex, cfmFcipLinkRemFcipEntityAddress=cfmFcipLinkRemFcipEntityAddress, cfmFcipNotification=cfmFcipNotification, cfmFcipLinkTcpKeepAliveTimeOut=cfmFcipLinkTcpKeepAliveTimeOut, cfmFcipEntitySACKOption=cfmFcipEntitySACKOption, cfmFcipDynIpConfType=cfmFcipDynIpConfType, cfmFcipStaRtRemFcipEntWWN=cfmFcipStaRtRemFcipEntWWN, cfmFcipLinkFcipSfRespMismatch=cfmFcipLinkFcipSfRespMismatch, cfmFcipLinkFcipLossofFcSynchs=cfmFcipLinkFcipLossofFcSynchs, cfmFcipEntityInstanceEntry=cfmFcipEntityInstanceEntry, cfmFcipLinkTcpExDatagramsDropped=cfmFcipLinkTcpExDatagramsDropped, cfmFcipStaticRouteEntry=cfmFcipStaticRouteEntry, cfmFcipEntityScalarGroup=cfmFcipEntityScalarGroup, cfmFcipLinkRemFcipEntityMode=cfmFcipLinkRemFcipEntityMode, cfmFcipCompliances=cfmFcipCompliances, cfmFcipLinkIndex=cfmFcipLinkIndex, cfmFcipTcpConnTable=cfmFcipTcpConnTable, cfmFcipLinkCost=cfmFcipLinkCost, cfmFcipStaRtStatus=cfmFcipStaRtStatus, cfmFcipDynamicRouteGroup=cfmFcipDynamicRouteGroup, cfmFcipDynamicRouteIndex=cfmFcipDynamicRouteIndex, cfmFcipLinkFcipSfNotRcv=cfmFcipLinkFcipSfNotRcv, cfmFcipEntityTcpConnPort=cfmFcipEntityTcpConnPort, cfmFcipEntityInstanceGroup=cfmFcipEntityInstanceGroup, cfmFcipStaticRouteGroup=cfmFcipStaticRouteGroup, cfmFcipLinkErrorsGroup=cfmFcipLinkErrorsGroup, cfmFcipLinkIfIndex=cfmFcipLinkIfIndex, cfmFcipStaRtRemFcipEntId=cfmFcipStaRtRemFcipEntId, cfmFcipStaticRouteTable=cfmFcipStaticRouteTable)
class unionFindSet: def __init__(self, S): self.S = {i: i for i in S} self.size = {i: 1 for i in S} def find(self, x): if x != self.S[x]: self.S[x] = self.find(self.S[x]) return self.S[x] def union(self, a, b, key=lambda x: x): x, y = sorted((self.find(a), self.find(b)), key=key) self.S[y] = x if x != y: self.size[x] += self.size[y] def getSize(self, x): return self.size[self.find(x)]
class Unionfindset: def __init__(self, S): self.S = {i: i for i in S} self.size = {i: 1 for i in S} def find(self, x): if x != self.S[x]: self.S[x] = self.find(self.S[x]) return self.S[x] def union(self, a, b, key=lambda x: x): (x, y) = sorted((self.find(a), self.find(b)), key=key) self.S[y] = x if x != y: self.size[x] += self.size[y] def get_size(self, x): return self.size[self.find(x)]
registered = False api_key = None environment = None log_404 = False log_403 = False log_405 = False use_ssl = False
registered = False api_key = None environment = None log_404 = False log_403 = False log_405 = False use_ssl = False
pytest_plugins = [ "polygon.tests.fixtures", "polygon.plugins.tests.fixtures", "polygon.graphql.tests.fixtures", ]
pytest_plugins = ['polygon.tests.fixtures', 'polygon.plugins.tests.fixtures', 'polygon.graphql.tests.fixtures']
ry = 0 def setup(): size(800, 800, P3D) global obj, texture1 texture1 = loadImage("texture.jpg") obj = loadShape("man.obj") def draw(): global ry background(0) lights() translate(width / 2, height / 2 + 200, -200) rotateZ(PI) rotateY(ry) scale(25) # Orange point light on the right pointLight(150, 100, 0, # Color 200, -150, 0) # Position # Blue directional light from the left directionalLight(0, 102, 255, # Color 1, 0, 0) # The x-, y-, z-axis direction # Yellow spotlight from the front spotLight(255, 255, 109, # Color 0, 40, 200, # Position 0, 10, 5, # Direction 90, 2) # Angle, concentration ambientLight(255, 0, 0); texture(texture1) shape(obj) box(100, 100, 200) ry += 0.02
ry = 0 def setup(): size(800, 800, P3D) global obj, texture1 texture1 = load_image('texture.jpg') obj = load_shape('man.obj') def draw(): global ry background(0) lights() translate(width / 2, height / 2 + 200, -200) rotate_z(PI) rotate_y(ry) scale(25) point_light(150, 100, 0, 200, -150, 0) directional_light(0, 102, 255, 1, 0, 0) spot_light(255, 255, 109, 0, 40, 200, 0, 10, 5, 90, 2) ambient_light(255, 0, 0) texture(texture1) shape(obj) box(100, 100, 200) ry += 0.02
def ft_filter(function_to_apply, list_of_inputs): for elem in list_of_inputs: res = function_to_apply(elem) if res is True: yield elem
def ft_filter(function_to_apply, list_of_inputs): for elem in list_of_inputs: res = function_to_apply(elem) if res is True: yield elem
STX: bytes = b"\x02" # Start of text, indicates the start of a message. ETX: bytes = b"\x03" # End of text, indicates the end of a message ENQ: bytes = b"\x05" # Enquiry about the PC interface being ready to receive a new message. ACK: bytes = b"\x06" # Positive acknowledgement to a PMS message or enquiry (ENQ). NAK: bytes = b"\x15" # Negative acknowledgement to a PMS message or enquiry (ENQ). LRC_SKIP: bytes = b"\x0D" # The PMS can avoid LRC calculation by sending a 0DH value (return character) def lrc(message: bytes) -> bytes: result = 0 for b in message + ETX: # LRC message must not include STX and should include ETX result ^= b return bytes([result])
stx: bytes = b'\x02' etx: bytes = b'\x03' enq: bytes = b'\x05' ack: bytes = b'\x06' nak: bytes = b'\x15' lrc_skip: bytes = b'\r' def lrc(message: bytes) -> bytes: result = 0 for b in message + ETX: result ^= b return bytes([result])
class Interval: def __init__(self, start, end): if start < end: self.start = start self.end = end else: self.start = end self.end = start def overlap(self, other): if self.start > other.start and self.start < other.end: return True if self.end > other.start and self.end < other.end: return True return False def __repr__(self): return "Interval(start={}, end={})".format(self.start, self.end) def __add__(self, other): return Interval(start=min(self.start, other.start), end=max(self.end, other.end))
class Interval: def __init__(self, start, end): if start < end: self.start = start self.end = end else: self.start = end self.end = start def overlap(self, other): if self.start > other.start and self.start < other.end: return True if self.end > other.start and self.end < other.end: return True return False def __repr__(self): return 'Interval(start={}, end={})'.format(self.start, self.end) def __add__(self, other): return interval(start=min(self.start, other.start), end=max(self.end, other.end))
# create a loop counter = 10 while counter > 0: print(counter) counter = counter -1 print('Blastoff!!')
counter = 10 while counter > 0: print(counter) counter = counter - 1 print('Blastoff!!')
# Hacer un programa que pida un caracter e indique si es una boca o no caracter = input("Digite un caracter: ").lower()# para mayusculas #caracter = caracter.lower() #caracter = caracter.upper() if caracter =="a" or caracter =="b" or caracter =="c" or caracter =="d" or caracter =="e": print("Es Una vocal") else: print("No es una vocal")
caracter = input('Digite un caracter: ').lower() if caracter == 'a' or caracter == 'b' or caracter == 'c' or (caracter == 'd') or (caracter == 'e'): print('Es Una vocal') else: print('No es una vocal')
grocery_list = ["fish", "tomato", "apples"] # Create new list print("tomato" in grocery_list) # Check that grocery_list contains "tomato" item grocery_dict = {"fish": 1, "tomato": 6, "apples": 3} # create new dictionary print("fish" in grocery_dict)
grocery_list = ['fish', 'tomato', 'apples'] print('tomato' in grocery_list) grocery_dict = {'fish': 1, 'tomato': 6, 'apples': 3} print('fish' in grocery_dict)
def _impl(ctx): args = [ctx.outputs.out.path] + [f.path for f in ctx.files.chunks] args_file = ctx.actions.declare_file(ctx.label.name + ".args") ctx.actions.write( output = args_file, content = "\n".join(args), ) ctx.actions.run( mnemonic = "Concat", inputs = ctx.files.chunks + [args_file], outputs = [ctx.outputs.out], arguments = ["@" + args_file.path], executable = ctx.executable.merge_tool, execution_requirements = { "supports-workers": "1", "requires-worker-protocol": "json", }, ) concat = rule( implementation = _impl, attrs = { "chunks": attr.label_list(allow_files = True), "out": attr.output(mandatory = True), "merge_tool": attr.label( executable = True, cfg = "exec", allow_files = True, default = Label("//:persistent_worker"), ), }, )
def _impl(ctx): args = [ctx.outputs.out.path] + [f.path for f in ctx.files.chunks] args_file = ctx.actions.declare_file(ctx.label.name + '.args') ctx.actions.write(output=args_file, content='\n'.join(args)) ctx.actions.run(mnemonic='Concat', inputs=ctx.files.chunks + [args_file], outputs=[ctx.outputs.out], arguments=['@' + args_file.path], executable=ctx.executable.merge_tool, execution_requirements={'supports-workers': '1', 'requires-worker-protocol': 'json'}) concat = rule(implementation=_impl, attrs={'chunks': attr.label_list(allow_files=True), 'out': attr.output(mandatory=True), 'merge_tool': attr.label(executable=True, cfg='exec', allow_files=True, default=label('//:persistent_worker'))})
k = int(input()) r = list(map(int, input().split())) p = set(r) # stores the sum of all unique elements x total no of groups a = sum(p)*k # stores the sum of element in the list b = sum(r) # (a - b) = (k - 1)*captains_room_no # prints the the difference of a and b divided by k-1 print((a-b)//(k-1))
k = int(input()) r = list(map(int, input().split())) p = set(r) a = sum(p) * k b = sum(r) print((a - b) // (k - 1))
def swap(arr, i, j): temp = arr[i] arr[i] = arr[j] arr[j] = temp def selectionSort(arr): for i in range(len(arr)): smallest = arr[i] for j in range(i+1, len(arr)): print(i) if smallest > arr[j]: print(f"replacing {j} th position with {i}th position") swap(arr, j, i) smallest = arr[i] else: print('This is the smallest') return arr # Driver code array = [10, 7, 8, 9, 1, 5] print(f'Given array: {array}') selectionSort(array) print(f'Sorted array: {array}')
def swap(arr, i, j): temp = arr[i] arr[i] = arr[j] arr[j] = temp def selection_sort(arr): for i in range(len(arr)): smallest = arr[i] for j in range(i + 1, len(arr)): print(i) if smallest > arr[j]: print(f'replacing {j} th position with {i}th position') swap(arr, j, i) smallest = arr[i] else: print('This is the smallest') return arr array = [10, 7, 8, 9, 1, 5] print(f'Given array: {array}') selection_sort(array) print(f'Sorted array: {array}')
with open('input.txt', 'r') as reader: input = [line for line in reader.read().splitlines()] def part1(numbers): length = len(numbers[0]) sums = [0] * length for number in numbers: for i in range(length): sums[i] += int(number[i]) gamma = [1 if v > len(numbers) / 2 else 0 for v in sums] gammaV = bin_arr_to_int(gamma) return gammaV * (gammaV ^ int("".join([str(1)]*length), 2)) def part2(numbers): idx = range(len(numbers)) current = 0 while(len(idx) > 1): sum_current = sum([int(numbers[i][current]) for i in idx]) most_common = "1" if sum_current >= len(idx)/ 2 else "0" idx = list(filter(lambda i: numbers[i][current] == most_common, idx)) current += 1 oxygen_generator_rating = bin_arr_to_int(numbers[idx[0]]) idx = range(len(numbers)) current = 0 while(len(idx) > 1): sum_current = sum([int(numbers[i][current]) for i in idx]) least_common = "1" if sum_current < len(idx)/ 2 else "0" idx = list(filter(lambda i: numbers[i][current] == least_common, idx)) current += 1 CO2_scrubber_rating = bin_arr_to_int(numbers[idx[0]]) return oxygen_generator_rating * CO2_scrubber_rating def bin_arr_to_int(binary): return int("".join([str(v) for v in binary]), 2) print(part1(input)) print(part2(input))
with open('input.txt', 'r') as reader: input = [line for line in reader.read().splitlines()] def part1(numbers): length = len(numbers[0]) sums = [0] * length for number in numbers: for i in range(length): sums[i] += int(number[i]) gamma = [1 if v > len(numbers) / 2 else 0 for v in sums] gamma_v = bin_arr_to_int(gamma) return gammaV * (gammaV ^ int(''.join([str(1)] * length), 2)) def part2(numbers): idx = range(len(numbers)) current = 0 while len(idx) > 1: sum_current = sum([int(numbers[i][current]) for i in idx]) most_common = '1' if sum_current >= len(idx) / 2 else '0' idx = list(filter(lambda i: numbers[i][current] == most_common, idx)) current += 1 oxygen_generator_rating = bin_arr_to_int(numbers[idx[0]]) idx = range(len(numbers)) current = 0 while len(idx) > 1: sum_current = sum([int(numbers[i][current]) for i in idx]) least_common = '1' if sum_current < len(idx) / 2 else '0' idx = list(filter(lambda i: numbers[i][current] == least_common, idx)) current += 1 co2_scrubber_rating = bin_arr_to_int(numbers[idx[0]]) return oxygen_generator_rating * CO2_scrubber_rating def bin_arr_to_int(binary): return int(''.join([str(v) for v in binary]), 2) print(part1(input)) print(part2(input))
def sieve(n): checkArray = [1] * (n+1) checkArray[0] = 0 checkArray[1] = 0 for i in range(2,n+1): j = i + i step = j + i for j in range(j,n+1,i): checkArray[j] = 0 for i in range(0,n+1): if checkArray[i] != 0: print(i) if __name__ == "__main__": n = int(input()) sieve(n)
def sieve(n): check_array = [1] * (n + 1) checkArray[0] = 0 checkArray[1] = 0 for i in range(2, n + 1): j = i + i step = j + i for j in range(j, n + 1, i): checkArray[j] = 0 for i in range(0, n + 1): if checkArray[i] != 0: print(i) if __name__ == '__main__': n = int(input()) sieve(n)
#Printing 'reverse Pyramid Shape ! ''' * * * * * * * * * * * * * * * ''' n=int(input()) for i in range(n,0,-1): #for rows for j in range(0,n-i): # for space print(end=' ') for j in range(0,i): # creating star print("*",end=' ') print() #other method n=int(input()) for i in range(n, 0, -1): print(' ' * (n - i) + '* ' * (i))
""" * * * * * * * * * * * * * * * """ n = int(input()) for i in range(n, 0, -1): for j in range(0, n - i): print(end=' ') for j in range(0, i): print('*', end=' ') print() n = int(input()) for i in range(n, 0, -1): print(' ' * (n - i) + '* ' * i)
class StepParseError(Exception): pass class RatDisconnectedError(Exception): pass class InvalidTimeoutExceptionError(Exception): pass class RatCallbackTimeoutError(Exception): pass class MissingFileError(Exception): pass
class Stepparseerror(Exception): pass class Ratdisconnectederror(Exception): pass class Invalidtimeoutexceptionerror(Exception): pass class Ratcallbacktimeouterror(Exception): pass class Missingfileerror(Exception): pass
def max_of_maximums(dTEmax, dsRNAmax): print('Finding max of maximums') dmax = {} for i in list(dTEmax.keys()): for j in list(dsRNAmax.keys()): try: dTEmax[j] except: dmax[j] = dsRNAmax[j] else: dmax[j] = max(dTEmax[j], dsRNAmax[j]) try: dsRNAmax[i] except: dmax[i] = dTEmax[i] # if no i in dsRNAmax else: # if scaffold is present in both dictionaries, find the max between them, i and j should be same dmax[i] = max(dTEmax[i], dsRNAmax[i]) for k, v in list(dmax.items()): if v == 0: print(k) return dmax def max_coords_per_scaffold(d): print('Calcualting maximum coordinates per scaffold') dmax_coords = {} dscaff_max = {} for scaff in list(d.keys()): # collect all coordinates in list, for each scaffold for line in d[scaff]: dmax_coords.setdefault(scaff, []).append(int(line.split('\t')[3])) for scaff in list(dmax_coords.keys()): # get maximum coordinate per scaffold dscaff_max[scaff] = max(dmax_coords[scaff]) return dscaff_max
def max_of_maximums(dTEmax, dsRNAmax): print('Finding max of maximums') dmax = {} for i in list(dTEmax.keys()): for j in list(dsRNAmax.keys()): try: dTEmax[j] except: dmax[j] = dsRNAmax[j] else: dmax[j] = max(dTEmax[j], dsRNAmax[j]) try: dsRNAmax[i] except: dmax[i] = dTEmax[i] else: dmax[i] = max(dTEmax[i], dsRNAmax[i]) for (k, v) in list(dmax.items()): if v == 0: print(k) return dmax def max_coords_per_scaffold(d): print('Calcualting maximum coordinates per scaffold') dmax_coords = {} dscaff_max = {} for scaff in list(d.keys()): for line in d[scaff]: dmax_coords.setdefault(scaff, []).append(int(line.split('\t')[3])) for scaff in list(dmax_coords.keys()): dscaff_max[scaff] = max(dmax_coords[scaff]) return dscaff_max
# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. # See LICENSE in the project root for license information. # Client ID and secret. client_id = '07c53e00-1adb-4fa7-8933-fd98f6a4da84' client_secret = '7CmTo1brGWMmh5RoFiTdO0n'
client_id = '07c53e00-1adb-4fa7-8933-fd98f6a4da84' client_secret = '7CmTo1brGWMmh5RoFiTdO0n'
registry = { "centivize_service": { "grpc": 7003, }, }
registry = {'centivize_service': {'grpc': 7003}}
''' additional_datastructures.py: File containing custom utility data structures for use in simple_rl. ''' class SimpleRLStack(object): ''' Implementation for a basic Stack data structure ''' def __init__(self, _list=None): ''' Args: _list (list) : underlying elements in the stack ''' self._list = _list if _list is not None else [] def __repr__(self): r = '' for element in self._list: r += str(element) + ', ' return r def push(self, element): return self._list.append(element) def pop(self): if len(self._list) > 0: return self._list.pop() return None def peek(self): if len(self._list) > 0: return self._list[-1] return None def is_empty(self): return len(self._list) == 0 def size(self): return len(self._list)
""" additional_datastructures.py: File containing custom utility data structures for use in simple_rl. """ class Simplerlstack(object): """ Implementation for a basic Stack data structure """ def __init__(self, _list=None): """ Args: _list (list) : underlying elements in the stack """ self._list = _list if _list is not None else [] def __repr__(self): r = '' for element in self._list: r += str(element) + ', ' return r def push(self, element): return self._list.append(element) def pop(self): if len(self._list) > 0: return self._list.pop() return None def peek(self): if len(self._list) > 0: return self._list[-1] return None def is_empty(self): return len(self._list) == 0 def size(self): return len(self._list)
# RUN: llvmPy %s > %t1 # RUN: cat -n %t1 >&2 # RUN: cat %t1 | FileCheck %s print(1 * 2) # CHECK: 2 print(2 * 2) # CHECK-NEXT: 4 print(0 * 2) # CHECK-NEXT: 0
print(1 * 2) print(2 * 2) print(0 * 2)
# 1st solution class Solution: def nthMagicalNumber(self, n: int, a: int, b: int) -> int: g = self.gcd(a, b) largest = a // g * b lst = [] numOne, numTwo = a, b while numOne <= largest and numTwo <= largest: if numOne < numTwo: lst.append(numOne) numOne += a elif numOne > numTwo: lst.append(numTwo) numTwo += b else: lst.append(numOne) numOne += a numTwo += b mod = 10**9 + 7 k, r = n // len(lst), n % len(lst) if r == 0: ans = k * lst[-1] else: ans = k * lst[-1] + lst[r - 1] return ans % mod def gcd(self, a, b): while a: a, b = b % a, a return b # 2nd solution, binary search # O(log(N*min(a, b))) time | O(1) space class Solution: def nthMagicalNumber(self, n: int, a: int, b: int) -> int: mod = 10 **9 + 7 g = self.gcd(a, b) largest = a // g * b def largeEnough(x): return x // a + x // b - x // largest >= n left, right = 0, n * min(a, b) while left < right: middle = left + (right - left) // 2 if largeEnough(middle): right = middle else: left = middle + 1 return left % mod def gcd(self, a, b): while a: a, b = b % a, a return b # 3rd solution, mathematical # O(a + b) time | O(1) space class Solution: def nthMagicalNumber(self, n: int, a: int, b: int) -> int: mod = 10**9 + 7 g = self.gcd(a, b) largest = a // g * b m = largest // a + largest // b - 1 q, r = divmod(n, m) if r == 0: return q * largest % mod heads = [a, b] for _ in range(r - 1): if heads[0] <= heads[1]: heads[0] += a else: heads[1] += b return (q * largest + min(heads)) % mod def gcd(self, a, b): while a: a, b = b % a, a return b
class Solution: def nth_magical_number(self, n: int, a: int, b: int) -> int: g = self.gcd(a, b) largest = a // g * b lst = [] (num_one, num_two) = (a, b) while numOne <= largest and numTwo <= largest: if numOne < numTwo: lst.append(numOne) num_one += a elif numOne > numTwo: lst.append(numTwo) num_two += b else: lst.append(numOne) num_one += a num_two += b mod = 10 ** 9 + 7 (k, r) = (n // len(lst), n % len(lst)) if r == 0: ans = k * lst[-1] else: ans = k * lst[-1] + lst[r - 1] return ans % mod def gcd(self, a, b): while a: (a, b) = (b % a, a) return b class Solution: def nth_magical_number(self, n: int, a: int, b: int) -> int: mod = 10 ** 9 + 7 g = self.gcd(a, b) largest = a // g * b def large_enough(x): return x // a + x // b - x // largest >= n (left, right) = (0, n * min(a, b)) while left < right: middle = left + (right - left) // 2 if large_enough(middle): right = middle else: left = middle + 1 return left % mod def gcd(self, a, b): while a: (a, b) = (b % a, a) return b class Solution: def nth_magical_number(self, n: int, a: int, b: int) -> int: mod = 10 ** 9 + 7 g = self.gcd(a, b) largest = a // g * b m = largest // a + largest // b - 1 (q, r) = divmod(n, m) if r == 0: return q * largest % mod heads = [a, b] for _ in range(r - 1): if heads[0] <= heads[1]: heads[0] += a else: heads[1] += b return (q * largest + min(heads)) % mod def gcd(self, a, b): while a: (a, b) = (b % a, a) return b