content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
major = 1 minor = 0 micro = None pre_release = ".alpha" post_release = None dev_release = None __version__ = '{}'.format(major) if minor is not None: __version__ += '.{}'.format(minor) if micro is not None: __version__ += '.{}'.format(micro) if pre_release is not None: __version__ += '{}'.format(pre_release) if post_release is not None: __version__ += '.post{}'.format(post_release) if dev_release is not None: __version__ += '.dev{}'.format(dev_release)
major = 1 minor = 0 micro = None pre_release = '.alpha' post_release = None dev_release = None __version__ = '{}'.format(major) if minor is not None: __version__ += '.{}'.format(minor) if micro is not None: __version__ += '.{}'.format(micro) if pre_release is not None: __version__ += '{}'.format(pre_release) if post_release is not None: __version__ += '.post{}'.format(post_release) if dev_release is not None: __version__ += '.dev{}'.format(dev_release)
############################# #PROJECT : ENCODER-DECODER #Language :English #basic encode and decode #Contact me on ; #Telegram : Zafiyetsiz0 #Instagram : Zafiyetsiz #Discord : Zafiyetsiz#4172 ############################## print("1-Encoder ; 2-Decoder") choise=int(input("Please type the number of transaction you want :")) print("-----------------------------------------------------------------------------") if choise==1: letters=("abcdefghijklmnopqrstuvwxyz") print("key should be between 1-9999 and do not forget it ;") key=int(input("Choose a number for your encode key:")) text=input("Enter text for encode:") x= len(letters) encoded=" " for i in text: for ii in letters: if i == ii: number=letters.index(ii) number += key encoded +=letters[number % x] print("Do not forget your key :", key ) print("Your encoded text :") print(encoded) elif choise==2: letters=("abcdefghijklmnopqrstuvwxyz") key=int(input("Choose a number for your decode key:")) text=input("Enter text for decode:") while key==key: if key > 26: key=key-26 print(key) else: break print("--------------------------------------------------") decoded_key = 26 - key x= len(letters) decoded=" " for i in text: for ii in letters: if i == ii: number=letters.index(ii) number += decoded_key decoded +=letters[number % x] print("Your decoded text :") print(decoded) else: print("ERROR : type 1 or 2")
print('1-Encoder ; 2-Decoder') choise = int(input('Please type the number of transaction you want :')) print('-----------------------------------------------------------------------------') if choise == 1: letters = 'abcdefghijklmnopqrstuvwxyz' print('key should be between 1-9999 and do not forget it ;') key = int(input('Choose a number for your encode key:')) text = input('Enter text for encode:') x = len(letters) encoded = ' ' for i in text: for ii in letters: if i == ii: number = letters.index(ii) number += key encoded += letters[number % x] print('Do not forget your key :', key) print('Your encoded text :') print(encoded) elif choise == 2: letters = 'abcdefghijklmnopqrstuvwxyz' key = int(input('Choose a number for your decode key:')) text = input('Enter text for decode:') while key == key: if key > 26: key = key - 26 print(key) else: break print('--------------------------------------------------') decoded_key = 26 - key x = len(letters) decoded = ' ' for i in text: for ii in letters: if i == ii: number = letters.index(ii) number += decoded_key decoded += letters[number % x] print('Your decoded text :') print(decoded) else: print('ERROR : type 1 or 2')
def fib(a,b,n): if(n==1): return a elif(n==2): return b else: return fib(a,b,n-2)+fib(a,b,n-1)*fib(a,b,n-1) r = input(); r = r.split(' ') a = int(r[0]) b = int(r[1]) n = int(r[2]) print(fib(a,b,n))
def fib(a, b, n): if n == 1: return a elif n == 2: return b else: return fib(a, b, n - 2) + fib(a, b, n - 1) * fib(a, b, n - 1) r = input() r = r.split(' ') a = int(r[0]) b = int(r[1]) n = int(r[2]) print(fib(a, b, n))
#Actividad 2 a=1+2**-53 print(a) b=a-1 print(b) a=1+2**-52 print(a) b=a-1
a = 1 + 2 ** (-53) print(a) b = a - 1 print(b) a = 1 + 2 ** (-52) print(a) b = a - 1
a = [{'001': '001', '002': '002'}] print(a, type(a)) a = a.__str__() print(a, type(a)) print(['------------------']) init_list = [0 for n in range(10)] init_list2 = [0] * 10 print(init_list) print(init_list2) # list - replace a = ['110', '111', '112', '113'] for i in a: print(i, a.index(i)) if i == '112': id = a.index(i) print(a[id]) i = i.replace('112', '000') a[id] = '000' print(a)
a = [{'001': '001', '002': '002'}] print(a, type(a)) a = a.__str__() print(a, type(a)) print(['------------------']) init_list = [0 for n in range(10)] init_list2 = [0] * 10 print(init_list) print(init_list2) a = ['110', '111', '112', '113'] for i in a: print(i, a.index(i)) if i == '112': id = a.index(i) print(a[id]) i = i.replace('112', '000') a[id] = '000' print(a)
# Check whether the string is palindrome or not considering # only Alpha-Numeric Characters ignoring cases s = input(); t = ''.join([i.lower() if i.isalnum() else '' for i in s]) if t==''.join(reversed(t)): print("It is a Palindrome String") else: print("It is not a Palindrome String")
s = input() t = ''.join([i.lower() if i.isalnum() else '' for i in s]) if t == ''.join(reversed(t)): print('It is a Palindrome String') else: print('It is not a Palindrome String')
# cannot be changed by user: coinbaseReward = 5000000000 #50 bitcoins halvingInterval = 150 maxOutputsPerTx = 1000 scalingUnits = .000001 # units of cap confirmations = 6 onchainSatoshiMinimum = 100 maxTxPerBlock = 20 # 200 transactions in a block plus coinbase (which is at index 0) iCoinbasePriv = 100000000 # some private key that is completely insecure. Doesn't matter what it is. bCoinbasePriv = bytearray(iCoinbasePriv.to_bytes(32, "big"))
coinbase_reward = 5000000000 halving_interval = 150 max_outputs_per_tx = 1000 scaling_units = 1e-06 confirmations = 6 onchain_satoshi_minimum = 100 max_tx_per_block = 20 i_coinbase_priv = 100000000 b_coinbase_priv = bytearray(iCoinbasePriv.to_bytes(32, 'big'))
__all__ = [ 'base_controller', 'basic_api_controller', 'advanced_api_controller', 'enterprise_only_controller', ]
__all__ = ['base_controller', 'basic_api_controller', 'advanced_api_controller', 'enterprise_only_controller']
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def convertBST(self, root: Optional[TreeNode]) -> Optional[TreeNode]: prev = 0 def inorderTraversal(root): nonlocal prev if not root: return inorderTraversal(root.right) root.val += prev prev = root.val inorderTraversal(root.left) return inorderTraversal(root) return root
class Solution: def convert_bst(self, root: Optional[TreeNode]) -> Optional[TreeNode]: prev = 0 def inorder_traversal(root): nonlocal prev if not root: return inorder_traversal(root.right) root.val += prev prev = root.val inorder_traversal(root.left) return inorder_traversal(root) return root
all_boards = { 'sysop': 1, 'vote': 2, 'bbslists': 3, 'notepad': 6, 'Test': 7, 'Dance': 8, 'Board': 9, 'Wisdom': 10, 'Science': 12, 'Linux': 13, 'IBMThinkPad': 14, 'LifeScience': 15, 'BBShelp': 16, 'Mechanics': 17, 'Emprise': 18, 'Philosophy': 20, 'Literature': 21, 'Triangle': 22, 'GSM': 23, 'CS': 24, 'PKULibrary': 25, 'New_Board': 27, 'BoardManager': 28, 'Announce': 29, 'Urban': 31, 'History': 33, 'Girl': 34, 'Networking': 35, 'Love': 36, 'Friend': 37, 'Psychology': 38, 'CStrike': 39, 'Innovation': 40, 'AdvancedEdu': 41, 'Virus_Security': 42, 'CIS': 44, 'CPlusPlus': 45, 'VisualBasic': 46, 'Feeling': 47, 'Memory': 48, 'Game': 49, 'Story': 50, 'SMS': 51, 'Boy': 52, 'Reader': 53, 'Law': 54, 'Mentality': 55, 'EnglishWorld': 56, 'Physics': 57, 'Electronics': 59, 'Geophysics': 60, 'CCME': 61, 'Economics': 62, 'Chinese': 63, 'SFL': 64, 'Geology': 66, 'NSD': 67, 'SG': 69, 'Archaeology': 70, 'SecondHand': 71, 'Joke': 72, 'Banquet': 73, 'Blessing': 74, 'AoA': 75, 'Badminton': 77, 'MUD': 78, 'PopMusic': 79, 'Poems': 80, 'Astrology': 81, 'Movie': 83, 'Riddle': 84, 'Java': 87, 'Basketball': 88, 'Astronomy': 89, 'Food': 90, 'Football': 93, 'Travel': 94, 'CSArch': 95, 'TableTennis': 96, 'Single': 97, 'Job': 99, 'Traffic': 100, 'ForeignLit': 101, 'Water': 103, 'THU': 104, 'Biology': 105, 'post': 106, 'Collection': 107, 'Comic': 108, 'NKU': 109, 'Oversea': 114, 'Ecosociety': 115, 'WHU': 117, 'GIS': 124, 'ClassicalMusic': 125, 'Tennis': 126, 'ColorShow': 130, 'IM': 131, 'Windows': 133, 'Thesis': 134, 'Swimming': 136, 'Skate': 137, 'HSC': 138, 'IME': 140, 'Freshman': 141, 'cntest': 142, 'loveheart': 143, 'NJU': 147, 'ASCIIArt': 149, 'HappyLife': 150, 'PetsEden': 151, 'CCC': 152, 'PersonalCorpus': 154, 'SIS': 155, 'Baseball': 157, 'Anniversary': 162, 'StoneStory': 163, 'Arbitration': 164, 'LostFound': 165, 'DIY': 166, 'PieBridge': 167, 'Romance': 168, 'Graduation': 173, 'BNU': 174, 'Bioinformatics': 175, 'Melancholy': 176, 'Video_Game': 177, 'Beauty': 179, 'RUC': 180, 'Software': 181, 'CinemaArt': 182, 'JapanResearch': 184, 'Military': 185, 'PhotoView': 186, 'Art': 187, 'SL': 188, 'Kaoyan': 190, 'CESE': 192, 'CAPU': 193, 'Chimusic': 194, 'Relatives': 196, 'MobileDigital': 197, 'Homepage': 198, 'Billiards': 199, 'TV': 200, 'Marxism': 203, 'Detective': 204, 'Chorus': 205, 'PKUER': 207, 'NCU': 208, 'NetResources': 209, 'ScienceFiction': 210, 'RockMusic': 211, 'Automobile': 212, 'Collectors': 213, 'Drama': 214, 'GuitarPKU': 216, 'rules': 217, 'Fairytales': 218, 'Fitness': 219, 'Auditory': 222, 'PUMA': 224, 'RedCross': 226, 'Character': 227, 'House': 230, 'FormulaOneZone': 231, 'JLU': 235, 'Mathematics': 236, 'Orchestra': 237, 'Aviation': 238, 'sysreport': 241, 'Volunteers': 242, 'BDSJC': 243, 'Health': 244, 'SLP': 245, 'PKULeagueschool': 246, 'WeClub': 248, 'Stock': 249, 'Counterculture': 251, 'Courses': 252, 'StudentUnion': 253, 'HK_MC_TW': 254, 'SPS': 256, 'Harmonica': 258, 'PKUHighSchool': 260, 'Brush_Art': 262, 'SESS': 267, 'Piefriends': 270, 'Greenlife': 271, 'FantasyWorld': 272, 'cnAdmin': 273, 'TeacherStudent': 274, 'Radio': 275, 'PKUFA': 277, 'Philo': 278, 'Advertising': 281, 'dance_company': 283, 'SAPA': 288, 'STWT': 289, 'PKUdevelopment': 294, 'GSE': 295, 'Tea': 296, 'Shopping': 298, 'PCIA': 299, 'XinWenZX': 300, 'LAAPKU': 301, 'DigitalWorld': 304, 'Volleyball': 307, 'HipHop': 308, 'SANGUO': 309, 'losefat': 310, 'pkuveg': 311, 'Hardware': 312, 'WanLiu': 315, 'PKU_PE': 316, 'sunshine': 318, 'ACM_Algo': 320, 'PKUHistory': 321, 'EECS': 322, 'Leisure_Game': 323, 'ypjh': 325, 'SSM': 327, 'RelicFans': 328, 'HuXiangCulture': 330, 'HiFi': 331, 'PKUTV': 336, 'SST': 337, 'ID': 338, 'NUDT': 339, 'AcademicInfo': 342, 'PKUPA': 343, 'OriginalFire': 344, 'Chemistry': 345, 'MathTools': 346, 'Heroes': 350, 'CampusInfo': 351, 'BBSInfo': 352, 'MNWH': 353, 'TrendyLife': 354, 'Economiclovers': 355, 'DVDZone': 357, 'Renju': 359, 'diary': 361, 'Bridge': 362, 'jingwu': 364, 'lottery': 365, 'JNFQ': 366, 'PKUSZ': 367, 'Application': 368, 'Complain': 369, 'wine': 373, 'TryYourBest': 376, 'Ghost': 377, 'Yueju': 378, 'Music_box': 381, 'Meteo': 382, 'PCA': 384, 'CIO_Forum': 385, 'Green_hut': 387, 'RPKU': 389, 'XiangSheng': 390, 'Muthos': 391, 'PKUSIFEA': 393, 'NIE': 394, 'ITrade': 395, 'WellBeing': 396, 'cnBM': 397, 'OPETech': 398, 'WorldHeritage': 400, 'Communications': 401, 'WesternMusic': 403, 'KoreanSalon': 404, 'CR': 405, 'Englishwriting': 407, 'LuXunStudies': 409, 'PKUYND': 410, 'PKU_OSFA': 411, 'SecretGarden': 414, 'ParttimeJob': 419, 'NewAgemusic': 420, 'Life_Art': 422, 'ccdra': 423, 'Anthropology': 425, 'Herbalism': 426, 'TRA': 430, 'EduLDA': 431, 'PKU_Suggest': 438, 'WenYan': 439, 'ShanXi': 440, 'Pictures': 441, 'GuoXue': 442, 'leagueforum': 443, 'ADAgent': 444, 'ECCA': 445, 'PKU_Feedback': 446, 'PKU_Announce': 447, 'HuBei': 450, 'JiangSu': 451, 'cinemapku': 452, 'ShanDong': 453, 'XSKC': 454, 'Christianity': 455, 'ZheJiang': 457, 'BDQN': 458, 'JiangXi': 459, 'FuJian': 460, 'LiaoNing': 461, 'TianJin': 462, 'ChongQing': 463, 'SiChuan': 464, 'ShaanXi': 466, 'GanSu': 467, 'BeiJing': 468, 'GuangXi': 470, 'ShangHai': 472, 'JiLin': 473, 'HuNan': 474, 'HeBei': 475, 'AnHui': 476, 'HeNan': 477, 'HeiLongJiang': 478, 'Temporary_BM': 480, 'YunNan': 481, 'HaiNan': 482, 'Notebook': 484, 'ITP': 485, 'GuangDong': 486, 'FoxForum': 487, 'Apple': 488, 'News_Editing': 489, 'ADer': 490, 'PKU_ShiJia': 491, 'SpanishStudy': 492, 'PRCEH': 493, 'PE': 494, 'PKUMUN': 495, 'le_francais': 496, 'StarsOfBDWM': 498, 'Languages': 502, 'BJ_Culture': 503, 'XinJiang': 504, 'BaoYan': 507, 'LITnMovie': 509, 'Little_Game': 510, 'ROSS': 511, 'Politics': 513, 'DMM': 514, 'zhijiangforum': 515, 'LangSong': 517, 'Sports_Game': 519, 'SICA': 521, 'pku_129': 524, 'PKUdebate': 527, 'BeiDaZhiFeng': 528, 'KXTS': 529, 'Folklore': 531, 'GuiZhou': 532, 'WMweibo': 533, 'OMW': 534, 'JiaJiao': 535, 'XiZang': 536, 'Bible': 537, 'IIMA': 539, 'SPH': 540, 'ChineseEconomy': 543, 'PKU_Zen': 544, 'HCC': 545, 'Coffee': 546, 'Thanks': 547, 'DoItForYou': 548, 'YanQingbu': 551, 'GengDu': 553, 'Customs': 554, 'SysAid': 555, 'TrafficTicket': 557, 'Actuary': 559, 'OurEileen': 560, 'VisualBible': 562, 'Deutsch': 563, 'Assembly': 564, 'ARTLIFE': 565, 'SFAPU': 566, 'Biography': 568, 'Econometrics': 569, 'Karaoke': 572, 'ACDR': 573, 'SocialPsy': 575, 'IPDA': 577, 'PUDA': 578, 'PKU_EnNews': 579, 'Piano': 580, 'GuQin': 581, 'PKUBA': 584, 'ACJC': 585, 'JMusic': 587, 'JCP': 590, 'PKUQUYI': 591, 'OVTS': 592, 'ForzaMilan': 594, 'Tobacco': 596, 'LordOfTheRings': 598, 'Inter': 603, 'Arsenal': 605, 'Modern_China': 606, 'ExceptNA': 607, 'LiverpoolFC': 608, 'InnerMongolia': 610, 'HXYG': 611, 'Beyond': 613, 'PKU_OOF': 622, 'PKU_SAD': 624, 'PKU_SCC': 625, 'PKU_CE': 627, 'Xuanliu': 628, 'M_M': 629, 'RegionalEcon': 632, 'ArchUrban': 634, 'LSA': 635, 'YangTaiChi': 636, 'QuantumChem': 637, 'Managepsy': 638, 'ILSAPKU': 639, 'VBVC': 640, 'Model': 641, 'HLC': 642, 'IJC': 644, 'Warcraft': 646, 'Railway': 647, 'Conan': 648, 'Referees': 649, 'SUforum': 653, 'HongqiOnline': 654, 'SanJinCulture': 655, 'Aesthetics': 656, 'OBCase': 657, 'RealMadrid': 659, 'Admin4': 661, 'Admin6': 662, 'Admin5': 665, 'BackstreetBack': 667, 'PKU_CC': 668, 'MusicGame': 669, 'ichess': 670, 'AdminG': 672, 'FlightSim': 677, 'WinterSunshine': 689, 'MentalityEdu': 690, 'PKUYAFA': 692, 'Aikido': 693, 'SHE': 695, 'ShouYu': 696, 'Kindergarten': 697, 'WBIA': 698, 'EUS': 699, 'FCBarcelona': 701, 'CCEA': 702, 'ArchSciTech': 703, 'musical': 705, 'Juventus': 706, 'ECPM': 709, 'ManUtd': 710, 'YASP': 711, 'PingShu': 712, 'BayernMunchen': 715, 'PLATEAUDREAM': 716, 'MusicTheory': 717, 'CritiWriting': 718, 'CG': 719, 'Logic': 721, 'AnalChem': 722, 'JingKun': 723, 'BeautyMarket': 724, 'PAPU': 726, 'ArtHistory': 727, 'WMReview': 728, 'Greece_Rome': 730, 'Sorry': 731, 'Loveletter': 732, 'TWLiterature': 734, 'Broadcasting': 736, 'Stefanie': 737, 'Pingtan': 738, 'Admin9': 739, 'AdminABC': 740, 'xcdyb': 742, 'Chelsea': 743, 'MaJiang': 744, 'Admin1': 748, 'Admin2': 749, 'Admin3': 750, 'Admin7': 751, 'Admin8': 752, 'GSMRL': 754, 'FrancisNG': 757, 'EasonChan': 758, 'WOW': 759, 'Wakin': 763, 'pub': 764, 'JayChou': 765, 'UrgentMeet': 766, 'warner_class': 767, 'WisePark': 769, 'FYSN': 772, 'GCHEM': 774, 'Jeff': 775, 'SocialNetwork': 776, 'LeslieCheung': 777, 'PKURELA': 778, 'CMI': 781, 'lostangel': 783, 'LiangPin': 784, 'FinalFantasy': 785, 'AOE': 787, 'KangYong': 788, 'JunXun': 789, 'PKU_EF': 791, 'Admin5_Bar': 792, 'WizArdS': 795, 'zts': 797, 'DY': 799, 'HappyPavilion': 801, 'StarCraft': 803, 'FruitFruit': 804, 'CCYuan': 807, 'HSC_CFAN': 812, 'WAH': 814, 'Friends': 815, 'XiYuCulture': 817, 'Islam': 818, 'Argentina': 821, 'UnivUnion': 825, 'PKUFMU': 826, 'DalianFC': 833, 'ShowTicket': 834, 'PhysicsReview': 835, 'NationalFlagTeam': 836, 'SIEN': 837, 'Xianjian': 838, 'Holland': 839, 'FiveMillion': 840, 'FRIENDFAMILY': 841, 'Kendo': 842, 'Job_Post': 845, 'COE': 846, 'PKUPI': 849, 'PECSA': 852, 'SAS_PKU': 853, 'PKURobot': 856, 'grsxz': 857, 'BJ4HS': 858, 'GSMer_Club': 859, 'PGA': 860, 'FreeRunning': 861, 'WUXIE': 863, 'PMA': 864, 'BDXK': 868, 'Architecture': 870, 'PKU_OMusic': 871, 'Zhuangzi': 872, 'Novoland': 873, 'NumberPark': 875, 'sneaker': 876, 'HGC': 877, 'Hogwarts': 881, 'Dream': 884, 'GalacticHeroes': 885, 'BoC': 886, 'ManCity': 892, 'Intern': 896, 'Rio2016': 900, 'GameTheory': 901, 'phychem': 902, 'LifeEducation': 903, 'Adolescence': 904, 'Maze': 906, 'Italiano': 908, 'CAH': 909, 'cssm': 910, 'CPGP': 911, 'PKU_JuXing': 912, 'kzone': 913, 'SecondBook': 914, 'Guizhou_Culture': 915, 'NuclearTec': 916, 'JapaneseArt': 917, 'RCPER': 919, 'Marxist': 923, 'WangLian': 924, 'WMFund': 927, 'PKUTA': 930, 'standflower': 931, 'PKU_GRS': 933, 'MayDay': 941, 'Euro2016': 944, 'FayeWong': 947, 'DV': 948, 'LeeHom': 949, 'WallaceChung': 950, 'DigitalArt': 951, 'POA': 952, 'BuddhismCHN': 953, 'Olydreams': 956, 'TuanGou': 957, 'KillerGame': 958, 'code_report': 959, 'WorldLiterary': 960, 'AJCD': 961, 'GFJY': 962, 'IEEEPKU': 963, 'CCAC': 964, 'ASRA': 965, 'Opera': 969, 'AAIS': 971, 'Graduate': 972, 'PG_Club': 978, 'Zillionaire': 979, 'webgame': 985, 'AminiEden': 988, 'SLS': 989, 'PKU_VI': 990, 'War3Clan': 991, 'PKUZDS': 993, 'LSU': 995, 'ElecDIY': 996, 'LoveCatMeetU': 997, 'HELP': 998, 'FilmReview': 999, 'ADintro': 1000, 'Google': 1001, 'wenji': 1002, 'Neverland': 1004, 'AngelaChang': 1005, 'ShenaRingo': 1006, 'TECC': 1007, 'Indiapac': 1009, 'DMP': 1010, 'BDWMFinance': 1011, 'WMHXS': 1012, 'Mavis': 1013, 'HSCINFO': 1014, 'DMB': 1015, 'JaneZhang': 1017, 'BeiShe': 1019, 'CACA': 1020, 'YOGA': 1022, 'GXue': 1023, 'twxgx': 1026, 'PRA': 1027, 'FofArt': 1028, 'LSIA': 1029, 'SaintSeiya': 1034, 'YOCSEF_GS': 1038, 'DMA': 1039, 'BibiChou': 1040, 'ElvaHsiao': 1041, 'SkateBoarding': 1043, 'QingHai': 1045, 'NingXia': 1046, 'HKCA': 1047, 'ADA': 1048, 'HscAssn': 1050, 'Skiing': 1051, 'Shin': 1052, 'MengTingWei': 1053, 'Game_Factory': 1054, 'Admin9_Bar': 1055, 'Circuit': 1058, 'pkpk': 1059, 'ChineseCulture': 1061, 'ZongJiaoZheXue': 1062, 'CFH': 1063, 'Adonis': 1064, 'Admin7_Bar': 1066, 'DotA': 1067, 'HSJCE': 1069, 'Magic': 1070, 'DigitalMusic': 1071, 'Echo': 1072, 'BaiduClub': 1073, 'OldSoftware': 1074, 'PKU_HMT': 1075, 'PKU_OIR': 1076, 'AiYuanClub': 1077, 'AbnormalPSY': 1078, 'LogicCriThink': 1079, 'Admin6_Bla': 1080, 'Bourgeoisie': 1081, 'OcciMusic': 1084, 'ILCA': 1088, 'MANYATTA': 1090, 'XiYou': 1091, 'pkuwuxia': 1092, 'FishLeong': 1094, 'IMM': 1095, }
all_boards = {'sysop': 1, 'vote': 2, 'bbslists': 3, 'notepad': 6, 'Test': 7, 'Dance': 8, 'Board': 9, 'Wisdom': 10, 'Science': 12, 'Linux': 13, 'IBMThinkPad': 14, 'LifeScience': 15, 'BBShelp': 16, 'Mechanics': 17, 'Emprise': 18, 'Philosophy': 20, 'Literature': 21, 'Triangle': 22, 'GSM': 23, 'CS': 24, 'PKULibrary': 25, 'New_Board': 27, 'BoardManager': 28, 'Announce': 29, 'Urban': 31, 'History': 33, 'Girl': 34, 'Networking': 35, 'Love': 36, 'Friend': 37, 'Psychology': 38, 'CStrike': 39, 'Innovation': 40, 'AdvancedEdu': 41, 'Virus_Security': 42, 'CIS': 44, 'CPlusPlus': 45, 'VisualBasic': 46, 'Feeling': 47, 'Memory': 48, 'Game': 49, 'Story': 50, 'SMS': 51, 'Boy': 52, 'Reader': 53, 'Law': 54, 'Mentality': 55, 'EnglishWorld': 56, 'Physics': 57, 'Electronics': 59, 'Geophysics': 60, 'CCME': 61, 'Economics': 62, 'Chinese': 63, 'SFL': 64, 'Geology': 66, 'NSD': 67, 'SG': 69, 'Archaeology': 70, 'SecondHand': 71, 'Joke': 72, 'Banquet': 73, 'Blessing': 74, 'AoA': 75, 'Badminton': 77, 'MUD': 78, 'PopMusic': 79, 'Poems': 80, 'Astrology': 81, 'Movie': 83, 'Riddle': 84, 'Java': 87, 'Basketball': 88, 'Astronomy': 89, 'Food': 90, 'Football': 93, 'Travel': 94, 'CSArch': 95, 'TableTennis': 96, 'Single': 97, 'Job': 99, 'Traffic': 100, 'ForeignLit': 101, 'Water': 103, 'THU': 104, 'Biology': 105, 'post': 106, 'Collection': 107, 'Comic': 108, 'NKU': 109, 'Oversea': 114, 'Ecosociety': 115, 'WHU': 117, 'GIS': 124, 'ClassicalMusic': 125, 'Tennis': 126, 'ColorShow': 130, 'IM': 131, 'Windows': 133, 'Thesis': 134, 'Swimming': 136, 'Skate': 137, 'HSC': 138, 'IME': 140, 'Freshman': 141, 'cntest': 142, 'loveheart': 143, 'NJU': 147, 'ASCIIArt': 149, 'HappyLife': 150, 'PetsEden': 151, 'CCC': 152, 'PersonalCorpus': 154, 'SIS': 155, 'Baseball': 157, 'Anniversary': 162, 'StoneStory': 163, 'Arbitration': 164, 'LostFound': 165, 'DIY': 166, 'PieBridge': 167, 'Romance': 168, 'Graduation': 173, 'BNU': 174, 'Bioinformatics': 175, 'Melancholy': 176, 'Video_Game': 177, 'Beauty': 179, 'RUC': 180, 'Software': 181, 'CinemaArt': 182, 'JapanResearch': 184, 'Military': 185, 'PhotoView': 186, 'Art': 187, 'SL': 188, 'Kaoyan': 190, 'CESE': 192, 'CAPU': 193, 'Chimusic': 194, 'Relatives': 196, 'MobileDigital': 197, 'Homepage': 198, 'Billiards': 199, 'TV': 200, 'Marxism': 203, 'Detective': 204, 'Chorus': 205, 'PKUER': 207, 'NCU': 208, 'NetResources': 209, 'ScienceFiction': 210, 'RockMusic': 211, 'Automobile': 212, 'Collectors': 213, 'Drama': 214, 'GuitarPKU': 216, 'rules': 217, 'Fairytales': 218, 'Fitness': 219, 'Auditory': 222, 'PUMA': 224, 'RedCross': 226, 'Character': 227, 'House': 230, 'FormulaOneZone': 231, 'JLU': 235, 'Mathematics': 236, 'Orchestra': 237, 'Aviation': 238, 'sysreport': 241, 'Volunteers': 242, 'BDSJC': 243, 'Health': 244, 'SLP': 245, 'PKULeagueschool': 246, 'WeClub': 248, 'Stock': 249, 'Counterculture': 251, 'Courses': 252, 'StudentUnion': 253, 'HK_MC_TW': 254, 'SPS': 256, 'Harmonica': 258, 'PKUHighSchool': 260, 'Brush_Art': 262, 'SESS': 267, 'Piefriends': 270, 'Greenlife': 271, 'FantasyWorld': 272, 'cnAdmin': 273, 'TeacherStudent': 274, 'Radio': 275, 'PKUFA': 277, 'Philo': 278, 'Advertising': 281, 'dance_company': 283, 'SAPA': 288, 'STWT': 289, 'PKUdevelopment': 294, 'GSE': 295, 'Tea': 296, 'Shopping': 298, 'PCIA': 299, 'XinWenZX': 300, 'LAAPKU': 301, 'DigitalWorld': 304, 'Volleyball': 307, 'HipHop': 308, 'SANGUO': 309, 'losefat': 310, 'pkuveg': 311, 'Hardware': 312, 'WanLiu': 315, 'PKU_PE': 316, 'sunshine': 318, 'ACM_Algo': 320, 'PKUHistory': 321, 'EECS': 322, 'Leisure_Game': 323, 'ypjh': 325, 'SSM': 327, 'RelicFans': 328, 'HuXiangCulture': 330, 'HiFi': 331, 'PKUTV': 336, 'SST': 337, 'ID': 338, 'NUDT': 339, 'AcademicInfo': 342, 'PKUPA': 343, 'OriginalFire': 344, 'Chemistry': 345, 'MathTools': 346, 'Heroes': 350, 'CampusInfo': 351, 'BBSInfo': 352, 'MNWH': 353, 'TrendyLife': 354, 'Economiclovers': 355, 'DVDZone': 357, 'Renju': 359, 'diary': 361, 'Bridge': 362, 'jingwu': 364, 'lottery': 365, 'JNFQ': 366, 'PKUSZ': 367, 'Application': 368, 'Complain': 369, 'wine': 373, 'TryYourBest': 376, 'Ghost': 377, 'Yueju': 378, 'Music_box': 381, 'Meteo': 382, 'PCA': 384, 'CIO_Forum': 385, 'Green_hut': 387, 'RPKU': 389, 'XiangSheng': 390, 'Muthos': 391, 'PKUSIFEA': 393, 'NIE': 394, 'ITrade': 395, 'WellBeing': 396, 'cnBM': 397, 'OPETech': 398, 'WorldHeritage': 400, 'Communications': 401, 'WesternMusic': 403, 'KoreanSalon': 404, 'CR': 405, 'Englishwriting': 407, 'LuXunStudies': 409, 'PKUYND': 410, 'PKU_OSFA': 411, 'SecretGarden': 414, 'ParttimeJob': 419, 'NewAgemusic': 420, 'Life_Art': 422, 'ccdra': 423, 'Anthropology': 425, 'Herbalism': 426, 'TRA': 430, 'EduLDA': 431, 'PKU_Suggest': 438, 'WenYan': 439, 'ShanXi': 440, 'Pictures': 441, 'GuoXue': 442, 'leagueforum': 443, 'ADAgent': 444, 'ECCA': 445, 'PKU_Feedback': 446, 'PKU_Announce': 447, 'HuBei': 450, 'JiangSu': 451, 'cinemapku': 452, 'ShanDong': 453, 'XSKC': 454, 'Christianity': 455, 'ZheJiang': 457, 'BDQN': 458, 'JiangXi': 459, 'FuJian': 460, 'LiaoNing': 461, 'TianJin': 462, 'ChongQing': 463, 'SiChuan': 464, 'ShaanXi': 466, 'GanSu': 467, 'BeiJing': 468, 'GuangXi': 470, 'ShangHai': 472, 'JiLin': 473, 'HuNan': 474, 'HeBei': 475, 'AnHui': 476, 'HeNan': 477, 'HeiLongJiang': 478, 'Temporary_BM': 480, 'YunNan': 481, 'HaiNan': 482, 'Notebook': 484, 'ITP': 485, 'GuangDong': 486, 'FoxForum': 487, 'Apple': 488, 'News_Editing': 489, 'ADer': 490, 'PKU_ShiJia': 491, 'SpanishStudy': 492, 'PRCEH': 493, 'PE': 494, 'PKUMUN': 495, 'le_francais': 496, 'StarsOfBDWM': 498, 'Languages': 502, 'BJ_Culture': 503, 'XinJiang': 504, 'BaoYan': 507, 'LITnMovie': 509, 'Little_Game': 510, 'ROSS': 511, 'Politics': 513, 'DMM': 514, 'zhijiangforum': 515, 'LangSong': 517, 'Sports_Game': 519, 'SICA': 521, 'pku_129': 524, 'PKUdebate': 527, 'BeiDaZhiFeng': 528, 'KXTS': 529, 'Folklore': 531, 'GuiZhou': 532, 'WMweibo': 533, 'OMW': 534, 'JiaJiao': 535, 'XiZang': 536, 'Bible': 537, 'IIMA': 539, 'SPH': 540, 'ChineseEconomy': 543, 'PKU_Zen': 544, 'HCC': 545, 'Coffee': 546, 'Thanks': 547, 'DoItForYou': 548, 'YanQingbu': 551, 'GengDu': 553, 'Customs': 554, 'SysAid': 555, 'TrafficTicket': 557, 'Actuary': 559, 'OurEileen': 560, 'VisualBible': 562, 'Deutsch': 563, 'Assembly': 564, 'ARTLIFE': 565, 'SFAPU': 566, 'Biography': 568, 'Econometrics': 569, 'Karaoke': 572, 'ACDR': 573, 'SocialPsy': 575, 'IPDA': 577, 'PUDA': 578, 'PKU_EnNews': 579, 'Piano': 580, 'GuQin': 581, 'PKUBA': 584, 'ACJC': 585, 'JMusic': 587, 'JCP': 590, 'PKUQUYI': 591, 'OVTS': 592, 'ForzaMilan': 594, 'Tobacco': 596, 'LordOfTheRings': 598, 'Inter': 603, 'Arsenal': 605, 'Modern_China': 606, 'ExceptNA': 607, 'LiverpoolFC': 608, 'InnerMongolia': 610, 'HXYG': 611, 'Beyond': 613, 'PKU_OOF': 622, 'PKU_SAD': 624, 'PKU_SCC': 625, 'PKU_CE': 627, 'Xuanliu': 628, 'M_M': 629, 'RegionalEcon': 632, 'ArchUrban': 634, 'LSA': 635, 'YangTaiChi': 636, 'QuantumChem': 637, 'Managepsy': 638, 'ILSAPKU': 639, 'VBVC': 640, 'Model': 641, 'HLC': 642, 'IJC': 644, 'Warcraft': 646, 'Railway': 647, 'Conan': 648, 'Referees': 649, 'SUforum': 653, 'HongqiOnline': 654, 'SanJinCulture': 655, 'Aesthetics': 656, 'OBCase': 657, 'RealMadrid': 659, 'Admin4': 661, 'Admin6': 662, 'Admin5': 665, 'BackstreetBack': 667, 'PKU_CC': 668, 'MusicGame': 669, 'ichess': 670, 'AdminG': 672, 'FlightSim': 677, 'WinterSunshine': 689, 'MentalityEdu': 690, 'PKUYAFA': 692, 'Aikido': 693, 'SHE': 695, 'ShouYu': 696, 'Kindergarten': 697, 'WBIA': 698, 'EUS': 699, 'FCBarcelona': 701, 'CCEA': 702, 'ArchSciTech': 703, 'musical': 705, 'Juventus': 706, 'ECPM': 709, 'ManUtd': 710, 'YASP': 711, 'PingShu': 712, 'BayernMunchen': 715, 'PLATEAUDREAM': 716, 'MusicTheory': 717, 'CritiWriting': 718, 'CG': 719, 'Logic': 721, 'AnalChem': 722, 'JingKun': 723, 'BeautyMarket': 724, 'PAPU': 726, 'ArtHistory': 727, 'WMReview': 728, 'Greece_Rome': 730, 'Sorry': 731, 'Loveletter': 732, 'TWLiterature': 734, 'Broadcasting': 736, 'Stefanie': 737, 'Pingtan': 738, 'Admin9': 739, 'AdminABC': 740, 'xcdyb': 742, 'Chelsea': 743, 'MaJiang': 744, 'Admin1': 748, 'Admin2': 749, 'Admin3': 750, 'Admin7': 751, 'Admin8': 752, 'GSMRL': 754, 'FrancisNG': 757, 'EasonChan': 758, 'WOW': 759, 'Wakin': 763, 'pub': 764, 'JayChou': 765, 'UrgentMeet': 766, 'warner_class': 767, 'WisePark': 769, 'FYSN': 772, 'GCHEM': 774, 'Jeff': 775, 'SocialNetwork': 776, 'LeslieCheung': 777, 'PKURELA': 778, 'CMI': 781, 'lostangel': 783, 'LiangPin': 784, 'FinalFantasy': 785, 'AOE': 787, 'KangYong': 788, 'JunXun': 789, 'PKU_EF': 791, 'Admin5_Bar': 792, 'WizArdS': 795, 'zts': 797, 'DY': 799, 'HappyPavilion': 801, 'StarCraft': 803, 'FruitFruit': 804, 'CCYuan': 807, 'HSC_CFAN': 812, 'WAH': 814, 'Friends': 815, 'XiYuCulture': 817, 'Islam': 818, 'Argentina': 821, 'UnivUnion': 825, 'PKUFMU': 826, 'DalianFC': 833, 'ShowTicket': 834, 'PhysicsReview': 835, 'NationalFlagTeam': 836, 'SIEN': 837, 'Xianjian': 838, 'Holland': 839, 'FiveMillion': 840, 'FRIENDFAMILY': 841, 'Kendo': 842, 'Job_Post': 845, 'COE': 846, 'PKUPI': 849, 'PECSA': 852, 'SAS_PKU': 853, 'PKURobot': 856, 'grsxz': 857, 'BJ4HS': 858, 'GSMer_Club': 859, 'PGA': 860, 'FreeRunning': 861, 'WUXIE': 863, 'PMA': 864, 'BDXK': 868, 'Architecture': 870, 'PKU_OMusic': 871, 'Zhuangzi': 872, 'Novoland': 873, 'NumberPark': 875, 'sneaker': 876, 'HGC': 877, 'Hogwarts': 881, 'Dream': 884, 'GalacticHeroes': 885, 'BoC': 886, 'ManCity': 892, 'Intern': 896, 'Rio2016': 900, 'GameTheory': 901, 'phychem': 902, 'LifeEducation': 903, 'Adolescence': 904, 'Maze': 906, 'Italiano': 908, 'CAH': 909, 'cssm': 910, 'CPGP': 911, 'PKU_JuXing': 912, 'kzone': 913, 'SecondBook': 914, 'Guizhou_Culture': 915, 'NuclearTec': 916, 'JapaneseArt': 917, 'RCPER': 919, 'Marxist': 923, 'WangLian': 924, 'WMFund': 927, 'PKUTA': 930, 'standflower': 931, 'PKU_GRS': 933, 'MayDay': 941, 'Euro2016': 944, 'FayeWong': 947, 'DV': 948, 'LeeHom': 949, 'WallaceChung': 950, 'DigitalArt': 951, 'POA': 952, 'BuddhismCHN': 953, 'Olydreams': 956, 'TuanGou': 957, 'KillerGame': 958, 'code_report': 959, 'WorldLiterary': 960, 'AJCD': 961, 'GFJY': 962, 'IEEEPKU': 963, 'CCAC': 964, 'ASRA': 965, 'Opera': 969, 'AAIS': 971, 'Graduate': 972, 'PG_Club': 978, 'Zillionaire': 979, 'webgame': 985, 'AminiEden': 988, 'SLS': 989, 'PKU_VI': 990, 'War3Clan': 991, 'PKUZDS': 993, 'LSU': 995, 'ElecDIY': 996, 'LoveCatMeetU': 997, 'HELP': 998, 'FilmReview': 999, 'ADintro': 1000, 'Google': 1001, 'wenji': 1002, 'Neverland': 1004, 'AngelaChang': 1005, 'ShenaRingo': 1006, 'TECC': 1007, 'Indiapac': 1009, 'DMP': 1010, 'BDWMFinance': 1011, 'WMHXS': 1012, 'Mavis': 1013, 'HSCINFO': 1014, 'DMB': 1015, 'JaneZhang': 1017, 'BeiShe': 1019, 'CACA': 1020, 'YOGA': 1022, 'GXue': 1023, 'twxgx': 1026, 'PRA': 1027, 'FofArt': 1028, 'LSIA': 1029, 'SaintSeiya': 1034, 'YOCSEF_GS': 1038, 'DMA': 1039, 'BibiChou': 1040, 'ElvaHsiao': 1041, 'SkateBoarding': 1043, 'QingHai': 1045, 'NingXia': 1046, 'HKCA': 1047, 'ADA': 1048, 'HscAssn': 1050, 'Skiing': 1051, 'Shin': 1052, 'MengTingWei': 1053, 'Game_Factory': 1054, 'Admin9_Bar': 1055, 'Circuit': 1058, 'pkpk': 1059, 'ChineseCulture': 1061, 'ZongJiaoZheXue': 1062, 'CFH': 1063, 'Adonis': 1064, 'Admin7_Bar': 1066, 'DotA': 1067, 'HSJCE': 1069, 'Magic': 1070, 'DigitalMusic': 1071, 'Echo': 1072, 'BaiduClub': 1073, 'OldSoftware': 1074, 'PKU_HMT': 1075, 'PKU_OIR': 1076, 'AiYuanClub': 1077, 'AbnormalPSY': 1078, 'LogicCriThink': 1079, 'Admin6_Bla': 1080, 'Bourgeoisie': 1081, 'OcciMusic': 1084, 'ILCA': 1088, 'MANYATTA': 1090, 'XiYou': 1091, 'pkuwuxia': 1092, 'FishLeong': 1094, 'IMM': 1095}
class RequestSourceValidator(object): REQUIRED_AUTHENTICATIONS = ["manager", "host"] SUPPORTED_TRANSPORT_METHODS = ['vddk', 'ssh'] def __init__(self, request): self._request = request self._errors = [] def validate(self): for auth in self.REQUIRED_AUTHENTICATIONS: if auth not in self._request["source"]["authentication"]: self._errors.append("Missing '%s' in request['source']['authentication']" % auth) if "hostname" not in self._request["source"]["authentication"][auth]: self._errors.append("Missing 'hostname' in request['source']['authentication']['%s']" % auth) if self._request["source"]["transport_method"] not in self.SUPPORTED_TRANSPORT_METHODS: self._errors.append("Transport method '%s' is not supported" % self._request["source"]["transport_method"]) getattr(self, '_validate_authentication_' + self._request["source"]["transport_method"]) return self._errors def _validate_authentication_vddk(self): if "username" not in self._request["source"]["authentication"]: self._errors.append("Missing 'username' in request['source']['authentication']") if "password" not in self._request["source"]["authentication"]: self._errors.append("Missing 'password' in request['source']['authentication']") def _validate_authentication_ssh(self): if "username" not in self._request["source"]["authentication"]: self._errors.append("Missing 'username' in request['source']['authentication']") if "ssh_key" not in self._request["source"]["authentication"]: self._errors.append("Missing 'ssh_key' in request['source']['authentication']")
class Requestsourcevalidator(object): required_authentications = ['manager', 'host'] supported_transport_methods = ['vddk', 'ssh'] def __init__(self, request): self._request = request self._errors = [] def validate(self): for auth in self.REQUIRED_AUTHENTICATIONS: if auth not in self._request['source']['authentication']: self._errors.append("Missing '%s' in request['source']['authentication']" % auth) if 'hostname' not in self._request['source']['authentication'][auth]: self._errors.append("Missing 'hostname' in request['source']['authentication']['%s']" % auth) if self._request['source']['transport_method'] not in self.SUPPORTED_TRANSPORT_METHODS: self._errors.append("Transport method '%s' is not supported" % self._request['source']['transport_method']) getattr(self, '_validate_authentication_' + self._request['source']['transport_method']) return self._errors def _validate_authentication_vddk(self): if 'username' not in self._request['source']['authentication']: self._errors.append("Missing 'username' in request['source']['authentication']") if 'password' not in self._request['source']['authentication']: self._errors.append("Missing 'password' in request['source']['authentication']") def _validate_authentication_ssh(self): if 'username' not in self._request['source']['authentication']: self._errors.append("Missing 'username' in request['source']['authentication']") if 'ssh_key' not in self._request['source']['authentication']: self._errors.append("Missing 'ssh_key' in request['source']['authentication']")
string = input() result = [] for index in range(len(string)): if string[index].isupper(): result.append(index) print(result)
string = input() result = [] for index in range(len(string)): if string[index].isupper(): result.append(index) print(result)
x = 10 if (x % 2) == 0 and (x % 5) == 0: print(x) A1 = "ostrich" print('o' in A1) print('r' not in A1)
x = 10 if x % 2 == 0 and x % 5 == 0: print(x) a1 = 'ostrich' print('o' in A1) print('r' not in A1)
class Solution: def XXX(self, nums: List[int]) -> bool: length = len(nums) global tag tag = False def dfs(idx): if idx == length - 1: global tag tag = True return if idx >= length or nums[idx] < 1: return for i in range(1, nums[idx] + 1): dfs(idx + i) return dfs(0) return tag
class Solution: def xxx(self, nums: List[int]) -> bool: length = len(nums) global tag tag = False def dfs(idx): if idx == length - 1: global tag tag = True return if idx >= length or nums[idx] < 1: return for i in range(1, nums[idx] + 1): dfs(idx + i) return dfs(0) return tag
# https://www.youtube.com/watch?v=fFVZt-6sgyo # broute force def subarraySum(nums, k): count = 0 for i in range(len(nums)): sub_sum = 0 for j in range(i, len(nums)): sub_sum += nums[j] if sub_sum == k: count += 1 return count # sliding window, only applys to positive numbers(No zero) case def subarray_sum(arr, k): if k < arr[0]: return 0 count, sub_sum = 0, 0 start, end = 0, 0 for end in range(start, len(arr)): sub_sum += arr[end] while sub_sum >= k: if sub_sum == k: count += 1 sub_sum -= arr[start] start += 1 return count # prefix sum + hashmap def subarraySum(nums, k): # prefix_sum count, by default we have prefix_sum = {0 : 1} sub_sum, count = 0, 0 for i in range(len(nums)): sub_sum += nums[i] diff = sub_sum - k # check if the prefix sum exist the sum equals diff count += prefix_sum.get(diff, 0) # increase the count for the cur observed sum prefix_sum[sub_sum] = 1 + prefix_sum.get(sub_sum, 0) return count nums=[0,1,2,3] #nums=[1,-1,0] #nums = [1,1,1] print(subarray_sum(nums, 0))
def subarray_sum(nums, k): count = 0 for i in range(len(nums)): sub_sum = 0 for j in range(i, len(nums)): sub_sum += nums[j] if sub_sum == k: count += 1 return count def subarray_sum(arr, k): if k < arr[0]: return 0 (count, sub_sum) = (0, 0) (start, end) = (0, 0) for end in range(start, len(arr)): sub_sum += arr[end] while sub_sum >= k: if sub_sum == k: count += 1 sub_sum -= arr[start] start += 1 return count def subarray_sum(nums, k): prefix_sum = {0: 1} (sub_sum, count) = (0, 0) for i in range(len(nums)): sub_sum += nums[i] diff = sub_sum - k count += prefix_sum.get(diff, 0) prefix_sum[sub_sum] = 1 + prefix_sum.get(sub_sum, 0) return count nums = [0, 1, 2, 3] print(subarray_sum(nums, 0))
# -*- coding: utf-8 -*- ''' Management of Open vSwitch ports. ''' def __virtual__(): ''' Only make these states available if Open vSwitch module is available. ''' return 'openvswitch.port_add' in __salt__ def present(name, bridge): ''' Ensures that the named port exists on bridge, eventually creates it. Args: name: The name of the port. bridge: The name of the bridge. ''' ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} bridge_exists = __salt__['openvswitch.bridge_exists'](bridge) if bridge_exists: port_list = __salt__['openvswitch.port_list'](bridge) # Comment and change messages comment_bridge_notexists = 'Bridge {0} does not exist.'.format(bridge) comment_port_exists = 'Port {0} already exists.'.format(name) comment_port_created = 'Port {0} created on bridge {1}.'.format(name, bridge) comment_port_notcreated = 'Unable to create port {0} on bridge {1}.'.format(name, bridge) changes_port_created = {name: {'old': 'No port named {0} present.'.format(name), 'new': 'Created port {1} on bridge {0}.'.format(bridge, name), } } # Dry run, test=true mode if __opts__['test']: if bridge_exists: if name in port_list: ret['result'] = True ret['comment'] = comment_port_exists else: ret['result'] = None ret['comment'] = comment_port_created ret['changes'] = changes_port_created else: ret['result'] = None ret['comment'] = comment_bridge_notexists return ret if bridge_exists: if name in port_list: ret['result'] = True ret['comment'] = comment_port_exists else: port_add = __salt__['openvswitch.port_add'](bridge, name) if port_add: ret['result'] = True ret['comment'] = comment_port_created ret['changes'] = changes_port_created else: ret['result'] = False ret['comment'] = comment_port_notcreated else: ret['result'] = False ret['comment'] = comment_bridge_notexists return ret def absent(name, bridge=None): ''' Ensures that the named port exists on bridge, eventually deletes it. If bridge is not set, port is removed from whatever bridge contains it. Args: name: The name of the port. bridge: The name of the bridge. ''' ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} if bridge: bridge_exists = __salt__['openvswitch.bridge_exists'](bridge) if bridge_exists: port_list = __salt__['openvswitch.port_list'](bridge) else: port_list = () else: port_list = [name] # Comment and change messages comment_bridge_notexists = 'Bridge {0} does not exist.'.format(bridge) comment_port_notexists = 'Port {0} does not exist on bridge {1}.'.format(name, bridge) comment_port_deleted = 'Port {0} deleted.'.format(name) comment_port_notdeleted = 'Unable to delete port {0}.'.format(name) changes_port_deleted = {name: {'old': 'Port named {0} may exist.'.format(name), 'new': 'Deleted port {0}.'.format(name), } } # Dry run, test=true mode if __opts__['test']: if bridge and not bridge_exists: ret['result'] = None ret['comment'] = comment_bridge_notexists elif name not in port_list: ret['result'] = True ret['comment'] = comment_port_notexists else: ret['result'] = None ret['comment'] = comment_port_deleted ret['changes'] = changes_port_deleted return ret if bridge and not bridge_exists: ret['result'] = False ret['comment'] = comment_bridge_notexists elif name not in port_list: ret['result'] = True ret['comment'] = comment_port_notexists else: if bridge: port_remove = __salt__['openvswitch.port_remove'](br=bridge, port=name) else: port_remove = __salt__['openvswitch.port_remove'](br=None, port=name) if port_remove: ret['result'] = True ret['comment'] = comment_port_deleted ret['changes'] = changes_port_deleted else: ret['result'] = False ret['comment'] = comment_port_notdeleted return ret
""" Management of Open vSwitch ports. """ def __virtual__(): """ Only make these states available if Open vSwitch module is available. """ return 'openvswitch.port_add' in __salt__ def present(name, bridge): """ Ensures that the named port exists on bridge, eventually creates it. Args: name: The name of the port. bridge: The name of the bridge. """ ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} bridge_exists = __salt__['openvswitch.bridge_exists'](bridge) if bridge_exists: port_list = __salt__['openvswitch.port_list'](bridge) comment_bridge_notexists = 'Bridge {0} does not exist.'.format(bridge) comment_port_exists = 'Port {0} already exists.'.format(name) comment_port_created = 'Port {0} created on bridge {1}.'.format(name, bridge) comment_port_notcreated = 'Unable to create port {0} on bridge {1}.'.format(name, bridge) changes_port_created = {name: {'old': 'No port named {0} present.'.format(name), 'new': 'Created port {1} on bridge {0}.'.format(bridge, name)}} if __opts__['test']: if bridge_exists: if name in port_list: ret['result'] = True ret['comment'] = comment_port_exists else: ret['result'] = None ret['comment'] = comment_port_created ret['changes'] = changes_port_created else: ret['result'] = None ret['comment'] = comment_bridge_notexists return ret if bridge_exists: if name in port_list: ret['result'] = True ret['comment'] = comment_port_exists else: port_add = __salt__['openvswitch.port_add'](bridge, name) if port_add: ret['result'] = True ret['comment'] = comment_port_created ret['changes'] = changes_port_created else: ret['result'] = False ret['comment'] = comment_port_notcreated else: ret['result'] = False ret['comment'] = comment_bridge_notexists return ret def absent(name, bridge=None): """ Ensures that the named port exists on bridge, eventually deletes it. If bridge is not set, port is removed from whatever bridge contains it. Args: name: The name of the port. bridge: The name of the bridge. """ ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} if bridge: bridge_exists = __salt__['openvswitch.bridge_exists'](bridge) if bridge_exists: port_list = __salt__['openvswitch.port_list'](bridge) else: port_list = () else: port_list = [name] comment_bridge_notexists = 'Bridge {0} does not exist.'.format(bridge) comment_port_notexists = 'Port {0} does not exist on bridge {1}.'.format(name, bridge) comment_port_deleted = 'Port {0} deleted.'.format(name) comment_port_notdeleted = 'Unable to delete port {0}.'.format(name) changes_port_deleted = {name: {'old': 'Port named {0} may exist.'.format(name), 'new': 'Deleted port {0}.'.format(name)}} if __opts__['test']: if bridge and (not bridge_exists): ret['result'] = None ret['comment'] = comment_bridge_notexists elif name not in port_list: ret['result'] = True ret['comment'] = comment_port_notexists else: ret['result'] = None ret['comment'] = comment_port_deleted ret['changes'] = changes_port_deleted return ret if bridge and (not bridge_exists): ret['result'] = False ret['comment'] = comment_bridge_notexists elif name not in port_list: ret['result'] = True ret['comment'] = comment_port_notexists else: if bridge: port_remove = __salt__['openvswitch.port_remove'](br=bridge, port=name) else: port_remove = __salt__['openvswitch.port_remove'](br=None, port=name) if port_remove: ret['result'] = True ret['comment'] = comment_port_deleted ret['changes'] = changes_port_deleted else: ret['result'] = False ret['comment'] = comment_port_notdeleted return ret
# Copyright 2014 Dave Kludt # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. auth_return = { 'access': { 'token': { 'RAX-AUTH:authenticatedBy': [ 'APIKEY' ], 'expires': '2015-06-23T12:44:18.758Z', 'id': '183e2f66535d4e03a04b2a91cf4a4f83', 'tenant': { 'id': '123456', 'name': '123456' } }, 'serviceCatalog': [ { 'endpoints': [ { 'region': 'IAD', 'publicURL': ( 'https://cdn5.clouddrive.com/' 'v1/MossoCloudFS_123456' ), 'tenantId': 'MossoCloudFS_123456' }, { 'region': 'SYD', 'publicURL': ( 'https://cdn4.clouddrive.com/v1/' 'MossoCloudFS_123456' ), 'tenantId': 'MossoCloudFS_123456' }, { 'region': 'DFW', 'publicURL': ( 'https://cdn1.clouddrive.com/v1/' 'MossoCloudFS_123456' ), 'tenantId': 'MossoCloudFS_123456' }, { 'region': 'HKG', 'publicURL': ( 'https://cdn6.clouddrive.com/v1/' 'MossoCloudFS_123456' ), 'tenantId': 'MossoCloudFS_123456' } ], 'type': 'rax:object-cdn', 'name': 'cloudFilesCDN' }, { 'endpoints': [ { 'region': 'IAD', 'publicURL': ( 'https://storage101.iad3.clouddrive.com/v1' '/MossoCloudFS_123456' ), 'internalURL': ( 'https://snet-storage101.iad3.clouddrive.com/v1' '/MossoCloudFS_123456' ), 'tenantId': 'MossoCloudFS_123456' }, { 'region': 'SYD', 'publicURL': ( 'https://storage101.syd2.clouddrive.com/v1' '/MossoCloudFS_123456' ), 'internalURL': ( 'https://snet-storage101.syd2.clouddrive.com/v1' '/MossoCloudFS_123456' ), 'tenantId': 'MossoCloudFS_123456' }, { 'region': 'DFW', 'publicURL': ( 'https://storage101.dfw1.clouddrive.com/v1' '/MossoCloudFS_123456' ), 'internalURL': ( 'https://snet-storage101.dfw1.clouddrive.com/v1' '/MossoCloudFS_123456' ), 'tenantId': 'MossoCloudFS_123456' }, { 'region': 'HKG', 'publicURL': ( 'https://storage101.hkg1.clouddrive.com/v1' '/MossoCloudFS_123456' ), 'internalURL': ( 'https://snet-storage101.hkg1.clouddrive.com/v1' '/MossoCloudFS_123456' ), 'tenantId': 'MossoCloudFS_123456' } ], 'type': 'object-store', 'name': 'cloudFiles' }, { 'endpoints': [ { 'region': 'DFW', 'publicURL': ( 'https://dfw.blockstorage.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.blockstorage.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' }, { 'region': 'IAD', 'publicURL': ( 'https://iad.blockstorage.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' }, { 'region': 'HKG', 'publicURL': ( 'https://hkg.blockstorage.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' } ], 'type': 'volume', 'name': 'cloudBlockStorage' }, { 'endpoints': [ { 'region': 'IAD', 'publicURL': ( 'https://iad.images.api.rackspacecloud.com/v2' ), 'tenantId': '123456' }, { 'region': 'HKG', 'publicURL': ( 'https://hkg.images.api.rackspacecloud.com/v2' ), 'tenantId': '123456' }, { 'region': 'DFW', 'publicURL': ( 'https://dfw.images.api.rackspacecloud.com/v2' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.images.api.rackspacecloud.com/v2' ), 'tenantId': '123456' } ], 'type': 'image', 'name': 'cloudImages' }, { 'endpoints': [ { 'region': 'HKG', 'publicURL': ( 'https://hkg.queues.api.rackspacecloud.com/' 'v1/123456' ), 'internalURL': ( 'https://snet-hkg.queues.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.queues.api.rackspacecloud.com/' 'v1/123456' ), 'internalURL': ( 'https://snet-syd.queues.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' }, { 'region': 'DFW', 'publicURL': ( 'https://dfw.queues.api.rackspacecloud.com/' 'v1/123456' ), 'internalURL': ( 'https://snet-dfw.queues.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' }, { 'region': 'IAD', 'publicURL': ( 'https://iad.queues.api.rackspacecloud.com/' 'v1/123456' ), 'internalURL': ( 'https://snet-iad.queues.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' } ], 'type': 'rax:queues', 'name': 'cloudQueues' }, { 'endpoints': [ { 'region': 'IAD', 'publicURL': ( 'https://iad.bigdata.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'DFW', 'publicURL': ( 'https://dfw.bigdata.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:bigdata', 'name': 'cloudBigData' }, { 'endpoints': [ { 'region': 'HKG', 'publicURL': ( 'https://hkg.orchestration.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' }, { 'region': 'DFW', 'publicURL': ( 'https://dfw.orchestration.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' }, { 'region': 'IAD', 'publicURL': ( 'https://iad.orchestration.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.orchestration.api.rackspacecloud.com/' 'v1/123456' ), 'tenantId': '123456' } ], 'type': 'orchestration', 'name': 'cloudOrchestration' }, { 'endpoints': [ { 'region': 'IAD', 'tenantId': '123456', 'versionId': '2', 'versionList': ( 'https://iad.servers.api.rackspacecloud.com/' ), 'versionInfo': ( 'https://iad.servers.api.rackspacecloud.com/v2' ), 'publicURL': ( 'https://iad.servers.api.rackspacecloud.com/' 'v2/123456' ) }, { 'region': 'DFW', 'tenantId': '123456', 'versionId': '2', 'versionList': ( 'https://dfw.servers.api.rackspacecloud.com/' ), 'versionInfo': ( 'https://dfw.servers.api.rackspacecloud.com/v2' ), 'publicURL': ( 'https://dfw.servers.api.rackspacecloud.com/' 'v2/123456' ) }, { 'region': 'SYD', 'tenantId': '123456', 'versionId': '2', 'versionList': ( 'https://syd.servers.api.rackspacecloud.com/' ), 'versionInfo': ( 'https://syd.servers.api.rackspacecloud.com/v2' ), 'publicURL': ( 'https://syd.servers.api.rackspacecloud.com/' 'v2/123456' ) }, { 'region': 'HKG', 'tenantId': '123456', 'versionId': '2', 'versionList': ( 'https://hkg.servers.api.rackspacecloud.com/' ), 'versionInfo': ( 'https://hkg.servers.api.rackspacecloud.com/v2' ), 'publicURL': ( 'https://hkg.servers.api.rackspacecloud.com/' 'v2/123456' ) } ], 'type': 'compute', 'name': 'cloudServersOpenStack' }, { 'endpoints': [ { 'region': 'DFW', 'publicURL': ( 'https://dfw.autoscale.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'HKG', 'publicURL': ( 'https://hkg.autoscale.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'IAD', 'publicURL': ( 'https://iad.autoscale.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.autoscale.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:autoscale', 'name': 'autoscale' }, { 'endpoints': [ { 'region': 'DFW', 'publicURL': ( 'https://dfw.databases.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'IAD', 'publicURL': ( 'https://iad.databases.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.databases.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'HKG', 'publicURL': ( 'https://hkg.databases.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:database', 'name': 'cloudDatabases' }, { 'endpoints': [ { 'region': 'IAD', 'publicURL': ( 'https://iad.backup.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'HKG', 'publicURL': ( 'https://hkg.backup.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.backup.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'DFW', 'publicURL': ( 'https://dfw.backup.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:backup', 'name': 'cloudBackup' }, { 'endpoints': [ { 'region': 'IAD', 'publicURL': ( 'https://iad.networks.api.rackspacecloud.com/v2.0' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.networks.api.rackspacecloud.com/v2.0' ), 'tenantId': '123456' }, { 'region': 'DFW', 'publicURL': ( 'https://dfw.networks.api.rackspacecloud.com/v2.0' ), 'tenantId': '123456' }, { 'region': 'HKG', 'publicURL': ( 'https://hkg.networks.api.rackspacecloud.com/v2.0' ), 'tenantId': '123456' } ], 'type': 'network', 'name': 'cloudNetworks' }, { 'endpoints': [ { 'region': 'IAD', 'publicURL': ( 'https://iad.loadbalancers.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'HKG', 'publicURL': ( 'https://hkg.loadbalancers.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'DFW', 'publicURL': ( 'https://dfw.loadbalancers.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.loadbalancers.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:load-balancer', 'name': 'cloudLoadBalancers' }, { 'endpoints': [ { 'region': 'IAD', 'publicURL': ( 'https://global.metrics.api.rackspacecloud.com/' 'v2.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:cloudmetrics', 'name': 'cloudMetrics' }, { 'endpoints': [ { 'region': 'HKG', 'publicURL': ( 'https://hkg.feeds.api.rackspacecloud.com/123456' ), 'internalURL': ( 'https://atom.prod.hkg1.us.ci.rackspace.net/123456' ), 'tenantId': '123456' }, { 'region': 'SYD', 'publicURL': ( 'https://syd.feeds.api.rackspacecloud.com/123456' ), 'internalURL': ( 'https://atom.prod.syd2.us.ci.rackspace.net/123456' ), 'tenantId': '123456' }, { 'region': 'IAD', 'publicURL': ( 'https://iad.feeds.api.rackspacecloud.com/123456' ), 'internalURL': ( 'https://atom.prod.iad3.us.ci.rackspace.net/123456' ), 'tenantId': '123456' }, { 'region': 'DFW', 'publicURL': ( 'https://dfw.feeds.api.rackspacecloud.com/123456' ), 'internalURL': ( 'https://atom.prod.dfw1.us.ci.rackspace.net/123456' ), 'tenantId': '123456' }, { 'region': 'ORD', 'publicURL': ( 'https://ord.feeds.api.rackspacecloud.com/123456' ), 'internalURL': ( 'https://atom.prod.ord1.us.ci.rackspace.net/123456' ), 'tenantId': '123456' } ], 'type': 'rax:feeds', 'name': 'cloudFeeds' }, { 'endpoints': [ { 'region': 'DFW', 'publicURL': ( 'https://sites.api.rackspacecloud.com/v1.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:sites', 'name': 'cloudSites' }, { 'endpoints': [ { 'publicURL': ( 'https://monitoring.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:monitor', 'name': 'cloudMonitoring' }, { 'endpoints': [ { 'publicURL': ( 'https://dns.api.rackspacecloud.com/v1.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:dns', 'name': 'cloudDNS' }, { 'endpoints': [ { 'region': 'DFW', 'publicURL': ( 'https://global.cdn.api.rackspacecloud.com/' 'v1.0/123456' ), 'internalURL': ( 'https://global.cdn.api.rackspacecloud.com/' 'v1.0/123456' ), 'tenantId': '123456' } ], 'type': 'rax:cdn', 'name': 'rackCDN' } ], 'user': { 'RAX-AUTH:defaultRegion': 'IAD', 'id': 'a432dbe77f5e4e20a88aaf1cab26c51b', 'roles': [ { 'description': ( 'A Role that allows a user access' ' to keystone Service methods' ), 'id': '5', 'name': 'object-store:default', 'tenantId': 'MossoCloudFS_123456' }, { 'description': ( 'A Role that allows a user access' ' to keystone Service methods' ), 'id': '6', 'name': 'compute:default', 'tenantId': '123456' }, { 'id': '3', 'name': 'identity:user-admin', 'description': 'User Admin Role.' } ], 'name': 'rusty.shackelford' } } }
auth_return = {'access': {'token': {'RAX-AUTH:authenticatedBy': ['APIKEY'], 'expires': '2015-06-23T12:44:18.758Z', 'id': '183e2f66535d4e03a04b2a91cf4a4f83', 'tenant': {'id': '123456', 'name': '123456'}}, 'serviceCatalog': [{'endpoints': [{'region': 'IAD', 'publicURL': 'https://cdn5.clouddrive.com/v1/MossoCloudFS_123456', 'tenantId': 'MossoCloudFS_123456'}, {'region': 'SYD', 'publicURL': 'https://cdn4.clouddrive.com/v1/MossoCloudFS_123456', 'tenantId': 'MossoCloudFS_123456'}, {'region': 'DFW', 'publicURL': 'https://cdn1.clouddrive.com/v1/MossoCloudFS_123456', 'tenantId': 'MossoCloudFS_123456'}, {'region': 'HKG', 'publicURL': 'https://cdn6.clouddrive.com/v1/MossoCloudFS_123456', 'tenantId': 'MossoCloudFS_123456'}], 'type': 'rax:object-cdn', 'name': 'cloudFilesCDN'}, {'endpoints': [{'region': 'IAD', 'publicURL': 'https://storage101.iad3.clouddrive.com/v1/MossoCloudFS_123456', 'internalURL': 'https://snet-storage101.iad3.clouddrive.com/v1/MossoCloudFS_123456', 'tenantId': 'MossoCloudFS_123456'}, {'region': 'SYD', 'publicURL': 'https://storage101.syd2.clouddrive.com/v1/MossoCloudFS_123456', 'internalURL': 'https://snet-storage101.syd2.clouddrive.com/v1/MossoCloudFS_123456', 'tenantId': 'MossoCloudFS_123456'}, {'region': 'DFW', 'publicURL': 'https://storage101.dfw1.clouddrive.com/v1/MossoCloudFS_123456', 'internalURL': 'https://snet-storage101.dfw1.clouddrive.com/v1/MossoCloudFS_123456', 'tenantId': 'MossoCloudFS_123456'}, {'region': 'HKG', 'publicURL': 'https://storage101.hkg1.clouddrive.com/v1/MossoCloudFS_123456', 'internalURL': 'https://snet-storage101.hkg1.clouddrive.com/v1/MossoCloudFS_123456', 'tenantId': 'MossoCloudFS_123456'}], 'type': 'object-store', 'name': 'cloudFiles'}, {'endpoints': [{'region': 'DFW', 'publicURL': 'https://dfw.blockstorage.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.blockstorage.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}, {'region': 'IAD', 'publicURL': 'https://iad.blockstorage.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}, {'region': 'HKG', 'publicURL': 'https://hkg.blockstorage.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}], 'type': 'volume', 'name': 'cloudBlockStorage'}, {'endpoints': [{'region': 'IAD', 'publicURL': 'https://iad.images.api.rackspacecloud.com/v2', 'tenantId': '123456'}, {'region': 'HKG', 'publicURL': 'https://hkg.images.api.rackspacecloud.com/v2', 'tenantId': '123456'}, {'region': 'DFW', 'publicURL': 'https://dfw.images.api.rackspacecloud.com/v2', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.images.api.rackspacecloud.com/v2', 'tenantId': '123456'}], 'type': 'image', 'name': 'cloudImages'}, {'endpoints': [{'region': 'HKG', 'publicURL': 'https://hkg.queues.api.rackspacecloud.com/v1/123456', 'internalURL': 'https://snet-hkg.queues.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.queues.api.rackspacecloud.com/v1/123456', 'internalURL': 'https://snet-syd.queues.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}, {'region': 'DFW', 'publicURL': 'https://dfw.queues.api.rackspacecloud.com/v1/123456', 'internalURL': 'https://snet-dfw.queues.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}, {'region': 'IAD', 'publicURL': 'https://iad.queues.api.rackspacecloud.com/v1/123456', 'internalURL': 'https://snet-iad.queues.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}], 'type': 'rax:queues', 'name': 'cloudQueues'}, {'endpoints': [{'region': 'IAD', 'publicURL': 'https://iad.bigdata.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'DFW', 'publicURL': 'https://dfw.bigdata.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}], 'type': 'rax:bigdata', 'name': 'cloudBigData'}, {'endpoints': [{'region': 'HKG', 'publicURL': 'https://hkg.orchestration.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}, {'region': 'DFW', 'publicURL': 'https://dfw.orchestration.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}, {'region': 'IAD', 'publicURL': 'https://iad.orchestration.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.orchestration.api.rackspacecloud.com/v1/123456', 'tenantId': '123456'}], 'type': 'orchestration', 'name': 'cloudOrchestration'}, {'endpoints': [{'region': 'IAD', 'tenantId': '123456', 'versionId': '2', 'versionList': 'https://iad.servers.api.rackspacecloud.com/', 'versionInfo': 'https://iad.servers.api.rackspacecloud.com/v2', 'publicURL': 'https://iad.servers.api.rackspacecloud.com/v2/123456'}, {'region': 'DFW', 'tenantId': '123456', 'versionId': '2', 'versionList': 'https://dfw.servers.api.rackspacecloud.com/', 'versionInfo': 'https://dfw.servers.api.rackspacecloud.com/v2', 'publicURL': 'https://dfw.servers.api.rackspacecloud.com/v2/123456'}, {'region': 'SYD', 'tenantId': '123456', 'versionId': '2', 'versionList': 'https://syd.servers.api.rackspacecloud.com/', 'versionInfo': 'https://syd.servers.api.rackspacecloud.com/v2', 'publicURL': 'https://syd.servers.api.rackspacecloud.com/v2/123456'}, {'region': 'HKG', 'tenantId': '123456', 'versionId': '2', 'versionList': 'https://hkg.servers.api.rackspacecloud.com/', 'versionInfo': 'https://hkg.servers.api.rackspacecloud.com/v2', 'publicURL': 'https://hkg.servers.api.rackspacecloud.com/v2/123456'}], 'type': 'compute', 'name': 'cloudServersOpenStack'}, {'endpoints': [{'region': 'DFW', 'publicURL': 'https://dfw.autoscale.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'HKG', 'publicURL': 'https://hkg.autoscale.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'IAD', 'publicURL': 'https://iad.autoscale.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.autoscale.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}], 'type': 'rax:autoscale', 'name': 'autoscale'}, {'endpoints': [{'region': 'DFW', 'publicURL': 'https://dfw.databases.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'IAD', 'publicURL': 'https://iad.databases.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.databases.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'HKG', 'publicURL': 'https://hkg.databases.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}], 'type': 'rax:database', 'name': 'cloudDatabases'}, {'endpoints': [{'region': 'IAD', 'publicURL': 'https://iad.backup.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'HKG', 'publicURL': 'https://hkg.backup.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.backup.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'DFW', 'publicURL': 'https://dfw.backup.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}], 'type': 'rax:backup', 'name': 'cloudBackup'}, {'endpoints': [{'region': 'IAD', 'publicURL': 'https://iad.networks.api.rackspacecloud.com/v2.0', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.networks.api.rackspacecloud.com/v2.0', 'tenantId': '123456'}, {'region': 'DFW', 'publicURL': 'https://dfw.networks.api.rackspacecloud.com/v2.0', 'tenantId': '123456'}, {'region': 'HKG', 'publicURL': 'https://hkg.networks.api.rackspacecloud.com/v2.0', 'tenantId': '123456'}], 'type': 'network', 'name': 'cloudNetworks'}, {'endpoints': [{'region': 'IAD', 'publicURL': 'https://iad.loadbalancers.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'HKG', 'publicURL': 'https://hkg.loadbalancers.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'DFW', 'publicURL': 'https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.loadbalancers.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}], 'type': 'rax:load-balancer', 'name': 'cloudLoadBalancers'}, {'endpoints': [{'region': 'IAD', 'publicURL': 'https://global.metrics.api.rackspacecloud.com/v2.0/123456', 'tenantId': '123456'}], 'type': 'rax:cloudmetrics', 'name': 'cloudMetrics'}, {'endpoints': [{'region': 'HKG', 'publicURL': 'https://hkg.feeds.api.rackspacecloud.com/123456', 'internalURL': 'https://atom.prod.hkg1.us.ci.rackspace.net/123456', 'tenantId': '123456'}, {'region': 'SYD', 'publicURL': 'https://syd.feeds.api.rackspacecloud.com/123456', 'internalURL': 'https://atom.prod.syd2.us.ci.rackspace.net/123456', 'tenantId': '123456'}, {'region': 'IAD', 'publicURL': 'https://iad.feeds.api.rackspacecloud.com/123456', 'internalURL': 'https://atom.prod.iad3.us.ci.rackspace.net/123456', 'tenantId': '123456'}, {'region': 'DFW', 'publicURL': 'https://dfw.feeds.api.rackspacecloud.com/123456', 'internalURL': 'https://atom.prod.dfw1.us.ci.rackspace.net/123456', 'tenantId': '123456'}, {'region': 'ORD', 'publicURL': 'https://ord.feeds.api.rackspacecloud.com/123456', 'internalURL': 'https://atom.prod.ord1.us.ci.rackspace.net/123456', 'tenantId': '123456'}], 'type': 'rax:feeds', 'name': 'cloudFeeds'}, {'endpoints': [{'region': 'DFW', 'publicURL': 'https://sites.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}], 'type': 'rax:sites', 'name': 'cloudSites'}, {'endpoints': [{'publicURL': 'https://monitoring.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}], 'type': 'rax:monitor', 'name': 'cloudMonitoring'}, {'endpoints': [{'publicURL': 'https://dns.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}], 'type': 'rax:dns', 'name': 'cloudDNS'}, {'endpoints': [{'region': 'DFW', 'publicURL': 'https://global.cdn.api.rackspacecloud.com/v1.0/123456', 'internalURL': 'https://global.cdn.api.rackspacecloud.com/v1.0/123456', 'tenantId': '123456'}], 'type': 'rax:cdn', 'name': 'rackCDN'}], 'user': {'RAX-AUTH:defaultRegion': 'IAD', 'id': 'a432dbe77f5e4e20a88aaf1cab26c51b', 'roles': [{'description': 'A Role that allows a user access to keystone Service methods', 'id': '5', 'name': 'object-store:default', 'tenantId': 'MossoCloudFS_123456'}, {'description': 'A Role that allows a user access to keystone Service methods', 'id': '6', 'name': 'compute:default', 'tenantId': '123456'}, {'id': '3', 'name': 'identity:user-admin', 'description': 'User Admin Role.'}], 'name': 'rusty.shackelford'}}}
'''P36 (**) Determine the prime factors of a given positive integer (2). Construct a list containing the prime factors and their multiplicity. Example: * (prime-factors-mult 315) ((3 2) (5 1) (7 1))''' base_divident=int(input('Enter number to find prime factors = ')) final_out=[] original=base_divident #save the original divident,in case needed #function to calculate prime factors def prime(divident): temp_out = [] #temporary list to save the current factor for divisor in range(2, divident+1): #iterate till the given number if divident % divisor ==0: #if remainder is zero,it is complete factor quotient =divident//divisor #save the quotient and use it as the next number temp_out.append(divisor) #save the number which devides the number as whole divident=quotient #the quotient will be treated as next number return divident,temp_out #return the quotient to be passes as new number and the divisor while base_divident !=1: #till the divident number doesnt equal 1,run the process base_divident,catch_out= prime(base_divident) #get the new divident(quotient) and the divisor and pass the quotuent as new number final_out +=catch_out #add the divisor into output list previous_element = final_out[0] #add the first element of the list to check counter = 0 #take a variable counter to count instances of a factor final=[] #final output list for current_element in final_out: #iterate through list containing prime factors if current_element == previous_element: #if current element of the list is equal to previously present counter+=1 #increment the counter else: final.append([previous_element,counter]) #if not,then add the previous element and its count to final list counter=1 #otherwise for non-repeated factor,set the counter to 1 previous_element= current_element #store current value into previous,so new current value will be checked else: final.append([previous_element,counter]) #add the last element and its count to final list print(f'Prime factors of {original}= {final}')
"""P36 (**) Determine the prime factors of a given positive integer (2). Construct a list containing the prime factors and their multiplicity. Example: * (prime-factors-mult 315) ((3 2) (5 1) (7 1))""" base_divident = int(input('Enter number to find prime factors = ')) final_out = [] original = base_divident def prime(divident): temp_out = [] for divisor in range(2, divident + 1): if divident % divisor == 0: quotient = divident // divisor temp_out.append(divisor) divident = quotient return (divident, temp_out) while base_divident != 1: (base_divident, catch_out) = prime(base_divident) final_out += catch_out previous_element = final_out[0] counter = 0 final = [] for current_element in final_out: if current_element == previous_element: counter += 1 else: final.append([previous_element, counter]) counter = 1 previous_element = current_element else: final.append([previous_element, counter]) print(f'Prime factors of {original}= {final}')
# This module contains a function to print Hello, World! # Prints Hello, World! def hello(): print("Hello, World!")
def hello(): print('Hello, World!')
class Difference: def __init__(self, a): self.__elements = a def computeDifference(self): result = [] data_len = len(self.__elements) for i in range(data_len): for n in range(i, data_len): if i == n: continue x = self.__elements[i] y = self.__elements[n] # calculate the absolute value and push it into resul result.append(abs(x - y)) self.maximumDifference = max(result) if __name__ == '__main__': _ = input() a = [int(e) for e in input().split(' ')] d = Difference(a) d.computeDifference() print(d.maximumDifference)
class Difference: def __init__(self, a): self.__elements = a def compute_difference(self): result = [] data_len = len(self.__elements) for i in range(data_len): for n in range(i, data_len): if i == n: continue x = self.__elements[i] y = self.__elements[n] result.append(abs(x - y)) self.maximumDifference = max(result) if __name__ == '__main__': _ = input() a = [int(e) for e in input().split(' ')] d = difference(a) d.computeDifference() print(d.maximumDifference)
# https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii class Solution: def minMoves2(self, nums: List[int]) -> int: nums = sorted(nums) if len(nums) % 2 == 1: mid = nums[len(nums) // 2] else: mid = (nums[len(nums) // 2] + nums[len(nums) // 2 - 1]) // 2 res = 0 for num in nums: res += abs(num - mid) return res
class Solution: def min_moves2(self, nums: List[int]) -> int: nums = sorted(nums) if len(nums) % 2 == 1: mid = nums[len(nums) // 2] else: mid = (nums[len(nums) // 2] + nums[len(nums) // 2 - 1]) // 2 res = 0 for num in nums: res += abs(num - mid) return res
guests = ["sam","mike","darren"] for i in range(len(guests)): print("Hello, "+guests[i].title()+" you are invited to dinner") print(" ") print(guests[0]+" cant make it to dinner unfortunately") guests[0] = "alicia" for i in range(len(guests)): print("Hello, "+guests[i].title()+" you are invited to dinner") print("Hello, I just reserved a bigger dinner table so now there's room for more people") guests.insert(0,"john") middle_index = (len(guests)/2).__ceil__(); guests.insert(middle_index,"janet") guests.insert(len(guests),"brown") for i in range(len(guests)): print("Hello, "+guests[i].title()+" you are invited to dinner") c = 0 for i in range(len(guests)): c = c + 1 print("No of guests invited to dinner: ",c)
guests = ['sam', 'mike', 'darren'] for i in range(len(guests)): print('Hello, ' + guests[i].title() + ' you are invited to dinner') print(' ') print(guests[0] + ' cant make it to dinner unfortunately') guests[0] = 'alicia' for i in range(len(guests)): print('Hello, ' + guests[i].title() + ' you are invited to dinner') print("Hello, I just reserved a bigger dinner table so now there's room for more people") guests.insert(0, 'john') middle_index = (len(guests) / 2).__ceil__() guests.insert(middle_index, 'janet') guests.insert(len(guests), 'brown') for i in range(len(guests)): print('Hello, ' + guests[i].title() + ' you are invited to dinner') c = 0 for i in range(len(guests)): c = c + 1 print('No of guests invited to dinner: ', c)
__all__=[ 'SG_disease', 'SG_weather', 'MY_dengue', 'MY_malaria', 'BN_disease', 'ID_malaria', 'PH_malaria', 'TH_disease', 'apps_who_int', 'wunderground' ]
__all__ = ['SG_disease', 'SG_weather', 'MY_dengue', 'MY_malaria', 'BN_disease', 'ID_malaria', 'PH_malaria', 'TH_disease', 'apps_who_int', 'wunderground']
while True: usr = input("Enter username: ") with open("users.txt", "r") as file: users = file.readlines() users = [i.strip("\n") for i in users] if usr in users: print("Username exists") continue else: print("Username is fine") break while True: notes = [] psw = input("Enter password: ") if not any(i.isdigit() for i in psw): notes.append("You need at least one number") if not any(i.isupper() for i in psw): notes.append("You need at least one uppercase letter") if len(psw) < 5: notes.append("You need at least 5 characters") if len(notes) == 0: print("Password is fine") break else: print("Please check the following: ") for note in notes: print(note)
while True: usr = input('Enter username: ') with open('users.txt', 'r') as file: users = file.readlines() users = [i.strip('\n') for i in users] if usr in users: print('Username exists') continue else: print('Username is fine') break while True: notes = [] psw = input('Enter password: ') if not any((i.isdigit() for i in psw)): notes.append('You need at least one number') if not any((i.isupper() for i in psw)): notes.append('You need at least one uppercase letter') if len(psw) < 5: notes.append('You need at least 5 characters') if len(notes) == 0: print('Password is fine') break else: print('Please check the following: ') for note in notes: print(note)
def set_default_values(args, also_hyper_params=True): # -set default-values for certain arguments based on chosen scenario & experiment if args.tasks is None: if args.experiment=='splitMNIST': args.num_classes = 10 if args.experiment=='splitMNISToneclass': args.num_classes = 10 elif args.experiment=='permMNIST': args.num_classes = 100 elif args.experiment=='cifar10': args.num_classes = 10 elif args.experiment=='cifar100': args.num_classes = 100 if args.iters is None: if args.experiment=='splitMNIST': args.iters = 2000 elif args.experiment=='splitMNISToneclass': args.iters = 2000 elif args.experiment=='permMNIST': args.iters = 5000 elif args.experiment=='cifar100': args.iters = 5000 elif args.experiment=='cifar10': args.iters = 5000 elif args.experiment=='block2d': args.iters = 5000 if args.lr is None: if args.ebm: if args.experiment=='splitMNIST': args.lr = 0.0001 if args.experiment=='splitMNISToneclass': args.lr = 0.0001 elif args.experiment=='permMNIST': args.lr = 0.00001 elif args.experiment=='cifar100': args.lr = 0.00001 elif args.experiment=='cifar10': args.lr = 0.00001 elif args.experiment=='block2d': args.lr = 0.00001 else: if args.experiment=='splitMNIST': args.lr = 0.001 if args.experiment=='splitMNISToneclass': args.lr = 0.001 elif args.experiment=='permMNIST': args.lr = 0.0001 elif args.experiment=='cifar100': args.lr = 0.0001 elif args.experiment=='cifar10': args.lr = 0.0001 elif args.experiment=='block2d': args.lr = 0.0001 if args.fc_units is None: if args.experiment=='splitMNIST': args.fc_units = 400 if args.experiment=='splitMNISToneclass': args.fc_units = 400 elif args.experiment=='permMNIST': args.fc_units = 1000 elif args.experiment=='cifar100': args.fc_units = 1000 elif args.experiment=='cifar10': args.fc_units = 1000 elif args.experiment=='block2d': args.fc_units = 400 print(args) return args
def set_default_values(args, also_hyper_params=True): if args.tasks is None: if args.experiment == 'splitMNIST': args.num_classes = 10 if args.experiment == 'splitMNISToneclass': args.num_classes = 10 elif args.experiment == 'permMNIST': args.num_classes = 100 elif args.experiment == 'cifar10': args.num_classes = 10 elif args.experiment == 'cifar100': args.num_classes = 100 if args.iters is None: if args.experiment == 'splitMNIST': args.iters = 2000 elif args.experiment == 'splitMNISToneclass': args.iters = 2000 elif args.experiment == 'permMNIST': args.iters = 5000 elif args.experiment == 'cifar100': args.iters = 5000 elif args.experiment == 'cifar10': args.iters = 5000 elif args.experiment == 'block2d': args.iters = 5000 if args.lr is None: if args.ebm: if args.experiment == 'splitMNIST': args.lr = 0.0001 if args.experiment == 'splitMNISToneclass': args.lr = 0.0001 elif args.experiment == 'permMNIST': args.lr = 1e-05 elif args.experiment == 'cifar100': args.lr = 1e-05 elif args.experiment == 'cifar10': args.lr = 1e-05 elif args.experiment == 'block2d': args.lr = 1e-05 else: if args.experiment == 'splitMNIST': args.lr = 0.001 if args.experiment == 'splitMNISToneclass': args.lr = 0.001 elif args.experiment == 'permMNIST': args.lr = 0.0001 elif args.experiment == 'cifar100': args.lr = 0.0001 elif args.experiment == 'cifar10': args.lr = 0.0001 elif args.experiment == 'block2d': args.lr = 0.0001 if args.fc_units is None: if args.experiment == 'splitMNIST': args.fc_units = 400 if args.experiment == 'splitMNISToneclass': args.fc_units = 400 elif args.experiment == 'permMNIST': args.fc_units = 1000 elif args.experiment == 'cifar100': args.fc_units = 1000 elif args.experiment == 'cifar10': args.fc_units = 1000 elif args.experiment == 'block2d': args.fc_units = 400 print(args) return args
# coding: utf-8 class DataBatch: def __init__(self, mxnet_module): self._data = [] self._label = [] self.mxnet_module = mxnet_module def append_data(self, new_data): self._data.append(self.__as_ndarray(new_data)) def append_label(self, new_label): self._label.append(self.__as_ndarray(new_label)) def __as_ndarray(self, in_data): return self.mxnet_module.ndarray.array(in_data, self.mxnet_module.cpu()) @property def data(self): return self._data @property def label(self): return self._label
class Databatch: def __init__(self, mxnet_module): self._data = [] self._label = [] self.mxnet_module = mxnet_module def append_data(self, new_data): self._data.append(self.__as_ndarray(new_data)) def append_label(self, new_label): self._label.append(self.__as_ndarray(new_label)) def __as_ndarray(self, in_data): return self.mxnet_module.ndarray.array(in_data, self.mxnet_module.cpu()) @property def data(self): return self._data @property def label(self): return self._label
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def maxLevelSum(self, root: TreeNode) -> int: if root is None: return 0 result, current = [], [root] while current: next_level, vals = [], [] for node in current: vals.append(node.val) if node.left: next_level.append(node.left) if node.right: next_level.append(node.right) current = next_level result.append(vals) result = [sum(i) for i in result] print(result) for idx, v in enumerate(result): if v == max(result): return idx+1
class Solution: def max_level_sum(self, root: TreeNode) -> int: if root is None: return 0 (result, current) = ([], [root]) while current: (next_level, vals) = ([], []) for node in current: vals.append(node.val) if node.left: next_level.append(node.left) if node.right: next_level.append(node.right) current = next_level result.append(vals) result = [sum(i) for i in result] print(result) for (idx, v) in enumerate(result): if v == max(result): return idx + 1
class Registry(dict): def __init__(self, *args, **kwargs): super(Registry, self).__init__(*args, **kwargs) def register(self, module_name): def register_fn(module): assert module_name not in self self[module_name] = module return module return register_fn
class Registry(dict): def __init__(self, *args, **kwargs): super(Registry, self).__init__(*args, **kwargs) def register(self, module_name): def register_fn(module): assert module_name not in self self[module_name] = module return module return register_fn
def findCandidate(A): maj_index = 0 count = 1 for i in range(len(A)): if A[maj_index] == A[i]: count += 1 else: count -= 1 if count == 0: maj_index, count = i, 1 return A[maj_index] def isMajority(A, cand, k): count = 0 for i in range(len(A)): if A[i] == cand: count += 1 if count > len(A)/k: return True else: return False def printMajority(A, k): cand = findCandidate(A) if isMajority(A, cand, k) == True: print(cand) else: print("No Majority Element") printMajority([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,4, 4, 5, 6, 7, 8, 4, 4, 5, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4], 3)
def find_candidate(A): maj_index = 0 count = 1 for i in range(len(A)): if A[maj_index] == A[i]: count += 1 else: count -= 1 if count == 0: (maj_index, count) = (i, 1) return A[maj_index] def is_majority(A, cand, k): count = 0 for i in range(len(A)): if A[i] == cand: count += 1 if count > len(A) / k: return True else: return False def print_majority(A, k): cand = find_candidate(A) if is_majority(A, cand, k) == True: print(cand) else: print('No Majority Element') print_majority([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 7, 8, 4, 4, 5, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4], 3)
# unihernandez22 # https://atcoder.jp/contests/abc159/tasks/abc159_a # math print(sum(map(lambda i: int(i)*(int(i)-1)//2, input().split())))
print(sum(map(lambda i: int(i) * (int(i) - 1) // 2, input().split())))
# define a function that display the output heading def output_heading(): print('Programmer: Emily') print('Course: COSC146') print('Lab#: 0') print('Due Date: 02-19-2019') #define a function that takes a number and returns that number + 10 def plus10(value): value = value + 10 return value #call function print_heading output_heading() #call function plus10 print(plus10(1000)) # define a function that takes in two parameters and return their sum def sumoftwo(x, y): return x + y print(sumoftwo(5,10)) print(sumoftwo('lil','phil'))
def output_heading(): print('Programmer: Emily') print('Course: COSC146') print('Lab#: 0') print('Due Date: 02-19-2019') def plus10(value): value = value + 10 return value output_heading() print(plus10(1000)) def sumoftwo(x, y): return x + y print(sumoftwo(5, 10)) print(sumoftwo('lil', 'phil'))
class Codec: url_list = [] def encode(self, longUrl): self.url_list.append(longUrl) return len(self.url_list) - 1 def decode(self, shortUrl): return self.url_list[shortUrl] if __name__ == '__main__': codec = Codec() print(codec.decode(codec.encode('xxxxx'))) print(codec.url_list)
class Codec: url_list = [] def encode(self, longUrl): self.url_list.append(longUrl) return len(self.url_list) - 1 def decode(self, shortUrl): return self.url_list[shortUrl] if __name__ == '__main__': codec = codec() print(codec.decode(codec.encode('xxxxx'))) print(codec.url_list)
class BaseEndpoint(): def __repr__(self): return f'<metrics.tools Endpoint [{self.endpoint}]>' if __name__ == '__main__': pass
class Baseendpoint: def __repr__(self): return f'<metrics.tools Endpoint [{self.endpoint}]>' if __name__ == '__main__': pass
s = input() start = s.find('A') stop = s.rfind('Z') print(stop - start + 1)
s = input() start = s.find('A') stop = s.rfind('Z') print(stop - start + 1)
# ~autogen spec_version spec_version = "spec: 0.9.3-pre-r2, kernel: v3.16.7-ckt16-7-ev3dev-ev3" # ~autogen
spec_version = 'spec: 0.9.3-pre-r2, kernel: v3.16.7-ckt16-7-ev3dev-ev3'
def sol(): N = int(input()) string = input() count = 0 while N > 0: count += int(string[N - 1]) N -= 1 print(count) if __name__ == "__main__": sol()
def sol(): n = int(input()) string = input() count = 0 while N > 0: count += int(string[N - 1]) n -= 1 print(count) if __name__ == '__main__': sol()
# list a = 'orange' print(a[::-1]) print(a[1:4:2]) b = [1,2,3,34,5, 1] print(b.count(1))
a = 'orange' print(a[::-1]) print(a[1:4:2]) b = [1, 2, 3, 34, 5, 1] print(b.count(1))
N = int(input()) A, B = map(int, input().split()) counts = [0, 0, 0] P = map(int, input().split()) for p in P: if p <= A: counts[0] += 1 elif p <= B: counts[1] += 1 else: counts[2] += 1 print(min(counts))
n = int(input()) (a, b) = map(int, input().split()) counts = [0, 0, 0] p = map(int, input().split()) for p in P: if p <= A: counts[0] += 1 elif p <= B: counts[1] += 1 else: counts[2] += 1 print(min(counts))
#!/bin/python3 print("Status: 200") print("Content-Type: text/plain") print() print("Hello World!")
print('Status: 200') print('Content-Type: text/plain') print() print('Hello World!')
color = { "black":(0, 0, 0, 255), "white":(255, 255, 255, 255), "red":(255, 0, 0, 255), "green":(0, 255, 0, 255), "blue":(0, 0, 255, 255), "yellow":(255, 255, 0, 255), "cyan":(0, 255, 255, 255), "magenta":(255, 0, 255, 255), "silver":(192, 192, 192, 255), "gray":(128, 128, 128, 255), "maroon":(128, 0, 0, 255), "olive":(128, 128, 0, 255), "darkgreen":(0, 128, 0, 255), "purple":(128, 0, 128, 255), "teal":(0, 0, 128, 255), "orange":(255, 165, 0, 255), "turquoise":(64, 224, 208, 255), "sky":(135, 206, 250, 255), "pink":(255, 192, 203, 255), "brown":(139, 69, 19, 255), "lightgray":(180, 180, 180, 255), "lightgrey":(180, 180, 180, 255) }
color = {'black': (0, 0, 0, 255), 'white': (255, 255, 255, 255), 'red': (255, 0, 0, 255), 'green': (0, 255, 0, 255), 'blue': (0, 0, 255, 255), 'yellow': (255, 255, 0, 255), 'cyan': (0, 255, 255, 255), 'magenta': (255, 0, 255, 255), 'silver': (192, 192, 192, 255), 'gray': (128, 128, 128, 255), 'maroon': (128, 0, 0, 255), 'olive': (128, 128, 0, 255), 'darkgreen': (0, 128, 0, 255), 'purple': (128, 0, 128, 255), 'teal': (0, 0, 128, 255), 'orange': (255, 165, 0, 255), 'turquoise': (64, 224, 208, 255), 'sky': (135, 206, 250, 255), 'pink': (255, 192, 203, 255), 'brown': (139, 69, 19, 255), 'lightgray': (180, 180, 180, 255), 'lightgrey': (180, 180, 180, 255)}
_base_ = [ '../_base_/models/fast_scnn.py', '../_base_/datasets/pascal_escroom.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' ] # Re-config the data sampler. data = dict(samples_per_gpu=2, workers_per_gpu=4) # Re-config the optimizer. optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-5) # runtime settings checkpoint_config = dict(by_epoch=False, interval=8000) evaluation = dict(interval=8000, metric='mIoU')
_base_ = ['../_base_/models/fast_scnn.py', '../_base_/datasets/pascal_escroom.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'] data = dict(samples_per_gpu=2, workers_per_gpu=4) optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-05) checkpoint_config = dict(by_epoch=False, interval=8000) evaluation = dict(interval=8000, metric='mIoU')
NBA_GAME_TIME = 48 def nba_extrap(points_per_game: float, minutes_per_game: float) -> float: if minutes_per_game < 0.001: return 0.0 else: return round(points_per_game/minutes_per_game * NBA_GAME_TIME, 1)
nba_game_time = 48 def nba_extrap(points_per_game: float, minutes_per_game: float) -> float: if minutes_per_game < 0.001: return 0.0 else: return round(points_per_game / minutes_per_game * NBA_GAME_TIME, 1)
#!/usr/bin/env python3 # Common physical "constants" # Universal gas constant (J/K/mol) R_gas = 8.3144598 # "Standard gravity": rate of gravitational acceleration at Earth's surface (m/s2) g0 = 9.80665 # Avogadro's number (molec/mol) avog = 6.022140857e23 # Molar mass of dry air (g/mol) MW_air = 28.97 # Radius of Earth (m) R_earth = 6.375e6
r_gas = 8.3144598 g0 = 9.80665 avog = 6.022140857e+23 mw_air = 28.97 r_earth = 6375000.0
def check_palindrome(str): return str == str[::-1] print(check_palindrome('palpa')) print(check_palindrome('radar'))
def check_palindrome(str): return str == str[::-1] print(check_palindrome('palpa')) print(check_palindrome('radar'))
def write(_text): return 0 def flush(): pass def _emit_ansi_escape(_=''): def inner(_=None): pass return inner clear_line = _emit_ansi_escape() clear_end = _emit_ansi_escape() hide_cursor = _emit_ansi_escape() show_cursor = _emit_ansi_escape() factory_cursor_up = lambda _: _emit_ansi_escape() def cols(): return 0 # more details in `alive_progress.tools.sampling#overhead`. carriage_return = ''
def write(_text): return 0 def flush(): pass def _emit_ansi_escape(_=''): def inner(_=None): pass return inner clear_line = _emit_ansi_escape() clear_end = _emit_ansi_escape() hide_cursor = _emit_ansi_escape() show_cursor = _emit_ansi_escape() factory_cursor_up = lambda _: _emit_ansi_escape() def cols(): return 0 carriage_return = ''
fibona = 89 anterior = 34 while fibona > 0: print(fibona) fibona -= anterior anterior = fibona - anterior if fibona == 0: print(fibona)
fibona = 89 anterior = 34 while fibona > 0: print(fibona) fibona -= anterior anterior = fibona - anterior if fibona == 0: print(fibona)
def search(blocking, requester, task, keyword, tty_mode): # the result of the task the hub thread submitted to us # will not be available right now task.set_async() blocking.search_image(requester, task.return_result, keyword, tty_mode)
def search(blocking, requester, task, keyword, tty_mode): task.set_async() blocking.search_image(requester, task.return_result, keyword, tty_mode)
class Solution: def getRow(self, rowIndex: int) -> List[int]: n=rowIndex if n==0: return [1] if n==1: return [1,1] arr=[[1],[1,1]] k=1 for i in range(2,n+1): arr.append([]) arr[i].append(1) for j in range(1,k+1): arr[i].append(arr[i-1][j-1]+arr[i-1][j]) k+=1 arr[i].append(1) return arr[n]
class Solution: def get_row(self, rowIndex: int) -> List[int]: n = rowIndex if n == 0: return [1] if n == 1: return [1, 1] arr = [[1], [1, 1]] k = 1 for i in range(2, n + 1): arr.append([]) arr[i].append(1) for j in range(1, k + 1): arr[i].append(arr[i - 1][j - 1] + arr[i - 1][j]) k += 1 arr[i].append(1) return arr[n]
def kangaroo(x1, v1, x2, v2): while (True): if (x2 > x1 and v2 >= v1) or (x2 < x1 and v2 <= v1): print('NO') return 'NO' x1 += v1 x2 += v2 if x1 == x2: print('YES') return 'YES'
def kangaroo(x1, v1, x2, v2): while True: if x2 > x1 and v2 >= v1 or (x2 < x1 and v2 <= v1): print('NO') return 'NO' x1 += v1 x2 += v2 if x1 == x2: print('YES') return 'YES'
class Solution: def threeSumClosest(self, nums: List[int], target: int) -> int: nums.sort() result = float("inf") for i in range(len(nums) - 2): l, r = i + 1, len(nums) - 1 while l < r: s = nums[i] + nums[l] + nums[r] if s == target: return target if abs(s - target) < abs(result - target): result = s if s > target: r -= 1 else: l += 1 return result
class Solution: def three_sum_closest(self, nums: List[int], target: int) -> int: nums.sort() result = float('inf') for i in range(len(nums) - 2): (l, r) = (i + 1, len(nums) - 1) while l < r: s = nums[i] + nums[l] + nums[r] if s == target: return target if abs(s - target) < abs(result - target): result = s if s > target: r -= 1 else: l += 1 return result
print("Hours in a year =") print(24*365) print("Minutes in a decade =") print(60*24*365*10) print("My age in seconds =") print((365*27+6+2+31+30+31+30+16)*24*1440) print("Andreea's age =") print(48618000/(365*24*1440)) print("?!") print(1<<2) # ** = ^ # << = bitshift # % = modulus print('Hello world') print('') print('Goodbye')
print('Hours in a year =') print(24 * 365) print('Minutes in a decade =') print(60 * 24 * 365 * 10) print('My age in seconds =') print((365 * 27 + 6 + 2 + 31 + 30 + 31 + 30 + 16) * 24 * 1440) print("Andreea's age =") print(48618000 / (365 * 24 * 1440)) print('?!') print(1 << 2) print('Hello world') print('') print('Goodbye')
terminalfont = { "width": 6, "height": 8, "start": 32, "end": 127, "data": bytearray([ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x5F, 0x06, 0x00, 0x00, 0x07, 0x03, 0x00, 0x07, 0x03, 0x00, 0x24, 0x7E, 0x24, 0x7E, 0x24, 0x00, 0x24, 0x2B, 0x6A, 0x12, 0x00, 0x00, 0x63, 0x13, 0x08, 0x64, 0x63, 0x00, 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x41, 0x00, 0x00, 0x00, 0x00, 0x41, 0x3E, 0x00, 0x00, 0x00, 0x08, 0x3E, 0x1C, 0x3E, 0x08, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0xE0, 0x60, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, 0x62, 0x51, 0x49, 0x49, 0x46, 0x00, 0x22, 0x49, 0x49, 0x49, 0x36, 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, 0x2F, 0x49, 0x49, 0x49, 0x31, 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30, 0x00, 0x01, 0x71, 0x09, 0x05, 0x03, 0x00, 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E, 0x00, 0x00, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0xEC, 0x6C, 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, 0x3E, 0x41, 0x5D, 0x55, 0x1E, 0x00, 0x7E, 0x11, 0x11, 0x11, 0x7E, 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A, 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, 0x30, 0x40, 0x40, 0x40, 0x3F, 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, 0x7F, 0x02, 0x04, 0x02, 0x7F, 0x00, 0x7F, 0x02, 0x04, 0x08, 0x7F, 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, 0x7F, 0x09, 0x09, 0x19, 0x66, 0x00, 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01, 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, 0x3F, 0x40, 0x3C, 0x40, 0x3F, 0x00, 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, 0x07, 0x08, 0x70, 0x08, 0x07, 0x00, 0x71, 0x49, 0x45, 0x43, 0x00, 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00, 0x00, 0x04, 0x02, 0x01, 0x02, 0x04, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x00, 0x20, 0x54, 0x54, 0x54, 0x78, 0x00, 0x7F, 0x44, 0x44, 0x44, 0x38, 0x00, 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, 0x38, 0x44, 0x44, 0x44, 0x7F, 0x00, 0x38, 0x54, 0x54, 0x54, 0x08, 0x00, 0x08, 0x7E, 0x09, 0x09, 0x00, 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C, 0x00, 0x7F, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00, 0x00, 0x7D, 0x40, 0x00, 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00, 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x40, 0x00, 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78, 0x00, 0x7C, 0x04, 0x04, 0x78, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0xFC, 0x44, 0x44, 0x44, 0x38, 0x00, 0x38, 0x44, 0x44, 0x44, 0xFC, 0x00, 0x44, 0x78, 0x44, 0x04, 0x08, 0x00, 0x08, 0x54, 0x54, 0x54, 0x20, 0x00, 0x04, 0x3E, 0x44, 0x24, 0x00, 0x00, 0x3C, 0x40, 0x20, 0x7C, 0x00, 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, 0x3C, 0x60, 0x30, 0x60, 0x3C, 0x00, 0x6C, 0x10, 0x10, 0x6C, 0x00, 0x00, 0x9C, 0xA0, 0x60, 0x3C, 0x00, 0x00, 0x64, 0x54, 0x54, 0x4C, 0x00, 0x00, 0x08, 0x3E, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x3E, 0x08, 0x00, 0x02, 0x01, 0x02, 0x01, 0x00, 0x00, 0x3C, 0x26, 0x23, 0x26, 0x3C ])}
terminalfont = {'width': 6, 'height': 8, 'start': 32, 'end': 127, 'data': bytearray([0, 0, 0, 0, 0, 0, 0, 0, 6, 95, 6, 0, 0, 7, 3, 0, 7, 3, 0, 36, 126, 36, 126, 36, 0, 36, 43, 106, 18, 0, 0, 99, 19, 8, 100, 99, 0, 54, 73, 86, 32, 80, 0, 0, 7, 3, 0, 0, 0, 0, 62, 65, 0, 0, 0, 0, 65, 62, 0, 0, 0, 8, 62, 28, 62, 8, 0, 8, 8, 62, 8, 8, 0, 0, 224, 96, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 96, 96, 0, 0, 0, 32, 16, 8, 4, 2, 0, 62, 81, 73, 69, 62, 0, 0, 66, 127, 64, 0, 0, 98, 81, 73, 73, 70, 0, 34, 73, 73, 73, 54, 0, 24, 20, 18, 127, 16, 0, 47, 73, 73, 73, 49, 0, 60, 74, 73, 73, 48, 0, 1, 113, 9, 5, 3, 0, 54, 73, 73, 73, 54, 0, 6, 73, 73, 41, 30, 0, 0, 108, 108, 0, 0, 0, 0, 236, 108, 0, 0, 0, 8, 20, 34, 65, 0, 0, 36, 36, 36, 36, 36, 0, 0, 65, 34, 20, 8, 0, 2, 1, 89, 9, 6, 0, 62, 65, 93, 85, 30, 0, 126, 17, 17, 17, 126, 0, 127, 73, 73, 73, 54, 0, 62, 65, 65, 65, 34, 0, 127, 65, 65, 65, 62, 0, 127, 73, 73, 73, 65, 0, 127, 9, 9, 9, 1, 0, 62, 65, 73, 73, 122, 0, 127, 8, 8, 8, 127, 0, 0, 65, 127, 65, 0, 0, 48, 64, 64, 64, 63, 0, 127, 8, 20, 34, 65, 0, 127, 64, 64, 64, 64, 0, 127, 2, 4, 2, 127, 0, 127, 2, 4, 8, 127, 0, 62, 65, 65, 65, 62, 0, 127, 9, 9, 9, 6, 0, 62, 65, 81, 33, 94, 0, 127, 9, 9, 25, 102, 0, 38, 73, 73, 73, 50, 0, 1, 1, 127, 1, 1, 0, 63, 64, 64, 64, 63, 0, 31, 32, 64, 32, 31, 0, 63, 64, 60, 64, 63, 0, 99, 20, 8, 20, 99, 0, 7, 8, 112, 8, 7, 0, 113, 73, 69, 67, 0, 0, 0, 127, 65, 65, 0, 0, 2, 4, 8, 16, 32, 0, 0, 65, 65, 127, 0, 0, 4, 2, 1, 2, 4, 128, 128, 128, 128, 128, 128, 0, 0, 3, 7, 0, 0, 0, 32, 84, 84, 84, 120, 0, 127, 68, 68, 68, 56, 0, 56, 68, 68, 68, 40, 0, 56, 68, 68, 68, 127, 0, 56, 84, 84, 84, 8, 0, 8, 126, 9, 9, 0, 0, 24, 164, 164, 164, 124, 0, 127, 4, 4, 120, 0, 0, 0, 0, 125, 64, 0, 0, 64, 128, 132, 125, 0, 0, 127, 16, 40, 68, 0, 0, 0, 0, 127, 64, 0, 0, 124, 4, 24, 4, 120, 0, 124, 4, 4, 120, 0, 0, 56, 68, 68, 68, 56, 0, 252, 68, 68, 68, 56, 0, 56, 68, 68, 68, 252, 0, 68, 120, 68, 4, 8, 0, 8, 84, 84, 84, 32, 0, 4, 62, 68, 36, 0, 0, 60, 64, 32, 124, 0, 0, 28, 32, 64, 32, 28, 0, 60, 96, 48, 96, 60, 0, 108, 16, 16, 108, 0, 0, 156, 160, 96, 60, 0, 0, 100, 84, 84, 76, 0, 0, 8, 62, 65, 65, 0, 0, 0, 0, 119, 0, 0, 0, 0, 65, 65, 62, 8, 0, 2, 1, 2, 1, 0, 0, 60, 38, 35, 38, 60])}
# Einfache Rechenoperationen # Addition und Subtraktion 1 + 2 1 - 2 # Multiplikation und Division 1 * 2 1 / 2 # Rechenregeln (1 + 2) * 3 1 + 2 * 3 print("Hello World!")
1 + 2 1 - 2 1 * 2 1 / 2 (1 + 2) * 3 1 + 2 * 3 print('Hello World!')
def build_model_filters(model, query, field): filters = [] if query: # The field exists as an exposed column if model.__mapper__.has_property(field): filters.append(getattr(model, field).like("%{}%".format(query))) return filters
def build_model_filters(model, query, field): filters = [] if query: if model.__mapper__.has_property(field): filters.append(getattr(model, field).like('%{}%'.format(query))) return filters
count=0 num=336 for i in range(2,num+1): while num%i==0: num=num//i if i == 2: count=count+1 print(count) ''' num=32546845 count=0 while num>0: digit=num%10 num=num//10 if digit%2==0: count=count+1 print(count) ''' ''' count=0 for i in range(1,101): while i%5==0: count=count+1 break print(count) ''' ''' sum=0 for i in range(1,101): while i>0: digit=i%10 i=i//10 sum=sum+digit print(sum) '''
count = 0 num = 336 for i in range(2, num + 1): while num % i == 0: num = num // i if i == 2: count = count + 1 print(count) '\nnum=32546845\ncount=0\nwhile num>0:\n digit=num%10\n num=num//10\n if digit%2==0:\n count=count+1\nprint(count)\n' '\ncount=0\nfor i in range(1,101):\n while i%5==0:\n count=count+1\n break\nprint(count)\n' '\nsum=0\nfor i in range(1,101):\n while i>0:\n digit=i%10\n i=i//10\n sum=sum+digit\nprint(sum)\n'
n=int(input()) for i in range(n): D = dict() for j in range(ord('a'),ord('z')+1): D[j] = 0 a=input() a=a.lower() for j in a: if ord('a') <= ord(j) <=ord('z'): D[ord(j)] += 1 num = min(D.values()) print("Case {}:".format(i+1),end=" ") if num == 0: print("Not a pangram") elif num ==1: print("Pangram!") elif num ==2: print("Double pangram!!") else: print("Triple pangram!!!")
n = int(input()) for i in range(n): d = dict() for j in range(ord('a'), ord('z') + 1): D[j] = 0 a = input() a = a.lower() for j in a: if ord('a') <= ord(j) <= ord('z'): D[ord(j)] += 1 num = min(D.values()) print('Case {}:'.format(i + 1), end=' ') if num == 0: print('Not a pangram') elif num == 1: print('Pangram!') elif num == 2: print('Double pangram!!') else: print('Triple pangram!!!')
GAME_RESET = "on_reset" GOAL_SCORED = "on_goal_scored" START_PENALTY = "on_penalty_start" END_PENALTY = "on_penalty_end"
game_reset = 'on_reset' goal_scored = 'on_goal_scored' start_penalty = 'on_penalty_start' end_penalty = 'on_penalty_end'
array = [1,2,3,4] result = [24,12,8,6] def product_except_itself_2(nums): output = [] L = [] R = [] temp = 1 for x in nums: L.append(temp) temp = temp * x temp = 1 for y in nums[::-1]: R.append(temp) temp = temp * y for i in range(len(R)): output.append(L[i]*R[len(R)-1-i]) return output print("Input: " + str(array)) print("Expected: " + str(result)) print("Output: " + str(product_except_itself_2(array)))
array = [1, 2, 3, 4] result = [24, 12, 8, 6] def product_except_itself_2(nums): output = [] l = [] r = [] temp = 1 for x in nums: L.append(temp) temp = temp * x temp = 1 for y in nums[::-1]: R.append(temp) temp = temp * y for i in range(len(R)): output.append(L[i] * R[len(R) - 1 - i]) return output print('Input: ' + str(array)) print('Expected: ' + str(result)) print('Output: ' + str(product_except_itself_2(array)))
# UUU F CUU L AUU I GUU V # UUC F CUC L AUC I GUC V # UUA L CUA L AUA I GUA V # UUG L CUG L AUG M GUG V # UCU S CCU P ACU T GCU A # UCC S CCC P ACC T GCC A # UCA S CCA P ACA T GCA A # UCG S CCG P ACG T GCG A # UAU Y CAU H AAU N GAU D # UAC Y CAC H AAC N GAC D # UAA Stop CAA Q AAA K GAA E # UAG Stop CAG Q AAG K GAG E # UGU C CGU R AGU S GGU G # UGC C CGC R AGC S GGC G # UGA Stop CGA R AGA R GGA G # UGG W CGG R AGG R GGG G lookup = { 'UUU': 'F', 'CUU': 'L', 'AUU': 'I', 'GUU': 'V', 'UUC': 'F', 'CUC': 'L', 'AUC': 'I', 'GUC': 'V', 'UUA': 'L', 'CUA': 'L', 'AUA': 'I', 'GUA': 'V', 'UUG': 'L', 'CUG': 'L', 'AUG': 'M', 'GUG': 'V', 'UCU': 'S', 'CCU': 'P', 'ACU': 'T', 'GCU': 'A', 'UCC': 'S', 'CCC': 'P', 'ACC': 'T', 'GCC': 'A', 'UCA': 'S', 'CCA': 'P', 'ACA': 'T', 'GCA': 'A', 'UCG': 'S', 'CCG': 'P', 'ACG': 'T', 'GCG': 'A', 'UAU': 'Y', 'CAU': 'H', 'AAU': 'N', 'GAU': 'D', 'UAC': 'Y', 'CAC': 'H', 'AAC': 'N', 'GAC': 'D', 'UAA': 'Stop', 'CAA': 'Q', 'AAA': 'K', 'GAA': 'E', 'UAG': 'Stop', 'CAG': 'Q', 'AAG': 'K', 'GAG': 'E', 'UGU': 'C', 'CGU': 'R', 'AGU': 'S', 'GGU': 'G', 'UGC': 'C', 'CGC': 'R', 'AGC': 'S', 'GGC': 'G', 'UGA': 'Stop', 'CGA': 'R', 'AGA': 'R', 'GGA': 'G', 'UGG': 'W', 'CGG': 'R', 'AGG': 'R', 'GGG': 'G' } def convert_rna_to_protein(rna_sequence): protein_list = [] for i in range(0, len(rna_sequence), 3): codon = rna_sequence[i:i+3] protein = lookup[codon] if protein != 'Stop': protein_list.append(protein) protein_sequence = ''.join(protein_list) return protein_sequence if __name__ == '__main__': rna_sequence = input("Enter RNA sequence:\n") protein_sequence = convert_rna_to_protein(rna_sequence) print(protein_sequence)
lookup = {'UUU': 'F', 'CUU': 'L', 'AUU': 'I', 'GUU': 'V', 'UUC': 'F', 'CUC': 'L', 'AUC': 'I', 'GUC': 'V', 'UUA': 'L', 'CUA': 'L', 'AUA': 'I', 'GUA': 'V', 'UUG': 'L', 'CUG': 'L', 'AUG': 'M', 'GUG': 'V', 'UCU': 'S', 'CCU': 'P', 'ACU': 'T', 'GCU': 'A', 'UCC': 'S', 'CCC': 'P', 'ACC': 'T', 'GCC': 'A', 'UCA': 'S', 'CCA': 'P', 'ACA': 'T', 'GCA': 'A', 'UCG': 'S', 'CCG': 'P', 'ACG': 'T', 'GCG': 'A', 'UAU': 'Y', 'CAU': 'H', 'AAU': 'N', 'GAU': 'D', 'UAC': 'Y', 'CAC': 'H', 'AAC': 'N', 'GAC': 'D', 'UAA': 'Stop', 'CAA': 'Q', 'AAA': 'K', 'GAA': 'E', 'UAG': 'Stop', 'CAG': 'Q', 'AAG': 'K', 'GAG': 'E', 'UGU': 'C', 'CGU': 'R', 'AGU': 'S', 'GGU': 'G', 'UGC': 'C', 'CGC': 'R', 'AGC': 'S', 'GGC': 'G', 'UGA': 'Stop', 'CGA': 'R', 'AGA': 'R', 'GGA': 'G', 'UGG': 'W', 'CGG': 'R', 'AGG': 'R', 'GGG': 'G'} def convert_rna_to_protein(rna_sequence): protein_list = [] for i in range(0, len(rna_sequence), 3): codon = rna_sequence[i:i + 3] protein = lookup[codon] if protein != 'Stop': protein_list.append(protein) protein_sequence = ''.join(protein_list) return protein_sequence if __name__ == '__main__': rna_sequence = input('Enter RNA sequence:\n') protein_sequence = convert_rna_to_protein(rna_sequence) print(protein_sequence)
DB_PATH = 'assets/survey_data.db' REVIEWS_PATH = 'static/files/reviews.csv' QUESTIONS_PATH = 'static/files/questions.csv' USER_TABLE = 'users' STMT_USER_TABLE = f'''CREATE TABLE IF NOT EXISTS {USER_TABLE} (netid int PRIMARY KEY, age int, internet_use int)''' REVIEWS_TABLE = 'reviews' STMT_REVIEWS_TABLE = f'''CREATE TABLE IF NOT EXISTS {REVIEWS_TABLE} (id int PRIMARY KEY, statement text, type int)''' STUDY_ONE_TABLE = 'study_one' STMT_STUDY_ONE_TABLE = f'''CREATE TABLE IF NOT EXISTS {STUDY_ONE_TABLE} (id int PRIMARY KEY, user_id int, review_id int, question_id int, value int)''' QUESTIONS_TABLE = 'questions' STMT_QUESTIONS_TABLE = f'''CREATE TABLE IF NOT EXISTS {QUESTIONS_TABLE} (id int PRIMARY KEY, statement text, type int, min text, max text)''' STUDY_TWO_TABLE = 'study_two' STMT_STUDY_TWO_TABLE = f'''CREATE TABLE IF NOT EXISTS {STUDY_TWO_TABLE} (id int PRIMARY KEY, user_id int, question_id int, value int)'''
db_path = 'assets/survey_data.db' reviews_path = 'static/files/reviews.csv' questions_path = 'static/files/questions.csv' user_table = 'users' stmt_user_table = f'CREATE TABLE IF NOT EXISTS {USER_TABLE}\n (netid int PRIMARY KEY, age int, internet_use int)' reviews_table = 'reviews' stmt_reviews_table = f'CREATE TABLE IF NOT EXISTS {REVIEWS_TABLE}\n (id int PRIMARY KEY, statement text, type int)' study_one_table = 'study_one' stmt_study_one_table = f'CREATE TABLE IF NOT EXISTS {STUDY_ONE_TABLE}\n (id int PRIMARY KEY, user_id int, review_id int, \n question_id int, value int)' questions_table = 'questions' stmt_questions_table = f'CREATE TABLE IF NOT EXISTS {QUESTIONS_TABLE}\n (id int PRIMARY KEY, statement text, type int, min text, max text)' study_two_table = 'study_two' stmt_study_two_table = f'CREATE TABLE IF NOT EXISTS {STUDY_TWO_TABLE}\n (id int PRIMARY KEY, user_id int, question_id int, value int)'
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isBalanced(self, root: TreeNode) -> bool: if self.height(root) is None: return False else: return True; def height(self, node): #base case if(node is None): return 0; left = self.height(node.left); right = self.height(node.right); if(left is None or right is None): return None; if(abs(left - right) > 1): return None; return 1 + max(left, right);
class Solution: def is_balanced(self, root: TreeNode) -> bool: if self.height(root) is None: return False else: return True def height(self, node): if node is None: return 0 left = self.height(node.left) right = self.height(node.right) if left is None or right is None: return None if abs(left - right) > 1: return None return 1 + max(left, right)
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def cloc(): http_archive( name="cloc" , build_file="//bazel/deps/cloc:build.BUILD" , sha256="da1a0de6d8ce2f4e80fa7554cf605f86d97d761b4ffd647df9b01c4658107dba" , strip_prefix="cloc-90070481081b6decd9446d57a35176da3a6d8fbc" , urls = [ "https://github.com/Unilang/cloc/archive/90070481081b6decd9446d57a35176da3a6d8fbc.tar.gz", ], )
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def cloc(): http_archive(name='cloc', build_file='//bazel/deps/cloc:build.BUILD', sha256='da1a0de6d8ce2f4e80fa7554cf605f86d97d761b4ffd647df9b01c4658107dba', strip_prefix='cloc-90070481081b6decd9446d57a35176da3a6d8fbc', urls=['https://github.com/Unilang/cloc/archive/90070481081b6decd9446d57a35176da3a6d8fbc.tar.gz'])
valid_names = ["Danilo", "Daniel", "Dani"] class NameError(Exception): pass def handler(event, context): name = event.get("name",None) if name: if name in valid_names: return event else: raise NameError("WrongName") else: raise NameError("NoName")
valid_names = ['Danilo', 'Daniel', 'Dani'] class Nameerror(Exception): pass def handler(event, context): name = event.get('name', None) if name: if name in valid_names: return event else: raise name_error('WrongName') else: raise name_error('NoName')
class SparseTable: def __init__(self,array,func): self.array = array self.func = func self._log = self._logPreprocess() self.sparseTable = self._preprocess() def _logPreprocess(self): n = len(self.array); _log = [0] * (n+1) for i in range(2,n+1): _log[i] = _log[n//2] + 1 return _log def _preprocess(self): n = len(self.array) k = self._log[n]+1 sTable = [[0]*k for i in range(n)] for i in range(n): sTable[i][0] = self.array[i] for j in range(1,k+1): for i in range(n+1): if i + (1 << j) > n: break sTable[i][j] = self.func(sTable[i][j-1], sTable[i + (1 << (j-1))][j-1]) return sTable def query(self,l,r): l,r = min(l,r),max(l,r) j = self._log[r-l+1] return self.func(self.sparseTable[l][j], self.sparseTable[r-(1 << j)+1][j]) def __len__(self): return len(self.array) def __getitem__(self,interval): if type(interval) == int: if interval < 0: raise IndexError("Negatives indexes aren't supported") l,r = (interval,interval) else: l = interval.start or 0 r = interval.stop or len(self.array)-1 if l < 0 or r < 0: raise IndexError("Negatives indexes aren't supported") return self.query(l,r) def __str__(self): return '\n'.join(' '.join(map(str,row)) for row in self.sparseTable) def __repr__(self): return f"SparseTable({self.array},{self.func.__name__})"
class Sparsetable: def __init__(self, array, func): self.array = array self.func = func self._log = self._logPreprocess() self.sparseTable = self._preprocess() def _log_preprocess(self): n = len(self.array) _log = [0] * (n + 1) for i in range(2, n + 1): _log[i] = _log[n // 2] + 1 return _log def _preprocess(self): n = len(self.array) k = self._log[n] + 1 s_table = [[0] * k for i in range(n)] for i in range(n): sTable[i][0] = self.array[i] for j in range(1, k + 1): for i in range(n + 1): if i + (1 << j) > n: break sTable[i][j] = self.func(sTable[i][j - 1], sTable[i + (1 << j - 1)][j - 1]) return sTable def query(self, l, r): (l, r) = (min(l, r), max(l, r)) j = self._log[r - l + 1] return self.func(self.sparseTable[l][j], self.sparseTable[r - (1 << j) + 1][j]) def __len__(self): return len(self.array) def __getitem__(self, interval): if type(interval) == int: if interval < 0: raise index_error("Negatives indexes aren't supported") (l, r) = (interval, interval) else: l = interval.start or 0 r = interval.stop or len(self.array) - 1 if l < 0 or r < 0: raise index_error("Negatives indexes aren't supported") return self.query(l, r) def __str__(self): return '\n'.join((' '.join(map(str, row)) for row in self.sparseTable)) def __repr__(self): return f'SparseTable({self.array},{self.func.__name__})'
class SampleNotMatchedError(Exception): pass class InvalidRangeError(Exception): pass
class Samplenotmatchederror(Exception): pass class Invalidrangeerror(Exception): pass
cat=int(input("Ingrese la categoria del trbajdor: ")) suel=int(input("Ingrese el sueldo bruto del trabajador: ")) if(cat==1): suelt1=suel* 0.10 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP") elif(cat==2): suelt1=suel* 0.15 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP") elif(cat==3): suelt1=suel* 0.20 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP") elif(cat==4): suelt1=suel* 0.40 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP") elif(cat==5): suelt1=suel* 0.60 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP")
cat = int(input('Ingrese la categoria del trbajdor: ')) suel = int(input('Ingrese el sueldo bruto del trabajador: ')) if cat == 1: suelt1 = suel * 0.1 suelt = suelt1 + suel print('Categoria: ' + str(cat)) print('Susueldo bruto con aumento es de: {:.0f}'.format(suelt), ' COP') elif cat == 2: suelt1 = suel * 0.15 suelt = suelt1 + suel print('Categoria: ' + str(cat)) print('Susueldo bruto con aumento es de: {:.0f}'.format(suelt), ' COP') elif cat == 3: suelt1 = suel * 0.2 suelt = suelt1 + suel print('Categoria: ' + str(cat)) print('Susueldo bruto con aumento es de: {:.0f}'.format(suelt), ' COP') elif cat == 4: suelt1 = suel * 0.4 suelt = suelt1 + suel print('Categoria: ' + str(cat)) print('Susueldo bruto con aumento es de: {:.0f}'.format(suelt), ' COP') elif cat == 5: suelt1 = suel * 0.6 suelt = suelt1 + suel print('Categoria: ' + str(cat)) print('Susueldo bruto con aumento es de: {:.0f}'.format(suelt), ' COP')
Train_0 = ['P26', 'P183', 'P89', 'P123', 'P61', 'P112', 'P63', 'P184', 'P100', 'P11', 'P111', 'P28', 'P192', 'P35', 'P27', 'P113', 'P33', 'P17', 'P126', 'P176', 'P46', 'P44', 'P137', 'P13', 'P74', 'P134', 'P128', 'P0', 'P157', 'P161', 'P163', 'P38', 'P190', 'P12', 'P115', 'P122', 'P144', 'P15', 'P154', 'P48', 'P187', 'P200', 'P99', 'P150', 'P53', 'P191', 'P79', 'P169', 'P19', 'P121', 'P90', 'P174', 'P117', 'P140', 'P85', 'P59', 'P168', 'P31', 'P21', 'P1', 'P97', 'P67', 'P107', 'P54', 'P181', 'P94', 'P30', 'P109', 'P47', 'P91', 'P2', 'P22', 'P62', 'P88', 'P66', 'P83', 'P76', 'P118', 'P65', 'P180', 'P179', 'P189', 'P173', 'P41', 'P166', 'P80', 'P193', 'P194', 'P6', 'P45', 'P182', 'P55', 'P177', 'P124', 'P165', 'P201', 'P110', 'P105', 'P125', 'P136', 'P102', 'P64', 'P50', 'P52', 'P162', 'P82', 'P106', 'P78', 'P186', 'P146', 'P36', 'P158', 'P84', 'P167', 'P43', 'P103', 'P96', 'P153', 'P5', 'P127', 'P20', 'P131', 'P198', 'P34', 'P185', 'P10', 'P87', 'P77', 'P25', 'P3', 'P39', 'P72', 'P160', 'P156', 'P40', 'P149', 'P204', 'P135', 'P8', 'P130', 'P70', 'P60'] Val_0 = ['P23', 'P199', 'P202', 'P42', 'P159', 'P116', 'P37', 'P171', 'P141', 'P51', 'P142', 'P129', 'P147', 'P104', 'P164', 'P155', 'P151', 'P29', 'P145', 'P95', 'P101'] Train_1 = ['P162', 'P62', 'P19', 'P37', 'P74', 'P109', 'P191', 'P99', 'P54', 'P88', 'P64', 'P78', 'P87', 'P95', 'P59', 'P80', 'P149', 'P72', 'P154', 'P168', 'P111', 'P146', 'P5', 'P136', 'P180', 'P23', 'P28', 'P70', 'P107', 'P187', 'P165', 'P182', 'P169', 'P186', 'P103', 'P26', 'P184', 'P171', 'P115', 'P85', 'P53', 'P102', 'P83', 'P11', 'P77', 'P122', 'P13', 'P97', 'P185', 'P10', 'P104', 'P38', 'P123', 'P27', 'P199', 'P129', 'P151', 'P190', 'P17', 'P43', 'P41', 'P201', 'P181', 'P36', 'P20', 'P163', 'P51', 'P183', 'P177', 'P94', 'P167', 'P42', 'P128', 'P45', 'P82', 'P200', 'P25', 'P84', 'P118', 'P156', 'P176', 'P79', 'P166', 'P142', 'P134', 'P137', 'P121', 'P144', 'P46', 'P153', 'P204', 'P100', 'P198', 'P60', 'P161', 'P44', 'P130', 'P202', 'P31', 'P160', 'P1', 'P48', 'P8', 'P173', 'P15', 'P50', 'P34', 'P116', 'P140', 'P126', 'P159', 'P157', 'P110', 'P65', 'P35', 'P0', 'P6', 'P55', 'P105', 'P2', 'P22', 'P30', 'P189', 'P125', 'P21', 'P147', 'P141', 'P155', 'P91', 'P29', 'P96', 'P89', 'P67', 'P3', 'P145', 'P76', 'P174', 'P39', 'P192', 'P194', 'P40', 'P193', 'P33'] Val_1 = ['P179', 'P164', 'P113', 'P124', 'P61', 'P117', 'P112', 'P63', 'P101', 'P131', 'P135', 'P90', 'P106', 'P150', 'P47', 'P158', 'P12', 'P52', 'P66', 'P127'] Train_2 = ['P30', 'P164', 'P180', 'P12', 'P51', 'P64', 'P38', 'P44', 'P42', 'P186', 'P162', 'P65', 'P136', 'P147', 'P28', 'P190', 'P5', 'P22', 'P174', 'P34', 'P113', 'P39', 'P25', 'P181', 'P110', 'P131', 'P2', 'P8', 'P74', 'P53', 'P85', 'P157', 'P103', 'P50', 'P67', 'P13', 'P112', 'P82', 'P130', 'P83', 'P167', 'P134', 'P127', 'P105', 'P76', 'P179', 'P124', 'P189', 'P89', 'P72', 'P59', 'P0', 'P26', 'P19', 'P151', 'P27', 'P107', 'P52', 'P187', 'P10', 'P3', 'P126', 'P70', 'P150', 'P104', 'P165', 'P45', 'P33', 'P154', 'P168', 'P48', 'P15', 'P192', 'P117', 'P201', 'P199', 'P183', 'P194', 'P66', 'P90', 'P141', 'P166', 'P20', 'P106', 'P84', 'P173', 'P17', 'P35', 'P144', 'P87', 'P37', 'P23', 'P149', 'P47', 'P97', 'P91', 'P198', 'P171', 'P55', 'P159', 'P116', 'P102', 'P122', 'P204', 'P61', 'P6', 'P1', 'P79', 'P125', 'P193', 'P156', 'P123', 'P140', 'P80', 'P155', 'P135', 'P177', 'P115', 'P169', 'P63', 'P31', 'P21', 'P96', 'P185', 'P100', 'P43', 'P202', 'P129', 'P118', 'P142', 'P77', 'P29', 'P101', 'P128', 'P78', 'P146', 'P11', 'P36', 'P94', 'P88', 'P54', 'P153', 'P121'] Val_2 = ['P184', 'P62', 'P158', 'P111', 'P161', 'P182', 'P40', 'P176', 'P60', 'P191', 'P109', 'P145', 'P41', 'P95', 'P160', 'P99', 'P137', 'P46', 'P163', 'P200'] Train_3 = ['P166', 'P48', 'P29', 'P147', 'P190', 'P67', 'P89', 'P6', 'P109', 'P181', 'P3', 'P59', 'P164', 'P167', 'P107', 'P28', 'P141', 'P27', 'P127', 'P36', 'P173', 'P82', 'P44', 'P41', 'P55', 'P128', 'P125', 'P99', 'P163', 'P186', 'P135', 'P112', 'P179', 'P180', 'P61', 'P194', 'P91', 'P33', 'P10', 'P51', 'P77', 'P95', 'P110', 'P105', 'P204', 'P130', 'P38', 'P131', 'P156', 'P8', 'P185', 'P43', 'P124', 'P182', 'P96', 'P94', 'P136', 'P83', 'P126', 'P158', 'P45', 'P100', 'P169', 'P121', 'P142', 'P34', 'P1', 'P62', 'P191', 'P151', 'P25', 'P47', 'P129', 'P85', 'P123', 'P189', 'P184', 'P76', 'P176', 'P157', 'P199', 'P87', 'P17', 'P134', 'P13', 'P200', 'P153', 'P74', 'P97', 'P19', 'P116', 'P149', 'P23', 'P64', 'P5', 'P11', 'P39', 'P104', 'P52', 'P165', 'P101', 'P183', 'P111', 'P201', 'P42', 'P35', 'P202', 'P162', 'P122', 'P187', 'P79', 'P2', 'P53', 'P50', 'P106', 'P54', 'P26', 'P30', 'P161', 'P37', 'P154', 'P70', 'P88', 'P155', 'P146', 'P63', 'P78', 'P144', 'P118', 'P15', 'P22', 'P80', 'P115', 'P31', 'P171', 'P192', 'P193', 'P20', 'P137', 'P12', 'P103', 'P140'] Val_3 = ['P102', 'P150', 'P66', 'P174', 'P117', 'P84', 'P46', 'P177', 'P40', 'P168', 'P72', 'P90', 'P21', 'P113', 'P159', 'P145', 'P160', 'P65', 'P198', 'P60', 'P0'] Train_4 = ['P145', 'P72', 'P70', 'P146', 'P53', 'P176', 'P169', 'P113', 'P35', 'P26', 'P5', 'P161', 'P106', 'P200', 'P107', 'P117', 'P192', 'P45', 'P189', 'P15', 'P174', 'P181', 'P141', 'P42', 'P100', 'P135', 'P130', 'P61', 'P165', 'P204', 'P201', 'P151', 'P60', 'P10', 'P20', 'P91', 'P66', 'P137', 'P155', 'P97', 'P194', 'P140', 'P79', 'P54', 'P17', 'P166', 'P125', 'P33', 'P29', 'P116', 'P44', 'P109', 'P74', 'P149', 'P46', 'P55', 'P59', 'P159', 'P84', 'P27', 'P112', 'P160', 'P38', 'P126', 'P37', 'P129', 'P30', 'P65', 'P63', 'P171', 'P11', 'P102', 'P95', 'P0', 'P52', 'P101', 'P88', 'P142', 'P105', 'P99', 'P118', 'P158', 'P78', 'P36', 'P90', 'P6', 'P80', 'P51', 'P64', 'P41', 'P202', 'P43', 'P76', 'P62', 'P31', 'P22', 'P34', 'P150', 'P190', 'P124', 'P156', 'P182', 'P193', 'P186', 'P147', 'P167', 'P131', 'P3', 'P144', 'P163', 'P136', 'P121', 'P128', 'P123', 'P39', 'P50', 'P199', 'P157', 'P87', 'P47', 'P21', 'P154', 'P89', 'P111', 'P184', 'P168', 'P40', 'P162', 'P12', 'P103', 'P1', 'P96', 'P83', 'P8', 'P85', 'P67', 'P153', 'P82', 'P2', 'P110', 'P77', 'P191', 'P185'] Val_4 = ['P94', 'P134', 'P23', 'P28', 'P177', 'P187', 'P180', 'P122', 'P104', 'P13', 'P127', 'P198', 'P179', 'P173', 'P164', 'P25', 'P115', 'P48', 'P183', 'P19'] test_indices = ['P71', 'P16', 'P114', 'P170', 'P98', 'P69', 'P92', 'P132', 'P81', 'P73', 'P143', 'P175', 'P56', 'P139', 'P152', 'P203', 'P75', 'P9', 'P24', 'P4', 'P32', 'P120', 'P138', 'P172', 'P57', 'P195', 'P68', 'P133', 'P14', 'P119', 'P7', 'P49', 'P93', 'P178', 'P58', 'P108', 'P197', 'P196', 'P86', 'P18', 'P188', 'P148']
train_0 = ['P26', 'P183', 'P89', 'P123', 'P61', 'P112', 'P63', 'P184', 'P100', 'P11', 'P111', 'P28', 'P192', 'P35', 'P27', 'P113', 'P33', 'P17', 'P126', 'P176', 'P46', 'P44', 'P137', 'P13', 'P74', 'P134', 'P128', 'P0', 'P157', 'P161', 'P163', 'P38', 'P190', 'P12', 'P115', 'P122', 'P144', 'P15', 'P154', 'P48', 'P187', 'P200', 'P99', 'P150', 'P53', 'P191', 'P79', 'P169', 'P19', 'P121', 'P90', 'P174', 'P117', 'P140', 'P85', 'P59', 'P168', 'P31', 'P21', 'P1', 'P97', 'P67', 'P107', 'P54', 'P181', 'P94', 'P30', 'P109', 'P47', 'P91', 'P2', 'P22', 'P62', 'P88', 'P66', 'P83', 'P76', 'P118', 'P65', 'P180', 'P179', 'P189', 'P173', 'P41', 'P166', 'P80', 'P193', 'P194', 'P6', 'P45', 'P182', 'P55', 'P177', 'P124', 'P165', 'P201', 'P110', 'P105', 'P125', 'P136', 'P102', 'P64', 'P50', 'P52', 'P162', 'P82', 'P106', 'P78', 'P186', 'P146', 'P36', 'P158', 'P84', 'P167', 'P43', 'P103', 'P96', 'P153', 'P5', 'P127', 'P20', 'P131', 'P198', 'P34', 'P185', 'P10', 'P87', 'P77', 'P25', 'P3', 'P39', 'P72', 'P160', 'P156', 'P40', 'P149', 'P204', 'P135', 'P8', 'P130', 'P70', 'P60'] val_0 = ['P23', 'P199', 'P202', 'P42', 'P159', 'P116', 'P37', 'P171', 'P141', 'P51', 'P142', 'P129', 'P147', 'P104', 'P164', 'P155', 'P151', 'P29', 'P145', 'P95', 'P101'] train_1 = ['P162', 'P62', 'P19', 'P37', 'P74', 'P109', 'P191', 'P99', 'P54', 'P88', 'P64', 'P78', 'P87', 'P95', 'P59', 'P80', 'P149', 'P72', 'P154', 'P168', 'P111', 'P146', 'P5', 'P136', 'P180', 'P23', 'P28', 'P70', 'P107', 'P187', 'P165', 'P182', 'P169', 'P186', 'P103', 'P26', 'P184', 'P171', 'P115', 'P85', 'P53', 'P102', 'P83', 'P11', 'P77', 'P122', 'P13', 'P97', 'P185', 'P10', 'P104', 'P38', 'P123', 'P27', 'P199', 'P129', 'P151', 'P190', 'P17', 'P43', 'P41', 'P201', 'P181', 'P36', 'P20', 'P163', 'P51', 'P183', 'P177', 'P94', 'P167', 'P42', 'P128', 'P45', 'P82', 'P200', 'P25', 'P84', 'P118', 'P156', 'P176', 'P79', 'P166', 'P142', 'P134', 'P137', 'P121', 'P144', 'P46', 'P153', 'P204', 'P100', 'P198', 'P60', 'P161', 'P44', 'P130', 'P202', 'P31', 'P160', 'P1', 'P48', 'P8', 'P173', 'P15', 'P50', 'P34', 'P116', 'P140', 'P126', 'P159', 'P157', 'P110', 'P65', 'P35', 'P0', 'P6', 'P55', 'P105', 'P2', 'P22', 'P30', 'P189', 'P125', 'P21', 'P147', 'P141', 'P155', 'P91', 'P29', 'P96', 'P89', 'P67', 'P3', 'P145', 'P76', 'P174', 'P39', 'P192', 'P194', 'P40', 'P193', 'P33'] val_1 = ['P179', 'P164', 'P113', 'P124', 'P61', 'P117', 'P112', 'P63', 'P101', 'P131', 'P135', 'P90', 'P106', 'P150', 'P47', 'P158', 'P12', 'P52', 'P66', 'P127'] train_2 = ['P30', 'P164', 'P180', 'P12', 'P51', 'P64', 'P38', 'P44', 'P42', 'P186', 'P162', 'P65', 'P136', 'P147', 'P28', 'P190', 'P5', 'P22', 'P174', 'P34', 'P113', 'P39', 'P25', 'P181', 'P110', 'P131', 'P2', 'P8', 'P74', 'P53', 'P85', 'P157', 'P103', 'P50', 'P67', 'P13', 'P112', 'P82', 'P130', 'P83', 'P167', 'P134', 'P127', 'P105', 'P76', 'P179', 'P124', 'P189', 'P89', 'P72', 'P59', 'P0', 'P26', 'P19', 'P151', 'P27', 'P107', 'P52', 'P187', 'P10', 'P3', 'P126', 'P70', 'P150', 'P104', 'P165', 'P45', 'P33', 'P154', 'P168', 'P48', 'P15', 'P192', 'P117', 'P201', 'P199', 'P183', 'P194', 'P66', 'P90', 'P141', 'P166', 'P20', 'P106', 'P84', 'P173', 'P17', 'P35', 'P144', 'P87', 'P37', 'P23', 'P149', 'P47', 'P97', 'P91', 'P198', 'P171', 'P55', 'P159', 'P116', 'P102', 'P122', 'P204', 'P61', 'P6', 'P1', 'P79', 'P125', 'P193', 'P156', 'P123', 'P140', 'P80', 'P155', 'P135', 'P177', 'P115', 'P169', 'P63', 'P31', 'P21', 'P96', 'P185', 'P100', 'P43', 'P202', 'P129', 'P118', 'P142', 'P77', 'P29', 'P101', 'P128', 'P78', 'P146', 'P11', 'P36', 'P94', 'P88', 'P54', 'P153', 'P121'] val_2 = ['P184', 'P62', 'P158', 'P111', 'P161', 'P182', 'P40', 'P176', 'P60', 'P191', 'P109', 'P145', 'P41', 'P95', 'P160', 'P99', 'P137', 'P46', 'P163', 'P200'] train_3 = ['P166', 'P48', 'P29', 'P147', 'P190', 'P67', 'P89', 'P6', 'P109', 'P181', 'P3', 'P59', 'P164', 'P167', 'P107', 'P28', 'P141', 'P27', 'P127', 'P36', 'P173', 'P82', 'P44', 'P41', 'P55', 'P128', 'P125', 'P99', 'P163', 'P186', 'P135', 'P112', 'P179', 'P180', 'P61', 'P194', 'P91', 'P33', 'P10', 'P51', 'P77', 'P95', 'P110', 'P105', 'P204', 'P130', 'P38', 'P131', 'P156', 'P8', 'P185', 'P43', 'P124', 'P182', 'P96', 'P94', 'P136', 'P83', 'P126', 'P158', 'P45', 'P100', 'P169', 'P121', 'P142', 'P34', 'P1', 'P62', 'P191', 'P151', 'P25', 'P47', 'P129', 'P85', 'P123', 'P189', 'P184', 'P76', 'P176', 'P157', 'P199', 'P87', 'P17', 'P134', 'P13', 'P200', 'P153', 'P74', 'P97', 'P19', 'P116', 'P149', 'P23', 'P64', 'P5', 'P11', 'P39', 'P104', 'P52', 'P165', 'P101', 'P183', 'P111', 'P201', 'P42', 'P35', 'P202', 'P162', 'P122', 'P187', 'P79', 'P2', 'P53', 'P50', 'P106', 'P54', 'P26', 'P30', 'P161', 'P37', 'P154', 'P70', 'P88', 'P155', 'P146', 'P63', 'P78', 'P144', 'P118', 'P15', 'P22', 'P80', 'P115', 'P31', 'P171', 'P192', 'P193', 'P20', 'P137', 'P12', 'P103', 'P140'] val_3 = ['P102', 'P150', 'P66', 'P174', 'P117', 'P84', 'P46', 'P177', 'P40', 'P168', 'P72', 'P90', 'P21', 'P113', 'P159', 'P145', 'P160', 'P65', 'P198', 'P60', 'P0'] train_4 = ['P145', 'P72', 'P70', 'P146', 'P53', 'P176', 'P169', 'P113', 'P35', 'P26', 'P5', 'P161', 'P106', 'P200', 'P107', 'P117', 'P192', 'P45', 'P189', 'P15', 'P174', 'P181', 'P141', 'P42', 'P100', 'P135', 'P130', 'P61', 'P165', 'P204', 'P201', 'P151', 'P60', 'P10', 'P20', 'P91', 'P66', 'P137', 'P155', 'P97', 'P194', 'P140', 'P79', 'P54', 'P17', 'P166', 'P125', 'P33', 'P29', 'P116', 'P44', 'P109', 'P74', 'P149', 'P46', 'P55', 'P59', 'P159', 'P84', 'P27', 'P112', 'P160', 'P38', 'P126', 'P37', 'P129', 'P30', 'P65', 'P63', 'P171', 'P11', 'P102', 'P95', 'P0', 'P52', 'P101', 'P88', 'P142', 'P105', 'P99', 'P118', 'P158', 'P78', 'P36', 'P90', 'P6', 'P80', 'P51', 'P64', 'P41', 'P202', 'P43', 'P76', 'P62', 'P31', 'P22', 'P34', 'P150', 'P190', 'P124', 'P156', 'P182', 'P193', 'P186', 'P147', 'P167', 'P131', 'P3', 'P144', 'P163', 'P136', 'P121', 'P128', 'P123', 'P39', 'P50', 'P199', 'P157', 'P87', 'P47', 'P21', 'P154', 'P89', 'P111', 'P184', 'P168', 'P40', 'P162', 'P12', 'P103', 'P1', 'P96', 'P83', 'P8', 'P85', 'P67', 'P153', 'P82', 'P2', 'P110', 'P77', 'P191', 'P185'] val_4 = ['P94', 'P134', 'P23', 'P28', 'P177', 'P187', 'P180', 'P122', 'P104', 'P13', 'P127', 'P198', 'P179', 'P173', 'P164', 'P25', 'P115', 'P48', 'P183', 'P19'] test_indices = ['P71', 'P16', 'P114', 'P170', 'P98', 'P69', 'P92', 'P132', 'P81', 'P73', 'P143', 'P175', 'P56', 'P139', 'P152', 'P203', 'P75', 'P9', 'P24', 'P4', 'P32', 'P120', 'P138', 'P172', 'P57', 'P195', 'P68', 'P133', 'P14', 'P119', 'P7', 'P49', 'P93', 'P178', 'P58', 'P108', 'P197', 'P196', 'P86', 'P18', 'P188', 'P148']
def registry_metaclass(storage): class RegistryMeta(type): def __init__(cls, name, bases, attrs): super(RegistryMeta, cls).__init__(name, bases, attrs) id = getattr(cls, 'id', None) if not id: return if id in storage: raise KeyError("Already registered: %s" % name) storage[id] = cls return RegistryMeta
def registry_metaclass(storage): class Registrymeta(type): def __init__(cls, name, bases, attrs): super(RegistryMeta, cls).__init__(name, bases, attrs) id = getattr(cls, 'id', None) if not id: return if id in storage: raise key_error('Already registered: %s' % name) storage[id] = cls return RegistryMeta
class Solution: def findSubstringInWraproundString(self, p): res, l = {i: 1 for i in p}, 1 for i, j in zip(p, p[1:]): l = l + 1 if (ord(j) - ord(i)) % 26 == 1 else 1 res[j] = max(res[j], l) return sum(res.values())
class Solution: def find_substring_in_wrapround_string(self, p): (res, l) = ({i: 1 for i in p}, 1) for (i, j) in zip(p, p[1:]): l = l + 1 if (ord(j) - ord(i)) % 26 == 1 else 1 res[j] = max(res[j], l) return sum(res.values())
def return_decoded_value(value): if type(value) is bytes: value = value.decode('utf-8') elif type(value) is not str: value = value.decode("ascii", "ignore") else: value = value return value.strip('\r\n')
def return_decoded_value(value): if type(value) is bytes: value = value.decode('utf-8') elif type(value) is not str: value = value.decode('ascii', 'ignore') else: value = value return value.strip('\r\n')
f=open("input.txt") Input = f.read().split("\n") f.close() x=0 y=0 count=0 while(y < len(Input)): count += Input[y][x%len(Input[0])] == "#" x += 3 y += 1 print(count)
f = open('input.txt') input = f.read().split('\n') f.close() x = 0 y = 0 count = 0 while y < len(Input): count += Input[y][x % len(Input[0])] == '#' x += 3 y += 1 print(count)
# https://www.codewars.com/kata/52fba66badcd10859f00097e def disemvowel(str): return "".join(filter(lambda c: c not in "aeiouAEIOU", str)) print(disemvowel("This website is for losers LOL!"))
def disemvowel(str): return ''.join(filter(lambda c: c not in 'aeiouAEIOU', str)) print(disemvowel('This website is for losers LOL!'))
def doSomethingWithString(str): print(" Input is "+str, end = '\n') split = str.split(" ") print(split) split.pop(2) print(split) def secondFun(): s = [10,20] x = [20,30] return s, x x = 10 y = 11.2 dict = {1:'Alfa', 2:'Beta'} k = "A sample approach" doSomethingWithString(k) x, y = secondFun() print(x, end='\n') print(y)
def do_something_with_string(str): print(' Input is ' + str, end='\n') split = str.split(' ') print(split) split.pop(2) print(split) def second_fun(): s = [10, 20] x = [20, 30] return (s, x) x = 10 y = 11.2 dict = {1: 'Alfa', 2: 'Beta'} k = 'A sample approach' do_something_with_string(k) (x, y) = second_fun() print(x, end='\n') print(y)
# If you want to print something customized in your terminal # Use my custom color and fonts styles in order to print wyw # Refer to it with this kind of formation and formulation: # Example: # customization.color.BOLD + "String" + customization.color.END class Colors: # String to purple color PURPLE = '\033[95m' # String to cyan color CYAN = '\033[96m' # String to darkcyan color DARKCYAN = '\033[36m' # String to blue color BLUE = '\033[94m' # String to green color GREEN = '\033[92m' # String to yellow color YELLOW = '\033[93m' # String to red color RED = '\033[91m' # Make string bold BOLD = '\033[1m' # Underline string UNDERLINE = '\033[4m' # Erase all formation END = '\033[0m'
class Colors: purple = '\x1b[95m' cyan = '\x1b[96m' darkcyan = '\x1b[36m' blue = '\x1b[94m' green = '\x1b[92m' yellow = '\x1b[93m' red = '\x1b[91m' bold = '\x1b[1m' underline = '\x1b[4m' end = '\x1b[0m'
with open('DOCKER_VERSION') as f: version = f.read() with open('DOCKER_VERSION', 'w') as f: major, minor, patch = version.split('.') patch = int(patch) + 1 f.write('{}.{}.{}\n'.format(major, minor, patch))
with open('DOCKER_VERSION') as f: version = f.read() with open('DOCKER_VERSION', 'w') as f: (major, minor, patch) = version.split('.') patch = int(patch) + 1 f.write('{}.{}.{}\n'.format(major, minor, patch))
''' Created on Feb 8, 2017 @author: PJ ''' class TempRetrofillSrFromOfficialResults: def populate_sr(self, **kargs): return kargs def save_sr(self, score_result_type, match, team, **kargs): sr_search = score_result_type.objects.filter(match=match, team=team) if len(sr_search) == 0: sr = score_result_type(match=match, team=team, competition=match.competition, **kargs) sr.save() pass else: sr = sr_search[0] for key, value in kargs.iteritems(): setattr(sr, key, value) sr.save() pass def populate_matchresults(self, official_match, match_class, score_result_class, official_sr_class): match, _ = match_class.objects.get_or_create(matchNumber=official_match.matchNumber) print("Updating match %s" % match.matchNumber) # print official_match.__dict__ official_srs = official_sr_class.objects.filter(official_match=official_match) red_sr = official_srs[0] blue_sr = official_srs[1] self.save_sr(score_result_class, match, match.red1, **self.populate_sr(**self.get_team1_stats(red_sr))) self.save_sr(score_result_class, match, match.red2, **self.populate_sr(**self.get_team2_stats(red_sr))) self.save_sr(score_result_class, match, match.red3, **self.populate_sr(**self.get_team3_stats(red_sr))) self.save_sr(score_result_class, match, match.blue1, **self.populate_sr(**self.get_team1_stats(blue_sr))) self.save_sr(score_result_class, match, match.blue2, **self.populate_sr(**self.get_team2_stats(blue_sr))) self.save_sr(score_result_class, match, match.blue3, **self.populate_sr(**self.get_team3_stats(blue_sr))) official_match.hasOfficialData = True official_match.save() def get_team1_stats(self, official_match_sr): raise NotImplementedError() def get_team2_stats(self, official_match_sr): raise NotImplementedError() def get_team3_stats(self, official_match_sr): raise NotImplementedError()
""" Created on Feb 8, 2017 @author: PJ """ class Tempretrofillsrfromofficialresults: def populate_sr(self, **kargs): return kargs def save_sr(self, score_result_type, match, team, **kargs): sr_search = score_result_type.objects.filter(match=match, team=team) if len(sr_search) == 0: sr = score_result_type(match=match, team=team, competition=match.competition, **kargs) sr.save() pass else: sr = sr_search[0] for (key, value) in kargs.iteritems(): setattr(sr, key, value) sr.save() pass def populate_matchresults(self, official_match, match_class, score_result_class, official_sr_class): (match, _) = match_class.objects.get_or_create(matchNumber=official_match.matchNumber) print('Updating match %s' % match.matchNumber) official_srs = official_sr_class.objects.filter(official_match=official_match) red_sr = official_srs[0] blue_sr = official_srs[1] self.save_sr(score_result_class, match, match.red1, **self.populate_sr(**self.get_team1_stats(red_sr))) self.save_sr(score_result_class, match, match.red2, **self.populate_sr(**self.get_team2_stats(red_sr))) self.save_sr(score_result_class, match, match.red3, **self.populate_sr(**self.get_team3_stats(red_sr))) self.save_sr(score_result_class, match, match.blue1, **self.populate_sr(**self.get_team1_stats(blue_sr))) self.save_sr(score_result_class, match, match.blue2, **self.populate_sr(**self.get_team2_stats(blue_sr))) self.save_sr(score_result_class, match, match.blue3, **self.populate_sr(**self.get_team3_stats(blue_sr))) official_match.hasOfficialData = True official_match.save() def get_team1_stats(self, official_match_sr): raise not_implemented_error() def get_team2_stats(self, official_match_sr): raise not_implemented_error() def get_team3_stats(self, official_match_sr): raise not_implemented_error()
lista = [] pares = [] impar = [] for i in range(20): lista.append(int(input("Digite um numero: "))) for i in lista: if i % 2 == 0: pares.append(i) else: impar.append(i) print(f"Lista = {lista}") print(f"Pares = {pares}") print(f"impar = {impar}")
lista = [] pares = [] impar = [] for i in range(20): lista.append(int(input('Digite um numero: '))) for i in lista: if i % 2 == 0: pares.append(i) else: impar.append(i) print(f'Lista = {lista}') print(f'Pares = {pares}') print(f'impar = {impar}')
#list of group members #MATSIKO BRUNO 2020/BSE/165/PS #DAVID NYAMUTALE 2020/BSE/057/PS #MAWANDA DENNIS 2020/BSE/155/PS #AKANDWANAHO NICKSON 2020/BSE/006/PS # strt with an empty list list_of_items_to_capture = [] #create a loop for capturing values random_number = 1 while random_number == 1: inputedValue = input('enter values, else enter done\n') if len(inputedValue) == 0: print('bad data') elif inputedValue.lower() == "done": random_number = 2 else: try: inputedValue = float(inputedValue) list_of_items_to_capture.append(inputedValue) except: print('bad data') #end of loop #create a loop that goes thru the list created above and creates total and count total_variable = 0 counting_variable = 0 for iteration_variable in list_of_items_to_capture: total_variable = total_variable + iteration_variable counting_variable = counting_variable + 1 print("count, total, and average") print(counting_variable, total_variable, total_variable/counting_variable)
list_of_items_to_capture = [] random_number = 1 while random_number == 1: inputed_value = input('enter values, else enter done\n') if len(inputedValue) == 0: print('bad data') elif inputedValue.lower() == 'done': random_number = 2 else: try: inputed_value = float(inputedValue) list_of_items_to_capture.append(inputedValue) except: print('bad data') total_variable = 0 counting_variable = 0 for iteration_variable in list_of_items_to_capture: total_variable = total_variable + iteration_variable counting_variable = counting_variable + 1 print('count, total, and average') print(counting_variable, total_variable, total_variable / counting_variable)
class TrieNode: def __init__(self): self.val = None self.children = [None] * 26 class MapSum: def __init__(self): self.root = TrieNode() def insert(self, key: str, val: int) -> None: p = self.root for c in key: offset_c = ord(c) - 97 if not p.children[offset_c]: p.children[offset_c] = TrieNode() p = p.children[offset_c] # overwrite teh old value p.val = val def getNode(self, key) -> TrieNode: p = self.root for c in key: if not p: return p p = p.children[ord(c) - 97] return p def valuesWithPrefix(self, prefix): res = [] path = [] node = self.getNode(prefix) self.traverse(node, res) return res def traverse(self, node, res): if not node: return if node.val: res.append(node.val) for child in node.children: self.traverse(child, res) return def sum(self, prefix: str) -> int: return sum(self.valuesWithPrefix(prefix)) # Your MapSum object will be instantiated and called as such: # obj = MapSum() # obj.insert(key,val) # param_2 = obj.sum(prefix)
class Trienode: def __init__(self): self.val = None self.children = [None] * 26 class Mapsum: def __init__(self): self.root = trie_node() def insert(self, key: str, val: int) -> None: p = self.root for c in key: offset_c = ord(c) - 97 if not p.children[offset_c]: p.children[offset_c] = trie_node() p = p.children[offset_c] p.val = val def get_node(self, key) -> TrieNode: p = self.root for c in key: if not p: return p p = p.children[ord(c) - 97] return p def values_with_prefix(self, prefix): res = [] path = [] node = self.getNode(prefix) self.traverse(node, res) return res def traverse(self, node, res): if not node: return if node.val: res.append(node.val) for child in node.children: self.traverse(child, res) return def sum(self, prefix: str) -> int: return sum(self.valuesWithPrefix(prefix))
# Created from ttf-fonts/Entypo.otf with freetype-generator. # freetype-generator created by Meurisse D ( MCHobby.be ). Entypo_23 = { 'width' : 0x16, 'height' : 0x17, 33:( 0x800000, 0x980000, 0xbc0000, 0xbe0000, 0xbe0000, 0xbc0000, 0xbc0000, 0x9c0000, 0x9e0000, 0x8f0000, 0x8f8000, 0x87c600, 0x83ef00, 0x81ff80, 0x807f80, 0x803f80, 0x800f00, 0x800000), 34:( 0xbffff8, 0xfffffc, 0xf8001c, 0xf8001c, 0xf8001c, 0xc8001c, 0xc8001c, 0xf8001c, 0xf8001c, 0xf8001c, 0xf8001c, 0xbffffc), 35:( 0x800f06, 0x80ff9e, 0x87fff8, 0x9ffce0, 0x9ffc60, 0xbffce0, 0xbfffc0, 0xbfffc0, 0xbfff80, 0x9ffc00, 0x8fe000, 0x878000), 36:( 0x800400, 0x800e00, 0x801e00, 0x801f00, 0x801f00, 0x801f00, 0x801f00, 0x801f00, 0xfffff0, 0x800000, 0x8001c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x800780, 0x800380, 0x800100), 37:( 0xff8800, 0xff9800, 0xff3800, 0xff3800, 0xfe7800, 0xfe7800, 0xfcf800, 0xfcf800, 0xf9f800, 0xf9f800, 0xf9f800, 0xfcf800, 0xfcf800, 0xfe7800, 0xfe7800, 0xff3800, 0xff3800, 0xff9800, 0xff9800), 38:( 0xe00000, 0xfc0000, 0xe20000, 0xc70000, 0xcf8000, 0xbfc000, 0x9fe000, 0x8ff000, 0x87f800, 0x83fc00, 0x81fe00, 0x80ff00, 0x807f80, 0x803f80, 0x801f00, 0x800e00, 0x800400), 39:( 0x800000, 0x8f0000, 0x9fc000, 0xb06000, 0xe23000, 0xe79800, 0xe4cc00, 0xe66600, 0xa73300, 0xb39980, 0x99ccc0, 0x8ce660, 0x867330, 0x833918, 0x819c0c, 0x80ce0c, 0x80630c, 0x80318c, 0x801cf8, 0x800e70, 0x800600), 40:( 0x808000, 0x81c000, 0x83e000, 0x87f000, 0x8ff000, 0x9ff800, 0xbffc00, 0xbffe00, 0x83e000, 0x83e000, 0x83e000, 0x83e000, 0x83c000, 0x878000, 0x878000, 0x870000, 0x8e0000, 0x980000, 0xa00000), 41:( 0x808000, 0x81c000, 0x83e000, 0x877000, 0x8e3000, 0x9cb800, 0xbddc00, 0xbbce00, 0x83e000, 0x87f000, 0x8ff800, 0x9ffc00, 0xbffe00, 0x83e000, 0x83e000, 0x83e000, 0x83c000, 0x87c000, 0x8f8000, 0x9e0000, 0xb80000), 42:( 0xa00000, 0x980000, 0x8c0000, 0x870000, 0x878000, 0x878000, 0x83c000, 0x83c000, 0x83e000, 0x83e000, 0x83e000, 0xfffe00, 0xbffc00, 0x9ff800, 0x8ff800, 0x87f000, 0x83e000, 0x81c000, 0x808000), 43:( 0xf00000, 0xf80000, 0xf80000, 0xfc0000, 0xfc0000, 0xfc0000, 0xfe0fe0, 0xff3fe0, 0xfffff0, 0xfffff0, 0xfffff0, 0xfffff0, 0xff3fe0, 0xfe0fe0, 0xfc0000, 0xfc0000, 0xfc0000, 0xf80000, 0xf80000, 0xf00000), 44:( 0xfc0000, 0xfc0000, 0xfe0000, 0xfe0fc0, 0xffbfe0, 0xffffe0, 0xffffe0, 0xffffe0, 0xff3fc0, 0xfe0f80, 0xfe0000, 0xfc0000, 0xfc1e00, 0xf9ff00, 0xf9ff00, 0x83ff00, 0xff3f00, 0xfe0000, 0xfe0000, 0xfc0000, 0xfc0000), 45:( 0xfc0000, 0xfc0000, 0xfe0000, 0xfe07c0, 0xff1ff0, 0xfffff0, 0xfffff0, 0xfffff0, 0xfffff0, 0xfffff0, 0xff1fe0, 0xfe07c0, 0xfe0000, 0xfc3000, 0xfc3000, 0xf83000, 0xf9fe00, 0x81fe00, 0x803000, 0x803000, 0x803000), 46:( 0xbfff80, 0xffffc0, 0xe000c0, 0xe000c0, 0xe6ecc0, 0xe6ecc0, 0xe6ecc0, 0xe6ecc0, 0xe6ecc0, 0xe6ecc0, 0xe000c0, 0xe000c0, 0xe230c0, 0xe3f8c0, 0xe3f8c0, 0xe278c0, 0xe200c0, 0xe000c0, 0xe000c0, 0xffffc0, 0xbfff80), 47:( 0xfffe00, 0xfffe00, 0xe00600, 0xe00600, 0xe00600, 0xe00200, 0xe1c200, 0xe07000, 0xe03800, 0xe03800, 0xe01c00, 0xe01c00, 0xe01c00, 0xe01e00, 0xe1ffc0, 0xe0ff80, 0xf87f00, 0xfc3e00, 0x801e00, 0x801c00, 0x800800), 48:( 0x803e00, 0x81ff00, 0x87ff80, 0x8fe1c0, 0xbfc1c0, 0xffc1c0, 0x9fc1c0, 0x8fe3c0, 0x83ff80, 0x80ff00, 0x801c00), 49:( 0xfffe00, 0xfffe00, 0xb00300, 0x900180, 0x980080, 0x8fffc0, 0x8800c0, 0x980180, 0xb00100, 0xa00300, 0xfffe00, 0xa00300, 0xb00100, 0x980180, 0x9800c0, 0x8fffc0, 0x9800c0, 0x980180, 0xb00100, 0xa00300, 0xfffe00), 50:( 0x80fc00, 0x83ff00, 0x8f8780, 0x9e01c0, 0x9c00e0, 0xb80070, 0xb3c030, 0xf1f038, 0xe1f818, 0xe1cc18, 0xe0c418, 0xe0c618, 0xe07218, 0xf01e30, 0xb00730, 0xb80070, 0x9c00e0, 0x8f03c0, 0x87ff80, 0x81fe00), 51:( 0x802000, 0x802000, 0x803000, 0x803000, 0x803800, 0x803800, 0x807c00, 0x807c00, 0x83fe00, 0xbffe00, 0x8e0f00, 0x878700, 0x81e380, 0x8071c0, 0x801cc0, 0x800760, 0x8001e0, 0x800060, 0x800000), 52:( 0x81f800, 0x87fe00, 0x8e2380, 0x9c21c0, 0x9820c0, 0xb02060, 0xa00020, 0xe00030, 0xfe03f0, 0xfe03f0, 0xe00030, 0xa00020, 0xb02060, 0xb020e0, 0x9821c0, 0x8e2380, 0x87ff00, 0x81fc00), 53:( 0x807000, 0x80f800, 0x80fc00, 0x80fc00, 0x80fc00, 0x80fc00, 0x81dc00, 0x818e00, 0x838e00, 0x870700, 0x860380, 0xbe03e0, 0xfe03f0, 0xfe03f0, 0xfe03f0, 0xbe03f0, 0x9c01e0), 54:( 0x807800, 0x80fc00, 0x81fe00, 0x83fe00, 0x87ff00, 0x8fff00, 0x9ffe00, 0xbffe00, 0xbffc00, 0xfffc00, 0xbffe00, 0x9ffe00, 0x8ffe00, 0x87ff00, 0x83ff00, 0x81fe00, 0x80fe00, 0x807c00, 0x800000), 55:( 0x800000, 0x800800, 0x801800, 0x803800, 0xb83800, 0x9ff800, 0x8ff800, 0x87fe00, 0x87ffc0, 0x83fff0, 0x87ff80, 0x8ffc00, 0x9ff800, 0x9f7800, 0xb03800, 0x801800, 0x801800, 0x800800, 0x800000), 56:( 0x8ff000, 0x8ff000, 0x8ff000, 0x8ff000, 0x800000, 0x8ff000, 0x9ff000, 0x9ff800, 0xbffc00, 0xfffe00, 0xffffc0, 0xffffe0, 0xffffe0, 0xfff800, 0xfff800, 0xfff800, 0xbff800, 0xbff800, 0x9ff000), 57:( 0x87fc00, 0x8ffe00, 0x8ffe00, 0xfffe00, 0xbffe00, 0x9ffe00, 0x8f0000, 0x8f3fe0, 0x8f3ff0, 0x8f3ff0, 0x8f3ff0, 0x8f3ff0, 0x8f3ff0, 0x873ff0, 0x803ff0, 0x807ff0, 0x80fff0, 0x81fff0, 0x803ff0, 0x803ff0, 0x803ff0), 58:( 0x87fe00, 0x87ff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x9fff00, 0xbfff00, 0xffff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x87ff00, 0x87fe00), 59:( 0xc03800, 0xc0fc00, 0xe0fc00, 0xb0fc00, 0x9dfc00, 0x8ffc00, 0x83f800, 0x800000, 0x800000, 0xc07800, 0xc0fc00, 0xe0fc00, 0xb0fc00, 0x9ffc00, 0x8ff800, 0x83f000, 0x800000, 0x800000, 0x800000), 60:( 0x83e000, 0x83f400, 0xc3f400, 0xfff400, 0xfff600, 0xe1f600, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe07600, 0xe3f600, 0xfff600, 0xfff400, 0x83f400, 0x83f400, 0x83e000), 61:( 0x800000, 0x881f00, 0x9fffc0, 0xb7ffe0, 0xb1fff0, 0xb5fff8, 0xb6fff0, 0xb6fff0, 0xb37ff0, 0x937ff0, 0x907fe0, 0x983fc0, 0x883f80, 0x8c3e00, 0x863800, 0x833000, 0x81e000, 0x80e000), 62:( 0x9e0000, 0xbf0000, 0xf38000, 0xe1c000, 0xe0e000, 0xf07000, 0xb83800, 0x999800, 0x839800, 0x833b00, 0x838380, 0x81c1c0, 0x80e0c0, 0x8070c0, 0x8039c0, 0x801f80, 0x800f00), 63:( 0x800180, 0x801f80, 0x81ff80, 0x9fffc0, 0xbf7fe0, 0xb03fe0, 0x801fe0, 0x801fe0, 0x801fc0, 0x801f80, 0x803f00, 0x807e00, 0x807e00, 0x807e00, 0x803e00, 0x801e00, 0x800e00, 0x800300, 0x800100), 64:( 0x820800, 0x873800, 0x87fc00, 0x87fc00, 0xbfff80, 0xff1fc0, 0xfe0fc0, 0xbc0780, 0x9c0700, 0xbc0700, 0xbc0780, 0xfe0fc0, 0xff1fc0, 0x8fff00, 0x87fc00, 0x87fc00, 0x831800, 0x820800), 65:( 0x9c0000, 0xbe0000, 0xbf0000, 0xff8000, 0xbfc000, 0x9fe000, 0x8ff000, 0x87d800, 0x83cc00, 0x81cf80, 0x80ffc0, 0x807fe0, 0x803ff0, 0x803fd0, 0x803f10, 0x801e30, 0x801e60, 0x800ec0, 0x800780), 66:( 0x8003c0, 0x8007c0, 0x800c40, 0x801840, 0x8033c0, 0xb07fe0, 0xf07f30, 0xf8ff30, 0xffff10, 0xfffe10, 0xffff10, 0xf9ff10, 0xf0ff30, 0xb07fe0, 0x8037c0, 0x803040, 0x801c40, 0x800fc0, 0x8003c0), 67:( 0x818000, 0x83c000, 0x87e000, 0x9fe000, 0xbff000, 0xfff800, 0xbffc00, 0xbffc00, 0x9ffe00, 0x8fff00, 0x8fff00, 0x87ff80, 0x83ff80, 0x81f180, 0x81f180, 0x80f700, 0x807e00, 0x800d00, 0x8000c0, 0x80007c, 0x800000), 68:( 0xbffc00, 0xfffe00, 0xfffe00, 0xfffe00, 0xfffe00, 0xff3f00, 0xf80fc0, 0xf087c0, 0xf3e7c0, 0xe7f3c0, 0xe7f3c0, 0xe7e3c0, 0xe3e3c0, 0xf1c7c0, 0xf80fc0, 0xfe3f00, 0xfffe00, 0xfffe00, 0xffe600, 0xfffe00, 0xbffc00), 69:( 0x820000, 0x840000, 0x8c0000, 0x9c0000, 0x9c0000, 0xbc0000, 0xbc0000, 0xbc0000, 0xbc0000, 0xbe0000, 0xbf0000, 0x9f8000, 0x9fc000, 0x8ff060, 0x87ffc0, 0x83ff80, 0x81fe00, 0x800000), 70:( 0x83c000, 0x8ff000, 0x9ffc00, 0xbffe00, 0xbfff00, 0xffff00, 0xffff80, 0xffff80, 0xffff80, 0xffff80, 0xf8ff80, 0xf8ff80, 0xb8ff80, 0xbfff80, 0x9fff80, 0x9c7f00, 0x803f00, 0x803f00, 0x803e00, 0x803c00, 0x803000), 71:( 0xb00000, 0xb8e000, 0x9c7800, 0x863c00, 0x831e00, 0x878f00, 0x87cf00, 0x87e780, 0x87e780, 0x87f780, 0x87f380, 0x87fb80, 0x83fb80, 0x81ff80, 0x807f80, 0x801f80, 0x800780, 0x800380, 0x800180, 0x800000, 0x800000), 72:( 0x980000, 0xbe0000, 0xbe0000, 0xbf0000, 0xbf0000, 0xbf0000, 0x9ffff8, 0x8ffff8, 0x8000f0, 0x8000e0, 0x8001c0, 0x801f00, 0x800000, 0x800000, 0x800000), 73:( 0x800f00, 0x83ff80, 0xfffe80, 0xfffec0, 0xfffe40, 0xffe640, 0xff8640, 0xff3e40, 0xfe7e40, 0xfe7e40, 0xfe3e40, 0xff0640, 0xffc640, 0xfffe40, 0xfffe40, 0xfffec0, 0x9fff80, 0x803f00), 74:( 0x810400, 0x81dc00, 0x81fc00, 0x80f800, 0x807000, 0x807000, 0xe07070, 0xfe73f0, 0xbfffe0, 0x8fff80, 0x87fe00, 0x81fc00, 0x807000, 0x807000, 0x807000, 0x807000, 0x807000, 0x807000, 0x807000, 0x807000, 0x802000), 75:( 0x80f800, 0x87de00, 0x8e0380, 0x9e03c0, 0xbfffe0, 0xbf8fe0, 0xee03b0, 0xc60310, 0xc40110, 0xc40110, 0xc40110, 0xc40110, 0xc60330, 0xbf07f0, 0xbfffe0, 0x9f77c0, 0x8e03c0, 0x860300, 0x83fe00, 0x802000), 76:( 0x87c060, 0x9ff090, 0xbc7890, 0xb018f0, 0xf03e00, 0xe0ff80, 0xe1ffc0, 0xe3cce0, 0xf39c70, 0xb73830, 0xbf7830, 0x9ff030, 0x87c030, 0x870030, 0x830070, 0x838060, 0x81c1e0, 0x80ffc0, 0x807f80), 77:( 0x860000, 0x8f0000, 0x9f8000, 0x9fc000, 0xbfe000, 0xbfe000, 0xf0f000, 0xe03000, 0xc63000, 0xcf1000, 0xcf9000, 0xcc1000, 0xc41000, 0xe03000, 0xf07000, 0xbfe000, 0xbfe000, 0x9fc000, 0x9fc000, 0x8f8000, 0x870000), 78:( 0x80f800, 0x87fe00, 0x8f8f80, 0x9c01c0, 0xb800e0, 0xb00060, 0xf00070, 0xe00030, 0xe00030, 0xe03f30, 0xe07f30, 0xe0c030, 0xf18070, 0xb00060, 0xb800e0, 0x9c01c0, 0x8e0380, 0x87ff00, 0x83fe00), 79:( 0x807c00, 0x80fc00, 0x818000, 0xe30000, 0xe37cf8, 0xe37cfc, 0xfe7cfc, 0xff7cfc, 0xe37cfc, 0xe33cf8, 0xe10000, 0x818000, 0x80fc00, 0x803c00), 80:( 0xbfff80, 0xffffc0, 0xe00fc0, 0xe00f00, 0xe00f70, 0xe00f70, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00f70, 0xe00f70, 0xe00f00, 0xe00fc0, 0xffffc0, 0xbfff80), 81:( 0x801000, 0xa03800, 0x983c00, 0x8e7e00, 0x87ff80, 0x83f3c0, 0x81e060, 0x80e010, 0x800000), 82:( 0x9e00f0, 0xb301b8, 0xb88248, 0xf8444c, 0xfc784c, 0xfe1044, 0xfe1044, 0xfc7844, 0xf8c44c, 0xb98248, 0xb301b8, 0x9e00f0), 83:( 0xb83180, 0xfc3180, 0xfc3180, 0xfc7180, 0xb87380, 0x80e380, 0x81c700, 0x87c700, 0xbf8e00, 0xfe1c00, 0xf83c00, 0x80f800, 0x83f000, 0xffc000, 0xff8000, 0xfc0000), 84:( 0x800400, 0x800e00, 0x800700, 0x802300, 0x807380, 0x803180, 0x813980, 0x8318c0, 0xb19cc0, 0xf98cc0, 0xf98cc0, 0xf98cc0, 0x939cc0, 0x8318c0, 0x813980, 0x803180, 0x807380, 0x802300, 0x800700, 0x800600, 0x800000), 85:( 0x9ff800, 0xbff800, 0xbff800, 0xbfff00, 0xffffc0, 0xfff8e0, 0xfff860, 0xfff860, 0xfff860, 0xffffe0, 0xffffc0, 0xbfff00, 0xbff800, 0xbff800, 0x9ff000), 86:( 0xbff000, 0xbff800, 0xfff800, 0xfff980, 0xfff9e0, 0xfff8f0, 0xfff830, 0xfff830, 0xfff830, 0xfffff0, 0xffffe0, 0xffff80, 0xfff800, 0xbff800, 0xbff000), 87:( 0x818000, 0x878000, 0x8f8000, 0x9f0000, 0xbc0000, 0xfc0000, 0xbe0000, 0x9f8000, 0x87e000, 0x81f000, 0x80fc00, 0x803e00, 0x801f00, 0x800700), 88:( 0xe03000, 0xf07000, 0xbde000, 0x9fc000, 0x8f8000, 0x8f8000, 0x9fc000, 0xbde000, 0xf87000, 0xe03000), 89:( 0x81f000, 0x87fc00, 0x8ffe00, 0x9fff00, 0xbfbf80, 0xbfbf80, 0xffbfc0, 0xffbfc0, 0xffbfc0, 0xffbfc0, 0xffbfc0, 0xffbfc0, 0xbfbf80, 0xbfbf80, 0x9fff00, 0x8ffe00, 0x87fc00, 0x81f000), 90:( 0x80f800, 0x83fe00, 0x8fff80, 0x9fffc0, 0x9f8fc0, 0xbf8fe0, 0xbf8fe0, 0xbf8fe0, 0xb800e0, 0xb800e0, 0xbf8fe0, 0xbf8fe0, 0xbf8fe0, 0x9f8fc0, 0x9fffc0, 0x8fff80, 0x83fe00, 0x80f800), 91:( 0x81f000, 0x87fe00, 0x8fff00, 0x9fff80, 0xbdf380, 0xb8e1c0, 0xfc43c0, 0xfe07c0, 0xff0fe0, 0xfe0fe0, 0xfc07e0, 0xf863c0, 0xb8f3c0, 0xbdff80, 0x9fff80, 0x8fff00, 0x87fc00, 0x80f000), 92:( 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000), 93:( 0x830000, 0x830000, 0x830000, 0x830000, 0x830000, 0xfff800, 0xfff800, 0x830000, 0x830000, 0x830000, 0x830000, 0x830000), 94:( 0x81f800, 0x87ff00, 0x8fdf80, 0x9e03c0, 0xbc00e0, 0xb60060, 0xf30070, 0xe18030, 0xe0c030, 0xe06030, 0xe03030, 0xe01830, 0xf00c70, 0xf00670, 0xb803e0, 0x9c01c0, 0x9f07c0, 0x87ff80, 0x83fe00), 95:( 0x802000, 0x801000, 0xfe1800, 0xfff800, 0xfffc00, 0xbffc38, 0xb7fc7c, 0x987e7c, 0x88003c, 0x880018), 96:( 0x80f800, 0x83fe00, 0x8fff80, 0x9fffc0, 0x9fffe0, 0xbfffe0, 0xbffff0, 0xfbdff0, 0xf80ff0, 0xf80c70, 0xf90c70, 0xfdfc70, 0xfffff0, 0xbffff0, 0xbfffe0, 0x9fffc0, 0x8fffc0, 0x87ff00, 0x83fe00, 0x802000), 97:( 0x800380, 0x8003c0, 0x8003e0, 0x8003f0, 0xf9c070, 0xf9e070, 0xf9f070, 0xb8f870, 0x803df0, 0x801fe0, 0x801fe0, 0x800fc0), 98:( 0x80f800, 0x83fe00, 0x8fff80, 0x9fffc0, 0x9fffc0, 0xbfffe0, 0xbff9e0, 0xfff8f0, 0xf9fcf0, 0xf89cf0, 0xf98cf0, 0xffc0f0, 0xffe1f0, 0xbffbe0, 0xbfffe0, 0x9fffc0, 0x8fff80, 0x87ff00, 0x83fe00, 0x802000), 99:( 0xc00000, 0xf00000, 0xfc0000, 0xfe0000, 0xff8000, 0xffe000, 0xfff800, 0xfffc00, 0xffff00, 0xec0fc0, 0xec0fc0, 0xffff80, 0xfffe00, 0xfff800, 0xfff000, 0xffc000, 0xff0000, 0xfe0000, 0xf80000, 0xe00000), 100:( 0x81f000, 0x87fc00, 0x9f1e00, 0x9c0700, 0xb80380, 0xf001c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xf001c0, 0xb04180, 0xa0c380, 0x81cf00, 0x83fe00, 0x83f800, 0x81c000, 0x80c000, 0x804000), 101:( 0x804000, 0x80c000, 0x81c000, 0x83f800, 0x83fe00, 0x81cf00, 0xa0c380, 0xb04180, 0xf001c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xf001c0, 0xb80380, 0x9c0700, 0x8f1e00, 0x87fc00, 0x81f000), 102:( 0x8e0380, 0x8e0380, 0x8e0380, 0x8e0380, 0x8f0780, 0x870f00, 0x878700, 0x83e000, 0x81f000, 0x80f800, 0x823c00, 0x831e00, 0x878f00, 0x8f0700, 0x8e0380, 0x8e0380, 0x8e8380, 0xbf0fe0, 0x9f07c0, 0x8e0380, 0x840100), 103:( 0x802000, 0xf07000, 0xf0f800, 0xf1f800, 0xf3fc00, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xfff000, 0xfff000, 0xbfe000), 104:( 0x800000, 0x802000, 0x803000, 0xfff800, 0xfffc00, 0xfff000, 0xf02000, 0xf04000, 0xf00000, 0xf00400, 0xf01c00, 0xe01c00, 0xc01c00, 0x801c00, 0x881c00, 0x981c00, 0xbffc00, 0xfffc00, 0xbff800, 0x880000, 0x880000), 105:( 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000), 106:( 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0x800000, 0x800000, 0x800000, 0x830000, 0x830000, 0x830000, 0x830000, 0xfff000, 0xfff000, 0x830000, 0x830000, 0x830000, 0x830000), 107:( 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0x800000, 0x800000, 0xb83800, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xbc7800), 108:( 0xbfffe0, 0xfffff0, 0xe00030, 0xe00030, 0xe63330, 0xe63330, 0xe63330, 0xe63330, 0xe63330, 0xe63330, 0xe00030, 0xe00030, 0xe00030, 0xfffff0, 0xbfffe0), 109:( 0xbfffe0, 0xfffff0, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xfffff0, 0xbfffe0), 110:( 0x87fff0, 0x87fff0, 0x860030, 0x860030, 0xffff30, 0xffff30, 0xe00330, 0xe00330, 0xe003f0, 0xe003f0, 0xe003e0, 0xe00300, 0xe00300, 0xffff00, 0xffff00), 111:( 0xbffe00, 0xffff00, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xffff00, 0xbffe00), 112:( 0x800600, 0x803e00, 0x80ff00, 0x800700, 0xfff380, 0xfff380, 0xfff380, 0xe1f3c0, 0xe073c0, 0xe0f3c0, 0xe3f1e0, 0xe3f0e0, 0xe1f0e0, 0xe1f070, 0xe0f0f0, 0xe073f0, 0xe073c0, 0xe07300, 0xe1f000, 0xfff000, 0xfff000), 113:( 0xe63300, 0xe63300, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xf80f00, 0xfc1f00, 0xfe3f00, 0xfe3f00, 0xff7f00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xe63300, 0xe63300), 114:( 0xbfffe0, 0xfffff0, 0xfffff0, 0xfffff0, 0xf8fff0, 0xf8fff0, 0xf8fff0, 0xf800f0, 0xfc00f0, 0xfff3f0, 0xffc7f0, 0xfffff0, 0xfffff0, 0xfffff0, 0xbfffe0), 115:( 0x81f000, 0xfff800, 0xfffb80, 0xfffbc0, 0xfffbc0, 0xfffbc0, 0xfffbc0, 0xfffbc0, 0xfffb80, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffa00, 0x8ff000), 116:( 0x803800, 0x8ffc00, 0xfff800, 0xfffb00, 0xfffb00, 0xfffb40, 0xfe3b40, 0xfe3b40, 0xfefb40, 0xfefb40, 0xfefb40, 0xfefb40, 0xfefb40, 0xfe3b40, 0xff3b40, 0xfffb40, 0xfffb00, 0xfffb00, 0xfff800, 0x87fc00, 0x801800), 117:( 0x800f00, 0x9fff80, 0xbffc80, 0xfffcc0, 0xfffcc0, 0xfffc40, 0xfffc40, 0xfffc40, 0xfffc40, 0xfffcc0, 0xfffcc0, 0xbffcc0, 0xbfff80, 0x80ff80, 0x800000), 118:( 0x9e0000, 0xff0000, 0xff0000, 0xff8000, 0xfec000, 0xfe4400, 0xfe0200, 0xf00300, 0xf07f80, 0xf07fc0, 0xf07fe0, 0xf07fc0, 0xf07f80, 0xf00300, 0xfc0300, 0xfe4200, 0xfec000, 0xfe8000, 0xff8000, 0xff0000, 0xbe0000), 119:( 0xbe0000, 0xff0000, 0xff0000, 0xfd8000, 0xfc8000, 0xfc0400, 0xfc0c00, 0xf01c00, 0xf03fe0, 0xf07fe0, 0xf07fe0, 0xf07fe0, 0xf03fe0, 0xf01c00, 0xfc0c00, 0xfc8400, 0xfc8000, 0xfd8000, 0xff0000, 0xfe0000, 0x9e0000), 120:( 0x8f8000, 0xbfe000, 0xf1fc00, 0xe1ff00, 0xe1ff80, 0xe1f780, 0xe1e780, 0xe1e000, 0xe1c000, 0xe18000, 0xe1c000, 0xe1c000, 0xe1e780, 0xe1f780, 0xe1ff80, 0xe1ff00, 0xe1fc00, 0xbff000, 0x8f8000), 121:( 0x9c0000, 0xfe0000, 0xff0000, 0xff0000, 0xffc000, 0xfff000, 0xfff800, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfff800, 0xfff000, 0xffc000, 0xffc000, 0xffc000, 0xffc000, 0xbf8000, 0x9f0000), 122:( 0x9c0000, 0xbf0000, 0xff0000, 0xff0000, 0xffe000, 0xfff800, 0xfff800, 0xfbfc00, 0xf9fc00, 0x80fe00, 0x803e00, 0x807c00, 0xf9fc00, 0xfbf800, 0xfff000, 0xffe000, 0xffe000, 0xffe000, 0xbfc000, 0xbfc000, 0x8f0000), 123:( 0xfffc00, 0xbffc00, 0xbff800, 0x9ff000, 0x8ff000, 0x8fe000, 0x87e000, 0x87c000, 0x838000, 0x818000, 0x810000), 124:( 0xbfff00, 0xffff00, 0xffff00, 0xbfff00, 0x800000, 0x800000, 0x800000, 0xbffe00, 0xffff00, 0xffff00, 0xbfff00), 125:( 0x83e000, 0x8ff800, 0x9ffc00, 0xbffe00, 0xbffe00, 0xbfff00, 0xffff00, 0xffff00, 0xffff00, 0xbfff00, 0xbffe00, 0x9ffe00, 0x9ffc00, 0x8ff800, 0x83e000), 126:( 0xbffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xbffc00), 174:( 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0x800000, 0x800000, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00), 196:( 0xfff800, 0xfff000, 0xbff000, 0x9fe000, 0x9fc000, 0x8fc000, 0x878000, 0x870000, 0x830000, 0xfff800, 0xfff800, 0xbff000, 0x9fe000, 0x9fe000, 0x8fc000, 0x878000, 0x878000, 0x830000, 0x800000), 197:( 0x820000, 0x830000, 0x878000, 0x8f8000, 0x8fc000, 0x9fe000, 0xbfe000, 0xbff000, 0xfff800, 0x800000, 0x830000, 0x870000, 0x878000, 0x8fc000, 0x9fe000, 0xbfe000, 0xbff000, 0xfff800, 0xfff000), 199:( 0xfff800, 0xfff800, 0xfff800, 0x800000, 0x830000, 0x870000, 0x878000, 0x8fc000, 0x8fc000, 0x9fe000, 0xbfe000, 0xbff000, 0xbff000), 201:( 0xbff000, 0xbff000, 0x9fe000, 0x9fe000, 0x8fc000, 0x8f8000, 0x878000, 0x830000, 0x830000, 0xbff000, 0xfff800, 0xfff800, 0xfff800), 209:( 0xfe0000, 0xfc0000, 0xfc0000, 0xfe0000, 0xaf0000, 0x870000, 0x820000, 0x800000, 0x800000, 0x800000, 0x800c00, 0x801e40, 0x801fc0, 0x800fc0, 0x8007c0, 0x8007c0, 0x800fc0), 214:( 0x900000, 0xb80000, 0xfd0000, 0xbf0000, 0x9f0000, 0x8f0000, 0x9f0000, 0x800000, 0x800000, 0x800000, 0x801f80, 0x801f00, 0x801e00, 0x801f80, 0x801fc0, 0x8013c0, 0x800180), 220:( 0xc00000, 0xe00000, 0xe00000, 0xf00000, 0xf00000, 0xf80000, 0xfc0000, 0xfc0000, 0xfe0000, 0xfe0000, 0xff0000, 0xff0000, 0xff8000, 0xffc000, 0xffc000, 0xffe000, 0xffe000, 0xfff000, 0xbff000), 224:( 0xe00000, 0xf00000, 0xb9e000, 0x9cfc00, 0x8e7f00, 0x873f80, 0x939fc0, 0x99c8c0, 0x9ce080, 0x9e7180, 0x9f3900, 0x9f9c00, 0x9f0e00, 0x8f0700, 0x8e3380, 0x87e1c0, 0x83c0e0, 0x800070, 0x800020), 225:( 0x800000, 0x800000, 0x800000, 0x80f800, 0x83fe00, 0x87ff80, 0x87ffc0, 0x8fffe0, 0x8ffe60, 0x8ff860, 0x8ff040, 0x8fe0c0, 0x87c198, 0x87c31e, 0x87860e, 0x838c02, 0x81f860, 0x81e070, 0x800338, 0x800318, 0x800380, 0x800180), 226:( 0x808000, 0x81c000, 0x83e000, 0x87f000, 0x8ff800, 0x9ffc00, 0xbffe00, 0xffff80, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800), 227:( 0x800000, 0x808000, 0x80c000, 0x80e000, 0xfff000, 0xfff800, 0xfffc00, 0xfffe00, 0xffff00, 0xfffe00, 0xfffc00, 0xfff800, 0x80f000, 0x80e000, 0x80c000, 0x808000), 228:( 0x808000, 0x818000, 0x838000, 0x878000, 0x8fff00, 0x9fff00, 0xbfff00, 0xffff00, 0xffff00, 0xbfff00, 0x9fff00, 0x8fff00, 0x878000, 0x838000, 0x818000, 0x808000), 229:( 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0xffff80, 0xbfff00, 0x9ffe00, 0x8ffc00, 0x87f800, 0x83f000, 0x81e000, 0x80c000), 231:( 0x800000, 0x818000, 0x83c000, 0x87e000, 0x8ff000, 0x9ff800, 0xbff800, 0xfffc00, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000), 232:( 0x808000, 0x80c000, 0x80e000, 0x80f000, 0xfff800, 0xfffc00, 0xfffe00, 0xffff00, 0xfffc00, 0xfff800, 0x80f000, 0x80e000, 0x80c000, 0x808000), 233:( 0x808000, 0x818000, 0x838000, 0x878000, 0x8fff00, 0xbfff00, 0xffff00, 0xffff00, 0xbfff00, 0x9fff00, 0x878000, 0x838000, 0x818000, 0x808000), 234:( 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0xfffe00, 0xbffc00, 0x9ff800, 0x8ff000, 0x87f000, 0x83e000, 0x83c000, 0x818000), 235:( 0x80fc00, 0x83ff00, 0x8f8780, 0x9e01c0, 0xb800e0, 0xb00060, 0xf03070, 0xe07830, 0xe0fc30, 0xe3fe30, 0xe07830, 0xe07830, 0xf07870, 0xb07860, 0xb800e0, 0x9c01c0, 0x8e03c0, 0x87ff80, 0x81fe00), 236:( 0x80f800, 0x87fe00, 0x8f8f80, 0x9c01c0, 0xb800e0, 0xb00060, 0xf01070, 0xe01830, 0xe3fc30, 0xe3fe30, 0xe3fc30, 0xe3f830, 0xf01070, 0xb02060, 0xb800e0, 0x9c01c0, 0x8e0380, 0x87ff00, 0x83fe00), 237:( 0x80f800, 0x87fe00, 0x8f8f80, 0x9c01c0, 0xb800e0, 0xb00060, 0xf04070, 0xe0c030, 0xe1fe30, 0xe3fe30, 0xe1fe30, 0xe0fe30, 0xf04070, 0xb04060, 0xb800e0, 0x9c01c0, 0x8e0380, 0x87ff00, 0x83fe00), 238:( 0x80fc00, 0x83ff00, 0x8f8780, 0x9e01c0, 0xb800e0, 0xb00060, 0xf07870, 0xe07830, 0xe07830, 0xe07a30, 0xe1fc30, 0xe0f830, 0xf07070, 0xb02060, 0xb800e0, 0x9c01c0, 0x8e03c0, 0x87ff80, 0x81fe00), 239:( 0x808000, 0x80c000, 0xffe000, 0xfff000, 0xfff800, 0xfffc00, 0xfffe00, 0x80ff00, 0x80ff80, 0x80ffc0, 0x80ffc0, 0x80ff80, 0xffff00, 0xfffe00, 0xfffc00, 0xfff800, 0xfff000, 0x80e000, 0x80c000), 241:( 0xfffff0, 0xbffff0, 0x9ffff0, 0x8ffff0, 0x8ffff0, 0x9ffff0, 0xbffff0, 0xfffff0), 242:( 0xbf8000, 0xff8000, 0xe00000, 0xe00000, 0xe3ff80, 0xe7ffc0, 0xe600c0, 0xe600c0, 0xe600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x87ffc0, 0x83ff80), 243:( 0x87fff0, 0x8ffff0, 0x8c0070, 0x98c460, 0x988c60, 0x9188c0, 0xb118c0, 0xb001c0, 0xffff80, 0xffff80, 0xffff80, 0xb00180, 0xb118c0, 0x9188c0, 0x988c60, 0x98c460, 0x8c0060, 0x8ffff0, 0x87fff0), 244:( 0x807c00, 0x80ff00, 0x81c780, 0x830180, 0x8701c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x830180, 0x878380, 0x8fff00, 0x9ffe00, 0xbe0000, 0xbc0000, 0xb80000, 0x900000), 246:( 0xb80000, 0xbc0000, 0xfc0000, 0xbc0000, 0x980000, 0x800000, 0x800000, 0x900000, 0xbc0000, 0xfc0000, 0xbc0000, 0xb80000, 0x800000, 0x800000, 0x800000, 0xb80000, 0xfc0000, 0xfc0000, 0xbc0000) }
entypo_23 = {'width': 22, 'height': 23, 33: (8388608, 9961472, 12320768, 12451840, 12451840, 12320768, 12320768, 10223616, 10354688, 9371648, 9404416, 8898048, 8646400, 8519552, 8421248, 8404864, 8392448, 8388608), 34: (12582904, 16777212, 16252956, 16252956, 16252956, 13107228, 13107228, 16252956, 16252956, 16252956, 16252956, 12582908), 35: (8392454, 8454046, 8912888, 10484960, 10484832, 12582112, 12582848, 12582848, 12582784, 10484736, 9428992, 8880128), 36: (8389632, 8392192, 8396288, 8396544, 8396544, 8396544, 8396544, 8396544, 16777200, 8388608, 8389056, 8390592, 8390592, 8390592, 8390592, 8390592, 8390592, 8390592, 8390528, 8389504, 8388864), 37: (16746496, 16750592, 16726016, 16726016, 16676864, 16676864, 16578560, 16578560, 16381952, 16381952, 16381952, 16578560, 16578560, 16676864, 16676864, 16726016, 16726016, 16750592, 16750592), 38: (14680064, 16515072, 14811136, 13041664, 13598720, 12566528, 10477568, 9433088, 8910848, 8649728, 8519168, 8453888, 8421248, 8404864, 8396544, 8392192, 8389632), 39: (8388608, 9371648, 10469376, 11558912, 14823424, 15177728, 14994432, 15099392, 10957568, 11770240, 10079424, 9234016, 8811312, 8599832, 8494092, 8441356, 8413964, 8401292, 8396024, 8392304, 8390144), 40: (8421376, 8503296, 8642560, 8908800, 9433088, 10483712, 12581888, 12582400, 8642560, 8642560, 8642560, 8642560, 8634368, 8880128, 8880128, 8847360, 9306112, 9961472, 10485760), 41: (8421376, 8503296, 8642560, 8876032, 9318400, 10270720, 12442624, 12307968, 8642560, 8908800, 9435136, 10484736, 12582400, 8642560, 8642560, 8642560, 8634368, 8896512, 9404416, 10354688, 12058624), 42: (10485760, 9961472, 9175040, 8847360, 8880128, 8880128, 8634368, 8634368, 8642560, 8642560, 8642560, 16776704, 12581888, 10483712, 9435136, 8908800, 8642560, 8503296, 8421376), 43: (15728640, 16252928, 16252928, 16515072, 16515072, 16515072, 16650208, 16728032, 16777200, 16777200, 16777200, 16777200, 16728032, 16650208, 16515072, 16515072, 16515072, 16252928, 16252928, 15728640), 44: (16515072, 16515072, 16646144, 16650176, 16760800, 16777184, 16777184, 16777184, 16728000, 16650112, 16646144, 16515072, 16522752, 16383744, 16383744, 8650496, 16727808, 16646144, 16646144, 16515072, 16515072), 45: (16515072, 16515072, 16646144, 16648128, 16719856, 16777200, 16777200, 16777200, 16777200, 16777200, 16719840, 16648128, 16646144, 16527360, 16527360, 16265216, 16383488, 8519168, 8400896, 8400896, 8400896), 46: (12582784, 16777152, 14680256, 14680256, 15133888, 15133888, 15133888, 15133888, 15133888, 15133888, 14680256, 14680256, 14823616, 14940352, 14940352, 14842048, 14811328, 14680256, 14680256, 16777152, 12582784), 47: (16776704, 16776704, 14681600, 14681600, 14681600, 14680576, 14795264, 14708736, 14694400, 14694400, 14687232, 14687232, 14687232, 14687744, 14811072, 14745472, 16285440, 16530944, 8396288, 8395776, 8390656), 48: (8404480, 8519424, 8912768, 9429440, 12566976, 16761280, 10469824, 9429952, 8650624, 8453888, 8395776), 49: (16776704, 16776704, 11535104, 9437568, 9961600, 9437120, 8913088, 9961856, 11534592, 10486528, 16776704, 10486528, 11534592, 9961856, 9961664, 9437120, 9961664, 9961856, 11534592, 10486528, 16776704), 50: (8453120, 8650496, 9406336, 10355136, 10223840, 12058736, 11780144, 15855672, 14809112, 14797848, 14730264, 14730776, 14709272, 15736368, 11536176, 12058736, 10223840, 9372608, 8912768, 8519168), 51: (8396800, 8396800, 8400896, 8400896, 8402944, 8402944, 8420352, 8420352, 8650240, 12582400, 9309952, 8881920, 8512384, 8417728, 8395968, 8390496, 8389088, 8388704, 8388608), 52: (8517632, 8912384, 9315200, 10232256, 9969856, 11542624, 10485792, 14680112, 16647152, 16647152, 14680112, 10485792, 11542624, 11542752, 9970112, 9315200, 8912640, 8518656), 53: (8417280, 8452096, 8453120, 8453120, 8453120, 8453120, 8510464, 8490496, 8621568, 8849152, 8782720, 12452832, 16647152, 16647152, 16647152, 12452848, 10224096), 54: (8419328, 8453120, 8519168, 8650240, 8912640, 9436928, 10485248, 12582400, 12581888, 16776192, 12582400, 10485248, 9436672, 8912640, 8650496, 8519168, 8453632, 8420352, 8388608), 55: (8388608, 8390656, 8394752, 8402944, 12072960, 10483712, 9435136, 8912384, 8912832, 8650736, 8912768, 9436160, 10483712, 10450944, 11548672, 8394752, 8394752, 8390656, 8388608), 56: (9433088, 9433088, 9433088, 9433088, 8388608, 9433088, 10481664, 10483712, 12581888, 16776704, 16777152, 16777184, 16777184, 16775168, 16775168, 16775168, 12580864, 12580864, 10481664), 57: (8911872, 9436672, 9436672, 16776704, 12582400, 10485248, 9371648, 9388000, 9388016, 9388016, 9388016, 9388016, 9388016, 8863728, 8404976, 8421360, 8454128, 8519664, 8404976, 8404976, 8404976), 58: (8912384, 8912640, 9436928, 9436928, 9436928, 9436928, 9436928, 9436928, 10485504, 12582656, 16776960, 9436928, 9436928, 9436928, 9436928, 8912640, 8912384), 59: (12597248, 12647424, 14744576, 11598848, 10353664, 9436160, 8648704, 8388608, 8388608, 12613632, 12647424, 14744576, 11598848, 10484736, 9435136, 8646656, 8388608, 8388608, 8388608), 60: (8642560, 8647680, 12841984, 16774144, 16774656, 14808576, 14710720, 14710720, 14710720, 14710720, 14710720, 14710720, 14710720, 14710720, 14710272, 14939648, 16774656, 16774144, 8647680, 8647680, 8642560), 61: (8388608, 8920832, 10485696, 12058592, 11665392, 11927544, 11993072, 11993072, 11763696, 9666544, 9469920, 9977792, 8929152, 9190912, 8796160, 8597504, 8511488, 8445952), 62: (10354688, 12517376, 15958016, 14794752, 14737408, 15757312, 12072960, 10065920, 8624128, 8600320, 8618880, 8503744, 8446144, 8417472, 8403392, 8396672, 8392448), 63: (8388992, 8396672, 8519552, 10485696, 12550112, 11550688, 8396768, 8396768, 8396736, 8396672, 8404736, 8420864, 8420864, 8420864, 8404480, 8396288, 8392192, 8389376, 8388864), 64: (8521728, 8861696, 8911872, 8911872, 12582784, 16719808, 16650176, 12322688, 10225408, 12322560, 12322688, 16650176, 16719808, 9436928, 8911872, 8911872, 8591360, 8521728), 65: (10223616, 12451840, 12517376, 16744448, 12566528, 10477568, 9433088, 8902656, 8637440, 8507264, 8454080, 8421344, 8404976, 8404944, 8404752, 8396336, 8396384, 8392384, 8390528), 66: (8389568, 8390592, 8391744, 8394816, 8401856, 11567072, 15761200, 16318256, 16776976, 16776720, 16776976, 16383760, 15793968, 11567072, 8402880, 8400960, 8395840, 8392640, 8389568), 67: (8486912, 8634368, 8904704, 10477568, 12578816, 16775168, 12581888, 12581888, 10485248, 9436928, 9436928, 8912768, 8650624, 8515968, 8515968, 8451840, 8420864, 8391936, 8388800, 8388732, 8388608), 68: (12581888, 16776704, 16776704, 16776704, 16776704, 16727808, 16256960, 15763392, 15984576, 15201216, 15201216, 15197120, 14934976, 15845312, 16256960, 16662272, 16776704, 16776704, 16770560, 16776704, 12581888), 69: (8519680, 8650752, 9175040, 10223616, 10223616, 12320768, 12320768, 12320768, 12320768, 12451840, 12517376, 10452992, 10469376, 9433184, 8912832, 8650624, 8519168, 8388608), 70: (8634368, 9433088, 10484736, 12582400, 12582656, 16776960, 16777088, 16777088, 16777088, 16777088, 16318336, 16318336, 12124032, 12582784, 10485632, 10256128, 8404736, 8404736, 8404480, 8403968, 8400896), 71: (11534336, 12115968, 10254336, 8797184, 8592896, 8883968, 8900352, 8906624, 8906624, 8910720, 8909696, 8911744, 8649600, 8519552, 8421248, 8396672, 8390528, 8389504, 8388992, 8388608, 8388608), 72: (9961472, 12451840, 12451840, 12517376, 12517376, 12517376, 10485752, 9437176, 8388848, 8388832, 8389056, 8396544, 8388608, 8388608, 8388608), 73: (8392448, 8650624, 16776832, 16776896, 16776768, 16770624, 16746048, 16727616, 16678464, 16678464, 16662080, 16713280, 16762432, 16776768, 16776768, 16776896, 10485632, 8404736), 74: (8455168, 8510464, 8518656, 8452096, 8417280, 8417280, 14708848, 16675824, 12582880, 9437056, 8912384, 8518656, 8417280, 8417280, 8417280, 8417280, 8417280, 8417280, 8417280, 8417280, 8396800), 75: (8452096, 8904192, 9307008, 10355648, 12582880, 12554208, 15598512, 12976912, 12845328, 12845328, 12845328, 12845328, 12976944, 12519408, 12582880, 10450880, 9307072, 8782592, 8650240, 8396800), 76: (8896608, 10481808, 12351632, 11540720, 15744512, 14745472, 14811072, 14929120, 15965296, 12007472, 12548144, 10481712, 8896560, 8847408, 8585328, 8618080, 8503776, 8454080, 8421248), 77: (8781824, 9371648, 10452992, 10469376, 12574720, 12574720, 15790080, 14692352, 12988416, 13570048, 13602816, 13373440, 12849152, 14692352, 15757312, 12574720, 12574720, 10469376, 10469376, 9404416, 8847360), 78: (8452096, 8912384, 9408384, 10224064, 12058848, 11534432, 15728752, 14680112, 14680112, 14696240, 14712624, 14729264, 15827056, 11534432, 12058848, 10224064, 9307008, 8912640, 8650240), 79: (8420352, 8453120, 8486912, 14876672, 14908664, 14908668, 16678140, 16743676, 14908668, 14892280, 14745600, 8486912, 8453120, 8403968), 80: (12582784, 16777152, 14684096, 14683904, 14684016, 14684016, 14684096, 14684096, 14684096, 14684096, 14684096, 14684096, 14684096, 14684016, 14684016, 14683904, 14684096, 16777152, 12582784), 81: (8392704, 10500096, 9976832, 9338368, 8912768, 8647616, 8511584, 8445968, 8388608), 82: (10354928, 11731384, 12091976, 16270412, 16545868, 16650308, 16650308, 16545860, 16303180, 12157512, 11731384, 10354928), 83: (12071296, 16527744, 16527744, 16544128, 12088192, 8446848, 8505088, 8898304, 12553728, 16653312, 16268288, 8452096, 8646656, 16760832, 16744448, 16515072), 84: (8389632, 8392192, 8390400, 8397568, 8418176, 8401280, 8468864, 8591552, 11640000, 16354496, 16354496, 16354496, 9673920, 8591552, 8468864, 8401280, 8418176, 8397568, 8390400, 8390144, 8388608), 85: (10483712, 12580864, 12580864, 12582656, 16777152, 16775392, 16775264, 16775264, 16775264, 16777184, 16777152, 12582656, 12580864, 12580864, 10481664), 86: (12578816, 12580864, 16775168, 16775552, 16775648, 16775408, 16775216, 16775216, 16775216, 16777200, 16777184, 16777088, 16775168, 12580864, 12578816), 87: (8486912, 8880128, 9404416, 10420224, 12320768, 16515072, 12451840, 10452992, 8904704, 8515584, 8453120, 8404480, 8396544, 8390400), 88: (14692352, 15757312, 12443648, 10469376, 9404416, 9404416, 10469376, 12443648, 16281600, 14692352), 89: (8515584, 8911872, 9436672, 10485504, 12566400, 12566400, 16760768, 16760768, 16760768, 16760768, 16760768, 16760768, 12566400, 12566400, 10485504, 9436672, 8911872, 8515584), 90: (8452096, 8650240, 9437056, 10485696, 10457024, 12554208, 12554208, 12554208, 12058848, 12058848, 12554208, 12554208, 12554208, 10457024, 10485696, 9437056, 8650240, 8452096), 91: (8515584, 8912384, 9436928, 10485632, 12448640, 12116416, 16532416, 16648128, 16715744, 16650208, 16517088, 16278464, 12121024, 12451712, 10485632, 9436928, 8911872, 8450048), 92: (14680064, 14680064, 14680064, 14680064, 14680064, 14680064, 14680064, 14680064, 14680064, 14680064, 14680064, 14680064), 93: (8585216, 8585216, 8585216, 8585216, 8585216, 16775168, 16775168, 8585216, 8585216, 8585216, 8585216, 8585216), 94: (8517632, 8912640, 9428864, 10355648, 12320992, 11927648, 15925360, 14778416, 14729264, 14704688, 14692400, 14686256, 15731824, 15730288, 12059616, 10224064, 10422208, 8912768, 8650240), 95: (8396800, 8392704, 16652288, 16775168, 16776192, 12581944, 12057724, 9993852, 8912956, 8912920), 96: (8452096, 8650240, 9437056, 10485696, 10485728, 12582880, 12582896, 16506864, 16257008, 16256112, 16321648, 16645232, 16777200, 12582896, 12582880, 10485696, 9437120, 8912640, 8650240, 8396800), 97: (8389504, 8389568, 8389600, 8389616, 16367728, 16375920, 16380016, 12122224, 8404464, 8396768, 8396768, 8392640), 98: (8452096, 8650240, 9437056, 10485696, 10485696, 12582880, 12581344, 16775408, 16383216, 16293104, 16354544, 16761072, 16769520, 12581856, 12582880, 10485696, 9437056, 8912640, 8650240, 8396800), 99: (12582912, 15728640, 16515072, 16646144, 16744448, 16769024, 16775168, 16776192, 16776960, 15470528, 15470528, 16777088, 16776704, 16775168, 16773120, 16760832, 16711680, 16646144, 16252928, 14680064), 100: (8515584, 8911872, 10427904, 10225408, 12059520, 15729088, 14680256, 14680256, 14680256, 14680256, 14680256, 15729088, 11551104, 10535808, 8507136, 8650240, 8648704, 8503296, 8437760, 8404992), 101: (8404992, 8437760, 8503296, 8648704, 8650240, 8507136, 10535808, 11551104, 15729088, 14680256, 14680256, 14680256, 14680256, 14680256, 15729088, 12059520, 10225408, 9379328, 8911872, 8515584), 102: (9307008, 9307008, 9307008, 9307008, 9373568, 8851200, 8881920, 8642560, 8515584, 8452096, 8535040, 8592896, 8883968, 9373440, 9307008, 9307008, 9339776, 12521440, 10422208, 9307008, 8651008), 103: (8396800, 15757312, 15792128, 15857664, 15989760, 15757312, 15757312, 15757312, 15757312, 15757312, 15757312, 15757312, 15757312, 15757312, 15757312, 16773120, 16773120, 12574720), 104: (8388608, 8396800, 8400896, 16775168, 16776192, 16773120, 15736832, 15745024, 15728640, 15729664, 15735808, 14687232, 12590080, 8395776, 8920064, 9968640, 12581888, 16776192, 12580864, 8912896, 8912896), 105: (14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960), 106: (14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 14888960, 8388608, 8388608, 8388608, 8585216, 8585216, 8585216, 8585216, 16773120, 16773120, 8585216, 8585216, 8585216, 8585216), 107: (16546816, 16546816, 16546816, 16546816, 16546816, 8388608, 8388608, 12072960, 16546816, 16546816, 16546816, 16546816, 12351488), 108: (12582880, 16777200, 14680112, 14680112, 15086384, 15086384, 15086384, 15086384, 15086384, 15086384, 14680112, 14680112, 14680112, 16777200, 12582880), 109: (12582880, 16777200, 14680112, 14680112, 14680112, 14680112, 14680112, 14680112, 14680112, 14680112, 14680112, 14680112, 14680112, 16777200, 12582880), 110: (8912880, 8912880, 8781872, 8781872, 16777008, 16777008, 14680880, 14680880, 14681072, 14681072, 14681056, 14680832, 14680832, 16776960, 16776960), 111: (12582400, 16776960, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 14680832, 16776960, 12582400), 112: (8390144, 8404480, 8453888, 8390400, 16774016, 16774016, 16774016, 14808000, 14709696, 14742464, 14938592, 14938336, 14807264, 14807152, 14741744, 14709744, 14709696, 14709504, 14807040, 16773120, 16773120), 113: (15086336, 15086336, 16776960, 16776960, 16776960, 16776960, 16776960, 16776960, 16256768, 16523008, 16662272, 16662272, 16744192, 16776960, 16776960, 16776960, 16776960, 16776960, 16776960, 15086336, 15086336), 114: (12582880, 16777200, 16777200, 16777200, 16318448, 16318448, 16318448, 16253168, 16515312, 16774128, 16762864, 16777200, 16777200, 16777200, 12582880), 115: (8515584, 16775168, 16776064, 16776128, 16776128, 16776128, 16776128, 16776128, 16776064, 16775936, 16775936, 16775936, 16775936, 16775936, 16775936, 16775936, 16775936, 16775936, 16775936, 16775680, 9433088), 116: (8402944, 9436160, 16775168, 16775936, 16775936, 16776000, 16661312, 16661312, 16710464, 16710464, 16710464, 16710464, 16710464, 16661312, 16726848, 16776000, 16775936, 16775936, 16775168, 8911872, 8394752), 117: (8392448, 10485632, 12582016, 16776384, 16776384, 16776256, 16776256, 16776256, 16776256, 16776384, 16776384, 12582080, 12582784, 8454016, 8388608), 118: (10354688, 16711680, 16711680, 16744448, 16695296, 16663552, 16646656, 15729408, 15761280, 15761344, 15761376, 15761344, 15761280, 15729408, 16515840, 16663040, 16695296, 16678912, 16744448, 16711680, 12451840), 119: (12451840, 16711680, 16711680, 16613376, 16547840, 16516096, 16518144, 15735808, 15744992, 15761376, 15761376, 15761376, 15744992, 15735808, 16518144, 16548864, 16547840, 16613376, 16711680, 16646144, 10354688), 120: (9404416, 12574720, 15858688, 14810880, 14811008, 14808960, 14804864, 14802944, 14794752, 14778368, 14794752, 14794752, 14804864, 14808960, 14811008, 14810880, 14810112, 12578816, 9404416), 121: (10223616, 16646144, 16711680, 16711680, 16760832, 16773120, 16775168, 16776192, 16776192, 16776192, 16776192, 16776192, 16776192, 16775168, 16773120, 16760832, 16760832, 16760832, 16760832, 12550144, 10420224), 122: (10223616, 12517376, 16711680, 16711680, 16769024, 16775168, 16775168, 16514048, 16382976, 8453632, 8404480, 8420352, 16382976, 16513024, 16773120, 16769024, 16769024, 16769024, 12566528, 12566528, 9371648), 123: (16776192, 12581888, 12580864, 10481664, 9433088, 9428992, 8904704, 8896512, 8617984, 8486912, 8454144), 124: (12582656, 16776960, 16776960, 12582656, 8388608, 8388608, 8388608, 12582400, 16776960, 16776960, 12582656), 125: (8642560, 9435136, 10484736, 12582400, 12582400, 12582656, 16776960, 16776960, 16776960, 12582656, 12582400, 10485248, 10484736, 9435136, 8642560), 126: (12581888, 16776192, 16776192, 16776192, 16776192, 16776192, 16776192, 16776192, 16776192, 16776192, 16776192, 16776192, 12581888), 174: (16546816, 16546816, 16546816, 16546816, 16546816, 16546816, 8388608, 8388608, 16546816, 16546816, 16546816, 16546816, 16546816, 16546816, 16546816, 16546816, 16546816, 16546816, 16546816), 196: (16775168, 16773120, 12578816, 10477568, 10469376, 9420800, 8880128, 8847360, 8585216, 16775168, 16775168, 12578816, 10477568, 10477568, 9420800, 8880128, 8880128, 8585216, 8388608), 197: (8519680, 8585216, 8880128, 9404416, 9420800, 10477568, 12574720, 12578816, 16775168, 8388608, 8585216, 8847360, 8880128, 9420800, 10477568, 12574720, 12578816, 16775168, 16773120), 199: (16775168, 16775168, 16775168, 8388608, 8585216, 8847360, 8880128, 9420800, 9420800, 10477568, 12574720, 12578816, 12578816), 201: (12578816, 12578816, 10477568, 10477568, 9420800, 9404416, 8880128, 8585216, 8585216, 12578816, 16775168, 16775168, 16775168), 209: (16646144, 16515072, 16515072, 16646144, 11468800, 8847360, 8519680, 8388608, 8388608, 8388608, 8391680, 8396352, 8396736, 8392640, 8390592, 8390592, 8392640), 214: (9437184, 12058624, 16580608, 12517376, 10420224, 9371648, 10420224, 8388608, 8388608, 8388608, 8396672, 8396544, 8396288, 8396672, 8396736, 8393664, 8388992), 220: (12582912, 14680064, 14680064, 15728640, 15728640, 16252928, 16515072, 16515072, 16646144, 16646144, 16711680, 16711680, 16744448, 16760832, 16760832, 16769024, 16769024, 16773120, 12578816), 224: (14680064, 15728640, 12181504, 10288128, 9338624, 8863616, 9674688, 10078400, 10281088, 10383744, 10434816, 10460160, 10423808, 9373440, 9319296, 8905152, 8634592, 8388720, 8388640), 225: (8388608, 8388608, 8388608, 8452096, 8650240, 8912768, 8912832, 9437152, 9436768, 9435232, 9433152, 9429184, 8896920, 8897310, 8881678, 8621058, 8517728, 8511600, 8389432, 8389400, 8389504, 8388992), 226: (8421376, 8503296, 8642560, 8908800, 9435136, 10484736, 12582400, 16777088, 8910848, 8910848, 8910848, 8910848, 8910848, 8910848, 8910848), 227: (8388608, 8421376, 8437760, 8445952, 16773120, 16775168, 16776192, 16776704, 16776960, 16776704, 16776192, 16775168, 8450048, 8445952, 8437760, 8421376), 228: (8421376, 8486912, 8617984, 8880128, 9436928, 10485504, 12582656, 16776960, 16776960, 12582656, 10485504, 9436928, 8880128, 8617984, 8486912, 8421376), 229: (8910848, 8910848, 8910848, 8910848, 8910848, 8910848, 8910848, 16777088, 12582656, 10485248, 9436160, 8910848, 8646656, 8511488, 8437760), 231: (8388608, 8486912, 8634368, 8904704, 9433088, 10483712, 12580864, 16776192, 8904704, 8904704, 8904704, 8904704, 8904704, 8904704, 8904704), 232: (8421376, 8437760, 8445952, 8450048, 16775168, 16776192, 16776704, 16776960, 16776192, 16775168, 8450048, 8445952, 8437760, 8421376), 233: (8421376, 8486912, 8617984, 8880128, 9436928, 12582656, 16776960, 16776960, 12582656, 10485504, 8880128, 8617984, 8486912, 8421376), 234: (8904704, 8904704, 8904704, 8904704, 8904704, 8904704, 8904704, 16776704, 12581888, 10483712, 9433088, 8908800, 8642560, 8634368, 8486912), 235: (8453120, 8650496, 9406336, 10355136, 12058848, 11534432, 15741040, 14710832, 14744624, 14941744, 14710832, 14710832, 15759472, 11565152, 12058848, 10224064, 9307072, 8912768, 8519168), 236: (8452096, 8912384, 9408384, 10224064, 12058848, 11534432, 15732848, 14686256, 14941232, 14941744, 14941232, 14940208, 15732848, 11542624, 12058848, 10224064, 9307008, 8912640, 8650240), 237: (8452096, 8912384, 9408384, 10224064, 12058848, 11534432, 15745136, 14729264, 14810672, 14941744, 14810672, 14745136, 15745136, 11550816, 12058848, 10224064, 9307008, 8912640, 8650240), 238: (8453120, 8650496, 9406336, 10355136, 12058848, 11534432, 15759472, 14710832, 14710832, 14711344, 14810160, 14743600, 15757424, 11542624, 12058848, 10224064, 9307072, 8912768, 8519168), 239: (8421376, 8437760, 16769024, 16773120, 16775168, 16776192, 16776704, 8453888, 8454016, 8454080, 8454080, 8454016, 16776960, 16776704, 16776192, 16775168, 16773120, 8445952, 8437760), 241: (16777200, 12582896, 10485744, 9437168, 9437168, 10485744, 12582896, 16777200), 242: (12550144, 16744448, 14680064, 14680064, 14942080, 15204288, 15073472, 15073472, 15073472, 8782016, 8782016, 8782016, 8782016, 8782016, 8782016, 8912832, 8650624), 243: (8912880, 9437168, 9175152, 10011744, 9997408, 9537728, 11606208, 11534784, 16777088, 16777088, 16777088, 11534720, 11606208, 9537728, 9997408, 10011744, 9175136, 9437168, 8912880), 244: (8420352, 8453888, 8505216, 8585600, 8847808, 8782016, 8782016, 8782016, 8782016, 8585600, 8881024, 9436928, 10485248, 12451840, 12320768, 12058624, 9437184), 246: (12058624, 12320768, 16515072, 12320768, 9961472, 8388608, 8388608, 9437184, 12320768, 16515072, 12320768, 12058624, 8388608, 8388608, 8388608, 12058624, 16515072, 16515072, 12320768)}
def value_matcher(value): if value.type.tag == "rat64": return Rat64Printer(value) return None class Rat64Printer(object): def __init__(self, value): self.value = value def to_string(self): numerator = self.value["numerator"] denominator = self.value["denominator"] return str(numerator) + "/" + str(denominator) gdb.current_objfile().pretty_printers.append(value_matcher)
def value_matcher(value): if value.type.tag == 'rat64': return rat64_printer(value) return None class Rat64Printer(object): def __init__(self, value): self.value = value def to_string(self): numerator = self.value['numerator'] denominator = self.value['denominator'] return str(numerator) + '/' + str(denominator) gdb.current_objfile().pretty_printers.append(value_matcher)
def fn(): print('Generate cache') cache = {} def get_from_cache(key): res = cache.get(key) if res: print('From cache') return res else: print('Calculate and save') res = 'value ' + str(key) cache[key] = res return get_from_cache f1 = fn() f2 = fn() f1(1) f1(2) f1(1) f1(2) f2(1) f2(2) f2(1) f2(2)
def fn(): print('Generate cache') cache = {} def get_from_cache(key): res = cache.get(key) if res: print('From cache') return res else: print('Calculate and save') res = 'value ' + str(key) cache[key] = res return get_from_cache f1 = fn() f2 = fn() f1(1) f1(2) f1(1) f1(2) f2(1) f2(2) f2(1) f2(2)
def __get_ints(line: str) -> list[int]: strings = line.strip().split(' ') return list(map(lambda x: int(x), strings)) def read_case_from_file(file_path: str) -> tuple[list[int], list[int]]: with open(file_path, 'r') as file: lines = file.readlines() assert len(lines) == 4 ranks = __get_ints(lines[1]) scores = __get_ints(lines[3]) return ranks, scores def read_results_from_file(file_path: str) -> list[int]: results = [] with open(file_path, 'r') as file: lines = file.readlines() for line in lines: number = int(line.strip()) results.append(number) return results
def __get_ints(line: str) -> list[int]: strings = line.strip().split(' ') return list(map(lambda x: int(x), strings)) def read_case_from_file(file_path: str) -> tuple[list[int], list[int]]: with open(file_path, 'r') as file: lines = file.readlines() assert len(lines) == 4 ranks = __get_ints(lines[1]) scores = __get_ints(lines[3]) return (ranks, scores) def read_results_from_file(file_path: str) -> list[int]: results = [] with open(file_path, 'r') as file: lines = file.readlines() for line in lines: number = int(line.strip()) results.append(number) return results
# # PySNMP MIB module CMM4-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CMM4-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:09:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") Gauge32, NotificationType, Bits, ObjectIdentity, iso, Integer32, MibIdentifier, Counter64, ModuleIdentity, IpAddress, Counter32, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "NotificationType", "Bits", "ObjectIdentity", "iso", "Integer32", "MibIdentifier", "Counter64", "ModuleIdentity", "IpAddress", "Counter32", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") whispBox, whispCMM4, whispModules = mibBuilder.importSymbols("WHISP-GLOBAL-REG-MIB", "whispBox", "whispCMM4", "whispModules") EventString, WhispLUID, WhispMACAddress = mibBuilder.importSymbols("WHISP-TCV2-MIB", "EventString", "WhispLUID", "WhispMACAddress") cmm4MibModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 161, 19, 1, 1, 15)) if mibBuilder.loadTexts: cmm4MibModule.setLastUpdated('200603290000Z') if mibBuilder.loadTexts: cmm4MibModule.setOrganization('Cambium Networks') cmm4Groups = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1)) cmm4Config = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2)) cmm4Status = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3)) cmm4Gps = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4)) cmm4EventLog = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 5)) cmm4Controls = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6)) cmm4Snmp = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7)) cmm4Event = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8)) cmm4GPSEvent = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8, 1)) cmm4PortCfgGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 1)).setObjects(("CMM4-MIB", "portCfgIndex"), ("CMM4-MIB", "cmm4PortText"), ("CMM4-MIB", "cmm4PortDevType"), ("CMM4-MIB", "cmm4PortPowerCfg"), ("CMM4-MIB", "cmm4PortResetCfg")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4PortCfgGroup = cmm4PortCfgGroup.setStatus('current') cmm4ConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 2)).setObjects(("CMM4-MIB", "gpsTimingPulse"), ("CMM4-MIB", "lan1Ip"), ("CMM4-MIB", "lan1SubnetMask"), ("CMM4-MIB", "defaultGateway"), ("CMM4-MIB", "cmm4WebAutoUpdate"), ("CMM4-MIB", "cmm4ExtEthPowerReset"), ("CMM4-MIB", "cmm4IpAccessFilter"), ("CMM4-MIB", "cmm4IpAccess1"), ("CMM4-MIB", "cmm4IpAccess2"), ("CMM4-MIB", "cmm4IpAccess3"), ("CMM4-MIB", "cmm4MgmtPortSpeed"), ("CMM4-MIB", "cmm4NTPServerIp"), ("CMM4-MIB", "sessionTimeout"), ("CMM4-MIB", "vlanEnable"), ("CMM4-MIB", "managementVID"), ("CMM4-MIB", "siteInfoViewable")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4ConfigGroup = cmm4ConfigGroup.setStatus('current') cmm4PortStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 3)).setObjects(("CMM4-MIB", "portStatusIndex"), ("CMM4-MIB", "cmm4PortPowerStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4PortStatusGroup = cmm4PortStatusGroup.setStatus('current') cmm4StatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 4)).setObjects(("CMM4-MIB", "deviceType"), ("CMM4-MIB", "cmm4pldVersion"), ("CMM4-MIB", "cmm4SoftwareVersion"), ("CMM4-MIB", "cmm4SystemTime"), ("CMM4-MIB", "cmm4UpTime"), ("CMM4-MIB", "satellitesVisible"), ("CMM4-MIB", "satellitesTracked"), ("CMM4-MIB", "latitude"), ("CMM4-MIB", "longitude"), ("CMM4-MIB", "height"), ("CMM4-MIB", "trackingMode"), ("CMM4-MIB", "syncStatus"), ("CMM4-MIB", "cmm4MacAddress"), ("CMM4-MIB", "cmm4ExtEthPwrStat"), ("CMM4-MIB", "cmm4FPGAVersion"), ("CMM4-MIB", "cmm4FPGAPlatform"), ("CMM4-MIB", "defaultStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4StatusGroup = cmm4StatusGroup.setStatus('current') cmm4GPSGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 5)).setObjects(("CMM4-MIB", "gpsTrackingMode"), ("CMM4-MIB", "gpsTime"), ("CMM4-MIB", "gpsDate"), ("CMM4-MIB", "gpsSatellitesVisible"), ("CMM4-MIB", "gpsSatellitesTracked"), ("CMM4-MIB", "gpsHeight"), ("CMM4-MIB", "gpsAntennaConnection"), ("CMM4-MIB", "gpsLatitude"), ("CMM4-MIB", "gpsLongitude"), ("CMM4-MIB", "gpsInvalidMsg"), ("CMM4-MIB", "gpsRestartCount"), ("CMM4-MIB", "gpsReceiverInfo"), ("CMM4-MIB", "gpsSyncStatus"), ("CMM4-MIB", "gpsSyncMasterSlave"), ("CMM4-MIB", "gpsLog"), ("CMM4-MIB", "gpsReInitCount")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4GPSGroup = cmm4GPSGroup.setStatus('current') cmm4ControlsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 6)).setObjects(("CMM4-MIB", "cmm4Reboot"), ("CMM4-MIB", "cmm4ClearEventLog"), ("CMM4-MIB", "cmm4RebootIfRequired")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4ControlsGroup = cmm4ControlsGroup.setStatus('current') cmm4SNMPGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 7)).setObjects(("CMM4-MIB", "cmm4SnmpComString"), ("CMM4-MIB", "cmm4SnmpAccessSubnet"), ("CMM4-MIB", "cmm4SnmpTrapIp1"), ("CMM4-MIB", "cmm4SnmpTrapIp2"), ("CMM4-MIB", "cmm4SnmpTrapIp3"), ("CMM4-MIB", "cmm4SnmpTrapIp4"), ("CMM4-MIB", "cmm4SnmpTrapIp5"), ("CMM4-MIB", "cmm4SnmpTrapIp6"), ("CMM4-MIB", "cmm4SnmpTrapIp7"), ("CMM4-MIB", "cmm4SnmpTrapIp8"), ("CMM4-MIB", "cmm4SnmpTrapIp9"), ("CMM4-MIB", "cmm4SnmpTrapIp10"), ("CMM4-MIB", "cmm4SnmpReadOnly"), ("CMM4-MIB", "cmm4SnmpGPSSyncTrapEnable"), ("CMM4-MIB", "cmm4SnmpAccessSubnet2"), ("CMM4-MIB", "cmm4SnmpAccessSubnet3"), ("CMM4-MIB", "cmm4SnmpAccessSubnet4"), ("CMM4-MIB", "cmm4SnmpAccessSubnet5"), ("CMM4-MIB", "cmm4SnmpAccessSubnet6"), ("CMM4-MIB", "cmm4SnmpAccessSubnet7"), ("CMM4-MIB", "cmm4SnmpAccessSubnet8"), ("CMM4-MIB", "cmm4SnmpAccessSubnet9"), ("CMM4-MIB", "cmm4SnmpAccessSubnet10")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4SNMPGroup = cmm4SNMPGroup.setStatus('current') cmm4UserTableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 8)).setObjects(("CMM4-MIB", "entryIndex"), ("CMM4-MIB", "userLoginName"), ("CMM4-MIB", "userPswd"), ("CMM4-MIB", "accessLevel")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4UserTableGroup = cmm4UserTableGroup.setStatus('current') gpsTimingPulse = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("master", 1), ("slave", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: gpsTimingPulse.setStatus('current') lan1Ip = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: lan1Ip.setStatus('current') lan1SubnetMask = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: lan1SubnetMask.setStatus('current') defaultGateway = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 4), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: defaultGateway.setStatus('current') cmm4WebAutoUpdate = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 5), Integer32()).setUnits('Seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4WebAutoUpdate.setStatus('current') cmm4ExtEthPowerReset = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("off", 0), ("on", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4ExtEthPowerReset.setStatus('current') cmm4IpAccessFilter = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("off", 0), ("on", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4IpAccessFilter.setStatus('current') cmm4IpAccess1 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 9), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4IpAccess1.setStatus('current') cmm4IpAccess2 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 10), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4IpAccess2.setStatus('current') cmm4IpAccess3 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 11), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4IpAccess3.setStatus('current') cmm4MgmtPortSpeed = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("autoNegotiate", 1), ("force10Half", 2), ("force10Full", 3), ("force100Half", 4), ("force100Full", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4MgmtPortSpeed.setStatus('current') cmm4NTPServerIp = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 13), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4NTPServerIp.setStatus('current') sessionTimeout = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 14), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: sessionTimeout.setStatus('current') vlanEnable = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disable", 0), ("enable", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: vlanEnable.setStatus('current') managementVID = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094))).setMaxAccess("readwrite") if mibBuilder.loadTexts: managementVID.setStatus('current') siteInfoViewable = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("enable", 1), ("disable", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: siteInfoViewable.setStatus('current') cmm4PortCfgTable = MibTable((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7), ) if mibBuilder.loadTexts: cmm4PortCfgTable.setStatus('current') cmm4PortCfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1), ).setIndexNames((0, "CMM4-MIB", "portCfgIndex")) if mibBuilder.loadTexts: cmm4PortCfgEntry.setStatus('current') portCfgIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: portCfgIndex.setStatus('current') cmm4PortText = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 2), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4PortText.setStatus('current') cmm4PortDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("canopy", 1), ("canopy56V", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4PortDevType.setStatus('current') cmm4PortPowerCfg = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("on", 1), ("off", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4PortPowerCfg.setStatus('current') cmm4PortResetCfg = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("resetPort", 1), ("resetComplete", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4PortResetCfg.setStatus('current') deviceType = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceType.setStatus('current') cmm4pldVersion = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4pldVersion.setStatus('current') cmm4SoftwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4SoftwareVersion.setStatus('current') cmm4SystemTime = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4SystemTime.setStatus('current') cmm4UpTime = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4UpTime.setStatus('current') satellitesVisible = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 7), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: satellitesVisible.setStatus('current') satellitesTracked = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: satellitesTracked.setStatus('current') latitude = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 9), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: latitude.setStatus('current') longitude = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 10), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: longitude.setStatus('current') height = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 11), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: height.setStatus('current') trackingMode = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 12), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: trackingMode.setStatus('current') syncStatus = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 13), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: syncStatus.setStatus('current') cmm4MacAddress = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 14), WhispMACAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4MacAddress.setStatus('current') cmm4ExtEthPwrStat = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("off", 0), ("on", 1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4ExtEthPwrStat.setStatus('current') cmm4FPGAVersion = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 16), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4FPGAVersion.setStatus('current') cmm4FPGAPlatform = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 17), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4FPGAPlatform.setStatus('current') defaultStatus = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("defaultPlugInserted", 1), ("defaultSwitchActive", 2), ("defaultPlugInsertedAndDefaultSwitchActive", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: defaultStatus.setStatus('current') cmm4PortStatusTable = MibTable((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1), ) if mibBuilder.loadTexts: cmm4PortStatusTable.setStatus('current') cmm4PortStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1, 1), ).setIndexNames((0, "CMM4-MIB", "portStatusIndex")) if mibBuilder.loadTexts: cmm4PortStatusEntry.setStatus('current') portStatusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: portStatusIndex.setStatus('current') cmm4PortPowerStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, -1))).clone(namedValues=NamedValues(("on", 1), ("off", 0), ("powerOverEthernetFault", -1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4PortPowerStatus.setStatus('current') gpsTrackingMode = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 1), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsTrackingMode.setStatus('current') gpsTime = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsTime.setStatus('current') gpsDate = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsDate.setStatus('current') gpsSatellitesVisible = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsSatellitesVisible.setStatus('current') gpsSatellitesTracked = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsSatellitesTracked.setStatus('current') gpsHeight = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsHeight.setStatus('current') gpsAntennaConnection = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 7), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsAntennaConnection.setStatus('current') gpsLatitude = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsLatitude.setStatus('current') gpsLongitude = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 9), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsLongitude.setStatus('current') gpsInvalidMsg = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 10), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsInvalidMsg.setStatus('current') gpsRestartCount = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsRestartCount.setStatus('current') gpsReceiverInfo = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 12), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsReceiverInfo.setStatus('current') gpsSyncStatus = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("syncOK", 1), ("noSync", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsSyncStatus.setStatus('current') gpsSyncMasterSlave = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("cmmIsGPSMaster", 1), ("cmmIsGPSSlave", 0)))).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsSyncMasterSlave.setStatus('current') gpsLog = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 15), EventString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsLog.setStatus('current') gpsReInitCount = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 16), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsReInitCount.setStatus('current') eventLog = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 5, 1), EventString()).setMaxAccess("readonly") if mibBuilder.loadTexts: eventLog.setStatus('current') ntpLog = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 5, 2), EventString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ntpLog.setStatus('current') cmm4Reboot = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("reboot", 1), ("finishedReboot", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4Reboot.setStatus('current') cmm4ClearEventLog = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("clear", 1), ("notClear", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4ClearEventLog.setStatus('current') cmm4RebootIfRequired = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("rebootifrquired", 1), ("rebootcomplete", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4RebootIfRequired.setStatus('current') cmm4SnmpComString = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpComString.setStatus('current') cmm4SnmpAccessSubnet = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 2), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet.setStatus('current') cmm4SnmpTrapIp1 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp1.setStatus('current') cmm4SnmpTrapIp2 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 4), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp2.setStatus('current') cmm4SnmpTrapIp3 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 5), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp3.setStatus('current') cmm4SnmpTrapIp4 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 6), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp4.setStatus('current') cmm4SnmpTrapIp5 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 7), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp5.setStatus('current') cmm4SnmpTrapIp6 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 8), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp6.setStatus('current') cmm4SnmpTrapIp7 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 9), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp7.setStatus('current') cmm4SnmpTrapIp8 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 10), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp8.setStatus('current') cmm4SnmpTrapIp9 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 11), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp9.setStatus('current') cmm4SnmpTrapIp10 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 12), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp10.setStatus('current') cmm4SnmpReadOnly = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("readOnlyPermissions", 1), ("readWritePermissions", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpReadOnly.setStatus('current') cmm4SnmpGPSSyncTrapEnable = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("gpsSyncTrapDisabled", 0), ("gpsSyncTrapEnabled", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpGPSSyncTrapEnable.setStatus('current') cmm4SnmpAccessSubnet2 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 15), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet2.setStatus('current') cmm4SnmpAccessSubnet3 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 16), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet3.setStatus('current') cmm4SnmpAccessSubnet4 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 17), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet4.setStatus('current') cmm4SnmpAccessSubnet5 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 18), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet5.setStatus('current') cmm4SnmpAccessSubnet6 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 19), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet6.setStatus('current') cmm4SnmpAccessSubnet7 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 20), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet7.setStatus('current') cmm4SnmpAccessSubnet8 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 21), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet8.setStatus('current') cmm4SnmpAccessSubnet9 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 22), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet9.setStatus('current') cmm4SnmpAccessSubnet10 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 23), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet10.setStatus('current') cmm4GPSInSync = NotificationType((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8, 1, 1)).setObjects(("CMM4-MIB", "gpsSyncStatus"), ("CMM4-MIB", "cmm4MacAddress")) if mibBuilder.loadTexts: cmm4GPSInSync.setStatus('current') cmm4GPSNoSync = NotificationType((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8, 1, 2)).setObjects(("CMM4-MIB", "gpsSyncStatus"), ("CMM4-MIB", "cmm4MacAddress")) if mibBuilder.loadTexts: cmm4GPSNoSync.setStatus('current') cmm4UserTable = MibTable((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9), ) if mibBuilder.loadTexts: cmm4UserTable.setStatus('current') cmm4UserEntry = MibTableRow((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1), ).setIndexNames((0, "CMM4-MIB", "entryIndex")) if mibBuilder.loadTexts: cmm4UserEntry.setStatus('current') entryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 5))).setMaxAccess("readonly") if mibBuilder.loadTexts: entryIndex.setStatus('current') userLoginName = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: userLoginName.setStatus('current') userPswd = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: userPswd.setStatus('current') accessLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("noAdmin", 0), ("guest", 1), ("installer", 2), ("administrator", 3), ("technician", 4), ("engineering", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: accessLevel.setStatus('current') mibBuilder.exportSymbols("CMM4-MIB", cmm4SystemTime=cmm4SystemTime, cmm4SnmpAccessSubnet10=cmm4SnmpAccessSubnet10, cmm4IpAccess1=cmm4IpAccess1, gpsSatellitesVisible=gpsSatellitesVisible, gpsTimingPulse=gpsTimingPulse, cmm4ClearEventLog=cmm4ClearEventLog, lan1Ip=lan1Ip, cmm4PortText=cmm4PortText, cmm4ExtEthPowerReset=cmm4ExtEthPowerReset, cmm4PortCfgEntry=cmm4PortCfgEntry, cmm4PortCfgTable=cmm4PortCfgTable, cmm4NTPServerIp=cmm4NTPServerIp, cmm4SnmpTrapIp4=cmm4SnmpTrapIp4, cmm4SnmpAccessSubnet7=cmm4SnmpAccessSubnet7, cmm4PortPowerCfg=cmm4PortPowerCfg, cmm4StatusGroup=cmm4StatusGroup, cmm4RebootIfRequired=cmm4RebootIfRequired, cmm4IpAccess2=cmm4IpAccess2, gpsRestartCount=gpsRestartCount, cmm4IpAccessFilter=cmm4IpAccessFilter, gpsInvalidMsg=gpsInvalidMsg, PYSNMP_MODULE_ID=cmm4MibModule, cmm4PortCfgGroup=cmm4PortCfgGroup, cmm4GPSNoSync=cmm4GPSNoSync, cmm4SnmpAccessSubnet=cmm4SnmpAccessSubnet, gpsHeight=gpsHeight, cmm4SnmpComString=cmm4SnmpComString, cmm4Controls=cmm4Controls, cmm4ConfigGroup=cmm4ConfigGroup, cmm4SnmpAccessSubnet3=cmm4SnmpAccessSubnet3, trackingMode=trackingMode, cmm4PortStatusGroup=cmm4PortStatusGroup, cmm4FPGAVersion=cmm4FPGAVersion, cmm4MacAddress=cmm4MacAddress, cmm4SnmpTrapIp8=cmm4SnmpTrapIp8, cmm4IpAccess3=cmm4IpAccess3, defaultStatus=defaultStatus, deviceType=deviceType, cmm4GPSInSync=cmm4GPSInSync, sessionTimeout=sessionTimeout, gpsLongitude=gpsLongitude, cmm4Snmp=cmm4Snmp, height=height, cmm4GPSGroup=cmm4GPSGroup, cmm4SnmpTrapIp10=cmm4SnmpTrapIp10, cmm4SnmpAccessSubnet5=cmm4SnmpAccessSubnet5, portStatusIndex=portStatusIndex, userPswd=userPswd, siteInfoViewable=siteInfoViewable, gpsLatitude=gpsLatitude, cmm4UserEntry=cmm4UserEntry, cmm4pldVersion=cmm4pldVersion, cmm4PortDevType=cmm4PortDevType, cmm4PortResetCfg=cmm4PortResetCfg, satellitesTracked=satellitesTracked, syncStatus=syncStatus, cmm4SnmpTrapIp2=cmm4SnmpTrapIp2, gpsSatellitesTracked=gpsSatellitesTracked, cmm4Gps=cmm4Gps, cmm4UserTableGroup=cmm4UserTableGroup, cmm4MibModule=cmm4MibModule, cmm4SnmpAccessSubnet8=cmm4SnmpAccessSubnet8, longitude=longitude, managementVID=managementVID, gpsDate=gpsDate, entryIndex=entryIndex, cmm4Status=cmm4Status, cmm4SnmpReadOnly=cmm4SnmpReadOnly, gpsReInitCount=gpsReInitCount, cmm4SoftwareVersion=cmm4SoftwareVersion, cmm4MgmtPortSpeed=cmm4MgmtPortSpeed, cmm4PortStatusEntry=cmm4PortStatusEntry, gpsAntennaConnection=gpsAntennaConnection, cmm4SnmpTrapIp7=cmm4SnmpTrapIp7, gpsSyncStatus=gpsSyncStatus, cmm4SnmpTrapIp9=cmm4SnmpTrapIp9, cmm4SnmpAccessSubnet4=cmm4SnmpAccessSubnet4, cmm4SnmpGPSSyncTrapEnable=cmm4SnmpGPSSyncTrapEnable, satellitesVisible=satellitesVisible, portCfgIndex=portCfgIndex, cmm4SnmpTrapIp6=cmm4SnmpTrapIp6, defaultGateway=defaultGateway, cmm4Groups=cmm4Groups, cmm4SnmpTrapIp1=cmm4SnmpTrapIp1, eventLog=eventLog, latitude=latitude, vlanEnable=vlanEnable, cmm4UserTable=cmm4UserTable, gpsReceiverInfo=gpsReceiverInfo, cmm4SNMPGroup=cmm4SNMPGroup, cmm4ExtEthPwrStat=cmm4ExtEthPwrStat, cmm4EventLog=cmm4EventLog, cmm4FPGAPlatform=cmm4FPGAPlatform, gpsLog=gpsLog, cmm4GPSEvent=cmm4GPSEvent, cmm4SnmpTrapIp5=cmm4SnmpTrapIp5, cmm4Event=cmm4Event, accessLevel=accessLevel, userLoginName=userLoginName, cmm4SnmpAccessSubnet9=cmm4SnmpAccessSubnet9, cmm4Config=cmm4Config, cmm4SnmpAccessSubnet2=cmm4SnmpAccessSubnet2, cmm4UpTime=cmm4UpTime, cmm4PortStatusTable=cmm4PortStatusTable, ntpLog=ntpLog, cmm4WebAutoUpdate=cmm4WebAutoUpdate, gpsSyncMasterSlave=gpsSyncMasterSlave, cmm4PortPowerStatus=cmm4PortPowerStatus, gpsTime=gpsTime, cmm4SnmpTrapIp3=cmm4SnmpTrapIp3, gpsTrackingMode=gpsTrackingMode, lan1SubnetMask=lan1SubnetMask, cmm4SnmpAccessSubnet6=cmm4SnmpAccessSubnet6, cmm4Reboot=cmm4Reboot, cmm4ControlsGroup=cmm4ControlsGroup)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection') (object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance') (gauge32, notification_type, bits, object_identity, iso, integer32, mib_identifier, counter64, module_identity, ip_address, counter32, time_ticks, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'NotificationType', 'Bits', 'ObjectIdentity', 'iso', 'Integer32', 'MibIdentifier', 'Counter64', 'ModuleIdentity', 'IpAddress', 'Counter32', 'TimeTicks', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') (whisp_box, whisp_cmm4, whisp_modules) = mibBuilder.importSymbols('WHISP-GLOBAL-REG-MIB', 'whispBox', 'whispCMM4', 'whispModules') (event_string, whisp_luid, whisp_mac_address) = mibBuilder.importSymbols('WHISP-TCV2-MIB', 'EventString', 'WhispLUID', 'WhispMACAddress') cmm4_mib_module = module_identity((1, 3, 6, 1, 4, 1, 161, 19, 1, 1, 15)) if mibBuilder.loadTexts: cmm4MibModule.setLastUpdated('200603290000Z') if mibBuilder.loadTexts: cmm4MibModule.setOrganization('Cambium Networks') cmm4_groups = mib_identifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1)) cmm4_config = mib_identifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2)) cmm4_status = mib_identifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3)) cmm4_gps = mib_identifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4)) cmm4_event_log = mib_identifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 5)) cmm4_controls = mib_identifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6)) cmm4_snmp = mib_identifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7)) cmm4_event = mib_identifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8)) cmm4_gps_event = mib_identifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8, 1)) cmm4_port_cfg_group = object_group((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 1)).setObjects(('CMM4-MIB', 'portCfgIndex'), ('CMM4-MIB', 'cmm4PortText'), ('CMM4-MIB', 'cmm4PortDevType'), ('CMM4-MIB', 'cmm4PortPowerCfg'), ('CMM4-MIB', 'cmm4PortResetCfg')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4_port_cfg_group = cmm4PortCfgGroup.setStatus('current') cmm4_config_group = object_group((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 2)).setObjects(('CMM4-MIB', 'gpsTimingPulse'), ('CMM4-MIB', 'lan1Ip'), ('CMM4-MIB', 'lan1SubnetMask'), ('CMM4-MIB', 'defaultGateway'), ('CMM4-MIB', 'cmm4WebAutoUpdate'), ('CMM4-MIB', 'cmm4ExtEthPowerReset'), ('CMM4-MIB', 'cmm4IpAccessFilter'), ('CMM4-MIB', 'cmm4IpAccess1'), ('CMM4-MIB', 'cmm4IpAccess2'), ('CMM4-MIB', 'cmm4IpAccess3'), ('CMM4-MIB', 'cmm4MgmtPortSpeed'), ('CMM4-MIB', 'cmm4NTPServerIp'), ('CMM4-MIB', 'sessionTimeout'), ('CMM4-MIB', 'vlanEnable'), ('CMM4-MIB', 'managementVID'), ('CMM4-MIB', 'siteInfoViewable')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4_config_group = cmm4ConfigGroup.setStatus('current') cmm4_port_status_group = object_group((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 3)).setObjects(('CMM4-MIB', 'portStatusIndex'), ('CMM4-MIB', 'cmm4PortPowerStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4_port_status_group = cmm4PortStatusGroup.setStatus('current') cmm4_status_group = object_group((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 4)).setObjects(('CMM4-MIB', 'deviceType'), ('CMM4-MIB', 'cmm4pldVersion'), ('CMM4-MIB', 'cmm4SoftwareVersion'), ('CMM4-MIB', 'cmm4SystemTime'), ('CMM4-MIB', 'cmm4UpTime'), ('CMM4-MIB', 'satellitesVisible'), ('CMM4-MIB', 'satellitesTracked'), ('CMM4-MIB', 'latitude'), ('CMM4-MIB', 'longitude'), ('CMM4-MIB', 'height'), ('CMM4-MIB', 'trackingMode'), ('CMM4-MIB', 'syncStatus'), ('CMM4-MIB', 'cmm4MacAddress'), ('CMM4-MIB', 'cmm4ExtEthPwrStat'), ('CMM4-MIB', 'cmm4FPGAVersion'), ('CMM4-MIB', 'cmm4FPGAPlatform'), ('CMM4-MIB', 'defaultStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4_status_group = cmm4StatusGroup.setStatus('current') cmm4_gps_group = object_group((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 5)).setObjects(('CMM4-MIB', 'gpsTrackingMode'), ('CMM4-MIB', 'gpsTime'), ('CMM4-MIB', 'gpsDate'), ('CMM4-MIB', 'gpsSatellitesVisible'), ('CMM4-MIB', 'gpsSatellitesTracked'), ('CMM4-MIB', 'gpsHeight'), ('CMM4-MIB', 'gpsAntennaConnection'), ('CMM4-MIB', 'gpsLatitude'), ('CMM4-MIB', 'gpsLongitude'), ('CMM4-MIB', 'gpsInvalidMsg'), ('CMM4-MIB', 'gpsRestartCount'), ('CMM4-MIB', 'gpsReceiverInfo'), ('CMM4-MIB', 'gpsSyncStatus'), ('CMM4-MIB', 'gpsSyncMasterSlave'), ('CMM4-MIB', 'gpsLog'), ('CMM4-MIB', 'gpsReInitCount')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4_gps_group = cmm4GPSGroup.setStatus('current') cmm4_controls_group = object_group((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 6)).setObjects(('CMM4-MIB', 'cmm4Reboot'), ('CMM4-MIB', 'cmm4ClearEventLog'), ('CMM4-MIB', 'cmm4RebootIfRequired')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4_controls_group = cmm4ControlsGroup.setStatus('current') cmm4_snmp_group = object_group((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 7)).setObjects(('CMM4-MIB', 'cmm4SnmpComString'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet'), ('CMM4-MIB', 'cmm4SnmpTrapIp1'), ('CMM4-MIB', 'cmm4SnmpTrapIp2'), ('CMM4-MIB', 'cmm4SnmpTrapIp3'), ('CMM4-MIB', 'cmm4SnmpTrapIp4'), ('CMM4-MIB', 'cmm4SnmpTrapIp5'), ('CMM4-MIB', 'cmm4SnmpTrapIp6'), ('CMM4-MIB', 'cmm4SnmpTrapIp7'), ('CMM4-MIB', 'cmm4SnmpTrapIp8'), ('CMM4-MIB', 'cmm4SnmpTrapIp9'), ('CMM4-MIB', 'cmm4SnmpTrapIp10'), ('CMM4-MIB', 'cmm4SnmpReadOnly'), ('CMM4-MIB', 'cmm4SnmpGPSSyncTrapEnable'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet2'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet3'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet4'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet5'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet6'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet7'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet8'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet9'), ('CMM4-MIB', 'cmm4SnmpAccessSubnet10')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4_snmp_group = cmm4SNMPGroup.setStatus('current') cmm4_user_table_group = object_group((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 8)).setObjects(('CMM4-MIB', 'entryIndex'), ('CMM4-MIB', 'userLoginName'), ('CMM4-MIB', 'userPswd'), ('CMM4-MIB', 'accessLevel')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4_user_table_group = cmm4UserTableGroup.setStatus('current') gps_timing_pulse = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('master', 1), ('slave', 0)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: gpsTimingPulse.setStatus('current') lan1_ip = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 2), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: lan1Ip.setStatus('current') lan1_subnet_mask = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 3), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: lan1SubnetMask.setStatus('current') default_gateway = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 4), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: defaultGateway.setStatus('current') cmm4_web_auto_update = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 5), integer32()).setUnits('Seconds').setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4WebAutoUpdate.setStatus('current') cmm4_ext_eth_power_reset = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('off', 0), ('on', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4ExtEthPowerReset.setStatus('current') cmm4_ip_access_filter = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('off', 0), ('on', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4IpAccessFilter.setStatus('current') cmm4_ip_access1 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 9), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4IpAccess1.setStatus('current') cmm4_ip_access2 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 10), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4IpAccess2.setStatus('current') cmm4_ip_access3 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 11), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4IpAccess3.setStatus('current') cmm4_mgmt_port_speed = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('autoNegotiate', 1), ('force10Half', 2), ('force10Full', 3), ('force100Half', 4), ('force100Full', 5)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4MgmtPortSpeed.setStatus('current') cmm4_ntp_server_ip = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 13), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4NTPServerIp.setStatus('current') session_timeout = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 14), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: sessionTimeout.setStatus('current') vlan_enable = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('disable', 0), ('enable', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: vlanEnable.setStatus('current') management_vid = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 16), integer32().subtype(subtypeSpec=value_range_constraint(1, 4094))).setMaxAccess('readwrite') if mibBuilder.loadTexts: managementVID.setStatus('current') site_info_viewable = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 17), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('enable', 1), ('disable', 0)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: siteInfoViewable.setStatus('current') cmm4_port_cfg_table = mib_table((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7)) if mibBuilder.loadTexts: cmm4PortCfgTable.setStatus('current') cmm4_port_cfg_entry = mib_table_row((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1)).setIndexNames((0, 'CMM4-MIB', 'portCfgIndex')) if mibBuilder.loadTexts: cmm4PortCfgEntry.setStatus('current') port_cfg_index = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 8))).setMaxAccess('readonly') if mibBuilder.loadTexts: portCfgIndex.setStatus('current') cmm4_port_text = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 2), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4PortText.setStatus('current') cmm4_port_dev_type = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('none', 0), ('canopy', 1), ('canopy56V', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4PortDevType.setStatus('current') cmm4_port_power_cfg = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('on', 1), ('off', 0)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4PortPowerCfg.setStatus('current') cmm4_port_reset_cfg = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('resetPort', 1), ('resetComplete', 0)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4PortResetCfg.setStatus('current') device_type = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: deviceType.setStatus('current') cmm4pld_version = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 3), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cmm4pldVersion.setStatus('current') cmm4_software_version = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 4), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cmm4SoftwareVersion.setStatus('current') cmm4_system_time = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 5), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cmm4SystemTime.setStatus('current') cmm4_up_time = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 6), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cmm4UpTime.setStatus('current') satellites_visible = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 7), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: satellitesVisible.setStatus('current') satellites_tracked = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 8), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: satellitesTracked.setStatus('current') latitude = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 9), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: latitude.setStatus('current') longitude = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 10), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: longitude.setStatus('current') height = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 11), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: height.setStatus('current') tracking_mode = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 12), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: trackingMode.setStatus('current') sync_status = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 13), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: syncStatus.setStatus('current') cmm4_mac_address = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 14), whisp_mac_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: cmm4MacAddress.setStatus('current') cmm4_ext_eth_pwr_stat = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('off', 0), ('on', 1)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cmm4ExtEthPwrStat.setStatus('current') cmm4_fpga_version = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 16), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cmm4FPGAVersion.setStatus('current') cmm4_fpga_platform = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 17), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cmm4FPGAPlatform.setStatus('current') default_status = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 18), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('none', 0), ('defaultPlugInserted', 1), ('defaultSwitchActive', 2), ('defaultPlugInsertedAndDefaultSwitchActive', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: defaultStatus.setStatus('current') cmm4_port_status_table = mib_table((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1)) if mibBuilder.loadTexts: cmm4PortStatusTable.setStatus('current') cmm4_port_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1, 1)).setIndexNames((0, 'CMM4-MIB', 'portStatusIndex')) if mibBuilder.loadTexts: cmm4PortStatusEntry.setStatus('current') port_status_index = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 8))).setMaxAccess('readonly') if mibBuilder.loadTexts: portStatusIndex.setStatus('current') cmm4_port_power_status = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, -1))).clone(namedValues=named_values(('on', 1), ('off', 0), ('powerOverEthernetFault', -1)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cmm4PortPowerStatus.setStatus('current') gps_tracking_mode = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 1), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsTrackingMode.setStatus('current') gps_time = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsTime.setStatus('current') gps_date = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 3), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsDate.setStatus('current') gps_satellites_visible = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 4), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsSatellitesVisible.setStatus('current') gps_satellites_tracked = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 5), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsSatellitesTracked.setStatus('current') gps_height = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 6), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsHeight.setStatus('current') gps_antenna_connection = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 7), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsAntennaConnection.setStatus('current') gps_latitude = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 8), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsLatitude.setStatus('current') gps_longitude = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 9), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsLongitude.setStatus('current') gps_invalid_msg = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 10), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsInvalidMsg.setStatus('current') gps_restart_count = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 11), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsRestartCount.setStatus('current') gps_receiver_info = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 12), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsReceiverInfo.setStatus('current') gps_sync_status = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('syncOK', 1), ('noSync', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsSyncStatus.setStatus('current') gps_sync_master_slave = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('cmmIsGPSMaster', 1), ('cmmIsGPSSlave', 0)))).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsSyncMasterSlave.setStatus('current') gps_log = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 15), event_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsLog.setStatus('current') gps_re_init_count = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 16), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: gpsReInitCount.setStatus('current') event_log = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 5, 1), event_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: eventLog.setStatus('current') ntp_log = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 5, 2), event_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: ntpLog.setStatus('current') cmm4_reboot = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('reboot', 1), ('finishedReboot', 0)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4Reboot.setStatus('current') cmm4_clear_event_log = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('clear', 1), ('notClear', 0)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4ClearEventLog.setStatus('current') cmm4_reboot_if_required = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('rebootifrquired', 1), ('rebootcomplete', 0)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4RebootIfRequired.setStatus('current') cmm4_snmp_com_string = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 1), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpComString.setStatus('current') cmm4_snmp_access_subnet = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 2), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet.setStatus('current') cmm4_snmp_trap_ip1 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 3), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp1.setStatus('current') cmm4_snmp_trap_ip2 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 4), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp2.setStatus('current') cmm4_snmp_trap_ip3 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 5), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp3.setStatus('current') cmm4_snmp_trap_ip4 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 6), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp4.setStatus('current') cmm4_snmp_trap_ip5 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 7), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp5.setStatus('current') cmm4_snmp_trap_ip6 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 8), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp6.setStatus('current') cmm4_snmp_trap_ip7 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 9), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp7.setStatus('current') cmm4_snmp_trap_ip8 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 10), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp8.setStatus('current') cmm4_snmp_trap_ip9 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 11), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp9.setStatus('current') cmm4_snmp_trap_ip10 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 12), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpTrapIp10.setStatus('current') cmm4_snmp_read_only = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('readOnlyPermissions', 1), ('readWritePermissions', 0)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpReadOnly.setStatus('current') cmm4_snmp_gps_sync_trap_enable = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('gpsSyncTrapDisabled', 0), ('gpsSyncTrapEnabled', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpGPSSyncTrapEnable.setStatus('current') cmm4_snmp_access_subnet2 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 15), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet2.setStatus('current') cmm4_snmp_access_subnet3 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 16), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet3.setStatus('current') cmm4_snmp_access_subnet4 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 17), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet4.setStatus('current') cmm4_snmp_access_subnet5 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 18), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet5.setStatus('current') cmm4_snmp_access_subnet6 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 19), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet6.setStatus('current') cmm4_snmp_access_subnet7 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 20), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet7.setStatus('current') cmm4_snmp_access_subnet8 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 21), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet8.setStatus('current') cmm4_snmp_access_subnet9 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 22), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet9.setStatus('current') cmm4_snmp_access_subnet10 = mib_scalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 23), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cmm4SnmpAccessSubnet10.setStatus('current') cmm4_gps_in_sync = notification_type((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8, 1, 1)).setObjects(('CMM4-MIB', 'gpsSyncStatus'), ('CMM4-MIB', 'cmm4MacAddress')) if mibBuilder.loadTexts: cmm4GPSInSync.setStatus('current') cmm4_gps_no_sync = notification_type((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8, 1, 2)).setObjects(('CMM4-MIB', 'gpsSyncStatus'), ('CMM4-MIB', 'cmm4MacAddress')) if mibBuilder.loadTexts: cmm4GPSNoSync.setStatus('current') cmm4_user_table = mib_table((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9)) if mibBuilder.loadTexts: cmm4UserTable.setStatus('current') cmm4_user_entry = mib_table_row((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1)).setIndexNames((0, 'CMM4-MIB', 'entryIndex')) if mibBuilder.loadTexts: cmm4UserEntry.setStatus('current') entry_index = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 5))).setMaxAccess('readonly') if mibBuilder.loadTexts: entryIndex.setStatus('current') user_login_name = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: userLoginName.setStatus('current') user_pswd = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 3), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: userPswd.setStatus('current') access_level = mib_table_column((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5))).clone(namedValues=named_values(('noAdmin', 0), ('guest', 1), ('installer', 2), ('administrator', 3), ('technician', 4), ('engineering', 5)))).setMaxAccess('readonly') if mibBuilder.loadTexts: accessLevel.setStatus('current') mibBuilder.exportSymbols('CMM4-MIB', cmm4SystemTime=cmm4SystemTime, cmm4SnmpAccessSubnet10=cmm4SnmpAccessSubnet10, cmm4IpAccess1=cmm4IpAccess1, gpsSatellitesVisible=gpsSatellitesVisible, gpsTimingPulse=gpsTimingPulse, cmm4ClearEventLog=cmm4ClearEventLog, lan1Ip=lan1Ip, cmm4PortText=cmm4PortText, cmm4ExtEthPowerReset=cmm4ExtEthPowerReset, cmm4PortCfgEntry=cmm4PortCfgEntry, cmm4PortCfgTable=cmm4PortCfgTable, cmm4NTPServerIp=cmm4NTPServerIp, cmm4SnmpTrapIp4=cmm4SnmpTrapIp4, cmm4SnmpAccessSubnet7=cmm4SnmpAccessSubnet7, cmm4PortPowerCfg=cmm4PortPowerCfg, cmm4StatusGroup=cmm4StatusGroup, cmm4RebootIfRequired=cmm4RebootIfRequired, cmm4IpAccess2=cmm4IpAccess2, gpsRestartCount=gpsRestartCount, cmm4IpAccessFilter=cmm4IpAccessFilter, gpsInvalidMsg=gpsInvalidMsg, PYSNMP_MODULE_ID=cmm4MibModule, cmm4PortCfgGroup=cmm4PortCfgGroup, cmm4GPSNoSync=cmm4GPSNoSync, cmm4SnmpAccessSubnet=cmm4SnmpAccessSubnet, gpsHeight=gpsHeight, cmm4SnmpComString=cmm4SnmpComString, cmm4Controls=cmm4Controls, cmm4ConfigGroup=cmm4ConfigGroup, cmm4SnmpAccessSubnet3=cmm4SnmpAccessSubnet3, trackingMode=trackingMode, cmm4PortStatusGroup=cmm4PortStatusGroup, cmm4FPGAVersion=cmm4FPGAVersion, cmm4MacAddress=cmm4MacAddress, cmm4SnmpTrapIp8=cmm4SnmpTrapIp8, cmm4IpAccess3=cmm4IpAccess3, defaultStatus=defaultStatus, deviceType=deviceType, cmm4GPSInSync=cmm4GPSInSync, sessionTimeout=sessionTimeout, gpsLongitude=gpsLongitude, cmm4Snmp=cmm4Snmp, height=height, cmm4GPSGroup=cmm4GPSGroup, cmm4SnmpTrapIp10=cmm4SnmpTrapIp10, cmm4SnmpAccessSubnet5=cmm4SnmpAccessSubnet5, portStatusIndex=portStatusIndex, userPswd=userPswd, siteInfoViewable=siteInfoViewable, gpsLatitude=gpsLatitude, cmm4UserEntry=cmm4UserEntry, cmm4pldVersion=cmm4pldVersion, cmm4PortDevType=cmm4PortDevType, cmm4PortResetCfg=cmm4PortResetCfg, satellitesTracked=satellitesTracked, syncStatus=syncStatus, cmm4SnmpTrapIp2=cmm4SnmpTrapIp2, gpsSatellitesTracked=gpsSatellitesTracked, cmm4Gps=cmm4Gps, cmm4UserTableGroup=cmm4UserTableGroup, cmm4MibModule=cmm4MibModule, cmm4SnmpAccessSubnet8=cmm4SnmpAccessSubnet8, longitude=longitude, managementVID=managementVID, gpsDate=gpsDate, entryIndex=entryIndex, cmm4Status=cmm4Status, cmm4SnmpReadOnly=cmm4SnmpReadOnly, gpsReInitCount=gpsReInitCount, cmm4SoftwareVersion=cmm4SoftwareVersion, cmm4MgmtPortSpeed=cmm4MgmtPortSpeed, cmm4PortStatusEntry=cmm4PortStatusEntry, gpsAntennaConnection=gpsAntennaConnection, cmm4SnmpTrapIp7=cmm4SnmpTrapIp7, gpsSyncStatus=gpsSyncStatus, cmm4SnmpTrapIp9=cmm4SnmpTrapIp9, cmm4SnmpAccessSubnet4=cmm4SnmpAccessSubnet4, cmm4SnmpGPSSyncTrapEnable=cmm4SnmpGPSSyncTrapEnable, satellitesVisible=satellitesVisible, portCfgIndex=portCfgIndex, cmm4SnmpTrapIp6=cmm4SnmpTrapIp6, defaultGateway=defaultGateway, cmm4Groups=cmm4Groups, cmm4SnmpTrapIp1=cmm4SnmpTrapIp1, eventLog=eventLog, latitude=latitude, vlanEnable=vlanEnable, cmm4UserTable=cmm4UserTable, gpsReceiverInfo=gpsReceiverInfo, cmm4SNMPGroup=cmm4SNMPGroup, cmm4ExtEthPwrStat=cmm4ExtEthPwrStat, cmm4EventLog=cmm4EventLog, cmm4FPGAPlatform=cmm4FPGAPlatform, gpsLog=gpsLog, cmm4GPSEvent=cmm4GPSEvent, cmm4SnmpTrapIp5=cmm4SnmpTrapIp5, cmm4Event=cmm4Event, accessLevel=accessLevel, userLoginName=userLoginName, cmm4SnmpAccessSubnet9=cmm4SnmpAccessSubnet9, cmm4Config=cmm4Config, cmm4SnmpAccessSubnet2=cmm4SnmpAccessSubnet2, cmm4UpTime=cmm4UpTime, cmm4PortStatusTable=cmm4PortStatusTable, ntpLog=ntpLog, cmm4WebAutoUpdate=cmm4WebAutoUpdate, gpsSyncMasterSlave=gpsSyncMasterSlave, cmm4PortPowerStatus=cmm4PortPowerStatus, gpsTime=gpsTime, cmm4SnmpTrapIp3=cmm4SnmpTrapIp3, gpsTrackingMode=gpsTrackingMode, lan1SubnetMask=lan1SubnetMask, cmm4SnmpAccessSubnet6=cmm4SnmpAccessSubnet6, cmm4Reboot=cmm4Reboot, cmm4ControlsGroup=cmm4ControlsGroup)
# ---------------------------------------------------------------------------- # Copyright (c) 2022, Franck Lejzerowicz. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- __version__ = "2.0"
__version__ = '2.0'
''' Creating a class Created with the keyword class followed by a name, Common practice is to make the names Pascal Casing: Example '''
""" Creating a class Created with the keyword class followed by a name, Common practice is to make the names Pascal Casing: Example """
__all__ = [ "accuracy", "confusion_matrix", "multi_class_acc", "top_k_svm", "microf1", "macrof1", ]
__all__ = ['accuracy', 'confusion_matrix', 'multi_class_acc', 'top_k_svm', 'microf1', 'macrof1']
def add_native_methods(clazz): def init__java_lang_String__boolean__(a0, a1): raise NotImplementedError() def indicateMechs____(): raise NotImplementedError() def inquireNamesForMech____(a0): raise NotImplementedError() def releaseName__long__(a0, a1): raise NotImplementedError() def importName__byte____org_ietf_jgss_Oid__(a0, a1, a2): raise NotImplementedError() def compareName__long__long__(a0, a1, a2): raise NotImplementedError() def canonicalizeName__long__(a0, a1): raise NotImplementedError() def exportName__long__(a0, a1): raise NotImplementedError() def displayName__long__(a0, a1): raise NotImplementedError() def acquireCred__long__int__int__(a0, a1, a2, a3): raise NotImplementedError() def releaseCred__long__(a0, a1): raise NotImplementedError() def getCredName__long__(a0, a1): raise NotImplementedError() def getCredTime__long__(a0, a1): raise NotImplementedError() def getCredUsage__long__(a0, a1): raise NotImplementedError() def importContext__byte____(a0, a1): raise NotImplementedError() def initContext__long__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__(a0, a1, a2, a3, a4, a5): raise NotImplementedError() def acceptContext__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__(a0, a1, a2, a3, a4): raise NotImplementedError() def inquireContext__long__(a0, a1): raise NotImplementedError() def getContextMech__long__(a0, a1): raise NotImplementedError() def getContextName__long__boolean__(a0, a1, a2): raise NotImplementedError() def getContextTime__long__(a0, a1): raise NotImplementedError() def deleteContext__long__(a0, a1): raise NotImplementedError() def wrapSizeLimit__long__int__int__int__(a0, a1, a2, a3, a4): raise NotImplementedError() def exportContext__long__(a0, a1): raise NotImplementedError() def getMic__long__int__byte____(a0, a1, a2, a3): raise NotImplementedError() def verifyMic__long__byte____byte____org_ietf_jgss_MessageProp__(a0, a1, a2, a3, a4): raise NotImplementedError() def wrap__long__byte____org_ietf_jgss_MessageProp__(a0, a1, a2, a3): raise NotImplementedError() def unwrap__long__byte____org_ietf_jgss_MessageProp__(a0, a1, a2, a3): raise NotImplementedError() clazz.init__java_lang_String__boolean__ = staticmethod(init__java_lang_String__boolean__) clazz.indicateMechs____ = staticmethod(indicateMechs____) clazz.inquireNamesForMech____ = inquireNamesForMech____ clazz.releaseName__long__ = releaseName__long__ clazz.importName__byte____org_ietf_jgss_Oid__ = importName__byte____org_ietf_jgss_Oid__ clazz.compareName__long__long__ = compareName__long__long__ clazz.canonicalizeName__long__ = canonicalizeName__long__ clazz.exportName__long__ = exportName__long__ clazz.displayName__long__ = displayName__long__ clazz.acquireCred__long__int__int__ = acquireCred__long__int__int__ clazz.releaseCred__long__ = releaseCred__long__ clazz.getCredName__long__ = getCredName__long__ clazz.getCredTime__long__ = getCredTime__long__ clazz.getCredUsage__long__ = getCredUsage__long__ clazz.importContext__byte____ = importContext__byte____ clazz.initContext__long__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ = initContext__long__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ clazz.acceptContext__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ = acceptContext__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ clazz.inquireContext__long__ = inquireContext__long__ clazz.getContextMech__long__ = getContextMech__long__ clazz.getContextName__long__boolean__ = getContextName__long__boolean__ clazz.getContextTime__long__ = getContextTime__long__ clazz.deleteContext__long__ = deleteContext__long__ clazz.wrapSizeLimit__long__int__int__int__ = wrapSizeLimit__long__int__int__int__ clazz.exportContext__long__ = exportContext__long__ clazz.getMic__long__int__byte____ = getMic__long__int__byte____ clazz.verifyMic__long__byte____byte____org_ietf_jgss_MessageProp__ = verifyMic__long__byte____byte____org_ietf_jgss_MessageProp__ clazz.wrap__long__byte____org_ietf_jgss_MessageProp__ = wrap__long__byte____org_ietf_jgss_MessageProp__ clazz.unwrap__long__byte____org_ietf_jgss_MessageProp__ = unwrap__long__byte____org_ietf_jgss_MessageProp__
def add_native_methods(clazz): def init__java_lang__string__boolean__(a0, a1): raise not_implemented_error() def indicate_mechs____(): raise not_implemented_error() def inquire_names_for_mech____(a0): raise not_implemented_error() def release_name__long__(a0, a1): raise not_implemented_error() def import_name__byte____org_ietf_jgss__oid__(a0, a1, a2): raise not_implemented_error() def compare_name__long__long__(a0, a1, a2): raise not_implemented_error() def canonicalize_name__long__(a0, a1): raise not_implemented_error() def export_name__long__(a0, a1): raise not_implemented_error() def display_name__long__(a0, a1): raise not_implemented_error() def acquire_cred__long__int__int__(a0, a1, a2, a3): raise not_implemented_error() def release_cred__long__(a0, a1): raise not_implemented_error() def get_cred_name__long__(a0, a1): raise not_implemented_error() def get_cred_time__long__(a0, a1): raise not_implemented_error() def get_cred_usage__long__(a0, a1): raise not_implemented_error() def import_context__byte____(a0, a1): raise not_implemented_error() def init_context__long__long__org_ietf_jgss__channel_binding__byte____sun_security_jgss_wrapper__native_gss_context__(a0, a1, a2, a3, a4, a5): raise not_implemented_error() def accept_context__long__org_ietf_jgss__channel_binding__byte____sun_security_jgss_wrapper__native_gss_context__(a0, a1, a2, a3, a4): raise not_implemented_error() def inquire_context__long__(a0, a1): raise not_implemented_error() def get_context_mech__long__(a0, a1): raise not_implemented_error() def get_context_name__long__boolean__(a0, a1, a2): raise not_implemented_error() def get_context_time__long__(a0, a1): raise not_implemented_error() def delete_context__long__(a0, a1): raise not_implemented_error() def wrap_size_limit__long__int__int__int__(a0, a1, a2, a3, a4): raise not_implemented_error() def export_context__long__(a0, a1): raise not_implemented_error() def get_mic__long__int__byte____(a0, a1, a2, a3): raise not_implemented_error() def verify_mic__long__byte____byte____org_ietf_jgss__message_prop__(a0, a1, a2, a3, a4): raise not_implemented_error() def wrap__long__byte____org_ietf_jgss__message_prop__(a0, a1, a2, a3): raise not_implemented_error() def unwrap__long__byte____org_ietf_jgss__message_prop__(a0, a1, a2, a3): raise not_implemented_error() clazz.init__java_lang_String__boolean__ = staticmethod(init__java_lang_String__boolean__) clazz.indicateMechs____ = staticmethod(indicateMechs____) clazz.inquireNamesForMech____ = inquireNamesForMech____ clazz.releaseName__long__ = releaseName__long__ clazz.importName__byte____org_ietf_jgss_Oid__ = importName__byte____org_ietf_jgss_Oid__ clazz.compareName__long__long__ = compareName__long__long__ clazz.canonicalizeName__long__ = canonicalizeName__long__ clazz.exportName__long__ = exportName__long__ clazz.displayName__long__ = displayName__long__ clazz.acquireCred__long__int__int__ = acquireCred__long__int__int__ clazz.releaseCred__long__ = releaseCred__long__ clazz.getCredName__long__ = getCredName__long__ clazz.getCredTime__long__ = getCredTime__long__ clazz.getCredUsage__long__ = getCredUsage__long__ clazz.importContext__byte____ = importContext__byte____ clazz.initContext__long__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ = initContext__long__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ clazz.acceptContext__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ = acceptContext__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ clazz.inquireContext__long__ = inquireContext__long__ clazz.getContextMech__long__ = getContextMech__long__ clazz.getContextName__long__boolean__ = getContextName__long__boolean__ clazz.getContextTime__long__ = getContextTime__long__ clazz.deleteContext__long__ = deleteContext__long__ clazz.wrapSizeLimit__long__int__int__int__ = wrapSizeLimit__long__int__int__int__ clazz.exportContext__long__ = exportContext__long__ clazz.getMic__long__int__byte____ = getMic__long__int__byte____ clazz.verifyMic__long__byte____byte____org_ietf_jgss_MessageProp__ = verifyMic__long__byte____byte____org_ietf_jgss_MessageProp__ clazz.wrap__long__byte____org_ietf_jgss_MessageProp__ = wrap__long__byte____org_ietf_jgss_MessageProp__ clazz.unwrap__long__byte____org_ietf_jgss_MessageProp__ = unwrap__long__byte____org_ietf_jgss_MessageProp__
class PyVeeException(Exception): pass class InvalidAddressException(PyVeeException): pass class InvalidParameterException(PyVeeException): pass class MissingPrivateKeyException(PyVeeException): pass class MissingPublicKeyException(PyVeeException): pass class MissingAddressException(PyVeeException): pass class InsufficientBalanceException(PyVeeException): pass class NetworkException(PyVeeException): pass
class Pyveeexception(Exception): pass class Invalidaddressexception(PyVeeException): pass class Invalidparameterexception(PyVeeException): pass class Missingprivatekeyexception(PyVeeException): pass class Missingpublickeyexception(PyVeeException): pass class Missingaddressexception(PyVeeException): pass class Insufficientbalanceexception(PyVeeException): pass class Networkexception(PyVeeException): pass
# test builtin type print(type(int)) try: type() except TypeError: print('TypeError') try: type(1, 2) except TypeError: print('TypeError') # second arg should be a tuple try: type('abc', None, None) except TypeError: print('TypeError') # third arg should be a dict try: type('abc', (), None) except TypeError: print('TypeError') # elements of second arg (the bases) should be types try: type('abc', (1,), {}) except TypeError: print('TypeError')
print(type(int)) try: type() except TypeError: print('TypeError') try: type(1, 2) except TypeError: print('TypeError') try: type('abc', None, None) except TypeError: print('TypeError') try: type('abc', (), None) except TypeError: print('TypeError') try: type('abc', (1,), {}) except TypeError: print('TypeError')
indexes = [(row, col) for row in range(5) for col in range(5)] class Board: def __init__(self, board: list[list[tuple[int, bool]]]) -> None: self.board = board self.done = False def set(self, n: int): if self.done: return True for row, col in indexes: value, _ = self.board[row][col] if value == n: self.board[row][col] = (value, True) self.done = self.check() return self.done def check(self): if any([all([s for _, s in row]) for row in self.board]): return True return any( [all([self.board[row][col][1] for row in range(5)]) for col in range(5)] ) def score(self, num: int): return num * sum([sum([n for n, m in row if not m]) for row in self.board]) @classmethod def from_str_list(cls, lst): return cls([[(int(n), False) for n in line.split() if n != ""] for line in lst]) def parse_input(input: list[str]) -> tuple[list[int], list[Board]]: draws = input[0] acc = [] boards = [] for line in input[2:]: if line == "": boards.append(acc.copy()) acc = [] else: acc.append(line) boards.append(acc.copy()) draw = [int(n) for n in draws.split(",")] games = [Board.from_str_list(b) for b in boards] return draw, games def part1(draws: list[int], games: list[Board]): for n in draws: for g in games: if g.set(n): return g.score(n) def part2(draws: list[int], games: list[Board]): wins = [] for n in draws: for g in filter(lambda g: not g.done, games): if g.set(n): wins.append((n, g)) if all([g.done for g in games]): break n, g = wins.pop() return g.score(n) if __name__ == "__main__": with open("input.txt") as f: input = [l.strip() for l in f.readlines()] draws, boards = parse_input(input) print(f"part 1: {part1(draws, boards)}") draws, boards = parse_input(input) print(f"part 2: {part2(draws, boards)}")
indexes = [(row, col) for row in range(5) for col in range(5)] class Board: def __init__(self, board: list[list[tuple[int, bool]]]) -> None: self.board = board self.done = False def set(self, n: int): if self.done: return True for (row, col) in indexes: (value, _) = self.board[row][col] if value == n: self.board[row][col] = (value, True) self.done = self.check() return self.done def check(self): if any([all([s for (_, s) in row]) for row in self.board]): return True return any([all([self.board[row][col][1] for row in range(5)]) for col in range(5)]) def score(self, num: int): return num * sum([sum([n for (n, m) in row if not m]) for row in self.board]) @classmethod def from_str_list(cls, lst): return cls([[(int(n), False) for n in line.split() if n != ''] for line in lst]) def parse_input(input: list[str]) -> tuple[list[int], list[Board]]: draws = input[0] acc = [] boards = [] for line in input[2:]: if line == '': boards.append(acc.copy()) acc = [] else: acc.append(line) boards.append(acc.copy()) draw = [int(n) for n in draws.split(',')] games = [Board.from_str_list(b) for b in boards] return (draw, games) def part1(draws: list[int], games: list[Board]): for n in draws: for g in games: if g.set(n): return g.score(n) def part2(draws: list[int], games: list[Board]): wins = [] for n in draws: for g in filter(lambda g: not g.done, games): if g.set(n): wins.append((n, g)) if all([g.done for g in games]): break (n, g) = wins.pop() return g.score(n) if __name__ == '__main__': with open('input.txt') as f: input = [l.strip() for l in f.readlines()] (draws, boards) = parse_input(input) print(f'part 1: {part1(draws, boards)}') (draws, boards) = parse_input(input) print(f'part 2: {part2(draws, boards)}')
#annapolis latitude = 38.9784 # longitude = -76.4922 longitude = 283.5078 height = 13
latitude = 38.9784 longitude = 283.5078 height = 13
# C++ implementation to convert the # given BST to Min Heap # structure of a node of BST class Node: # Constructor to create a new node def __init__(self, data): self.data = data self.left = None self.right = None # function for the inorder traversal # of the tree so as to store the node # values in 'arr' in sorted order def inorderTraversal(root, arr): if root == None: return # first recur on left subtree inorderTraversal(root.left, arr) # then copy the data of the node arr.append(root.data) # now recur for right subtree inorderTraversal(root.right, arr) # function to convert the given # BST to MIN HEAP performs preorder # traversal of the tree def BSTToMinHeap(root, arr, i): if root == None: return # first copy data at index 'i' of # 'arr' to the node i[0] += 1 root.data = arr[i[0]] # then recur on left subtree BSTToMinHeap(root.left, arr, i) # now recur on right subtree BSTToMinHeap(root.right, arr, i) # utility function to convert the # given BST to MIN HEAP def convertToMinHeapUtil(root): # vector to store the data of # all the nodes of the BST arr = [] i = [-1] # inorder traversal to populate 'arr' inorderTraversal(root, arr); # BST to MIN HEAP conversion BSTToMinHeap(root, arr, i) # function for the preorder traversal # of the tree def preorderTraversal(root): if root == None: return # first print the root's data print(root.data, end = " ") # then recur on left subtree preorderTraversal(root.left) # now recur on right subtree preorderTraversal(root.right) # Driver Code if __name__ == '__main__': # BST formation root = Node(4) root.left = Node(2) root.right = Node(6) root.left.left = Node(1) root.left.right = Node(3) root.right.left = Node(5) root.right.right = Node(7) convertToMinHeapUtil(root) print("Preorder Traversal:") preorderTraversal(root) # This code is contributed # by PranchalK
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def inorder_traversal(root, arr): if root == None: return inorder_traversal(root.left, arr) arr.append(root.data) inorder_traversal(root.right, arr) def bst_to_min_heap(root, arr, i): if root == None: return i[0] += 1 root.data = arr[i[0]] bst_to_min_heap(root.left, arr, i) bst_to_min_heap(root.right, arr, i) def convert_to_min_heap_util(root): arr = [] i = [-1] inorder_traversal(root, arr) bst_to_min_heap(root, arr, i) def preorder_traversal(root): if root == None: return print(root.data, end=' ') preorder_traversal(root.left) preorder_traversal(root.right) if __name__ == '__main__': root = node(4) root.left = node(2) root.right = node(6) root.left.left = node(1) root.left.right = node(3) root.right.left = node(5) root.right.right = node(7) convert_to_min_heap_util(root) print('Preorder Traversal:') preorder_traversal(root)
#!/usr/bin/env python # coding: utf-8 # In[34]: def test(): print test() class Testing: def test(): print("hello") Testing.test() a = bool(input("enter the value: ")) if (a==False): print("Please enter some input") print(a) # scope of variables # In[ ]:
def test(): print test() class Testing: def test(): print('hello') Testing.test() a = bool(input('enter the value: ')) if a == False: print('Please enter some input') print(a)
frase = input("Dime una frase: ") letra = input("Dime una letra que quieres que te busque: ") index = 0 contador = 0 while(index < len(frase)): if(frase[index].lower() == letra.lower()): contador += 1 index += 1 print(f"La letra {letra} aparece {contador} veces")
frase = input('Dime una frase: ') letra = input('Dime una letra que quieres que te busque: ') index = 0 contador = 0 while index < len(frase): if frase[index].lower() == letra.lower(): contador += 1 index += 1 print(f'La letra {letra} aparece {contador} veces')
line = input() a, b = line.split() a = int(a) b = int(b) maxi = max(a, b) if a <= 0 and b <= 0: print('Not a moose') elif a == b: print(f'Even {a + b}') elif a != b: print(f'Odd {maxi + maxi}')
line = input() (a, b) = line.split() a = int(a) b = int(b) maxi = max(a, b) if a <= 0 and b <= 0: print('Not a moose') elif a == b: print(f'Even {a + b}') elif a != b: print(f'Odd {maxi + maxi}')
localDockerIPP = { "sites": [ {"site": "Local_IPP", "auth": {"channel": None}, "execution": { "executor": "ipp", "container": { "type": "docker", "image": "parslbase_v0.1", }, "provider": "local", "block": { "initBlocks": 2, # Start with 4 workers }, } }], "globals": {"lazyErrors": True} } localSimpleIPP = { "sites": [ {"site": "Local_IPP", "auth": {"channel": None}, "execution": { "executor": "ipp", "provider": "local", "block": { "initBlocks": 4, # Start with 4 workers }, } }], "globals": {"lazyErrors": True} } localDockerMulti = { "sites": [ {"site": "pool_app1", "auth": {"channel": None}, "execution": { "executor": "ipp", "container": { "type": "docker", "image": "app1_v0.1", }, "provider": "local", "block": { "initBlocks": 1, # Start with 4 workers }, } }, {"site": "pool_app2", "auth": {"channel": None}, "execution": { "executor": "ipp", "container": { "type": "docker", "image": "app2_v0.1", }, "provider": "local", "block": { "initBlocks": 1, # Start with 4 workers }, } } ], "globals": {"lazyErrors": True} }
local_docker_ipp = {'sites': [{'site': 'Local_IPP', 'auth': {'channel': None}, 'execution': {'executor': 'ipp', 'container': {'type': 'docker', 'image': 'parslbase_v0.1'}, 'provider': 'local', 'block': {'initBlocks': 2}}}], 'globals': {'lazyErrors': True}} local_simple_ipp = {'sites': [{'site': 'Local_IPP', 'auth': {'channel': None}, 'execution': {'executor': 'ipp', 'provider': 'local', 'block': {'initBlocks': 4}}}], 'globals': {'lazyErrors': True}} local_docker_multi = {'sites': [{'site': 'pool_app1', 'auth': {'channel': None}, 'execution': {'executor': 'ipp', 'container': {'type': 'docker', 'image': 'app1_v0.1'}, 'provider': 'local', 'block': {'initBlocks': 1}}}, {'site': 'pool_app2', 'auth': {'channel': None}, 'execution': {'executor': 'ipp', 'container': {'type': 'docker', 'image': 'app2_v0.1'}, 'provider': 'local', 'block': {'initBlocks': 1}}}], 'globals': {'lazyErrors': True}}
class Solution: def findDisappearedNumbers(self, nums: List[int]) -> List[int]: res = [] num_set = set(nums) for i in range(1,len(nums)+1): if i not in num_set: res.append(i) return res
class Solution: def find_disappeared_numbers(self, nums: List[int]) -> List[int]: res = [] num_set = set(nums) for i in range(1, len(nums) + 1): if i not in num_set: res.append(i) return res
#create a program that asks the user submit text repeatedly #The program will exit when user submit CLOSE #print the output as text file with open('./96_file/96_file.txt', 'w') as file: while True: user_input = input('Enter anything (to quite- type CLOSE) : '); if user_input == 'CLOSE': break; else: file.write(user_input + '\n');
with open('./96_file/96_file.txt', 'w') as file: while True: user_input = input('Enter anything (to quite- type CLOSE) : ') if user_input == 'CLOSE': break else: file.write(user_input + '\n')
class AllowSenderError(Exception): pass class AllowAuthError(Exception): pass class NotEnoughPoint(Exception): pass class AligoError(Exception): pass
class Allowsendererror(Exception): pass class Allowautherror(Exception): pass class Notenoughpoint(Exception): pass class Aligoerror(Exception): pass