content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Can 31 dominoes cover all but two opposite corners of a chess board? def dominoes(): # Each dominoe must cover one black and one white square. # But there are different numbers of black and white squares. # Read up on such parity arguments here: # http://ihxrelation.blogspot.com/2015/10/tiling-problems.html return False
def dominoes(): return False
def merger_first_into_second(arr1, arr2): p1 = len(arr1) - 1 runner = len(arr2) - 1 # Assuming arr2 is the padded p2 = len(arr2) - len(arr1) - 1 while p1 >= 0 or p2 >= 0 and p1 != runner and p2 != runner: if p1 >= 0 and p2 >= 0: if arr1[p1] > arr2[p2]: arr2[runner] = arr1[p1] p1 -= 1 else: arr2[runner] = arr2[p2] p2 -= 1 elif p1 >= 0: arr2[runner] = arr1[p1] p1 -= 1 else: arr2[runner] = arr2[p2] p2 -= 1 runner -= 1
def merger_first_into_second(arr1, arr2): p1 = len(arr1) - 1 runner = len(arr2) - 1 p2 = len(arr2) - len(arr1) - 1 while p1 >= 0 or (p2 >= 0 and p1 != runner and (p2 != runner)): if p1 >= 0 and p2 >= 0: if arr1[p1] > arr2[p2]: arr2[runner] = arr1[p1] p1 -= 1 else: arr2[runner] = arr2[p2] p2 -= 1 elif p1 >= 0: arr2[runner] = arr1[p1] p1 -= 1 else: arr2[runner] = arr2[p2] p2 -= 1 runner -= 1
# strings_with_backspaces # given strings with backspace character '#' # check if they are equal def strings_with_backspaces(str1, str2): p = len(str1)-1 q = len(str2)-1 while p >= 0 and q >= 0: # handle backspace character if str1[p] == '#': p = p - 2 if str2[q] == '#': q = q - 2 # compare characters if p >= 0 and q >= 0: if str1[p] != str2[q]: return False else: return False p = p - 1 q = q - 1 # p must equal q for, string equality return p == q def main(): str1 = "xy#z" str2 = "xzz#" res = strings_with_backspaces(str1, str2) print(f'{res}') if __name__ == "__main__": main()
def strings_with_backspaces(str1, str2): p = len(str1) - 1 q = len(str2) - 1 while p >= 0 and q >= 0: if str1[p] == '#': p = p - 2 if str2[q] == '#': q = q - 2 if p >= 0 and q >= 0: if str1[p] != str2[q]: return False else: return False p = p - 1 q = q - 1 return p == q def main(): str1 = 'xy#z' str2 = 'xzz#' res = strings_with_backspaces(str1, str2) print(f'{res}') if __name__ == '__main__': main()
expected_output = { "interfaces": { "Ethernet1/1": { "interface": "Ethernet1/1", "statistics": { "txreq": 0, "rxlogoff": 0, "txtotal": 3, "txreqid": 0, "lastrxsrcmac": "00:00:00:ff:00:00", "rxinvalid": 0, "rxrespid": 0, "rxlenerr": 0, "rxversion": 0, "rxstart": 0, "rxresp": 0, "rxtotal": 0, }, } } }
expected_output = {'interfaces': {'Ethernet1/1': {'interface': 'Ethernet1/1', 'statistics': {'txreq': 0, 'rxlogoff': 0, 'txtotal': 3, 'txreqid': 0, 'lastrxsrcmac': '00:00:00:ff:00:00', 'rxinvalid': 0, 'rxrespid': 0, 'rxlenerr': 0, 'rxversion': 0, 'rxstart': 0, 'rxresp': 0, 'rxtotal': 0}}}}
FreeSerifBold18pt7bBitmaps = [ 0x7B, 0xEF, 0xFF, 0xFF, 0xF7, 0x9E, 0x71, 0xC7, 0x0C, 0x20, 0x82, 0x00, 0x00, 0x07, 0x3E, 0xFF, 0xFF, 0xDC, 0x60, 0x37, 0x83, 0xFC, 0x1F, 0xE0, 0xFF, 0x07, 0xB8, 0x3D, 0xC0, 0xCC, 0x06, 0x20, 0x31, 0x01, 0x80, 0x03, 0x8E, 0x00, 0xC3, 0x80, 0x30, 0xE0, 0x1C, 0x38, 0x07, 0x0E, 0x01, 0xC3, 0x87, 0xFF, 0xFD, 0xFF, 0xFF, 0x7F, 0xFF, 0xC1, 0x87, 0x00, 0xE1, 0xC0, 0x38, 0x70, 0x0E, 0x1C, 0x03, 0x86, 0x0F, 0xFF, 0xF3, 0xFF, 0xFC, 0xFF, 0xFF, 0x07, 0x0E, 0x01, 0xC3, 0x80, 0x70, 0xE0, 0x1C, 0x30, 0x07, 0x0C, 0x01, 0x87, 0x00, 0x61, 0xC0, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0xFF, 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0, 6, 24, 12, 3, -23 ], # 0x21 '!' [ 18, 13, 10, 19, 3, -23 ], # 0x22 '"' [ 35, 18, 24, 17, 0, -23 ], # 0x23 '#' [ 89, 15, 28, 17, 1, -25 ], # 0x24 '$' [ 142, 27, 24, 35, 4, -23 ], # 0x25 '%' [ 223, 26, 25, 29, 2, -23 ], # 0x26 '&' [ 305, 4, 10, 10, 3, -23 ], # 0x27 ''' [ 310, 9, 30, 12, 2, -23 ], # 0x28 '(' [ 344, 9, 30, 12, 1, -23 ], # 0x29 ')' [ 378, 14, 15, 18, 2, -23 ], # 0x2A '#' [ 405, 19, 19, 24, 2, -17 ], # 0x2B '+' [ 451, 6, 12, 9, 1, -5 ], # 0x2C ',' [ 460, 8, 4, 12, 2, -9 ], # 0x2D '-' [ 464, 6, 6, 9, 1, -5 ], # 0x2E '.' [ 469, 11, 25, 10, -1, -23 ], # 0x2F '/' [ 504, 16, 24, 18, 1, -23 ], # 0x30 '0' [ 552, 12, 24, 18, 3, -23 ], # 0x31 '1' [ 588, 16, 24, 17, 1, -23 ], # 0x32 '2' [ 636, 16, 24, 18, 0, -23 ], # 0x33 '3' [ 684, 15, 24, 18, 1, -23 ], # 0x34 '4' [ 729, 15, 24, 18, 1, -23 ], # 0x35 '5' [ 774, 16, 24, 18, 1, -23 ], # 0x36 '6' [ 822, 16, 24, 17, 1, -23 ], # 0x37 '7' [ 870, 16, 24, 17, 1, -23 ], # 0x38 '8' [ 918, 16, 24, 18, 1, -23 ], # 0x39 '9' [ 966, 6, 16, 12, 3, -15 ], # 0x3A ':' [ 978, 7, 22, 12, 2, -15 ], # 0x3B '' [ 998, 19, 20, 24, 2, -18 ], # 0x3C '<' [ 1046, 19, 12, 24, 2, -14 ], # 0x3D '=' [ 1075, 19, 20, 24, 3, -18 ], # 0x3E '>' [ 1123, 14, 24, 18, 2, -23 ], # 0x3F '?' [ 1165, 24, 25, 33, 4, -23 ], # 0x40 '@' [ 1240, 24, 24, 25, 1, -23 ], # 0x41 'A' [ 1312, 21, 24, 23, 1, -23 ], # 0x42 'B' [ 1375, 23, 25, 25, 1, -23 ], # 0x43 'C' [ 1447, 23, 24, 26, 1, -23 ], # 0x44 'D' [ 1516, 21, 24, 23, 2, -23 ], # 0x45 'E' [ 1579, 19, 24, 22, 2, -23 ], # 0x46 'F' [ 1636, 25, 25, 27, 1, -23 ], # 0x47 'G' [ 1715, 24, 24, 27, 2, -23 ], # 0x48 'H' [ 1787, 11, 24, 14, 2, -23 ], # 0x49 'I' [ 1820, 16, 27, 18, 0, -23 ], # 0x4A 'J' [ 1874, 25, 24, 27, 2, -23 ], # 0x4B 'K' [ 1949, 21, 24, 23, 2, -23 ], # 0x4C 'L' [ 2012, 31, 24, 33, 1, -23 ], # 0x4D 'M' [ 2105, 23, 24, 25, 1, -23 ], # 0x4E 'N' [ 2174, 25, 25, 27, 1, -23 ], # 0x4F 'O' [ 2253, 19, 24, 22, 2, -23 ], # 0x50 'P' [ 2310, 25, 30, 27, 1, -23 ], # 0x51 'Q' [ 2404, 23, 24, 25, 2, -23 ], # 0x52 'R' [ 2473, 16, 25, 20, 2, -23 ], # 0x53 'S' [ 2523, 21, 24, 23, 1, -23 ], # 0x54 'T' [ 2586, 22, 25, 25, 2, -23 ], # 0x55 'U' [ 2655, 24, 24, 25, 0, -23 ], # 0x56 'V' [ 2727, 34, 25, 34, 0, -23 ], # 0x57 'W' [ 2834, 24, 24, 25, 1, -23 ], # 0x58 'X' [ 2906, 24, 24, 25, 1, -23 ], # 0x59 'Y' [ 2978, 21, 24, 23, 1, -23 ], # 0x5A 'Z' [ 3041, 8, 29, 12, 2, -23 ], # 0x5B '[' [ 3070, 11, 25, 10, -1, -23 ], # 0x5C '\' [ 3105, 8, 29, 12, 2, -23 ], # 0x5D ']' [ 3134, 15, 13, 20, 3, -23 ], # 0x5E '^' [ 3159, 18, 3, 17, 0, 3 ], # 0x5F '_' [ 3166, 8, 6, 12, 0, -23 ], # 0x60 '`' [ 3172, 16, 16, 18, 1, -15 ], # 0x61 'a' [ 3204, 18, 24, 19, 1, -23 ], # 0x62 'b' [ 3258, 14, 16, 15, 1, -15 ], # 0x63 'c' [ 3286, 18, 24, 19, 1, -23 ], # 0x64 'd' [ 3340, 14, 16, 16, 1, -15 ], # 0x65 'e' [ 3368, 11, 24, 14, 2, -23 ], # 0x66 'f' [ 3401, 17, 23, 17, 1, -15 ], # 0x67 'g' [ 3450, 17, 24, 19, 1, -23 ], # 0x68 'h' [ 3501, 7, 24, 10, 2, -23 ], # 0x69 'i' [ 3522, 11, 31, 14, 0, -23 ], # 0x6A 'j' [ 3565, 18, 24, 19, 1, -23 ], # 0x6B 'k' [ 3619, 7, 24, 10, 1, -23 ], # 0x6C 'l' [ 3640, 27, 16, 29, 1, -15 ], # 0x6D 'm' [ 3694, 17, 16, 19, 1, -15 ], # 0x6E 'n' [ 3728, 17, 16, 18, 1, -15 ], # 0x6F 'o' [ 3762, 19, 23, 19, 0, -15 ], # 0x70 'p' [ 3817, 17, 23, 19, 1, -15 ], # 0x71 'q' [ 3866, 13, 16, 15, 1, -15 ], # 0x72 'r' [ 3892, 12, 16, 14, 1, -15 ], # 0x73 's' [ 3916, 10, 21, 12, 1, -20 ], # 0x74 't' [ 3943, 18, 16, 20, 1, -15 ], # 0x75 'u' [ 3979, 17, 16, 17, 0, -15 ], # 0x76 'v' [ 4013, 24, 16, 25, 0, -15 ], # 0x77 'w' [ 4061, 16, 16, 18, 1, -15 ], # 0x78 'x' [ 4093, 16, 23, 17, 0, -15 ], # 0x79 'y' [ 4139, 14, 16, 16, 0, -15 ], # 0x7A 'z' [ 4167, 11, 31, 14, 1, -24 ], # 0x7B '[' [ 4210, 3, 25, 8, 2, -23 ], # 0x7C '|' [ 4220, 11, 31, 14, 3, -24 ], # 0x7D ']' [ 4263, 16, 5, 18, 1, -11 ] ] # 0x7E '~' FreeSerifBold18pt7b = [ FreeSerifBold18pt7bBitmaps, FreeSerifBold18pt7bGlyphs, 0x20, 0x7E, 42 ] # Approx. 4945 bytes
free_serif_bold18pt7b_bitmaps = [123, 239, 255, 255, 247, 158, 113, 199, 12, 32, 130, 0, 0, 7, 62, 255, 255, 220, 96, 55, 131, 252, 31, 224, 255, 7, 184, 61, 192, 204, 6, 32, 49, 1, 128, 3, 142, 0, 195, 128, 48, 224, 28, 56, 7, 14, 1, 195, 135, 255, 253, 255, 255, 127, 255, 193, 135, 0, 225, 192, 56, 112, 14, 28, 3, 134, 15, 255, 243, 255, 252, 255, 255, 7, 14, 1, 195, 128, 112, 224, 28, 48, 7, 12, 1, 135, 0, 97, 192, 2, 0, 4, 0, 8, 0, 255, 3, 39, 140, 71, 56, 134, 113, 12, 242, 9, 244, 3, 248, 3, 248, 7, 252, 3, 252, 3, 254, 1, 254, 3, 252, 4, 252, 8, 250, 16, 244, 33, 236, 67, 216, 143, 61, 60, 63, 240, 31, 0, 8, 0, 16, 0, 3, 192, 24, 1, 254, 15, 0, 124, 255, 192, 31, 15, 144, 7, 193, 6, 0, 240, 33, 128, 62, 4, 48, 7, 129, 140, 0, 240, 33, 128, 30, 12, 96, 3, 193, 24, 30, 60, 227, 15, 231, 248, 195, 230, 60, 24, 248, 64, 6, 62, 8, 1, 135, 129, 0, 49, 240, 32, 12, 62, 4, 1, 135, 129, 0, 96, 240, 96, 24, 30, 8, 3, 3, 199, 0, 192, 63, 192, 24, 3, 224, 0, 126, 0, 0, 127, 224, 0, 56, 248, 0, 30, 31, 0, 7, 131, 192, 1, 240, 240, 0, 124, 56, 0, 31, 156, 0, 3, 252, 0, 0, 254, 15, 240, 63, 128, 240, 31, 240, 24, 28, 254, 12, 14, 31, 195, 7, 135, 241, 129, 224, 254, 64, 248, 31, 240, 63, 7, 248, 15, 192, 254, 3, 248, 31, 192, 254, 7, 248, 159, 227, 255, 231, 255, 159, 240, 255, 195, 248, 15, 128, 60, 0, 111, 255, 255, 102, 102, 0, 129, 129, 129, 129, 128, 192, 224, 112, 112, 56, 60, 30, 15, 7, 131, 193, 224, 240, 120, 60, 14, 7, 3, 128, 224, 112, 24, 6, 1, 0, 64, 16, 4, 128, 48, 12, 3, 0, 192, 96, 56, 28, 7, 3, 129, 192, 240, 120, 60, 30, 15, 7, 131, 193, 224, 224, 112, 56, 56, 28, 12, 12, 6, 4, 4, 4, 0, 3, 0, 30, 0, 120, 29, 230, 251, 61, 237, 243, 255, 1, 192, 127, 243, 237, 255, 51, 217, 230, 7, 128, 30, 0, 48, 0, 0, 224, 0, 28, 0, 3, 128, 0, 112, 0, 14, 0, 1, 192, 0, 56, 0, 7, 0, 255, 255, 255, 255, 255, 255, 255, 128, 112, 0, 14, 0, 1, 192, 0, 56, 0, 7, 0, 0, 224, 0, 28, 0, 3, 128, 0, 115, 239, 255, 253, 240, 194, 24, 198, 48, 255, 255, 255, 255, 123, 255, 255, 253, 224, 0, 224, 60, 7, 0, 224, 28, 7, 0, 224, 28, 7, 0, 224, 28, 7, 0, 224, 28, 7, 0, 224, 28, 7, 0, 224, 28, 7, 0, 224, 28, 7, 0, 224, 0, 3, 192, 14, 112, 30, 120, 60, 60, 60, 60, 124, 62, 124, 62, 124, 62, 252, 63, 252, 63, 252, 63, 252, 63, 252, 63, 252, 63, 252, 63, 252, 63, 252, 62, 124, 62, 124, 62, 60, 60, 60, 60, 30, 120, 14, 112, 3, 192, 0, 192, 60, 15, 195, 252, 79, 192, 252, 15, 192, 252, 15, 192, 252, 15, 192, 252, 15, 192, 252, 15, 192, 252, 15, 192, 252, 15, 192, 252, 15, 192, 252, 31, 239, 255, 3, 224, 15, 248, 31, 252, 63, 252, 48, 254, 96, 126, 64, 62, 0, 62, 0, 62, 0, 60, 0, 60, 0, 120, 0, 112, 0, 224, 0, 192, 1, 128, 3, 0, 6, 1, 12, 3, 31, 255, 31, 255, 63, 254, 127, 254, 255, 254, 3, 240, 15, 248, 63, 252, 33, 254, 64, 254, 0, 126, 0, 126, 0, 124, 0, 120, 0, 240, 1, 252, 3, 254, 0, 126, 0, 63, 0, 31, 0, 15, 0, 15, 0, 15, 0, 14, 112, 14, 252, 28, 254, 56, 127, 224, 63, 128, 0, 56, 0, 240, 3, 224, 7, 192, 31, 128, 95, 0, 190, 2, 124, 8, 248, 49, 240, 67, 225, 7, 196, 15, 136, 31, 32, 62, 127, 255, 255, 255, 255, 255, 255, 248, 7, 192, 15, 128, 31, 0, 62, 0, 124, 15, 254, 31, 248, 127, 240, 255, 225, 128, 3, 0, 12, 0, 24, 0, 63, 128, 255, 193, 255, 195, 255, 195, 255, 128, 63, 128, 15, 0, 14, 0, 28, 0, 24, 0, 55, 128, 79, 129, 159, 198, 63, 248, 31, 128, 0, 7, 0, 124, 1, 240, 3, 192, 15, 128, 31, 0, 31, 0, 62, 0, 126, 0, 127, 240, 127, 252, 252, 126, 252, 126, 252, 63, 252, 63, 252, 63, 252, 63, 252, 63, 124, 63, 124, 62, 60, 62, 62, 60, 30, 120, 7, 224, 127, 255, 127, 254, 127, 254, 255, 254, 255, 252, 192, 28, 128, 24, 128, 56, 0, 56, 0, 112, 0, 112, 0, 112, 0, 224, 0, 224, 0, 224, 1, 192, 1, 192, 1, 192, 3, 128, 3, 128, 7, 128, 7, 0, 7, 0, 15, 0, 15, 224, 56, 120, 112, 60, 240, 30, 240, 30, 248, 30, 248, 30, 254, 60, 127, 176, 127, 224, 63, 240, 15, 248, 31, 252, 57, 254, 112, 255, 240, 63, 240, 63, 240, 31, 240, 31, 240, 30, 120, 62, 124, 124, 63, 248, 15, 224, 7, 224, 30, 120, 60, 124, 124, 60, 124, 62, 252, 62, 252, 63, 252, 63, 252, 63, 252, 63, 252, 63, 126, 63, 126, 63, 63, 254, 15, 254, 0, 126, 0, 124, 0, 248, 0, 248, 1, 240, 3, 192, 15, 128, 62, 0, 224, 0, 123, 255, 255, 253, 224, 0, 0, 7, 191, 255, 255, 222, 57, 251, 247, 239, 199, 0, 0, 0, 1, 231, 239, 255, 255, 191, 6, 8, 48, 194, 24, 0, 0, 0, 0, 0, 12, 0, 15, 128, 7, 240, 3, 252, 1, 254, 0, 254, 0, 127, 0, 63, 128, 31, 192, 3, 248, 0, 31, 192, 0, 254, 0, 7, 240, 0, 63, 128, 1, 254, 0, 15, 224, 0, 124, 0, 1, 128, 0, 0, 255, 255, 255, 255, 255, 255, 255, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 255, 255, 255, 255, 255, 255, 240, 0, 0, 24, 0, 3, 224, 0, 127, 0, 7, 248, 0, 31, 192, 0, 254, 0, 7, 240, 0, 63, 128, 1, 252, 0, 63, 128, 31, 192, 15, 224, 7, 240, 7, 248, 3, 252, 0, 254, 0, 31, 0, 3, 0, 0, 0, 0, 0, 15, 192, 255, 199, 31, 184, 62, 240, 255, 195, 255, 15, 216, 63, 0, 248, 7, 192, 30, 0, 96, 3, 0, 8, 0, 32, 0, 128, 0, 0, 0, 0, 112, 3, 224, 31, 128, 126, 1, 248, 1, 192, 0, 127, 0, 1, 255, 224, 7, 192, 240, 15, 0, 56, 30, 0, 12, 60, 7, 6, 56, 31, 114, 120, 60, 243, 120, 120, 225, 240, 112, 225, 240, 240, 225, 240, 224, 193, 241, 225, 193, 241, 193, 193, 241, 195, 130, 241, 195, 134, 113, 199, 140, 121, 251, 248, 120, 241, 240, 60, 0, 0, 30, 0, 0, 15, 0, 0, 7, 192, 120, 3, 255, 224, 0, 127, 128, 0, 16, 0, 0, 56, 0, 0, 56, 0, 0, 120, 0, 0, 124, 0, 0, 124, 0, 0, 254, 0, 0, 254, 0, 1, 191, 0, 1, 191, 0, 1, 31, 0, 3, 31, 128, 2, 31, 128, 6, 15, 192, 6, 15, 192, 4, 7, 224, 15, 255, 224, 15, 255, 224, 24, 3, 240, 24, 3, 240, 48, 1, 248, 48, 1, 248, 112, 1, 252, 254, 15, 255, 255, 254, 7, 255, 254, 15, 225, 248, 63, 7, 193, 248, 63, 15, 193, 248, 126, 15, 195, 240, 126, 31, 135, 224, 252, 124, 7, 255, 0, 63, 255, 1, 248, 254, 15, 193, 248, 126, 15, 195, 240, 63, 31, 129, 248, 252, 15, 199, 224, 126, 63, 3, 241, 248, 63, 15, 195, 240, 255, 255, 31, 255, 192, 0, 126, 4, 7, 255, 24, 31, 7, 240, 124, 3, 225, 240, 3, 199, 192, 3, 159, 128, 3, 63, 0, 6, 124, 0, 5, 248, 0, 3, 240, 0, 7, 224, 0, 15, 192, 0, 31, 128, 0, 63, 0, 0, 126, 0, 0, 252, 0, 0, 252, 0, 1, 248, 0, 1, 240, 0, 35, 240, 0, 195, 240, 7, 3, 240, 60, 1, 255, 224, 0, 255, 0, 255, 254, 0, 127, 255, 0, 126, 31, 128, 252, 31, 129, 248, 31, 131, 240, 31, 7, 224, 63, 15, 192, 126, 31, 128, 126, 63, 0, 252, 126, 1, 248, 252, 3, 241, 248, 7, 227, 240, 15, 199, 224, 31, 143, 192, 63, 31, 128, 124, 63, 1, 248, 126, 3, 224, 252, 15, 129, 248, 31, 3, 240, 252, 15, 255, 224, 127, 255, 0, 255, 255, 227, 255, 255, 15, 192, 120, 126, 1, 195, 240, 6, 31, 128, 16, 252, 16, 135, 224, 128, 63, 12, 1, 248, 224, 15, 255, 0, 127, 248, 3, 241, 192, 31, 134, 0, 252, 16, 7, 224, 128, 63, 0, 9, 248, 0, 207, 192, 12, 126, 0, 99, 240, 15, 31, 129, 251, 255, 255, 223, 255, 252, 255, 255, 239, 255, 252, 252, 15, 159, 128, 115, 240, 6, 126, 0, 79, 193, 9, 248, 32, 63, 12, 7, 227, 128, 255, 240, 31, 254, 3, 241, 192, 126, 24, 15, 193, 1, 248, 32, 63, 0, 7, 224, 0, 252, 0, 31, 128, 3, 240, 0, 126, 0, 31, 224, 7, 255, 0, 0, 126, 2, 1, 255, 227, 1, 240, 63, 129, 240, 7, 193, 240, 1, 225, 240, 0, 113, 248, 0, 24, 252, 0, 12, 124, 0, 2, 126, 0, 0, 63, 0, 0, 31, 128, 0, 15, 192, 0, 7, 224, 0, 3, 240, 15, 255, 248, 1, 254, 124, 0, 126, 63, 0, 63, 31, 128, 31, 135, 192, 15, 193, 240, 7, 224, 252, 3, 240, 31, 131, 240, 7, 255, 224, 0, 127, 128, 0, 255, 195, 255, 127, 129, 254, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 255, 252, 63, 255, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 63, 0, 252, 127, 129, 254, 255, 195, 255, 255, 239, 240, 252, 31, 131, 240, 126, 15, 193, 248, 63, 7, 224, 252, 31, 131, 240, 126, 15, 193, 248, 63, 7, 224, 252, 31, 131, 240, 126, 31, 231, 255, 7, 255, 1, 254, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 0, 252, 112, 252, 248, 252, 248, 248, 240, 248, 113, 240, 127, 224, 31, 128, 255, 195, 255, 63, 192, 62, 15, 192, 28, 7, 224, 24, 3, 240, 24, 1, 248, 24, 0, 252, 24, 0, 126, 24, 0, 63, 24, 0, 31, 156, 0, 15, 223, 0, 7, 255, 192, 3, 255, 240, 1, 249, 248, 0, 252, 254, 0, 126, 63, 128, 63, 15, 224, 31, 131, 248, 15, 192, 252, 7, 224, 127, 3, 240, 31, 193, 248, 7, 241, 254, 3, 253, 255, 143, 255, 255, 224, 3, 252, 0, 15, 192, 0, 126, 0, 3, 240, 0, 31, 128, 0, 252, 0, 7, 224, 0, 63, 0, 1, 248, 0, 15, 192, 0, 126, 0, 3, 240, 0, 31, 128, 0, 252, 0, 7, 224, 1, 63, 0, 25, 248, 0, 207, 192, 12, 126, 0, 99, 240, 15, 31, 129, 251, 255, 255, 223, 255, 254, 255, 128, 3, 254, 127, 0, 7, 248, 126, 0, 15, 224, 254, 0, 63, 193, 124, 0, 95, 130, 252, 1, 191, 5, 248, 2, 126, 9, 248, 12, 252, 19, 240, 17, 248, 35, 224, 35, 240, 71, 224, 199, 224, 135, 193, 15, 193, 15, 198, 31, 130, 15, 136, 63, 4, 31, 176, 126, 8, 63, 96, 252, 16, 62, 129, 248, 32, 127, 3, 240, 64, 124, 7, 224, 128, 248, 15, 193, 0, 224, 31, 130, 1, 192, 63, 14, 3, 128, 255, 127, 130, 3, 255, 254, 0, 254, 254, 0, 112, 254, 0, 64, 254, 0, 129, 252, 1, 3, 252, 2, 5, 252, 4, 9, 252, 8, 17, 252, 16, 35, 248, 32, 67, 248, 64, 131, 248, 129, 3, 249, 2, 3, 250, 4, 3, 244, 8, 7, 248, 16, 7, 240, 32, 7, 224, 64, 7, 192, 128, 7, 129, 0, 15, 2, 0, 14, 14, 0, 12, 127, 0, 8, 0, 127, 0, 1, 255, 240, 1, 240, 124, 1, 240, 31, 1, 240, 7, 193, 240, 1, 241, 248, 0, 252, 252, 0, 126, 124, 0, 31, 126, 0, 15, 255, 0, 7, 255, 128, 3, 255, 192, 1, 255, 224, 0, 255, 240, 0, 127, 248, 0, 63, 124, 0, 31, 62, 0, 31, 159, 128, 15, 199, 192, 7, 193, 240, 7, 192, 252, 7, 224, 63, 7, 192, 7, 255, 192, 0, 127, 0, 0, 255, 252, 15, 255, 224, 252, 126, 31, 135, 227, 240, 126, 126, 15, 207, 193, 249, 248, 63, 63, 7, 231, 224, 252, 252, 63, 31, 143, 195, 255, 240, 127, 248, 15, 192, 1, 248, 0, 63, 0, 7, 224, 0, 252, 0, 31, 128, 3, 240, 0, 126, 0, 31, 224, 7, 254, 0, 0, 127, 0, 1, 255, 240, 1, 240, 124, 1, 240, 31, 1, 240, 7, 193, 240, 1, 241, 248, 0, 252, 252, 0, 126, 124, 0, 31, 126, 0, 15, 255, 0, 7, 255, 128, 3, 255, 192, 1, 255, 224, 0, 255, 240, 0, 127, 248, 0, 63, 124, 0, 31, 62, 0, 15, 159, 128, 15, 199, 192, 7, 193, 240, 7, 192, 120, 3, 192, 30, 7, 192, 3, 255, 128, 0, 127, 0, 0, 63, 192, 0, 15, 240, 0, 3, 254, 0, 0, 255, 248, 0, 15, 224, 255, 254, 0, 255, 255, 0, 252, 63, 1, 248, 63, 3, 240, 63, 7, 224, 126, 15, 192, 252, 31, 129, 248, 63, 3, 240, 126, 7, 192, 252, 31, 129, 248, 126, 3, 255, 240, 7, 255, 192, 15, 223, 192, 31, 159, 128, 63, 31, 128, 126, 63, 128, 252, 63, 129, 248, 63, 3, 240, 127, 7, 224, 127, 31, 224, 127, 127, 224, 255, 7, 194, 31, 242, 60, 62, 112, 14, 240, 6, 240, 6, 240, 2, 248, 0, 254, 0, 255, 128, 127, 224, 63, 248, 31, 252, 15, 254, 3, 254, 0, 255, 0, 63, 128, 31, 192, 15, 192, 15, 224, 14, 240, 30, 248, 60, 159, 248, 135, 224, 255, 255, 255, 255, 255, 252, 126, 63, 131, 240, 124, 31, 129, 192, 252, 6, 7, 224, 32, 63, 0, 1, 248, 0, 15, 192, 0, 126, 0, 3, 240, 0, 31, 128, 0, 252, 0, 7, 224, 0, 63, 0, 1, 248, 0, 15, 192, 0, 126, 0, 3, 240, 0, 31, 128, 0, 252, 0, 15, 240, 1, 255, 224, 255, 193, 253, 254, 1, 195, 240, 2, 15, 192, 8, 63, 0, 32, 252, 0, 131, 240, 2, 15, 192, 8, 63, 0, 32, 252, 0, 131, 240, 2, 15, 192, 8, 63, 0, 32, 252, 0, 131, 240, 2, 15, 192, 8, 63, 0, 32, 252, 0, 131, 240, 2, 15, 192, 24, 31, 128, 64, 126, 3, 0, 252, 24, 1, 255, 192, 0, 252, 0, 255, 240, 127, 63, 192, 30, 31, 128, 12, 31, 128, 8, 15, 192, 24, 15, 192, 24, 7, 224, 16, 7, 224, 48, 7, 224, 32, 3, 240, 96, 3, 240, 96, 1, 248, 64, 1, 248, 192, 0, 248, 128, 0, 252, 128, 0, 253, 128, 0, 127, 0, 0, 127, 0, 0, 62, 0, 0, 62, 0, 0, 30, 0, 0, 28, 0, 0, 28, 0, 0, 12, 0, 255, 231, 255, 15, 207, 224, 127, 0, 225, 248, 15, 192, 48, 126, 3, 240, 12, 31, 128, 124, 2, 3, 224, 31, 129, 128, 252, 7, 224, 96, 63, 3, 248, 16, 7, 192, 191, 12, 1, 248, 47, 195, 0, 126, 25, 240, 128, 15, 132, 124, 96, 3, 243, 15, 152, 0, 252, 195, 228, 0, 31, 32, 251, 0, 7, 248, 31, 192, 0, 252, 7, 224, 0, 63, 1, 248, 0, 15, 192, 62, 0, 1, 224, 15, 0, 0, 120, 3, 192, 0, 28, 0, 112, 0, 3, 0, 24, 0, 0, 192, 6, 0, 0, 32, 0, 128, 0, 255, 243, 254, 127, 128, 120, 63, 128, 112, 31, 192, 96, 15, 192, 192, 15, 225, 128, 7, 241, 0, 3, 243, 0, 3, 254, 0, 1, 252, 0, 0, 252, 0, 0, 254, 0, 0, 126, 0, 0, 127, 0, 0, 255, 128, 0, 159, 128, 1, 143, 192, 3, 15, 224, 6, 7, 224, 6, 7, 240, 12, 3, 248, 28, 3, 248, 60, 3, 252, 255, 15, 255, 255, 240, 255, 127, 128, 30, 63, 128, 28, 31, 128, 24, 31, 192, 16, 15, 192, 48, 7, 224, 32, 7, 224, 96, 3, 240, 192, 3, 240, 128, 1, 249, 128, 1, 255, 0, 0, 255, 0, 0, 254, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 126, 0, 0, 255, 0, 1, 255, 128, 127, 255, 243, 255, 255, 159, 1, 248, 224, 31, 134, 1, 252, 32, 15, 193, 0, 252, 0, 7, 224, 0, 126, 0, 7, 224, 0, 63, 0, 3, 240, 0, 63, 128, 1, 248, 0, 31, 128, 1, 252, 1, 15, 192, 24, 252, 0, 199, 224, 6, 126, 0, 119, 240, 7, 63, 0, 251, 255, 255, 223, 255, 254, 255, 255, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 255, 255, 224, 30, 1, 192, 56, 7, 128, 112, 14, 1, 192, 28, 3, 128, 112, 7, 0, 224, 28, 1, 192, 56, 7, 0, 112, 14, 1, 192, 28, 3, 128, 112, 15, 0, 224, 255, 255, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 255, 255, 3, 128, 15, 0, 31, 0, 126, 0, 238, 3, 156, 7, 28, 28, 56, 56, 56, 224, 113, 192, 119, 0, 238, 0, 224, 255, 255, 255, 255, 255, 255, 252, 224, 240, 120, 60, 14, 7, 15, 224, 63, 240, 120, 248, 120, 124, 120, 124, 56, 124, 0, 124, 3, 252, 30, 124, 124, 124, 252, 124, 252, 124, 252, 252, 255, 253, 127, 127, 60, 60, 252, 0, 31, 0, 7, 192, 1, 240, 0, 124, 0, 31, 0, 7, 192, 1, 240, 0, 124, 248, 31, 127, 135, 227, 241, 240, 126, 124, 15, 159, 3, 247, 192, 253, 240, 63, 124, 15, 223, 3, 247, 192, 253, 240, 62, 124, 31, 31, 143, 198, 127, 193, 7, 192, 7, 192, 127, 195, 199, 159, 30, 120, 123, 225, 207, 128, 62, 0, 248, 3, 224, 15, 128, 63, 0, 124, 0, 252, 97, 255, 3, 240, 0, 127, 0, 7, 192, 1, 240, 0, 124, 0, 31, 0, 7, 192, 1, 240, 0, 124, 7, 159, 7, 247, 195, 227, 241, 248, 124, 124, 31, 63, 7, 207, 193, 243, 240, 124, 252, 31, 63, 7, 207, 193, 241, 240, 124, 126, 31, 15, 143, 193, 253, 252, 62, 112, 15, 192, 127, 195, 199, 30, 30, 248, 123, 255, 255, 255, 254, 0, 248, 3, 224, 15, 192, 31, 3, 126, 24, 255, 193, 254, 3, 240, 15, 131, 248, 243, 190, 247, 220, 248, 31, 3, 224, 255, 31, 225, 240, 62, 7, 192, 248, 31, 3, 224, 124, 15, 129, 240, 62, 7, 192, 248, 31, 7, 248, 15, 192, 31, 255, 223, 31, 255, 7, 143, 131, 231, 193, 243, 224, 249, 240, 124, 120, 60, 30, 62, 3, 252, 3, 0, 7, 0, 7, 128, 3, 255, 241, 255, 254, 127, 255, 143, 255, 248, 1, 252, 0, 127, 0, 115, 255, 240, 127, 192, 252, 0, 62, 0, 31, 0, 15, 128, 7, 192, 3, 224, 1, 240, 0, 248, 0, 124, 124, 62, 255, 31, 207, 207, 131, 231, 193, 243, 224, 249, 240, 124, 248, 62, 124, 31, 62, 15, 159, 7, 207, 131, 231, 193, 243, 224, 249, 240, 125, 252, 127, 57, 251, 247, 231, 128, 0, 0, 252, 249, 243, 231, 207, 159, 62, 124, 249, 243, 231, 207, 159, 127, 3, 192, 252, 31, 131, 240, 60, 0, 0, 0, 0, 15, 224, 124, 15, 129, 240, 62, 7, 192, 248, 31, 3, 224, 124, 15, 129, 240, 62, 7, 192, 248, 31, 3, 224, 125, 207, 249, 238, 124, 255, 15, 128, 252, 0, 31, 0, 7, 192, 1, 240, 0, 124, 0, 31, 0, 7, 192, 1, 240, 0, 124, 127, 159, 7, 135, 193, 129, 240, 192, 124, 96, 31, 48, 7, 222, 1, 255, 192, 127, 240, 31, 62, 7, 207, 193, 241, 248, 124, 62, 31, 7, 199, 193, 251, 249, 255, 252, 249, 243, 231, 207, 159, 62, 124, 249, 243, 231, 207, 159, 62, 124, 249, 243, 231, 207, 159, 127, 252, 124, 31, 15, 191, 207, 241, 248, 255, 63, 62, 15, 131, 231, 193, 240, 124, 248, 62, 15, 159, 7, 193, 243, 224, 248, 62, 124, 31, 7, 207, 131, 224, 249, 240, 124, 31, 62, 15, 131, 231, 193, 240, 124, 248, 62, 15, 159, 7, 193, 247, 241, 252, 127, 252, 124, 62, 255, 31, 207, 207, 131, 231, 193, 243, 224, 249, 240, 124, 248, 62, 124, 31, 62, 15, 159, 7, 207, 131, 231, 193, 243, 224, 249, 240, 125, 252, 127, 7, 240, 15, 254, 15, 143, 143, 135, 231, 193, 247, 224, 255, 240, 127, 248, 63, 252, 31, 254, 15, 255, 7, 239, 131, 231, 193, 241, 241, 240, 127, 240, 15, 224, 254, 124, 7, 223, 224, 254, 62, 31, 7, 227, 224, 124, 124, 15, 207, 129, 249, 240, 63, 62, 7, 231, 192, 252, 248, 31, 159, 3, 227, 224, 252, 126, 63, 15, 191, 193, 243, 224, 62, 0, 7, 192, 0, 248, 0, 31, 0, 3, 224, 0, 126, 0, 31, 224, 0, 7, 193, 15, 249, 143, 205, 207, 195, 231, 193, 247, 224, 251, 240, 125, 248, 62, 252, 31, 126, 15, 191, 7, 223, 131, 231, 225, 241, 241, 248, 127, 124, 31, 62, 0, 31, 0, 15, 128, 7, 192, 3, 224, 1, 240, 1, 248, 1, 254, 252, 115, 239, 223, 254, 252, 247, 195, 190, 1, 240, 15, 128, 124, 3, 224, 31, 0, 248, 7, 192, 62, 1, 240, 31, 224, 30, 35, 254, 112, 238, 6, 224, 47, 128, 255, 7, 252, 63, 224, 255, 129, 248, 7, 192, 126, 14, 191, 200, 248, 4, 3, 1, 192, 240, 124, 63, 239, 249, 240, 124, 31, 7, 193, 240, 124, 31, 7, 193, 240, 124, 95, 55, 248, 254, 30, 0, 252, 127, 31, 7, 199, 193, 241, 240, 124, 124, 31, 31, 7, 199, 193, 241, 240, 124, 124, 31, 31, 7, 199, 193, 241, 240, 124, 124, 31, 31, 143, 195, 253, 252, 124, 96, 255, 159, 191, 131, 15, 129, 135, 224, 129, 240, 64, 248, 64, 62, 32, 31, 48, 7, 208, 3, 248, 0, 248, 0, 124, 0, 60, 0, 14, 0, 7, 0, 1, 0, 255, 63, 207, 126, 31, 6, 62, 15, 6, 62, 15, 132, 31, 15, 140, 31, 31, 136, 15, 23, 200, 15, 151, 216, 15, 179, 208, 7, 227, 240, 7, 227, 224, 3, 193, 224, 3, 193, 224, 3, 129, 192, 1, 128, 192, 1, 128, 128, 255, 63, 126, 12, 62, 8, 63, 24, 31, 48, 15, 224, 15, 192, 7, 224, 3, 224, 3, 240, 5, 248, 12, 248, 24, 252, 48, 126, 112, 126, 252, 255, 255, 63, 126, 12, 124, 12, 62, 8, 62, 8, 30, 24, 31, 16, 15, 48, 15, 160, 15, 160, 7, 224, 7, 192, 3, 192, 3, 128, 1, 128, 1, 128, 1, 0, 1, 0, 97, 0, 242, 0, 246, 0, 252, 0, 120, 0, 127, 253, 255, 247, 15, 208, 62, 1, 240, 15, 192, 62, 1, 240, 15, 192, 62, 1, 248, 15, 193, 62, 5, 248, 127, 255, 255, 255, 1, 224, 248, 62, 7, 128, 240, 30, 3, 192, 120, 15, 1, 224, 60, 7, 128, 240, 30, 7, 135, 128, 30, 1, 224, 60, 7, 128, 240, 30, 3, 192, 120, 15, 1, 224, 60, 7, 128, 248, 15, 128, 120, 255, 255, 255, 255, 255, 255, 255, 255, 255, 224, 240, 15, 128, 240, 15, 1, 224, 60, 7, 128, 240, 30, 3, 192, 120, 15, 1, 224, 60, 3, 192, 15, 15, 3, 192, 120, 15, 1, 224, 60, 7, 128, 240, 30, 3, 192, 120, 15, 3, 224, 248, 60, 0, 62, 0, 127, 198, 255, 255, 97, 254, 0, 124] free_serif_bold18pt7b_glyphs = [[0, 0, 0, 9, 0, 1], [0, 6, 24, 12, 3, -23], [18, 13, 10, 19, 3, -23], [35, 18, 24, 17, 0, -23], [89, 15, 28, 17, 1, -25], [142, 27, 24, 35, 4, -23], [223, 26, 25, 29, 2, -23], [305, 4, 10, 10, 3, -23], [310, 9, 30, 12, 2, -23], [344, 9, 30, 12, 1, -23], [378, 14, 15, 18, 2, -23], [405, 19, 19, 24, 2, -17], [451, 6, 12, 9, 1, -5], [460, 8, 4, 12, 2, -9], [464, 6, 6, 9, 1, -5], [469, 11, 25, 10, -1, -23], [504, 16, 24, 18, 1, -23], [552, 12, 24, 18, 3, -23], [588, 16, 24, 17, 1, -23], [636, 16, 24, 18, 0, -23], [684, 15, 24, 18, 1, -23], [729, 15, 24, 18, 1, -23], [774, 16, 24, 18, 1, -23], [822, 16, 24, 17, 1, -23], [870, 16, 24, 17, 1, -23], [918, 16, 24, 18, 1, -23], [966, 6, 16, 12, 3, -15], [978, 7, 22, 12, 2, -15], [998, 19, 20, 24, 2, -18], [1046, 19, 12, 24, 2, -14], [1075, 19, 20, 24, 3, -18], [1123, 14, 24, 18, 2, -23], [1165, 24, 25, 33, 4, -23], [1240, 24, 24, 25, 1, -23], [1312, 21, 24, 23, 1, -23], [1375, 23, 25, 25, 1, -23], [1447, 23, 24, 26, 1, -23], [1516, 21, 24, 23, 2, -23], [1579, 19, 24, 22, 2, -23], [1636, 25, 25, 27, 1, -23], [1715, 24, 24, 27, 2, -23], [1787, 11, 24, 14, 2, -23], [1820, 16, 27, 18, 0, -23], [1874, 25, 24, 27, 2, -23], [1949, 21, 24, 23, 2, -23], [2012, 31, 24, 33, 1, -23], [2105, 23, 24, 25, 1, -23], [2174, 25, 25, 27, 1, -23], [2253, 19, 24, 22, 2, -23], [2310, 25, 30, 27, 1, -23], [2404, 23, 24, 25, 2, -23], [2473, 16, 25, 20, 2, -23], [2523, 21, 24, 23, 1, -23], [2586, 22, 25, 25, 2, -23], [2655, 24, 24, 25, 0, -23], [2727, 34, 25, 34, 0, -23], [2834, 24, 24, 25, 1, -23], [2906, 24, 24, 25, 1, -23], [2978, 21, 24, 23, 1, -23], [3041, 8, 29, 12, 2, -23], [3070, 11, 25, 10, -1, -23], [3105, 8, 29, 12, 2, -23], [3134, 15, 13, 20, 3, -23], [3159, 18, 3, 17, 0, 3], [3166, 8, 6, 12, 0, -23], [3172, 16, 16, 18, 1, -15], [3204, 18, 24, 19, 1, -23], [3258, 14, 16, 15, 1, -15], [3286, 18, 24, 19, 1, -23], [3340, 14, 16, 16, 1, -15], [3368, 11, 24, 14, 2, -23], [3401, 17, 23, 17, 1, -15], [3450, 17, 24, 19, 1, -23], [3501, 7, 24, 10, 2, -23], [3522, 11, 31, 14, 0, -23], [3565, 18, 24, 19, 1, -23], [3619, 7, 24, 10, 1, -23], [3640, 27, 16, 29, 1, -15], [3694, 17, 16, 19, 1, -15], [3728, 17, 16, 18, 1, -15], [3762, 19, 23, 19, 0, -15], [3817, 17, 23, 19, 1, -15], [3866, 13, 16, 15, 1, -15], [3892, 12, 16, 14, 1, -15], [3916, 10, 21, 12, 1, -20], [3943, 18, 16, 20, 1, -15], [3979, 17, 16, 17, 0, -15], [4013, 24, 16, 25, 0, -15], [4061, 16, 16, 18, 1, -15], [4093, 16, 23, 17, 0, -15], [4139, 14, 16, 16, 0, -15], [4167, 11, 31, 14, 1, -24], [4210, 3, 25, 8, 2, -23], [4220, 11, 31, 14, 3, -24], [4263, 16, 5, 18, 1, -11]] free_serif_bold18pt7b = [FreeSerifBold18pt7bBitmaps, FreeSerifBold18pt7bGlyphs, 32, 126, 42]
class ImportedJvmLib: _imported_libs = [] @classmethod def has_library(cls, library: str) -> bool: return library in cls._imported_libs @classmethod def import_lib(cls, library: str) -> bool: if library not in cls._imported_libs: cls._imported_libs.append(library) else: return False return True
class Importedjvmlib: _imported_libs = [] @classmethod def has_library(cls, library: str) -> bool: return library in cls._imported_libs @classmethod def import_lib(cls, library: str) -> bool: if library not in cls._imported_libs: cls._imported_libs.append(library) else: return False return True
# Load modules load_modules = { 'hw_fakeIO' : {'bus': 31}, 'gen_ping' : {'debug': 2, 'bus': 32}, 'gen_ping~1' : {'debug': 2}, 'mod_stat' : {'debug': 2} } # Scenario actions = [ {'gen_ping' : {'pipe': 2}}, {'gen_ping~1' : {'pipe': 1}}, {'hw_fakeIO' : {'action':'write','pipe':2}}, {'mod_stat' : {'pipe': 2}}, {'mod_stat' : {'pipe': 1}} ]
load_modules = {'hw_fakeIO': {'bus': 31}, 'gen_ping': {'debug': 2, 'bus': 32}, 'gen_ping~1': {'debug': 2}, 'mod_stat': {'debug': 2}} actions = [{'gen_ping': {'pipe': 2}}, {'gen_ping~1': {'pipe': 1}}, {'hw_fakeIO': {'action': 'write', 'pipe': 2}}, {'mod_stat': {'pipe': 2}}, {'mod_stat': {'pipe': 1}}]
# Copyright 2013 VMware, Inc. # # 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. class ClientError(Exception): """dbeekeeper client error. Dbeekeeper raises a ClientError when it encounters a client-side errors. Examples of client-side errors are: - Trying to delete a non-existent record. - Foreign key constraint error. - Malformed transaction. Client-side errors are *not* considered fatal since they do not affect the consistency of dbee. """ class DbeeError(Exception): """dbee error. Dbee raises a DbeeError when it encounters a dbee-side errors. Examples of dbee-side errors are: - Underlying storage server is down. - Failed to write a record to disk because it was full. - Out of memory. Dbee-side errors *are* considered fatal since they might affect the consistency of dbee. When a dbee throws a DbeeError, dbeekeeper goes into recovery. """
class Clienterror(Exception): """dbeekeeper client error. Dbeekeeper raises a ClientError when it encounters a client-side errors. Examples of client-side errors are: - Trying to delete a non-existent record. - Foreign key constraint error. - Malformed transaction. Client-side errors are *not* considered fatal since they do not affect the consistency of dbee. """ class Dbeeerror(Exception): """dbee error. Dbee raises a DbeeError when it encounters a dbee-side errors. Examples of dbee-side errors are: - Underlying storage server is down. - Failed to write a record to disk because it was full. - Out of memory. Dbee-side errors *are* considered fatal since they might affect the consistency of dbee. When a dbee throws a DbeeError, dbeekeeper goes into recovery. """
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'AND CLOSE_B COLUMN_FUNCTION_NAME COMMA DIVIDE EQUALITY FROM_T GREATER_THAN LESS_THAN MINUS NOT NUMBER OPEN_B OR PLUS SELECT_T SEMICOLON TIMES WHERE_TSQLselect : SELECT_T COLUMN_FUNCTION_NAME FROM_T COLUMN_FUNCTION_NAME SEMICOLON\n | SELECT_T TIMES FROM_T COLUMN_FUNCTION_NAME SEMICOLON\n | SELECT_T function FROM_T COLUMN_FUNCTION_NAME SEMICOLON\n | SELECT_T COLUMN_FUNCTION_NAME FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON\n | SELECT_T TIMES FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON\n | SELECT_T function FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON\n | SELECT_T columnlist FROM_T COLUMN_FUNCTION_NAME SEMICOLON\n | SELECT_T columnlist FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON\n condition : COLUMN_FUNCTION_NAME EQUALITY expression\n | COLUMN_FUNCTION_NAME LESS_THAN expression\n | COLUMN_FUNCTION_NAME GREATER_THAN expression\n expression : expression PLUS expression\n | expression MINUS expression\n | expression TIMES expression\n | expression DIVIDE expression\n | expression AND expression\n | expression OR expression\n | NOT expression\n | NUMBERfunction : COLUMN_FUNCTION_NAME OPEN_B COLUMN_FUNCTION_NAME CLOSE_B \n columnlist : COLUMN_FUNCTION_NAME\n | COLUMN_FUNCTION_NAME COMMA columnlist\n ' _lr_action_items = {'AND':([42,43,44,45,46,53,54,55,56,57,58,],[-19,47,47,47,47,47,47,47,47,47,47,]),'NOT':([35,36,37,41,47,48,49,50,51,52,],[41,41,41,41,41,41,41,41,41,41,]),'CLOSE_B':([17,],[24,]),'TIMES':([2,42,43,44,45,46,53,54,55,56,57,58,],[3,-19,51,51,51,51,51,51,51,51,51,51,]),'$end':([1,20,23,25,27,34,38,39,40,],[0,-2,-3,-1,-7,-5,-6,-4,-8,]),'OPEN_B':([5,],[10,]),'WHERE_T':([13,14,18,19,],[21,22,26,28,]),'DIVIDE':([42,43,44,45,46,53,54,55,56,57,58,],[-19,50,50,50,50,50,50,50,50,50,50,]),'FROM_T':([3,4,5,6,15,16,24,],[7,8,11,12,-21,-22,-20,]),'GREATER_THAN':([30,],[36,]),'SELECT_T':([0,],[2,]),'COMMA':([5,15,],[9,9,]),'OR':([42,43,44,45,46,53,54,55,56,57,58,],[-19,48,48,48,48,48,48,48,48,48,48,]),'COLUMN_FUNCTION_NAME':([2,7,8,9,10,11,12,21,22,26,28,],[5,13,14,15,17,18,19,30,30,30,30,]),'SEMICOLON':([13,14,18,19,29,31,32,33,42,43,44,45,46,53,54,55,56,57,58,],[20,23,25,27,34,38,39,40,-19,-9,-11,-10,-18,-16,-17,-13,-15,-14,-12,]),'EQUALITY':([30,],[35,]),'MINUS':([42,43,44,45,46,53,54,55,56,57,58,],[-19,49,49,49,49,49,49,49,49,49,49,]),'LESS_THAN':([30,],[37,]),'PLUS':([42,43,44,45,46,53,54,55,56,57,58,],[-19,52,52,52,52,52,52,52,52,52,52,]),'NUMBER':([35,36,37,41,47,48,49,50,51,52,],[42,42,42,42,42,42,42,42,42,42,]),} _lr_action = {} for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'condition':([21,22,26,28,],[29,31,32,33,]),'function':([2,],[4,]),'SQLselect':([0,],[1,]),'expression':([35,36,37,41,47,48,49,50,51,52,],[43,44,45,46,53,54,55,56,57,58,]),'columnlist':([2,9,],[6,16,]),} _lr_goto = {} for _k, _v in _lr_goto_items.items(): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> SQLselect","S'",1,None,None,None), ('SQLselect -> SELECT_T COLUMN_FUNCTION_NAME FROM_T COLUMN_FUNCTION_NAME SEMICOLON','SQLselect',5,'p_SQLselect','parsesql.py',87), ('SQLselect -> SELECT_T TIMES FROM_T COLUMN_FUNCTION_NAME SEMICOLON','SQLselect',5,'p_SQLselect','parsesql.py',88), ('SQLselect -> SELECT_T function FROM_T COLUMN_FUNCTION_NAME SEMICOLON','SQLselect',5,'p_SQLselect','parsesql.py',89), ('SQLselect -> SELECT_T COLUMN_FUNCTION_NAME FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON','SQLselect',7,'p_SQLselect','parsesql.py',90), ('SQLselect -> SELECT_T TIMES FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON','SQLselect',7,'p_SQLselect','parsesql.py',91), ('SQLselect -> SELECT_T function FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON','SQLselect',7,'p_SQLselect','parsesql.py',92), ('SQLselect -> SELECT_T columnlist FROM_T COLUMN_FUNCTION_NAME SEMICOLON','SQLselect',5,'p_SQLselect','parsesql.py',93), ('SQLselect -> SELECT_T columnlist FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON','SQLselect',7,'p_SQLselect','parsesql.py',94), ('condition -> COLUMN_FUNCTION_NAME EQUALITY expression','condition',3,'p_condition','parsesql.py',99), ('condition -> COLUMN_FUNCTION_NAME LESS_THAN expression','condition',3,'p_condition','parsesql.py',100), ('condition -> COLUMN_FUNCTION_NAME GREATER_THAN expression','condition',3,'p_condition','parsesql.py',101), ('expression -> expression PLUS expression','expression',3,'p_expression','parsesql.py',106), ('expression -> expression MINUS expression','expression',3,'p_expression','parsesql.py',107), ('expression -> expression TIMES expression','expression',3,'p_expression','parsesql.py',108), ('expression -> expression DIVIDE expression','expression',3,'p_expression','parsesql.py',109), ('expression -> expression AND expression','expression',3,'p_expression','parsesql.py',110), ('expression -> expression OR expression','expression',3,'p_expression','parsesql.py',111), ('expression -> NOT expression','expression',2,'p_expression','parsesql.py',112), ('expression -> NUMBER','expression',1,'p_expression','parsesql.py',113), ('function -> COLUMN_FUNCTION_NAME OPEN_B COLUMN_FUNCTION_NAME CLOSE_B','function',4,'p_function','parsesql.py',117), ('columnlist -> COLUMN_FUNCTION_NAME','columnlist',1,'p_columnlist','parsesql.py',122), ('columnlist -> COLUMN_FUNCTION_NAME COMMA columnlist','columnlist',3,'p_columnlist','parsesql.py',123), ]
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'AND CLOSE_B COLUMN_FUNCTION_NAME COMMA DIVIDE EQUALITY FROM_T GREATER_THAN LESS_THAN MINUS NOT NUMBER OPEN_B OR PLUS SELECT_T SEMICOLON TIMES WHERE_TSQLselect : SELECT_T COLUMN_FUNCTION_NAME FROM_T COLUMN_FUNCTION_NAME SEMICOLON\n | SELECT_T TIMES FROM_T COLUMN_FUNCTION_NAME SEMICOLON\n | SELECT_T function FROM_T COLUMN_FUNCTION_NAME SEMICOLON\n | SELECT_T COLUMN_FUNCTION_NAME FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON\n | SELECT_T TIMES FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON\n | SELECT_T function FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON\n | SELECT_T columnlist FROM_T COLUMN_FUNCTION_NAME SEMICOLON\n | SELECT_T columnlist FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON\n condition : COLUMN_FUNCTION_NAME EQUALITY expression\n | COLUMN_FUNCTION_NAME LESS_THAN expression\n | COLUMN_FUNCTION_NAME GREATER_THAN expression\n expression : expression PLUS expression\n | expression MINUS expression\n | expression TIMES expression\n | expression DIVIDE expression\n | expression AND expression\n | expression OR expression\n | NOT expression\n | NUMBERfunction : COLUMN_FUNCTION_NAME OPEN_B COLUMN_FUNCTION_NAME CLOSE_B \n columnlist : COLUMN_FUNCTION_NAME\n | COLUMN_FUNCTION_NAME COMMA columnlist\n ' _lr_action_items = {'AND': ([42, 43, 44, 45, 46, 53, 54, 55, 56, 57, 58], [-19, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47]), 'NOT': ([35, 36, 37, 41, 47, 48, 49, 50, 51, 52], [41, 41, 41, 41, 41, 41, 41, 41, 41, 41]), 'CLOSE_B': ([17], [24]), 'TIMES': ([2, 42, 43, 44, 45, 46, 53, 54, 55, 56, 57, 58], [3, -19, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51]), '$end': ([1, 20, 23, 25, 27, 34, 38, 39, 40], [0, -2, -3, -1, -7, -5, -6, -4, -8]), 'OPEN_B': ([5], [10]), 'WHERE_T': ([13, 14, 18, 19], [21, 22, 26, 28]), 'DIVIDE': ([42, 43, 44, 45, 46, 53, 54, 55, 56, 57, 58], [-19, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]), 'FROM_T': ([3, 4, 5, 6, 15, 16, 24], [7, 8, 11, 12, -21, -22, -20]), 'GREATER_THAN': ([30], [36]), 'SELECT_T': ([0], [2]), 'COMMA': ([5, 15], [9, 9]), 'OR': ([42, 43, 44, 45, 46, 53, 54, 55, 56, 57, 58], [-19, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48]), 'COLUMN_FUNCTION_NAME': ([2, 7, 8, 9, 10, 11, 12, 21, 22, 26, 28], [5, 13, 14, 15, 17, 18, 19, 30, 30, 30, 30]), 'SEMICOLON': ([13, 14, 18, 19, 29, 31, 32, 33, 42, 43, 44, 45, 46, 53, 54, 55, 56, 57, 58], [20, 23, 25, 27, 34, 38, 39, 40, -19, -9, -11, -10, -18, -16, -17, -13, -15, -14, -12]), 'EQUALITY': ([30], [35]), 'MINUS': ([42, 43, 44, 45, 46, 53, 54, 55, 56, 57, 58], [-19, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49]), 'LESS_THAN': ([30], [37]), 'PLUS': ([42, 43, 44, 45, 46, 53, 54, 55, 56, 57, 58], [-19, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52]), 'NUMBER': ([35, 36, 37, 41, 47, 48, 49, 50, 51, 52], [42, 42, 42, 42, 42, 42, 42, 42, 42, 42])} _lr_action = {} for (_k, _v) in _lr_action_items.items(): for (_x, _y) in zip(_v[0], _v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'condition': ([21, 22, 26, 28], [29, 31, 32, 33]), 'function': ([2], [4]), 'SQLselect': ([0], [1]), 'expression': ([35, 36, 37, 41, 47, 48, 49, 50, 51, 52], [43, 44, 45, 46, 53, 54, 55, 56, 57, 58]), 'columnlist': ([2, 9], [6, 16])} _lr_goto = {} for (_k, _v) in _lr_goto_items.items(): for (_x, _y) in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [("S' -> SQLselect", "S'", 1, None, None, None), ('SQLselect -> SELECT_T COLUMN_FUNCTION_NAME FROM_T COLUMN_FUNCTION_NAME SEMICOLON', 'SQLselect', 5, 'p_SQLselect', 'parsesql.py', 87), ('SQLselect -> SELECT_T TIMES FROM_T COLUMN_FUNCTION_NAME SEMICOLON', 'SQLselect', 5, 'p_SQLselect', 'parsesql.py', 88), ('SQLselect -> SELECT_T function FROM_T COLUMN_FUNCTION_NAME SEMICOLON', 'SQLselect', 5, 'p_SQLselect', 'parsesql.py', 89), ('SQLselect -> SELECT_T COLUMN_FUNCTION_NAME FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON', 'SQLselect', 7, 'p_SQLselect', 'parsesql.py', 90), ('SQLselect -> SELECT_T TIMES FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON', 'SQLselect', 7, 'p_SQLselect', 'parsesql.py', 91), ('SQLselect -> SELECT_T function FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON', 'SQLselect', 7, 'p_SQLselect', 'parsesql.py', 92), ('SQLselect -> SELECT_T columnlist FROM_T COLUMN_FUNCTION_NAME SEMICOLON', 'SQLselect', 5, 'p_SQLselect', 'parsesql.py', 93), ('SQLselect -> SELECT_T columnlist FROM_T COLUMN_FUNCTION_NAME WHERE_T condition SEMICOLON', 'SQLselect', 7, 'p_SQLselect', 'parsesql.py', 94), ('condition -> COLUMN_FUNCTION_NAME EQUALITY expression', 'condition', 3, 'p_condition', 'parsesql.py', 99), ('condition -> COLUMN_FUNCTION_NAME LESS_THAN expression', 'condition', 3, 'p_condition', 'parsesql.py', 100), ('condition -> COLUMN_FUNCTION_NAME GREATER_THAN expression', 'condition', 3, 'p_condition', 'parsesql.py', 101), ('expression -> expression PLUS expression', 'expression', 3, 'p_expression', 'parsesql.py', 106), ('expression -> expression MINUS expression', 'expression', 3, 'p_expression', 'parsesql.py', 107), ('expression -> expression TIMES expression', 'expression', 3, 'p_expression', 'parsesql.py', 108), ('expression -> expression DIVIDE expression', 'expression', 3, 'p_expression', 'parsesql.py', 109), ('expression -> expression AND expression', 'expression', 3, 'p_expression', 'parsesql.py', 110), ('expression -> expression OR expression', 'expression', 3, 'p_expression', 'parsesql.py', 111), ('expression -> NOT expression', 'expression', 2, 'p_expression', 'parsesql.py', 112), ('expression -> NUMBER', 'expression', 1, 'p_expression', 'parsesql.py', 113), ('function -> COLUMN_FUNCTION_NAME OPEN_B COLUMN_FUNCTION_NAME CLOSE_B', 'function', 4, 'p_function', 'parsesql.py', 117), ('columnlist -> COLUMN_FUNCTION_NAME', 'columnlist', 1, 'p_columnlist', 'parsesql.py', 122), ('columnlist -> COLUMN_FUNCTION_NAME COMMA columnlist', 'columnlist', 3, 'p_columnlist', 'parsesql.py', 123)]
# nlantau, 2002-11-08 def spin_words(s): # s = s.split(" ") # for i, word in enumerate(s): # if len(word) >= 5: # s[i] = word[::-1] # return " ".join(s) return " ".join([i[::-1] if len(i) >= 5 else i for i in s.split(" ")]) print(spin_words("hey my name is Niklas Welcome"))
def spin_words(s): return ' '.join([i[::-1] if len(i) >= 5 else i for i in s.split(' ')]) print(spin_words('hey my name is Niklas Welcome'))
CSS_BUNDLES = { 'common': ( 'css/normalize.css', 'less/style.less', ), 'profile': ( 'less/profile.less', ) } JS_BUNDLES = { 'common': ( 'js/standup.js', ) }
css_bundles = {'common': ('css/normalize.css', 'less/style.less'), 'profile': ('less/profile.less',)} js_bundles = {'common': ('js/standup.js',)}
"""Initialize proj-template module.""" # __version__ should be updated only by utils/release __version__ = "0.2.1"
"""Initialize proj-template module.""" __version__ = '0.2.1'
# # PySNMP MIB module BIANCA-BRICK-TDRC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BIANCA-BRICK-TDRC-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:38:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection") DisplayString, = mibBuilder.importSymbols("RFC1158-MIB", "DisplayString") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Counter64, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, enterprises, iso, TimeTicks, NotificationType, Gauge32, ObjectIdentity, Counter32, Unsigned32, ModuleIdentity, IpAddress, MibIdentifier, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "enterprises", "iso", "TimeTicks", "NotificationType", "Gauge32", "ObjectIdentity", "Counter32", "Unsigned32", "ModuleIdentity", "IpAddress", "MibIdentifier", "Bits") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") bintec = MibIdentifier((1, 3, 6, 1, 4, 1, 272)) bibo = MibIdentifier((1, 3, 6, 1, 4, 1, 272, 4)) biboip = MibIdentifier((1, 3, 6, 1, 4, 1, 272, 4, 5)) ipTdrcTable = MibTable((1, 3, 6, 1, 4, 1, 272, 4, 5, 43), ) if mibBuilder.loadTexts: ipTdrcTable.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcTable.setDescription("The ipTdrcTable enables the TCP Download Rate Control (TDRC) on the interface specified by ipTdrcIfIndex (interface index). Creating entries: Entries are created by assigning an interface index to the ipTdrcIfIndex object. Deleting entries: Entries are removed by setting an entry's ipTdrcMode object to 'delete'.") ipTdrcEntry = MibTableRow((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1), ).setIndexNames((0, "BIANCA-BRICK-TDRC-MIB", "ipTdrcIfIndex")) if mibBuilder.loadTexts: ipTdrcEntry.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcEntry.setDescription('') ipTdrcIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcIfIndex.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcIfIndex.setDescription('The associated Interface Index.') ipTdrcMode = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("disabled", 1), ("ack-prioritisation", 2), ("static", 3), ("dynamic", 4), ("delete", 5))).clone('static')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcMode.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcMode.setDescription('The TDRC mode for the associated interface. disabled(1): no TDRC active ack-prioritisation(2): preferential transmission of TCP ACK messages static(3): static TCP download limitation determined by ipTdrcMaxRate dynamic(4): dynamic TCP download limitation determined by ipTdrcMaxRate less amount of high priority traffic send via the associated interface delete(5): this entry will be deleted') ipTdrcMaxRate = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 3), Integer32().clone(1024000)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcMaxRate.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcMaxRate.setDescription('The maximum TCP download rate in bits per second.') ipTdrcWindowScaling = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 16)).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcWindowScaling.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcWindowScaling.setDescription('The TCP window scaling used for TDRC.') ipTdrcMss = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4056)).clone(1452)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcMss.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcMss.setDescription('The TCP MSS used for TDRC.') ipTdrcServices = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("listed-only", 1), ("all", 2))).clone('all')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcServices.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServices.setDescription('Determines the TCP services to be considered for TDRC. If set to listed-only(1), only the predefined and listed services (see ipTdrcServiceTable) will be controlled. If set to all(2) each TCP service will be controlled.') ipTdrcServiceTable = MibTable((1, 3, 6, 1, 4, 1, 272, 4, 5, 44), ) if mibBuilder.loadTexts: ipTdrcServiceTable.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceTable.setDescription("The ipTdrcServiceTable specifies TCP services to be considered for the TCP Download Rate Control (TDRC) if enabled on the interface specified by ipTdrcServiceIfIndex (interface index). Creating entries: Entries are created by assigning an interface index to the ipTdrcServiceIfIndex object. Deleting entries: Entries are removed by setting an entry's ipTdrcServiceStatus object to 'delete'.") ipTdrcServiceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1), ).setIndexNames((0, "BIANCA-BRICK-TDRC-MIB", "ipTdrcServiceIfIndex")) if mibBuilder.loadTexts: ipTdrcServiceEntry.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceEntry.setDescription('') ipTdrcServiceIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcServiceIfIndex.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceIfIndex.setDescription('The associated Interface Index.') ipTdrcServicePort = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcServicePort.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServicePort.setDescription('The associated TCP service/port.') ipTdrcServiceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 5))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("delete", 5))).clone('enabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcServiceStatus.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceStatus.setDescription('The status of this entry. enabled(1): service will be TDRC controlled disabled(2): service will not be TDRC controlled delete(5): this entry will be deleted. ') ipTdrcServiceAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1, 4), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipTdrcServiceAlias.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceAlias.setDescription('Alias Name for the Service Entry') mibBuilder.exportSymbols("BIANCA-BRICK-TDRC-MIB", ipTdrcServicePort=ipTdrcServicePort, ipTdrcMaxRate=ipTdrcMaxRate, biboip=biboip, ipTdrcTable=ipTdrcTable, bintec=bintec, ipTdrcMss=ipTdrcMss, ipTdrcMode=ipTdrcMode, ipTdrcServiceTable=ipTdrcServiceTable, ipTdrcServices=ipTdrcServices, ipTdrcServiceIfIndex=ipTdrcServiceIfIndex, ipTdrcServiceAlias=ipTdrcServiceAlias, ipTdrcWindowScaling=ipTdrcWindowScaling, ipTdrcServiceEntry=ipTdrcServiceEntry, ipTdrcIfIndex=ipTdrcIfIndex, ipTdrcServiceStatus=ipTdrcServiceStatus, bibo=bibo, ipTdrcEntry=ipTdrcEntry)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, value_size_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'ConstraintsIntersection') (display_string,) = mibBuilder.importSymbols('RFC1158-MIB', 'DisplayString') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (counter64, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, enterprises, iso, time_ticks, notification_type, gauge32, object_identity, counter32, unsigned32, module_identity, ip_address, mib_identifier, bits) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'enterprises', 'iso', 'TimeTicks', 'NotificationType', 'Gauge32', 'ObjectIdentity', 'Counter32', 'Unsigned32', 'ModuleIdentity', 'IpAddress', 'MibIdentifier', 'Bits') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') bintec = mib_identifier((1, 3, 6, 1, 4, 1, 272)) bibo = mib_identifier((1, 3, 6, 1, 4, 1, 272, 4)) biboip = mib_identifier((1, 3, 6, 1, 4, 1, 272, 4, 5)) ip_tdrc_table = mib_table((1, 3, 6, 1, 4, 1, 272, 4, 5, 43)) if mibBuilder.loadTexts: ipTdrcTable.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcTable.setDescription("The ipTdrcTable enables the TCP Download Rate Control (TDRC) on the interface specified by ipTdrcIfIndex (interface index). Creating entries: Entries are created by assigning an interface index to the ipTdrcIfIndex object. Deleting entries: Entries are removed by setting an entry's ipTdrcMode object to 'delete'.") ip_tdrc_entry = mib_table_row((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1)).setIndexNames((0, 'BIANCA-BRICK-TDRC-MIB', 'ipTdrcIfIndex')) if mibBuilder.loadTexts: ipTdrcEntry.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcEntry.setDescription('') ip_tdrc_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 1), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcIfIndex.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcIfIndex.setDescription('The associated Interface Index.') ip_tdrc_mode = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('disabled', 1), ('ack-prioritisation', 2), ('static', 3), ('dynamic', 4), ('delete', 5))).clone('static')).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcMode.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcMode.setDescription('The TDRC mode for the associated interface. disabled(1): no TDRC active ack-prioritisation(2): preferential transmission of TCP ACK messages static(3): static TCP download limitation determined by ipTdrcMaxRate dynamic(4): dynamic TCP download limitation determined by ipTdrcMaxRate less amount of high priority traffic send via the associated interface delete(5): this entry will be deleted') ip_tdrc_max_rate = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 3), integer32().clone(1024000)).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcMaxRate.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcMaxRate.setDescription('The maximum TCP download rate in bits per second.') ip_tdrc_window_scaling = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 16)).clone(2)).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcWindowScaling.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcWindowScaling.setDescription('The TCP window scaling used for TDRC.') ip_tdrc_mss = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 4056)).clone(1452)).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcMss.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcMss.setDescription('The TCP MSS used for TDRC.') ip_tdrc_services = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 43, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('listed-only', 1), ('all', 2))).clone('all')).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcServices.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServices.setDescription('Determines the TCP services to be considered for TDRC. If set to listed-only(1), only the predefined and listed services (see ipTdrcServiceTable) will be controlled. If set to all(2) each TCP service will be controlled.') ip_tdrc_service_table = mib_table((1, 3, 6, 1, 4, 1, 272, 4, 5, 44)) if mibBuilder.loadTexts: ipTdrcServiceTable.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceTable.setDescription("The ipTdrcServiceTable specifies TCP services to be considered for the TCP Download Rate Control (TDRC) if enabled on the interface specified by ipTdrcServiceIfIndex (interface index). Creating entries: Entries are created by assigning an interface index to the ipTdrcServiceIfIndex object. Deleting entries: Entries are removed by setting an entry's ipTdrcServiceStatus object to 'delete'.") ip_tdrc_service_entry = mib_table_row((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1)).setIndexNames((0, 'BIANCA-BRICK-TDRC-MIB', 'ipTdrcServiceIfIndex')) if mibBuilder.loadTexts: ipTdrcServiceEntry.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceEntry.setDescription('') ip_tdrc_service_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1, 1), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcServiceIfIndex.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceIfIndex.setDescription('The associated Interface Index.') ip_tdrc_service_port = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcServicePort.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServicePort.setDescription('The associated TCP service/port.') ip_tdrc_service_status = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 5))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2), ('delete', 5))).clone('enabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcServiceStatus.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceStatus.setDescription('The status of this entry. enabled(1): service will be TDRC controlled disabled(2): service will not be TDRC controlled delete(5): this entry will be deleted. ') ip_tdrc_service_alias = mib_table_column((1, 3, 6, 1, 4, 1, 272, 4, 5, 44, 1, 4), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ipTdrcServiceAlias.setStatus('mandatory') if mibBuilder.loadTexts: ipTdrcServiceAlias.setDescription('Alias Name for the Service Entry') mibBuilder.exportSymbols('BIANCA-BRICK-TDRC-MIB', ipTdrcServicePort=ipTdrcServicePort, ipTdrcMaxRate=ipTdrcMaxRate, biboip=biboip, ipTdrcTable=ipTdrcTable, bintec=bintec, ipTdrcMss=ipTdrcMss, ipTdrcMode=ipTdrcMode, ipTdrcServiceTable=ipTdrcServiceTable, ipTdrcServices=ipTdrcServices, ipTdrcServiceIfIndex=ipTdrcServiceIfIndex, ipTdrcServiceAlias=ipTdrcServiceAlias, ipTdrcWindowScaling=ipTdrcWindowScaling, ipTdrcServiceEntry=ipTdrcServiceEntry, ipTdrcIfIndex=ipTdrcIfIndex, ipTdrcServiceStatus=ipTdrcServiceStatus, bibo=bibo, ipTdrcEntry=ipTdrcEntry)
[ [ 1.00000000e00, 9.50744855e-01, 7.61580875e-01, 1.45494511e-03, 1.35271514e-04, 2.75262668e-03, 9.40575477e-01, 4.90755141e-01, 3.16822332e-03, 6.38672254e-01, 3.44275537e-05, ], [ 1.00000000e00, 2.34589189e-01, 7.02082945e-01, 8.84605265e-04, 5.67562813e-04, 5.94375533e-03, 5.53862215e-01, 3.88027539e-01, 1.11098015e-02, 2.71039211e-01, 7.25442977e-04, ], [ 1.00000000e00, 8.78852262e-02, 3.51831360e-01, 3.82131035e-01, 8.03255937e-01, 8.12841336e-01, 3.31271828e-01, 7.00272311e-01, 9.68813218e-01, 3.04581978e-01, 8.43264694e-01, ], ]
[[1.0, 0.950744855, 0.761580875, 0.00145494511, 0.000135271514, 0.00275262668, 0.940575477, 0.490755141, 0.00316822332, 0.638672254, 3.44275537e-05], [1.0, 0.234589189, 0.702082945, 0.000884605265, 0.000567562813, 0.00594375533, 0.553862215, 0.388027539, 0.0111098015, 0.271039211, 0.000725442977], [1.0, 0.0878852262, 0.35183136, 0.382131035, 0.803255937, 0.812841336, 0.331271828, 0.700272311, 0.968813218, 0.304581978, 0.843264694]]
"""AI Engines Here is a set of AI- and ML-patterns for adavanced research of business data. """
"""AI Engines Here is a set of AI- and ML-patterns for adavanced research of business data. """
def solution(s): answer = True tmp = '' li = [] for c in s: if c == '(': li.append(c) else: if len(li) == 0: return False tmp = li.pop() if tmp == '': return False return len(li) == 0
def solution(s): answer = True tmp = '' li = [] for c in s: if c == '(': li.append(c) else: if len(li) == 0: return False tmp = li.pop() if tmp == '': return False return len(li) == 0
# Created by MechAviv # Violetta's Charming Damage Skin | (2433251) if sm.addDamageSkin(2433251): sm.chat("'Violetta's Charming Damage Skin' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
if sm.addDamageSkin(2433251): sm.chat("'Violetta's Charming Damage Skin' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
class MultiVariateTrainer: def __init__(self, trainers): self._trainers = trainers def fit(self, parameters, values): for n, trainer in enumerate(self._trainers): trainer.fit(parameters, values[:,n]) @property def models(self): return [trainer.model for trainer in self._trainers]
class Multivariatetrainer: def __init__(self, trainers): self._trainers = trainers def fit(self, parameters, values): for (n, trainer) in enumerate(self._trainers): trainer.fit(parameters, values[:, n]) @property def models(self): return [trainer.model for trainer in self._trainers]
def addTwoNumbers(a, b): return a + b firstNumber = input("What is the first number?") secondNumber = input("What is the second number?") result = addTwoNumbers(firstNumber, secondNumber) print(result) # Why are the two numbers not added correctly? # Example of type casting result = addTwoNumbers(int(firstNumber), int(secondNumber)) print(result)
def add_two_numbers(a, b): return a + b first_number = input('What is the first number?') second_number = input('What is the second number?') result = add_two_numbers(firstNumber, secondNumber) print(result) result = add_two_numbers(int(firstNumber), int(secondNumber)) print(result)
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # A top level slice of a presentation.main thread can cause the webapp to behave # unresponsively if its thread duration is greater than or equals to # USER_PERCEIVABLE_DELAY_THRESHOLD_MS. Human eyes can perceive delay at low as # 100ms, but since we use thread time instead of wall-time, we reduce the # threshold further to 50ms to make room for other OS's activities. USER_PERCEIVABLE_DELAY_THRESHOLD_MS = 50 class _MainthreadJankStat(object): """A small wrapper class for storing mainthread jank stats computed for single record. """ def __init__(self): self.sum_big_top_slices_thread_time = 0 self.biggest_top_slice_thread_time = 0 def _ComputeMainthreadJankStatsForRecord(renderer_thread, record): """Computes the mainthread jank stat on a record range. Returns: An instance of _MainthreadJankStat, which has: sum_big_top_slices_thread_time is the total thread duration of all top slices whose thread time ranges overlapped with (thread_start, thread_end) and the overlapped thread duration is greater than or equal USER_PERCEIVABLE_DELAY_THRESHOLD_MS. biggest_top_slice_thread_time is the biggest thread duration of all top slices whose thread time ranges overlapped with (thread_start, thread_end). Note: thread duration of each slices is computed using overlapped range with (thread_start, thread_end). """ stat = _MainthreadJankStat() for s in renderer_thread.toplevel_slices: jank_thread_duration = record.GetOverlappedThreadTimeForSlice(s) stat.biggest_top_slice_thread_time = max( stat.biggest_top_slice_thread_time, jank_thread_duration) if jank_thread_duration >= USER_PERCEIVABLE_DELAY_THRESHOLD_MS: stat.sum_big_top_slices_thread_time += jank_thread_duration return stat class MainthreadJankStats(object): """ Utility class for extracting presentation.main thread jank statistics from the timeline (or other loggin facilities), and providing them in a common format to classes that compute benchmark metrics from this data. total_big_jank_thread_time is the total thread duration of all top slices whose thread time ranges overlapped with any thread time ranges of the records and the overlapped thread duration is greater than or equal USER_PERCEIVABLE_DELAY_THRESHOLD_MS. biggest_jank_thread_time is the biggest thread duration of all top slices whose thread time ranges overlapped with any of records' thread time ranges. """ def __init__(self, renderer_thread, interaction_records): self._renderer_thread = renderer_thread self._interaction_records = interaction_records self._total_big_jank_thread_time = 0 self._biggest_jank_thread_time = 0 self._ComputeMainthreadJankStats() @property def total_big_jank_thread_time(self): return self._total_big_jank_thread_time @property def biggest_jank_thread_time(self): return self._biggest_jank_thread_time def _ComputeMainthreadJankStats(self): for record in self._interaction_records: record_jank_stat = _ComputeMainthreadJankStatsForRecord( self._renderer_thread, record) self._total_big_jank_thread_time += ( record_jank_stat.sum_big_top_slices_thread_time) self._biggest_jank_thread_time = ( max(self._biggest_jank_thread_time, record_jank_stat.biggest_top_slice_thread_time))
user_perceivable_delay_threshold_ms = 50 class _Mainthreadjankstat(object): """A small wrapper class for storing mainthread jank stats computed for single record. """ def __init__(self): self.sum_big_top_slices_thread_time = 0 self.biggest_top_slice_thread_time = 0 def __compute_mainthread_jank_stats_for_record(renderer_thread, record): """Computes the mainthread jank stat on a record range. Returns: An instance of _MainthreadJankStat, which has: sum_big_top_slices_thread_time is the total thread duration of all top slices whose thread time ranges overlapped with (thread_start, thread_end) and the overlapped thread duration is greater than or equal USER_PERCEIVABLE_DELAY_THRESHOLD_MS. biggest_top_slice_thread_time is the biggest thread duration of all top slices whose thread time ranges overlapped with (thread_start, thread_end). Note: thread duration of each slices is computed using overlapped range with (thread_start, thread_end). """ stat = __mainthread_jank_stat() for s in renderer_thread.toplevel_slices: jank_thread_duration = record.GetOverlappedThreadTimeForSlice(s) stat.biggest_top_slice_thread_time = max(stat.biggest_top_slice_thread_time, jank_thread_duration) if jank_thread_duration >= USER_PERCEIVABLE_DELAY_THRESHOLD_MS: stat.sum_big_top_slices_thread_time += jank_thread_duration return stat class Mainthreadjankstats(object): """ Utility class for extracting presentation.main thread jank statistics from the timeline (or other loggin facilities), and providing them in a common format to classes that compute benchmark metrics from this data. total_big_jank_thread_time is the total thread duration of all top slices whose thread time ranges overlapped with any thread time ranges of the records and the overlapped thread duration is greater than or equal USER_PERCEIVABLE_DELAY_THRESHOLD_MS. biggest_jank_thread_time is the biggest thread duration of all top slices whose thread time ranges overlapped with any of records' thread time ranges. """ def __init__(self, renderer_thread, interaction_records): self._renderer_thread = renderer_thread self._interaction_records = interaction_records self._total_big_jank_thread_time = 0 self._biggest_jank_thread_time = 0 self._ComputeMainthreadJankStats() @property def total_big_jank_thread_time(self): return self._total_big_jank_thread_time @property def biggest_jank_thread_time(self): return self._biggest_jank_thread_time def __compute_mainthread_jank_stats(self): for record in self._interaction_records: record_jank_stat = __compute_mainthread_jank_stats_for_record(self._renderer_thread, record) self._total_big_jank_thread_time += record_jank_stat.sum_big_top_slices_thread_time self._biggest_jank_thread_time = max(self._biggest_jank_thread_time, record_jank_stat.biggest_top_slice_thread_time)
""" binclf clfviz ================================== Utils library to visualize decision trees. Author: Casokaks (https://github.com/Casokaks/) Created on: Nov 1st 2018 """ def xgb_visualize(clf, tree_idx=0, with_stats=False, dump_format='text'): booster = clf.get_booster() dumps = booster.get_dump(with_stats=with_stats, dump_format=dump_format) print('\nTree {}:'.format(tree_idx)) print(dumps[tree_idx]) def tree_visualize(estimator, columns): # The decision estimator has an attribute called tree_ which stores the entire # tree structure and allows access to low level attributes. The binary tree # tree_ is represented as a number of parallel arrays. The i-th element of each # array holds information about the node `i`. Node 0 is the tree's root. NOTE: # Some of the arrays only apply to either leaves or split nodes, resp. In this # case the values of nodes of the other type are arbitrary! # # Among those arrays, we have: # - left_child, id of the left child of the node # - right_child, id of the right child of the node # - feature, feature used for splitting the node # - threshold, threshold value at the node # # Using those arrays, we can parse the tree structure: n_nodes = estimator.tree_.node_count children_left = estimator.tree_.children_left children_right = estimator.tree_.children_right feature = estimator.tree_.feature threshold = estimator.tree_.threshold # The tree structure can be traversed to compute various properties such # as the depth of each node and whether or not it is a leaf. node_depth = np.zeros(shape=n_nodes, dtype=np.int64) is_leaves = np.zeros(shape=n_nodes, dtype=bool) stack = [(0, -1)] # seed is the root node id and its parent depth while len(stack) > 0: node_id, parent_depth = stack.pop() node_depth[node_id] = parent_depth + 1 # If we have a test node if (children_left[node_id] != children_right[node_id]): stack.append((children_left[node_id], parent_depth + 1)) stack.append((children_right[node_id], parent_depth + 1)) else: is_leaves[node_id] = True print("The binary tree structure has %s nodes and has " "the following tree structure:" % n_nodes) for i in range(n_nodes): print() if is_leaves[i]: print("%snode=%s leaf node." % (node_depth[i] * "\t", i)) else: print("%snode=%s: go to node %s if %s <= %s else to " "node %s." % (node_depth[i] * "\t", i, children_left[i], columns[feature[i]], threshold[i], children_right[i], )) print()
""" binclf clfviz ================================== Utils library to visualize decision trees. Author: Casokaks (https://github.com/Casokaks/) Created on: Nov 1st 2018 """ def xgb_visualize(clf, tree_idx=0, with_stats=False, dump_format='text'): booster = clf.get_booster() dumps = booster.get_dump(with_stats=with_stats, dump_format=dump_format) print('\nTree {}:'.format(tree_idx)) print(dumps[tree_idx]) def tree_visualize(estimator, columns): n_nodes = estimator.tree_.node_count children_left = estimator.tree_.children_left children_right = estimator.tree_.children_right feature = estimator.tree_.feature threshold = estimator.tree_.threshold node_depth = np.zeros(shape=n_nodes, dtype=np.int64) is_leaves = np.zeros(shape=n_nodes, dtype=bool) stack = [(0, -1)] while len(stack) > 0: (node_id, parent_depth) = stack.pop() node_depth[node_id] = parent_depth + 1 if children_left[node_id] != children_right[node_id]: stack.append((children_left[node_id], parent_depth + 1)) stack.append((children_right[node_id], parent_depth + 1)) else: is_leaves[node_id] = True print('The binary tree structure has %s nodes and has the following tree structure:' % n_nodes) for i in range(n_nodes): print() if is_leaves[i]: print('%snode=%s leaf node.' % (node_depth[i] * '\t', i)) else: print('%snode=%s: go to node %s if %s <= %s else to node %s.' % (node_depth[i] * '\t', i, children_left[i], columns[feature[i]], threshold[i], children_right[i])) print()
subnet_create_payload = { "nickname": "Test Python Subnet" } subnet_update_payload = { "allowed": "LOCKED" }
subnet_create_payload = {'nickname': 'Test Python Subnet'} subnet_update_payload = {'allowed': 'LOCKED'}
def rev_order(s: str): return ' '.join(s.split(' ')[::-1]) def test1(): print(rev_order('Technical Interview Preparation') == 'Preparation Interview Technical') def main(): test1() if __name__ == '__main__': main()
def rev_order(s: str): return ' '.join(s.split(' ')[::-1]) def test1(): print(rev_order('Technical Interview Preparation') == 'Preparation Interview Technical') def main(): test1() if __name__ == '__main__': main()
#Ahmed Mousa: 201601381 #Eman Adel: 201902302 #These functions are for taking file names, reading, writing, and closing files def inputfile(): return input('Enter input file name: ') def openinput(x): return open(x, 'r') def readinput(x): return x.read() def outputfile(): return input('Enter output file name: ') def openoutput(x): return open(x, 'w') def closefile(x): return x.close() #A function to remove new lines in the input files: def removenew(x): if x == '\n': return '' else: return x #This function checks whether the input sequence is valid: def validsequence(x): c = 0 for i in range(len(x)): if menu == 1 or menu == 4: if x[i] not in '35\'ATCG': c += 1 elif menu == 2 or menu == 3: if x[i] not in '35\'AUCG': c += 1 if (not (x[0:2] == '3\'' and x[-1:-3:-1] == '\'5')) and (not (x[0:2] == '5\'' and x[-1:-3:-1] == '\'3')): c += 1 if menu == 3: if not(x[0:2] == '5\'' and x[-1:-3:-1] == '\'3'): c += 1 if c > 0: print('Invalid input sequence! Or empty input file.\n' 'Sequence should not contain the following:\n' '- Small letters\n' '- Invalid base letters, including Uracil in DNA or Thymine in RNA\n' '- Numbers or symbols in non-terminals\n' '- Numbers or symbols other than 5\' and 3\' in terminals\n' '- 3\' terminal at the beginning of translated sequence instead of 5\'') return c #This function is for formatting the output in file and program: def format(x, y): for i in range(len(x)): if (i+1) % y == 0: print(x[i]) outfile.write(f'{x[i]}\n') else: print(x[i], end = '') outfile.write(x[i]) print('') #while loop for repetition unknown times: Cont = 'y' while Cont == 'y': #The program starts executing by showing the menu: menu = int(input('Choose the desired option: \n' '1- DNA transcription, 2- Reverse transcription, 3- RNA translation, 4- Get complementary DNA strand: ')) while menu != 1 and menu != 2 and menu != 3 and menu != 4: menu = int(input('Error! Please enter a valid option: ')) #First this code module for transcription, reverse transcription or complementary DNA: if menu == 1 or menu == 2 or menu == 4: #Terminal function to reverse input terminals in the output def terminal(x): if x == "3": return "5" elif x == "5": return "3" elif x == "'": return "'" else: return'' #Functions for transcription and reverse transcription. They turn the base into its correspondent. def transcription(x): if x == 'A': return 'U' elif x == 'T': return 'A' elif x == 'G': return 'C' elif x == 'C': return 'G' else: return '' def retranscription(x): if x == 'A': return 'T' elif x == 'U': return 'A' elif x == 'G': return 'C' elif x == 'C': return 'G' else: return'' #Function for getting the complementary DNA starnd: def complement(x): if x == 'A': return 'T' elif x == 'T': return 'A' elif x == 'G': return 'C' elif x == 'C': return 'G' else: return '' #The program takes input file names and opens them for reading: inname = inputfile() infile = openinput(inname) inputseq = readinput(infile) inputmodified = '' #Removing new lines and checking validity of input: for i in inputseq: inputmodified += removenew(i) while validsequence(inputmodified) > 0: inname = inputfile() infile = openinput(inname) inputseq = readinput(infile) inputmodified = '' for i in inputseq: inputmodified += removenew(i) validsequence(inputmodified) #Taking output file name and opening it for writing: outname = outputfile() outfile = openoutput(outname) outputseq = "" #The printed and written phrases, and functions diverge between transcription and reverse transcription f = int(input('Enter characters per output line: ')) if menu == 1: outfile.write('RNA transcript:\n') print('DNA sequence is:\n ', inputmodified) print('RNA transcript: ') for i in inputmodified: outputseq += terminal(i) outputseq += transcription(i) elif menu == 2: outfile.write('DNA sequence:\n') print('RNA transcript is:\n', inputmodified) print('DNA sequence: ') for i in inputmodified: outputseq += terminal(i) outputseq += retranscription(i) elif menu == 4: outfile.write('Complementary DNA strand:\n') print('Input DNA: ', inputmodified) print('Complementary DNA: ') for i in inputmodified: outputseq += terminal(i) outputseq += complement(i) #Output part where output is printed in program and file: format(outputseq, f) closefile(infile) closefile(outfile) #This is the translation part: if menu == 3: #This function reads the codon and returns the corresponding one-letter amino acid def codon(x): if x == 'UAA' or x == 'UGA' or x == 'UAG': return '' elif x == 'GCU' or x == 'GCC' or x == 'GCA' or x == 'GCG': return 'A' elif x == 'CGU' or x == 'CGC' or x == 'CGA' or x == 'CGG' or x == 'AGA' or x == 'AGG': return 'R' elif x == 'AAU' or x == 'AAC': return 'N' elif x == 'GAU' or x == 'GAC': return 'D' elif x == 'UGU' or x == 'UGC': return 'C' elif x == 'CAA' or x == 'CAG': return 'Q' elif x == 'GAA' or x == 'GAG': return 'E' elif x == 'GGU' or x == 'GGC' or x == 'GGA' or x == 'GGG': return 'G' elif x == 'CAU' or x == 'CAC': return 'H' elif x == 'AUU' or x == 'AUC' or x == 'AUA': return 'I' elif x == 'CUU' or x == 'CUC' or x == 'CUA' or x == 'CUG' or x == 'UUA' or x == 'UUG': return 'L' elif x == 'AAA' or x == 'AAG': return 'K' elif x == 'AUG': return 'M' elif x == 'UUU' or x == 'UUC': return 'F' elif x == 'CCU' or x == 'CCC' or x == 'CCA' or x == 'CCG': return 'P' elif x == 'UCU' or x == 'UCC' or x == 'UCA' or x == 'UCG' or x == 'AGU' or x == 'AGC': return 'S' elif x == 'ACU' or x == 'ACC' or x == 'ACA' or x == 'ACG': return 'T' elif x == 'UGG': return 'W' elif x == 'UAU' or x == 'UAC': return 'Y' elif x == 'GUU' or x == 'GUC' or x == 'GUA' or x == 'GUG': return 'V' #This function removes 3' and 5' terminal if entered: def removeterminal(x): if x == "3": return '' elif x == "5": return '' elif x == "'": return '' else: return x #The program takes input file name and opens for reading: inname = inputfile() infile = openinput(inname) inputseq = readinput(infile) inputmodified = '' #Removing new lines and checking validity of input: for i in inputseq: inputmodified += removenew(i) while validsequence(inputmodified) > 0: inname = inputfile() infile = openinput(inname) inputseq = readinput(infile) inputmodified = '' for i in inputseq: inputmodified += removenew(i) validsequence(inputmodified) #Removing terminal from input sequence: rna = "" for i in inputmodified: rna += removeterminal(i) #Taking output file name and opening it for writing: ptnseq = "" outname = outputfile() outfile = openoutput(outname) #This part translates the RNA sequence: for i in range(0, len(rna), 3): ptnseq += codon(rna[i:i+3]) if codon(rna[i:i+3]) == '': break #Check whether the sequence is translated properly or a stop codon is in the middle: if len(ptnseq) < (len(rna)/3-1): print(f'Stop codon after: {len(ptnseq)*3} bases.') outfile.write(f'Stop codon after: {len(ptnseq)*3} bases.\n') #Output part where output is printed in program and file: f = int(input('Enter characters per output line: ')) print('RNA sequence is:\n', inputmodified) print('Protein sequence:') outfile.write('Protein sequence:\n') format(ptnseq, f) closefile(infile) closefile(outfile) #The user is asked if they wish to continue: Cont = input('Continue? y/n: ') while Cont != 'y' and Cont != 'n': Cont = input('Error! Enter y/n: ')
def inputfile(): return input('Enter input file name: ') def openinput(x): return open(x, 'r') def readinput(x): return x.read() def outputfile(): return input('Enter output file name: ') def openoutput(x): return open(x, 'w') def closefile(x): return x.close() def removenew(x): if x == '\n': return '' else: return x def validsequence(x): c = 0 for i in range(len(x)): if menu == 1 or menu == 4: if x[i] not in "35'ATCG": c += 1 elif menu == 2 or menu == 3: if x[i] not in "35'AUCG": c += 1 if not (x[0:2] == "3'" and x[-1:-3:-1] == "'5") and (not (x[0:2] == "5'" and x[-1:-3:-1] == "'3")): c += 1 if menu == 3: if not (x[0:2] == "5'" and x[-1:-3:-1] == "'3"): c += 1 if c > 0: print("Invalid input sequence! Or empty input file.\nSequence should not contain the following:\n- Small letters\n- Invalid base letters, including Uracil in DNA or Thymine in RNA\n- Numbers or symbols in non-terminals\n- Numbers or symbols other than 5' and 3' in terminals\n- 3' terminal at the beginning of translated sequence instead of 5'") return c def format(x, y): for i in range(len(x)): if (i + 1) % y == 0: print(x[i]) outfile.write(f'{x[i]}\n') else: print(x[i], end='') outfile.write(x[i]) print('') cont = 'y' while Cont == 'y': menu = int(input('Choose the desired option: \n1- DNA transcription, 2- Reverse transcription, 3- RNA translation, 4- Get complementary DNA strand: ')) while menu != 1 and menu != 2 and (menu != 3) and (menu != 4): menu = int(input('Error! Please enter a valid option: ')) if menu == 1 or menu == 2 or menu == 4: def terminal(x): if x == '3': return '5' elif x == '5': return '3' elif x == "'": return "'" else: return '' def transcription(x): if x == 'A': return 'U' elif x == 'T': return 'A' elif x == 'G': return 'C' elif x == 'C': return 'G' else: return '' def retranscription(x): if x == 'A': return 'T' elif x == 'U': return 'A' elif x == 'G': return 'C' elif x == 'C': return 'G' else: return '' def complement(x): if x == 'A': return 'T' elif x == 'T': return 'A' elif x == 'G': return 'C' elif x == 'C': return 'G' else: return '' inname = inputfile() infile = openinput(inname) inputseq = readinput(infile) inputmodified = '' for i in inputseq: inputmodified += removenew(i) while validsequence(inputmodified) > 0: inname = inputfile() infile = openinput(inname) inputseq = readinput(infile) inputmodified = '' for i in inputseq: inputmodified += removenew(i) validsequence(inputmodified) outname = outputfile() outfile = openoutput(outname) outputseq = '' f = int(input('Enter characters per output line: ')) if menu == 1: outfile.write('RNA transcript:\n') print('DNA sequence is:\n ', inputmodified) print('RNA transcript: ') for i in inputmodified: outputseq += terminal(i) outputseq += transcription(i) elif menu == 2: outfile.write('DNA sequence:\n') print('RNA transcript is:\n', inputmodified) print('DNA sequence: ') for i in inputmodified: outputseq += terminal(i) outputseq += retranscription(i) elif menu == 4: outfile.write('Complementary DNA strand:\n') print('Input DNA: ', inputmodified) print('Complementary DNA: ') for i in inputmodified: outputseq += terminal(i) outputseq += complement(i) format(outputseq, f) closefile(infile) closefile(outfile) if menu == 3: def codon(x): if x == 'UAA' or x == 'UGA' or x == 'UAG': return '' elif x == 'GCU' or x == 'GCC' or x == 'GCA' or (x == 'GCG'): return 'A' elif x == 'CGU' or x == 'CGC' or x == 'CGA' or (x == 'CGG') or (x == 'AGA') or (x == 'AGG'): return 'R' elif x == 'AAU' or x == 'AAC': return 'N' elif x == 'GAU' or x == 'GAC': return 'D' elif x == 'UGU' or x == 'UGC': return 'C' elif x == 'CAA' or x == 'CAG': return 'Q' elif x == 'GAA' or x == 'GAG': return 'E' elif x == 'GGU' or x == 'GGC' or x == 'GGA' or (x == 'GGG'): return 'G' elif x == 'CAU' or x == 'CAC': return 'H' elif x == 'AUU' or x == 'AUC' or x == 'AUA': return 'I' elif x == 'CUU' or x == 'CUC' or x == 'CUA' or (x == 'CUG') or (x == 'UUA') or (x == 'UUG'): return 'L' elif x == 'AAA' or x == 'AAG': return 'K' elif x == 'AUG': return 'M' elif x == 'UUU' or x == 'UUC': return 'F' elif x == 'CCU' or x == 'CCC' or x == 'CCA' or (x == 'CCG'): return 'P' elif x == 'UCU' or x == 'UCC' or x == 'UCA' or (x == 'UCG') or (x == 'AGU') or (x == 'AGC'): return 'S' elif x == 'ACU' or x == 'ACC' or x == 'ACA' or (x == 'ACG'): return 'T' elif x == 'UGG': return 'W' elif x == 'UAU' or x == 'UAC': return 'Y' elif x == 'GUU' or x == 'GUC' or x == 'GUA' or (x == 'GUG'): return 'V' def removeterminal(x): if x == '3': return '' elif x == '5': return '' elif x == "'": return '' else: return x inname = inputfile() infile = openinput(inname) inputseq = readinput(infile) inputmodified = '' for i in inputseq: inputmodified += removenew(i) while validsequence(inputmodified) > 0: inname = inputfile() infile = openinput(inname) inputseq = readinput(infile) inputmodified = '' for i in inputseq: inputmodified += removenew(i) validsequence(inputmodified) rna = '' for i in inputmodified: rna += removeterminal(i) ptnseq = '' outname = outputfile() outfile = openoutput(outname) for i in range(0, len(rna), 3): ptnseq += codon(rna[i:i + 3]) if codon(rna[i:i + 3]) == '': break if len(ptnseq) < len(rna) / 3 - 1: print(f'Stop codon after: {len(ptnseq) * 3} bases.') outfile.write(f'Stop codon after: {len(ptnseq) * 3} bases.\n') f = int(input('Enter characters per output line: ')) print('RNA sequence is:\n', inputmodified) print('Protein sequence:') outfile.write('Protein sequence:\n') format(ptnseq, f) closefile(infile) closefile(outfile) cont = input('Continue? y/n: ') while Cont != 'y' and Cont != 'n': cont = input('Error! Enter y/n: ')
#!/usr/bin/env python2 def xutf8len(x): if x < 0x80: return 1 if x < 0x800: return 2 if x < 0x10000: return 3 if x < 0x200000: return 4 if x < 0x4000000: return 5 if x < 0x80000000: return 6 return 7 def enci32(x): if x >= 0: return x return (-x) * 2 + 1 def skipadjust(x): if x >= 0: return 0 t = xutf8len(enci32(x)) t = xutf8len(enci32(x - t)) # byte length of encoded, adjusted skip return t def adjusted(skip): return skip - skipadjust(skip) # Binary search for lowest negative skip offset which, when adjusted for # encoding length, encodes to numbytes. def binsearch(numbytes): a = -1 b = -0xffffffff while a - b > 1: c = (a + b) / 2 n = skipadjust(c) #print(a, b, c, n, numbytes) if n > numbytes: b = c else: a = c if skipadjust(a) == numbytes: return a else: return b def closed1(skip): if skip >= 0: return skip if skip >= -0x3e: skip -= 1 elif skip >= -0x3fd: skip -= 2 elif skip >= -0x7ffc: skip -= 3 elif skip >= -0xffffb: skip -= 4 elif skip >= -0x1fffffa: skip -= 5 elif skip >= -0x3ffffff9: skip -= 6 else: skip -= 7 return skip def closed2(skip): if skip >= 0: return skip skip -= 1 if skip < -0x3f: skip -= 1 if skip < -0x3ff: skip -= 1 if skip < -0x7fff: skip -= 1 if skip < -0xfffff: skip -= 1 if skip < -0x1ffffff: skip -= 1 if skip < -0x3fffffff: skip -= 1 return skip def main(): def validate(skip): print('validate: skip %d -> adjusted %d, closed1 %d, closed2 %d' % (skip, adjusted(skip), closed1(skip), closed2(skip))) assert(adjusted(skip) == closed1(skip)) assert(adjusted(skip) == closed2(skip)) for i in xrange(1, 7): n = binsearch(i) print('lowest unadjusted skip offset for %d byte encoding: 0x%x' % (i, n)) for j in xrange(-1, 2): validate(n + j) print('spot checks') validate(-0x7fffffff) validate(-0x80000000) if __name__ == '__main__': main()
def xutf8len(x): if x < 128: return 1 if x < 2048: return 2 if x < 65536: return 3 if x < 2097152: return 4 if x < 67108864: return 5 if x < 2147483648: return 6 return 7 def enci32(x): if x >= 0: return x return -x * 2 + 1 def skipadjust(x): if x >= 0: return 0 t = xutf8len(enci32(x)) t = xutf8len(enci32(x - t)) return t def adjusted(skip): return skip - skipadjust(skip) def binsearch(numbytes): a = -1 b = -4294967295 while a - b > 1: c = (a + b) / 2 n = skipadjust(c) if n > numbytes: b = c else: a = c if skipadjust(a) == numbytes: return a else: return b def closed1(skip): if skip >= 0: return skip if skip >= -62: skip -= 1 elif skip >= -1021: skip -= 2 elif skip >= -32764: skip -= 3 elif skip >= -1048571: skip -= 4 elif skip >= -33554426: skip -= 5 elif skip >= -1073741817: skip -= 6 else: skip -= 7 return skip def closed2(skip): if skip >= 0: return skip skip -= 1 if skip < -63: skip -= 1 if skip < -1023: skip -= 1 if skip < -32767: skip -= 1 if skip < -1048575: skip -= 1 if skip < -33554431: skip -= 1 if skip < -1073741823: skip -= 1 return skip def main(): def validate(skip): print('validate: skip %d -> adjusted %d, closed1 %d, closed2 %d' % (skip, adjusted(skip), closed1(skip), closed2(skip))) assert adjusted(skip) == closed1(skip) assert adjusted(skip) == closed2(skip) for i in xrange(1, 7): n = binsearch(i) print('lowest unadjusted skip offset for %d byte encoding: 0x%x' % (i, n)) for j in xrange(-1, 2): validate(n + j) print('spot checks') validate(-2147483647) validate(-2147483648) if __name__ == '__main__': main()
#!/usr/bin/env python3 # these are the last few bytes of the file o = [int(x, 16) for x in '70 69 63 6f 43 54 4b 80 6b 35 7a 73 69 64 36 71 5f 65 65 61 65 63 34 38 62 7d'.split(' ')] flag = [] for i in range(5): flag.append(o.pop(0)) for i in range(6, 0xf + 1): flag.append(o.pop(0) - 5) flag.append(o.pop(0) + 3) for i in range(0x10, 0x1a): flag.append(o.pop(0)) print(bytes(flag).decode())
o = [int(x, 16) for x in '70 69 63 6f 43 54 4b 80 6b 35 7a 73 69 64 36 71 5f 65 65 61 65 63 34 38 62 7d'.split(' ')] flag = [] for i in range(5): flag.append(o.pop(0)) for i in range(6, 15 + 1): flag.append(o.pop(0) - 5) flag.append(o.pop(0) + 3) for i in range(16, 26): flag.append(o.pop(0)) print(bytes(flag).decode())
n = int(input()) for b in range(1, n+1, 3): print(b)
n = int(input()) for b in range(1, n + 1, 3): print(b)
__all__ = ['simulator', 'screen'] __version__ = '0.0' # See also below and setup.py __revision__ = "$Id$" # New software should look at this instead of at __version__ above. version_info = (0, 0, 0, 'experimental', 0) # See also above and setup.py
__all__ = ['simulator', 'screen'] __version__ = '0.0' __revision__ = '$Id$' version_info = (0, 0, 0, 'experimental', 0)
def computepay(h,r): if h <= 40: return h * r else: return ((h-40) * (r * 1.5)) + (40 * r) hrs = float(input("Enter Hours: ")) rs = float(input("Enter Rate: ")) p = computepay(hrs,rs) print("Pay",p)
def computepay(h, r): if h <= 40: return h * r else: return (h - 40) * (r * 1.5) + 40 * r hrs = float(input('Enter Hours: ')) rs = float(input('Enter Rate: ')) p = computepay(hrs, rs) print('Pay', p)
# 374. Guess Number Higher or Lower # ttungl@gmail.com # The guess API is already defined for you. # @param num, your guess # @return -1 if my number is lower, 1 if my number is higher, otherwise return 0 # def guess(num): class Solution(object): def guessNumber(self, n): """ :type n: int :rtype: int """ # sol 1: # use BS # time O(log n) space O(1) # runtime: 51ms left, right = 1, n while left+1 < right: # two more candidates after loop. mid = left + (right-left)/2 x = guess(mid) if x==0: return mid elif x==-1: right = mid elif x==1: left = mid if guess(left)==0: return left if guess(right)==0: return right return None # sol 2: # use BS # runtime: 36ms bs = [1, n] while True: num = (bs[0] + bs[1])/2 x = guess(num) if x==0: return num elif x<0: bs[1] = num-1 elif x>0: bs[0] = num+1
class Solution(object): def guess_number(self, n): """ :type n: int :rtype: int """ (left, right) = (1, n) while left + 1 < right: mid = left + (right - left) / 2 x = guess(mid) if x == 0: return mid elif x == -1: right = mid elif x == 1: left = mid if guess(left) == 0: return left if guess(right) == 0: return right return None bs = [1, n] while True: num = (bs[0] + bs[1]) / 2 x = guess(num) if x == 0: return num elif x < 0: bs[1] = num - 1 elif x > 0: bs[0] = num + 1
N = int(input()) A = list(map(int, input().split())) ans = [0] * N for i in A: ans[i - 1] += 1 for i in ans: print(i)
n = int(input()) a = list(map(int, input().split())) ans = [0] * N for i in A: ans[i - 1] += 1 for i in ans: print(i)
FILE_TYPE_OPTIONS = {} USAGE_RIGHT_OPTIONS = {} ASPECT_RATIO_OPTIONS = {'tall': 't', 'square': 's', 'wide': 'w', 'panoramic': 'xw'} IMAGE_SIZE_OPTIONS = {'any': '', 'icon': 'i', 'medium': 'm', 'large': 'l', 'exactly': 'ex', '400x300+': 'qsvga', '640x480+': 'vga', '800x600+': 'svga', '1024x768+': 'xga', '2mp+': '2mp', '4mp+': '4mp', '6mp+': '6mp', '8mp+': '8mp', '10mp+': '10mp', '12mp+': '12mp', '15mp+': '15mp', '20mp+': '20mp', '40mp+': '40mp', '70mp+': '70mp'} def aspect_ratio_paramenter(option): if not option: return None ASPECT_RATIO_PARAM = 'iar' return ASPECT_RATIO_PARAM + ':' + ASPECT_RATIO_OPTIONS[option] def image_size_parameter(option): if not option: return None IMAGE_SIZE_PARAM = 'isz' if isinstance(option, (tuple, list)): width, height = option values = ':{},iszw:{},iszh:{}'.format(IMAGE_SIZE_OPTIONS['exactly'], width, height) return IMAGE_SIZE_PARAM + values else: return IMAGE_SIZE_PARAM + ':' + IMAGE_SIZE_OPTIONS[option] def image_aspect_parameters(aspect_ratio, image_size): if any([aspect_ratio, image_size]) is False: return None else: IMAGE_RELATED = 'tbs=' values = filter(lambda x: x is not None, [aspect_ratio, image_size]) options = ','.join(list(values)) return '{}{}'.format(IMAGE_RELATED, options) def query_builder(query, image_size=None, aspect_ratio=None, page_number=0): if query is None: raise ValueError('query must have a value.') SEARCH_TYPE = 'tbm' IMAGES = 'isch' SEARCH_TYPE_PARAM = '='.join([SEARCH_TYPE, IMAGES]) BASE_URL = 'https://www.google.com/search?' + SEARCH_TYPE_PARAM # Add page number PAGE_NUMBER = 'ijn' page_number_param = '='.join([PAGE_NUMBER, str(page_number)]) URL = '&'.join([BASE_URL, page_number_param]) # Add query value QUERY_TYPE = 'q' query_param = '='.join([QUERY_TYPE, str(query)]) URL = '&'.join([URL, query_param]) # Add image aspects parameters iar = aspect_ratio_paramenter(aspect_ratio) isz = image_size_parameter(image_size) image_aspect_param = image_aspect_parameters(iar, isz) if image_aspect_param is not None: URL = '&'.join([URL, image_aspect_param]) return URL
file_type_options = {} usage_right_options = {} aspect_ratio_options = {'tall': 't', 'square': 's', 'wide': 'w', 'panoramic': 'xw'} image_size_options = {'any': '', 'icon': 'i', 'medium': 'm', 'large': 'l', 'exactly': 'ex', '400x300+': 'qsvga', '640x480+': 'vga', '800x600+': 'svga', '1024x768+': 'xga', '2mp+': '2mp', '4mp+': '4mp', '6mp+': '6mp', '8mp+': '8mp', '10mp+': '10mp', '12mp+': '12mp', '15mp+': '15mp', '20mp+': '20mp', '40mp+': '40mp', '70mp+': '70mp'} def aspect_ratio_paramenter(option): if not option: return None aspect_ratio_param = 'iar' return ASPECT_RATIO_PARAM + ':' + ASPECT_RATIO_OPTIONS[option] def image_size_parameter(option): if not option: return None image_size_param = 'isz' if isinstance(option, (tuple, list)): (width, height) = option values = ':{},iszw:{},iszh:{}'.format(IMAGE_SIZE_OPTIONS['exactly'], width, height) return IMAGE_SIZE_PARAM + values else: return IMAGE_SIZE_PARAM + ':' + IMAGE_SIZE_OPTIONS[option] def image_aspect_parameters(aspect_ratio, image_size): if any([aspect_ratio, image_size]) is False: return None else: image_related = 'tbs=' values = filter(lambda x: x is not None, [aspect_ratio, image_size]) options = ','.join(list(values)) return '{}{}'.format(IMAGE_RELATED, options) def query_builder(query, image_size=None, aspect_ratio=None, page_number=0): if query is None: raise value_error('query must have a value.') search_type = 'tbm' images = 'isch' search_type_param = '='.join([SEARCH_TYPE, IMAGES]) base_url = 'https://www.google.com/search?' + SEARCH_TYPE_PARAM page_number = 'ijn' page_number_param = '='.join([PAGE_NUMBER, str(page_number)]) url = '&'.join([BASE_URL, page_number_param]) query_type = 'q' query_param = '='.join([QUERY_TYPE, str(query)]) url = '&'.join([URL, query_param]) iar = aspect_ratio_paramenter(aspect_ratio) isz = image_size_parameter(image_size) image_aspect_param = image_aspect_parameters(iar, isz) if image_aspect_param is not None: url = '&'.join([URL, image_aspect_param]) return URL
def cipher(text, shift, encrypt=True): """ Encrypts and decrypts words written using a Caesar cipher, which replaces a letter with another letter a given number of places away in the alphabet. Parameters ---------- text : String The String that should be processed in the function shift : Integer The number of alphabetic positions away the individual letters of the String should be shifted. Can be positive or negative. encrypt : Boolean, default True Indicates whether the function should return the text encrypted or decrypted. Returns ------- String The encrypted or decrypted version of the text input. Examples -------- >>> from cipher_lmd2231 import cipher >>> cipher(text='OneSingleWord', shift=5, encrypt=True) TsjXnslqjbtwi Each character in `OneSingleWord` is shifted 5 places ahead. >>> cipher(text='TsjXnslqjbtwi', shift=-5, encrypt=True) OneSingleWord Each character in `TsjXnslqjbtwi` is shifted 5 places back. >>> cipher(text='TsjXnslqjbtwi', shift=5, encrypt=False) OneSingleWord Each character in `TsjXnslqjbtwi` is shifted 5 places back due to the encrypt argument. """ alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' new_text = '' for c in text: index = alphabet.find(c) if index == -1: new_text += c else: new_index = index + shift if encrypt == True else index - shift new_index %= len(alphabet) new_text += alphabet[new_index:new_index+1] return new_text
def cipher(text, shift, encrypt=True): """ Encrypts and decrypts words written using a Caesar cipher, which replaces a letter with another letter a given number of places away in the alphabet. Parameters ---------- text : String The String that should be processed in the function shift : Integer The number of alphabetic positions away the individual letters of the String should be shifted. Can be positive or negative. encrypt : Boolean, default True Indicates whether the function should return the text encrypted or decrypted. Returns ------- String The encrypted or decrypted version of the text input. Examples -------- >>> from cipher_lmd2231 import cipher >>> cipher(text='OneSingleWord', shift=5, encrypt=True) TsjXnslqjbtwi Each character in `OneSingleWord` is shifted 5 places ahead. >>> cipher(text='TsjXnslqjbtwi', shift=-5, encrypt=True) OneSingleWord Each character in `TsjXnslqjbtwi` is shifted 5 places back. >>> cipher(text='TsjXnslqjbtwi', shift=5, encrypt=False) OneSingleWord Each character in `TsjXnslqjbtwi` is shifted 5 places back due to the encrypt argument. """ alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' new_text = '' for c in text: index = alphabet.find(c) if index == -1: new_text += c else: new_index = index + shift if encrypt == True else index - shift new_index %= len(alphabet) new_text += alphabet[new_index:new_index + 1] return new_text
d={} while True: s=input().split() if s == ["-1"]: break else: id,subject=s[0],s[1:] for sub in subject: if sub not in d: d[sub]={id} else: d[sub].add(id) class1,class2=input().split() if (class1 in d) and (class2 in d): twoclass=len(d[class1] & d[class2]) orclass=len(d[class1] | d[class2]) oneclass=orclass-twoclass elif class1 in d: twoclass=0 orclass=oneclass=len(d[class1]) elif class2 in d: twoclass=0 orclass=oneclass=len(d[class2]) else: twoclass=orclass=oneclass=0 print(twoclass,oneclass,orclass)
d = {} while True: s = input().split() if s == ['-1']: break else: (id, subject) = (s[0], s[1:]) for sub in subject: if sub not in d: d[sub] = {id} else: d[sub].add(id) (class1, class2) = input().split() if class1 in d and class2 in d: twoclass = len(d[class1] & d[class2]) orclass = len(d[class1] | d[class2]) oneclass = orclass - twoclass elif class1 in d: twoclass = 0 orclass = oneclass = len(d[class1]) elif class2 in d: twoclass = 0 orclass = oneclass = len(d[class2]) else: twoclass = orclass = oneclass = 0 print(twoclass, oneclass, orclass)
class Solution: # @param A : list of integers # @param B : integer # @return an integer def solve(self, A, B): n = len(A) left = 0 right = n - 1 count = 0 while (left <= right): mid = int((right + left) / 2) # Check if middle element is less than or equal to B if (A[mid] <= B): # At least (mid + 1) elements are there whose values are less than or equal to key count = mid + 1 left = mid + 1 # If B is smaller, ignore right half else: right = mid - 1 return count def solve2(self, A, B): lo = 0 hi = len(A) - 1 mid = (lo + hi) // 2 counter = -10 if B > A[hi - 1]: return hi if B < A[0]: return 0 while lo <= hi: mid = (lo + hi) // 2 if A[mid] == B: counter = mid break elif A[mid] > B: hi = mid - 1 else: lo = mid + 1 counter = mid while counter < len(A) and A[counter] <= B: counter += 1 return counter def solve3(self, A, B): counter = 0 while counter < len(A) and A[counter] <= B: counter += 1 return counter # A = [1, 3, 3, 4, 6, 6, 6, 7, 8, 9] # B = 6 A = [1, 1, 1, 1, 1] B = 1 # A = [1, 3, 5, 7, 9] # B = 4 s = Solution() print(s.solve(A, B))
class Solution: def solve(self, A, B): n = len(A) left = 0 right = n - 1 count = 0 while left <= right: mid = int((right + left) / 2) if A[mid] <= B: count = mid + 1 left = mid + 1 else: right = mid - 1 return count def solve2(self, A, B): lo = 0 hi = len(A) - 1 mid = (lo + hi) // 2 counter = -10 if B > A[hi - 1]: return hi if B < A[0]: return 0 while lo <= hi: mid = (lo + hi) // 2 if A[mid] == B: counter = mid break elif A[mid] > B: hi = mid - 1 else: lo = mid + 1 counter = mid while counter < len(A) and A[counter] <= B: counter += 1 return counter def solve3(self, A, B): counter = 0 while counter < len(A) and A[counter] <= B: counter += 1 return counter a = [1, 1, 1, 1, 1] b = 1 s = solution() print(s.solve(A, B))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeInBetween(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: fakeNode = ListNode() fakeNode.next = list1 list1Curr = fakeNode list2Curr = list2 aPos, bPos = None, None temp = 0 while list1Curr.next: if temp == a: aPos = list1Curr if temp == b: bPos = list1Curr.next break list1Curr = list1Curr.next temp += 1 while list2Curr.next: list2Curr = list2Curr.next aPos.next = list2 list2Curr.next = bPos.next return fakeNode.next def mergeInBetweenForLoop(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: fakeNode = ListNode(next=list1) list1Curr = fakeNode list2Curr = list2 aPos, bPos = None, None for i in range(b + 1): if i == a: aPos = list1Curr list1Curr = list1Curr.next bPos = list1Curr while list2Curr.next: list2Curr = list2Curr.next aPos.next = list2 list2Curr.next = bPos.next return fakeNode.next
class Solution: def merge_in_between(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: fake_node = list_node() fakeNode.next = list1 list1_curr = fakeNode list2_curr = list2 (a_pos, b_pos) = (None, None) temp = 0 while list1Curr.next: if temp == a: a_pos = list1Curr if temp == b: b_pos = list1Curr.next break list1_curr = list1Curr.next temp += 1 while list2Curr.next: list2_curr = list2Curr.next aPos.next = list2 list2Curr.next = bPos.next return fakeNode.next def merge_in_between_for_loop(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: fake_node = list_node(next=list1) list1_curr = fakeNode list2_curr = list2 (a_pos, b_pos) = (None, None) for i in range(b + 1): if i == a: a_pos = list1Curr list1_curr = list1Curr.next b_pos = list1Curr while list2Curr.next: list2_curr = list2Curr.next aPos.next = list2 list2Curr.next = bPos.next return fakeNode.next
''' Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: arr.length >= 3 There exists some i with 0 < i < arr.length - 1 such that: arr[0] < arr[1] < ... < arr[i - 1] < arr[i] arr[i] > arr[i + 1] > ... > arr[arr.length - 1] Example 1: Input: arr = [2,1] Output: false Example 2: Input: arr = [3,5,5] Output: false Example 3: Input: arr = [0,3,2,1] Output: true ''' class Solution(object): def validMountainArray(self, arr): if len(arr) < 3: return False left_ptr, right_ptr = 0, len(arr) - 1 while (left_ptr < right_ptr): if arr[left_ptr] < arr[left_ptr + 1]: left_ptr += 1 elif arr[right_ptr - 1] > arr[right_ptr]: right_ptr -= 1 else: break if left_ptr == right_ptr and left_ptr !=0 and right_ptr != len(arr) - 1: return True else: return False
""" Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: arr.length >= 3 There exists some i with 0 < i < arr.length - 1 such that: arr[0] < arr[1] < ... < arr[i - 1] < arr[i] arr[i] > arr[i + 1] > ... > arr[arr.length - 1] Example 1: Input: arr = [2,1] Output: false Example 2: Input: arr = [3,5,5] Output: false Example 3: Input: arr = [0,3,2,1] Output: true """ class Solution(object): def valid_mountain_array(self, arr): if len(arr) < 3: return False (left_ptr, right_ptr) = (0, len(arr) - 1) while left_ptr < right_ptr: if arr[left_ptr] < arr[left_ptr + 1]: left_ptr += 1 elif arr[right_ptr - 1] > arr[right_ptr]: right_ptr -= 1 else: break if left_ptr == right_ptr and left_ptr != 0 and (right_ptr != len(arr) - 1): return True else: return False
# Choose the GNN architecture between "DeepSet", "GCN", "EdgeNet", "PointNet", "MetaNet" #use_model = "DeepSet" #use_model = "GCN" use_model = "EdgeNet" #use_model = "PointNet" #use_model = "EdgePoint" #use_model = "MetaNet" # Learning rate learning_rate = 0.0006303742576368124 # Weight decay weight_decay = 1.991127058506617e-08 # Number of layers of each graph layer n_layers = 1 # Number of nearest neighbors in kNN / radius of NNs k_nn = 4.86294104668695 # Number of epochs n_epochs = 150 # If training, set to True, otherwise loads a pretrained model and tests it training = True # Simulation suite, choose between "IllustrisTNG" and "SIMBA" #simsuite = "SIMBA" simsuite = "SIMBA" # Simulation set, choose between "CV" and "LH" simset = "CV" # Number of simulations considered, maximum 27 for CV and 1000 for LH n_sims = 27 params = [use_model, learning_rate, weight_decay, n_layers, k_nn, n_epochs, training, simsuite, simset, n_sims]
use_model = 'EdgeNet' learning_rate = 0.0006303742576368124 weight_decay = 1.991127058506617e-08 n_layers = 1 k_nn = 4.86294104668695 n_epochs = 150 training = True simsuite = 'SIMBA' simset = 'CV' n_sims = 27 params = [use_model, learning_rate, weight_decay, n_layers, k_nn, n_epochs, training, simsuite, simset, n_sims]
""" """ load("@bazel_skylib//rules:copy_file.bzl", _copy_file = "copy_file") def path_concat(*args): """Concatenate a list of paths Args: *args: The paths to concatenate. Returns: A path that consists of the individual path segments but concatenated. """ path = "" for arg in args: if path == "": path = arg elif arg == "": pass elif arg.startswith("/"): path += arg else: path += "/" + arg if path.endswith("/"): path = path[:-1] return path def _copy_files(ctx): outputs = [] strip_prefix = ctx.attr.strip_prefix if not strip_prefix.startswith("/"): strip_prefix = path_concat(ctx.label.package, strip_prefix) strip_prefix = path_concat(ctx.label.workspace_root, strip_prefix) strip_len = len(strip_prefix) + 1 bindir_prefix = path_concat(ctx.bin_dir.path, strip_prefix) gendir_prefix = path_concat(ctx.genfiles_dir.path, strip_prefix) for src in ctx.files.srcs: if src.path.startswith(strip_prefix): out_rel = src.path[strip_len:] elif src.path.startswith(bindir_prefix): out_rel = src.path[len(bindir_prefix) + 1:] elif src.path.startswith(gendir_prefix): out_rel = src.path[len(gendir_prefix) + 1:] else: fail("{} did not start with prefix {}".format(src.path, strip_prefix)) if ctx.attr.output_to_bindir: out = ctx.actions.declare_file(path_concat( ctx.bin_dir.path, ctx.attr.prefix, out_rel )) else: out = ctx.actions.declare_file(path_concat( ctx.genfiles_dir.path, ctx.attr.prefix, out_rel )) args = ctx.actions.args() args.add(src) args.add(out) ctx.actions.run_shell( outputs = [out], inputs = [src], command = "mkdir -p $(dirname $2); cp $1 $2", arguments = [args], mnemonic = "CopyFile" ) outputs.append(out) return [DefaultInfo(files = depset(outputs))] copy_files = rule( implementation = _copy_files, attrs = { "srcs": attr.label_list(allow_files = True, mandatory = True), "prefix": attr.string(default = ""), "strip_prefix": attr.string(default = ""), "output_to_bindir": attr.bool(default = False), } ) def copy_file(name, src, is_executable = False, allow_symlink = False, **kwargs): """Copies a file to another location. This is a wrapper around copy_file within bazel-skylib. Args: name: Name of the rule. src: A Label. The file to make a copy of. (Can also be the label of a rule that generates a file.) is_executable: A boolean. Whether to make the output file executable. When True, the rule's output can be executed using `bazel run` and can be in the srcs of binary and test rules that require executable sources. WARNING: If `allow_symlink` is True, `src` must also be executable. allow_symlink: A boolean. Whether to allow symlinking instead of copying. When False, the output is always a hard copy. When True, the output *can* be a symlink, but there is no guarantee that a symlink is created (i.e., at the time of writing, we don't create symlinks on Windows). Set this to True if you need fast copying and your tools can handle symlinks (which most UNIX tools can). **kwargs: further keyword arguments, e.g. `visibility` """ _copy_file( name = name + "#copy", src = src, out = name, is_executable = is_executable, allow_symlink = allow_symlink, **kwargs )
""" """ load('@bazel_skylib//rules:copy_file.bzl', _copy_file='copy_file') def path_concat(*args): """Concatenate a list of paths Args: *args: The paths to concatenate. Returns: A path that consists of the individual path segments but concatenated. """ path = '' for arg in args: if path == '': path = arg elif arg == '': pass elif arg.startswith('/'): path += arg else: path += '/' + arg if path.endswith('/'): path = path[:-1] return path def _copy_files(ctx): outputs = [] strip_prefix = ctx.attr.strip_prefix if not strip_prefix.startswith('/'): strip_prefix = path_concat(ctx.label.package, strip_prefix) strip_prefix = path_concat(ctx.label.workspace_root, strip_prefix) strip_len = len(strip_prefix) + 1 bindir_prefix = path_concat(ctx.bin_dir.path, strip_prefix) gendir_prefix = path_concat(ctx.genfiles_dir.path, strip_prefix) for src in ctx.files.srcs: if src.path.startswith(strip_prefix): out_rel = src.path[strip_len:] elif src.path.startswith(bindir_prefix): out_rel = src.path[len(bindir_prefix) + 1:] elif src.path.startswith(gendir_prefix): out_rel = src.path[len(gendir_prefix) + 1:] else: fail('{} did not start with prefix {}'.format(src.path, strip_prefix)) if ctx.attr.output_to_bindir: out = ctx.actions.declare_file(path_concat(ctx.bin_dir.path, ctx.attr.prefix, out_rel)) else: out = ctx.actions.declare_file(path_concat(ctx.genfiles_dir.path, ctx.attr.prefix, out_rel)) args = ctx.actions.args() args.add(src) args.add(out) ctx.actions.run_shell(outputs=[out], inputs=[src], command='mkdir -p $(dirname $2); cp $1 $2', arguments=[args], mnemonic='CopyFile') outputs.append(out) return [default_info(files=depset(outputs))] copy_files = rule(implementation=_copy_files, attrs={'srcs': attr.label_list(allow_files=True, mandatory=True), 'prefix': attr.string(default=''), 'strip_prefix': attr.string(default=''), 'output_to_bindir': attr.bool(default=False)}) def copy_file(name, src, is_executable=False, allow_symlink=False, **kwargs): """Copies a file to another location. This is a wrapper around copy_file within bazel-skylib. Args: name: Name of the rule. src: A Label. The file to make a copy of. (Can also be the label of a rule that generates a file.) is_executable: A boolean. Whether to make the output file executable. When True, the rule's output can be executed using `bazel run` and can be in the srcs of binary and test rules that require executable sources. WARNING: If `allow_symlink` is True, `src` must also be executable. allow_symlink: A boolean. Whether to allow symlinking instead of copying. When False, the output is always a hard copy. When True, the output *can* be a symlink, but there is no guarantee that a symlink is created (i.e., at the time of writing, we don't create symlinks on Windows). Set this to True if you need fast copying and your tools can handle symlinks (which most UNIX tools can). **kwargs: further keyword arguments, e.g. `visibility` """ _copy_file(name=name + '#copy', src=src, out=name, is_executable=is_executable, allow_symlink=allow_symlink, **kwargs)
age = 22 # if age >= 18: # message = "Eligible" # else: # message = "Not eligible" message = "Eligible" if age >= 18 else "Not eligible" print(message)
age = 22 message = 'Eligible' if age >= 18 else 'Not eligible' print(message)
""" Given an array of strings A[], determine if the strings can be chained together to form a circle. A string X can be chained together with another string Y if the last character of X is same as first character of Y. If every string of the array can be chained, it will form a circle. For eg for the array arr[] = {"for", "geek", "rig", "kaf"} the answer will be Yes as the given strings can be chained as "for", "rig", "geek" and "kaf". SOLUTION 1: Brute force (Backtracking) SOLUTION 2: Create a directed graph such that for every word `abc`, there is an edge from vertex 'a' -> 'c'. Now just check if this graph has an eulerian circuit or not. To do this, just check that for every vertex in-degree == out-degree. Also, start dfs from any vertex (with non zero in and out degrees) and do a DFS. If DFS covers all nodes, means its connected, meaning it is an eulerian graph. SOLUTION 3: Create a directed graph between words (word is a node). Now check if there is a hamiltonian circuit. But checking if a graph is hamiltonian is NP complete. So no point! """ def is_circle_possible(strs): words_mapping = {} for str in strs: words = words_mapping.get(str[0], []) words_mapping[str[0]] = words words.append(str) circle = [] for word in strs: ret = dfs(word, words_mapping, len(strs), circle) if ret: return circle return None def dfs(word, mapping, num_words_total, circle): # CAREFUL: We cannot use a visited set() as there can be duplicate # words in the input array. # Example - ['aa', 'aa'] mapping[word[0]].remove(word) circle.append(word) if len(circle) == num_words_total and word[-1] == circle[0][0]: return True last_char = word[-1] for neigh in mapping.get(last_char, []): ret = dfs(neigh, mapping, num_words_total, circle) if ret: return True circle.pop() mapping[word[0]].append(word) return False def main(): words = ["for", "geek", "rig", "kaf"] words = ["ceee", "eeece", "ddbc"] # words = ['ab', 'bc', 'cd', 'da'] # words = ['abc', 'bcd', 'cdf'] words = ["dedce", "cdcae", "debdc", "d", "abde"] words = ["e", "e"] ans = is_circle_possible(words) print(ans) main()
""" Given an array of strings A[], determine if the strings can be chained together to form a circle. A string X can be chained together with another string Y if the last character of X is same as first character of Y. If every string of the array can be chained, it will form a circle. For eg for the array arr[] = {"for", "geek", "rig", "kaf"} the answer will be Yes as the given strings can be chained as "for", "rig", "geek" and "kaf". SOLUTION 1: Brute force (Backtracking) SOLUTION 2: Create a directed graph such that for every word `abc`, there is an edge from vertex 'a' -> 'c'. Now just check if this graph has an eulerian circuit or not. To do this, just check that for every vertex in-degree == out-degree. Also, start dfs from any vertex (with non zero in and out degrees) and do a DFS. If DFS covers all nodes, means its connected, meaning it is an eulerian graph. SOLUTION 3: Create a directed graph between words (word is a node). Now check if there is a hamiltonian circuit. But checking if a graph is hamiltonian is NP complete. So no point! """ def is_circle_possible(strs): words_mapping = {} for str in strs: words = words_mapping.get(str[0], []) words_mapping[str[0]] = words words.append(str) circle = [] for word in strs: ret = dfs(word, words_mapping, len(strs), circle) if ret: return circle return None def dfs(word, mapping, num_words_total, circle): mapping[word[0]].remove(word) circle.append(word) if len(circle) == num_words_total and word[-1] == circle[0][0]: return True last_char = word[-1] for neigh in mapping.get(last_char, []): ret = dfs(neigh, mapping, num_words_total, circle) if ret: return True circle.pop() mapping[word[0]].append(word) return False def main(): words = ['for', 'geek', 'rig', 'kaf'] words = ['ceee', 'eeece', 'ddbc'] words = ['dedce', 'cdcae', 'debdc', 'd', 'abde'] words = ['e', 'e'] ans = is_circle_possible(words) print(ans) main()
"""Given an integer n, return any array containing n unique integers such that they add up to 0. Example 1: Input: n = 5 Output: [-7,-1,1,3,4] Explanation: These arrays also are accepted [-5,-1,1,2,3] , [-3,-1,2,-2,4].""" n = 5 list = [] for i in range(1, (n // 2) + 1): posi = i neg = -1 * i list.append(posi) list.append(neg) if n % 2 != 0: list.append(0) print(list)
"""Given an integer n, return any array containing n unique integers such that they add up to 0. Example 1: Input: n = 5 Output: [-7,-1,1,3,4] Explanation: These arrays also are accepted [-5,-1,1,2,3] , [-3,-1,2,-2,4].""" n = 5 list = [] for i in range(1, n // 2 + 1): posi = i neg = -1 * i list.append(posi) list.append(neg) if n % 2 != 0: list.append(0) print(list)
def mult (x,y): return (x*y) def div (x,y): return (x/y)
def mult(x, y): return x * y def div(x, y): return x / y
__author__ = 'Fule Liu' PROTEIN = "ACDEFGHIKLMNPQRSTVWY" DNA = "ACGT" RNA = "ACGU" didna_list = ['Base stacking', 'Protein induced deformability', 'B-DNA twist', 'Dinucleotide GC Content', 'A-philicity', 'Propeller twist', 'Duplex stability:(freeenergy)', 'Duplex tability(disruptenergy)', 'DNA denaturation', 'Bending stiffness', 'Protein DNA twist', 'Stabilising energy of Z-DNA', 'Aida_BA_transition', 'Breslauer_dG', 'Breslauer_dH', 'Breslauer_dS', 'Electron_interaction', 'Hartman_trans_free_energy', 'Helix-Coil_transition', 'Ivanov_BA_transition', 'Lisser_BZ_transition', 'Polar_interaction', 'SantaLucia_dG', 'SantaLucia_dH', 'SantaLucia_dS', 'Sarai_flexibility', 'Stability', 'Stacking_energy', 'Sugimoto_dG', 'Sugimoto_dH', 'Sugimoto_dS', 'Watson-Crick_interaction', 'Twist', 'Tilt', 'Roll', 'Shift', 'Slide', 'Rise', 'Clash Strength', 'Roll_roll', 'Twist stiffness', 'Tilt stiffness', 'Shift_rise', 'Adenine content', 'Direction', 'Twist_shift', 'Enthalpy1', 'Twist_twist', 'Roll_shift', 'Shift_slide', 'Shift2', 'Tilt3', 'Tilt1', 'Tilt4', 'Tilt2', 'Slide (DNA-protein complex)1', 'Tilt_shift', 'Twist_tilt', 'Twist (DNA-protein complex)1', 'Tilt_rise', 'Roll_rise', 'Stacking energy', 'Stacking energy1', 'Stacking energy2', 'Stacking energy3', 'Propeller Twist', 'Roll11', 'Rise (DNA-protein complex)', 'Tilt_tilt', 'Roll4', 'Roll2', 'Roll3', 'Roll1', 'Minor Groove Size', 'GC content', 'Slide_slide', 'Enthalpy', 'Shift_shift', 'Slide stiffness', 'Melting Temperature1', 'Flexibility_slide', 'Minor Groove Distance', 'Rise (DNA-protein complex)1', 'Tilt (DNA-protein complex)', 'Guanine content', 'Roll (DNA-protein complex)1', 'Entropy', 'Cytosine content', 'Major Groove Size', 'Twist_rise', 'Major Groove Distance', 'Twist (DNA-protein complex)', 'Purine (AG) content', 'Melting Temperature', 'Free energy', 'Tilt_slide', 'Major Groove Width', 'Major Groove Depth', 'Wedge', 'Free energy8', 'Free energy6', 'Free energy7', 'Free energy4', 'Free energy5', 'Free energy2', 'Free energy3', 'Free energy1', 'Twist_roll', 'Shift (DNA-protein complex)', 'Rise_rise', 'Flexibility_shift', 'Shift (DNA-protein complex)1', 'Thymine content', 'Slide_rise', 'Tilt_roll', 'Tip', 'Keto (GT) content', 'Roll stiffness', 'Minor Groove Width', 'Inclination', 'Entropy1', 'Roll_slide', 'Slide (DNA-protein complex)', 'Twist1', 'Twist3', 'Twist2', 'Twist5', 'Twist4', 'Twist7', 'Twist6', 'Tilt (DNA-protein complex)1', 'Twist_slide', 'Minor Groove Depth', 'Roll (DNA-protein complex)', 'Rise2', 'Persistance Length', 'Rise3', 'Shift stiffness', 'Probability contacting nucleosome core', 'Mobility to bend towards major groove', 'Slide3', 'Slide2', 'Slide1', 'Shift1', 'Bend', 'Rise1', 'Rise stiffness', 'Mobility to bend towards minor groove'] tridna_list = ['Dnase I', 'Bendability (DNAse)', 'Bendability (consensus)', 'Trinucleotide GC Content', 'Nucleosome positioning', 'Consensus_roll', 'Consensus-Rigid', 'Dnase I-Rigid', 'MW-Daltons', 'MW-kg', 'Nucleosome', 'Nucleosome-Rigid'] dirna_list = ['Slide (RNA)', 'Adenine content', 'Hydrophilicity (RNA)', 'Tilt (RNA)', 'Stacking energy (RNA)', 'Twist (RNA)', 'Entropy (RNA)', 'Roll (RNA)', 'Purine (AG) content', 'Hydrophilicity (RNA)1', 'Enthalpy (RNA)1', 'GC content', 'Entropy (RNA)1', 'Rise (RNA)', 'Free energy (RNA)', 'Keto (GT) content', 'Free energy (RNA)1', 'Enthalpy (RNA)', 'Guanine content', 'Shift (RNA)', 'Cytosine content', 'Thymine content'] pro_list = ['Hydrophobicity', 'Hydrophilicity', 'Mass', 'ANDN920101', 'ARGP820101', 'ARGP820102', 'ARGP820103', 'BEGF750101', 'BEGF750102', 'BEGF750103', 'BHAR880101', 'BIGC670101', 'BIOV880101', 'BIOV880102', 'BROC820101', 'BROC820102', 'BULH740101', 'BULH740102', 'BUNA790101', 'BUNA790102', 'BUNA790103', 'BURA740101', 'BURA740102', 'CHAM810101', 'CHAM820101', 'CHAM820102', 'CHAM830101', 'CHAM830102', 'CHAM830103', 'CHAM830104', 'CHAM830105', 'CHAM830106', 'CHAM830107', 'CHAM830108', 'CHOC750101', 'CHOC760101', 'CHOC760102', 'CHOC760103', 'CHOC760104', 'CHOP780101', 'CHOP780201', 'CHOP780202', 'CHOP780203', 'CHOP780204', 'CHOP780205', 'CHOP780206', 'CHOP780207', 'CHOP780208', 'CHOP780209', 'CHOP780210', 'CHOP780211', 'CHOP780212', 'CHOP780213', 'CHOP780214', 'CHOP780215', 'CHOP780216', 'CIDH920101', 'CIDH920102', 'CIDH920103', 'CIDH920104', 'CIDH920105', 'COHE430101', 'CRAJ730101', 'CRAJ730102', 'CRAJ730103', 'DAWD720101', 'DAYM780101', 'DAYM780201', 'DESM900101', 'DESM900102', 'EISD840101', 'EISD860101', 'EISD860102', 'EISD860103', 'FASG760101', 'FASG760102', 'FASG760103', 'FASG760104', 'FASG760105', 'FAUJ830101', 'FAUJ880101', 'FAUJ880102', 'FAUJ880103', 'FAUJ880104', 'FAUJ880105', 'FAUJ880106', 'FAUJ880107', 'FAUJ880108', 'FAUJ880109', 'FAUJ880110', 'FAUJ880111', 'FAUJ880112', 'FAUJ880113', 'FINA770101', 'FINA910101', 'FINA910102', 'FINA910103', 'FINA910104', 'GARJ730101', 'GEIM800101', 'GEIM800102', 'GEIM800103', 'GEIM800104', 'GEIM800105', 'GEIM800106', 'GEIM800107', 'GEIM800108', 'GEIM800109', 'GEIM800110', 'GEIM800111', 'GOLD730101', 'GOLD730102', 'GRAR740101', 'GRAR740102', 'GRAR740103', 'GUYH850101', 'HOPA770101', 'HOPT810101', 'HUTJ700101', 'HUTJ700102', 'HUTJ700103', 'ISOY800101', 'ISOY800102', 'ISOY800103', 'ISOY800104', 'ISOY800105', 'ISOY800106', 'ISOY800107', 'ISOY800108', 'JANJ780101', 'JANJ780102', 'JANJ780103', 'JANJ790101', 'JANJ790102', 'JOND750101', 'JOND750102', 'JOND920101', 'JOND920102', 'JUKT750101', 'JUNJ780101', 'KANM800101', 'KANM800102', 'KANM800103', 'KANM800104', 'KARP850101', 'KARP850102', 'KARP850103', 'KHAG800101', 'KLEP840101', 'KRIW710101', 'KRIW790101', 'KRIW790102', 'KRIW790103', 'KYTJ820101', 'LAWE840101', 'LEVM760101', 'LEVM760102', 'LEVM760103', 'LEVM760104', 'LEVM760105', 'LEVM760106', 'LEVM760107', 'LEVM780101', 'LEVM780102', 'LEVM780103', 'LEVM780104', 'LEVM780105', 'LEVM780106', 'LEWP710101', 'LIFS790101', 'LIFS790102', 'LIFS790103', 'MANP780101', 'MAXF760101', 'MAXF760102', 'MAXF760103', 'MAXF760104', 'MAXF760105', 'MAXF760106', 'MCMT640101', 'MEEJ800101', 'MEEJ800102', 'MEEJ810101', 'MEEJ810102', 'MEIH800101', 'MEIH800102', 'MEIH800103', 'MIYS850101', 'NAGK730101', 'NAGK730102', 'NAGK730103', 'NAKH900101', 'NAKH900102', 'NAKH900103', 'NAKH900104', 'NAKH900105', 'NAKH900106', 'NAKH900107', 'NAKH900108', 'NAKH900109', 'NAKH900110', 'NAKH900111', 'NAKH900112', 'NAKH900113', 'NAKH920101', 'NAKH920102', 'NAKH920103', 'NAKH920104', 'NAKH920105', 'NAKH920106', 'NAKH920107', 'NAKH920108', 'NISK800101', 'NISK860101', 'NOZY710101', 'OOBM770101', 'OOBM770102', 'OOBM770103', 'OOBM770104', 'OOBM770105', 'OOBM850101', 'OOBM850102', 'OOBM850103', 'OOBM850104', 'OOBM850105', 'PALJ810101', 'PALJ810102', 'PALJ810103', 'PALJ810104', 'PALJ810105', 'PALJ810106', 'PALJ810107', 'PALJ810108', 'PALJ810109', 'PALJ810110', 'PALJ810111', 'PALJ810112', 'PALJ810113', 'PALJ810114', 'PALJ810115', 'PALJ810116', 'PARJ860101', 'PLIV810101', 'PONP800101', 'PONP800102', 'PONP800103', 'PONP800104', 'PONP800105', 'PONP800106', 'PONP800107', 'PONP800108', 'PRAM820101', 'PRAM820102', 'PRAM820103', 'PRAM900101', 'PRAM900102', 'PRAM900103', 'PRAM900104', 'PTIO830101', 'PTIO830102', 'QIAN880101', 'QIAN880102', 'QIAN880103', 'QIAN880104', 'QIAN880105', 'QIAN880106', 'QIAN880107', 'QIAN880108', 'QIAN880109', 'QIAN880110', 'QIAN880111', 'QIAN880112', 'QIAN880113', 'QIAN880114', 'QIAN880115', 'QIAN880116', 'QIAN880117', 'QIAN880118', 'QIAN880119', 'QIAN880120', 'QIAN880121', 'QIAN880122', 'QIAN880123', 'QIAN880124', 'QIAN880125', 'QIAN880126', 'QIAN880127', 'QIAN880128', 'QIAN880129', 'QIAN880130', 'QIAN880131', 'QIAN880132', 'QIAN880133', 'QIAN880134', 'QIAN880135', 'QIAN880136', 'QIAN880137', 'QIAN880138', 'QIAN880139', 'RACS770101', 'RACS770102', 'RACS770103', 'RACS820101', 'RACS820102', 'RACS820103', 'RACS820104', 'RACS820105', 'RACS820106', 'RACS820107', 'RACS820108', 'RACS820109', 'RACS820110', 'RACS820111', 'RACS820112', 'RACS820113', 'RACS820114', 'RADA880101', 'RADA880102', 'RADA880103', 'RADA880104', 'RADA880105', 'RADA880106', 'RADA880107', 'RADA880108', 'RICJ880101', 'RICJ880102', 'RICJ880103', 'RICJ880104', 'RICJ880105', 'RICJ880106', 'RICJ880107', 'RICJ880108', 'RICJ880109', 'RICJ880110', 'RICJ880111', 'RICJ880112', 'RICJ880113', 'RICJ880114', 'RICJ880115', 'RICJ880116', 'RICJ880117', 'ROBB760101', 'ROBB760102', 'ROBB760103', 'ROBB760104', 'ROBB760105', 'ROBB760106', 'ROBB760107', 'ROBB760108', 'ROBB760109', 'ROBB760110', 'ROBB760111', 'ROBB760112', 'ROBB760113', 'ROBB790101', 'ROSG850101', 'ROSG850102', 'ROSM880101', 'ROSM880102', 'ROSM880103', 'SIMZ760101', 'SNEP660101', 'SNEP660102', 'SNEP660103', 'SNEP660104', 'SUEM840101', 'SUEM840102', 'SWER830101', 'TANS770101', 'TANS770102', 'TANS770103', 'TANS770104', 'TANS770105', 'TANS770106', 'TANS770107', 'TANS770108', 'TANS770109', 'TANS770110', 'VASM830101', 'VASM830102', 'VASM830103', 'VELV850101', 'VENT840101', 'VHEG790101', 'WARP780101', 'WEBA780101', 'WERD780101', 'WERD780102', 'WERD780103', 'WERD780104', 'WOEC730101', 'WOLR810101', 'WOLS870101', 'WOLS870102', 'WOLS870103', 'YUTK870101', 'YUTK870102', 'YUTK870103', 'YUTK870104', 'ZASB820101', 'ZIMJ680101', 'ZIMJ680102', 'ZIMJ680103', 'ZIMJ680104', 'ZIMJ680105', 'AURR980101', 'AURR980102', 'AURR980103', 'AURR980104', 'AURR980105', 'AURR980106', 'AURR980107', 'AURR980108', 'AURR980109', 'AURR980110', 'AURR980111', 'AURR980112', 'AURR980113', 'AURR980114', 'AURR980115', 'AURR980116', 'AURR980117', 'AURR980118', 'AURR980119', 'AURR980120', 'ONEK900101', 'ONEK900102', 'VINM940101', 'VINM940102', 'VINM940103', 'VINM940104', 'MUNV940101', 'MUNV940102', 'MUNV940103', 'MUNV940104', 'MUNV940105', 'WIMW960101', 'KIMC930101', 'MONM990101', 'BLAM930101', 'PARS000101', 'PARS000102', 'KUMS000101', 'KUMS000102', 'KUMS000103', 'KUMS000104', 'TAKK010101', 'FODM020101', 'NADH010101', 'NADH010102', 'NADH010103', 'NADH010104', 'NADH010105', 'NADH010106', 'NADH010107', 'MONM990201', 'KOEP990101', 'KOEP990102', 'CEDJ970101', 'CEDJ970102', 'CEDJ970103', 'CEDJ970104', 'CEDJ970105', 'FUKS010101', 'FUKS010102', 'FUKS010103', 'FUKS010104', 'FUKS010105', 'FUKS010106', 'FUKS010107', 'FUKS010108', 'FUKS010109', 'FUKS010110', 'FUKS010111', 'FUKS010112', 'AVBF000101', 'AVBF000102', 'AVBF000103', 'AVBF000104', 'AVBF000105', 'AVBF000106', 'AVBF000107', 'AVBF000108', 'AVBF000109', 'YANJ020101', 'MITS020101', 'TSAJ990101', 'TSAJ990102', 'COSI940101', 'PONP930101', 'WILM950101', 'WILM950102', 'WILM950103', 'WILM950104', 'KUHL950101', 'GUOD860101', 'JURD980101', 'BASU050101', 'BASU050102', 'BASU050103', 'SUYM030101', 'PUNT030101', 'PUNT030102', 'GEOR030101', 'GEOR030102', 'GEOR030103', 'GEOR030104', 'GEOR030105', 'GEOR030106', 'GEOR030107', 'GEOR030108', 'GEOR030109', 'ZHOH040101', 'ZHOH040102', 'ZHOH040103', 'BAEK050101', 'HARY940101', 'PONJ960101', 'DIGM050101', 'WOLR790101', 'OLSK800101', 'KIDA850101', 'GUYH850102', 'GUYH850103', 'GUYH850104', 'GUYH850105', 'ROSM880104', 'ROSM880105', 'JACR890101', 'COWR900101', 'BLAS910101', 'CASG920101', 'CORJ870101', 'CORJ870102', 'CORJ870103', 'CORJ870104', 'CORJ870105', 'CORJ870106', 'CORJ870107', 'CORJ870108', 'MIYS990101', 'MIYS990102', 'MIYS990103', 'MIYS990104', 'MIYS990105', 'ENGD860101', 'FASG890101']
__author__ = 'Fule Liu' protein = 'ACDEFGHIKLMNPQRSTVWY' dna = 'ACGT' rna = 'ACGU' didna_list = ['Base stacking', 'Protein induced deformability', 'B-DNA twist', 'Dinucleotide GC Content', 'A-philicity', 'Propeller twist', 'Duplex stability:(freeenergy)', 'Duplex tability(disruptenergy)', 'DNA denaturation', 'Bending stiffness', 'Protein DNA twist', 'Stabilising energy of Z-DNA', 'Aida_BA_transition', 'Breslauer_dG', 'Breslauer_dH', 'Breslauer_dS', 'Electron_interaction', 'Hartman_trans_free_energy', 'Helix-Coil_transition', 'Ivanov_BA_transition', 'Lisser_BZ_transition', 'Polar_interaction', 'SantaLucia_dG', 'SantaLucia_dH', 'SantaLucia_dS', 'Sarai_flexibility', 'Stability', 'Stacking_energy', 'Sugimoto_dG', 'Sugimoto_dH', 'Sugimoto_dS', 'Watson-Crick_interaction', 'Twist', 'Tilt', 'Roll', 'Shift', 'Slide', 'Rise', 'Clash Strength', 'Roll_roll', 'Twist stiffness', 'Tilt stiffness', 'Shift_rise', 'Adenine content', 'Direction', 'Twist_shift', 'Enthalpy1', 'Twist_twist', 'Roll_shift', 'Shift_slide', 'Shift2', 'Tilt3', 'Tilt1', 'Tilt4', 'Tilt2', 'Slide (DNA-protein complex)1', 'Tilt_shift', 'Twist_tilt', 'Twist (DNA-protein complex)1', 'Tilt_rise', 'Roll_rise', 'Stacking energy', 'Stacking energy1', 'Stacking energy2', 'Stacking energy3', 'Propeller Twist', 'Roll11', 'Rise (DNA-protein complex)', 'Tilt_tilt', 'Roll4', 'Roll2', 'Roll3', 'Roll1', 'Minor Groove Size', 'GC content', 'Slide_slide', 'Enthalpy', 'Shift_shift', 'Slide stiffness', 'Melting Temperature1', 'Flexibility_slide', 'Minor Groove Distance', 'Rise (DNA-protein complex)1', 'Tilt (DNA-protein complex)', 'Guanine content', 'Roll (DNA-protein complex)1', 'Entropy', 'Cytosine content', 'Major Groove Size', 'Twist_rise', 'Major Groove Distance', 'Twist (DNA-protein complex)', 'Purine (AG) content', 'Melting Temperature', 'Free energy', 'Tilt_slide', 'Major Groove Width', 'Major Groove Depth', 'Wedge', 'Free energy8', 'Free energy6', 'Free energy7', 'Free energy4', 'Free energy5', 'Free energy2', 'Free energy3', 'Free energy1', 'Twist_roll', 'Shift (DNA-protein complex)', 'Rise_rise', 'Flexibility_shift', 'Shift (DNA-protein complex)1', 'Thymine content', 'Slide_rise', 'Tilt_roll', 'Tip', 'Keto (GT) content', 'Roll stiffness', 'Minor Groove Width', 'Inclination', 'Entropy1', 'Roll_slide', 'Slide (DNA-protein complex)', 'Twist1', 'Twist3', 'Twist2', 'Twist5', 'Twist4', 'Twist7', 'Twist6', 'Tilt (DNA-protein complex)1', 'Twist_slide', 'Minor Groove Depth', 'Roll (DNA-protein complex)', 'Rise2', 'Persistance Length', 'Rise3', 'Shift stiffness', 'Probability contacting nucleosome core', 'Mobility to bend towards major groove', 'Slide3', 'Slide2', 'Slide1', 'Shift1', 'Bend', 'Rise1', 'Rise stiffness', 'Mobility to bend towards minor groove'] tridna_list = ['Dnase I', 'Bendability (DNAse)', 'Bendability (consensus)', 'Trinucleotide GC Content', 'Nucleosome positioning', 'Consensus_roll', 'Consensus-Rigid', 'Dnase I-Rigid', 'MW-Daltons', 'MW-kg', 'Nucleosome', 'Nucleosome-Rigid'] dirna_list = ['Slide (RNA)', 'Adenine content', 'Hydrophilicity (RNA)', 'Tilt (RNA)', 'Stacking energy (RNA)', 'Twist (RNA)', 'Entropy (RNA)', 'Roll (RNA)', 'Purine (AG) content', 'Hydrophilicity (RNA)1', 'Enthalpy (RNA)1', 'GC content', 'Entropy (RNA)1', 'Rise (RNA)', 'Free energy (RNA)', 'Keto (GT) content', 'Free energy (RNA)1', 'Enthalpy (RNA)', 'Guanine content', 'Shift (RNA)', 'Cytosine content', 'Thymine content'] pro_list = ['Hydrophobicity', 'Hydrophilicity', 'Mass', 'ANDN920101', 'ARGP820101', 'ARGP820102', 'ARGP820103', 'BEGF750101', 'BEGF750102', 'BEGF750103', 'BHAR880101', 'BIGC670101', 'BIOV880101', 'BIOV880102', 'BROC820101', 'BROC820102', 'BULH740101', 'BULH740102', 'BUNA790101', 'BUNA790102', 'BUNA790103', 'BURA740101', 'BURA740102', 'CHAM810101', 'CHAM820101', 'CHAM820102', 'CHAM830101', 'CHAM830102', 'CHAM830103', 'CHAM830104', 'CHAM830105', 'CHAM830106', 'CHAM830107', 'CHAM830108', 'CHOC750101', 'CHOC760101', 'CHOC760102', 'CHOC760103', 'CHOC760104', 'CHOP780101', 'CHOP780201', 'CHOP780202', 'CHOP780203', 'CHOP780204', 'CHOP780205', 'CHOP780206', 'CHOP780207', 'CHOP780208', 'CHOP780209', 'CHOP780210', 'CHOP780211', 'CHOP780212', 'CHOP780213', 'CHOP780214', 'CHOP780215', 'CHOP780216', 'CIDH920101', 'CIDH920102', 'CIDH920103', 'CIDH920104', 'CIDH920105', 'COHE430101', 'CRAJ730101', 'CRAJ730102', 'CRAJ730103', 'DAWD720101', 'DAYM780101', 'DAYM780201', 'DESM900101', 'DESM900102', 'EISD840101', 'EISD860101', 'EISD860102', 'EISD860103', 'FASG760101', 'FASG760102', 'FASG760103', 'FASG760104', 'FASG760105', 'FAUJ830101', 'FAUJ880101', 'FAUJ880102', 'FAUJ880103', 'FAUJ880104', 'FAUJ880105', 'FAUJ880106', 'FAUJ880107', 'FAUJ880108', 'FAUJ880109', 'FAUJ880110', 'FAUJ880111', 'FAUJ880112', 'FAUJ880113', 'FINA770101', 'FINA910101', 'FINA910102', 'FINA910103', 'FINA910104', 'GARJ730101', 'GEIM800101', 'GEIM800102', 'GEIM800103', 'GEIM800104', 'GEIM800105', 'GEIM800106', 'GEIM800107', 'GEIM800108', 'GEIM800109', 'GEIM800110', 'GEIM800111', 'GOLD730101', 'GOLD730102', 'GRAR740101', 'GRAR740102', 'GRAR740103', 'GUYH850101', 'HOPA770101', 'HOPT810101', 'HUTJ700101', 'HUTJ700102', 'HUTJ700103', 'ISOY800101', 'ISOY800102', 'ISOY800103', 'ISOY800104', 'ISOY800105', 'ISOY800106', 'ISOY800107', 'ISOY800108', 'JANJ780101', 'JANJ780102', 'JANJ780103', 'JANJ790101', 'JANJ790102', 'JOND750101', 'JOND750102', 'JOND920101', 'JOND920102', 'JUKT750101', 'JUNJ780101', 'KANM800101', 'KANM800102', 'KANM800103', 'KANM800104', 'KARP850101', 'KARP850102', 'KARP850103', 'KHAG800101', 'KLEP840101', 'KRIW710101', 'KRIW790101', 'KRIW790102', 'KRIW790103', 'KYTJ820101', 'LAWE840101', 'LEVM760101', 'LEVM760102', 'LEVM760103', 'LEVM760104', 'LEVM760105', 'LEVM760106', 'LEVM760107', 'LEVM780101', 'LEVM780102', 'LEVM780103', 'LEVM780104', 'LEVM780105', 'LEVM780106', 'LEWP710101', 'LIFS790101', 'LIFS790102', 'LIFS790103', 'MANP780101', 'MAXF760101', 'MAXF760102', 'MAXF760103', 'MAXF760104', 'MAXF760105', 'MAXF760106', 'MCMT640101', 'MEEJ800101', 'MEEJ800102', 'MEEJ810101', 'MEEJ810102', 'MEIH800101', 'MEIH800102', 'MEIH800103', 'MIYS850101', 'NAGK730101', 'NAGK730102', 'NAGK730103', 'NAKH900101', 'NAKH900102', 'NAKH900103', 'NAKH900104', 'NAKH900105', 'NAKH900106', 'NAKH900107', 'NAKH900108', 'NAKH900109', 'NAKH900110', 'NAKH900111', 'NAKH900112', 'NAKH900113', 'NAKH920101', 'NAKH920102', 'NAKH920103', 'NAKH920104', 'NAKH920105', 'NAKH920106', 'NAKH920107', 'NAKH920108', 'NISK800101', 'NISK860101', 'NOZY710101', 'OOBM770101', 'OOBM770102', 'OOBM770103', 'OOBM770104', 'OOBM770105', 'OOBM850101', 'OOBM850102', 'OOBM850103', 'OOBM850104', 'OOBM850105', 'PALJ810101', 'PALJ810102', 'PALJ810103', 'PALJ810104', 'PALJ810105', 'PALJ810106', 'PALJ810107', 'PALJ810108', 'PALJ810109', 'PALJ810110', 'PALJ810111', 'PALJ810112', 'PALJ810113', 'PALJ810114', 'PALJ810115', 'PALJ810116', 'PARJ860101', 'PLIV810101', 'PONP800101', 'PONP800102', 'PONP800103', 'PONP800104', 'PONP800105', 'PONP800106', 'PONP800107', 'PONP800108', 'PRAM820101', 'PRAM820102', 'PRAM820103', 'PRAM900101', 'PRAM900102', 'PRAM900103', 'PRAM900104', 'PTIO830101', 'PTIO830102', 'QIAN880101', 'QIAN880102', 'QIAN880103', 'QIAN880104', 'QIAN880105', 'QIAN880106', 'QIAN880107', 'QIAN880108', 'QIAN880109', 'QIAN880110', 'QIAN880111', 'QIAN880112', 'QIAN880113', 'QIAN880114', 'QIAN880115', 'QIAN880116', 'QIAN880117', 'QIAN880118', 'QIAN880119', 'QIAN880120', 'QIAN880121', 'QIAN880122', 'QIAN880123', 'QIAN880124', 'QIAN880125', 'QIAN880126', 'QIAN880127', 'QIAN880128', 'QIAN880129', 'QIAN880130', 'QIAN880131', 'QIAN880132', 'QIAN880133', 'QIAN880134', 'QIAN880135', 'QIAN880136', 'QIAN880137', 'QIAN880138', 'QIAN880139', 'RACS770101', 'RACS770102', 'RACS770103', 'RACS820101', 'RACS820102', 'RACS820103', 'RACS820104', 'RACS820105', 'RACS820106', 'RACS820107', 'RACS820108', 'RACS820109', 'RACS820110', 'RACS820111', 'RACS820112', 'RACS820113', 'RACS820114', 'RADA880101', 'RADA880102', 'RADA880103', 'RADA880104', 'RADA880105', 'RADA880106', 'RADA880107', 'RADA880108', 'RICJ880101', 'RICJ880102', 'RICJ880103', 'RICJ880104', 'RICJ880105', 'RICJ880106', 'RICJ880107', 'RICJ880108', 'RICJ880109', 'RICJ880110', 'RICJ880111', 'RICJ880112', 'RICJ880113', 'RICJ880114', 'RICJ880115', 'RICJ880116', 'RICJ880117', 'ROBB760101', 'ROBB760102', 'ROBB760103', 'ROBB760104', 'ROBB760105', 'ROBB760106', 'ROBB760107', 'ROBB760108', 'ROBB760109', 'ROBB760110', 'ROBB760111', 'ROBB760112', 'ROBB760113', 'ROBB790101', 'ROSG850101', 'ROSG850102', 'ROSM880101', 'ROSM880102', 'ROSM880103', 'SIMZ760101', 'SNEP660101', 'SNEP660102', 'SNEP660103', 'SNEP660104', 'SUEM840101', 'SUEM840102', 'SWER830101', 'TANS770101', 'TANS770102', 'TANS770103', 'TANS770104', 'TANS770105', 'TANS770106', 'TANS770107', 'TANS770108', 'TANS770109', 'TANS770110', 'VASM830101', 'VASM830102', 'VASM830103', 'VELV850101', 'VENT840101', 'VHEG790101', 'WARP780101', 'WEBA780101', 'WERD780101', 'WERD780102', 'WERD780103', 'WERD780104', 'WOEC730101', 'WOLR810101', 'WOLS870101', 'WOLS870102', 'WOLS870103', 'YUTK870101', 'YUTK870102', 'YUTK870103', 'YUTK870104', 'ZASB820101', 'ZIMJ680101', 'ZIMJ680102', 'ZIMJ680103', 'ZIMJ680104', 'ZIMJ680105', 'AURR980101', 'AURR980102', 'AURR980103', 'AURR980104', 'AURR980105', 'AURR980106', 'AURR980107', 'AURR980108', 'AURR980109', 'AURR980110', 'AURR980111', 'AURR980112', 'AURR980113', 'AURR980114', 'AURR980115', 'AURR980116', 'AURR980117', 'AURR980118', 'AURR980119', 'AURR980120', 'ONEK900101', 'ONEK900102', 'VINM940101', 'VINM940102', 'VINM940103', 'VINM940104', 'MUNV940101', 'MUNV940102', 'MUNV940103', 'MUNV940104', 'MUNV940105', 'WIMW960101', 'KIMC930101', 'MONM990101', 'BLAM930101', 'PARS000101', 'PARS000102', 'KUMS000101', 'KUMS000102', 'KUMS000103', 'KUMS000104', 'TAKK010101', 'FODM020101', 'NADH010101', 'NADH010102', 'NADH010103', 'NADH010104', 'NADH010105', 'NADH010106', 'NADH010107', 'MONM990201', 'KOEP990101', 'KOEP990102', 'CEDJ970101', 'CEDJ970102', 'CEDJ970103', 'CEDJ970104', 'CEDJ970105', 'FUKS010101', 'FUKS010102', 'FUKS010103', 'FUKS010104', 'FUKS010105', 'FUKS010106', 'FUKS010107', 'FUKS010108', 'FUKS010109', 'FUKS010110', 'FUKS010111', 'FUKS010112', 'AVBF000101', 'AVBF000102', 'AVBF000103', 'AVBF000104', 'AVBF000105', 'AVBF000106', 'AVBF000107', 'AVBF000108', 'AVBF000109', 'YANJ020101', 'MITS020101', 'TSAJ990101', 'TSAJ990102', 'COSI940101', 'PONP930101', 'WILM950101', 'WILM950102', 'WILM950103', 'WILM950104', 'KUHL950101', 'GUOD860101', 'JURD980101', 'BASU050101', 'BASU050102', 'BASU050103', 'SUYM030101', 'PUNT030101', 'PUNT030102', 'GEOR030101', 'GEOR030102', 'GEOR030103', 'GEOR030104', 'GEOR030105', 'GEOR030106', 'GEOR030107', 'GEOR030108', 'GEOR030109', 'ZHOH040101', 'ZHOH040102', 'ZHOH040103', 'BAEK050101', 'HARY940101', 'PONJ960101', 'DIGM050101', 'WOLR790101', 'OLSK800101', 'KIDA850101', 'GUYH850102', 'GUYH850103', 'GUYH850104', 'GUYH850105', 'ROSM880104', 'ROSM880105', 'JACR890101', 'COWR900101', 'BLAS910101', 'CASG920101', 'CORJ870101', 'CORJ870102', 'CORJ870103', 'CORJ870104', 'CORJ870105', 'CORJ870106', 'CORJ870107', 'CORJ870108', 'MIYS990101', 'MIYS990102', 'MIYS990103', 'MIYS990104', 'MIYS990105', 'ENGD860101', 'FASG890101']
class Solution: def XXX(self, a: str, b: str) -> str: a, b = a[::-1], b[::-1] if len(a) < len(b): a, b = b, a b += "0" * (len(a) - len(b)) res = "" carrier = 0 for i, j in zip(a, b): cur = (int(i) + int(j) + carrier) % 2 carrier = (int(i) + int(j) + carrier) // 2 res += str(cur) res += str(carrier) return str(int(res[::-1]))
class Solution: def xxx(self, a: str, b: str) -> str: (a, b) = (a[::-1], b[::-1]) if len(a) < len(b): (a, b) = (b, a) b += '0' * (len(a) - len(b)) res = '' carrier = 0 for (i, j) in zip(a, b): cur = (int(i) + int(j) + carrier) % 2 carrier = (int(i) + int(j) + carrier) // 2 res += str(cur) res += str(carrier) return str(int(res[::-1]))
class Solution: def numDistinct(self, s: str, t: str) -> int: dp = [] dp.append([1] * (len(s) + 1)) for i in range(len(t)): dp.append([0] * (len(s) + 1)) for i in range(1, len(t) + 1): for j in range(1, len(s) + 1): dp[i][j] = dp[i][j-1] if s[j-1] == t[i-1]: dp[i][j] += dp[i-1][j-1] return dp[len(t)][len(s)] ob = Solution() s = "rabbbit" t = "rabbit" print(ob.numDistinct(t, s))
class Solution: def num_distinct(self, s: str, t: str) -> int: dp = [] dp.append([1] * (len(s) + 1)) for i in range(len(t)): dp.append([0] * (len(s) + 1)) for i in range(1, len(t) + 1): for j in range(1, len(s) + 1): dp[i][j] = dp[i][j - 1] if s[j - 1] == t[i - 1]: dp[i][j] += dp[i - 1][j - 1] return dp[len(t)][len(s)] ob = solution() s = 'rabbbit' t = 'rabbit' print(ob.numDistinct(t, s))
'''https://leetcode.com/problems/rotate-image/ 48. Rotate Image Medium 6773 413 Add to List Share You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. Example 1: Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [[7,4,1],[8,5,2],[9,6,3]] Example 2: Input: matrix = [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]] Output: [[15,13,2,5],[14,3,4,1],[12,6,8,9],[16,7,10,11]] Example 3: Input: matrix = [[1]] Output: [[1]] Example 4: Input: matrix = [[1,2],[3,4]] Output: [[3,1],[4,2]] Constraints: matrix.length == n matrix[i].length == n 1 <= n <= 20 -1000 <= matrix[i][j] <= 1000''' # [48] Rotate Image # class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ matrix[:] = zip(*matrix[::-1])
"""https://leetcode.com/problems/rotate-image/ 48. Rotate Image Medium 6773 413 Add to List Share You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. Example 1: Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [[7,4,1],[8,5,2],[9,6,3]] Example 2: Input: matrix = [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]] Output: [[15,13,2,5],[14,3,4,1],[12,6,8,9],[16,7,10,11]] Example 3: Input: matrix = [[1]] Output: [[1]] Example 4: Input: matrix = [[1,2],[3,4]] Output: [[3,1],[4,2]] Constraints: matrix.length == n matrix[i].length == n 1 <= n <= 20 -1000 <= matrix[i][j] <= 1000""" class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ matrix[:] = zip(*matrix[::-1])
file=open("C:\\Users\minjie\Desktop\data_label.txt","r",encoding="utf-8") file1=open("data_test.txt","w",encoding="utf-8") sentence="" label="" sen=[] lab=[] text=[] ignored_words=['!','\"','$','%','\'','(',')','*','+',',','.','..','@','#','&','?','/'] for line in file: line=line.lower() if(line[0]=='\"'): for item in sen: if(item in dic): if(len(item)<2): continue file1.write(item+" "+dic[item]+"\n") else: if(len(item)<2): continue file1.write(item+" "+"O"+"\n") file1.write("\n") dic={} sentence=line[1:-2] for i in range(0,len(sentence)): if sentence[i] in ignored_words: sentence=sentence.replace(sentence[i],' ') sen=sentence.split(' ') elif(line[0]=='('): label=line lab=label.split(',') lab1=lab[0][1:].split(' ') lab2=lab[1].split(' ') flag=0 for item in lab1: if(flag==0): dic[item]="B-DIS" flag=1 else: dic[item]="I-DIS" flag=0 for item in lab2: if(flag==0): dic[item]="B-MED" flag=1 else: dic[item]="I-MED" file.close() file1.close()
file = open('C:\\Users\\minjie\\Desktop\\data_label.txt', 'r', encoding='utf-8') file1 = open('data_test.txt', 'w', encoding='utf-8') sentence = '' label = '' sen = [] lab = [] text = [] ignored_words = ['!', '"', '$', '%', "'", '(', ')', '*', '+', ',', '.', '..', '@', '#', '&', '?', '/'] for line in file: line = line.lower() if line[0] == '"': for item in sen: if item in dic: if len(item) < 2: continue file1.write(item + ' ' + dic[item] + '\n') else: if len(item) < 2: continue file1.write(item + ' ' + 'O' + '\n') file1.write('\n') dic = {} sentence = line[1:-2] for i in range(0, len(sentence)): if sentence[i] in ignored_words: sentence = sentence.replace(sentence[i], ' ') sen = sentence.split(' ') elif line[0] == '(': label = line lab = label.split(',') lab1 = lab[0][1:].split(' ') lab2 = lab[1].split(' ') flag = 0 for item in lab1: if flag == 0: dic[item] = 'B-DIS' flag = 1 else: dic[item] = 'I-DIS' flag = 0 for item in lab2: if flag == 0: dic[item] = 'B-MED' flag = 1 else: dic[item] = 'I-MED' file.close() file1.close()
class Assembler: def __init__(self, output_file): self._output_file = output_file def load_register_with_value(self, reg_index, reg_value): opcode = 0x6000 opcode |= ((reg_index & 0xF) << 8) opcode |= (reg_value & 0xFF) self._write_opcode(opcode) def load_font(self, reg_index): opcode = 0xF029 opcode |= ((reg_index & 0xF) << 8) self._write_opcode(opcode) def draw(self, reg_index1, reg_index2, size): opcode = 0xD000 opcode |= ((reg_index1 & 0xF) << 8) opcode |= ((reg_index2 & 0xF) << 4) opcode |= size & 0xF self._write_opcode(opcode) def jump(self, address): opcode = 0xB000 opcode |= (address & 0xFFF) self._write_opcode(opcode) def _write_opcode(self, opcode): self._output_file.write(opcode.to_bytes(2, byteorder='little')) def assemble(): with open("output.bin", "wb") as output_file: asm = Assembler(output_file) x, y = 2, 2 offset_x, offset_y = 8, 6 for c in range(16): asm.load_register_with_value(0, c) asm.load_font(0) asm.load_register_with_value(1, x) asm.load_register_with_value(2, y) asm.draw(1, 2, 5) x += offset_x if x > (4 * offset_x): x = 2 y += 1 asm.load_register_with_value(0, 0) asm.jump(0x2A3) if __name__ == '__main__': assemble()
class Assembler: def __init__(self, output_file): self._output_file = output_file def load_register_with_value(self, reg_index, reg_value): opcode = 24576 opcode |= (reg_index & 15) << 8 opcode |= reg_value & 255 self._write_opcode(opcode) def load_font(self, reg_index): opcode = 61481 opcode |= (reg_index & 15) << 8 self._write_opcode(opcode) def draw(self, reg_index1, reg_index2, size): opcode = 53248 opcode |= (reg_index1 & 15) << 8 opcode |= (reg_index2 & 15) << 4 opcode |= size & 15 self._write_opcode(opcode) def jump(self, address): opcode = 45056 opcode |= address & 4095 self._write_opcode(opcode) def _write_opcode(self, opcode): self._output_file.write(opcode.to_bytes(2, byteorder='little')) def assemble(): with open('output.bin', 'wb') as output_file: asm = assembler(output_file) (x, y) = (2, 2) (offset_x, offset_y) = (8, 6) for c in range(16): asm.load_register_with_value(0, c) asm.load_font(0) asm.load_register_with_value(1, x) asm.load_register_with_value(2, y) asm.draw(1, 2, 5) x += offset_x if x > 4 * offset_x: x = 2 y += 1 asm.load_register_with_value(0, 0) asm.jump(675) if __name__ == '__main__': assemble()
flag = "rarctf{See,ThatWasn'tSoHard-1eb519ed}" out = [] key = [0x13, 0x37] for c in flag: c = ord(c) out.append((c ^ key[0]) + key[1]) key = key[::-1] # print(', '.join([chr(c) for c in out])) print(', '.join([hex(c) for c in out]))
flag = "rarctf{See,ThatWasn'tSoHard-1eb519ed}" out = [] key = [19, 55] for c in flag: c = ord(c) out.append((c ^ key[0]) + key[1]) key = key[::-1] print(', '.join([hex(c) for c in out]))
''' Statement Given a two-digit integer, print its left digit (a tens digit) and then its right digit (a ones digit). Use the operator of integer division for obtaining the tens digit and the operator of taking remainder for obtaining the ones digit. Example input 79 Example output 7 9 ''' num = int(input()) print(num // 10, num % 10)
""" Statement Given a two-digit integer, print its left digit (a tens digit) and then its right digit (a ones digit). Use the operator of integer division for obtaining the tens digit and the operator of taking remainder for obtaining the ones digit. Example input 79 Example output 7 9 """ num = int(input()) print(num // 10, num % 10)
class MergeEntry: def __init__(self, log_entry): self.sha1 = '' self.action = '' self.description = '' self.issue = 0 def set_with(self, log_entry): self.sha1 = log_entry[0:8] def extract_substring_surrounded_by(self, char): pass
class Mergeentry: def __init__(self, log_entry): self.sha1 = '' self.action = '' self.description = '' self.issue = 0 def set_with(self, log_entry): self.sha1 = log_entry[0:8] def extract_substring_surrounded_by(self, char): pass
rec={} n=int(input("enter no. of students:")) i=1 while i<=n: name=input("enter student name:") marks=input("enter % of marks of student:") rec[name]=marks i=i+1 print("name of students","\t","% of marks") for x in rec: print("\t",x,"\t\t",rec[x])
rec = {} n = int(input('enter no. of students:')) i = 1 while i <= n: name = input('enter student name:') marks = input('enter % of marks of student:') rec[name] = marks i = i + 1 print('name of students', '\t', '% of marks') for x in rec: print('\t', x, '\t\t', rec[x])
# -*- coding: utf-8 -*- """ Created on Thu Apr 18 14:50:56 2019 @author: ajand """ # Function to sort the words # in ascending order def sortedSentence(Sentence): # Spliting the Sentence into words words = Sentence.split(" ") # Sorting the words words.sort() # Making new Sentence by # joining the sorted words newSentence = " ".join(words) # Return newSentence return newSentence # Driver's Code Sentence = "to learn programming refer geeksforgeeks" # Print the sortedSentence print(sortedSentence(Sentence)) Sentence = "geeks for geeks" # Print the sortedSentence print(sortedSentence(Sentence))
""" Created on Thu Apr 18 14:50:56 2019 @author: ajand """ def sorted_sentence(Sentence): words = Sentence.split(' ') words.sort() new_sentence = ' '.join(words) return newSentence sentence = 'to learn programming refer geeksforgeeks' print(sorted_sentence(Sentence)) sentence = 'geeks for geeks' print(sorted_sentence(Sentence))
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- def get_http_request_kwargs(kwargs): http_request_keywords = ["params", "headers", "json", "data", "files"] http_request_kwargs = { key: kwargs.pop(key, None) for key in http_request_keywords if key in kwargs } return http_request_kwargs
def get_http_request_kwargs(kwargs): http_request_keywords = ['params', 'headers', 'json', 'data', 'files'] http_request_kwargs = {key: kwargs.pop(key, None) for key in http_request_keywords if key in kwargs} return http_request_kwargs
''' * @author: ashwek * @date: 20/12/2018 ''' n = int(input("Enter limit : ")) for i in range(1, n+1): output = "" if i%3 == 0 : output = "Fizz" if i%5 == 0: output += "Buzz" if output : print(output) else: print(i)
""" * @author: ashwek * @date: 20/12/2018 """ n = int(input('Enter limit : ')) for i in range(1, n + 1): output = '' if i % 3 == 0: output = 'Fizz' if i % 5 == 0: output += 'Buzz' if output: print(output) else: print(i)
''' @author: l4zyc0d3r People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt ''' # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: sp, fp = head, head while fp and fp.next: sp = sp.next fp=fp.next.next if sp==fp: sp = head while sp is not fp: sp, fp = sp.next, fp.next return sp return None
""" @author: l4zyc0d3r People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt """ class Solution: def detect_cycle(self, head: ListNode) -> ListNode: (sp, fp) = (head, head) while fp and fp.next: sp = sp.next fp = fp.next.next if sp == fp: sp = head while sp is not fp: (sp, fp) = (sp.next, fp.next) return sp return None
class Vocab: def __init__(self, vocab_path): self.word2id = dict() self.id2word = list() for ln in open(vocab_path): wid, word, freq = ln.strip().split("\t") self.word2id[word] = int(wid) self.id2word.append(word) if len(self.id2word) == 50000: break self.size = len(self.id2word) self.pad_idx = 0 self.sos_idx = 1 self.sep_idx = 2 self.eos_idx = 3 self.unk_idx = 4 self.special_token_idx = [0, 1, 2, 3, 4] def __len__(self): return self.size def get_word(self, idx): if idx > 0 and idx < self.size: return self.id2word[idx] else: raise IndexError("{} index invalid!".format(idx)) def get_idx(self, word): return self.word2id[word] if word in self.word2id else self.unk_idx def encode(self, word_list): return [self.get_idx(w) for w in word_list] def decode(self, idx_list): return [self.get_word(idx) for idx in idx_list if idx > 0]
class Vocab: def __init__(self, vocab_path): self.word2id = dict() self.id2word = list() for ln in open(vocab_path): (wid, word, freq) = ln.strip().split('\t') self.word2id[word] = int(wid) self.id2word.append(word) if len(self.id2word) == 50000: break self.size = len(self.id2word) self.pad_idx = 0 self.sos_idx = 1 self.sep_idx = 2 self.eos_idx = 3 self.unk_idx = 4 self.special_token_idx = [0, 1, 2, 3, 4] def __len__(self): return self.size def get_word(self, idx): if idx > 0 and idx < self.size: return self.id2word[idx] else: raise index_error('{} index invalid!'.format(idx)) def get_idx(self, word): return self.word2id[word] if word in self.word2id else self.unk_idx def encode(self, word_list): return [self.get_idx(w) for w in word_list] def decode(self, idx_list): return [self.get_word(idx) for idx in idx_list if idx > 0]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 6 07:54:08 2018 @author: tuheenahmmed """ def calculateHandlen(hand): """ Returns the length (number of letters) in the current hand. hand: dictionary (string-> int) returns: integer """ length =0 for letter in hand: length += hand[letter] return length
""" Created on Mon Aug 6 07:54:08 2018 @author: tuheenahmmed """ def calculate_handlen(hand): """ Returns the length (number of letters) in the current hand. hand: dictionary (string-> int) returns: integer """ length = 0 for letter in hand: length += hand[letter] return length
class MaxRetriesExceeded(Exception): pass class HTTPMethodNotFound(Exception): pass
class Maxretriesexceeded(Exception): pass class Httpmethodnotfound(Exception): pass
""" Summary of ``hexagon_grid.py`` ------------------------------ Text-based definition of a SQL function to create a hexagon grid overlay """ def sql_to_make_hex_grid( extent_table: str, epsg: int, output_table_name: str, size: float ): """ This function returns a string with a valid SQL query that creates a hexagon layer covering the input {extent_table}. :param extent_table: 'name_of_table_to_cover' :param epsg: integer for EPSG you want the hexagons to be in :param output_table_name: 'hexagon_layer' :param size: float value, 1 = 1 square KM :return: string, valid SQL query """ create_hex_grid_command = f""" DROP TABLE IF EXISTS {output_table_name}; CREATE TABLE {output_table_name} ( gid SERIAL NOT NULL PRIMARY KEY, geom GEOMETRY('POLYGON', {epsg}, 2) NOT NULL ) WITH (OIDS=FALSE); INSERT INTO {output_table_name} (geom) SELECT hex_grid({size}, (select st_xmin(st_transform(st_collect(geom), 4326)) from {extent_table}), (select st_ymin(st_transform(st_collect(geom), 4326)) from {extent_table}), (select st_xmax(st_transform(st_collect(geom), 4326)) from {extent_table}), (select st_ymax(st_transform(st_collect(geom), 4326)) from {extent_table}), 4326, {epsg}, {epsg});""" return create_hex_grid_command.replace('\n', '') hex_grid_function = """ ------ this function was found and copied from the web link below: ------ https://github.com/minus34/postgis-scripts/blob/master/hex-grid/create-hex-grid-function.sql -------------------------------------------------------------------------------------------------------------------------------- -- HEX GRID - Create function -------------------------------------------------------------------------------------------------------------------------------- -- -- Hugh Saalmans (@minus34) -- 2015/04/10 -- -- DESCRIPTION: -- -- Function returns a grid of mathmatically correct hexagonal polygons. -- Useful for hexbinning (the art of mapping clusters of information unbiased by political/historical/statistical boundaries). -- -- INPUT -- -- areakm2 : area of each hexagon in square km. -- - note: hexagon size can be off slightly due to coordinate rounding in the calcs. -- -- xmin, ymin : min coords of the grid extents. -- -- xmax, ymax : max coords of the grid extents. -- -- inputsrid : the coordinate system (SRID) of the input min/max coords. -- -- workingsrid : the SRID used to process the polygons. -- - SRID must be a projected coord sys (i.e. in metres) as the calcs require ints. Degrees are out. -- - should be an equal area SRID such as Albers or Lambert Azimuthal (e.g. Australia = 3577, US = 2163). -- - using Mercator will NOT return hexagons of equal area due to its distortions (don't try it in Greenland). -- -- ouputsrid : the SRID of the output polygons. -- -- NOTES -- -- Hexagon height & width are rounded up & down to the nearest metre, hence the area may be off slightly. -- This is due to the Postgres generate_series function which doesn't support floats. -- -- Why are my areas wrong in QGIS, MapInfo, etc...? -- Let's assume you created WGS84 lat/long hexagons, you may have noticed the areas differ by almost half in a desktop GIS -- like QGIS or MapInfo Pro. This is due to the way those tools display geographic coordinate systems like WGS84 lat/long. -- Running the following query in PostGIS will confirm the min & max sizes of your hexagons (in km2): -- -- SELECT (SELECT (MIN(ST_Area(geom::geography, FALSE)) / 1000000.0)::numeric(10,3) From my_hex_grid) AS minarea, -- (SELECT (MAX(ST_Area(geom::geography, FALSE)) / 1000000.0)::numeric(10,3) From my_hex_grid) AS maxarea; -- -- Hey, why doesn't the grid cover the area I defined using my min/max extents? -- Assuming you used lat/long extents and processed the grid with an equal area projection, the projection caused your -- min/max coords to describe a conical shape, not a rectangular one - and the conical area didn't cover everything you -- wanted to include. See au-hex-grid.png as an example of this. -- If you're bored - learn why projections distort maps here: http://www.icsm.gov.au/mapping/about_projections.html -- -- This code is based on this PostGIS Wiki article: https://trac.osgeo.org/postgis/wiki/UsersWikiGenerateHexagonalGrid -- -- Dimension calcs are based on formulae from: http://hexnet.org/content/hexagonal-geometry -- -- LICENSE -- -- This work is licensed under the Apache License, Version 2: https://www.apache.org/licenses/LICENSE-2.0 -- -------------------------------------------------------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION hex_grid(areakm2 FLOAT, xmin FLOAT, ymin FLOAT, xmax FLOAT, ymax FLOAT, inputsrid INTEGER, workingsrid INTEGER, ouputsrid INTEGER) RETURNS SETOF geometry AS $BODY$ DECLARE minpnt GEOMETRY; maxpnt GEOMETRY; x1 INTEGER; y1 INTEGER; x2 INTEGER; y2 INTEGER; aream2 FLOAT; qtrwidthfloat FLOAT; qtrwidth INTEGER; halfheight INTEGER; BEGIN -- Convert input coords to points in the working SRID minpnt = ST_Transform(ST_SetSRID(ST_MakePoint(xmin, ymin), inputsrid), workingsrid); maxpnt = ST_Transform(ST_SetSRID(ST_MakePoint(xmax, ymax), inputsrid), workingsrid); -- Get grid extents in working SRID coords x1 = ST_X(minpnt)::INTEGER; y1 = ST_Y(minpnt)::INTEGER; x2 = ST_X(maxpnt)::INTEGER; y2 = ST_Y(maxpnt)::INTEGER; -- Get height and width of hexagon - FLOOR and CEILING are used to get the hexagon size closer to the requested input area aream2 := areakm2 * 1000000.0; qtrwidthfloat := sqrt(aream2/(sqrt(3.0) * (3.0/2.0))) / 2.0; qtrwidth := FLOOR(qtrwidthfloat); halfheight := CEILING(qtrwidthfloat * sqrt(3.0)); -- Return the hexagons - done in pairs, with one offset from the other RETURN QUERY ( SELECT ST_Transform(ST_SetSRID(ST_Translate(geom, x_series::FLOAT, y_series::FLOAT), workingsrid), ouputsrid) AS geom FROM generate_series(x1, x2, (qtrwidth * 6)) AS x_series, generate_series(y1, y2, (halfheight * 2)) AS y_series, ( SELECT ST_GeomFromText( format('POLYGON((0 0, %s %s, %s %s, %s %s, %s %s, %s %s, 0 0))', qtrwidth, halfheight, qtrwidth * 3, halfheight, qtrwidth * 4, 0, qtrwidth * 3, halfheight * -1, qtrwidth, halfheight * -1 ) ) AS geom UNION SELECT ST_Translate( ST_GeomFromText( format('POLYGON((0 0, %s %s, %s %s, %s %s, %s %s, %s %s, 0 0))', qtrwidth, halfheight, qtrwidth * 3, halfheight, qtrwidth * 4, 0, qtrwidth * 3, halfheight * -1, qtrwidth, halfheight * -1 ) ) , qtrwidth * 3, halfheight) as geom ) AS two_hex); END$BODY$ LANGUAGE plpgsql VOLATILE COST 100; """
""" Summary of ``hexagon_grid.py`` ------------------------------ Text-based definition of a SQL function to create a hexagon grid overlay """ def sql_to_make_hex_grid(extent_table: str, epsg: int, output_table_name: str, size: float): """ This function returns a string with a valid SQL query that creates a hexagon layer covering the input {extent_table}. :param extent_table: 'name_of_table_to_cover' :param epsg: integer for EPSG you want the hexagons to be in :param output_table_name: 'hexagon_layer' :param size: float value, 1 = 1 square KM :return: string, valid SQL query """ create_hex_grid_command = f"\n DROP TABLE IF EXISTS {output_table_name};\n CREATE TABLE {output_table_name} (\n gid SERIAL NOT NULL PRIMARY KEY,\n geom GEOMETRY('POLYGON', {epsg}, 2) NOT NULL\n )\n WITH (OIDS=FALSE); \n\n INSERT INTO {output_table_name} (geom)\n SELECT hex_grid({size},\n (select st_xmin(st_transform(st_collect(geom), 4326)) from {extent_table}),\n (select st_ymin(st_transform(st_collect(geom), 4326)) from {extent_table}),\n (select st_xmax(st_transform(st_collect(geom), 4326)) from {extent_table}),\n (select st_ymax(st_transform(st_collect(geom), 4326)) from {extent_table}),\n 4326, {epsg}, {epsg});" return create_hex_grid_command.replace('\n', '') hex_grid_function = "\n------ this function was found and copied from the web link below:\n------ https://github.com/minus34/postgis-scripts/blob/master/hex-grid/create-hex-grid-function.sql\n--------------------------------------------------------------------------------------------------------------------------------\n-- HEX GRID - Create function\n--------------------------------------------------------------------------------------------------------------------------------\n--\n-- Hugh Saalmans (@minus34)\n-- 2015/04/10\n--\n-- DESCRIPTION:\n--\n-- Function returns a grid of mathmatically correct hexagonal polygons.\n-- Useful for hexbinning (the art of mapping clusters of information unbiased by political/historical/statistical boundaries).\n--\n-- INPUT\n--\n-- areakm2 : area of each hexagon in square km.\n-- - note: hexagon size can be off slightly due to coordinate rounding in the calcs.\n--\n-- xmin, ymin : min coords of the grid extents.\n--\n-- xmax, ymax : max coords of the grid extents.\n--\n-- inputsrid : the coordinate system (SRID) of the input min/max coords.\n--\n-- workingsrid : the SRID used to process the polygons.\n-- - SRID must be a projected coord sys (i.e. in metres) as the calcs require ints. Degrees are out.\n-- - should be an equal area SRID such as Albers or Lambert Azimuthal (e.g. Australia = 3577, US = 2163).\n-- - using Mercator will NOT return hexagons of equal area due to its distortions (don't try it in Greenland).\n--\n-- ouputsrid : the SRID of the output polygons.\n--\n-- NOTES\n--\n-- Hexagon height & width are rounded up & down to the nearest metre, hence the area may be off slightly.\n-- This is due to the Postgres generate_series function which doesn't support floats.\n--\n-- Why are my areas wrong in QGIS, MapInfo, etc...?\n-- Let's assume you created WGS84 lat/long hexagons, you may have noticed the areas differ by almost half in a desktop GIS\n-- like QGIS or MapInfo Pro. This is due to the way those tools display geographic coordinate systems like WGS84 lat/long.\n-- Running the following query in PostGIS will confirm the min & max sizes of your hexagons (in km2):\n--\n-- SELECT (SELECT (MIN(ST_Area(geom::geography, FALSE)) / 1000000.0)::numeric(10,3) From my_hex_grid) AS minarea,\n-- (SELECT (MAX(ST_Area(geom::geography, FALSE)) / 1000000.0)::numeric(10,3) From my_hex_grid) AS maxarea;\n--\n-- Hey, why doesn't the grid cover the area I defined using my min/max extents?\n-- Assuming you used lat/long extents and processed the grid with an equal area projection, the projection caused your\n-- min/max coords to describe a conical shape, not a rectangular one - and the conical area didn't cover everything you\n-- wanted to include. See au-hex-grid.png as an example of this.\n-- If you're bored - learn why projections distort maps here: http://www.icsm.gov.au/mapping/about_projections.html\n--\n-- This code is based on this PostGIS Wiki article: https://trac.osgeo.org/postgis/wiki/UsersWikiGenerateHexagonalGrid\n--\n-- Dimension calcs are based on formulae from: http://hexnet.org/content/hexagonal-geometry\n--\n-- LICENSE\n--\n-- This work is licensed under the Apache License, Version 2: https://www.apache.org/licenses/LICENSE-2.0\n--\n--------------------------------------------------------------------------------------------------------------------------------\n\nCREATE OR REPLACE FUNCTION hex_grid(areakm2 FLOAT, xmin FLOAT, ymin FLOAT, xmax FLOAT, ymax FLOAT, inputsrid INTEGER,\n workingsrid INTEGER, ouputsrid INTEGER)\n RETURNS SETOF geometry AS\n$BODY$\n\nDECLARE\n minpnt GEOMETRY;\n maxpnt GEOMETRY;\n x1 INTEGER;\n y1 INTEGER;\n x2 INTEGER;\n y2 INTEGER;\n aream2 FLOAT;\n qtrwidthfloat FLOAT;\n qtrwidth INTEGER;\n halfheight INTEGER;\n\nBEGIN\n\n -- Convert input coords to points in the working SRID\n minpnt = ST_Transform(ST_SetSRID(ST_MakePoint(xmin, ymin), inputsrid), workingsrid);\n maxpnt = ST_Transform(ST_SetSRID(ST_MakePoint(xmax, ymax), inputsrid), workingsrid);\n\n -- Get grid extents in working SRID coords\n x1 = ST_X(minpnt)::INTEGER;\n y1 = ST_Y(minpnt)::INTEGER;\n x2 = ST_X(maxpnt)::INTEGER;\n y2 = ST_Y(maxpnt)::INTEGER;\n\n -- Get height and width of hexagon - FLOOR and CEILING are used to get the hexagon size closer to the requested input area\n aream2 := areakm2 * 1000000.0;\n qtrwidthfloat := sqrt(aream2/(sqrt(3.0) * (3.0/2.0))) / 2.0;\n\n qtrwidth := FLOOR(qtrwidthfloat);\n halfheight := CEILING(qtrwidthfloat * sqrt(3.0));\n\n -- Return the hexagons - done in pairs, with one offset from the other\n RETURN QUERY (\n SELECT ST_Transform(ST_SetSRID(ST_Translate(geom, x_series::FLOAT, y_series::FLOAT), workingsrid), ouputsrid) AS geom\n FROM generate_series(x1, x2, (qtrwidth * 6)) AS x_series,\n generate_series(y1, y2, (halfheight * 2)) AS y_series,\n (\n SELECT ST_GeomFromText(\n format('POLYGON((0 0, %s %s, %s %s, %s %s, %s %s, %s %s, 0 0))',\n qtrwidth, halfheight,\n qtrwidth * 3, halfheight,\n qtrwidth * 4, 0,\n qtrwidth * 3, halfheight * -1,\n qtrwidth, halfheight * -1\n )\n ) AS geom\n UNION\n SELECT ST_Translate(\n ST_GeomFromText(\n format('POLYGON((0 0, %s %s, %s %s, %s %s, %s %s, %s %s, 0 0))',\n qtrwidth, halfheight,\n qtrwidth * 3, halfheight,\n qtrwidth * 4, 0,\n qtrwidth * 3, halfheight * -1,\n qtrwidth, halfheight * -1\n )\n )\n , qtrwidth * 3, halfheight) as geom\n ) AS two_hex);\n\nEND$BODY$\n LANGUAGE plpgsql VOLATILE\n COST 100;\n"
test_list = ['NINE', 'Geeky', 'Computers', 'Algorithms'] print ("The original list is : " + str(test_list)) subs = 'ELEPHANTINE ' chars = set('NINE') if any((c in chars) for c in test_list): print('Found') else: print('Not Found')
test_list = ['NINE', 'Geeky', 'Computers', 'Algorithms'] print('The original list is : ' + str(test_list)) subs = 'ELEPHANTINE ' chars = set('NINE') if any((c in chars for c in test_list)): print('Found') else: print('Not Found')
# # @lc app=leetcode.cn id=240 lang=python3 # # [240] search-a-2d-matrix-ii # None # @lc code=end
None
nums = [10,9,2] print(nums) print(nums[0]) print(nums[1]) print(nums[2]) for i in nums: print(i) it = iter(nums) print(it.__next__()) print(it.__next__()) print(it.__next__()) print(next(it)) print(next(it)) print(next(it))
nums = [10, 9, 2] print(nums) print(nums[0]) print(nums[1]) print(nums[2]) for i in nums: print(i) it = iter(nums) print(it.__next__()) print(it.__next__()) print(it.__next__()) print(next(it)) print(next(it)) print(next(it))
# Copyright 2014 The Bazel 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. load("@io_bazel_rules_go//go/private:common.bzl", "get_go_toolchain", "go_exts", "hdr_exts", "c_exts", "asm_exts", "pkg_dir") load("@io_bazel_rules_go//go/private:library.bzl", "go_library") load("@io_bazel_rules_go//go/private:binary.bzl", "c_linker_options") def cgo_genrule(tags=[], **kwargs): return cgo_library(tags=tags+["manual"], **kwargs) def cgo_library(name, srcs, go_toolchain=None, go_tool=None, copts=[], clinkopts=[], cdeps=[], **kwargs): """Builds a cgo-enabled go library. Args: name: A unique name for this rule. srcs: List of Go, C and C++ files that are processed to build a Go library. Those Go files must contain `import "C"`. C and C++ files can be anything allowed in `srcs` attribute of `cc_library`. copts: Add these flags to the C++ compiler. clinkopts: Add these flags to the C++ linker. cdeps: List of C/C++ libraries to be linked into the binary target. They must be `cc_library` rules. deps: List of other libraries to be linked to this library target. data: List of files needed by this rule at runtime. NOTE: `srcs` cannot contain pure-Go files, which do not have `import "C"`. So you need to define another `go_library` when you build a go package with both cgo-enabled and pure-Go sources. ``` cgo_library( name = "cgo_enabled", srcs = ["cgo-enabled.go", "foo.cc", "bar.S", "baz.a"], ) go_library( name = "go_default_library", srcs = ["pure-go.go"], library = ":cgo_enabled", ) ``` """ cgogen = setup_cgo_library( name = name, srcs = srcs, cdeps = cdeps, copts = copts, clinkopts = clinkopts, ) go_library( name = name, srcs = cgogen.go_srcs, cgo_object = cgogen.cgo_object, **kwargs ) def _cgo_select_go_files_impl(ctx): return struct(files = ctx.attr.dep.go_files) _cgo_select_go_files = rule(_cgo_select_go_files_impl, attrs = {"dep": attr.label()}) def _cgo_select_main_c_impl(ctx): return struct(files = ctx.attr.dep.main_c) _cgo_select_main_c = rule(_cgo_select_main_c_impl, attrs = {"dep": attr.label()}) def _cgo_codegen_impl(ctx): go_toolchain = get_go_toolchain(ctx) srcs = ctx.files.srcs linkopts = ctx.attr.linkopts copts = ctx.fragments.cpp.c_options + ctx.attr.copts deps = depset([], order="topological") cgo_export_h = ctx.new_file(ctx.attr.out_dir + "/_cgo_export.h") cgo_export_c = ctx.new_file(ctx.attr.out_dir + "/_cgo_export.c") cgo_main = ctx.new_file(ctx.attr.out_dir + "/_cgo_main.c") cgo_types = ctx.new_file(ctx.attr.out_dir + "/_cgo_gotypes.go") out_dir = cgo_main.dirname cc = ctx.fragments.cpp.compiler_executable args = [go_toolchain.go.path, "-cc", str(cc), "-objdir", out_dir] c_outs = depset([cgo_export_h, cgo_export_c]) go_outs = depset([cgo_types]) hdrs = [] for src in srcs: src_stem, _, src_ext = src.path.rpartition('.') mangled_stem = ctx.attr.out_dir + "/" + src_stem.replace('/', '_') if any([src.basename.endswith(ext) for ext in hdr_exts]): copts += ['-iquote', src.dirname] hdrs += [src] elif any([src.basename.endswith(ext) for ext in go_exts]): gen_file = ctx.new_file(mangled_stem + ".cgo1."+src_ext) gen_c_file = ctx.new_file(mangled_stem + ".cgo2.c") go_outs += [gen_file] c_outs += [gen_c_file] args += ["-src", gen_file.path + "=" + src.path] elif any([src.basename.endswith(ext) for ext in asm_exts]): gen_file = ctx.new_file(mangled_stem + ".cgo1."+src_ext) go_outs += [gen_file] args += ["-src", gen_file.path + "=" + src.path] elif any([src.basename.endswith(ext) for ext in c_exts]): gen_file = ctx.new_file(mangled_stem + ".cgo1."+src_ext) c_outs += [gen_file] args += ["-src", gen_file.path + "=" + src.path] else: fail("Unknown source type {0} in {1}".format(src.basename, ctx.label)) for d in ctx.attr.deps: srcs += list(d.cc.transitive_headers) deps += d.cc.libs copts += ['-D' + define for define in d.cc.defines] for inc in d.cc.include_directories: copts += ['-I', _exec_path(inc)] for inc in d.cc.quote_include_directories: copts += ['-iquote', _exec_path(inc)] for inc in d.cc.system_include_directories: copts += ['-isystem', _exec_path(inc)] for lib in d.cc.libs: if lib.basename.startswith('lib') and lib.basename.endswith('.so'): linkopts += ['-L', lib.dirname, '-l', lib.basename[3:-3]] else: linkopts += [lib.path] linkopts += d.cc.link_flags # The first -- below is to stop the cgo from processing args, the # second is an actual arg to forward to the underlying go tool args += ["--", "--"] + copts inputs = srcs + go_toolchain.tools + go_toolchain.crosstool outputs = list(c_outs + go_outs + [cgo_main]) ctx.action( inputs = inputs, outputs = outputs, mnemonic = "CGoCodeGen", progress_message = "CGoCodeGen %s" % ctx.label, executable = go_toolchain.cgo, arguments = args, env = go_toolchain.env + { "CGO_LDFLAGS": " ".join(linkopts), }, ) return struct( label = ctx.label, files = c_outs + hdrs, go_files = go_outs, main_c = depset([cgo_main]), cgo_deps = deps, ) _cgo_codegen_rule = rule( _cgo_codegen_impl, attrs = { "srcs": attr.label_list(allow_files = True), "deps": attr.label_list( allow_files = False, providers = ["cc"], ), "copts": attr.string_list(), "linkopts": attr.string_list(), "out_dir": attr.string(mandatory = True), #TODO(toolchains): Remove _toolchain attribute when real toolchains arrive "_go_toolchain": attr.label(default = Label("@io_bazel_rules_go_toolchain//:go_toolchain")), }, fragments = ["cpp"], ) def _cgo_import_impl(ctx): #TODO: move the dynpackage part into the cgo wrapper so we can stop using shell go_toolchain = get_go_toolchain(ctx) command = ( go_toolchain.go.path + " tool cgo" + " -dynout " + ctx.outputs.out.path + " -dynimport " + ctx.file.cgo_o.path + " -dynpackage $(%s %s)" % (go_toolchain.extract_package.path, ctx.files.sample_go_srcs[0].path) ) ctx.action( inputs = (go_toolchain.tools + [go_toolchain.go, go_toolchain.extract_package, ctx.file.cgo_o, ctx.files.sample_go_srcs[0]]), outputs = [ctx.outputs.out], command = command, mnemonic = "CGoImportGen", env = go_toolchain.env, ) return struct( files = depset([ctx.outputs.out]), ) _cgo_import = rule( _cgo_import_impl, attrs = { "cgo_o": attr.label( allow_files = True, single_file = True, ), "sample_go_srcs": attr.label_list(allow_files = True), "out": attr.output( mandatory = True, ), #TODO(toolchains): Remove _toolchain attribute when real toolchains arrive "_go_toolchain": attr.label(default = Label("@io_bazel_rules_go_toolchain//:go_toolchain")), }, fragments = ["cpp"], ) """Generates symbol-import directives for cgo Args: cgo_o: The loadable object to extract dynamic symbols from. sample_go_src: A go source which is compiled together with the generated file. The generated file will have the same Go package name as this file. out: Destination of the generated codes. """ def _cgo_object_impl(ctx): go_toolchain = get_go_toolchain(ctx) arguments = c_linker_options(ctx, blacklist=[ # never link any dependency libraries "-l", "-L", # manage flags to ld(1) by ourselves "-Wl,"]) arguments += [ "-o", ctx.outputs.out.path, "-nostdlib", "-Wl,-r", ] + go_toolchain.cgo_link_flags lo = ctx.files.src[-1] arguments += [lo.path] ctx.action( inputs = [lo] + go_toolchain.crosstool, outputs = [ctx.outputs.out], mnemonic = "CGoObject", progress_message = "Linking %s" % ctx.outputs.out.short_path, executable = ctx.fragments.cpp.compiler_executable, arguments = arguments, ) runfiles = ctx.runfiles(collect_data = True) runfiles = runfiles.merge(ctx.attr.src.data_runfiles) return struct( files = depset([ctx.outputs.out]), cgo_obj = ctx.outputs.out, cgo_deps = ctx.attr.cgogen.cgo_deps, runfiles = runfiles, ) _cgo_object = rule( _cgo_object_impl, attrs = { "src": attr.label( mandatory = True, providers = ["cc"], ), "cgogen": attr.label( mandatory = True, providers = ["cgo_deps"], ), "out": attr.output( mandatory = True, ), #TODO(toolchains): Remove _toolchain attribute when real toolchains arrive "_go_toolchain": attr.label(default = Label("@io_bazel_rules_go_toolchain//:go_toolchain")), }, fragments = ["cpp"], ) def _exec_path(path): if path.startswith('/'): return path return '${execroot}/' + path """Generates _all.o to be archived together with Go objects. Args: src: source static library which contains objects cgogen: _cgo_codegen rule which knows the dependency cc_library() rules to be linked together with src when we generate the final go binary. """ def setup_cgo_library(name, srcs, cdeps, copts, clinkopts): cgo_codegen_dir = name + ".cgo.dir" # Apply build constraints to source files (both Go and C) but not to header # files. Separate filtered Go and C sources. # Run cgo on the filtered Go files. This will split them into pure Go files # and pure C files, plus a few other glue files. base_dir = pkg_dir( "external/" + REPOSITORY_NAME[1:] if len(REPOSITORY_NAME) > 1 else "", PACKAGE_NAME) copts += ["-I", base_dir] cgo_codegen_name = name + ".cgo_codegen" _cgo_codegen_rule( name = cgo_codegen_name, srcs = srcs, deps = cdeps, copts = copts, linkopts = clinkopts, out_dir = cgo_codegen_dir, visibility = ["//visibility:private"], ) select_go_files = name + ".select_go_files" _cgo_select_go_files( name = select_go_files, dep = cgo_codegen_name, visibility = ["//visibility:private"], ) select_main_c = name + ".select_main_c" _cgo_select_main_c( name = select_main_c, dep = cgo_codegen_name, visibility = ["//visibility:private"], ) # Compile C sources and generated files into a library. This will be linked # into binaries that depend on this cgo_library. It will also be used # in _cgo_.o. platform_copts = select({ "@io_bazel_rules_go//go/platform:windows_amd64": ["-mthreads"], "//conditions:default": ["-pthread"], }) platform_linkopts = platform_copts cgo_lib_name = name + ".cgo_c_lib" native.cc_library( name = cgo_lib_name, srcs = [cgo_codegen_name], deps = cdeps, copts = copts + platform_copts + [ "-I", "$(BINDIR)/" + base_dir + "/" + cgo_codegen_dir, # The generated thunks often contain unused variables. "-Wno-unused-variable", ], linkopts = clinkopts + platform_linkopts, linkstatic = 1, # _cgo_.o and _all.o keep all objects in this archive. # But it should not be very annoying in the final binary target # because _cgo_object rule does not propagate alwayslink=1 alwayslink = 1, visibility = ["//visibility:private"], ) # Create a loadable object with no undefined references. cgo reads this # when it generates _cgo_import.go. cgo_o_name = name + "._cgo_.o" native.cc_binary( name = cgo_o_name, srcs = [select_main_c], deps = cdeps + [cgo_lib_name], copts = copts, linkopts = clinkopts, visibility = ["//visibility:private"], ) # Create a Go file which imports symbols from the C library. cgo_import_name = name + ".cgo_import" _cgo_import( name = cgo_import_name, cgo_o = cgo_o_name, sample_go_srcs = [select_go_files], out = cgo_codegen_dir + "/_cgo_import.go", visibility = ["//visibility:private"], ) # Link the library into a relocatable .o file that can be linked into the # final binary. all_o_name = name + "._all.o" _cgo_object( name = all_o_name, src = cgo_lib_name, out = cgo_codegen_dir + "/_all.o", cgogen = cgo_codegen_name, visibility = ["//visibility:private"], ) return struct( name = name, go_srcs = [ select_go_files, cgo_import_name, ], cgo_object = all_o_name, )
load('@io_bazel_rules_go//go/private:common.bzl', 'get_go_toolchain', 'go_exts', 'hdr_exts', 'c_exts', 'asm_exts', 'pkg_dir') load('@io_bazel_rules_go//go/private:library.bzl', 'go_library') load('@io_bazel_rules_go//go/private:binary.bzl', 'c_linker_options') def cgo_genrule(tags=[], **kwargs): return cgo_library(tags=tags + ['manual'], **kwargs) def cgo_library(name, srcs, go_toolchain=None, go_tool=None, copts=[], clinkopts=[], cdeps=[], **kwargs): """Builds a cgo-enabled go library. Args: name: A unique name for this rule. srcs: List of Go, C and C++ files that are processed to build a Go library. Those Go files must contain `import "C"`. C and C++ files can be anything allowed in `srcs` attribute of `cc_library`. copts: Add these flags to the C++ compiler. clinkopts: Add these flags to the C++ linker. cdeps: List of C/C++ libraries to be linked into the binary target. They must be `cc_library` rules. deps: List of other libraries to be linked to this library target. data: List of files needed by this rule at runtime. NOTE: `srcs` cannot contain pure-Go files, which do not have `import "C"`. So you need to define another `go_library` when you build a go package with both cgo-enabled and pure-Go sources. ``` cgo_library( name = "cgo_enabled", srcs = ["cgo-enabled.go", "foo.cc", "bar.S", "baz.a"], ) go_library( name = "go_default_library", srcs = ["pure-go.go"], library = ":cgo_enabled", ) ``` """ cgogen = setup_cgo_library(name=name, srcs=srcs, cdeps=cdeps, copts=copts, clinkopts=clinkopts) go_library(name=name, srcs=cgogen.go_srcs, cgo_object=cgogen.cgo_object, **kwargs) def _cgo_select_go_files_impl(ctx): return struct(files=ctx.attr.dep.go_files) _cgo_select_go_files = rule(_cgo_select_go_files_impl, attrs={'dep': attr.label()}) def _cgo_select_main_c_impl(ctx): return struct(files=ctx.attr.dep.main_c) _cgo_select_main_c = rule(_cgo_select_main_c_impl, attrs={'dep': attr.label()}) def _cgo_codegen_impl(ctx): go_toolchain = get_go_toolchain(ctx) srcs = ctx.files.srcs linkopts = ctx.attr.linkopts copts = ctx.fragments.cpp.c_options + ctx.attr.copts deps = depset([], order='topological') cgo_export_h = ctx.new_file(ctx.attr.out_dir + '/_cgo_export.h') cgo_export_c = ctx.new_file(ctx.attr.out_dir + '/_cgo_export.c') cgo_main = ctx.new_file(ctx.attr.out_dir + '/_cgo_main.c') cgo_types = ctx.new_file(ctx.attr.out_dir + '/_cgo_gotypes.go') out_dir = cgo_main.dirname cc = ctx.fragments.cpp.compiler_executable args = [go_toolchain.go.path, '-cc', str(cc), '-objdir', out_dir] c_outs = depset([cgo_export_h, cgo_export_c]) go_outs = depset([cgo_types]) hdrs = [] for src in srcs: (src_stem, _, src_ext) = src.path.rpartition('.') mangled_stem = ctx.attr.out_dir + '/' + src_stem.replace('/', '_') if any([src.basename.endswith(ext) for ext in hdr_exts]): copts += ['-iquote', src.dirname] hdrs += [src] elif any([src.basename.endswith(ext) for ext in go_exts]): gen_file = ctx.new_file(mangled_stem + '.cgo1.' + src_ext) gen_c_file = ctx.new_file(mangled_stem + '.cgo2.c') go_outs += [gen_file] c_outs += [gen_c_file] args += ['-src', gen_file.path + '=' + src.path] elif any([src.basename.endswith(ext) for ext in asm_exts]): gen_file = ctx.new_file(mangled_stem + '.cgo1.' + src_ext) go_outs += [gen_file] args += ['-src', gen_file.path + '=' + src.path] elif any([src.basename.endswith(ext) for ext in c_exts]): gen_file = ctx.new_file(mangled_stem + '.cgo1.' + src_ext) c_outs += [gen_file] args += ['-src', gen_file.path + '=' + src.path] else: fail('Unknown source type {0} in {1}'.format(src.basename, ctx.label)) for d in ctx.attr.deps: srcs += list(d.cc.transitive_headers) deps += d.cc.libs copts += ['-D' + define for define in d.cc.defines] for inc in d.cc.include_directories: copts += ['-I', _exec_path(inc)] for inc in d.cc.quote_include_directories: copts += ['-iquote', _exec_path(inc)] for inc in d.cc.system_include_directories: copts += ['-isystem', _exec_path(inc)] for lib in d.cc.libs: if lib.basename.startswith('lib') and lib.basename.endswith('.so'): linkopts += ['-L', lib.dirname, '-l', lib.basename[3:-3]] else: linkopts += [lib.path] linkopts += d.cc.link_flags args += ['--', '--'] + copts inputs = srcs + go_toolchain.tools + go_toolchain.crosstool outputs = list(c_outs + go_outs + [cgo_main]) ctx.action(inputs=inputs, outputs=outputs, mnemonic='CGoCodeGen', progress_message='CGoCodeGen %s' % ctx.label, executable=go_toolchain.cgo, arguments=args, env=go_toolchain.env + {'CGO_LDFLAGS': ' '.join(linkopts)}) return struct(label=ctx.label, files=c_outs + hdrs, go_files=go_outs, main_c=depset([cgo_main]), cgo_deps=deps) _cgo_codegen_rule = rule(_cgo_codegen_impl, attrs={'srcs': attr.label_list(allow_files=True), 'deps': attr.label_list(allow_files=False, providers=['cc']), 'copts': attr.string_list(), 'linkopts': attr.string_list(), 'out_dir': attr.string(mandatory=True), '_go_toolchain': attr.label(default=label('@io_bazel_rules_go_toolchain//:go_toolchain'))}, fragments=['cpp']) def _cgo_import_impl(ctx): go_toolchain = get_go_toolchain(ctx) command = go_toolchain.go.path + ' tool cgo' + ' -dynout ' + ctx.outputs.out.path + ' -dynimport ' + ctx.file.cgo_o.path + ' -dynpackage $(%s %s)' % (go_toolchain.extract_package.path, ctx.files.sample_go_srcs[0].path) ctx.action(inputs=go_toolchain.tools + [go_toolchain.go, go_toolchain.extract_package, ctx.file.cgo_o, ctx.files.sample_go_srcs[0]], outputs=[ctx.outputs.out], command=command, mnemonic='CGoImportGen', env=go_toolchain.env) return struct(files=depset([ctx.outputs.out])) _cgo_import = rule(_cgo_import_impl, attrs={'cgo_o': attr.label(allow_files=True, single_file=True), 'sample_go_srcs': attr.label_list(allow_files=True), 'out': attr.output(mandatory=True), '_go_toolchain': attr.label(default=label('@io_bazel_rules_go_toolchain//:go_toolchain'))}, fragments=['cpp']) 'Generates symbol-import directives for cgo\n\nArgs:\n cgo_o: The loadable object to extract dynamic symbols from.\n sample_go_src: A go source which is compiled together with the generated file.\n The generated file will have the same Go package name as this file.\n out: Destination of the generated codes.\n' def _cgo_object_impl(ctx): go_toolchain = get_go_toolchain(ctx) arguments = c_linker_options(ctx, blacklist=['-l', '-L', '-Wl,']) arguments += ['-o', ctx.outputs.out.path, '-nostdlib', '-Wl,-r'] + go_toolchain.cgo_link_flags lo = ctx.files.src[-1] arguments += [lo.path] ctx.action(inputs=[lo] + go_toolchain.crosstool, outputs=[ctx.outputs.out], mnemonic='CGoObject', progress_message='Linking %s' % ctx.outputs.out.short_path, executable=ctx.fragments.cpp.compiler_executable, arguments=arguments) runfiles = ctx.runfiles(collect_data=True) runfiles = runfiles.merge(ctx.attr.src.data_runfiles) return struct(files=depset([ctx.outputs.out]), cgo_obj=ctx.outputs.out, cgo_deps=ctx.attr.cgogen.cgo_deps, runfiles=runfiles) _cgo_object = rule(_cgo_object_impl, attrs={'src': attr.label(mandatory=True, providers=['cc']), 'cgogen': attr.label(mandatory=True, providers=['cgo_deps']), 'out': attr.output(mandatory=True), '_go_toolchain': attr.label(default=label('@io_bazel_rules_go_toolchain//:go_toolchain'))}, fragments=['cpp']) def _exec_path(path): if path.startswith('/'): return path return '${execroot}/' + path 'Generates _all.o to be archived together with Go objects.\n\nArgs:\n src: source static library which contains objects\n cgogen: _cgo_codegen rule which knows the dependency cc_library() rules\n to be linked together with src when we generate the final go binary.\n' def setup_cgo_library(name, srcs, cdeps, copts, clinkopts): cgo_codegen_dir = name + '.cgo.dir' base_dir = pkg_dir('external/' + REPOSITORY_NAME[1:] if len(REPOSITORY_NAME) > 1 else '', PACKAGE_NAME) copts += ['-I', base_dir] cgo_codegen_name = name + '.cgo_codegen' _cgo_codegen_rule(name=cgo_codegen_name, srcs=srcs, deps=cdeps, copts=copts, linkopts=clinkopts, out_dir=cgo_codegen_dir, visibility=['//visibility:private']) select_go_files = name + '.select_go_files' _cgo_select_go_files(name=select_go_files, dep=cgo_codegen_name, visibility=['//visibility:private']) select_main_c = name + '.select_main_c' _cgo_select_main_c(name=select_main_c, dep=cgo_codegen_name, visibility=['//visibility:private']) platform_copts = select({'@io_bazel_rules_go//go/platform:windows_amd64': ['-mthreads'], '//conditions:default': ['-pthread']}) platform_linkopts = platform_copts cgo_lib_name = name + '.cgo_c_lib' native.cc_library(name=cgo_lib_name, srcs=[cgo_codegen_name], deps=cdeps, copts=copts + platform_copts + ['-I', '$(BINDIR)/' + base_dir + '/' + cgo_codegen_dir, '-Wno-unused-variable'], linkopts=clinkopts + platform_linkopts, linkstatic=1, alwayslink=1, visibility=['//visibility:private']) cgo_o_name = name + '._cgo_.o' native.cc_binary(name=cgo_o_name, srcs=[select_main_c], deps=cdeps + [cgo_lib_name], copts=copts, linkopts=clinkopts, visibility=['//visibility:private']) cgo_import_name = name + '.cgo_import' _cgo_import(name=cgo_import_name, cgo_o=cgo_o_name, sample_go_srcs=[select_go_files], out=cgo_codegen_dir + '/_cgo_import.go', visibility=['//visibility:private']) all_o_name = name + '._all.o' _cgo_object(name=all_o_name, src=cgo_lib_name, out=cgo_codegen_dir + '/_all.o', cgogen=cgo_codegen_name, visibility=['//visibility:private']) return struct(name=name, go_srcs=[select_go_files, cgo_import_name], cgo_object=all_o_name)
# test10.py a = _n('a') b = _n('b') root = (a^b)*inv(a^b)
a = _n('a') b = _n('b') root = (a ^ b) * inv(a ^ b)
"""A module defining the third party dependency GMP""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def gmp_repositories(): maybe( http_archive, name = "GMP_lib", build_file = Label("@//third_party/GMP:BUILD.gmp.bazel"), sha256 = "258e6cd51b3fbdfc185c716d55f82c08aff57df0c6fbd143cf6ed561267a1526", strip_prefix = "gmp-6.2.0", # Be compliant with what NTL expects (otherwise version mismatch) urls = ["https://ftp.gnu.org/gnu/gmp/gmp-6.2.0.tar.xz"], )
"""A module defining the third party dependency GMP""" load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') def gmp_repositories(): maybe(http_archive, name='GMP_lib', build_file=label('@//third_party/GMP:BUILD.gmp.bazel'), sha256='258e6cd51b3fbdfc185c716d55f82c08aff57df0c6fbd143cf6ed561267a1526', strip_prefix='gmp-6.2.0', urls=['https://ftp.gnu.org/gnu/gmp/gmp-6.2.0.tar.xz'])
# # @lc app=leetcode id=100 lang=python3 # # [100] Same Tree # # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: if p is None: return q is None elif q is None: return False else: return p.val == q.val and self.isSameTree(p.left, q.left) \ and self.isSameTree(p.right, q.right)
class Solution: def is_same_tree(self, p: TreeNode, q: TreeNode) -> bool: if p is None: return q is None elif q is None: return False else: return p.val == q.val and self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right)
L, Q = map(int, input().split()) w = {"0": L} plist = [0] for _ in range(Q): c, x = map(int, input().split()) if c == 1: target_p = None for p in plist: if p < x: target_p = p else: break w[str(x)] = target_p + w[str(target_p)] - x w[str(target_p)] = w[str(target_p)] - w[str(x)] plist = plist + [x] plist.sort() elif c == 2: target_p = None for p in plist: if p < x: target_p = p else: break print(w[str(target_p)])
(l, q) = map(int, input().split()) w = {'0': L} plist = [0] for _ in range(Q): (c, x) = map(int, input().split()) if c == 1: target_p = None for p in plist: if p < x: target_p = p else: break w[str(x)] = target_p + w[str(target_p)] - x w[str(target_p)] = w[str(target_p)] - w[str(x)] plist = plist + [x] plist.sort() elif c == 2: target_p = None for p in plist: if p < x: target_p = p else: break print(w[str(target_p)])
#!/usr/bin/python # ============================================================================== # Author: Tao Li (taoli@ucsd.edu) # Date: May 3, 2015 # Question: 038-Count-and-Say # Link: https://leetcode.com/problems/count-and-say/ # ============================================================================== # The count-and-say sequence is the sequence of integers beginning as follows: # 1, 11, 21, 1211, 111221, ... # 1 is read off as "one 1" or 11. # 11 is read off as "two 1s" or 21. # 21 is read off as "one 2, then one 1" or 1211. # Given an integer n, generate the nth sequence. # Note: The sequence of integers will be represented as a string. # ============================================================================== class Solution: # @param {integer} n # @return {string} def countAndSay(self, n): res = str(1) while n > 1: n -= 1 res = self.say(res) return res def say(self, s): if len(s) == 1: return '1'+s last = s[0] newStr = "" counter = 1 for i in s[1:]: if last == i: counter += 1 else: newStr += str(counter)+last last = i counter = 1 newStr += str(counter)+last return newStr
class Solution: def count_and_say(self, n): res = str(1) while n > 1: n -= 1 res = self.say(res) return res def say(self, s): if len(s) == 1: return '1' + s last = s[0] new_str = '' counter = 1 for i in s[1:]: if last == i: counter += 1 else: new_str += str(counter) + last last = i counter = 1 new_str += str(counter) + last return newStr
def stop(track, pos, start_speed): max_speed = len(track)-1 solutions = {} for posistion in range(len(track)): if track[posistion]: solutions[posistion] = set([0]) for posistion in reversed(range(pos, len(track))): if not track[posistion]: continue for speed in range(1,max_speed): for adjusted_speed in [speed+1,speed,speed-1]: new_posistion = posistion + adjusted_speed if new_posistion in solutions: if adjusted_speed in solutions[new_posistion]: solutions[posistion].add(speed) print(solutions[pos]) return start_speed in solutions[pos] print(stop([False,True,True,True,False],1,3))
def stop(track, pos, start_speed): max_speed = len(track) - 1 solutions = {} for posistion in range(len(track)): if track[posistion]: solutions[posistion] = set([0]) for posistion in reversed(range(pos, len(track))): if not track[posistion]: continue for speed in range(1, max_speed): for adjusted_speed in [speed + 1, speed, speed - 1]: new_posistion = posistion + adjusted_speed if new_posistion in solutions: if adjusted_speed in solutions[new_posistion]: solutions[posistion].add(speed) print(solutions[pos]) return start_speed in solutions[pos] print(stop([False, True, True, True, False], 1, 3))
class level(object): bg = pygame.image.load(os.path.abspath(os.path.join(os.path.dirname(__file__),'images/bg.png'))) def __init__(self,currentpos,levellength): self.currentpos = currentpos self.fulllength = fulllength self.vel = velocity def draw(self, win): win.blit(self.bg, (self.currentpos,0)) #pygame.draw.rect(win, (255,0,0), self.hitbox2,2)
class Level(object): bg = pygame.image.load(os.path.abspath(os.path.join(os.path.dirname(__file__), 'images/bg.png'))) def __init__(self, currentpos, levellength): self.currentpos = currentpos self.fulllength = fulllength self.vel = velocity def draw(self, win): win.blit(self.bg, (self.currentpos, 0))
config_dict = { "out_path": "~/daily_counts.json", "trackers": [ { "name": "Hex.pm (Elixir/Erlang)", "url": "https://hex.pm/packages", "regex": ">(\\d+) Results Found" }, { "name": "DUB (dlang)", "url": "https://code.dlang.org", "regex": "<p>Found (\\d+) packages.<\/p>" }, { "name": "npm (node.js)", "url": "https://skimdb.npmjs.com/registry", "key": "doc_count" }, { "name": "Rubygems.org", "url": "https://rubygems.org/stats", "regex": "Total gems[^<]*<[^<]*stat__count\">([0-9,]+)<" }, { "name": "Drupal (php)", "url": "https://www.drupal.org/project/project_module", "regex": ">([0-9,]+) Modules match your search" }, { "name": "Perl 6 Ecosystem (perl 6)", "url": "http://modules.perl6.org/total", "regex": "(\\d+)" }, { "name": "nuget (.NET)", "url": "http://www.nuget.org/stats/totals", "key": "UniquePackages" }, { "name": "LuaRocks (Lua)", "url": "https://luarocks.org/m/root", "regex": "<span class=\"header_count\">\\((\\d+)\\)</span>" }, { "name": "Packagist (PHP)", "url": "http://packagist.org/statistics", "regex": "Packages registered<\\/dt>[^>]+>(\\d[^<]+)<\\/dd" }, { "name": "Crates.io (Rust)", "url": "https://crates.io/summary", "key": "num_crates" }, { "name": "CRAN (R)", "url": "http://cran.r-project.org/web/packages/", "regex": "features\\s+([\\d,]+)\\s+available packages" }, { "name": "Hackage (Haskell)", "url": "http://hackage.haskell.org/packages/.json", "is_full_list": True }, { "name": "Melpa (Emacs)", "url": "http://melpa.milkbox.net/recipes.json", "is_full_list": True }, { "name": "Maven Central (Java)", "url": "http://search.maven.org/quickstats", "key": "gaNumber" }, { "name": "Clojars (Clojure)", "url": "http://clojars.org/projects", "regex": "Displaying projects <b>.*</b> of <b>\\s*(\\d+)\\s*</b>\\s*</div>" }, { "name": "CPAN (search)", "url": "http://search.cpan.org", "regex": ",\\s+(\\d+)\\sDistributions" }, { "name": "PyPI", "url": "http://pypi.python.org/pypi", "regex": "currently\\s*<strong>([\\d,]+)</strong>\\s*packages" } ] }
config_dict = {'out_path': '~/daily_counts.json', 'trackers': [{'name': 'Hex.pm (Elixir/Erlang)', 'url': 'https://hex.pm/packages', 'regex': '>(\\d+) Results Found'}, {'name': 'DUB (dlang)', 'url': 'https://code.dlang.org', 'regex': '<p>Found (\\d+) packages.<\\/p>'}, {'name': 'npm (node.js)', 'url': 'https://skimdb.npmjs.com/registry', 'key': 'doc_count'}, {'name': 'Rubygems.org', 'url': 'https://rubygems.org/stats', 'regex': 'Total gems[^<]*<[^<]*stat__count">([0-9,]+)<'}, {'name': 'Drupal (php)', 'url': 'https://www.drupal.org/project/project_module', 'regex': '>([0-9,]+) Modules match your search'}, {'name': 'Perl 6 Ecosystem (perl 6)', 'url': 'http://modules.perl6.org/total', 'regex': '(\\d+)'}, {'name': 'nuget (.NET)', 'url': 'http://www.nuget.org/stats/totals', 'key': 'UniquePackages'}, {'name': 'LuaRocks (Lua)', 'url': 'https://luarocks.org/m/root', 'regex': '<span class="header_count">\\((\\d+)\\)</span>'}, {'name': 'Packagist (PHP)', 'url': 'http://packagist.org/statistics', 'regex': 'Packages registered<\\/dt>[^>]+>(\\d[^<]+)<\\/dd'}, {'name': 'Crates.io (Rust)', 'url': 'https://crates.io/summary', 'key': 'num_crates'}, {'name': 'CRAN (R)', 'url': 'http://cran.r-project.org/web/packages/', 'regex': 'features\\s+([\\d,]+)\\s+available packages'}, {'name': 'Hackage (Haskell)', 'url': 'http://hackage.haskell.org/packages/.json', 'is_full_list': True}, {'name': 'Melpa (Emacs)', 'url': 'http://melpa.milkbox.net/recipes.json', 'is_full_list': True}, {'name': 'Maven Central (Java)', 'url': 'http://search.maven.org/quickstats', 'key': 'gaNumber'}, {'name': 'Clojars (Clojure)', 'url': 'http://clojars.org/projects', 'regex': 'Displaying projects <b>.*</b> of <b>\\s*(\\d+)\\s*</b>\\s*</div>'}, {'name': 'CPAN (search)', 'url': 'http://search.cpan.org', 'regex': ',\\s+(\\d+)\\sDistributions'}, {'name': 'PyPI', 'url': 'http://pypi.python.org/pypi', 'regex': 'currently\\s*<strong>([\\d,]+)</strong>\\s*packages'}]}
class Solution: def solve(self, nums, M, K): n = len(nums) r = -99999 for i in range(n - M * K): r = max(r, sum(nums[i: i + M * K + 1: K + 1])) return r def solve2(self, N, R, points): M = len(R) S = len(points) R.sort(reverse=True) points.sort() count = 0 gap = 0 i = 0 while i < M: if count >= M: return -1 if points[i] > R[count] * 2 + gap: count += 1 gap = points[i] elif points[i] == R[count] * 2 + gap: count += 1 i += 1 gap = points[i] i += 1 return count def insertsort(A): for j in range(1, len(A)): key = A[j] i = j - 1 while i >= 0 and A[i] > key: A[i + 1] = A[i] i -= 1 A[i + 1] = key return A def main(): solution = Solution() print(solution.solve([-6, -5, -2, 0, -1], 2, 1)) print(solution.solve([0, -5, -2, 0, -1], 2, 1)) print(solution.solve2(10, [2, 2, 3], [0, 3, 7])) print(solution.solve2(12, [2, 2, 3], [0, 2, 3, 8, 12])) print(solution.solve2(12, [2, 4], [0, 2, 3, 8, 12])) print(solution.solve2(12, [2, 2, 5], [0, 2, 3, 8, 12])) print(solution.solve2(12, [2, 2, 3], [0, 2, 3, 8, 14])) print(solution.solve2(12, [3], [0, 2, 3, 8, 14])) print(insertsort([5, 6, 4, 8, 4, 3, 2, 1])) if __name__ == "__main__": main()
class Solution: def solve(self, nums, M, K): n = len(nums) r = -99999 for i in range(n - M * K): r = max(r, sum(nums[i:i + M * K + 1:K + 1])) return r def solve2(self, N, R, points): m = len(R) s = len(points) R.sort(reverse=True) points.sort() count = 0 gap = 0 i = 0 while i < M: if count >= M: return -1 if points[i] > R[count] * 2 + gap: count += 1 gap = points[i] elif points[i] == R[count] * 2 + gap: count += 1 i += 1 gap = points[i] i += 1 return count def insertsort(A): for j in range(1, len(A)): key = A[j] i = j - 1 while i >= 0 and A[i] > key: A[i + 1] = A[i] i -= 1 A[i + 1] = key return A def main(): solution = solution() print(solution.solve([-6, -5, -2, 0, -1], 2, 1)) print(solution.solve([0, -5, -2, 0, -1], 2, 1)) print(solution.solve2(10, [2, 2, 3], [0, 3, 7])) print(solution.solve2(12, [2, 2, 3], [0, 2, 3, 8, 12])) print(solution.solve2(12, [2, 4], [0, 2, 3, 8, 12])) print(solution.solve2(12, [2, 2, 5], [0, 2, 3, 8, 12])) print(solution.solve2(12, [2, 2, 3], [0, 2, 3, 8, 14])) print(solution.solve2(12, [3], [0, 2, 3, 8, 14])) print(insertsort([5, 6, 4, 8, 4, 3, 2, 1])) if __name__ == '__main__': main()
# This is an example of a comment that Python ignores. Use these to make notes as you write your code. You will also fill out the top comment with any help or resources you use. # Collaborators: (fill this is on every assignment, even if the answer is "none") print('Hello world') name='Keelie' print(f'Hello {name}') name2 = 'Friends' print(f' Welcome {name} and {name2}') print('What is your favorite period of history?') period_of_history = input() print(f'The {period_of_history} is fascinating!') print('What do you like about The Holy Roman Empire?') What_do_you_like_about = input() print(f'I like the {What_do_you_like_about} about it too!') print('Enter a number') num = int(input()) quadruple = num * 4 print(quadruple) print(type(num))
print('Hello world') name = 'Keelie' print(f'Hello {name}') name2 = 'Friends' print(f' Welcome {name} and {name2}') print('What is your favorite period of history?') period_of_history = input() print(f'The {period_of_history} is fascinating!') print('What do you like about The Holy Roman Empire?') what_do_you_like_about = input() print(f'I like the {What_do_you_like_about} about it too!') print('Enter a number') num = int(input()) quadruple = num * 4 print(quadruple) print(type(num))
# -*- coding: utf-8 -*- """ idfy_rest_client.models.konsern_link This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io ) """ class KonsernLink(object): """Implementation of the 'KonsernLink' model. TODO: type model description here. Attributes: orgnr_overste_mor_field (int): TODO: type description here. orgnr_naermeste_mor_field (int): TODO: type description here. lopenr_field (int): TODO: type description here. niva_deltagende_field (int): TODO: type description here. landkode_deltagende_field (string): TODO: type description here. orgnr_deltagende_field (int): TODO: type description here. navn_deltagende_field (string): TODO: type description here. eierandel_deltagende_field (float): TODO: type description here. """ # Create a mapping from Model property names to API property names _names = { "orgnr_overste_mor_field":'orgnrOversteMorField', "orgnr_naermeste_mor_field":'orgnrNaermesteMorField', "lopenr_field":'lopenrField', "niva_deltagende_field":'nivaDeltagendeField', "landkode_deltagende_field":'landkodeDeltagendeField', "orgnr_deltagende_field":'orgnrDeltagendeField', "navn_deltagende_field":'navnDeltagendeField', "eierandel_deltagende_field":'eierandelDeltagendeField' } def __init__(self, orgnr_overste_mor_field=None, orgnr_naermeste_mor_field=None, lopenr_field=None, niva_deltagende_field=None, landkode_deltagende_field=None, orgnr_deltagende_field=None, navn_deltagende_field=None, eierandel_deltagende_field=None, additional_properties = {}): """Constructor for the KonsernLink class""" # Initialize members of the class self.orgnr_overste_mor_field = orgnr_overste_mor_field self.orgnr_naermeste_mor_field = orgnr_naermeste_mor_field self.lopenr_field = lopenr_field self.niva_deltagende_field = niva_deltagende_field self.landkode_deltagende_field = landkode_deltagende_field self.orgnr_deltagende_field = orgnr_deltagende_field self.navn_deltagende_field = navn_deltagende_field self.eierandel_deltagende_field = eierandel_deltagende_field # Add additional model properties to the instance self.additional_properties = additional_properties @classmethod def from_dictionary(cls, dictionary): """Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as obtained from the deserialization of the server's response. The keys MUST match property names in the API description. Returns: object: An instance of this structure class. """ if dictionary is None: return None # Extract variables from the dictionary orgnr_overste_mor_field = dictionary.get('orgnrOversteMorField') orgnr_naermeste_mor_field = dictionary.get('orgnrNaermesteMorField') lopenr_field = dictionary.get('lopenrField') niva_deltagende_field = dictionary.get('nivaDeltagendeField') landkode_deltagende_field = dictionary.get('landkodeDeltagendeField') orgnr_deltagende_field = dictionary.get('orgnrDeltagendeField') navn_deltagende_field = dictionary.get('navnDeltagendeField') eierandel_deltagende_field = dictionary.get('eierandelDeltagendeField') # Clean out expected properties from dictionary for key in cls._names.values(): if key in dictionary: del dictionary[key] # Return an object of this model return cls(orgnr_overste_mor_field, orgnr_naermeste_mor_field, lopenr_field, niva_deltagende_field, landkode_deltagende_field, orgnr_deltagende_field, navn_deltagende_field, eierandel_deltagende_field, dictionary)
""" idfy_rest_client.models.konsern_link This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io ) """ class Konsernlink(object): """Implementation of the 'KonsernLink' model. TODO: type model description here. Attributes: orgnr_overste_mor_field (int): TODO: type description here. orgnr_naermeste_mor_field (int): TODO: type description here. lopenr_field (int): TODO: type description here. niva_deltagende_field (int): TODO: type description here. landkode_deltagende_field (string): TODO: type description here. orgnr_deltagende_field (int): TODO: type description here. navn_deltagende_field (string): TODO: type description here. eierandel_deltagende_field (float): TODO: type description here. """ _names = {'orgnr_overste_mor_field': 'orgnrOversteMorField', 'orgnr_naermeste_mor_field': 'orgnrNaermesteMorField', 'lopenr_field': 'lopenrField', 'niva_deltagende_field': 'nivaDeltagendeField', 'landkode_deltagende_field': 'landkodeDeltagendeField', 'orgnr_deltagende_field': 'orgnrDeltagendeField', 'navn_deltagende_field': 'navnDeltagendeField', 'eierandel_deltagende_field': 'eierandelDeltagendeField'} def __init__(self, orgnr_overste_mor_field=None, orgnr_naermeste_mor_field=None, lopenr_field=None, niva_deltagende_field=None, landkode_deltagende_field=None, orgnr_deltagende_field=None, navn_deltagende_field=None, eierandel_deltagende_field=None, additional_properties={}): """Constructor for the KonsernLink class""" self.orgnr_overste_mor_field = orgnr_overste_mor_field self.orgnr_naermeste_mor_field = orgnr_naermeste_mor_field self.lopenr_field = lopenr_field self.niva_deltagende_field = niva_deltagende_field self.landkode_deltagende_field = landkode_deltagende_field self.orgnr_deltagende_field = orgnr_deltagende_field self.navn_deltagende_field = navn_deltagende_field self.eierandel_deltagende_field = eierandel_deltagende_field self.additional_properties = additional_properties @classmethod def from_dictionary(cls, dictionary): """Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as obtained from the deserialization of the server's response. The keys MUST match property names in the API description. Returns: object: An instance of this structure class. """ if dictionary is None: return None orgnr_overste_mor_field = dictionary.get('orgnrOversteMorField') orgnr_naermeste_mor_field = dictionary.get('orgnrNaermesteMorField') lopenr_field = dictionary.get('lopenrField') niva_deltagende_field = dictionary.get('nivaDeltagendeField') landkode_deltagende_field = dictionary.get('landkodeDeltagendeField') orgnr_deltagende_field = dictionary.get('orgnrDeltagendeField') navn_deltagende_field = dictionary.get('navnDeltagendeField') eierandel_deltagende_field = dictionary.get('eierandelDeltagendeField') for key in cls._names.values(): if key in dictionary: del dictionary[key] return cls(orgnr_overste_mor_field, orgnr_naermeste_mor_field, lopenr_field, niva_deltagende_field, landkode_deltagende_field, orgnr_deltagende_field, navn_deltagende_field, eierandel_deltagende_field, dictionary)
# Asks for a file name and tries to find it and adds a file extention to the # input name. If it is not found, tell and try again untill it is found def enterFile(): # initialisation notFound = True # while the file isn't found, keep asking for a filename while notFound: # input filename needs to be without the file extention fileName = input('Enter the filename here, without the suffux("<enter file suffix here>"): ') # adds custom file extention fileName += str('<enter file suffix here> (example: ".txt")') # assigns the opening of a file to a variable, and tries to open it try: open(fileName) # If file isn't found, tell the user except FileNotFoundError: print('') print('File not found, please try again') print('') # if file is found, tell the user and stop asking for a new filename else: print('') print('File found, congratulations!') print('') notFound = False return(fileName)
def enter_file(): not_found = True while notFound: file_name = input('Enter the filename here, without the suffux("<enter file suffix here>"): ') file_name += str('<enter file suffix here> (example: ".txt")') try: open(fileName) except FileNotFoundError: print('') print('File not found, please try again') print('') else: print('') print('File found, congratulations!') print('') not_found = False return fileName
expected_output = { "bgp_id": 5918, "vrf": { "L3VPN-1151": { "neighbor": { "192.168.10.253": { "address_family": { "vpnv4": { "activity_paths": "5564978/1540171", "activity_prefixes": "2722671/700066", "as": 61100, "attribute_entries": "5101/4901", "bgp_table_version": 9370786, "cache_entries": { "filter-list": {"memory_usage": 0, "total_entries": 0}, "route-map": {"memory_usage": 0, "total_entries": 0}, }, "community_entries": { "memory_usage": 60120, "total_entries": 2303, }, "entries": { "AS-PATH": {"memory_usage": 4824, "total_entries": 201}, "rrinfo": {"memory_usage": 20080, "total_entries": 502}, }, "input_queue": 0, "local_as": 5918, "msg_rcvd": 0, "msg_sent": 0, "output_queue": 0, "path": {"memory_usage": 24360, "total_entries": 203}, "prefixes": {"memory_usage": 26112, "total_entries": 102}, "route_identifier": "192.168.10.254", "routing_table_version": 9370786, "scan_interval": 60, "state_pfxrcd": "Idle", "tbl_ver": 1, "total_memory": 1482160, "up_down": "never", "version": 4, } } } } } }, }
expected_output = {'bgp_id': 5918, 'vrf': {'L3VPN-1151': {'neighbor': {'192.168.10.253': {'address_family': {'vpnv4': {'activity_paths': '5564978/1540171', 'activity_prefixes': '2722671/700066', 'as': 61100, 'attribute_entries': '5101/4901', 'bgp_table_version': 9370786, 'cache_entries': {'filter-list': {'memory_usage': 0, 'total_entries': 0}, 'route-map': {'memory_usage': 0, 'total_entries': 0}}, 'community_entries': {'memory_usage': 60120, 'total_entries': 2303}, 'entries': {'AS-PATH': {'memory_usage': 4824, 'total_entries': 201}, 'rrinfo': {'memory_usage': 20080, 'total_entries': 502}}, 'input_queue': 0, 'local_as': 5918, 'msg_rcvd': 0, 'msg_sent': 0, 'output_queue': 0, 'path': {'memory_usage': 24360, 'total_entries': 203}, 'prefixes': {'memory_usage': 26112, 'total_entries': 102}, 'route_identifier': '192.168.10.254', 'routing_table_version': 9370786, 'scan_interval': 60, 'state_pfxrcd': 'Idle', 'tbl_ver': 1, 'total_memory': 1482160, 'up_down': 'never', 'version': 4}}}}}}}
class Solution: def numDifferentIntegers(self, word: str) -> int: s = "".join([char if char.isdigit() else " " for char in word]) return len({int(num) for num in s.split()})
class Solution: def num_different_integers(self, word: str) -> int: s = ''.join([char if char.isdigit() else ' ' for char in word]) return len({int(num) for num in s.split()})
if __name__ == '__main__': print("hello, world")
if __name__ == '__main__': print('hello, world')
''' ATOMIC WEIGHTS OF THE ELEMENTS (2019) from the IUPAC Commission on Isotopic Abundances and Atomic Weights Based on the following reports: - Pure Appl. Chem., 2016, 88, 265-291 (https://doi.org/10.1515/pac-2015-0305) - Chem. Eng. News, 2015, 93(37), 9 (https://doi.org/10.1021/cen-09337-notw9) - Pure Appl. Chem., 2016, 88, 139-153 (https://doi.org/10.1515/pac-2015-0502) - Pure Appl. Chem., 2016, 88, 155-160 (https://doi.org/10.1515/pac-2015-0501) - Pure Appl. Chem., 2016, 88, 1225-1229 (https://doi.org/10.1515/pac-2016-0501) - Chem. Int., 2018, 40(4), 23-24 (https://doi.org/10.1515/ci-2018-0409) - Chem. Int., 2020, 42(2), 31 (https://doi.org/10.1515/ci-2020-0222) Data taken from: https://www.qmul.ac.uk/sbcs/iupac/AtWt/ Quoted atomic weights are those suggested for materials where the origin of the sample is unknown. For radioactive elements the isotope with the longest half-life is quoted as an integer. ''' def atomic_weight(element): atomic_weight_table = { "H": 1.008, "He": 4.002602, "Li": 6.94, "Be": 9.0121831, "B": 10.81, "C": 12.011, "N": 14.007, "O": 15.999, "F": 18.998403163, "Ne": 20.1797, "Na": 22.98976928, "Mg": 24.305, "Al": 26.9815384, "Si": 28.085, "P": 30.973761998, "S": 32.06, "Cl": 35.45, "Ar": 39.948, "K": 39.0983, "Ca": 40.078, "Sc": 44.955908, "Ti": 47.867, "V": 50.9415, "Cr": 51.9961, "Mn": 54.938043, "Fe": 55.845, "Co": 58.933194, "Ni": 58.6934, "Cu": 63.546, "Zn": 65.38, "Ga": 69.723, "Ge": 72.630, "As": 74.921595, "Se": 78.971, "Br": 79.904, "Kr": 83.798, "Rb": 85.4678, "Sr": 87.62, "Y": 88.90584, "Zr": 91.224, "Nb": 92.90637, "Mo": 95.95, "Tc": 97, "Ru": 101.07, "Rh": 102.90549, "Pd": 106.42, "Ag": 107.8682, "Cd": 112.414, "In": 114.818, "Sn": 118.710, "Sb": 121.760, "Te": 127.60, "I": 126.90447, "Xe": 131.293, "Cs": 132.90545196, "Ba": 137.327, "La": 138.90547, "Ce": 140.116, "Pr": 140.90766, "Nd": 144.242, "Pm": 145, "Sm": 150.36, "Eu": 151.964, "Gd": 157.25, "Tb": 158.925354, "Dy": 162.500, "Ho": 164.930328, "Er": 167.259, "Tm": 168.934218, "Yb": 173.045, "Lu": 174.9668, "Hf": 178.486, "Ta": 180.94788, "W": 183.84, "Re": 186.207, "Os": 190.23, "Ir": 192.217, "Pt": 195.084, "Au": 196.966570, "Hg": 200.592, "Tl": 204.38, "Pb": 207.2, "Bi": 208.98040, "Po": 209, "At": 210, "Rn": 222, "Fr": 223, "Ra": 226, "Ac": 227, "Th": 232.0377, "Pa": 231.03588, "U": 238.02891, "Np": 237, "Pu": 244, "Am": 243, "Cm": 247, "Bk": 247, "Cf": 251, "Es": 252, "Fm": 257, "Md": 258, "No": 259, "Lr": 262, "Rf": 267, "Db": 270, "Sg": 269, "Bh": 270, "Hs": 270, "Mt": 278, "Ds": 281, "Rg": 281, "Cn": 285, "Nh": 286, "Fl": 289, "Mc": 289, "Lv": 293, "Ts": 293, "Og": 294 } # return atomic weight of the element symbol passed to the function, False if element symbol does not exist return float(atomic_weight_table[element]) if element in atomic_weight_table else False def radioactive_element(element): radioactive_elements = [ "Tc", "Po", "At", "Rn", "Fr", "Ra", "Pm", "Ac", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr" ] # element is in the list of radioactive elements => True else False return element in radioactive_elements
""" ATOMIC WEIGHTS OF THE ELEMENTS (2019) from the IUPAC Commission on Isotopic Abundances and Atomic Weights Based on the following reports: - Pure Appl. Chem., 2016, 88, 265-291 (https://doi.org/10.1515/pac-2015-0305) - Chem. Eng. News, 2015, 93(37), 9 (https://doi.org/10.1021/cen-09337-notw9) - Pure Appl. Chem., 2016, 88, 139-153 (https://doi.org/10.1515/pac-2015-0502) - Pure Appl. Chem., 2016, 88, 155-160 (https://doi.org/10.1515/pac-2015-0501) - Pure Appl. Chem., 2016, 88, 1225-1229 (https://doi.org/10.1515/pac-2016-0501) - Chem. Int., 2018, 40(4), 23-24 (https://doi.org/10.1515/ci-2018-0409) - Chem. Int., 2020, 42(2), 31 (https://doi.org/10.1515/ci-2020-0222) Data taken from: https://www.qmul.ac.uk/sbcs/iupac/AtWt/ Quoted atomic weights are those suggested for materials where the origin of the sample is unknown. For radioactive elements the isotope with the longest half-life is quoted as an integer. """ def atomic_weight(element): atomic_weight_table = {'H': 1.008, 'He': 4.002602, 'Li': 6.94, 'Be': 9.0121831, 'B': 10.81, 'C': 12.011, 'N': 14.007, 'O': 15.999, 'F': 18.998403163, 'Ne': 20.1797, 'Na': 22.98976928, 'Mg': 24.305, 'Al': 26.9815384, 'Si': 28.085, 'P': 30.973761998, 'S': 32.06, 'Cl': 35.45, 'Ar': 39.948, 'K': 39.0983, 'Ca': 40.078, 'Sc': 44.955908, 'Ti': 47.867, 'V': 50.9415, 'Cr': 51.9961, 'Mn': 54.938043, 'Fe': 55.845, 'Co': 58.933194, 'Ni': 58.6934, 'Cu': 63.546, 'Zn': 65.38, 'Ga': 69.723, 'Ge': 72.63, 'As': 74.921595, 'Se': 78.971, 'Br': 79.904, 'Kr': 83.798, 'Rb': 85.4678, 'Sr': 87.62, 'Y': 88.90584, 'Zr': 91.224, 'Nb': 92.90637, 'Mo': 95.95, 'Tc': 97, 'Ru': 101.07, 'Rh': 102.90549, 'Pd': 106.42, 'Ag': 107.8682, 'Cd': 112.414, 'In': 114.818, 'Sn': 118.71, 'Sb': 121.76, 'Te': 127.6, 'I': 126.90447, 'Xe': 131.293, 'Cs': 132.90545196, 'Ba': 137.327, 'La': 138.90547, 'Ce': 140.116, 'Pr': 140.90766, 'Nd': 144.242, 'Pm': 145, 'Sm': 150.36, 'Eu': 151.964, 'Gd': 157.25, 'Tb': 158.925354, 'Dy': 162.5, 'Ho': 164.930328, 'Er': 167.259, 'Tm': 168.934218, 'Yb': 173.045, 'Lu': 174.9668, 'Hf': 178.486, 'Ta': 180.94788, 'W': 183.84, 'Re': 186.207, 'Os': 190.23, 'Ir': 192.217, 'Pt': 195.084, 'Au': 196.96657, 'Hg': 200.592, 'Tl': 204.38, 'Pb': 207.2, 'Bi': 208.9804, 'Po': 209, 'At': 210, 'Rn': 222, 'Fr': 223, 'Ra': 226, 'Ac': 227, 'Th': 232.0377, 'Pa': 231.03588, 'U': 238.02891, 'Np': 237, 'Pu': 244, 'Am': 243, 'Cm': 247, 'Bk': 247, 'Cf': 251, 'Es': 252, 'Fm': 257, 'Md': 258, 'No': 259, 'Lr': 262, 'Rf': 267, 'Db': 270, 'Sg': 269, 'Bh': 270, 'Hs': 270, 'Mt': 278, 'Ds': 281, 'Rg': 281, 'Cn': 285, 'Nh': 286, 'Fl': 289, 'Mc': 289, 'Lv': 293, 'Ts': 293, 'Og': 294} return float(atomic_weight_table[element]) if element in atomic_weight_table else False def radioactive_element(element): radioactive_elements = ['Tc', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Pm', 'Ac', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Nh', 'Fl', 'Mc', 'Lv', 'Ts', 'Og', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No', 'Lr'] return element in radioactive_elements
# -*- coding: utf-8 -*- # @Author: Nate # @Date: 2020-02-20 08:25:21 # @Last Modified by: Nate # @Last Modified time: 2021-12-12 15:54:04 path = 'V:\crawler\manga_crawler\download\cartoonmad'
path = 'V:\\crawler\\manga_crawler\\download\\cartoonmad'
'''Common restriction sites.''' fallback_enzymes = {'AflII': ('CTTAAG', (1, 5)), 'AgeI': ('ACCGGT', (1, 5)), 'BamHI': ('GGATCC', (1, 5)), 'DpnI': ('GATC', (2, 2)), 'DraI': ('TTTAAA', (3, 3)), 'EcoRI': ('GAATTC', (1, 5)), 'EcoRV': ('GATATC', (3, 3)), 'FokI': ('GGATG', (14, 18)), 'HindIII': ('AAGCTT', (1, 5)), 'NcoI': ('CCATGG', (1, 5)), 'NheI': ('GCTAGC', (1, 5)), 'NruI': ('TCGCGA', (3, 3)), 'PmeI': ('GTTTAAAC', (4, 4)), 'PstI': ('CTGCAG', (5, 1)), 'SpeI': ('ACTAGT', (1, 5)), 'XbaI': ('TCTAGA', (1, 5)), 'XhoI': ('CTCGAG', (1, 5)), 'XmaI': ('CCCGGG', (1, 5)), 'SnaBI': ('TACGTA', (3, 3)), 'AclI': ('AACGTT', (2, 3))}
"""Common restriction sites.""" fallback_enzymes = {'AflII': ('CTTAAG', (1, 5)), 'AgeI': ('ACCGGT', (1, 5)), 'BamHI': ('GGATCC', (1, 5)), 'DpnI': ('GATC', (2, 2)), 'DraI': ('TTTAAA', (3, 3)), 'EcoRI': ('GAATTC', (1, 5)), 'EcoRV': ('GATATC', (3, 3)), 'FokI': ('GGATG', (14, 18)), 'HindIII': ('AAGCTT', (1, 5)), 'NcoI': ('CCATGG', (1, 5)), 'NheI': ('GCTAGC', (1, 5)), 'NruI': ('TCGCGA', (3, 3)), 'PmeI': ('GTTTAAAC', (4, 4)), 'PstI': ('CTGCAG', (5, 1)), 'SpeI': ('ACTAGT', (1, 5)), 'XbaI': ('TCTAGA', (1, 5)), 'XhoI': ('CTCGAG', (1, 5)), 'XmaI': ('CCCGGG', (1, 5)), 'SnaBI': ('TACGTA', (3, 3)), 'AclI': ('AACGTT', (2, 3))}
def subsets(nums): res = [] dfs(nums, [], res) return res def dfs(nums, path, res): res.append(path) for i in range(len(nums)): dfs(nums[i + 1 :], path + [nums[i]], res) return res def subsets2(nums): res = [[]] for num in sorted(nums): print(res) res += [item + [num] for item in res] return res nums = [1, 2, 3] print(subsets(nums)) print(subsets2(nums))
def subsets(nums): res = [] dfs(nums, [], res) return res def dfs(nums, path, res): res.append(path) for i in range(len(nums)): dfs(nums[i + 1:], path + [nums[i]], res) return res def subsets2(nums): res = [[]] for num in sorted(nums): print(res) res += [item + [num] for item in res] return res nums = [1, 2, 3] print(subsets(nums)) print(subsets2(nums))
"""Useful utilities used internally or useful to extensions.""" def tpl_cons(hd, tl): yield hd for x in tl: yield x def contains_ellipsis(idx): if idx is Ellipsis: return True elif isinstance(idx, tuple): for item in idx: if item is Ellipsis: return True return False _py_fn_type = type(lambda x: x) # can use any function def is_py_fn(obj): return isinstance(obj, _py_fn_type) def fn_argcount(obj): return obj.func_code.co_argcount
"""Useful utilities used internally or useful to extensions.""" def tpl_cons(hd, tl): yield hd for x in tl: yield x def contains_ellipsis(idx): if idx is Ellipsis: return True elif isinstance(idx, tuple): for item in idx: if item is Ellipsis: return True return False _py_fn_type = type(lambda x: x) def is_py_fn(obj): return isinstance(obj, _py_fn_type) def fn_argcount(obj): return obj.func_code.co_argcount
soma = 0 conta = 0 c = 0 while not c == 999: c = int(input('digite um valor : [ 999 para PARAR ] :')) conta += 1 if c != 999: soma = (soma + c) print('vc digitou {} numeros e a soma entre eles e {}'.format(conta - 1, soma))
soma = 0 conta = 0 c = 0 while not c == 999: c = int(input('digite um valor : [ 999 para PARAR ] :')) conta += 1 if c != 999: soma = soma + c print('vc digitou {} numeros e a soma entre eles e {}'.format(conta - 1, soma))
# -*- encoding: utf-8 -*- # Ref: https://github.com/dissemin/wikiciteparser/blob/master/wikiciteparser/en/__init__.py """ List of citation templates which are going to be extracted """ CITATION_TEMPLATES = set([ 'citation', 'cite arxiv', 'cite av media', 'cite av media notes', 'cite book', 'cite conference', 'cite dvd notes', 'cite encyclopedia', 'cite episode', 'cite interview', 'cite journal', 'cite mailing list', 'cite map', 'cite news', 'cite newsgroup', 'cite podcast', 'cite press release', 'cite report', 'cite serial', 'cite sign', 'cite speech', 'cite techreport', 'cite thesis', 'cite web' ])
""" List of citation templates which are going to be extracted """ citation_templates = set(['citation', 'cite arxiv', 'cite av media', 'cite av media notes', 'cite book', 'cite conference', 'cite dvd notes', 'cite encyclopedia', 'cite episode', 'cite interview', 'cite journal', 'cite mailing list', 'cite map', 'cite news', 'cite newsgroup', 'cite podcast', 'cite press release', 'cite report', 'cite serial', 'cite sign', 'cite speech', 'cite techreport', 'cite thesis', 'cite web'])
def logging_detector(funct): def wrapper(*args, **kwargs): print(f'The function called was {funct.__name__}') print('Arguments passed:') for arg in args: print(arg) print(funct(*args)) return wrapper @logging_detector def homer(name, day, rating): return 'HOMER' @logging_detector def tempo(song, singer, bpm): return 'Rock it up!' homer('sam', 'bad', 'worst') tempo('Yo', 'Bonny', 125)
def logging_detector(funct): def wrapper(*args, **kwargs): print(f'The function called was {funct.__name__}') print('Arguments passed:') for arg in args: print(arg) print(funct(*args)) return wrapper @logging_detector def homer(name, day, rating): return 'HOMER' @logging_detector def tempo(song, singer, bpm): return 'Rock it up!' homer('sam', 'bad', 'worst') tempo('Yo', 'Bonny', 125)
"""Manages print format for GOEA results.""" __copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" # import collections as cx class PrtFmt(object): """Manages print format for GOEA results.""" # Default Excel table column widths for GOEA results default_fld2col_widths = { 'NS' : 3, 'GO' : 12, 'alt' : 2, 'level' : 3, 'depth' : 3, 'enrichment': 1, 'name' : 60, 'ratio_in_study': 8, 'ratio_in_pop' : 12, 'study_items' : 15, } default_fld2fmt = { 'NS' : '{NS}', 'GO' : '{GO}', 'alt' : '{alt:1}', 'level' : 'L{level:02}', 'depth' : 'D{depth:02}', 'reldepth' : 'D{reldepth:02}', 'dcnt' : '{dcnt:5}', 'tcnt' : '{tcnt:7,}', 'tfreq' : '{tfreq:8.6f}', 'tinfo' : '{tinfo:5.2f}', 'enrichment': '{enrichment:1}', 'name' : '{name:40}', 'ratio_in_study': '{ratio_in_study:>7}', 'ratio_in_pop' : '{ratio_in_pop:>11}', 'study_count' : '{study_count:4}', 'study_items' : '{study_items}', } prtfmt_dflt = ("{GO} {NS} {p_uncorrected:5.2e} {ratio_in_study:>6} {ratio_in_pop:>9} " "{depth:02} {name:40} {study_items}\n") def __init__(self): pass def get_prtfmt_str(self, flds, add_nl=True): fmts = self.get_prtfmt_list(flds, add_nl) return " ".join(fmts) def get_prtfmt_list(self, flds, add_nl=True): """Get print format, given fields.""" fmts = [] for fld in flds: if fld[:2] == 'p_': fmts.append('{{{FLD}:8.2e}}'.format(FLD=fld)) elif fld in self.default_fld2fmt: fmts.append(self.default_fld2fmt[fld]) else: raise Exception("UNKNOWN FORMAT: {FLD}".format(FLD=fld)) if add_nl: fmts.append("\n") return fmts @staticmethod def adjust_prtfmt(prtfmt): """Adjust format_strings for legal values.""" prtfmt = prtfmt.replace("{p_holm-sidak", "{p_holm_sidak") prtfmt = prtfmt.replace("{p_simes-hochberg", "{p_simes_hochberg") return prtfmt # Copyright (C) 2016-2018, DV Klopfenstein, H Tang, All rights reserved.
"""Manages print format for GOEA results.""" __copyright__ = 'Copyright (C) 2016-2018, DV Klopfenstein, H Tang, All rights reserved.' __author__ = 'DV Klopfenstein' class Prtfmt(object): """Manages print format for GOEA results.""" default_fld2col_widths = {'NS': 3, 'GO': 12, 'alt': 2, 'level': 3, 'depth': 3, 'enrichment': 1, 'name': 60, 'ratio_in_study': 8, 'ratio_in_pop': 12, 'study_items': 15} default_fld2fmt = {'NS': '{NS}', 'GO': '{GO}', 'alt': '{alt:1}', 'level': 'L{level:02}', 'depth': 'D{depth:02}', 'reldepth': 'D{reldepth:02}', 'dcnt': '{dcnt:5}', 'tcnt': '{tcnt:7,}', 'tfreq': '{tfreq:8.6f}', 'tinfo': '{tinfo:5.2f}', 'enrichment': '{enrichment:1}', 'name': '{name:40}', 'ratio_in_study': '{ratio_in_study:>7}', 'ratio_in_pop': '{ratio_in_pop:>11}', 'study_count': '{study_count:4}', 'study_items': '{study_items}'} prtfmt_dflt = '{GO} {NS} {p_uncorrected:5.2e} {ratio_in_study:>6} {ratio_in_pop:>9} {depth:02} {name:40} {study_items}\n' def __init__(self): pass def get_prtfmt_str(self, flds, add_nl=True): fmts = self.get_prtfmt_list(flds, add_nl) return ' '.join(fmts) def get_prtfmt_list(self, flds, add_nl=True): """Get print format, given fields.""" fmts = [] for fld in flds: if fld[:2] == 'p_': fmts.append('{{{FLD}:8.2e}}'.format(FLD=fld)) elif fld in self.default_fld2fmt: fmts.append(self.default_fld2fmt[fld]) else: raise exception('UNKNOWN FORMAT: {FLD}'.format(FLD=fld)) if add_nl: fmts.append('\n') return fmts @staticmethod def adjust_prtfmt(prtfmt): """Adjust format_strings for legal values.""" prtfmt = prtfmt.replace('{p_holm-sidak', '{p_holm_sidak') prtfmt = prtfmt.replace('{p_simes-hochberg', '{p_simes_hochberg') return prtfmt
class Solution: def getModifiedArray(self, length, updates): """ :type length: int :type updates: List[List[int]] :rtype: List[int] """ result=[0] * length for operation in updates: result[operation[0]] = result[operation[0]] + operation[2] if operation[1] < length - 1: result[operation[1] + 1] = result[operation[1] + 1] - operation[2] tem = 0 for index in range(length): tem = tem + result[index] result[index] = tem return result
class Solution: def get_modified_array(self, length, updates): """ :type length: int :type updates: List[List[int]] :rtype: List[int] """ result = [0] * length for operation in updates: result[operation[0]] = result[operation[0]] + operation[2] if operation[1] < length - 1: result[operation[1] + 1] = result[operation[1] + 1] - operation[2] tem = 0 for index in range(length): tem = tem + result[index] result[index] = tem return result
real_number = {chr(el) for el in range(ord('0'), ord('9') + 1)} real_number.update(['.', ',']) required_real_number = {'.'} def real_number_is_valid(number): real_number_as_set = set(number) if not number or real_number_as_set - real_number or required_real_number - real_number_as_set: return False number_chunks = number.split('.') if len(number_chunks) < 1 or len(number_chunks[-1]) < 1: return False return True assert real_number_is_valid('1.32') assert not real_number_is_valid('1,32')
real_number = {chr(el) for el in range(ord('0'), ord('9') + 1)} real_number.update(['.', ',']) required_real_number = {'.'} def real_number_is_valid(number): real_number_as_set = set(number) if not number or real_number_as_set - real_number or required_real_number - real_number_as_set: return False number_chunks = number.split('.') if len(number_chunks) < 1 or len(number_chunks[-1]) < 1: return False return True assert real_number_is_valid('1.32') assert not real_number_is_valid('1,32')
#!/usr/bin/env python """ File name: test_CTCI_Ch4_Ex5.py Author: Matt Randazzo Date created: 2/18/2019 Date last modified: 2/18/2019 Python Version: 3.7 Description: CTCI 4.5 Validate BST Implement a function to check if a binary tree is a binary search tree Classes: Functions: is_bst is_bst_helper """ def is_bst(root): """Determine if binary tree is a binary search tree :param root Root of binary tree :return True if binary tree is a binary search tree """ def is_bst_helper(root, min, max): """Helper function to determine if binary tree is a BST :param root Root of binary tree :param min Minimum value for root node :param max Maximum value for root node :return True if root has BST properties """ if root is None: return True if max is not None and root.data > max: return False if min is not None and root.data <= min: return False left = is_bst_helper(root.left, min, root.data) right = is_bst_helper(root.right, root.data, max) return left and right # Empty Tree if root is None: return else: return is_bst_helper(root, None, None)
""" File name: test_CTCI_Ch4_Ex5.py Author: Matt Randazzo Date created: 2/18/2019 Date last modified: 2/18/2019 Python Version: 3.7 Description: CTCI 4.5 Validate BST Implement a function to check if a binary tree is a binary search tree Classes: Functions: is_bst is_bst_helper """ def is_bst(root): """Determine if binary tree is a binary search tree :param root Root of binary tree :return True if binary tree is a binary search tree """ def is_bst_helper(root, min, max): """Helper function to determine if binary tree is a BST :param root Root of binary tree :param min Minimum value for root node :param max Maximum value for root node :return True if root has BST properties """ if root is None: return True if max is not None and root.data > max: return False if min is not None and root.data <= min: return False left = is_bst_helper(root.left, min, root.data) right = is_bst_helper(root.right, root.data, max) return left and right if root is None: return else: return is_bst_helper(root, None, None)
""" A collection of Bootstrap static files. """ __author__ = 'Peter Bittner' __email__ = 'django@bittner.it' __license__ = 'MIT' __url__ = 'https://github.com/bittner/django-bootstrap-static' __version__ = '5.0.0-beta1'
""" A collection of Bootstrap static files. """ __author__ = 'Peter Bittner' __email__ = 'django@bittner.it' __license__ = 'MIT' __url__ = 'https://github.com/bittner/django-bootstrap-static' __version__ = '5.0.0-beta1'
''' Problem: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists, and should also be sorted. For example, given following linked lists : 5 -> 8 -> 20 4 -> 11 -> 15 The merged list should be : 4 -> 5 -> 8 -> 11 -> 15 -> 20 ''' # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # @param A : head node of linked list # @param B : head node of linked list # @return the head node in the linked list def mergeTwoLists(self, A, B): ans = ListNode(0) curr = ans first = A second = B while first is not None and second is not None: if first.val <= second.val: nodeToAdd = ListNode(first.val) curr.next = nodeToAdd curr = curr.next first = first.next else: nodeToAdd = ListNode(second.val) curr.next = nodeToAdd curr = curr.next second = second.next while first is not None: nodeToAdd = ListNode(first.val) curr.next = nodeToAdd curr = curr.next first = first.next while second is not None: nodeToAdd = ListNode(second.val) curr.next = nodeToAdd curr = curr.next second = second.next return ans.next
""" Problem: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists, and should also be sorted. For example, given following linked lists : 5 -> 8 -> 20 4 -> 11 -> 15 The merged list should be : 4 -> 5 -> 8 -> 11 -> 15 -> 20 """ class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def merge_two_lists(self, A, B): ans = list_node(0) curr = ans first = A second = B while first is not None and second is not None: if first.val <= second.val: node_to_add = list_node(first.val) curr.next = nodeToAdd curr = curr.next first = first.next else: node_to_add = list_node(second.val) curr.next = nodeToAdd curr = curr.next second = second.next while first is not None: node_to_add = list_node(first.val) curr.next = nodeToAdd curr = curr.next first = first.next while second is not None: node_to_add = list_node(second.val) curr.next = nodeToAdd curr = curr.next second = second.next return ans.next
""" 0426. Convert Binary Search Tree to Sorted Doubly Linked List Medium Convert a Binary Search Tree to a sorted Circular Doubly-Linked List in place. You can think of the left and right pointers as synonymous to the predecessor and successor pointers in a doubly-linked list. For a circular doubly linked list, the predecessor of the first element is the last element, and the successor of the last element is the first element. We want to do the transformation in place. After the transformation, the left pointer of the tree node should point to its predecessor, and the right pointer should point to its successor. You should return the pointer to the smallest element of the linked list. Example 1: Input: root = [4,2,5,1,3] Output: [1,2,3,4,5] Explanation: The figure below shows the transformed BST. The solid line indicates the successor relationship, while the dashed line means the predecessor relationship. Example 2: Input: root = [2,1,3] Output: [1,2,3] Example 3: Input: root = [] Output: [] Explanation: Input is an empty tree. Output is also an empty Linked List. Example 4: Input: root = [1] Output: [1] Constraints: -1000 <= Node.val <= 1000 Node.left.val < Node.val < Node.right.val All values of Node.val are unique. 0 <= Number of Nodes <= 2000 """ """ # Definition for a Node. class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right """ class Solution: def treeToDoublyList(self, root: 'Node') -> 'Node': if not root: return # dummy = Node(0, None, None) dummy = Node(0, None) prev = dummy stack, node = [], root while stack or node: while node: stack.append(node) node = node.left node = stack.pop() node.left, prev.right, prev = prev, node, node node = node.right dummy.right.left, prev.right = prev, dummy.right return dummy.right
""" 0426. Convert Binary Search Tree to Sorted Doubly Linked List Medium Convert a Binary Search Tree to a sorted Circular Doubly-Linked List in place. You can think of the left and right pointers as synonymous to the predecessor and successor pointers in a doubly-linked list. For a circular doubly linked list, the predecessor of the first element is the last element, and the successor of the last element is the first element. We want to do the transformation in place. After the transformation, the left pointer of the tree node should point to its predecessor, and the right pointer should point to its successor. You should return the pointer to the smallest element of the linked list. Example 1: Input: root = [4,2,5,1,3] Output: [1,2,3,4,5] Explanation: The figure below shows the transformed BST. The solid line indicates the successor relationship, while the dashed line means the predecessor relationship. Example 2: Input: root = [2,1,3] Output: [1,2,3] Example 3: Input: root = [] Output: [] Explanation: Input is an empty tree. Output is also an empty Linked List. Example 4: Input: root = [1] Output: [1] Constraints: -1000 <= Node.val <= 1000 Node.left.val < Node.val < Node.right.val All values of Node.val are unique. 0 <= Number of Nodes <= 2000 """ '\n# Definition for a Node.\nclass Node:\n def __init__(self, val, left=None, right=None):\n self.val = val\n self.left = left\n self.right = right\n' class Solution: def tree_to_doubly_list(self, root: 'Node') -> 'Node': if not root: return dummy = node(0, None) prev = dummy (stack, node) = ([], root) while stack or node: while node: stack.append(node) node = node.left node = stack.pop() (node.left, prev.right, prev) = (prev, node, node) node = node.right (dummy.right.left, prev.right) = (prev, dummy.right) return dummy.right
# # @lc app=leetcode id=367 lang=python3 # # [367] Valid Perfect Square # # @lc code=start class Solution: def isPerfectSquare(self, num): cur = 1 while True: multi = cur * cur if multi > num: return False if multi == num: return True cur += 1 # @lc code=end
class Solution: def is_perfect_square(self, num): cur = 1 while True: multi = cur * cur if multi > num: return False if multi == num: return True cur += 1
# Convert Integer to the Sum of Two No-Zero Integers # # Source - https://leetcode.com/problems/convert-integer-to-the-sum-of-two-no-zero-integers/ class Solution: def getNoZeroIntegers(self, n): for a in range(n): if '0' not in f'{a}{n - a}': return [a, n - a] s = Solution().getNoZeroIntegers(11) print(s) # class Solution: # def getNoZeroIntegers(self, n: int) -> List[int]: # def recursive(n, count=1): # if '0' not in str(n) and '0' not in str(count): # return n # n -= 1 # count += 1 # return recursive(n, count) # # num = recursive(n - 1) # return [n - num, num]
class Solution: def get_no_zero_integers(self, n): for a in range(n): if '0' not in f'{a}{n - a}': return [a, n - a] s = solution().getNoZeroIntegers(11) print(s)
#class Solution: # def chalkReplacer(self, chalk: List[int], k: int) -> int: def chalkReplacer(chalk, k): # loop thru the list `chalk` one time first, # to know its sum. somme = 0 for i, n_i in enumerate(chalk): k -= n_i if k < 0: return i somme += n_i k %= somme # k < somme for sure now. for i, n_i in enumerate(chalk): k -= n_i if k < 0: return i def test(chalk, k, expected): sol = chalkReplacer(chalk, k) if sol == expected: print("Congratulations!") else: print(f"sol = {sol}") print(f"expected = {expected}") print() if __name__ == "__main__": test_id = 0 test_id += 1 print(f"testcase {test_id}") chalk = [5,1,5] k = 22 expected = 0 test(chalk, k, expected) test_id += 1 print(f"testcase {test_id}") chalk = [3,4,1,2] k = 25 expected = 1 test(chalk, k, expected)
def chalk_replacer(chalk, k): somme = 0 for (i, n_i) in enumerate(chalk): k -= n_i if k < 0: return i somme += n_i k %= somme for (i, n_i) in enumerate(chalk): k -= n_i if k < 0: return i def test(chalk, k, expected): sol = chalk_replacer(chalk, k) if sol == expected: print('Congratulations!') else: print(f'sol = {sol}') print(f'expected = {expected}') print() if __name__ == '__main__': test_id = 0 test_id += 1 print(f'testcase {test_id}') chalk = [5, 1, 5] k = 22 expected = 0 test(chalk, k, expected) test_id += 1 print(f'testcase {test_id}') chalk = [3, 4, 1, 2] k = 25 expected = 1 test(chalk, k, expected)
# Copyright The OpenTelemetry Authors # # 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. """ The **OpenTelemetry Collector Exporter** allows to export OpenTelemetry traces to OpenTelemetry Collector. .. code:: python from opentelemetry import trace from opentelemetry.ext.otcollector.trace_exporter import CollectorSpanExporter from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchExportSpanProcessor # create a CollectorSpanExporter collector_exporter = CollectorSpanExporter( # optional: # endpoint="myCollectorUrl:55678", # service_name="test_service", # host_name="machine/container name", ) # Create a BatchExportSpanProcessor and add the exporter to it span_processor = BatchExportSpanProcessor(collector_exporter) # Configure the tracer to use the collector exporter tracer_provider = TracerProvider() tracer_provider.add_span_processor(span_processor) tracer = TracerProvider().get_tracer(__name__) with tracer.start_as_current_span("foo"): print("Hello world!") Metrics Usage ------------- The **OpenTelemetry Collector Exporter** allows to export OpenTelemetry metrics to OpenTelemetry Collector. .. code:: python from opentelemetry import metrics from opentelemetry.ext.otcollector.metrics_exporter import CollectorMetricsExporter from opentelemetry.sdk.metrics import Counter, MeterProvider from opentelemetry.sdk.metrics.export.controller import PushController # create a CollectorMetricsExporter collector_exporter = CollectorMetricsExporter( # optional: # endpoint="myCollectorUrl:55678", # service_name="test_service", # host_name="machine/container name", ) # Meter is responsible for creating and recording metrics metrics.set_meter_provider(MeterProvider()) meter = metrics.get_meter(__name__) # controller collects metrics created from meter and exports it via the # exporter every interval controller = PushController(meter, collector_exporter, 5) counter = meter.create_metric( "requests", "number of requests", "requests", int, Counter, ("environment",), ) # Labels are used to identify key-values that are associated with a specific # metric that you want to record. These are useful for pre-aggregation and can # be used to store custom dimensions pertaining to a metric labels = {"environment": "staging"} counter.add(25, labels) """
""" The **OpenTelemetry Collector Exporter** allows to export OpenTelemetry traces to OpenTelemetry Collector. .. code:: python from opentelemetry import trace from opentelemetry.ext.otcollector.trace_exporter import CollectorSpanExporter from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchExportSpanProcessor # create a CollectorSpanExporter collector_exporter = CollectorSpanExporter( # optional: # endpoint="myCollectorUrl:55678", # service_name="test_service", # host_name="machine/container name", ) # Create a BatchExportSpanProcessor and add the exporter to it span_processor = BatchExportSpanProcessor(collector_exporter) # Configure the tracer to use the collector exporter tracer_provider = TracerProvider() tracer_provider.add_span_processor(span_processor) tracer = TracerProvider().get_tracer(__name__) with tracer.start_as_current_span("foo"): print("Hello world!") Metrics Usage ------------- The **OpenTelemetry Collector Exporter** allows to export OpenTelemetry metrics to OpenTelemetry Collector. .. code:: python from opentelemetry import metrics from opentelemetry.ext.otcollector.metrics_exporter import CollectorMetricsExporter from opentelemetry.sdk.metrics import Counter, MeterProvider from opentelemetry.sdk.metrics.export.controller import PushController # create a CollectorMetricsExporter collector_exporter = CollectorMetricsExporter( # optional: # endpoint="myCollectorUrl:55678", # service_name="test_service", # host_name="machine/container name", ) # Meter is responsible for creating and recording metrics metrics.set_meter_provider(MeterProvider()) meter = metrics.get_meter(__name__) # controller collects metrics created from meter and exports it via the # exporter every interval controller = PushController(meter, collector_exporter, 5) counter = meter.create_metric( "requests", "number of requests", "requests", int, Counter, ("environment",), ) # Labels are used to identify key-values that are associated with a specific # metric that you want to record. These are useful for pre-aggregation and can # be used to store custom dimensions pertaining to a metric labels = {"environment": "staging"} counter.add(25, labels) """
ENTRY_POINT = 'match_parens' FIX = """ Fix the bug of in solution which considers )( )( as valid. Add test case for above. """ #[PROMPT] def match_parens(lst): ''' You are given a list of two strings, both strings consist of open parentheses '(' or close parentheses ')' only. Your job is to check if it is possible to concatenate the two strings in some order, that the resulting string will be good. A string S is considered to be good if and only if all parentheses in S are balanced. For example: the string '(())()' is good, while the string '())' is not. Return 'Yes' if there's a way to make a good string, and return 'No' otherwise. Examples: match_parens(['()(', ')']) == 'Yes' match_parens([')', ')']) == 'No' ''' #[SOLUTION] def check(s): val = 0 for i in s: if i == '(': val = val + 1 else: val = val - 1 if val < 0: return False return True if val == 0 else False S1 = lst[0] + lst[1] S2 = lst[1] + lst[0] return 'Yes' if check(S1) or check(S2) else 'No' #[CHECK] def check(candidate): # Check some simple cases assert candidate(['()(', ')']) == 'Yes' assert candidate([')', ')']) == 'No' assert candidate(['(()(())', '())())']) == 'No' assert candidate([')())', '(()()(']) == 'Yes' assert candidate(['(())))', '(()())((']) == 'Yes' assert candidate(['()', '())']) == 'No' assert candidate(['(()(', '()))()']) == 'Yes' assert candidate(['((((', '((())']) == 'No' assert candidate([')(()', '(()(']) == 'No' assert candidate([')(', ')(']) == 'No' # Check some edge cases that are easy to work out by hand. assert candidate(['(', ')']) == 'Yes' assert candidate([')', '(']) == 'Yes'
entry_point = 'match_parens' fix = '\nFix the bug of in solution which considers )( )( as valid.\nAdd test case for above.\n' def match_parens(lst): """ You are given a list of two strings, both strings consist of open parentheses '(' or close parentheses ')' only. Your job is to check if it is possible to concatenate the two strings in some order, that the resulting string will be good. A string S is considered to be good if and only if all parentheses in S are balanced. For example: the string '(())()' is good, while the string '())' is not. Return 'Yes' if there's a way to make a good string, and return 'No' otherwise. Examples: match_parens(['()(', ')']) == 'Yes' match_parens([')', ')']) == 'No' """ def check(s): val = 0 for i in s: if i == '(': val = val + 1 else: val = val - 1 if val < 0: return False return True if val == 0 else False s1 = lst[0] + lst[1] s2 = lst[1] + lst[0] return 'Yes' if check(S1) or check(S2) else 'No' def check(candidate): assert candidate(['()(', ')']) == 'Yes' assert candidate([')', ')']) == 'No' assert candidate(['(()(())', '())())']) == 'No' assert candidate([')())', '(()()(']) == 'Yes' assert candidate(['(())))', '(()())((']) == 'Yes' assert candidate(['()', '())']) == 'No' assert candidate(['(()(', '()))()']) == 'Yes' assert candidate(['((((', '((())']) == 'No' assert candidate([')(()', '(()(']) == 'No' assert candidate([')(', ')(']) == 'No' assert candidate(['(', ')']) == 'Yes' assert candidate([')', '(']) == 'Yes'