content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# 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) |
"""
The overridden attribute manager is a singleton that observes the scene to
react to attribute changes. If the attribute change is on an attribute
that is overridden by render setup, the attribute manager will attempt to
take the value change and reproduce it on the override itself.
This allows for convenient workflows like using direct manipulation on an
object with a value override, where the value is actually written back to
the override.
Apply value override nodes conditionally implement the passive output plug
behavior, through a chain of responsibility. A passive output allows
setting its destination input. If this destination input is connected to
an apply override node, the overridden attribute manager asks the
highest-priority apply override node to write the value to its
corresponding override, if it's enabled, else pass the request to the next
lower-priority apply override node. The chain ends by writing into the
original. If the highest-priority apply override node returns true from
isPassiveOutput(), this means that the overridden attribute write must
succeed, as one of the apply override nodes in the chain will accept the
write.
Autokey functionality is supported in this framework: in autokey mode, we
query the auto keyer to ask if an overridden attribute would be auto-keyed.
If so, we add the override attribute to the list of attributes the auto
keyer will add keys to. See the autoKey render setup module and the
autoKeyframe command for more information.
Note that it is understood that changing the override value will cause all
overridden attributes to change.
"""
class OverriddenAttributeManager(object):
"""
Observe and react to overridden attribute changes.
The overridden attribute manager attempts to convert changes to
overridden attributes to changes to overrides. See the module
documentation for more details.
The overridden attribute manager is only active when a render layer
other than the default (or master) layer is visible.
"""
def __init__(self):
pass
def aboutToDelete(self):
"""
Final clean up before the manager is destroyed.
"""
pass
def addAttributeChangeObservation(self):
"""
Start observing DG attribute changes.
"""
pass
def onAttributeChanged(self, msg, plg, otherPlug, clientData):
pass
def onRenderLayerChanged(self):
"""
Called after the visible render layer has been changed.
"""
pass
def removeAttributeChangeObservation(self):
"""
End observation of DG attribute changes.
"""
pass
def renderSetupAdded(self):
"""
Called just after the render setup node has been added.
"""
pass
def renderSetupPreDelete(self):
"""
Called just before the render setup node is deleted.
Unregisters from visible render layer and attribute change
observation.
"""
pass
__dict__ = None
__weakref__ = None
def isDefaultRenderLayerVisible():
pass
def initialize():
pass
def finalize():
pass
def instance():
pass
_instance = OverriddenAttributeManager()
| """
The overridden attribute manager is a singleton that observes the scene to
react to attribute changes. If the attribute change is on an attribute
that is overridden by render setup, the attribute manager will attempt to
take the value change and reproduce it on the override itself.
This allows for convenient workflows like using direct manipulation on an
object with a value override, where the value is actually written back to
the override.
Apply value override nodes conditionally implement the passive output plug
behavior, through a chain of responsibility. A passive output allows
setting its destination input. If this destination input is connected to
an apply override node, the overridden attribute manager asks the
highest-priority apply override node to write the value to its
corresponding override, if it's enabled, else pass the request to the next
lower-priority apply override node. The chain ends by writing into the
original. If the highest-priority apply override node returns true from
isPassiveOutput(), this means that the overridden attribute write must
succeed, as one of the apply override nodes in the chain will accept the
write.
Autokey functionality is supported in this framework: in autokey mode, we
query the auto keyer to ask if an overridden attribute would be auto-keyed.
If so, we add the override attribute to the list of attributes the auto
keyer will add keys to. See the autoKey render setup module and the
autoKeyframe command for more information.
Note that it is understood that changing the override value will cause all
overridden attributes to change.
"""
class Overriddenattributemanager(object):
"""
Observe and react to overridden attribute changes.
The overridden attribute manager attempts to convert changes to
overridden attributes to changes to overrides. See the module
documentation for more details.
The overridden attribute manager is only active when a render layer
other than the default (or master) layer is visible.
"""
def __init__(self):
pass
def about_to_delete(self):
"""
Final clean up before the manager is destroyed.
"""
pass
def add_attribute_change_observation(self):
"""
Start observing DG attribute changes.
"""
pass
def on_attribute_changed(self, msg, plg, otherPlug, clientData):
pass
def on_render_layer_changed(self):
"""
Called after the visible render layer has been changed.
"""
pass
def remove_attribute_change_observation(self):
"""
End observation of DG attribute changes.
"""
pass
def render_setup_added(self):
"""
Called just after the render setup node has been added.
"""
pass
def render_setup_pre_delete(self):
"""
Called just before the render setup node is deleted.
Unregisters from visible render layer and attribute change
observation.
"""
pass
__dict__ = None
__weakref__ = None
def is_default_render_layer_visible():
pass
def initialize():
pass
def finalize():
pass
def instance():
pass
_instance = overridden_attribute_manager() |
class notifyException(Exception):
"""Base class for other exceptions."""
code: int = None
payload: str = None
def __init__(self, message: str = None, *args, code: int = None, payload: str = None, **kwargs):
super(notifyException, self).__init__(*args, **kwargs)
self.args = (
message,
code,
)
self.message = message
if code:
self.code = code
if payload:
self.payload = payload
def __str__(self):
return f"{__name__} -> {self.message}"
def get(self):
return self.message
class DataError(notifyException, ValueError):
"""An error caused by invalid query input."""
class NotSupported(notifyException):
"""Not Supported functionality."""
class ProviderError(notifyException):
"""Database Provider Error."""
class NotImplementedError(notifyException):
"""Exception for Not implementation."""
class UninitializedError(ProviderError):
"""Exception when provider cant be initialized."""
class ConnectionError(ProviderError):
"""Generic Connection Error."""
class ConnectionTimeout(ProviderError):
"""Connection Timeout Error."""
class TooManyConnections(ProviderError):
"""Too Many Connections."""
| class Notifyexception(Exception):
"""Base class for other exceptions."""
code: int = None
payload: str = None
def __init__(self, message: str=None, *args, code: int=None, payload: str=None, **kwargs):
super(notifyException, self).__init__(*args, **kwargs)
self.args = (message, code)
self.message = message
if code:
self.code = code
if payload:
self.payload = payload
def __str__(self):
return f'{__name__} -> {self.message}'
def get(self):
return self.message
class Dataerror(notifyException, ValueError):
"""An error caused by invalid query input."""
class Notsupported(notifyException):
"""Not Supported functionality."""
class Providererror(notifyException):
"""Database Provider Error."""
class Notimplementederror(notifyException):
"""Exception for Not implementation."""
class Uninitializederror(ProviderError):
"""Exception when provider cant be initialized."""
class Connectionerror(ProviderError):
"""Generic Connection Error."""
class Connectiontimeout(ProviderError):
"""Connection Timeout Error."""
class Toomanyconnections(ProviderError):
"""Too Many Connections.""" |
# 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) |
class ServiceUnavailable(Exception):
"""Raised when you try to send a request to a service that is
unavailable.
"""
class ServiceError(Exception):
"""Raised when a service failed to fulfill your request."""
class UnknownRejection(Exception):
"""Raised when a service rejects your request, and you haven't
registered an exception for this rejection type
"""
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
class InvalidEventName(Exception):
"""Raised when you try to register an event with an invalid name"""
| class Serviceunavailable(Exception):
"""Raised when you try to send a request to a service that is
unavailable.
"""
class Serviceerror(Exception):
"""Raised when a service failed to fulfill your request."""
class Unknownrejection(Exception):
"""Raised when a service rejects your request, and you haven't
registered an exception for this rejection type
"""
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
class Invalideventname(Exception):
"""Raised when you try to register an event with an invalid name""" |
# Atharv Kolhar
# Python Bytes
"""
Question:
1. Create a list 'solar_system' of Planets in the Solar System and
print the 4th planet.
Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto
2. Print the length of the 'solar_system'.
3. Remove the last planet Pluto from the list.
4. Reverse the list solar_system
""" | """
Question:
1. Create a list 'solar_system' of Planets in the Solar System and
print the 4th planet.
Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto
2. Print the length of the 'solar_system'.
3. Remove the last planet Pluto from the list.
4. Reverse the list solar_system
""" |
#!/usr/bin/env python
# encoding: utf-8
"""
Created by 'bens3' on 2013-06-21.
Copyright (c) 2013 'bens3'. All rights reserved.
""" | """
Created by 'bens3' on 2013-06-21.
Copyright (c) 2013 'bens3'. All rights reserved.
""" |
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 |
"""
File: weather_master.py
Name: DiCheng
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
# enter EXIT_CODE to exit while loop
EXIT_CODE = -100
def main():
"""
pre-cond: User can enter series of temperatures, using hint number to quit enter.
post-cond: stanCode "Weather Master 4.0" will give you highest, lowest, average temperatures
and the count of cold days among given numbers.
"""
print("stanCode \"Weather Master 4.0\"!")
# define variables
data = int(input("Next Temperature: (or " + str(EXIT_CODE) + " to quit)? "))
data_highest = data
data_lowest = data
data_sum = 0
data_count = 0
cold_days_count = 0
while data != EXIT_CODE:
# calculate count of data and summary of data.
data_count += 1
data_sum += data
# compare data with current data_highest and data_lowest, then reassign variables if True.
if data > data_highest:
data_highest = data
if data < data_lowest:
data_lowest = data
# count the number of data which is under 16.
if data < 16:
cold_days_count += 1
data = int(input("Next Temperature: (or " + str(EXIT_CODE) + " to quit)? "))
# EXIT entering input, print the outcomes.
if data_count != 0:
print("Highest temperature = " + str(data_highest))
print("Lowest temperature = " + str(data_lowest))
print("Average = " + str(data_sum/data_count))
print(str(cold_days_count) + " cold day(s)")
else:
print("No temperatures were entered.")
###### DO NOT EDIT CODE BELOW THIS LINE ######
if __name__ == "__main__":
main()
| """
File: weather_master.py
Name: DiCheng
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
exit_code = -100
def main():
"""
pre-cond: User can enter series of temperatures, using hint number to quit enter.
post-cond: stanCode "Weather Master 4.0" will give you highest, lowest, average temperatures
and the count of cold days among given numbers.
"""
print('stanCode "Weather Master 4.0"!')
data = int(input('Next Temperature: (or ' + str(EXIT_CODE) + ' to quit)? '))
data_highest = data
data_lowest = data
data_sum = 0
data_count = 0
cold_days_count = 0
while data != EXIT_CODE:
data_count += 1
data_sum += data
if data > data_highest:
data_highest = data
if data < data_lowest:
data_lowest = data
if data < 16:
cold_days_count += 1
data = int(input('Next Temperature: (or ' + str(EXIT_CODE) + ' to quit)? '))
if data_count != 0:
print('Highest temperature = ' + str(data_highest))
print('Lowest temperature = ' + str(data_lowest))
print('Average = ' + str(data_sum / data_count))
print(str(cold_days_count) + ' cold day(s)')
else:
print('No temperatures were entered.')
if __name__ == '__main__':
main() |
# 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 |
test = {
'name': 'Question 4',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> is_swap(19, 91)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(19, 19)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(123, 12)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(1, 2)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(12, 2)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(2, 2)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(36, 35)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(114, 12)
True
>>> is_swap(108, 7)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(18, 108)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(8, 108)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(20, 0)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(10, 16)
True
""",
'hidden': False,
'locked': False
}
],
'scored': True,
'setup': r"""
>>> from hog import *
""",
'teardown': '',
'type': 'doctest'
}
]
}
| test = {'name': 'Question 4', 'points': 1, 'suites': [{'cases': [{'code': '\n >>> is_swap(19, 91)\n False\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(19, 19)\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(123, 12)\n False\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(1, 2)\n False\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(12, 2)\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(2, 2)\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(36, 35)\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(114, 12)\n True\n >>> is_swap(108, 7)\n False\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(18, 108)\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(8, 108)\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(20, 0)\n False\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(10, 16)\n True\n ', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '\n >>> from hog import *\n ', 'teardown': '', 'type': 'doctest'}]} |
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 |
"""
Given a pattern and a string str, find if str follows the same pattern.
Here follow means a full match, such that there is a bijection between a
letter in pattern and a non-empty word in str.
Example:
Input: pattern = "abba", str = "dog cat cat dog"
Output: true
Example:
Input:pattern = "abba", str = "dog cat cat fish"
Output: false
Example:
Input: pattern = "aaaa", str = "dog cat cat dog"
Output: false
Example:
Input: pattern = "abba", str = "dog dog dog dog"
Output: false
Notes:
- You may assume pattern contains only lowercase letters, and str
contains lowercase letters that may be separated by a single space.
"""
#Difficulty: Easy
#37 / 37 test cases passed.
#Runtime: 28 ms
#Memory Usage: 13.7 MB
#Runtime: 28 ms, faster than 82.00% of Python3 online submissions for Word Pattern.
#Memory Usage: 13.7 MB, less than 84.35% of Python3 online submissions for Word Pattern.
class Solution:
def wordPattern(self, pattern: str, string: str) -> bool:
pairs = {}
pattern = list(pattern)
string = string.split(' ')
if len(pattern) != len(string):
return False
for i, p in enumerate(pattern):
if p not in pairs and string[i] not in pairs.values():
pairs[p] = string[i]
else:
if p not in pairs or pairs[p] != string[i]:
return False
return True
| """
Given a pattern and a string str, find if str follows the same pattern.
Here follow means a full match, such that there is a bijection between a
letter in pattern and a non-empty word in str.
Example:
Input: pattern = "abba", str = "dog cat cat dog"
Output: true
Example:
Input:pattern = "abba", str = "dog cat cat fish"
Output: false
Example:
Input: pattern = "aaaa", str = "dog cat cat dog"
Output: false
Example:
Input: pattern = "abba", str = "dog dog dog dog"
Output: false
Notes:
- You may assume pattern contains only lowercase letters, and str
contains lowercase letters that may be separated by a single space.
"""
class Solution:
def word_pattern(self, pattern: str, string: str) -> bool:
pairs = {}
pattern = list(pattern)
string = string.split(' ')
if len(pattern) != len(string):
return False
for (i, p) in enumerate(pattern):
if p not in pairs and string[i] not in pairs.values():
pairs[p] = string[i]
elif p not in pairs or pairs[p] != string[i]:
return False
return True |
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')) |
# Copyright 2017 The Forseti Security Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test data for Cloud Resource Manager GCP api responses."""
FAKE_PROJECT_NUMBER = "1111111"
FAKE_PROJECT_ID = "forseti-system-test"
FAKE_ORG_ID = "2222222"
FAKE_FOLDER_ID = "3333333"
GET_PROJECT_RESPONSE = """
{
"projectNumber": "1111111",
"projectId": "forseti-system-test",
"lifecycleState": "ACTIVE",
"name": "Forseti Security Tests",
"createTime": "2017-07-12T17:50:40.895Z",
"parent": {
"type": "organization",
"id": "2222222"
}
}
"""
GET_PROJECT_ANCESTRY_RESPONSE = """
{
"ancestor": [
{
"resourceId": {
"type": "project",
"id": "forseti-system-test"
}
},
{
"resourceId": {
"type": "folder",
"id": "3333333"
}
},
{
"resourceId": {
"type": "organization",
"id": "2222222"
}
}
]
}
"""
EXPECTED_PROJECT_ANCESTRY_IDS = ["forseti-system-test", "3333333", "2222222"]
GET_IAM_POLICY = """
{
"version": 1,
"etag": "BwVVEmTu/ww=",
"bindings": [
{
"role": "roles/editor",
"members": [
"serviceAccount:1111111-compute@developer.gserviceaccount.com",
"serviceAccount:1111111@cloudservices.gserviceaccount.com"
]
},
{
"role": "roles/owner",
"members": [
"group:test@forsetisecurity.testing",
"user:testuser@forsetisecurity.testing"
]
}
]
}
"""
SEARCH_ORGANIZATIONS_PAGE1 = """
{
"organizations": [
{
"displayName": "foresti.testing",
"owner": {
"directoryCustomerId": "ABC123DEF"
},
"creationTime": "2015-09-09T19:34:18.591Z",
"lifecycleState": "ACTIVE",
"name": "organizations/2222222"
}
],
"nextPageToken": "123"
}
"""
SEARCH_ORGANIZATIONS_PAGE2 = """
{
"organizations": [
{
"displayName": "test.foresti.testing",
"owner": {
"directoryCustomerId": "FED987CBA"
},
"creationTime": "2016-01-09T09:30:28.001Z",
"lifecycleState": "ACTIVE",
"name": "organizations/4444444"
}
]
}
"""
SEARCH_ORGANIZATIONS = [SEARCH_ORGANIZATIONS_PAGE1,
SEARCH_ORGANIZATIONS_PAGE2]
EXPECTED_ORGANIZATIONS_FROM_SEARCH = ["organizations/2222222",
"organizations/4444444"]
GET_ORGANIZATION = """
{
"displayName": "forsetisecurity.testing",
"owner": {
"directoryCustomerId": "ABC123DEF"
},
"creationTime": "2015-09-09T19:34:18.591Z",
"lifecycleState": "ACTIVE",
"name": "organizations/2222222"
}
"""
GET_FOLDER = """
{
"name": "folders/3333333",
"parent": "organizations/2222222",
"displayName": "folder-forseti-test",
"lifecycleState": "ACTIVE",
"createTime": "2017-02-09T22:02:07.769Z"
}
"""
GET_ORG_POLICY_NO_POLICY = """
{
"constraint": "constraints/compute.disableSerialPortAccess",
"etag": "BwVUSr8Q7Ng="
}
"""
GET_EFFECTIVE_ORG_POLICY = """
{
"constraint": "constraints/compute.disableSerialPortAccess",
"booleanPolicy": {
"enforced": true
}
}
"""
GET_LIENS = """
{
"liens": [
{
"name": "liens/test-lien1",
"parent": "projects/forseti-system-test",
"restrictions": [
"resourcemanager.projects.delete"
],
"origin": "testing",
"createTime": "2018-09-05T14:45:46.534Z"
}
]
}
"""
EXPECTED_LIENS = [{
"name": "liens/test-lien1",
"parent": "projects/forseti-system-test",
"restrictions": [
"resourcemanager.projects.delete"
],
"origin": "testing",
"createTime": "2018-09-05T14:45:46.534Z"
}]
LIST_ORG_POLICIES = """
{
"policies": [
{
"constraint": "constraints/compute.disableSerialPortAccess",
"booleanPolicy": {
"enforced": true
}
}
]
}
"""
TEST_ORG_POLICY_CONSTRAINT = "constraints/compute.disableSerialPortAccess"
FAKE_FOLDERS_API_RESPONSE1 = {
'folders': [
{
'displayName': 'folder-1',
'name': 'folders/111',
'lifecycleState': 'ACTIVE',
'parent': 'organizations/9999'
},
{
'displayName': 'folder-2',
'name': 'folders/222',
'parent': 'folders/2222222',
'lifecycleState': 'DELETE_REQUESTED'
},
{
'displayName': 'folder-3',
'name': 'folders/333',
'parent': 'folders/3333333',
'lifecycleState': 'ACTIVE'
},
]
}
EXPECTED_FAKE_FOLDERS1 = FAKE_FOLDERS_API_RESPONSE1['folders']
FAKE_FOLDERS_LIST_API_RESPONSE1 = {
'folders': [
f for f in FAKE_FOLDERS_API_RESPONSE1['folders']
if f['parent'] == 'organizations/9999'
]
}
EXPECTED_FAKE_FOLDERS_LIST1 = FAKE_FOLDERS_LIST_API_RESPONSE1['folders']
FAKE_ACTIVE_FOLDERS_API_RESPONSE1 = {
'folders': [
f for f in FAKE_FOLDERS_API_RESPONSE1['folders']
if f['lifecycleState'] == 'ACTIVE'
]
}
EXPECTED_FAKE_ACTIVE_FOLDERS1 = FAKE_ACTIVE_FOLDERS_API_RESPONSE1['folders']
FAKE_ORGS_RESPONSE = {
'organizations': [
{
'name': 'organizations/1111111111',
'display_name': 'Organization1',
'lifecycleState': 'ACTIVE',
},
{
'name': 'organizations/2222222222',
'display_name': 'Organization2',
'lifecycleState': 'ACTIVE',
},
{
'name': 'organizations/3333333333',
'display_name': 'Organization3',
'lifecycleState': 'ACTIVE',
}
]
}
EXPECTED_FAKE_ORGS_FROM_API = FAKE_ORGS_RESPONSE['organizations']
FAKE_PROJECTS_API_RESPONSE1 = {
'projects': [
{
'name': 'project1',
'projectId': 'project1',
'projectNumber': '25621943694',
'lifecycleState': 'ACTIVE',
},
{
'name': 'project2',
'projectId': 'project2',
'projectNumber': '94226340476',
'lifecycleState': 'DELETE_REQUESTED',
},
{
'name': 'project3',
'projectId': 'project3',
'projectNumber': '133851422272',
'lifecycleState': 'ACTIVE',
}]
}
FAKE_ACTIVE_PROJECTS_API_RESPONSE = {
'projects': [
p for p in FAKE_PROJECTS_API_RESPONSE1['projects']
if p['lifecycleState'] == 'ACTIVE'
]
}
EXPECTED_FAKE_PROJECTS1 = [FAKE_PROJECTS_API_RESPONSE1]
EXPECTED_FAKE_ACTIVE_PROJECTS1 = [{
'projects': [
p for p in FAKE_PROJECTS_API_RESPONSE1['projects']
if p['lifecycleState'] == 'ACTIVE'
]
}]
# Errors
GET_PROJECT_NOT_FOUND = """
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
"""
| """Test data for Cloud Resource Manager GCP api responses."""
fake_project_number = '1111111'
fake_project_id = 'forseti-system-test'
fake_org_id = '2222222'
fake_folder_id = '3333333'
get_project_response = '\n{\n "projectNumber": "1111111",\n "projectId": "forseti-system-test",\n "lifecycleState": "ACTIVE",\n "name": "Forseti Security Tests",\n "createTime": "2017-07-12T17:50:40.895Z",\n "parent": {\n "type": "organization",\n "id": "2222222"\n }\n}\n'
get_project_ancestry_response = '\n{\n "ancestor": [\n {\n "resourceId": {\n "type": "project",\n "id": "forseti-system-test"\n }\n },\n {\n "resourceId": {\n "type": "folder",\n "id": "3333333"\n }\n },\n {\n "resourceId": {\n "type": "organization",\n "id": "2222222"\n }\n }\n ]\n}\n'
expected_project_ancestry_ids = ['forseti-system-test', '3333333', '2222222']
get_iam_policy = '\n{\n "version": 1,\n "etag": "BwVVEmTu/ww=",\n "bindings": [\n {\n "role": "roles/editor",\n "members": [\n "serviceAccount:1111111-compute@developer.gserviceaccount.com",\n "serviceAccount:1111111@cloudservices.gserviceaccount.com"\n ]\n },\n {\n "role": "roles/owner",\n "members": [\n "group:test@forsetisecurity.testing",\n "user:testuser@forsetisecurity.testing"\n ]\n }\n ]\n}\n'
search_organizations_page1 = '\n{\n "organizations": [\n {\n "displayName": "foresti.testing",\n "owner": {\n "directoryCustomerId": "ABC123DEF"\n },\n "creationTime": "2015-09-09T19:34:18.591Z",\n "lifecycleState": "ACTIVE",\n "name": "organizations/2222222"\n }\n ],\n "nextPageToken": "123"\n}\n'
search_organizations_page2 = '\n{\n "organizations": [\n {\n "displayName": "test.foresti.testing",\n "owner": {\n "directoryCustomerId": "FED987CBA"\n },\n "creationTime": "2016-01-09T09:30:28.001Z",\n "lifecycleState": "ACTIVE",\n "name": "organizations/4444444"\n }\n ]\n}\n'
search_organizations = [SEARCH_ORGANIZATIONS_PAGE1, SEARCH_ORGANIZATIONS_PAGE2]
expected_organizations_from_search = ['organizations/2222222', 'organizations/4444444']
get_organization = '\n{\n "displayName": "forsetisecurity.testing",\n "owner": {\n "directoryCustomerId": "ABC123DEF"\n },\n "creationTime": "2015-09-09T19:34:18.591Z",\n "lifecycleState": "ACTIVE",\n "name": "organizations/2222222"\n}\n'
get_folder = '\n{\n "name": "folders/3333333",\n "parent": "organizations/2222222",\n "displayName": "folder-forseti-test",\n "lifecycleState": "ACTIVE",\n "createTime": "2017-02-09T22:02:07.769Z"\n}\n'
get_org_policy_no_policy = '\n{\n "constraint": "constraints/compute.disableSerialPortAccess",\n "etag": "BwVUSr8Q7Ng="\n}\n'
get_effective_org_policy = '\n{\n "constraint": "constraints/compute.disableSerialPortAccess",\n "booleanPolicy": {\n "enforced": true\n }\n}\n'
get_liens = '\n{\n "liens": [\n {\n "name": "liens/test-lien1",\n "parent": "projects/forseti-system-test",\n "restrictions": [\n "resourcemanager.projects.delete"\n ],\n "origin": "testing",\n "createTime": "2018-09-05T14:45:46.534Z"\n }\n ]\n}\n'
expected_liens = [{'name': 'liens/test-lien1', 'parent': 'projects/forseti-system-test', 'restrictions': ['resourcemanager.projects.delete'], 'origin': 'testing', 'createTime': '2018-09-05T14:45:46.534Z'}]
list_org_policies = '\n{\n "policies": [\n {\n "constraint": "constraints/compute.disableSerialPortAccess",\n "booleanPolicy": {\n "enforced": true\n }\n }\n ]\n}\n'
test_org_policy_constraint = 'constraints/compute.disableSerialPortAccess'
fake_folders_api_response1 = {'folders': [{'displayName': 'folder-1', 'name': 'folders/111', 'lifecycleState': 'ACTIVE', 'parent': 'organizations/9999'}, {'displayName': 'folder-2', 'name': 'folders/222', 'parent': 'folders/2222222', 'lifecycleState': 'DELETE_REQUESTED'}, {'displayName': 'folder-3', 'name': 'folders/333', 'parent': 'folders/3333333', 'lifecycleState': 'ACTIVE'}]}
expected_fake_folders1 = FAKE_FOLDERS_API_RESPONSE1['folders']
fake_folders_list_api_response1 = {'folders': [f for f in FAKE_FOLDERS_API_RESPONSE1['folders'] if f['parent'] == 'organizations/9999']}
expected_fake_folders_list1 = FAKE_FOLDERS_LIST_API_RESPONSE1['folders']
fake_active_folders_api_response1 = {'folders': [f for f in FAKE_FOLDERS_API_RESPONSE1['folders'] if f['lifecycleState'] == 'ACTIVE']}
expected_fake_active_folders1 = FAKE_ACTIVE_FOLDERS_API_RESPONSE1['folders']
fake_orgs_response = {'organizations': [{'name': 'organizations/1111111111', 'display_name': 'Organization1', 'lifecycleState': 'ACTIVE'}, {'name': 'organizations/2222222222', 'display_name': 'Organization2', 'lifecycleState': 'ACTIVE'}, {'name': 'organizations/3333333333', 'display_name': 'Organization3', 'lifecycleState': 'ACTIVE'}]}
expected_fake_orgs_from_api = FAKE_ORGS_RESPONSE['organizations']
fake_projects_api_response1 = {'projects': [{'name': 'project1', 'projectId': 'project1', 'projectNumber': '25621943694', 'lifecycleState': 'ACTIVE'}, {'name': 'project2', 'projectId': 'project2', 'projectNumber': '94226340476', 'lifecycleState': 'DELETE_REQUESTED'}, {'name': 'project3', 'projectId': 'project3', 'projectNumber': '133851422272', 'lifecycleState': 'ACTIVE'}]}
fake_active_projects_api_response = {'projects': [p for p in FAKE_PROJECTS_API_RESPONSE1['projects'] if p['lifecycleState'] == 'ACTIVE']}
expected_fake_projects1 = [FAKE_PROJECTS_API_RESPONSE1]
expected_fake_active_projects1 = [{'projects': [p for p in FAKE_PROJECTS_API_RESPONSE1['projects'] if p['lifecycleState'] == 'ACTIVE']}]
get_project_not_found = '\n{\n "error": {\n "code": 403,\n "message": "The caller does not have permission",\n "status": "PERMISSION_DENIED"\n }\n}\n' |
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 = '' |
class Solution(object):
def computeArea(self, A, B, C, D, E, F, G, H):
"""
:type A: int
:type B: int
:type C: int
:type D: int
:type E: int
:type F: int
:type G: int
:type H: int
:rtype: int
"""
rec1 = (C - A) * (D - B)
rec2 = (G - E) * (H - F)
# If no intersection
if E >= C or A >= G or F >= D or B >= H:
return rec1 + rec2
# Sort the 4 X's and 4 Y's
sorted_x = sorted([A, E, C, G])
sorted_y = sorted([F, B, H, D])
return rec1 + rec2 - (sorted_x[2] - sorted_x[1]) * (sorted_y[2] - sorted_y[1]) | class Solution(object):
def compute_area(self, A, B, C, D, E, F, G, H):
"""
:type A: int
:type B: int
:type C: int
:type D: int
:type E: int
:type F: int
:type G: int
:type H: int
:rtype: int
"""
rec1 = (C - A) * (D - B)
rec2 = (G - E) * (H - F)
if E >= C or A >= G or F >= D or (B >= H):
return rec1 + rec2
sorted_x = sorted([A, E, C, G])
sorted_y = sorted([F, B, H, D])
return rec1 + rec2 - (sorted_x[2] - sorted_x[1]) * (sorted_y[2] - sorted_y[1]) |
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] |
class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
y = 0
xx = x
while x != 0:
t = x % 10
y = y * 10 + t
x = x // 10
return y == xx
| class Solution:
def is_palindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
y = 0
xx = x
while x != 0:
t = x % 10
y = y * 10 + t
x = x // 10
return y == xx |
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 |
test = {
'name': 'Problem 9',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (lambda (x y) (+ x y))
d579a305762000c8ae036c510fb2baf6
# locked
""",
'hidden': False,
'locked': True
},
{
'code': r"""
scm> (lambda (x) (+ x) (+ x x))
(lambda (x) (+ x) (+ x x))
scm> (lambda (x))
SchemeError
""",
'hidden': False,
'locked': False
}
],
'scored': True,
'setup': '',
'teardown': '',
'type': 'scheme'
}
]
}
| test = {'name': 'Problem 9', 'points': 1, 'suites': [{'cases': [{'code': '\n scm> (lambda (x y) (+ x y))\n d579a305762000c8ae036c510fb2baf6\n # locked\n ', 'hidden': False, 'locked': True}, {'code': '\n scm> (lambda (x) (+ x) (+ x x))\n (lambda (x) (+ x) (+ x x))\n scm> (lambda (x))\n SchemeError\n ', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'scheme'}]} |
"""
Codemonk link: https://www.hackerearth.com/problem/algorithm/little-monk-and-goblet-of-fire-3c1c6865/
Albus Dumbledore announced that the school will host the legendary event known as Wizard Tournament where four magical
schools are going to compete against each other in a very deadly competition by facing some dangerous challenges. Since
the team selection is very critical in this deadly competition. Albus Dumbledore asked Little Monk to help him in the
team selection process. There is a long queue of students from all the four magical schools. Each student of a school
have a different roll number. Whenever a new student will come, he will search for his schoolmate from the end of the
queue. As soon as he will find any of the schoolmate in the queue, he will stand behind him, otherwise he will stand at
the end of the queue. At any moment Little Monk will ask the student, who is standing in front of the queue, to come and
put his name in the Goblet of Fire and remove him from the queue. There are Q operations of one of the following types:
E x y: A new student of school x (1<=x<=4) whose roll number is y (1<=y<=50000) will stand in queue according to the
method mentioned above.
D: Little Monk will ask the student, who is standing in front of the queue, to come and put his name in the Goblet of
Fire and remove him from the queue.
Now Albus Dumbledore asked Little Monk to tell him the order in which student put their name. Little Monk is too lazy to
that so he asked you to write a program to print required order. Number of dequeue operations will never be greater than
enqueue operations at any point of time.
Input - Output:
First line contains an integer Q 1<=Q<=10000, denoting the number of operations.
Next Q lines will contains one of the 2 types of operations.
For each type of operation, print two space separated integers,
the front student's school and roll number.
Sample input:
E 1 1
E 2 1
E 1 2
D
D
Sample Output:
1 1
1 2
"""
"""
We can solve this problem in linear time by using simple arrays in an efficient way. Instead of creating a queue with
all the students, we are going to create a queue that contains 4 queues, one for each school. By doing that, we are able
to directly insert a student behind the student of the same school in constant time. The only thing that's missing now,
is the order of the schools. To solve tha problem we will create one more queue that is going to hold that order. We
have to notice that the order of the schools will be maintained as long as there is at least one student there. If there
are no more students, then the new student that is going to come will be placed at the end, creating a new order for
that school. Now, each, time a school queue is empty and we add a student in it, we insert the number of the school in
that array. For example, if we have:
E 1 5
E 2 3
E 1 1
E 3 2
then, school_queue = [[5, 1], [3], [2], [0]] and order_queue = [1, 2, 3]. How can we achieve a O(1) dequeue in our case?
In python if we remove an element all the other elements of the array shift. To avoid that, we will simply create 5
counters and completely avoid the dequeue. The 4 counters will be responsible to count the amount of students removed
from each school. The 5th counter will be responsible for the change of the index in the order queue. That way, instead
of dequeueing, we just increase those counters and consider the the next elements to be the front.
Final complexity: O(Q)
"""
q = int(input())
structure = [[] for _ in range(4)]
s_counter = [0] * 4
order = []
o_counter = 0
for _ in range(q):
info = input().rstrip().split()
if info[0] == "E":
school = int(info[1]) - 1
# If the schools queue is empty or doesn't have any more students,
# meaning that the counter is bigger than its length, then we add
# that school to the order queue.
if not structure[school] or s_counter[school] >= len(structure[school]):
order.append(school)
# Add the student to its responsive school.
structure[school].append(int(info[2]))
else:
# Print the school and the student's roll,
# increase the counter for the respective school
# (instead of dequeueing) and if there are no more
# student's left in that school then increase the
# order counter (instead of dequeueing).
school = order[o_counter]
print(school + 1, structure[school][s_counter[school]])
s_counter[school] += 1
if s_counter[school] >= len(structure[school]):
o_counter += 1
| """
Codemonk link: https://www.hackerearth.com/problem/algorithm/little-monk-and-goblet-of-fire-3c1c6865/
Albus Dumbledore announced that the school will host the legendary event known as Wizard Tournament where four magical
schools are going to compete against each other in a very deadly competition by facing some dangerous challenges. Since
the team selection is very critical in this deadly competition. Albus Dumbledore asked Little Monk to help him in the
team selection process. There is a long queue of students from all the four magical schools. Each student of a school
have a different roll number. Whenever a new student will come, he will search for his schoolmate from the end of the
queue. As soon as he will find any of the schoolmate in the queue, he will stand behind him, otherwise he will stand at
the end of the queue. At any moment Little Monk will ask the student, who is standing in front of the queue, to come and
put his name in the Goblet of Fire and remove him from the queue. There are Q operations of one of the following types:
E x y: A new student of school x (1<=x<=4) whose roll number is y (1<=y<=50000) will stand in queue according to the
method mentioned above.
D: Little Monk will ask the student, who is standing in front of the queue, to come and put his name in the Goblet of
Fire and remove him from the queue.
Now Albus Dumbledore asked Little Monk to tell him the order in which student put their name. Little Monk is too lazy to
that so he asked you to write a program to print required order. Number of dequeue operations will never be greater than
enqueue operations at any point of time.
Input - Output:
First line contains an integer Q 1<=Q<=10000, denoting the number of operations.
Next Q lines will contains one of the 2 types of operations.
For each type of operation, print two space separated integers,
the front student's school and roll number.
Sample input:
E 1 1
E 2 1
E 1 2
D
D
Sample Output:
1 1
1 2
"""
"\nWe can solve this problem in linear time by using simple arrays in an efficient way. Instead of creating a queue with \nall the students, we are going to create a queue that contains 4 queues, one for each school. By doing that, we are able\nto directly insert a student behind the student of the same school in constant time. The only thing that's missing now,\nis the order of the schools. To solve tha problem we will create one more queue that is going to hold that order. We \nhave to notice that the order of the schools will be maintained as long as there is at least one student there. If there\nare no more students, then the new student that is going to come will be placed at the end, creating a new order for\nthat school. Now, each, time a school queue is empty and we add a student in it, we insert the number of the school in\nthat array. For example, if we have:\n\nE 1 5\nE 2 3\nE 1 1\nE 3 2\n\nthen, school_queue = [[5, 1], [3], [2], [0]] and order_queue = [1, 2, 3]. How can we achieve a O(1) dequeue in our case? \nIn python if we remove an element all the other elements of the array shift. To avoid that, we will simply create 5\ncounters and completely avoid the dequeue. The 4 counters will be responsible to count the amount of students removed \nfrom each school. The 5th counter will be responsible for the change of the index in the order queue. That way, instead\nof dequeueing, we just increase those counters and consider the the next elements to be the front.\n\nFinal complexity: O(Q)\n"
q = int(input())
structure = [[] for _ in range(4)]
s_counter = [0] * 4
order = []
o_counter = 0
for _ in range(q):
info = input().rstrip().split()
if info[0] == 'E':
school = int(info[1]) - 1
if not structure[school] or s_counter[school] >= len(structure[school]):
order.append(school)
structure[school].append(int(info[2]))
else:
school = order[o_counter]
print(school + 1, structure[school][s_counter[school]])
s_counter[school] += 1
if s_counter[school] >= len(structure[school]):
o_counter += 1 |
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' |
#!/bin/python3
__author__ = "Adam Karl"
"""Find the sum of all numbers below N which divide the sum of the factorial of their digits"""
#https://projecteuler.net/problem=34
digitFactorials = []
def sumCuriousNumbersUnderN(n):
"""Return a sum of all numbers that evenly divide the sum of the factorial of their digits"""
sumCurious = 0
for i in range(10, n): #no numbers under 10 are curious, even though 1!=1 and 2!=2
string = str(i)
digitFactorialSum = 0
for c in string:
digitFactorialSum += digitFactorials[int(c)]
if digitFactorialSum == i:
sumCurious += i
return sumCurious
def main():
print("Find the sum of all numbers which are equal to the sum of the factorial of their digits")
global digitFactorials
digitFactorials = [1] #0! = 1
for i in range(9): #1-9
digitFactorials.append(digitFactorials[-1] * (i+1))
#since 7 * 9! = 2540160, 2540160 is the last number that can be potentially curious
result = sumCuriousNumbersUnderN(2540161)
print("Sum = %d" % result)
if __name__ == "__main__":
main()
| __author__ = 'Adam Karl'
'Find the sum of all numbers below N which divide the sum of the factorial of their digits'
digit_factorials = []
def sum_curious_numbers_under_n(n):
"""Return a sum of all numbers that evenly divide the sum of the factorial of their digits"""
sum_curious = 0
for i in range(10, n):
string = str(i)
digit_factorial_sum = 0
for c in string:
digit_factorial_sum += digitFactorials[int(c)]
if digitFactorialSum == i:
sum_curious += i
return sumCurious
def main():
print('Find the sum of all numbers which are equal to the sum of the factorial of their digits')
global digitFactorials
digit_factorials = [1]
for i in range(9):
digitFactorials.append(digitFactorials[-1] * (i + 1))
result = sum_curious_numbers_under_n(2540161)
print('Sum = %d' % result)
if __name__ == '__main__':
main() |
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()) |
# TODO: Turn this into a generator?
def get_tiles(image, tile_size):
"""Splits an image into multiple tiles of a certain size"""
tile_images = []
x = 0
y = 0
while y < image.height:
im_tile = image.crop((x, y, x+tile_size, y+tile_size))
tile_images.append(im_tile)
if x < image.width - tile_size:
x += tile_size
else:
x = 0
y += tile_size
return tile_images
| def get_tiles(image, tile_size):
"""Splits an image into multiple tiles of a certain size"""
tile_images = []
x = 0
y = 0
while y < image.height:
im_tile = image.crop((x, y, x + tile_size, y + tile_size))
tile_images.append(im_tile)
if x < image.width - tile_size:
x += tile_size
else:
x = 0
y += tile_size
return tile_images |
# day_1/vars.py
# <-- This symbol makes a line a comment
""" <-- These make a multi line comment. Both typs of comments are ignored by
python. But you need to close multiline comments --> """
"""
The first thing we should talk about is how to get output out of your program.
In python we use the print function. You do this by typing:
print(10) # This will print 10 to the terminal.
Type your own print statement below.
"""
# <-- Type your print statement before the hashtag
"""
You can run a program by typing python3 <name of the file> in the terminal
Type: python3 vars.py
"""
"""
Varialbles are something that you can assign a value to. You give it a name and
you tell it it's value, then when ever you call it's name you get the value.
Lets go ahead and uncomment those two lines below, what do you think will
happen when we run it?
"""
# my_variable = 3
# print(my_variable)
"""
Math with variables. You can add and subtract variable and even reassign them to
be something else. Uncomment the lines below and see if you can guess what each
print statement will print.
"""
one = 1
two = 2
three = 3
goku = 9001
# print(goku - one) # Type your guess here:
# print(goku + one) # Type your guess here:
# print(two * three) # Type your guess here:
# print(goku / three) # Type your guess here:
# print(goku // three) # Type your guess here:
# goku = goku - one
# print(goku) # Type your guess here:
# print((goku * two) - (three ** two)) # Type your guess here:
# goku += two
# print(goku) # Type your guess here:
# modulus_maths = goku % three
# print(modulus_maths) # Type your guess here:
| """ <-- These make a multi line comment. Both typs of comments are ignored by
python. But you need to close multiline comments --> """
'\nThe first thing we should talk about is how to get output out of your program.\nIn python we use the print function. You do this by typing:\n\nprint(10) # This will print 10 to the terminal.\n\nType your own print statement below.\n'
'\nYou can run a program by typing python3 <name of the file> in the terminal\nType: python3 vars.py \n'
"\nVarialbles are something that you can assign a value to. You give it a name and\nyou tell it it's value, then when ever you call it's name you get the value.\nLets go ahead and uncomment those two lines below, what do you think will\nhappen when we run it?\n"
'\nMath with variables. You can add and subtract variable and even reassign them to\nbe something else. Uncomment the lines below and see if you can guess what each\nprint statement will print.\n'
one = 1
two = 2
three = 3
goku = 9001 |
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}') |
class HxCType(object):
"""
Enum and static methods for manipulating the C type defined by
HexRays. This is a wrapper on top of the ``ctype_t`` enum: ``cot_*``
are for the expresion (``cexpr_t`` in ida, :class:`HxCExpr` in bip )
and ``cit_*`` are for the statement (``cinsn_t`` in ida,
:class:`HxCStmt` in bip). This also include some static function
which are wrapper which manipulate those types.
.. todo:: static function for manipulating the enum ?
Comment on the enum are from ``hexrays.hpp`` .
"""
COT_EMPTY = 0
COT_COMMA = 1 #: ``x, y``
COT_ASG = 2 #: ``x = y``
COT_ASGBOR = 3 #: ``x |= y``
COT_ASGXOR = 4 #: ``x ^= y``
COT_ASGBAND = 5 #: ``x &= y``
COT_ASGADD = 6 #: ``x += y``
COT_ASGSUB = 7 #: ``x -= y``
COT_ASGMUL = 8 #: ``x *= y``
COT_ASGSSHR = 9 #: ``x >>= y`` signed
COT_ASGUSHR = 10 #: ``x >>= y`` unsigned
COT_ASGSHL = 11 #: ``x <<= y``
COT_ASGSDIV = 12 #: ``x /= y`` signed
COT_ASGUDIV = 13 #: ``x /= y`` unsigned
COT_ASGSMOD = 14 #: ``x %= y`` signed
COT_ASGUMOD = 15 #: ``x %= y`` unsigned
COT_TERN = 16 #: ``x ? y : z``
COT_LOR = 17 #: ``x || y``
COT_LAND = 18 #: ``x && y``
COT_BOR = 19 #: ``x | y``
COT_XOR = 20 #: ``x ^ y``
COT_BAND = 21 #: ``x & y``
COT_EQ = 22 #: ``x == y`` int or fpu (see EXFL_FPOP)
COT_NE = 23 #: ``x != y`` int or fpu (see EXFL_FPOP)
COT_SGE = 24 #: ``x >= y`` signed or fpu (see EXFL_FPOP)
COT_UGE = 25 #: ``x >= y`` unsigned
COT_SLE = 26 #: ``x <= y`` signed or fpu (see EXFL_FPOP)
COT_ULE = 27 #: ``x <= y`` unsigned
COT_SGT = 28 #: ``x > y`` signed or fpu (see EXFL_FPOP)
COT_UGT = 29 #: ``x > y`` unsigned
COT_SLT = 30 #: ``x < y`` signed or fpu (see EXFL_FPOP)
COT_ULT = 31 #: ``x < y`` unsigned
COT_SSHR = 32 #: ``x >> y`` signed
COT_USHR = 33 #: ``x >> y`` unsigned
COT_SHL = 34 #: ``x << y``
COT_ADD = 35 #: ``x + y``
COT_SUB = 36 #: ``x - y``
COT_MUL = 37 #: ``x * y``
COT_SDIV = 38 #: ``x / y`` signed
COT_UDIV = 39 #: ``x / y`` unsigned
COT_SMOD = 40 #: ``x % y`` signed
COT_UMOD = 41 #: ``x % y`` unsigned
COT_FADD = 42 #: ``x + y`` fp
COT_FSUB = 43 #: ``x - y`` fp
COT_FMUL = 44 #: ``x * y`` fp
COT_FDIV = 45 #: ``x / y`` fp
COT_FNEG = 46 #: ``-x`` fp
COT_NEG = 47 #: ``-x``
COT_CAST = 48 #: ``(type)x``
COT_LNOT = 49 #: ``!x``
COT_BNOT = 50 #: ``~x``
COT_PTR = 51 #: ``*x``, access size in 'ptrsize'
COT_REF = 52 #: ``&x``
COT_POSTINC = 53 #: ``x++``
COT_POSTDEC = 54 #: ``x--``
COT_PREINC = 55 #: ``++x``
COT_PREDEC = 56 #: ``--x``
COT_CALL = 57 #: ``x(...)``
COT_IDX = 58 #: ``x[y]``
COT_MEMREF = 59 #: ``x.m``
COT_MEMPTR = 60 #: ``x->m``, access size in 'ptrsize'
COT_NUM = 61 #: n
COT_FNUM = 62 #: fpc
COT_STR = 63 #: string constant
COT_OBJ = 64 #: obj_ea
COT_VAR = 65 #: v
COT_INSN = 66 #: instruction in expression, internal representation only
COT_SIZEOF = 67 #: ``sizeof(x)``
COT_HELPER = 68 #: arbitrary name
COT_TYPE = 69 #: arbitrary type
COT_LAST = 69 #: All before this are ``cexpr_t`` after are ``cinsn_t``
CIT_EMPTY = 70 #: instruction types start here
CIT_BLOCK = 71 #: block-statement: { ... }
CIT_EXPR = 72 #: expression-statement: expr;
CIT_IF = 73 #: if-statement
CIT_FOR = 74 #: for-statement
CIT_WHILE = 75 #: while-statement
CIT_DO = 76 #: do-statement
CIT_SWITCH = 77 #: switch-statement
CIT_BREAK = 78 #: break-statement
CIT_CONTINUE = 79 #: continue-statement
CIT_RETURN = 80 #: return-statement
CIT_GOTO = 81 #: goto-statement
CIT_ASM = 82 #: asm-statement
CIT_END = 83
class AbstractCItem(object):
"""
Abstract class for common element between :class:`HxCItem` and
:class:`CNode`.
This class provide access to common implementation: address of the
element, equality operator, testing for the label and testing for
expression or statement.
This class also define the
:meth:`~AbstractCItem.is_handling_type` method used for determining
the correct object to create using the
:attr:`~AbstractCItem.TYPE_HANDLE` attribute. Finally, it also define
the :meth:`~AbstractCItem._create_child` abstract method used for being
able to create child nodes.
"""
#: Class attribute indicating which type of item this class handles,
#: this is used for determining if this is the good object to
#: instantiate. All abstract class should have a value of -1 for this
#: object, non-abstract class should have a value corresponding to the
#: :class:`HxCType` they handle.
TYPE_HANDLE = -1
def __init__(self, citem):
"""
Constructor for the abstract class :class:`HxCItem` . This should
never be used directly.
:param citem: a ``citem_t`` object, in practice this should always
be a ``cexpr_t`` or a ``cinsn_t`` object.
"""
#: The ``citem_t`` object from ida, this is conserved at this level
#: for providing a few functionnality compatible between different
#: item types (such as :class:`HxCExpr` and :class:`HxCStmt`) .
self._citem = citem
############################ BASE METHODS ##########################
@property
def ea(self):
"""
Property which return the address corresponding to this item.
:return: An integer corresponding to the address of the item. This
may be ``idc.BADADDR`` if the item as no equivalent address.
"""
return self._citem.ea
@property
def is_expr(self):
"""
Property which return true if this item is a C Expression
(:class:`HxCExpr`, ``cexpr_t``).
"""
return self._citem.is_expr()
@property
def is_statement(self):
"""
Property which return true if this item is a C Statement
(:class:`HxCStmt`, ``cinsn_t``).
"""
return not self.is_expr
@property
def _ctype(self):
"""
Property which return the :class:`HxCType` (``ctype_t``) of this
object.
:return int: One of the :class:`HxCType` constant value.
"""
return self._citem.op
def __str__(self):
"""
Convert a citem to a string.
This is surcharge both by :class:`HxCStmt` and :class:`HxCExpr`.
"""
return "{}(ea=0x{:X})".format(self.__class__.__name__, self.ea)
########################## LABEL METHODS ###########################
@property
def has_label(self):
"""
Property which return True if the node has a label number.
"""
return self._citem.label_num != -1
@property
def label_num(self):
"""
Property which return the label number of the node. If this node
has no label ``-1`` is return. :meth:`~AbstractCItem.has_label`
allows to check if the node has a label.
"""
return self._citem.label_num
########################### CMP METHODS ###############################
def __eq__(self, other):
"""
Compare to AST node. This is base on the compare implemented by
hexrays and can return true for two different object including
for comparing object which inherit from :class:`HxCItem` and from
:class:`CNode`.
This seems to not work if the function has been recompiled.
Return ``NotImplemented`` if the element to compare does not
inherit from AbstractCItem
"""
if not isinstance(other, AbstractCItem):
return NotImplemented
return self._citem == other._citem
def __ne__(self, other):
res = self.__eq__(other)
if res == NotImplemented:
return res
else:
return not res
############################ INHERITANCE METHODS #########################
def _create_child(self, obj):
"""
Abstract method which allow to create child element for this
object with the correct class. This should be implemented by child
classes and will raise a :class:`NotImplementedError` exception
if not surcharge.
"""
raise NotImplementedError("_create_child is an abstract method and should be surcharge by child class")
############################ CLASS METHODS ##########################
@classmethod
def is_handling_type(cls, typ):
"""
Class method which return True if the function handle the type
passed as argument.
:param typ: One of the :class:`HxCType` value.
"""
return cls.TYPE_HANDLE == typ
| class Hxctype(object):
"""
Enum and static methods for manipulating the C type defined by
HexRays. This is a wrapper on top of the ``ctype_t`` enum: ``cot_*``
are for the expresion (``cexpr_t`` in ida, :class:`HxCExpr` in bip )
and ``cit_*`` are for the statement (``cinsn_t`` in ida,
:class:`HxCStmt` in bip). This also include some static function
which are wrapper which manipulate those types.
.. todo:: static function for manipulating the enum ?
Comment on the enum are from ``hexrays.hpp`` .
"""
cot_empty = 0
cot_comma = 1
cot_asg = 2
cot_asgbor = 3
cot_asgxor = 4
cot_asgband = 5
cot_asgadd = 6
cot_asgsub = 7
cot_asgmul = 8
cot_asgsshr = 9
cot_asgushr = 10
cot_asgshl = 11
cot_asgsdiv = 12
cot_asgudiv = 13
cot_asgsmod = 14
cot_asgumod = 15
cot_tern = 16
cot_lor = 17
cot_land = 18
cot_bor = 19
cot_xor = 20
cot_band = 21
cot_eq = 22
cot_ne = 23
cot_sge = 24
cot_uge = 25
cot_sle = 26
cot_ule = 27
cot_sgt = 28
cot_ugt = 29
cot_slt = 30
cot_ult = 31
cot_sshr = 32
cot_ushr = 33
cot_shl = 34
cot_add = 35
cot_sub = 36
cot_mul = 37
cot_sdiv = 38
cot_udiv = 39
cot_smod = 40
cot_umod = 41
cot_fadd = 42
cot_fsub = 43
cot_fmul = 44
cot_fdiv = 45
cot_fneg = 46
cot_neg = 47
cot_cast = 48
cot_lnot = 49
cot_bnot = 50
cot_ptr = 51
cot_ref = 52
cot_postinc = 53
cot_postdec = 54
cot_preinc = 55
cot_predec = 56
cot_call = 57
cot_idx = 58
cot_memref = 59
cot_memptr = 60
cot_num = 61
cot_fnum = 62
cot_str = 63
cot_obj = 64
cot_var = 65
cot_insn = 66
cot_sizeof = 67
cot_helper = 68
cot_type = 69
cot_last = 69
cit_empty = 70
cit_block = 71
cit_expr = 72
cit_if = 73
cit_for = 74
cit_while = 75
cit_do = 76
cit_switch = 77
cit_break = 78
cit_continue = 79
cit_return = 80
cit_goto = 81
cit_asm = 82
cit_end = 83
class Abstractcitem(object):
"""
Abstract class for common element between :class:`HxCItem` and
:class:`CNode`.
This class provide access to common implementation: address of the
element, equality operator, testing for the label and testing for
expression or statement.
This class also define the
:meth:`~AbstractCItem.is_handling_type` method used for determining
the correct object to create using the
:attr:`~AbstractCItem.TYPE_HANDLE` attribute. Finally, it also define
the :meth:`~AbstractCItem._create_child` abstract method used for being
able to create child nodes.
"""
type_handle = -1
def __init__(self, citem):
"""
Constructor for the abstract class :class:`HxCItem` . This should
never be used directly.
:param citem: a ``citem_t`` object, in practice this should always
be a ``cexpr_t`` or a ``cinsn_t`` object.
"""
self._citem = citem
@property
def ea(self):
"""
Property which return the address corresponding to this item.
:return: An integer corresponding to the address of the item. This
may be ``idc.BADADDR`` if the item as no equivalent address.
"""
return self._citem.ea
@property
def is_expr(self):
"""
Property which return true if this item is a C Expression
(:class:`HxCExpr`, ``cexpr_t``).
"""
return self._citem.is_expr()
@property
def is_statement(self):
"""
Property which return true if this item is a C Statement
(:class:`HxCStmt`, ``cinsn_t``).
"""
return not self.is_expr
@property
def _ctype(self):
"""
Property which return the :class:`HxCType` (``ctype_t``) of this
object.
:return int: One of the :class:`HxCType` constant value.
"""
return self._citem.op
def __str__(self):
"""
Convert a citem to a string.
This is surcharge both by :class:`HxCStmt` and :class:`HxCExpr`.
"""
return '{}(ea=0x{:X})'.format(self.__class__.__name__, self.ea)
@property
def has_label(self):
"""
Property which return True if the node has a label number.
"""
return self._citem.label_num != -1
@property
def label_num(self):
"""
Property which return the label number of the node. If this node
has no label ``-1`` is return. :meth:`~AbstractCItem.has_label`
allows to check if the node has a label.
"""
return self._citem.label_num
def __eq__(self, other):
"""
Compare to AST node. This is base on the compare implemented by
hexrays and can return true for two different object including
for comparing object which inherit from :class:`HxCItem` and from
:class:`CNode`.
This seems to not work if the function has been recompiled.
Return ``NotImplemented`` if the element to compare does not
inherit from AbstractCItem
"""
if not isinstance(other, AbstractCItem):
return NotImplemented
return self._citem == other._citem
def __ne__(self, other):
res = self.__eq__(other)
if res == NotImplemented:
return res
else:
return not res
def _create_child(self, obj):
"""
Abstract method which allow to create child element for this
object with the correct class. This should be implemented by child
classes and will raise a :class:`NotImplementedError` exception
if not surcharge.
"""
raise not_implemented_error('_create_child is an abstract method and should be surcharge by child class')
@classmethod
def is_handling_type(cls, typ):
"""
Class method which return True if the function handle the type
passed as argument.
:param typ: One of the :class:`HxCType` value.
"""
return cls.TYPE_HANDLE == typ |
#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)) |
# -*- python -*-
"""@file
@brief crc8 calculator for Pato packets
Copyright (c) 2014-2015 Dimitry Kloper <kloper@users.sf.net>.
All rights reserved.
@page License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing
official policies, either expressed or implied, of the Pato Project.
"""
def _crc_update(crc, data, mask, const):
"""
CRC8/16 update function taken from _crc_ibutton_update() function
found in "Atmel Toolchain/AVR8 GCC/Native/3.4.1061/
avr8-gnu-toolchain/avr/include/util/crc16.h" documentation.
@param[in] crc current CRC value
@param[in] data next byte of data
@param[in] mask CRC mask, must be 0xff for CRC8 and 0xffff for CRC16
@param[in] const CRC polynomial constant
@returns Next CRC value either 8 or 16 bit depending on mask
"""
crc = (crc & mask) ^ (data & 0xff)
for _ in range(8):
if crc & 1:
crc = (crc >> 1) ^ const
else:
crc >>= 1
return crc & mask
def crc8(data):
"""
Calculate CRC8 as described in the util/crc16.h (see _crc_update())
@param[in] data input byte sequence
@returns Optimized Dallas (now Maxim) iButton 8-bit CRC
"""
crc = 0
for c in data:
crc = _crc_update(crc, c, 0xff, 0x8c)
return crc
def crc16(data):
"""
Calculate CRC16 as described in the util/crc16.h (see _crc_update())
@param[in] data input byte sequence
@returns CRC16 of input byte sequence
"""
crc = 0
for c in data:
crc = _crc_update(crc, c, 0xffff, 0xA001)
return crc
| """@file
@brief crc8 calculator for Pato packets
Copyright (c) 2014-2015 Dimitry Kloper <kloper@users.sf.net>.
All rights reserved.
@page License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing
official policies, either expressed or implied, of the Pato Project.
"""
def _crc_update(crc, data, mask, const):
"""
CRC8/16 update function taken from _crc_ibutton_update() function
found in "Atmel Toolchain/AVR8 GCC/Native/3.4.1061/
avr8-gnu-toolchain/avr/include/util/crc16.h" documentation.
@param[in] crc current CRC value
@param[in] data next byte of data
@param[in] mask CRC mask, must be 0xff for CRC8 and 0xffff for CRC16
@param[in] const CRC polynomial constant
@returns Next CRC value either 8 or 16 bit depending on mask
"""
crc = crc & mask ^ data & 255
for _ in range(8):
if crc & 1:
crc = crc >> 1 ^ const
else:
crc >>= 1
return crc & mask
def crc8(data):
"""
Calculate CRC8 as described in the util/crc16.h (see _crc_update())
@param[in] data input byte sequence
@returns Optimized Dallas (now Maxim) iButton 8-bit CRC
"""
crc = 0
for c in data:
crc = _crc_update(crc, c, 255, 140)
return crc
def crc16(data):
"""
Calculate CRC16 as described in the util/crc16.h (see _crc_update())
@param[in] data input byte sequence
@returns CRC16 of input byte sequence
"""
crc = 0
for c in data:
crc = _crc_update(crc, c, 65535, 40961)
return crc |
__all__ = ('InvalidOption')
class InvalidOption(Exception):
"""
Raises when user call methods
with incorrect arguments.
"""
| __all__ = 'InvalidOption'
class Invalidoption(Exception):
"""
Raises when user call methods
with incorrect arguments.
""" |
class PolydatumException(Exception):
pass
class ServiceError(PolydatumException):
code = 500
class NotFound(ServiceError):
code = 404
class ErrorsOnClose(PolydatumException):
"""
Deprecated 0.8.4 as Resources errors on exit
are suppressed
"""
def __init__(self, message, exceptions):
super(Exception, self).__init__(message)
self.message = message
self.exceptions = exceptions
def __str__(self):
return '<{} {}: {}>'.format(
self.__class__.__name__,
self.message,
self.exceptions
)
class AlreadyExistsException(PolydatumException):
"""
Service, middleware, or resource already exists
"""
class MiddlewareException(PolydatumException):
pass
class MiddlewareSetupException(MiddlewareException):
"""
Middleware setup failed
"""
class ResourceException(PolydatumException):
pass
class ResourceSetupException(ResourceException):
"""
Resource setup failed
""" | class Polydatumexception(Exception):
pass
class Serviceerror(PolydatumException):
code = 500
class Notfound(ServiceError):
code = 404
class Errorsonclose(PolydatumException):
"""
Deprecated 0.8.4 as Resources errors on exit
are suppressed
"""
def __init__(self, message, exceptions):
super(Exception, self).__init__(message)
self.message = message
self.exceptions = exceptions
def __str__(self):
return '<{} {}: {}>'.format(self.__class__.__name__, self.message, self.exceptions)
class Alreadyexistsexception(PolydatumException):
"""
Service, middleware, or resource already exists
"""
class Middlewareexception(PolydatumException):
pass
class Middlewaresetupexception(MiddlewareException):
"""
Middleware setup failed
"""
class Resourceexception(PolydatumException):
pass
class Resourcesetupexception(ResourceException):
"""
Resource setup failed
""" |
# 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)} |
class AndroidKey:
# Key code constant: Unknown key code.
UNKNOWN = 0
# Key code constant: Soft Left key.
# Usually situated below the display on phones and used as a multi-function
# feature key for selecting a software defined function shown on the bottom left
# of the display.
SOFT_LEFT = 1
# Key code constant: Soft Right key.
# Usually situated below the display on phones and used as a multi-function
# feature key for selecting a software defined function shown on the bottom right
# of the display.
SOFT_RIGHT = 2
# Key code constant: Home key.
# This key is handled by the framework and is never delivered to applications.
HOME = 3
# Key code constant: Back key.
BACK = 4
# Key code constant: Call key.
CALL = 5
# Key code constant: End Call key.
ENDCALL = 6
# Key code constant: '0' key.
DIGIT_0 = 7
# Key code constant: '1' key.
DIGIT_1 = 8
# Key code constant: '2' key.
DIGIT_2 = 9
# Key code constant: '3' key.
DIGIT_3 = 10
# Key code constant: '4' key.
DIGIT_4 = 11
# Key code constant: '5' key.
DIGIT_5 = 12
# Key code constant: '6' key.
DIGIT_6 = 13
# Key code constant: '7' key.
DIGIT_7 = 14
# Key code constant: '8' key.
DIGIT_8 = 15
# Key code constant: '9' key.
DIGIT_9 = 16
# Key code constant: '*' key.
STAR = 17
# Key code constant: '#' key.
POUND = 18
# Key code constant: Directional Pad Up key.
# May also be synthesized from trackball motions.
DPAD_UP = 19
# Key code constant: Directional Pad Down key.
# May also be synthesized from trackball motions.
DPAD_DOWN = 20
# Key code constant: Directional Pad Left key.
# May also be synthesized from trackball motions.
DPAD_LEFT = 21
# Key code constant: Directional Pad Right key.
# May also be synthesized from trackball motions.
DPAD_RIGHT = 22
# Key code constant: Directional Pad Center key.
# May also be synthesized from trackball motions.
DPAD_CENTER = 23
# Key code constant: Volume Up key.
# Adjusts the speaker volume up.
VOLUME_UP = 24
# Key code constant: Volume Down key.
# Adjusts the speaker volume down.
VOLUME_DOWN = 25
# Key code constant: Power key.
POWER = 26
# Key code constant: Camera key.
# Used to launch a camera application or take pictures.
CAMERA = 27
# Key code constant: Clear key.
CLEAR = 28
# Key code constant: 'A' key.
A = 29
# Key code constant: 'B' key.
B = 30
# Key code constant: 'C' key.
C = 31
# Key code constant: 'D' key.
D = 32
# Key code constant: 'E' key.
E = 33
# Key code constant: 'F' key.
F = 34
# Key code constant: 'G' key.
G = 35
# Key code constant: 'H' key.
H = 36
# Key code constant: 'I' key.
I = 37
# Key code constant: 'J' key.
J = 38
# Key code constant: 'K' key.
K = 39
# Key code constant: 'L' key.
L = 40
# Key code constant: 'M' key.
M = 41
# Key code constant: 'N' key.
N = 42
# Key code constant: 'O' key.
O = 43
# Key code constant: 'P' key.
P = 44
# Key code constant: 'Q' key.
Q = 45
# Key code constant: 'R' key.
R = 46
# Key code constant: 'S' key.
S = 47
# Key code constant: 'T' key.
T = 48
# Key code constant: 'U' key.
U = 49
# Key code constant: 'V' key.
V = 50
# Key code constant: 'W' key.
W = 51
# Key code constant: 'X' key.
X = 52
# Key code constant: 'Y' key.
Y = 53
# Key code constant: 'Z' key.
Z = 54
# Key code constant: ',' key.
COMMA = 55
# Key code constant: '.' key.
PERIOD = 56
# Key code constant: Left Alt modifier key.
ALT_LEFT = 57
# Key code constant: Right Alt modifier key.
ALT_RIGHT = 58
# Key code constant: Left Shift modifier key.
SHIFT_LEFT = 59
# Key code constant: Right Shift modifier key.
SHIFT_RIGHT = 60
# Key code constant: Tab key.
TAB = 61
# Key code constant: Space key.
SPACE = 62
# Key code constant: Symbol modifier key.
# Used to enter alternate symbols.
SYM = 63
# Key code constant: Explorer special function key.
# Used to launch a browser application.
EXPLORER = 64
# Key code constant: Envelope special function key.
# Used to launch a mail application.
ENVELOPE = 65
# Key code constant: Enter key.
ENTER = 66
# Key code constant: Backspace key.
# Deletes characters before the insertion point, unlike {@link #FORWARD_DEL}.
DEL = 67
# Key code constant: '`' (backtick) key.
GRAVE = 68
# Key code constant: '-'.
MINUS = 69
# Key code constant: '=' key.
EQUALS = 70
# Key code constant: '[' key.
LEFT_BRACKET = 71
# Key code constant: ']' key.
RIGHT_BRACKET = 72
# Key code constant: '\' key.
BACKSLASH = 73
# Key code constant: ';' key.
SEMICOLON = 74
# Key code constant: ''' (apostrophe) key.
APOSTROPHE = 75
# Key code constant: '/' key.
SLASH = 76
# Key code constant: '@' key.
AT = 77
# Key code constant: Number modifier key.
# Used to enter numeric symbols.
# This key is not Num Lock; it is more like {@link #ALT_LEFT} and is
# interpreted as an ALT key
NUM = 78
# Key code constant: Headset Hook key.
# Used to hang up calls and stop media.
HEADSETHOOK = 79
# Key code constant: Camera Focus key.
# Used to focus the camera.
FOCUS = 80 # *Camera* focus
# Key code constant: '+' key.
PLUS = 81
# Key code constant: Menu key.
MENU = 82
# Key code constant: Notification key.
NOTIFICATION = 83
# Key code constant: Search key.
SEARCH = 84
# Key code constant: Play/Pause media key.
MEDIA_PLAY_PAUSE = 85
# Key code constant: Stop media key.
MEDIA_STOP = 86
# Key code constant: Play Next media key.
MEDIA_NEXT = 87
# Key code constant: Play Previous media key.
MEDIA_PREVIOUS = 88
# Key code constant: Rewind media key.
MEDIA_REWIND = 89
# Key code constant: Fast Forward media key.
MEDIA_FAST_FORWARD = 90
# Key code constant: Mute key.
# Mutes the microphone, unlike {@link #VOLUME_MUTE}.
MUTE = 91
# Key code constant: Page Up key.
PAGE_UP = 92
# Key code constant: Page Down key.
PAGE_DOWN = 93
# Key code constant: Picture Symbols modifier key.
# Used to switch symbol sets (Emoji, Kao-moji).
PICTSYMBOLS = 94 # switch symbol-sets (Emoji,Kao-moji)
# Key code constant: Switch Charset modifier key.
# Used to switch character sets (Kanji, Katakana).
SWITCH_CHARSET = 95 # switch char-sets (Kanji,Katakana)
# Key code constant: A Button key.
# On a game controller, the A button should be either the button labeled A
# or the first button on the bottom row of controller buttons.
BUTTON_A = 96
# Key code constant: B Button key.
# On a game controller, the B button should be either the button labeled B
# or the second button on the bottom row of controller buttons.
BUTTON_B = 97
# Key code constant: C Button key.
# On a game controller, the C button should be either the button labeled C
# or the third button on the bottom row of controller buttons.
BUTTON_C = 98
# Key code constant: X Button key.
# On a game controller, the X button should be either the button labeled X
# or the first button on the upper row of controller buttons.
BUTTON_X = 99
# Key code constant: Y Button key.
# On a game controller, the Y button should be either the button labeled Y
# or the second button on the upper row of controller buttons.
BUTTON_Y = 100
# Key code constant: Z Button key.
# On a game controller, the Z button should be either the button labeled Z
# or the third button on the upper row of controller buttons.
BUTTON_Z = 101
# Key code constant: L1 Button key.
# On a game controller, the L1 button should be either the button labeled L1 (or L)
# or the top left trigger button.
BUTTON_L1 = 102
# Key code constant: R1 Button key.
# On a game controller, the R1 button should be either the button labeled R1 (or R)
# or the top right trigger button.
BUTTON_R1 = 103
# Key code constant: L2 Button key.
# On a game controller, the L2 button should be either the button labeled L2
# or the bottom left trigger button.
BUTTON_L2 = 104
# Key code constant: R2 Button key.
# On a game controller, the R2 button should be either the button labeled R2
# or the bottom right trigger button.
BUTTON_R2 = 105
# Key code constant: Left Thumb Button key.
# On a game controller, the left thumb button indicates that the left (or only)
# joystick is pressed.
BUTTON_THUMBL = 106
# Key code constant: Right Thumb Button key.
# On a game controller, the right thumb button indicates that the right
# joystick is pressed.
BUTTON_THUMBR = 107
# Key code constant: Start Button key.
# On a game controller, the button labeled Start.
BUTTON_START = 108
# Key code constant: Select Button key.
# On a game controller, the button labeled Select.
BUTTON_SELECT = 109
# Key code constant: Mode Button key.
# On a game controller, the button labeled Mode.
BUTTON_MODE = 110
# Key code constant: Escape key.
ESCAPE = 111
# Key code constant: Forward Delete key.
# Deletes characters ahead of the insertion point, unlike {@link #DEL}.
FORWARD_DEL = 112
# Key code constant: Left Control modifier key.
CTRL_LEFT = 113
# Key code constant: Right Control modifier key.
CTRL_RIGHT = 114
# Key code constant: Caps Lock key.
CAPS_LOCK = 115
# Key code constant: Scroll Lock key.
SCROLL_LOCK = 116
# Key code constant: Left Meta modifier key.
META_LEFT = 117
# Key code constant: Right Meta modifier key.
META_RIGHT = 118
# Key code constant: Function modifier key.
FUNCTION = 119
# Key code constant: System Request / Print Screen key.
SYSRQ = 120
# Key code constant: Break / Pause key.
BREAK = 121
# Key code constant: Home Movement key.
# Used for scrolling or moving the cursor around to the start of a line
# or to the top of a list.
MOVE_HOME = 122
# Key code constant: End Movement key.
# Used for scrolling or moving the cursor around to the end of a line
# or to the bottom of a list.
MOVE_END = 123
# Key code constant: Insert key.
# Toggles insert / overwrite edit mode.
INSERT = 124
# Key code constant: Forward key.
# Navigates forward in the history stack. Complement of {@link #BACK}.
FORWARD = 125
# Key code constant: Play media key.
MEDIA_PLAY = 126
# Key code constant: Pause media key.
MEDIA_PAUSE = 127
# Key code constant: Close media key.
# May be used to close a CD tray, for example.
MEDIA_CLOSE = 128
# Key code constant: Eject media key.
# May be used to eject a CD tray, for example.
MEDIA_EJECT = 129
# Key code constant: Record media key.
MEDIA_RECORD = 130
# Key code constant: F1 key.
F1 = 131
# Key code constant: F2 key.
F2 = 132
# Key code constant: F3 key.
F3 = 133
# Key code constant: F4 key.
F4 = 134
# Key code constant: F5 key.
F5 = 135
# Key code constant: F6 key.
F6 = 136
# Key code constant: F7 key.
F7 = 137
# Key code constant: F8 key.
F8 = 138
# Key code constant: F9 key.
F9 = 139
# Key code constant: F10 key.
F10 = 140
# Key code constant: F11 key.
F11 = 141
# Key code constant: F12 key.
F12 = 142
# Key code constant: Num Lock key.
# This is the Num Lock key; it is different from {@link #NUM}.
# This key alters the behavior of other keys on the numeric keypad.
NUM_LOCK = 143
# Key code constant: Numeric keypad '0' key.
NUMPAD_0 = 144
# Key code constant: Numeric keypad '1' key.
NUMPAD_1 = 145
# Key code constant: Numeric keypad '2' key.
NUMPAD_2 = 146
# Key code constant: Numeric keypad '3' key.
NUMPAD_3 = 147
# Key code constant: Numeric keypad '4' key.
NUMPAD_4 = 148
# Key code constant: Numeric keypad '5' key.
NUMPAD_5 = 149
# Key code constant: Numeric keypad '6' key.
NUMPAD_6 = 150
# Key code constant: Numeric keypad '7' key.
NUMPAD_7 = 151
# Key code constant: Numeric keypad '8' key.
NUMPAD_8 = 152
# Key code constant: Numeric keypad '9' key.
NUMPAD_9 = 153
# Key code constant: Numeric keypad '/' key (for division).
NUMPAD_DIVIDE = 154
# Key code constant: Numeric keypad '#' key (for multiplication).
NUMPAD_MULTIPLY = 155
# Key code constant: Numeric keypad '-' key (for subtraction).
NUMPAD_SUBTRACT = 156
# Key code constant: Numeric keypad '+' key (for addition).
NUMPAD_ADD = 157
# Key code constant: Numeric keypad '.' key (for decimals or digit grouping).
NUMPAD_DOT = 158
# Key code constant: Numeric keypad ',' key (for decimals or digit grouping).
NUMPAD_COMMA = 159
# Key code constant: Numeric keypad Enter key.
NUMPAD_ENTER = 160
# Key code constant: Numeric keypad '=' key.
NUMPAD_EQUALS = 161
# Key code constant: Numeric keypad '(' key.
NUMPAD_LEFT_PAREN = 162
# Key code constant: Numeric keypad ')' key.
NUMPAD_RIGHT_PAREN = 163
# Key code constant: Volume Mute key.
# Mutes the speaker, unlike {@link #MUTE}.
# This key should normally be implemented as a toggle such that the first press
# mutes the speaker and the second press restores the original volume.
VOLUME_MUTE = 164
# Key code constant: Info key.
# Common on TV remotes to show additional information related to what is
# currently being viewed.
INFO = 165
# Key code constant: Channel up key.
# On TV remotes, increments the television channel.
CHANNEL_UP = 166
# Key code constant: Channel down key.
# On TV remotes, decrements the television channel.
CHANNEL_DOWN = 167
# Key code constant: Zoom in key.
KEYCODE_ZOOM_IN = 168
# Key code constant: Zoom out key.
KEYCODE_ZOOM_OUT = 169
# Key code constant: TV key.
# On TV remotes, switches to viewing live TV.
TV = 170
# Key code constant: Window key.
# On TV remotes, toggles picture-in-picture mode or other windowing functions.
WINDOW = 171
# Key code constant: Guide key.
# On TV remotes, shows a programming guide.
GUIDE = 172
# Key code constant: DVR key.
# On some TV remotes, switches to a DVR mode for recorded shows.
DVR = 173
# Key code constant: Bookmark key.
# On some TV remotes, bookmarks content or web pages.
BOOKMARK = 174
# Key code constant: Toggle captions key.
# Switches the mode for closed-captioning text, for example during television shows.
CAPTIONS = 175
# Key code constant: Settings key.
# Starts the system settings activity.
SETTINGS = 176
# Key code constant: TV power key.
# On TV remotes, toggles the power on a television screen.
TV_POWER = 177
# Key code constant: TV input key.
# On TV remotes, switches the input on a television screen.
TV_INPUT = 178
# Key code constant: Set-top-box power key.
# On TV remotes, toggles the power on an external Set-top-box.
STB_POWER = 179
# Key code constant: Set-top-box input key.
# On TV remotes, switches the input mode on an external Set-top-box.
STB_INPUT = 180
# Key code constant: A/V Receiver power key.
# On TV remotes, toggles the power on an external A/V Receiver.
AVR_POWER = 181
# Key code constant: A/V Receiver input key.
# On TV remotes, switches the input mode on an external A/V Receiver.
AVR_INPUT = 182
# Key code constant: Red "programmable" key.
# On TV remotes, acts as a contextual/programmable key.
PROG_RED = 183
# Key code constant: Green "programmable" key.
# On TV remotes, actsas a contextual/programmable key.
PROG_GREEN = 184
# Key code constant: Yellow "programmable" key.
# On TV remotes, acts as a contextual/programmable key.
PROG_YELLOW = 185
# Key code constant: Blue "programmable" key.
# On TV remotes, acts as a contextual/programmable key.
PROG_BLUE = 186
# Key code constant: App switch key.
# Should bring up the application switcher dialog.
APP_SWITCH = 187
# Key code constant: Generic Game Pad Button #1.
BUTTON_1 = 188
# Key code constant: Generic Game Pad Button #2.
BUTTON_2 = 189
# Key code constant: Generic Game Pad Button #3.
BUTTON_3 = 190
# Key code constant: Generic Game Pad Button #4.
BUTTON_4 = 191
# Key code constant: Generic Game Pad Button #5.
BUTTON_5 = 192
# Key code constant: Generic Game Pad Button #6.
BUTTON_6 = 193
# Key code constant: Generic Game Pad Button #7.
BUTTON_7 = 194
# Key code constant: Generic Game Pad Button #8.
BUTTON_8 = 195
# Key code constant: Generic Game Pad Button #9.
BUTTON_9 = 196
# Key code constant: Generic Game Pad Button #10.
BUTTON_10 = 197
# Key code constant: Generic Game Pad Button #11.
BUTTON_11 = 198
# Key code constant: Generic Game Pad Button #12.
BUTTON_12 = 199
# Key code constant: Generic Game Pad Button #13.
BUTTON_13 = 200
# Key code constant: Generic Game Pad Button #14.
BUTTON_14 = 201
# Key code constant: Generic Game Pad Button #15.
BUTTON_15 = 202
# Key code constant: Generic Game Pad Button #16.
BUTTON_16 = 203
# Key code constant: Language Switch key.
# Toggles the current input language such as switching between English and Japanese on
# a QWERTY keyboard. On some devices, the same function may be performed by
# pressing Shift+Spacebar.
LANGUAGE_SWITCH = 204
# Key code constant: Manner Mode key.
# Toggles silent or vibrate mode on and off to make the device behave more politely
# in certain settings such as on a crowded train. On some devices, the key may only
# operate when long-pressed.
MANNER_MODE = 205
# Key code constant: 3D Mode key.
# Toggles the display between 2D and 3D mode.
MODE_3D = 206
# Key code constant: Contacts special function key.
# Used to launch an address book application.
CONTACTS = 207
# Key code constant: Calendar special function key.
# Used to launch a calendar application.
CALENDAR = 208
# Key code constant: Music special function key.
# Used to launch a music player application.
MUSIC = 209
# Key code constant: Calculator special function key.
# Used to launch a calculator application.
CALCULATOR = 210
# Key code constant: Japanese full-width / half-width key.
ZENKAKU_HANKAKU = 211
# Key code constant: Japanese alphanumeric key.
EISU = 212
# Key code constant: Japanese non-conversion key.
MUHENKAN = 213
# Key code constant: Japanese conversion key.
HENKAN = 214
# Key code constant: Japanese katakana / hiragana key.
KATAKANA_HIRAGANA = 215
# Key code constant: Japanese Yen key.
YEN = 216
# Key code constant: Japanese Ro key.
RO = 217
# Key code constant: Japanese kana key.
KANA = 218
# Key code constant: Assist key.
# Launches the global assist activity. Not delivered to applications.
ASSIST = 219
# Key code constant: Brightness Down key.
# Adjusts the screen brightness down.
BRIGHTNESS_DOWN = 220
# Key code constant: Brightness Up key.
# Adjusts the screen brightness up.
BRIGHTNESS_UP = 221
# Key code constant: Audio Track key.
# Switches the audio tracks.
MEDIA_AUDIO_TRACK = 222
# Key code constant: Sleep key.
# Puts the device to sleep. Behaves somewhat like {@link #POWER} but it
# has no effect if the device is already asleep.
SLEEP = 223
# Key code constant: Wakeup key.
# Wakes up the device. Behaves somewhat like {@link #POWER} but it
# has no effect if the device is already awake.
WAKEUP = 224
# Key code constant: Pairing key.
# Initiates peripheral pairing mode. Useful for pairing remote control
# devices or game controllers, especially if no other input mode is
# available.
PAIRING = 225
# Key code constant: Media Top Menu key.
# Goes to the top of media menu.
MEDIA_TOP_MENU = 226
# Key code constant: '11' key.
KEY_11 = 227
# Key code constant: '12' key.
KEY_12 = 228
# Key code constant: Last Channel key.
# Goes to the last viewed channel.
LAST_CHANNEL = 229
# Key code constant: TV data service key.
# Displays data services like weather, sports.
TV_DATA_SERVICE = 230
# Key code constant: Voice Assist key.
# Launches the global voice assist activity. Not delivered to applications.
VOICE_ASSIST = 231
# Key code constant: Radio key.
# Toggles TV service / Radio service.
TV_RADIO_SERVICE = 232
# Key code constant: Teletext key.
# Displays Teletext service.
TV_TELETEXT = 233
# Key code constant: Number entry key.
# Initiates to enter multi-digit channel nubmber when each digit key is assigned
# for selecting separate channel. Corresponds to Number Entry Mode (0x1D) of CEC
# User Control Code.
TV_NUMBER_ENTRY = 234
# Key code constant: Analog Terrestrial key.
# Switches to analog terrestrial broadcast service.
TV_TERRESTRIAL_ANALOG = 235
# Key code constant: Digital Terrestrial key.
# Switches to digital terrestrial broadcast service.
TV_TERRESTRIAL_DIGITAL = 236
# Key code constant: Satellite key.
# Switches to digital satellite broadcast service.
TV_SATELLITE = 237
# Key code constant: BS key.
# Switches to BS digital satellite broadcasting service available in Japan.
TV_SATELLITE_BS = 238
# Key code constant: CS key.
# Switches to CS digital satellite broadcasting service available in Japan.
TV_SATELLITE_CS = 239
# Key code constant: BS/CS key.
# Toggles between BS and CS digital satellite services.
TV_SATELLITE_SERVICE = 240
# Key code constant: Toggle Network key.
# Toggles selecting broacast services.
TV_NETWORK = 241
# Key code constant: Antenna/Cable key.
# Toggles broadcast input source between antenna and cable.
TV_ANTENNA_CABLE = 242
# Key code constant: HDMI #1 key.
# Switches to HDMI input #1.
TV_INPUT_HDMI_1 = 243
# Key code constant: HDMI #2 key.
# Switches to HDMI input #2.
TV_INPUT_HDMI_2 = 244
# Key code constant: HDMI #3 key.
# Switches to HDMI input #3.
TV_INPUT_HDMI_3 = 245
# Key code constant: HDMI #4 key.
# Switches to HDMI input #4.
TV_INPUT_HDMI_4 = 246
# Key code constant: Composite #1 key.
# Switches to composite video input #1.
TV_INPUT_COMPOSITE_1 = 247
# Key code constant: Composite #2 key.
# Switches to composite video input #2.
TV_INPUT_COMPOSITE_2 = 248
# Key code constant: Component #1 key.
# Switches to component video input #1.
TV_INPUT_COMPONENT_1 = 249
# Key code constant: Component #2 key.
# Switches to component video input #2.
TV_INPUT_COMPONENT_2 = 250
# Key code constant: VGA #1 key.
# Switches to VGA (analog RGB) input #1.
TV_INPUT_VGA_1 = 251
# Key code constant: Audio description key.
# Toggles audio description off / on.
TV_AUDIO_DESCRIPTION = 252
# Key code constant: Audio description mixing volume up key.
# Louden audio description volume as compared with normal audio volume.
TV_AUDIO_DESCRIPTION_MIX_UP = 253
# Key code constant: Audio description mixing volume down key.
# Lessen audio description volume as compared with normal audio volume.
TV_AUDIO_DESCRIPTION_MIX_DOWN = 254
# Key code constant: Zoom mode key.
# Changes Zoom mode (Normal, Full, Zoom, Wide-zoom, etc.)
TV_ZOOM_MODE = 255
# Key code constant: Contents menu key.
# Goes to the title list. Corresponds to Contents Menu (0x0B) of CEC User Control
# Code
TV_CONTENTS_MENU = 256
# Key code constant: Media context menu key.
# Goes to the context menu of media contents. Corresponds to Media Context-sensitive
# Menu (0x11) of CEC User Control Code.
TV_MEDIA_CONTEXT_MENU = 257
# Key code constant: Timer programming key.
# Goes to the timer recording menu. Corresponds to Timer Programming (0x54) of
# CEC User Control Code.
TV_TIMER_PROGRAMMING = 258
# Key code constant: Help key.
HELP = 259
# Key code constant: Navigate to previous key.
# Goes backward by one item in an ordered collection of items.
NAVIGATE_PREVIOUS = 260
# Key code constant: Navigate to next key.
# Advances to the next item in an ordered collection of items.
NAVIGATE_NEXT = 261
# Key code constant: Navigate in key.
# Activates the item that currently has focus or expands to the next level of a navigation
# hierarchy.
NAVIGATE_IN = 262
# Key code constant: Navigate out key.
# Backs out one level of a navigation hierarchy or collapses the item that currently has
# focus.
NAVIGATE_OUT = 263
# Key code constant: Primary stem key for Wear.
# Main power/reset button on watch.
STEM_PRIMARY = 264
# Key code constant: Generic stem key 1 for Wear.
STEM_1 = 265
# Key code constant: Generic stem key 2 for Wear.
STEM_2 = 266
# Key code constant: Generic stem key 3 for Wear.
STEM_3 = 267
# Key code constant: Directional Pad Up-Left.
DPAD_UP_LEFT = 268
# Key code constant: Directional Pad Down-Left.
DPAD_DOWN_LEFT = 269
# Key code constant: Directional Pad Up-Right.
DPAD_UP_RIGHT = 270
# Key code constant: Directional Pad Down-Right.
DPAD_DOWN_RIGHT = 271
# Key code constant: Skip forward media key.
MEDIA_SKIP_FORWARD = 272
# Key code constant: Skip backward media key.
MEDIA_SKIP_BACKWARD = 273
# Key code constant: Step forward media key.
# Steps media forward, one frame at a time.
MEDIA_STEP_FORWARD = 274
# Key code constant: Step backward media key.
# Steps media backward, one frame at a time.
MEDIA_STEP_BACKWARD = 275
# Key code constant: put device to sleep unless a wakelock is held.
SOFT_SLEEP = 276
# Key code constant: Cut key.
CUT = 277
# Key code constant: Copy key.
COPY = 278
gamepad_buttons = [BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_X,
BUTTON_Y, BUTTON_Z, BUTTON_L1, BUTTON_R1,
BUTTON_L2, BUTTON_R2, BUTTON_THUMBL, BUTTON_THUMBR,
BUTTON_START, BUTTON_SELECT, BUTTON_MODE, BUTTON_1,
BUTTON_2, BUTTON_3, BUTTON_4, BUTTON_5, BUTTON_6,
BUTTON_7, BUTTON_8, BUTTON_9, BUTTON_10,
BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14,
BUTTON_15, BUTTON_16]
@staticmethod
def is_gamepad_button(code):
"""Returns true if the specified nativekey is a gamepad button."""
return code in AndroidKey.gamepad_buttons
confirm_buttons = [DPAD_CENTER, ENTER, SPACE, NUMPAD_ENTER]
@staticmethod
def is_confirm_key(code):
"""Returns true if the key will, by default, trigger a click on the focused view."""
return code in AndroidKey.confirm_buttons
media_buttons = [MEDIA_PLAY, MEDIA_PAUSE, MEDIA_PLAY_PAUSE,
MUTE, HEADSETHOOK, MEDIA_STOP, MEDIA_NEXT, MEDIA_PREVIOUS,
MEDIA_REWIND, MEDIA_RECORD, MEDIA_FAST_FORWARD]
@staticmethod
def is_media_key(code):
"""Returns true if this key is a media key, which can be send to apps that are
interested in media key events."""
return code in AndroidKey.media_buttons
system_buttons = [MENU, SOFT_RIGHT, HOME, BACK, CALL,
ENDCALL, VOLUME_UP, VOLUME_DOWN, VOLUME_MUTE, MUTE,
POWER, HEADSETHOOK, MEDIA_PLAY, MEDIA_PAUSE,
MEDIA_PLAY_PAUSE, MEDIA_STOP, MEDIA_NEXT,
MEDIA_PREVIOUS, MEDIA_REWIND, MEDIA_RECORD,
MEDIA_FAST_FORWARD, CAMERA, FOCUS, SEARCH,
BRIGHTNESS_DOWN, BRIGHTNESS_UP, MEDIA_AUDIO_TRACK]
@staticmethod
def is_system_key(code):
"""Returns true if the key is a system key, System keys can not be used for menu shortcuts."""
return code in AndroidKey.system_buttons
wake_buttons = [BACK, MENU, WAKEUP, PAIRING, STEM_1, STEM_2, STEM_3]
@staticmethod
def is_wake_key(code):
"""Returns true if the key is a wake key."""
return code in AndroidKey.wake_buttons
| class Androidkey:
unknown = 0
soft_left = 1
soft_right = 2
home = 3
back = 4
call = 5
endcall = 6
digit_0 = 7
digit_1 = 8
digit_2 = 9
digit_3 = 10
digit_4 = 11
digit_5 = 12
digit_6 = 13
digit_7 = 14
digit_8 = 15
digit_9 = 16
star = 17
pound = 18
dpad_up = 19
dpad_down = 20
dpad_left = 21
dpad_right = 22
dpad_center = 23
volume_up = 24
volume_down = 25
power = 26
camera = 27
clear = 28
a = 29
b = 30
c = 31
d = 32
e = 33
f = 34
g = 35
h = 36
i = 37
j = 38
k = 39
l = 40
m = 41
n = 42
o = 43
p = 44
q = 45
r = 46
s = 47
t = 48
u = 49
v = 50
w = 51
x = 52
y = 53
z = 54
comma = 55
period = 56
alt_left = 57
alt_right = 58
shift_left = 59
shift_right = 60
tab = 61
space = 62
sym = 63
explorer = 64
envelope = 65
enter = 66
del = 67
grave = 68
minus = 69
equals = 70
left_bracket = 71
right_bracket = 72
backslash = 73
semicolon = 74
apostrophe = 75
slash = 76
at = 77
num = 78
headsethook = 79
focus = 80
plus = 81
menu = 82
notification = 83
search = 84
media_play_pause = 85
media_stop = 86
media_next = 87
media_previous = 88
media_rewind = 89
media_fast_forward = 90
mute = 91
page_up = 92
page_down = 93
pictsymbols = 94
switch_charset = 95
button_a = 96
button_b = 97
button_c = 98
button_x = 99
button_y = 100
button_z = 101
button_l1 = 102
button_r1 = 103
button_l2 = 104
button_r2 = 105
button_thumbl = 106
button_thumbr = 107
button_start = 108
button_select = 109
button_mode = 110
escape = 111
forward_del = 112
ctrl_left = 113
ctrl_right = 114
caps_lock = 115
scroll_lock = 116
meta_left = 117
meta_right = 118
function = 119
sysrq = 120
break = 121
move_home = 122
move_end = 123
insert = 124
forward = 125
media_play = 126
media_pause = 127
media_close = 128
media_eject = 129
media_record = 130
f1 = 131
f2 = 132
f3 = 133
f4 = 134
f5 = 135
f6 = 136
f7 = 137
f8 = 138
f9 = 139
f10 = 140
f11 = 141
f12 = 142
num_lock = 143
numpad_0 = 144
numpad_1 = 145
numpad_2 = 146
numpad_3 = 147
numpad_4 = 148
numpad_5 = 149
numpad_6 = 150
numpad_7 = 151
numpad_8 = 152
numpad_9 = 153
numpad_divide = 154
numpad_multiply = 155
numpad_subtract = 156
numpad_add = 157
numpad_dot = 158
numpad_comma = 159
numpad_enter = 160
numpad_equals = 161
numpad_left_paren = 162
numpad_right_paren = 163
volume_mute = 164
info = 165
channel_up = 166
channel_down = 167
keycode_zoom_in = 168
keycode_zoom_out = 169
tv = 170
window = 171
guide = 172
dvr = 173
bookmark = 174
captions = 175
settings = 176
tv_power = 177
tv_input = 178
stb_power = 179
stb_input = 180
avr_power = 181
avr_input = 182
prog_red = 183
prog_green = 184
prog_yellow = 185
prog_blue = 186
app_switch = 187
button_1 = 188
button_2 = 189
button_3 = 190
button_4 = 191
button_5 = 192
button_6 = 193
button_7 = 194
button_8 = 195
button_9 = 196
button_10 = 197
button_11 = 198
button_12 = 199
button_13 = 200
button_14 = 201
button_15 = 202
button_16 = 203
language_switch = 204
manner_mode = 205
mode_3_d = 206
contacts = 207
calendar = 208
music = 209
calculator = 210
zenkaku_hankaku = 211
eisu = 212
muhenkan = 213
henkan = 214
katakana_hiragana = 215
yen = 216
ro = 217
kana = 218
assist = 219
brightness_down = 220
brightness_up = 221
media_audio_track = 222
sleep = 223
wakeup = 224
pairing = 225
media_top_menu = 226
key_11 = 227
key_12 = 228
last_channel = 229
tv_data_service = 230
voice_assist = 231
tv_radio_service = 232
tv_teletext = 233
tv_number_entry = 234
tv_terrestrial_analog = 235
tv_terrestrial_digital = 236
tv_satellite = 237
tv_satellite_bs = 238
tv_satellite_cs = 239
tv_satellite_service = 240
tv_network = 241
tv_antenna_cable = 242
tv_input_hdmi_1 = 243
tv_input_hdmi_2 = 244
tv_input_hdmi_3 = 245
tv_input_hdmi_4 = 246
tv_input_composite_1 = 247
tv_input_composite_2 = 248
tv_input_component_1 = 249
tv_input_component_2 = 250
tv_input_vga_1 = 251
tv_audio_description = 252
tv_audio_description_mix_up = 253
tv_audio_description_mix_down = 254
tv_zoom_mode = 255
tv_contents_menu = 256
tv_media_context_menu = 257
tv_timer_programming = 258
help = 259
navigate_previous = 260
navigate_next = 261
navigate_in = 262
navigate_out = 263
stem_primary = 264
stem_1 = 265
stem_2 = 266
stem_3 = 267
dpad_up_left = 268
dpad_down_left = 269
dpad_up_right = 270
dpad_down_right = 271
media_skip_forward = 272
media_skip_backward = 273
media_step_forward = 274
media_step_backward = 275
soft_sleep = 276
cut = 277
copy = 278
gamepad_buttons = [BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_X, BUTTON_Y, BUTTON_Z, BUTTON_L1, BUTTON_R1, BUTTON_L2, BUTTON_R2, BUTTON_THUMBL, BUTTON_THUMBR, BUTTON_START, BUTTON_SELECT, BUTTON_MODE, BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4, BUTTON_5, BUTTON_6, BUTTON_7, BUTTON_8, BUTTON_9, BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14, BUTTON_15, BUTTON_16]
@staticmethod
def is_gamepad_button(code):
"""Returns true if the specified nativekey is a gamepad button."""
return code in AndroidKey.gamepad_buttons
confirm_buttons = [DPAD_CENTER, ENTER, SPACE, NUMPAD_ENTER]
@staticmethod
def is_confirm_key(code):
"""Returns true if the key will, by default, trigger a click on the focused view."""
return code in AndroidKey.confirm_buttons
media_buttons = [MEDIA_PLAY, MEDIA_PAUSE, MEDIA_PLAY_PAUSE, MUTE, HEADSETHOOK, MEDIA_STOP, MEDIA_NEXT, MEDIA_PREVIOUS, MEDIA_REWIND, MEDIA_RECORD, MEDIA_FAST_FORWARD]
@staticmethod
def is_media_key(code):
"""Returns true if this key is a media key, which can be send to apps that are
interested in media key events."""
return code in AndroidKey.media_buttons
system_buttons = [MENU, SOFT_RIGHT, HOME, BACK, CALL, ENDCALL, VOLUME_UP, VOLUME_DOWN, VOLUME_MUTE, MUTE, POWER, HEADSETHOOK, MEDIA_PLAY, MEDIA_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_STOP, MEDIA_NEXT, MEDIA_PREVIOUS, MEDIA_REWIND, MEDIA_RECORD, MEDIA_FAST_FORWARD, CAMERA, FOCUS, SEARCH, BRIGHTNESS_DOWN, BRIGHTNESS_UP, MEDIA_AUDIO_TRACK]
@staticmethod
def is_system_key(code):
"""Returns true if the key is a system key, System keys can not be used for menu shortcuts."""
return code in AndroidKey.system_buttons
wake_buttons = [BACK, MENU, WAKEUP, PAIRING, STEM_1, STEM_2, STEM_3]
@staticmethod
def is_wake_key(code):
"""Returns true if the key is a wake key."""
return code in AndroidKey.wake_buttons |
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) |
class SampleSheetError(Exception):
"""An exception raised when errors are encountered with a sample sheet.
Examples include when a sample sheet can't be parsed because it's garbled, or
if IRIDA rejects the creation of a run because fields are missing or invalid
from the sample sheet.
"""
def __init__(self, message, errors):
"""Initalize a SampleSheetError.
Args:
message: a summary message that's causing the error.
errors: a more detailed list of errors.
"""
self._message = message
self._errors = errors
@property
def message(self):
return self._message
@property
def errors(self):
return self._errors
def __str__(self):
return self.message
| class Samplesheeterror(Exception):
"""An exception raised when errors are encountered with a sample sheet.
Examples include when a sample sheet can't be parsed because it's garbled, or
if IRIDA rejects the creation of a run because fields are missing or invalid
from the sample sheet.
"""
def __init__(self, message, errors):
"""Initalize a SampleSheetError.
Args:
message: a summary message that's causing the error.
errors: a more detailed list of errors.
"""
self._message = message
self._errors = errors
@property
def message(self):
return self._message
@property
def errors(self):
return self._errors
def __str__(self):
return self.message |
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""File's labels and properties."""
class TransformationCSVFields(object):
"""To transformation fields of CSV files."""
# pylint: disable=too-few-public-methods
REVISION_DATE = "Revision Date"
| """File's labels and properties."""
class Transformationcsvfields(object):
"""To transformation fields of CSV files."""
revision_date = 'Revision Date' |
class Container:
"""A container that holds objects.
This is an abstract class. Only child classes should be instantiated.
"""
def add(self, item):
"""Add <item> to this Container.
@type self: Container
@type item: Object
@rtype: None
"""
raise NotImplementedError("Implemented in a subclass")
def remove(self):
"""Remove and return a single item from this Container.
@type self: Container
@rtype: Object
"""
raise NotImplementedError("Implemented in a subclass")
def is_empty(self):
"""Return True iff this Container is empty.
@type self: Container
@rtype: bool
"""
raise NotImplementedError("Implemented in a subclass")
class PriorityQueue(Container):
"""A queue of items that operates in priority order.
Items are removed from the queue according to priority; the item with the
highest priority is removed first. Ties are resolved in FIFO order,
meaning the item which was inserted *earlier* is the first one to be
removed.
Priority is defined by the rich comparison methods for the objects in the
container (__lt__, __le__, __gt__, __ge__).
If x < y, then x has a *HIGHER* priority than y.
All objects in the container must be of the same type.
"""
# === Private Attributes ===
# @type _items: list
# The items stored in the priority queue.
#
# === Representation Invariants ===
# _items is a sorted list, where the first item in the queue is the
# item with the highest priority.
def __init__(self):
"""Initialize an empty PriorityQueue.
@type self: PriorityQueue
@rtype: None
"""
self._items = []
def remove(self):
"""Remove and return the next item from this PriorityQueue.
Precondition: <self> should not be empty.
@type self: PriorityQueue
@rtype: object
>>> pq = PriorityQueue()
>>> pq.add("red")
>>> pq.add("blue")
>>> pq.add("yellow")
>>> pq.add("green")
>>> pq.remove()
'blue'
>>> pq.remove()
'green'
>>> pq.remove()
'red'
>>> pq.remove()
'yellow'
"""
return self._items.pop(0)
def is_empty(self):
"""
Return true iff this PriorityQueue is empty.
@type self: PriorityQueue
@rtype: bool
>>> pq = PriorityQueue()
>>> pq.is_empty()
True
>>> pq.add("thing")
>>> pq.is_empty()
False
"""
return len(self._items) == 0
def add(self, item):
"""Add <item> to this PriorityQueue.
@type self: PriorityQueue
@type item: object
@rtype: None
>>> pq = PriorityQueue()
>>> pq.add("yellow")
>>> pq.add("blue")
>>> pq.add("red")
>>> pq.add("green")
>>> pq._items
['blue', 'green', 'red', 'yellow']
"""
self._items.append(item)
self._items.sort()
| class Container:
"""A container that holds objects.
This is an abstract class. Only child classes should be instantiated.
"""
def add(self, item):
"""Add <item> to this Container.
@type self: Container
@type item: Object
@rtype: None
"""
raise not_implemented_error('Implemented in a subclass')
def remove(self):
"""Remove and return a single item from this Container.
@type self: Container
@rtype: Object
"""
raise not_implemented_error('Implemented in a subclass')
def is_empty(self):
"""Return True iff this Container is empty.
@type self: Container
@rtype: bool
"""
raise not_implemented_error('Implemented in a subclass')
class Priorityqueue(Container):
"""A queue of items that operates in priority order.
Items are removed from the queue according to priority; the item with the
highest priority is removed first. Ties are resolved in FIFO order,
meaning the item which was inserted *earlier* is the first one to be
removed.
Priority is defined by the rich comparison methods for the objects in the
container (__lt__, __le__, __gt__, __ge__).
If x < y, then x has a *HIGHER* priority than y.
All objects in the container must be of the same type.
"""
def __init__(self):
"""Initialize an empty PriorityQueue.
@type self: PriorityQueue
@rtype: None
"""
self._items = []
def remove(self):
"""Remove and return the next item from this PriorityQueue.
Precondition: <self> should not be empty.
@type self: PriorityQueue
@rtype: object
>>> pq = PriorityQueue()
>>> pq.add("red")
>>> pq.add("blue")
>>> pq.add("yellow")
>>> pq.add("green")
>>> pq.remove()
'blue'
>>> pq.remove()
'green'
>>> pq.remove()
'red'
>>> pq.remove()
'yellow'
"""
return self._items.pop(0)
def is_empty(self):
"""
Return true iff this PriorityQueue is empty.
@type self: PriorityQueue
@rtype: bool
>>> pq = PriorityQueue()
>>> pq.is_empty()
True
>>> pq.add("thing")
>>> pq.is_empty()
False
"""
return len(self._items) == 0
def add(self, item):
"""Add <item> to this PriorityQueue.
@type self: PriorityQueue
@type item: object
@rtype: None
>>> pq = PriorityQueue()
>>> pq.add("yellow")
>>> pq.add("blue")
>>> pq.add("red")
>>> pq.add("green")
>>> pq._items
['blue', 'green', 'red', 'yellow']
"""
self._items.append(item)
self._items.sort() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.