content
stringlengths
7
1.05M
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def menu(food, **meal): print(f"Food: {food}") for meal, name in meal.items(): print(f"{name}") if __name__ == '__main__': menu( "Прием пищи", breakfast="Блинчики с творогом", dinner="Суп с грибами", supper="Рыба с овощами" ) menu( "Прием пищи", breakfast="Овсяная каша" )
# define a function that display the output heading def output_heading(): print('Programmer: Emily') print('Course: COSC146') print('Lab#: 0') print('Due Date: 02-19-2019') #define a function that takes a number and returns that number + 10 def plus10(value): value = value + 10 return value #call function print_heading output_heading() #call function plus10 print(plus10(1000)) # define a function that takes in two parameters and return their sum def sumoftwo(x, y): return x + y print(sumoftwo(5,10)) print(sumoftwo('lil','phil'))
class Codec: url_list = [] def encode(self, longUrl): self.url_list.append(longUrl) return len(self.url_list) - 1 def decode(self, shortUrl): return self.url_list[shortUrl] if __name__ == '__main__': codec = Codec() print(codec.decode(codec.encode('xxxxx'))) print(codec.url_list)
class BaseEndpoint(): def __repr__(self): return f'<metrics.tools Endpoint [{self.endpoint}]>' if __name__ == '__main__': pass
""" Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str. Example: Input: pattern = "abba", str = "dog cat cat dog" Output: true Example: Input:pattern = "abba", str = "dog cat cat fish" Output: false Example: Input: pattern = "aaaa", str = "dog cat cat dog" Output: false Example: Input: pattern = "abba", str = "dog dog dog dog" Output: false Notes: - You may assume pattern contains only lowercase letters, and str contains lowercase letters that may be separated by a single space. """ #Difficulty: Easy #37 / 37 test cases passed. #Runtime: 28 ms #Memory Usage: 13.7 MB #Runtime: 28 ms, faster than 82.00% of Python3 online submissions for Word Pattern. #Memory Usage: 13.7 MB, less than 84.35% of Python3 online submissions for Word Pattern. class Solution: def wordPattern(self, pattern: str, string: str) -> bool: pairs = {} pattern = list(pattern) string = string.split(' ') if len(pattern) != len(string): return False for i, p in enumerate(pattern): if p not in pairs and string[i] not in pairs.values(): pairs[p] = string[i] else: if p not in pairs or pairs[p] != string[i]: return False return True
tupla = ('un','deux','trois','quatre','cinq') n = int(input('Choisissez un chiffres de 1 à 5: ')) while n < 1 or n > 5: n = int(input('Réponse invalide. Choisissez un chiffres de 1 à 5: ')) print('Vouz avez choisi le chiffres',tupla[n-1])
s = input() start = s.find('A') stop = s.rfind('Z') print(stop - start + 1)
# ~autogen spec_version spec_version = "spec: 0.9.3-pre-r2, kernel: v3.16.7-ckt16-7-ev3dev-ev3" # ~autogen
def sol(): N = int(input()) string = input() count = 0 while N > 0: count += int(string[N - 1]) N -= 1 print(count) if __name__ == "__main__": sol()
# list a = 'orange' print(a[::-1]) print(a[1:4:2]) b = [1,2,3,34,5, 1] print(b.count(1))
N = int(input()) A, B = map(int, input().split()) counts = [0, 0, 0] P = map(int, input().split()) for p in P: if p <= A: counts[0] += 1 elif p <= B: counts[1] += 1 else: counts[2] += 1 print(min(counts))
#!/bin/python3 print("Status: 200") print("Content-Type: text/plain") print() print("Hello World!")
color = { "black":(0, 0, 0, 255), "white":(255, 255, 255, 255), "red":(255, 0, 0, 255), "green":(0, 255, 0, 255), "blue":(0, 0, 255, 255), "yellow":(255, 255, 0, 255), "cyan":(0, 255, 255, 255), "magenta":(255, 0, 255, 255), "silver":(192, 192, 192, 255), "gray":(128, 128, 128, 255), "maroon":(128, 0, 0, 255), "olive":(128, 128, 0, 255), "darkgreen":(0, 128, 0, 255), "purple":(128, 0, 128, 255), "teal":(0, 0, 128, 255), "orange":(255, 165, 0, 255), "turquoise":(64, 224, 208, 255), "sky":(135, 206, 250, 255), "pink":(255, 192, 203, 255), "brown":(139, 69, 19, 255), "lightgray":(180, 180, 180, 255), "lightgrey":(180, 180, 180, 255) }
_base_ = [ '../_base_/models/fast_scnn.py', '../_base_/datasets/pascal_escroom.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' ] # Re-config the data sampler. data = dict(samples_per_gpu=2, workers_per_gpu=4) # Re-config the optimizer. optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-5) # runtime settings checkpoint_config = dict(by_epoch=False, interval=8000) evaluation = dict(interval=8000, metric='mIoU')
NBA_GAME_TIME = 48 def nba_extrap(points_per_game: float, minutes_per_game: float) -> float: if minutes_per_game < 0.001: return 0.0 else: return round(points_per_game/minutes_per_game * NBA_GAME_TIME, 1)
''' num = int(input('Digite um valor: ')) listaNum = [num] print('Adicionado na posição 0 da lista...') for cont in range(1, 5): num = int(input('Digite um valor: ')) if num <= min(listaNum): listaNum.insert(0, num) print('Adicionado na posição 0 da lista...') elif num >= max(listaNum): listaNum.append(num) print('Valor adicionado ao final da lista...') elif min(listaNum) < num < max(listaNum): for i in range(0, 3): if listaNum[i] < num <= listaNum[i+1]: listaNum.insert(i+1, num) print(f'Valor adicionado a posição {i+1} da lista') print('-=-'*20) print(f'Os valores digitados foram {listaNum}') ''' #Curso em Video lista = [] for c in range(0, 5): n = int(input('Digite um valor: ')) if c == 0 or n > lista[-1]: lista.append(n) print('Adicionado ao final da lista...') else: pos = 0 while pos < len(lista): if n <= lista[pos]: lista.insert(pos, n) print(f'Adicionado a posição {pos} da lista...') break pos += 1 print('-='*30) print(f'Os valors digitados em ordem foram {lista}')
#!/usr/bin/python3 class Humano: # atributo de classe especie = 'Homo Sapiens' def __init__(self, nome): self.nome = nome def das_cavernas(self): self.especie = 'Homo Neanderthalensis' return self if __name__ == '__main__': jose = Humano('José') grokn = Humano('Grokn').das_cavernas() print(f'Humano.espcie: {Humano.especie}') print(f'jose.especie: {jose.especie}') print(f'grokn.especie: {grokn.especie}')
#!/usr/bin/env python3 # Common physical "constants" # Universal gas constant (J/K/mol) R_gas = 8.3144598 # "Standard gravity": rate of gravitational acceleration at Earth's surface (m/s2) g0 = 9.80665 # Avogadro's number (molec/mol) avog = 6.022140857e23 # Molar mass of dry air (g/mol) MW_air = 28.97 # Radius of Earth (m) R_earth = 6.375e6
# Write programs that read a sequence of integer inputs and print # a.  The smallest and largest of the inputs. # b.  The number of even and odd inputs. # c.  Cumulative totals. For example, if the input is 1 7 2 9, the program should print # 1 8 10 19. # d.  All adjacent duplicates. For example, if the input is 1 3 3 4 5 5 6 6 6 2, the # program should print 3 5 6. numEven = 0 numOdd = 0 stop = False while not stop: inputN = str(input("Enter a number:(Stop/stop to stop): ")) if inputN == "Stop" or inputN == "stop": stop = True elif inputN.isdigit(): inputN = int(inputN) if inputN % 2 == 0: numEven += 1 else: numOdd += 1 print("Number of even numbers:", numEven) print("Number of odd numbers:", numOdd)
def check_palindrome(str): return str == str[::-1] print(check_palindrome('palpa')) print(check_palindrome('radar'))
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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. # # NOTE: This class is auto generated by the jdcloud code generator program. class OutFile(object): def __init__(self, filePath=None): """ :param filePath: (Optional) 输出文件路径。 路径支持占位符 YEAR、MONTH、DAY、JOBID、TASKID、TEMPLATEID, VIDEOID,但对于转码输出路径,必须以 vod/product 为路径前缀。 最终生成的转码输出文件,将会是此路径和一个随机文件名共同构成。 若转码模板中该字段配置为:vod/product/{YEAR}{MONTH}{DAY}/{JOBID}/{TEMPLATEID}/{TASKID} 则最终生成的输出文件可能为:vod/product/20200921/8238/2243310/2378041/6b91f559d51b4b62ac60b98c318e9ae9.mp4 """ self.filePath = filePath
# Copyright 2017 The Forseti Security Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test data for Cloud Resource Manager GCP api responses.""" FAKE_PROJECT_NUMBER = "1111111" FAKE_PROJECT_ID = "forseti-system-test" FAKE_ORG_ID = "2222222" FAKE_FOLDER_ID = "3333333" GET_PROJECT_RESPONSE = """ { "projectNumber": "1111111", "projectId": "forseti-system-test", "lifecycleState": "ACTIVE", "name": "Forseti Security Tests", "createTime": "2017-07-12T17:50:40.895Z", "parent": { "type": "organization", "id": "2222222" } } """ GET_PROJECT_ANCESTRY_RESPONSE = """ { "ancestor": [ { "resourceId": { "type": "project", "id": "forseti-system-test" } }, { "resourceId": { "type": "folder", "id": "3333333" } }, { "resourceId": { "type": "organization", "id": "2222222" } } ] } """ EXPECTED_PROJECT_ANCESTRY_IDS = ["forseti-system-test", "3333333", "2222222"] GET_IAM_POLICY = """ { "version": 1, "etag": "BwVVEmTu/ww=", "bindings": [ { "role": "roles/editor", "members": [ "serviceAccount:1111111-compute@developer.gserviceaccount.com", "serviceAccount:1111111@cloudservices.gserviceaccount.com" ] }, { "role": "roles/owner", "members": [ "group:test@forsetisecurity.testing", "user:testuser@forsetisecurity.testing" ] } ] } """ SEARCH_ORGANIZATIONS_PAGE1 = """ { "organizations": [ { "displayName": "foresti.testing", "owner": { "directoryCustomerId": "ABC123DEF" }, "creationTime": "2015-09-09T19:34:18.591Z", "lifecycleState": "ACTIVE", "name": "organizations/2222222" } ], "nextPageToken": "123" } """ SEARCH_ORGANIZATIONS_PAGE2 = """ { "organizations": [ { "displayName": "test.foresti.testing", "owner": { "directoryCustomerId": "FED987CBA" }, "creationTime": "2016-01-09T09:30:28.001Z", "lifecycleState": "ACTIVE", "name": "organizations/4444444" } ] } """ SEARCH_ORGANIZATIONS = [SEARCH_ORGANIZATIONS_PAGE1, SEARCH_ORGANIZATIONS_PAGE2] EXPECTED_ORGANIZATIONS_FROM_SEARCH = ["organizations/2222222", "organizations/4444444"] GET_ORGANIZATION = """ { "displayName": "forsetisecurity.testing", "owner": { "directoryCustomerId": "ABC123DEF" }, "creationTime": "2015-09-09T19:34:18.591Z", "lifecycleState": "ACTIVE", "name": "organizations/2222222" } """ GET_FOLDER = """ { "name": "folders/3333333", "parent": "organizations/2222222", "displayName": "folder-forseti-test", "lifecycleState": "ACTIVE", "createTime": "2017-02-09T22:02:07.769Z" } """ GET_ORG_POLICY_NO_POLICY = """ { "constraint": "constraints/compute.disableSerialPortAccess", "etag": "BwVUSr8Q7Ng=" } """ GET_EFFECTIVE_ORG_POLICY = """ { "constraint": "constraints/compute.disableSerialPortAccess", "booleanPolicy": { "enforced": true } } """ GET_LIENS = """ { "liens": [ { "name": "liens/test-lien1", "parent": "projects/forseti-system-test", "restrictions": [ "resourcemanager.projects.delete" ], "origin": "testing", "createTime": "2018-09-05T14:45:46.534Z" } ] } """ EXPECTED_LIENS = [{ "name": "liens/test-lien1", "parent": "projects/forseti-system-test", "restrictions": [ "resourcemanager.projects.delete" ], "origin": "testing", "createTime": "2018-09-05T14:45:46.534Z" }] LIST_ORG_POLICIES = """ { "policies": [ { "constraint": "constraints/compute.disableSerialPortAccess", "booleanPolicy": { "enforced": true } } ] } """ TEST_ORG_POLICY_CONSTRAINT = "constraints/compute.disableSerialPortAccess" FAKE_FOLDERS_API_RESPONSE1 = { 'folders': [ { 'displayName': 'folder-1', 'name': 'folders/111', 'lifecycleState': 'ACTIVE', 'parent': 'organizations/9999' }, { 'displayName': 'folder-2', 'name': 'folders/222', 'parent': 'folders/2222222', 'lifecycleState': 'DELETE_REQUESTED' }, { 'displayName': 'folder-3', 'name': 'folders/333', 'parent': 'folders/3333333', 'lifecycleState': 'ACTIVE' }, ] } EXPECTED_FAKE_FOLDERS1 = FAKE_FOLDERS_API_RESPONSE1['folders'] FAKE_FOLDERS_LIST_API_RESPONSE1 = { 'folders': [ f for f in FAKE_FOLDERS_API_RESPONSE1['folders'] if f['parent'] == 'organizations/9999' ] } EXPECTED_FAKE_FOLDERS_LIST1 = FAKE_FOLDERS_LIST_API_RESPONSE1['folders'] FAKE_ACTIVE_FOLDERS_API_RESPONSE1 = { 'folders': [ f for f in FAKE_FOLDERS_API_RESPONSE1['folders'] if f['lifecycleState'] == 'ACTIVE' ] } EXPECTED_FAKE_ACTIVE_FOLDERS1 = FAKE_ACTIVE_FOLDERS_API_RESPONSE1['folders'] FAKE_ORGS_RESPONSE = { 'organizations': [ { 'name': 'organizations/1111111111', 'display_name': 'Organization1', 'lifecycleState': 'ACTIVE', }, { 'name': 'organizations/2222222222', 'display_name': 'Organization2', 'lifecycleState': 'ACTIVE', }, { 'name': 'organizations/3333333333', 'display_name': 'Organization3', 'lifecycleState': 'ACTIVE', } ] } EXPECTED_FAKE_ORGS_FROM_API = FAKE_ORGS_RESPONSE['organizations'] FAKE_PROJECTS_API_RESPONSE1 = { 'projects': [ { 'name': 'project1', 'projectId': 'project1', 'projectNumber': '25621943694', 'lifecycleState': 'ACTIVE', }, { 'name': 'project2', 'projectId': 'project2', 'projectNumber': '94226340476', 'lifecycleState': 'DELETE_REQUESTED', }, { 'name': 'project3', 'projectId': 'project3', 'projectNumber': '133851422272', 'lifecycleState': 'ACTIVE', }] } FAKE_ACTIVE_PROJECTS_API_RESPONSE = { 'projects': [ p for p in FAKE_PROJECTS_API_RESPONSE1['projects'] if p['lifecycleState'] == 'ACTIVE' ] } EXPECTED_FAKE_PROJECTS1 = [FAKE_PROJECTS_API_RESPONSE1] EXPECTED_FAKE_ACTIVE_PROJECTS1 = [{ 'projects': [ p for p in FAKE_PROJECTS_API_RESPONSE1['projects'] if p['lifecycleState'] == 'ACTIVE' ] }] # Errors GET_PROJECT_NOT_FOUND = """ { "error": { "code": 403, "message": "The caller does not have permission", "status": "PERMISSION_DENIED" } } """
def write(_text): return 0 def flush(): pass def _emit_ansi_escape(_=''): def inner(_=None): pass return inner clear_line = _emit_ansi_escape() clear_end = _emit_ansi_escape() hide_cursor = _emit_ansi_escape() show_cursor = _emit_ansi_escape() factory_cursor_up = lambda _: _emit_ansi_escape() def cols(): return 0 # more details in `alive_progress.tools.sampling#overhead`. carriage_return = ''
class Solution(object): def computeArea(self, A, B, C, D, E, F, G, H): """ :type A: int :type B: int :type C: int :type D: int :type E: int :type F: int :type G: int :type H: int :rtype: int """ rec1 = (C - A) * (D - B) rec2 = (G - E) * (H - F) # If no intersection if E >= C or A >= G or F >= D or B >= H: return rec1 + rec2 # Sort the 4 X's and 4 Y's sorted_x = sorted([A, E, C, G]) sorted_y = sorted([F, B, H, D]) return rec1 + rec2 - (sorted_x[2] - sorted_x[1]) * (sorted_y[2] - sorted_y[1])
fibona = 89 anterior = 34 while fibona > 0: print(fibona) fibona -= anterior anterior = fibona - anterior if fibona == 0: print(fibona)
def search(blocking, requester, task, keyword, tty_mode): # the result of the task the hub thread submitted to us # will not be available right now task.set_async() blocking.search_image(requester, task.return_result, keyword, tty_mode)
class Solution: def getRow(self, rowIndex: int) -> List[int]: n=rowIndex if n==0: return [1] if n==1: return [1,1] arr=[[1],[1,1]] k=1 for i in range(2,n+1): arr.append([]) arr[i].append(1) for j in range(1,k+1): arr[i].append(arr[i-1][j-1]+arr[i-1][j]) k+=1 arr[i].append(1) return arr[n]
class Solution: def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False y = 0 xx = x while x != 0: t = x % 10 y = y * 10 + t x = x // 10 return y == xx
def kangaroo(x1, v1, x2, v2): while (True): if (x2 > x1 and v2 >= v1) or (x2 < x1 and v2 <= v1): print('NO') return 'NO' x1 += v1 x2 += v2 if x1 == x2: print('YES') return 'YES'
class Solution: def threeSumClosest(self, nums: List[int], target: int) -> int: nums.sort() result = float("inf") for i in range(len(nums) - 2): l, r = i + 1, len(nums) - 1 while l < r: s = nums[i] + nums[l] + nums[r] if s == target: return target if abs(s - target) < abs(result - target): result = s if s > target: r -= 1 else: l += 1 return result
print("Hours in a year =") print(24*365) print("Minutes in a decade =") print(60*24*365*10) print("My age in seconds =") print((365*27+6+2+31+30+31+30+16)*24*1440) print("Andreea's age =") print(48618000/(365*24*1440)) print("?!") print(1<<2) # ** = ^ # << = bitshift # % = modulus print('Hello world') print('') print('Goodbye')
terminalfont = { "width": 6, "height": 8, "start": 32, "end": 127, "data": bytearray([ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x5F, 0x06, 0x00, 0x00, 0x07, 0x03, 0x00, 0x07, 0x03, 0x00, 0x24, 0x7E, 0x24, 0x7E, 0x24, 0x00, 0x24, 0x2B, 0x6A, 0x12, 0x00, 0x00, 0x63, 0x13, 0x08, 0x64, 0x63, 0x00, 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x41, 0x00, 0x00, 0x00, 0x00, 0x41, 0x3E, 0x00, 0x00, 0x00, 0x08, 0x3E, 0x1C, 0x3E, 0x08, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0xE0, 0x60, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, 0x62, 0x51, 0x49, 0x49, 0x46, 0x00, 0x22, 0x49, 0x49, 0x49, 0x36, 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, 0x2F, 0x49, 0x49, 0x49, 0x31, 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30, 0x00, 0x01, 0x71, 0x09, 0x05, 0x03, 0x00, 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E, 0x00, 0x00, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0xEC, 0x6C, 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, 0x3E, 0x41, 0x5D, 0x55, 0x1E, 0x00, 0x7E, 0x11, 0x11, 0x11, 0x7E, 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A, 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, 0x30, 0x40, 0x40, 0x40, 0x3F, 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, 0x7F, 0x02, 0x04, 0x02, 0x7F, 0x00, 0x7F, 0x02, 0x04, 0x08, 0x7F, 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, 0x7F, 0x09, 0x09, 0x19, 0x66, 0x00, 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01, 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, 0x3F, 0x40, 0x3C, 0x40, 0x3F, 0x00, 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, 0x07, 0x08, 0x70, 0x08, 0x07, 0x00, 0x71, 0x49, 0x45, 0x43, 0x00, 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00, 0x00, 0x04, 0x02, 0x01, 0x02, 0x04, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x00, 0x20, 0x54, 0x54, 0x54, 0x78, 0x00, 0x7F, 0x44, 0x44, 0x44, 0x38, 0x00, 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, 0x38, 0x44, 0x44, 0x44, 0x7F, 0x00, 0x38, 0x54, 0x54, 0x54, 0x08, 0x00, 0x08, 0x7E, 0x09, 0x09, 0x00, 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C, 0x00, 0x7F, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00, 0x00, 0x7D, 0x40, 0x00, 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00, 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x40, 0x00, 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78, 0x00, 0x7C, 0x04, 0x04, 0x78, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0xFC, 0x44, 0x44, 0x44, 0x38, 0x00, 0x38, 0x44, 0x44, 0x44, 0xFC, 0x00, 0x44, 0x78, 0x44, 0x04, 0x08, 0x00, 0x08, 0x54, 0x54, 0x54, 0x20, 0x00, 0x04, 0x3E, 0x44, 0x24, 0x00, 0x00, 0x3C, 0x40, 0x20, 0x7C, 0x00, 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, 0x3C, 0x60, 0x30, 0x60, 0x3C, 0x00, 0x6C, 0x10, 0x10, 0x6C, 0x00, 0x00, 0x9C, 0xA0, 0x60, 0x3C, 0x00, 0x00, 0x64, 0x54, 0x54, 0x4C, 0x00, 0x00, 0x08, 0x3E, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x3E, 0x08, 0x00, 0x02, 0x01, 0x02, 0x01, 0x00, 0x00, 0x3C, 0x26, 0x23, 0x26, 0x3C ])}
# Einfache Rechenoperationen # Addition und Subtraktion 1 + 2 1 - 2 # Multiplikation und Division 1 * 2 1 / 2 # Rechenregeln (1 + 2) * 3 1 + 2 * 3 print("Hello World!")
def build_model_filters(model, query, field): filters = [] if query: # The field exists as an exposed column if model.__mapper__.has_property(field): filters.append(getattr(model, field).like("%{}%".format(query))) return filters
test = { 'name': 'Problem 9', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (lambda (x y) (+ x y)) d579a305762000c8ae036c510fb2baf6 # locked """, 'hidden': False, 'locked': True }, { 'code': r""" scm> (lambda (x) (+ x) (+ x x)) (lambda (x) (+ x) (+ x x)) scm> (lambda (x)) SchemeError """, 'hidden': False, 'locked': False } ], 'scored': True, 'setup': '', 'teardown': '', 'type': 'scheme' } ] }
""" Codemonk link: https://www.hackerearth.com/problem/algorithm/little-monk-and-goblet-of-fire-3c1c6865/ Albus Dumbledore announced that the school will host the legendary event known as Wizard Tournament where four magical schools are going to compete against each other in a very deadly competition by facing some dangerous challenges. Since the team selection is very critical in this deadly competition. Albus Dumbledore asked Little Monk to help him in the team selection process. There is a long queue of students from all the four magical schools. Each student of a school have a different roll number. Whenever a new student will come, he will search for his schoolmate from the end of the queue. As soon as he will find any of the schoolmate in the queue, he will stand behind him, otherwise he will stand at the end of the queue. At any moment Little Monk will ask the student, who is standing in front of the queue, to come and put his name in the Goblet of Fire and remove him from the queue. There are Q operations of one of the following types: E x y: A new student of school x (1<=x<=4) whose roll number is y (1<=y<=50000) will stand in queue according to the method mentioned above. D: Little Monk will ask the student, who is standing in front of the queue, to come and put his name in the Goblet of Fire and remove him from the queue. Now Albus Dumbledore asked Little Monk to tell him the order in which student put their name. Little Monk is too lazy to that so he asked you to write a program to print required order. Number of dequeue operations will never be greater than enqueue operations at any point of time. Input - Output: First line contains an integer Q 1<=Q<=10000, denoting the number of operations. Next Q lines will contains one of the 2 types of operations. For each type of operation, print two space separated integers, the front student's school and roll number. Sample input: E 1 1 E 2 1 E 1 2 D D Sample Output: 1 1 1 2 """ """ We can solve this problem in linear time by using simple arrays in an efficient way. Instead of creating a queue with all the students, we are going to create a queue that contains 4 queues, one for each school. By doing that, we are able to directly insert a student behind the student of the same school in constant time. The only thing that's missing now, is the order of the schools. To solve tha problem we will create one more queue that is going to hold that order. We have to notice that the order of the schools will be maintained as long as there is at least one student there. If there are no more students, then the new student that is going to come will be placed at the end, creating a new order for that school. Now, each, time a school queue is empty and we add a student in it, we insert the number of the school in that array. For example, if we have: E 1 5 E 2 3 E 1 1 E 3 2 then, school_queue = [[5, 1], [3], [2], [0]] and order_queue = [1, 2, 3]. How can we achieve a O(1) dequeue in our case? In python if we remove an element all the other elements of the array shift. To avoid that, we will simply create 5 counters and completely avoid the dequeue. The 4 counters will be responsible to count the amount of students removed from each school. The 5th counter will be responsible for the change of the index in the order queue. That way, instead of dequeueing, we just increase those counters and consider the the next elements to be the front. Final complexity: O(Q) """ q = int(input()) structure = [[] for _ in range(4)] s_counter = [0] * 4 order = [] o_counter = 0 for _ in range(q): info = input().rstrip().split() if info[0] == "E": school = int(info[1]) - 1 # If the schools queue is empty or doesn't have any more students, # meaning that the counter is bigger than its length, then we add # that school to the order queue. if not structure[school] or s_counter[school] >= len(structure[school]): order.append(school) # Add the student to its responsive school. structure[school].append(int(info[2])) else: # Print the school and the student's roll, # increase the counter for the respective school # (instead of dequeueing) and if there are no more # student's left in that school then increase the # order counter (instead of dequeueing). school = order[o_counter] print(school + 1, structure[school][s_counter[school]]) s_counter[school] += 1 if s_counter[school] >= len(structure[school]): o_counter += 1
count=0 num=336 for i in range(2,num+1): while num%i==0: num=num//i if i == 2: count=count+1 print(count) ''' num=32546845 count=0 while num>0: digit=num%10 num=num//10 if digit%2==0: count=count+1 print(count) ''' ''' count=0 for i in range(1,101): while i%5==0: count=count+1 break print(count) ''' ''' sum=0 for i in range(1,101): while i>0: digit=i%10 i=i//10 sum=sum+digit print(sum) '''
n=int(input()) for i in range(n): D = dict() for j in range(ord('a'),ord('z')+1): D[j] = 0 a=input() a=a.lower() for j in a: if ord('a') <= ord(j) <=ord('z'): D[ord(j)] += 1 num = min(D.values()) print("Case {}:".format(i+1),end=" ") if num == 0: print("Not a pangram") elif num ==1: print("Pangram!") elif num ==2: print("Double pangram!!") else: print("Triple pangram!!!")
GAME_RESET = "on_reset" GOAL_SCORED = "on_goal_scored" START_PENALTY = "on_penalty_start" END_PENALTY = "on_penalty_end"
#!/bin/python3 __author__ = "Adam Karl" """Find the sum of all numbers below N which divide the sum of the factorial of their digits""" #https://projecteuler.net/problem=34 digitFactorials = [] def sumCuriousNumbersUnderN(n): """Return a sum of all numbers that evenly divide the sum of the factorial of their digits""" sumCurious = 0 for i in range(10, n): #no numbers under 10 are curious, even though 1!=1 and 2!=2 string = str(i) digitFactorialSum = 0 for c in string: digitFactorialSum += digitFactorials[int(c)] if digitFactorialSum == i: sumCurious += i return sumCurious def main(): print("Find the sum of all numbers which are equal to the sum of the factorial of their digits") global digitFactorials digitFactorials = [1] #0! = 1 for i in range(9): #1-9 digitFactorials.append(digitFactorials[-1] * (i+1)) #since 7 * 9! = 2540160, 2540160 is the last number that can be potentially curious result = sumCuriousNumbersUnderN(2540161) print("Sum = %d" % result) if __name__ == "__main__": main()
array = [1,2,3,4] result = [24,12,8,6] def product_except_itself_2(nums): output = [] L = [] R = [] temp = 1 for x in nums: L.append(temp) temp = temp * x temp = 1 for y in nums[::-1]: R.append(temp) temp = temp * y for i in range(len(R)): output.append(L[i]*R[len(R)-1-i]) return output print("Input: " + str(array)) print("Expected: " + str(result)) print("Output: " + str(product_except_itself_2(array)))
# UUU F CUU L AUU I GUU V # UUC F CUC L AUC I GUC V # UUA L CUA L AUA I GUA V # UUG L CUG L AUG M GUG V # UCU S CCU P ACU T GCU A # UCC S CCC P ACC T GCC A # UCA S CCA P ACA T GCA A # UCG S CCG P ACG T GCG A # UAU Y CAU H AAU N GAU D # UAC Y CAC H AAC N GAC D # UAA Stop CAA Q AAA K GAA E # UAG Stop CAG Q AAG K GAG E # UGU C CGU R AGU S GGU G # UGC C CGC R AGC S GGC G # UGA Stop CGA R AGA R GGA G # UGG W CGG R AGG R GGG G lookup = { 'UUU': 'F', 'CUU': 'L', 'AUU': 'I', 'GUU': 'V', 'UUC': 'F', 'CUC': 'L', 'AUC': 'I', 'GUC': 'V', 'UUA': 'L', 'CUA': 'L', 'AUA': 'I', 'GUA': 'V', 'UUG': 'L', 'CUG': 'L', 'AUG': 'M', 'GUG': 'V', 'UCU': 'S', 'CCU': 'P', 'ACU': 'T', 'GCU': 'A', 'UCC': 'S', 'CCC': 'P', 'ACC': 'T', 'GCC': 'A', 'UCA': 'S', 'CCA': 'P', 'ACA': 'T', 'GCA': 'A', 'UCG': 'S', 'CCG': 'P', 'ACG': 'T', 'GCG': 'A', 'UAU': 'Y', 'CAU': 'H', 'AAU': 'N', 'GAU': 'D', 'UAC': 'Y', 'CAC': 'H', 'AAC': 'N', 'GAC': 'D', 'UAA': 'Stop', 'CAA': 'Q', 'AAA': 'K', 'GAA': 'E', 'UAG': 'Stop', 'CAG': 'Q', 'AAG': 'K', 'GAG': 'E', 'UGU': 'C', 'CGU': 'R', 'AGU': 'S', 'GGU': 'G', 'UGC': 'C', 'CGC': 'R', 'AGC': 'S', 'GGC': 'G', 'UGA': 'Stop', 'CGA': 'R', 'AGA': 'R', 'GGA': 'G', 'UGG': 'W', 'CGG': 'R', 'AGG': 'R', 'GGG': 'G' } def convert_rna_to_protein(rna_sequence): protein_list = [] for i in range(0, len(rna_sequence), 3): codon = rna_sequence[i:i+3] protein = lookup[codon] if protein != 'Stop': protein_list.append(protein) protein_sequence = ''.join(protein_list) return protein_sequence if __name__ == '__main__': rna_sequence = input("Enter RNA sequence:\n") protein_sequence = convert_rna_to_protein(rna_sequence) print(protein_sequence)
DB_PATH = 'assets/survey_data.db' REVIEWS_PATH = 'static/files/reviews.csv' QUESTIONS_PATH = 'static/files/questions.csv' USER_TABLE = 'users' STMT_USER_TABLE = f'''CREATE TABLE IF NOT EXISTS {USER_TABLE} (netid int PRIMARY KEY, age int, internet_use int)''' REVIEWS_TABLE = 'reviews' STMT_REVIEWS_TABLE = f'''CREATE TABLE IF NOT EXISTS {REVIEWS_TABLE} (id int PRIMARY KEY, statement text, type int)''' STUDY_ONE_TABLE = 'study_one' STMT_STUDY_ONE_TABLE = f'''CREATE TABLE IF NOT EXISTS {STUDY_ONE_TABLE} (id int PRIMARY KEY, user_id int, review_id int, question_id int, value int)''' QUESTIONS_TABLE = 'questions' STMT_QUESTIONS_TABLE = f'''CREATE TABLE IF NOT EXISTS {QUESTIONS_TABLE} (id int PRIMARY KEY, statement text, type int, min text, max text)''' STUDY_TWO_TABLE = 'study_two' STMT_STUDY_TWO_TABLE = f'''CREATE TABLE IF NOT EXISTS {STUDY_TWO_TABLE} (id int PRIMARY KEY, user_id int, question_id int, value int)'''
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isBalanced(self, root: TreeNode) -> bool: if self.height(root) is None: return False else: return True; def height(self, node): #base case if(node is None): return 0; left = self.height(node.left); right = self.height(node.right); if(left is None or right is None): return None; if(abs(left - right) > 1): return None; return 1 + max(left, right);
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def cloc(): http_archive( name="cloc" , build_file="//bazel/deps/cloc:build.BUILD" , sha256="da1a0de6d8ce2f4e80fa7554cf605f86d97d761b4ffd647df9b01c4658107dba" , strip_prefix="cloc-90070481081b6decd9446d57a35176da3a6d8fbc" , urls = [ "https://github.com/Unilang/cloc/archive/90070481081b6decd9446d57a35176da3a6d8fbc.tar.gz", ], )
valid_names = ["Danilo", "Daniel", "Dani"] class NameError(Exception): pass def handler(event, context): name = event.get("name",None) if name: if name in valid_names: return event else: raise NameError("WrongName") else: raise NameError("NoName")
class SparseTable: def __init__(self,array,func): self.array = array self.func = func self._log = self._logPreprocess() self.sparseTable = self._preprocess() def _logPreprocess(self): n = len(self.array); _log = [0] * (n+1) for i in range(2,n+1): _log[i] = _log[n//2] + 1 return _log def _preprocess(self): n = len(self.array) k = self._log[n]+1 sTable = [[0]*k for i in range(n)] for i in range(n): sTable[i][0] = self.array[i] for j in range(1,k+1): for i in range(n+1): if i + (1 << j) > n: break sTable[i][j] = self.func(sTable[i][j-1], sTable[i + (1 << (j-1))][j-1]) return sTable def query(self,l,r): l,r = min(l,r),max(l,r) j = self._log[r-l+1] return self.func(self.sparseTable[l][j], self.sparseTable[r-(1 << j)+1][j]) def __len__(self): return len(self.array) def __getitem__(self,interval): if type(interval) == int: if interval < 0: raise IndexError("Negatives indexes aren't supported") l,r = (interval,interval) else: l = interval.start or 0 r = interval.stop or len(self.array)-1 if l < 0 or r < 0: raise IndexError("Negatives indexes aren't supported") return self.query(l,r) def __str__(self): return '\n'.join(' '.join(map(str,row)) for row in self.sparseTable) def __repr__(self): return f"SparseTable({self.array},{self.func.__name__})"
class SampleNotMatchedError(Exception): pass class InvalidRangeError(Exception): pass
cat=int(input("Ingrese la categoria del trbajdor: ")) suel=int(input("Ingrese el sueldo bruto del trabajador: ")) if(cat==1): suelt1=suel* 0.10 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP") elif(cat==2): suelt1=suel* 0.15 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP") elif(cat==3): suelt1=suel* 0.20 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP") elif(cat==4): suelt1=suel* 0.40 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP") elif(cat==5): suelt1=suel* 0.60 suelt= suelt1+suel print("Categoria: " +str(cat)) print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP")
Train_0 = ['P26', 'P183', 'P89', 'P123', 'P61', 'P112', 'P63', 'P184', 'P100', 'P11', 'P111', 'P28', 'P192', 'P35', 'P27', 'P113', 'P33', 'P17', 'P126', 'P176', 'P46', 'P44', 'P137', 'P13', 'P74', 'P134', 'P128', 'P0', 'P157', 'P161', 'P163', 'P38', 'P190', 'P12', 'P115', 'P122', 'P144', 'P15', 'P154', 'P48', 'P187', 'P200', 'P99', 'P150', 'P53', 'P191', 'P79', 'P169', 'P19', 'P121', 'P90', 'P174', 'P117', 'P140', 'P85', 'P59', 'P168', 'P31', 'P21', 'P1', 'P97', 'P67', 'P107', 'P54', 'P181', 'P94', 'P30', 'P109', 'P47', 'P91', 'P2', 'P22', 'P62', 'P88', 'P66', 'P83', 'P76', 'P118', 'P65', 'P180', 'P179', 'P189', 'P173', 'P41', 'P166', 'P80', 'P193', 'P194', 'P6', 'P45', 'P182', 'P55', 'P177', 'P124', 'P165', 'P201', 'P110', 'P105', 'P125', 'P136', 'P102', 'P64', 'P50', 'P52', 'P162', 'P82', 'P106', 'P78', 'P186', 'P146', 'P36', 'P158', 'P84', 'P167', 'P43', 'P103', 'P96', 'P153', 'P5', 'P127', 'P20', 'P131', 'P198', 'P34', 'P185', 'P10', 'P87', 'P77', 'P25', 'P3', 'P39', 'P72', 'P160', 'P156', 'P40', 'P149', 'P204', 'P135', 'P8', 'P130', 'P70', 'P60'] Val_0 = ['P23', 'P199', 'P202', 'P42', 'P159', 'P116', 'P37', 'P171', 'P141', 'P51', 'P142', 'P129', 'P147', 'P104', 'P164', 'P155', 'P151', 'P29', 'P145', 'P95', 'P101'] Train_1 = ['P162', 'P62', 'P19', 'P37', 'P74', 'P109', 'P191', 'P99', 'P54', 'P88', 'P64', 'P78', 'P87', 'P95', 'P59', 'P80', 'P149', 'P72', 'P154', 'P168', 'P111', 'P146', 'P5', 'P136', 'P180', 'P23', 'P28', 'P70', 'P107', 'P187', 'P165', 'P182', 'P169', 'P186', 'P103', 'P26', 'P184', 'P171', 'P115', 'P85', 'P53', 'P102', 'P83', 'P11', 'P77', 'P122', 'P13', 'P97', 'P185', 'P10', 'P104', 'P38', 'P123', 'P27', 'P199', 'P129', 'P151', 'P190', 'P17', 'P43', 'P41', 'P201', 'P181', 'P36', 'P20', 'P163', 'P51', 'P183', 'P177', 'P94', 'P167', 'P42', 'P128', 'P45', 'P82', 'P200', 'P25', 'P84', 'P118', 'P156', 'P176', 'P79', 'P166', 'P142', 'P134', 'P137', 'P121', 'P144', 'P46', 'P153', 'P204', 'P100', 'P198', 'P60', 'P161', 'P44', 'P130', 'P202', 'P31', 'P160', 'P1', 'P48', 'P8', 'P173', 'P15', 'P50', 'P34', 'P116', 'P140', 'P126', 'P159', 'P157', 'P110', 'P65', 'P35', 'P0', 'P6', 'P55', 'P105', 'P2', 'P22', 'P30', 'P189', 'P125', 'P21', 'P147', 'P141', 'P155', 'P91', 'P29', 'P96', 'P89', 'P67', 'P3', 'P145', 'P76', 'P174', 'P39', 'P192', 'P194', 'P40', 'P193', 'P33'] Val_1 = ['P179', 'P164', 'P113', 'P124', 'P61', 'P117', 'P112', 'P63', 'P101', 'P131', 'P135', 'P90', 'P106', 'P150', 'P47', 'P158', 'P12', 'P52', 'P66', 'P127'] Train_2 = ['P30', 'P164', 'P180', 'P12', 'P51', 'P64', 'P38', 'P44', 'P42', 'P186', 'P162', 'P65', 'P136', 'P147', 'P28', 'P190', 'P5', 'P22', 'P174', 'P34', 'P113', 'P39', 'P25', 'P181', 'P110', 'P131', 'P2', 'P8', 'P74', 'P53', 'P85', 'P157', 'P103', 'P50', 'P67', 'P13', 'P112', 'P82', 'P130', 'P83', 'P167', 'P134', 'P127', 'P105', 'P76', 'P179', 'P124', 'P189', 'P89', 'P72', 'P59', 'P0', 'P26', 'P19', 'P151', 'P27', 'P107', 'P52', 'P187', 'P10', 'P3', 'P126', 'P70', 'P150', 'P104', 'P165', 'P45', 'P33', 'P154', 'P168', 'P48', 'P15', 'P192', 'P117', 'P201', 'P199', 'P183', 'P194', 'P66', 'P90', 'P141', 'P166', 'P20', 'P106', 'P84', 'P173', 'P17', 'P35', 'P144', 'P87', 'P37', 'P23', 'P149', 'P47', 'P97', 'P91', 'P198', 'P171', 'P55', 'P159', 'P116', 'P102', 'P122', 'P204', 'P61', 'P6', 'P1', 'P79', 'P125', 'P193', 'P156', 'P123', 'P140', 'P80', 'P155', 'P135', 'P177', 'P115', 'P169', 'P63', 'P31', 'P21', 'P96', 'P185', 'P100', 'P43', 'P202', 'P129', 'P118', 'P142', 'P77', 'P29', 'P101', 'P128', 'P78', 'P146', 'P11', 'P36', 'P94', 'P88', 'P54', 'P153', 'P121'] Val_2 = ['P184', 'P62', 'P158', 'P111', 'P161', 'P182', 'P40', 'P176', 'P60', 'P191', 'P109', 'P145', 'P41', 'P95', 'P160', 'P99', 'P137', 'P46', 'P163', 'P200'] Train_3 = ['P166', 'P48', 'P29', 'P147', 'P190', 'P67', 'P89', 'P6', 'P109', 'P181', 'P3', 'P59', 'P164', 'P167', 'P107', 'P28', 'P141', 'P27', 'P127', 'P36', 'P173', 'P82', 'P44', 'P41', 'P55', 'P128', 'P125', 'P99', 'P163', 'P186', 'P135', 'P112', 'P179', 'P180', 'P61', 'P194', 'P91', 'P33', 'P10', 'P51', 'P77', 'P95', 'P110', 'P105', 'P204', 'P130', 'P38', 'P131', 'P156', 'P8', 'P185', 'P43', 'P124', 'P182', 'P96', 'P94', 'P136', 'P83', 'P126', 'P158', 'P45', 'P100', 'P169', 'P121', 'P142', 'P34', 'P1', 'P62', 'P191', 'P151', 'P25', 'P47', 'P129', 'P85', 'P123', 'P189', 'P184', 'P76', 'P176', 'P157', 'P199', 'P87', 'P17', 'P134', 'P13', 'P200', 'P153', 'P74', 'P97', 'P19', 'P116', 'P149', 'P23', 'P64', 'P5', 'P11', 'P39', 'P104', 'P52', 'P165', 'P101', 'P183', 'P111', 'P201', 'P42', 'P35', 'P202', 'P162', 'P122', 'P187', 'P79', 'P2', 'P53', 'P50', 'P106', 'P54', 'P26', 'P30', 'P161', 'P37', 'P154', 'P70', 'P88', 'P155', 'P146', 'P63', 'P78', 'P144', 'P118', 'P15', 'P22', 'P80', 'P115', 'P31', 'P171', 'P192', 'P193', 'P20', 'P137', 'P12', 'P103', 'P140'] Val_3 = ['P102', 'P150', 'P66', 'P174', 'P117', 'P84', 'P46', 'P177', 'P40', 'P168', 'P72', 'P90', 'P21', 'P113', 'P159', 'P145', 'P160', 'P65', 'P198', 'P60', 'P0'] Train_4 = ['P145', 'P72', 'P70', 'P146', 'P53', 'P176', 'P169', 'P113', 'P35', 'P26', 'P5', 'P161', 'P106', 'P200', 'P107', 'P117', 'P192', 'P45', 'P189', 'P15', 'P174', 'P181', 'P141', 'P42', 'P100', 'P135', 'P130', 'P61', 'P165', 'P204', 'P201', 'P151', 'P60', 'P10', 'P20', 'P91', 'P66', 'P137', 'P155', 'P97', 'P194', 'P140', 'P79', 'P54', 'P17', 'P166', 'P125', 'P33', 'P29', 'P116', 'P44', 'P109', 'P74', 'P149', 'P46', 'P55', 'P59', 'P159', 'P84', 'P27', 'P112', 'P160', 'P38', 'P126', 'P37', 'P129', 'P30', 'P65', 'P63', 'P171', 'P11', 'P102', 'P95', 'P0', 'P52', 'P101', 'P88', 'P142', 'P105', 'P99', 'P118', 'P158', 'P78', 'P36', 'P90', 'P6', 'P80', 'P51', 'P64', 'P41', 'P202', 'P43', 'P76', 'P62', 'P31', 'P22', 'P34', 'P150', 'P190', 'P124', 'P156', 'P182', 'P193', 'P186', 'P147', 'P167', 'P131', 'P3', 'P144', 'P163', 'P136', 'P121', 'P128', 'P123', 'P39', 'P50', 'P199', 'P157', 'P87', 'P47', 'P21', 'P154', 'P89', 'P111', 'P184', 'P168', 'P40', 'P162', 'P12', 'P103', 'P1', 'P96', 'P83', 'P8', 'P85', 'P67', 'P153', 'P82', 'P2', 'P110', 'P77', 'P191', 'P185'] Val_4 = ['P94', 'P134', 'P23', 'P28', 'P177', 'P187', 'P180', 'P122', 'P104', 'P13', 'P127', 'P198', 'P179', 'P173', 'P164', 'P25', 'P115', 'P48', 'P183', 'P19'] test_indices = ['P71', 'P16', 'P114', 'P170', 'P98', 'P69', 'P92', 'P132', 'P81', 'P73', 'P143', 'P175', 'P56', 'P139', 'P152', 'P203', 'P75', 'P9', 'P24', 'P4', 'P32', 'P120', 'P138', 'P172', 'P57', 'P195', 'P68', 'P133', 'P14', 'P119', 'P7', 'P49', 'P93', 'P178', 'P58', 'P108', 'P197', 'P196', 'P86', 'P18', 'P188', 'P148']
def registry_metaclass(storage): class RegistryMeta(type): def __init__(cls, name, bases, attrs): super(RegistryMeta, cls).__init__(name, bases, attrs) id = getattr(cls, 'id', None) if not id: return if id in storage: raise KeyError("Already registered: %s" % name) storage[id] = cls return RegistryMeta
class Solution: def findSubstringInWraproundString(self, p): res, l = {i: 1 for i in p}, 1 for i, j in zip(p, p[1:]): l = l + 1 if (ord(j) - ord(i)) % 26 == 1 else 1 res[j] = max(res[j], l) return sum(res.values())
# TODO: Turn this into a generator? def get_tiles(image, tile_size): """Splits an image into multiple tiles of a certain size""" tile_images = [] x = 0 y = 0 while y < image.height: im_tile = image.crop((x, y, x+tile_size, y+tile_size)) tile_images.append(im_tile) if x < image.width - tile_size: x += tile_size else: x = 0 y += tile_size return tile_images
# day_1/vars.py # <-- This symbol makes a line a comment """ <-- These make a multi line comment. Both typs of comments are ignored by python. But you need to close multiline comments --> """ """ The first thing we should talk about is how to get output out of your program. In python we use the print function. You do this by typing: print(10) # This will print 10 to the terminal. Type your own print statement below. """ # <-- Type your print statement before the hashtag """ You can run a program by typing python3 <name of the file> in the terminal Type: python3 vars.py """ """ Varialbles are something that you can assign a value to. You give it a name and you tell it it's value, then when ever you call it's name you get the value. Lets go ahead and uncomment those two lines below, what do you think will happen when we run it? """ # my_variable = 3 # print(my_variable) """ Math with variables. You can add and subtract variable and even reassign them to be something else. Uncomment the lines below and see if you can guess what each print statement will print. """ one = 1 two = 2 three = 3 goku = 9001 # print(goku - one) # Type your guess here: # print(goku + one) # Type your guess here: # print(two * three) # Type your guess here: # print(goku / three) # Type your guess here: # print(goku // three) # Type your guess here: # goku = goku - one # print(goku) # Type your guess here: # print((goku * two) - (three ** two)) # Type your guess here: # goku += two # print(goku) # Type your guess here: # modulus_maths = goku % three # print(modulus_maths) # Type your guess here:
def return_decoded_value(value): if type(value) is bytes: value = value.decode('utf-8') elif type(value) is not str: value = value.decode("ascii", "ignore") else: value = value return value.strip('\r\n')
f=open("input.txt") Input = f.read().split("\n") f.close() x=0 y=0 count=0 while(y < len(Input)): count += Input[y][x%len(Input[0])] == "#" x += 3 y += 1 print(count)
# https://www.codewars.com/kata/52fba66badcd10859f00097e def disemvowel(str): return "".join(filter(lambda c: c not in "aeiouAEIOU", str)) print(disemvowel("This website is for losers LOL!"))
def doSomethingWithString(str): print(" Input is "+str, end = '\n') split = str.split(" ") print(split) split.pop(2) print(split) def secondFun(): s = [10,20] x = [20,30] return s, x x = 10 y = 11.2 dict = {1:'Alfa', 2:'Beta'} k = "A sample approach" doSomethingWithString(k) x, y = secondFun() print(x, end='\n') print(y)
# If you want to print something customized in your terminal # Use my custom color and fonts styles in order to print wyw # Refer to it with this kind of formation and formulation: # Example: # customization.color.BOLD + "String" + customization.color.END class Colors: # String to purple color PURPLE = '\033[95m' # String to cyan color CYAN = '\033[96m' # String to darkcyan color DARKCYAN = '\033[36m' # String to blue color BLUE = '\033[94m' # String to green color GREEN = '\033[92m' # String to yellow color YELLOW = '\033[93m' # String to red color RED = '\033[91m' # Make string bold BOLD = '\033[1m' # Underline string UNDERLINE = '\033[4m' # Erase all formation END = '\033[0m'
with open('DOCKER_VERSION') as f: version = f.read() with open('DOCKER_VERSION', 'w') as f: major, minor, patch = version.split('.') patch = int(patch) + 1 f.write('{}.{}.{}\n'.format(major, minor, patch))
''' Created on Feb 8, 2017 @author: PJ ''' class TempRetrofillSrFromOfficialResults: def populate_sr(self, **kargs): return kargs def save_sr(self, score_result_type, match, team, **kargs): sr_search = score_result_type.objects.filter(match=match, team=team) if len(sr_search) == 0: sr = score_result_type(match=match, team=team, competition=match.competition, **kargs) sr.save() pass else: sr = sr_search[0] for key, value in kargs.iteritems(): setattr(sr, key, value) sr.save() pass def populate_matchresults(self, official_match, match_class, score_result_class, official_sr_class): match, _ = match_class.objects.get_or_create(matchNumber=official_match.matchNumber) print("Updating match %s" % match.matchNumber) # print official_match.__dict__ official_srs = official_sr_class.objects.filter(official_match=official_match) red_sr = official_srs[0] blue_sr = official_srs[1] self.save_sr(score_result_class, match, match.red1, **self.populate_sr(**self.get_team1_stats(red_sr))) self.save_sr(score_result_class, match, match.red2, **self.populate_sr(**self.get_team2_stats(red_sr))) self.save_sr(score_result_class, match, match.red3, **self.populate_sr(**self.get_team3_stats(red_sr))) self.save_sr(score_result_class, match, match.blue1, **self.populate_sr(**self.get_team1_stats(blue_sr))) self.save_sr(score_result_class, match, match.blue2, **self.populate_sr(**self.get_team2_stats(blue_sr))) self.save_sr(score_result_class, match, match.blue3, **self.populate_sr(**self.get_team3_stats(blue_sr))) official_match.hasOfficialData = True official_match.save() def get_team1_stats(self, official_match_sr): raise NotImplementedError() def get_team2_stats(self, official_match_sr): raise NotImplementedError() def get_team3_stats(self, official_match_sr): raise NotImplementedError()
lista = [] pares = [] impar = [] for i in range(20): lista.append(int(input("Digite um numero: "))) for i in lista: if i % 2 == 0: pares.append(i) else: impar.append(i) print(f"Lista = {lista}") print(f"Pares = {pares}") print(f"impar = {impar}")
''' Created on 2015年12月4日 given [1, [2,3], [[4]]], return sum. 计算sum的方法是每向下一个level权重+1, 例子的sum = 1 * 1 + (2 + 3) * 2 + 4 * 3。follow up:每向下一个level 权重 - 1, sum = 3 * 1 +(2 + 3)* 2 + 4 * 1 @author: Darren ''' def levelSum(string): pass print(levelSum("[1, [2,3], [2,3],[[4]]]") )
sehirler=['Adana','Gaziantep'] plakalar=[1,27] print(plakalar[sehirler.index('Gaziantep')]) plakalar={'Adana':1,'Gaziantep':27} print(plakalar['Gaziantep']) plakalar['Ankara']=6 print(plakalar) users={'SudeSezen':{ 'age':36, 'roles':['user'], 'email':'aaaaa@aa.com', 'address':'KOMPLE ADANA BİZİM', 'phone':'01' }, 'KadirDurmaz':{ 'age':22, 'roles':['admin','user'], 'email':'kadir@aa.com', 'address':'ANTEP BABA', 'phone':'911' }} print(users['SudeSezen']) print(users['SudeSezen']['address']) print(users['KadirDurmaz']['roles'][0]) print(users['SudeSezen']['roles'][0])
# Queue using Two Stacks # Create a queue data structure using two stacks. # # https://www.hackerrank.com/challenges/queue-using-two-stacks/problem # in_stack = [] out_stack = [] for _ in range(int(input())): op = list(map(int, input().split())) # push back if op[0] == 1: in_stack.append(op[1]) # pop front elif op[0] == 2: if len(out_stack) > 0: # vide la stack de sortie out_stack.pop() else: # transvase la stack d'entrée vers la stack de sortie while len(in_stack) > 1: out_stack.append(in_stack.pop()) in_stack.pop() # print elif op[0] == 3: if len(out_stack) == 0: while len(in_stack) > 0: out_stack.append(in_stack.pop()) print(out_stack[-1])
class HxCType(object): """ Enum and static methods for manipulating the C type defined by HexRays. This is a wrapper on top of the ``ctype_t`` enum: ``cot_*`` are for the expresion (``cexpr_t`` in ida, :class:`HxCExpr` in bip ) and ``cit_*`` are for the statement (``cinsn_t`` in ida, :class:`HxCStmt` in bip). This also include some static function which are wrapper which manipulate those types. .. todo:: static function for manipulating the enum ? Comment on the enum are from ``hexrays.hpp`` . """ COT_EMPTY = 0 COT_COMMA = 1 #: ``x, y`` COT_ASG = 2 #: ``x = y`` COT_ASGBOR = 3 #: ``x |= y`` COT_ASGXOR = 4 #: ``x ^= y`` COT_ASGBAND = 5 #: ``x &= y`` COT_ASGADD = 6 #: ``x += y`` COT_ASGSUB = 7 #: ``x -= y`` COT_ASGMUL = 8 #: ``x *= y`` COT_ASGSSHR = 9 #: ``x >>= y`` signed COT_ASGUSHR = 10 #: ``x >>= y`` unsigned COT_ASGSHL = 11 #: ``x <<= y`` COT_ASGSDIV = 12 #: ``x /= y`` signed COT_ASGUDIV = 13 #: ``x /= y`` unsigned COT_ASGSMOD = 14 #: ``x %= y`` signed COT_ASGUMOD = 15 #: ``x %= y`` unsigned COT_TERN = 16 #: ``x ? y : z`` COT_LOR = 17 #: ``x || y`` COT_LAND = 18 #: ``x && y`` COT_BOR = 19 #: ``x | y`` COT_XOR = 20 #: ``x ^ y`` COT_BAND = 21 #: ``x & y`` COT_EQ = 22 #: ``x == y`` int or fpu (see EXFL_FPOP) COT_NE = 23 #: ``x != y`` int or fpu (see EXFL_FPOP) COT_SGE = 24 #: ``x >= y`` signed or fpu (see EXFL_FPOP) COT_UGE = 25 #: ``x >= y`` unsigned COT_SLE = 26 #: ``x <= y`` signed or fpu (see EXFL_FPOP) COT_ULE = 27 #: ``x <= y`` unsigned COT_SGT = 28 #: ``x > y`` signed or fpu (see EXFL_FPOP) COT_UGT = 29 #: ``x > y`` unsigned COT_SLT = 30 #: ``x < y`` signed or fpu (see EXFL_FPOP) COT_ULT = 31 #: ``x < y`` unsigned COT_SSHR = 32 #: ``x >> y`` signed COT_USHR = 33 #: ``x >> y`` unsigned COT_SHL = 34 #: ``x << y`` COT_ADD = 35 #: ``x + y`` COT_SUB = 36 #: ``x - y`` COT_MUL = 37 #: ``x * y`` COT_SDIV = 38 #: ``x / y`` signed COT_UDIV = 39 #: ``x / y`` unsigned COT_SMOD = 40 #: ``x % y`` signed COT_UMOD = 41 #: ``x % y`` unsigned COT_FADD = 42 #: ``x + y`` fp COT_FSUB = 43 #: ``x - y`` fp COT_FMUL = 44 #: ``x * y`` fp COT_FDIV = 45 #: ``x / y`` fp COT_FNEG = 46 #: ``-x`` fp COT_NEG = 47 #: ``-x`` COT_CAST = 48 #: ``(type)x`` COT_LNOT = 49 #: ``!x`` COT_BNOT = 50 #: ``~x`` COT_PTR = 51 #: ``*x``, access size in 'ptrsize' COT_REF = 52 #: ``&x`` COT_POSTINC = 53 #: ``x++`` COT_POSTDEC = 54 #: ``x--`` COT_PREINC = 55 #: ``++x`` COT_PREDEC = 56 #: ``--x`` COT_CALL = 57 #: ``x(...)`` COT_IDX = 58 #: ``x[y]`` COT_MEMREF = 59 #: ``x.m`` COT_MEMPTR = 60 #: ``x->m``, access size in 'ptrsize' COT_NUM = 61 #: n COT_FNUM = 62 #: fpc COT_STR = 63 #: string constant COT_OBJ = 64 #: obj_ea COT_VAR = 65 #: v COT_INSN = 66 #: instruction in expression, internal representation only COT_SIZEOF = 67 #: ``sizeof(x)`` COT_HELPER = 68 #: arbitrary name COT_TYPE = 69 #: arbitrary type COT_LAST = 69 #: All before this are ``cexpr_t`` after are ``cinsn_t`` CIT_EMPTY = 70 #: instruction types start here CIT_BLOCK = 71 #: block-statement: { ... } CIT_EXPR = 72 #: expression-statement: expr; CIT_IF = 73 #: if-statement CIT_FOR = 74 #: for-statement CIT_WHILE = 75 #: while-statement CIT_DO = 76 #: do-statement CIT_SWITCH = 77 #: switch-statement CIT_BREAK = 78 #: break-statement CIT_CONTINUE = 79 #: continue-statement CIT_RETURN = 80 #: return-statement CIT_GOTO = 81 #: goto-statement CIT_ASM = 82 #: asm-statement CIT_END = 83 class AbstractCItem(object): """ Abstract class for common element between :class:`HxCItem` and :class:`CNode`. This class provide access to common implementation: address of the element, equality operator, testing for the label and testing for expression or statement. This class also define the :meth:`~AbstractCItem.is_handling_type` method used for determining the correct object to create using the :attr:`~AbstractCItem.TYPE_HANDLE` attribute. Finally, it also define the :meth:`~AbstractCItem._create_child` abstract method used for being able to create child nodes. """ #: Class attribute indicating which type of item this class handles, #: this is used for determining if this is the good object to #: instantiate. All abstract class should have a value of -1 for this #: object, non-abstract class should have a value corresponding to the #: :class:`HxCType` they handle. TYPE_HANDLE = -1 def __init__(self, citem): """ Constructor for the abstract class :class:`HxCItem` . This should never be used directly. :param citem: a ``citem_t`` object, in practice this should always be a ``cexpr_t`` or a ``cinsn_t`` object. """ #: The ``citem_t`` object from ida, this is conserved at this level #: for providing a few functionnality compatible between different #: item types (such as :class:`HxCExpr` and :class:`HxCStmt`) . self._citem = citem ############################ BASE METHODS ########################## @property def ea(self): """ Property which return the address corresponding to this item. :return: An integer corresponding to the address of the item. This may be ``idc.BADADDR`` if the item as no equivalent address. """ return self._citem.ea @property def is_expr(self): """ Property which return true if this item is a C Expression (:class:`HxCExpr`, ``cexpr_t``). """ return self._citem.is_expr() @property def is_statement(self): """ Property which return true if this item is a C Statement (:class:`HxCStmt`, ``cinsn_t``). """ return not self.is_expr @property def _ctype(self): """ Property which return the :class:`HxCType` (``ctype_t``) of this object. :return int: One of the :class:`HxCType` constant value. """ return self._citem.op def __str__(self): """ Convert a citem to a string. This is surcharge both by :class:`HxCStmt` and :class:`HxCExpr`. """ return "{}(ea=0x{:X})".format(self.__class__.__name__, self.ea) ########################## LABEL METHODS ########################### @property def has_label(self): """ Property which return True if the node has a label number. """ return self._citem.label_num != -1 @property def label_num(self): """ Property which return the label number of the node. If this node has no label ``-1`` is return. :meth:`~AbstractCItem.has_label` allows to check if the node has a label. """ return self._citem.label_num ########################### CMP METHODS ############################### def __eq__(self, other): """ Compare to AST node. This is base on the compare implemented by hexrays and can return true for two different object including for comparing object which inherit from :class:`HxCItem` and from :class:`CNode`. This seems to not work if the function has been recompiled. Return ``NotImplemented`` if the element to compare does not inherit from AbstractCItem """ if not isinstance(other, AbstractCItem): return NotImplemented return self._citem == other._citem def __ne__(self, other): res = self.__eq__(other) if res == NotImplemented: return res else: return not res ############################ INHERITANCE METHODS ######################### def _create_child(self, obj): """ Abstract method which allow to create child element for this object with the correct class. This should be implemented by child classes and will raise a :class:`NotImplementedError` exception if not surcharge. """ raise NotImplementedError("_create_child is an abstract method and should be surcharge by child class") ############################ CLASS METHODS ########################## @classmethod def is_handling_type(cls, typ): """ Class method which return True if the function handle the type passed as argument. :param typ: One of the :class:`HxCType` value. """ return cls.TYPE_HANDLE == typ
#list of group members #MATSIKO BRUNO 2020/BSE/165/PS #DAVID NYAMUTALE 2020/BSE/057/PS #MAWANDA DENNIS 2020/BSE/155/PS #AKANDWANAHO NICKSON 2020/BSE/006/PS # strt with an empty list list_of_items_to_capture = [] #create a loop for capturing values random_number = 1 while random_number == 1: inputedValue = input('enter values, else enter done\n') if len(inputedValue) == 0: print('bad data') elif inputedValue.lower() == "done": random_number = 2 else: try: inputedValue = float(inputedValue) list_of_items_to_capture.append(inputedValue) except: print('bad data') #end of loop #create a loop that goes thru the list created above and creates total and count total_variable = 0 counting_variable = 0 for iteration_variable in list_of_items_to_capture: total_variable = total_variable + iteration_variable counting_variable = counting_variable + 1 print("count, total, and average") print(counting_variable, total_variable, total_variable/counting_variable)
class TrieNode: def __init__(self): self.val = None self.children = [None] * 26 class MapSum: def __init__(self): self.root = TrieNode() def insert(self, key: str, val: int) -> None: p = self.root for c in key: offset_c = ord(c) - 97 if not p.children[offset_c]: p.children[offset_c] = TrieNode() p = p.children[offset_c] # overwrite teh old value p.val = val def getNode(self, key) -> TrieNode: p = self.root for c in key: if not p: return p p = p.children[ord(c) - 97] return p def valuesWithPrefix(self, prefix): res = [] path = [] node = self.getNode(prefix) self.traverse(node, res) return res def traverse(self, node, res): if not node: return if node.val: res.append(node.val) for child in node.children: self.traverse(child, res) return def sum(self, prefix: str) -> int: return sum(self.valuesWithPrefix(prefix)) # Your MapSum object will be instantiated and called as such: # obj = MapSum() # obj.insert(key,val) # param_2 = obj.sum(prefix)
# -*- python -*- """@file @brief crc8 calculator for Pato packets Copyright (c) 2014-2015 Dimitry Kloper <kloper@users.sf.net>. All rights reserved. @page License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the Pato Project. """ def _crc_update(crc, data, mask, const): """ CRC8/16 update function taken from _crc_ibutton_update() function found in "Atmel Toolchain/AVR8 GCC/Native/3.4.1061/ avr8-gnu-toolchain/avr/include/util/crc16.h" documentation. @param[in] crc current CRC value @param[in] data next byte of data @param[in] mask CRC mask, must be 0xff for CRC8 and 0xffff for CRC16 @param[in] const CRC polynomial constant @returns Next CRC value either 8 or 16 bit depending on mask """ crc = (crc & mask) ^ (data & 0xff) for _ in range(8): if crc & 1: crc = (crc >> 1) ^ const else: crc >>= 1 return crc & mask def crc8(data): """ Calculate CRC8 as described in the util/crc16.h (see _crc_update()) @param[in] data input byte sequence @returns Optimized Dallas (now Maxim) iButton 8-bit CRC """ crc = 0 for c in data: crc = _crc_update(crc, c, 0xff, 0x8c) return crc def crc16(data): """ Calculate CRC16 as described in the util/crc16.h (see _crc_update()) @param[in] data input byte sequence @returns CRC16 of input byte sequence """ crc = 0 for c in data: crc = _crc_update(crc, c, 0xffff, 0xA001) return crc
def int_to_Roman(num): val = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ] syb = [ "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" ] roman_num = '' i = 0 while num > 0: # girilen sayı 0 dan büyük oldukça ; for _ in range(num // val[i]): # örn 12 için sadece X - 10 değerlerinde calısacak. RANGE(1) olursa döngü çalışır ! roman_num += syb[i] # eğer tam bölünürse, symbol ü roman_num a ata num -= val[i] # num'dan val[i]'yi çıkararak döngüye devam et i += 1 # counter'ı arttır. return roman_num print(int_to_Roman(123))
__all__ = ('InvalidOption') class InvalidOption(Exception): """ Raises when user call methods with incorrect arguments. """
class PolydatumException(Exception): pass class ServiceError(PolydatumException): code = 500 class NotFound(ServiceError): code = 404 class ErrorsOnClose(PolydatumException): """ Deprecated 0.8.4 as Resources errors on exit are suppressed """ def __init__(self, message, exceptions): super(Exception, self).__init__(message) self.message = message self.exceptions = exceptions def __str__(self): return '<{} {}: {}>'.format( self.__class__.__name__, self.message, self.exceptions ) class AlreadyExistsException(PolydatumException): """ Service, middleware, or resource already exists """ class MiddlewareException(PolydatumException): pass class MiddlewareSetupException(MiddlewareException): """ Middleware setup failed """ class ResourceException(PolydatumException): pass class ResourceSetupException(ResourceException): """ Resource setup failed """
# Created from ttf-fonts/Entypo.otf with freetype-generator. # freetype-generator created by Meurisse D ( MCHobby.be ). Entypo_23 = { 'width' : 0x16, 'height' : 0x17, 33:( 0x800000, 0x980000, 0xbc0000, 0xbe0000, 0xbe0000, 0xbc0000, 0xbc0000, 0x9c0000, 0x9e0000, 0x8f0000, 0x8f8000, 0x87c600, 0x83ef00, 0x81ff80, 0x807f80, 0x803f80, 0x800f00, 0x800000), 34:( 0xbffff8, 0xfffffc, 0xf8001c, 0xf8001c, 0xf8001c, 0xc8001c, 0xc8001c, 0xf8001c, 0xf8001c, 0xf8001c, 0xf8001c, 0xbffffc), 35:( 0x800f06, 0x80ff9e, 0x87fff8, 0x9ffce0, 0x9ffc60, 0xbffce0, 0xbfffc0, 0xbfffc0, 0xbfff80, 0x9ffc00, 0x8fe000, 0x878000), 36:( 0x800400, 0x800e00, 0x801e00, 0x801f00, 0x801f00, 0x801f00, 0x801f00, 0x801f00, 0xfffff0, 0x800000, 0x8001c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x8007c0, 0x800780, 0x800380, 0x800100), 37:( 0xff8800, 0xff9800, 0xff3800, 0xff3800, 0xfe7800, 0xfe7800, 0xfcf800, 0xfcf800, 0xf9f800, 0xf9f800, 0xf9f800, 0xfcf800, 0xfcf800, 0xfe7800, 0xfe7800, 0xff3800, 0xff3800, 0xff9800, 0xff9800), 38:( 0xe00000, 0xfc0000, 0xe20000, 0xc70000, 0xcf8000, 0xbfc000, 0x9fe000, 0x8ff000, 0x87f800, 0x83fc00, 0x81fe00, 0x80ff00, 0x807f80, 0x803f80, 0x801f00, 0x800e00, 0x800400), 39:( 0x800000, 0x8f0000, 0x9fc000, 0xb06000, 0xe23000, 0xe79800, 0xe4cc00, 0xe66600, 0xa73300, 0xb39980, 0x99ccc0, 0x8ce660, 0x867330, 0x833918, 0x819c0c, 0x80ce0c, 0x80630c, 0x80318c, 0x801cf8, 0x800e70, 0x800600), 40:( 0x808000, 0x81c000, 0x83e000, 0x87f000, 0x8ff000, 0x9ff800, 0xbffc00, 0xbffe00, 0x83e000, 0x83e000, 0x83e000, 0x83e000, 0x83c000, 0x878000, 0x878000, 0x870000, 0x8e0000, 0x980000, 0xa00000), 41:( 0x808000, 0x81c000, 0x83e000, 0x877000, 0x8e3000, 0x9cb800, 0xbddc00, 0xbbce00, 0x83e000, 0x87f000, 0x8ff800, 0x9ffc00, 0xbffe00, 0x83e000, 0x83e000, 0x83e000, 0x83c000, 0x87c000, 0x8f8000, 0x9e0000, 0xb80000), 42:( 0xa00000, 0x980000, 0x8c0000, 0x870000, 0x878000, 0x878000, 0x83c000, 0x83c000, 0x83e000, 0x83e000, 0x83e000, 0xfffe00, 0xbffc00, 0x9ff800, 0x8ff800, 0x87f000, 0x83e000, 0x81c000, 0x808000), 43:( 0xf00000, 0xf80000, 0xf80000, 0xfc0000, 0xfc0000, 0xfc0000, 0xfe0fe0, 0xff3fe0, 0xfffff0, 0xfffff0, 0xfffff0, 0xfffff0, 0xff3fe0, 0xfe0fe0, 0xfc0000, 0xfc0000, 0xfc0000, 0xf80000, 0xf80000, 0xf00000), 44:( 0xfc0000, 0xfc0000, 0xfe0000, 0xfe0fc0, 0xffbfe0, 0xffffe0, 0xffffe0, 0xffffe0, 0xff3fc0, 0xfe0f80, 0xfe0000, 0xfc0000, 0xfc1e00, 0xf9ff00, 0xf9ff00, 0x83ff00, 0xff3f00, 0xfe0000, 0xfe0000, 0xfc0000, 0xfc0000), 45:( 0xfc0000, 0xfc0000, 0xfe0000, 0xfe07c0, 0xff1ff0, 0xfffff0, 0xfffff0, 0xfffff0, 0xfffff0, 0xfffff0, 0xff1fe0, 0xfe07c0, 0xfe0000, 0xfc3000, 0xfc3000, 0xf83000, 0xf9fe00, 0x81fe00, 0x803000, 0x803000, 0x803000), 46:( 0xbfff80, 0xffffc0, 0xe000c0, 0xe000c0, 0xe6ecc0, 0xe6ecc0, 0xe6ecc0, 0xe6ecc0, 0xe6ecc0, 0xe6ecc0, 0xe000c0, 0xe000c0, 0xe230c0, 0xe3f8c0, 0xe3f8c0, 0xe278c0, 0xe200c0, 0xe000c0, 0xe000c0, 0xffffc0, 0xbfff80), 47:( 0xfffe00, 0xfffe00, 0xe00600, 0xe00600, 0xe00600, 0xe00200, 0xe1c200, 0xe07000, 0xe03800, 0xe03800, 0xe01c00, 0xe01c00, 0xe01c00, 0xe01e00, 0xe1ffc0, 0xe0ff80, 0xf87f00, 0xfc3e00, 0x801e00, 0x801c00, 0x800800), 48:( 0x803e00, 0x81ff00, 0x87ff80, 0x8fe1c0, 0xbfc1c0, 0xffc1c0, 0x9fc1c0, 0x8fe3c0, 0x83ff80, 0x80ff00, 0x801c00), 49:( 0xfffe00, 0xfffe00, 0xb00300, 0x900180, 0x980080, 0x8fffc0, 0x8800c0, 0x980180, 0xb00100, 0xa00300, 0xfffe00, 0xa00300, 0xb00100, 0x980180, 0x9800c0, 0x8fffc0, 0x9800c0, 0x980180, 0xb00100, 0xa00300, 0xfffe00), 50:( 0x80fc00, 0x83ff00, 0x8f8780, 0x9e01c0, 0x9c00e0, 0xb80070, 0xb3c030, 0xf1f038, 0xe1f818, 0xe1cc18, 0xe0c418, 0xe0c618, 0xe07218, 0xf01e30, 0xb00730, 0xb80070, 0x9c00e0, 0x8f03c0, 0x87ff80, 0x81fe00), 51:( 0x802000, 0x802000, 0x803000, 0x803000, 0x803800, 0x803800, 0x807c00, 0x807c00, 0x83fe00, 0xbffe00, 0x8e0f00, 0x878700, 0x81e380, 0x8071c0, 0x801cc0, 0x800760, 0x8001e0, 0x800060, 0x800000), 52:( 0x81f800, 0x87fe00, 0x8e2380, 0x9c21c0, 0x9820c0, 0xb02060, 0xa00020, 0xe00030, 0xfe03f0, 0xfe03f0, 0xe00030, 0xa00020, 0xb02060, 0xb020e0, 0x9821c0, 0x8e2380, 0x87ff00, 0x81fc00), 53:( 0x807000, 0x80f800, 0x80fc00, 0x80fc00, 0x80fc00, 0x80fc00, 0x81dc00, 0x818e00, 0x838e00, 0x870700, 0x860380, 0xbe03e0, 0xfe03f0, 0xfe03f0, 0xfe03f0, 0xbe03f0, 0x9c01e0), 54:( 0x807800, 0x80fc00, 0x81fe00, 0x83fe00, 0x87ff00, 0x8fff00, 0x9ffe00, 0xbffe00, 0xbffc00, 0xfffc00, 0xbffe00, 0x9ffe00, 0x8ffe00, 0x87ff00, 0x83ff00, 0x81fe00, 0x80fe00, 0x807c00, 0x800000), 55:( 0x800000, 0x800800, 0x801800, 0x803800, 0xb83800, 0x9ff800, 0x8ff800, 0x87fe00, 0x87ffc0, 0x83fff0, 0x87ff80, 0x8ffc00, 0x9ff800, 0x9f7800, 0xb03800, 0x801800, 0x801800, 0x800800, 0x800000), 56:( 0x8ff000, 0x8ff000, 0x8ff000, 0x8ff000, 0x800000, 0x8ff000, 0x9ff000, 0x9ff800, 0xbffc00, 0xfffe00, 0xffffc0, 0xffffe0, 0xffffe0, 0xfff800, 0xfff800, 0xfff800, 0xbff800, 0xbff800, 0x9ff000), 57:( 0x87fc00, 0x8ffe00, 0x8ffe00, 0xfffe00, 0xbffe00, 0x9ffe00, 0x8f0000, 0x8f3fe0, 0x8f3ff0, 0x8f3ff0, 0x8f3ff0, 0x8f3ff0, 0x8f3ff0, 0x873ff0, 0x803ff0, 0x807ff0, 0x80fff0, 0x81fff0, 0x803ff0, 0x803ff0, 0x803ff0), 58:( 0x87fe00, 0x87ff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x9fff00, 0xbfff00, 0xffff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x8fff00, 0x87ff00, 0x87fe00), 59:( 0xc03800, 0xc0fc00, 0xe0fc00, 0xb0fc00, 0x9dfc00, 0x8ffc00, 0x83f800, 0x800000, 0x800000, 0xc07800, 0xc0fc00, 0xe0fc00, 0xb0fc00, 0x9ffc00, 0x8ff800, 0x83f000, 0x800000, 0x800000, 0x800000), 60:( 0x83e000, 0x83f400, 0xc3f400, 0xfff400, 0xfff600, 0xe1f600, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe077c0, 0xe07600, 0xe3f600, 0xfff600, 0xfff400, 0x83f400, 0x83f400, 0x83e000), 61:( 0x800000, 0x881f00, 0x9fffc0, 0xb7ffe0, 0xb1fff0, 0xb5fff8, 0xb6fff0, 0xb6fff0, 0xb37ff0, 0x937ff0, 0x907fe0, 0x983fc0, 0x883f80, 0x8c3e00, 0x863800, 0x833000, 0x81e000, 0x80e000), 62:( 0x9e0000, 0xbf0000, 0xf38000, 0xe1c000, 0xe0e000, 0xf07000, 0xb83800, 0x999800, 0x839800, 0x833b00, 0x838380, 0x81c1c0, 0x80e0c0, 0x8070c0, 0x8039c0, 0x801f80, 0x800f00), 63:( 0x800180, 0x801f80, 0x81ff80, 0x9fffc0, 0xbf7fe0, 0xb03fe0, 0x801fe0, 0x801fe0, 0x801fc0, 0x801f80, 0x803f00, 0x807e00, 0x807e00, 0x807e00, 0x803e00, 0x801e00, 0x800e00, 0x800300, 0x800100), 64:( 0x820800, 0x873800, 0x87fc00, 0x87fc00, 0xbfff80, 0xff1fc0, 0xfe0fc0, 0xbc0780, 0x9c0700, 0xbc0700, 0xbc0780, 0xfe0fc0, 0xff1fc0, 0x8fff00, 0x87fc00, 0x87fc00, 0x831800, 0x820800), 65:( 0x9c0000, 0xbe0000, 0xbf0000, 0xff8000, 0xbfc000, 0x9fe000, 0x8ff000, 0x87d800, 0x83cc00, 0x81cf80, 0x80ffc0, 0x807fe0, 0x803ff0, 0x803fd0, 0x803f10, 0x801e30, 0x801e60, 0x800ec0, 0x800780), 66:( 0x8003c0, 0x8007c0, 0x800c40, 0x801840, 0x8033c0, 0xb07fe0, 0xf07f30, 0xf8ff30, 0xffff10, 0xfffe10, 0xffff10, 0xf9ff10, 0xf0ff30, 0xb07fe0, 0x8037c0, 0x803040, 0x801c40, 0x800fc0, 0x8003c0), 67:( 0x818000, 0x83c000, 0x87e000, 0x9fe000, 0xbff000, 0xfff800, 0xbffc00, 0xbffc00, 0x9ffe00, 0x8fff00, 0x8fff00, 0x87ff80, 0x83ff80, 0x81f180, 0x81f180, 0x80f700, 0x807e00, 0x800d00, 0x8000c0, 0x80007c, 0x800000), 68:( 0xbffc00, 0xfffe00, 0xfffe00, 0xfffe00, 0xfffe00, 0xff3f00, 0xf80fc0, 0xf087c0, 0xf3e7c0, 0xe7f3c0, 0xe7f3c0, 0xe7e3c0, 0xe3e3c0, 0xf1c7c0, 0xf80fc0, 0xfe3f00, 0xfffe00, 0xfffe00, 0xffe600, 0xfffe00, 0xbffc00), 69:( 0x820000, 0x840000, 0x8c0000, 0x9c0000, 0x9c0000, 0xbc0000, 0xbc0000, 0xbc0000, 0xbc0000, 0xbe0000, 0xbf0000, 0x9f8000, 0x9fc000, 0x8ff060, 0x87ffc0, 0x83ff80, 0x81fe00, 0x800000), 70:( 0x83c000, 0x8ff000, 0x9ffc00, 0xbffe00, 0xbfff00, 0xffff00, 0xffff80, 0xffff80, 0xffff80, 0xffff80, 0xf8ff80, 0xf8ff80, 0xb8ff80, 0xbfff80, 0x9fff80, 0x9c7f00, 0x803f00, 0x803f00, 0x803e00, 0x803c00, 0x803000), 71:( 0xb00000, 0xb8e000, 0x9c7800, 0x863c00, 0x831e00, 0x878f00, 0x87cf00, 0x87e780, 0x87e780, 0x87f780, 0x87f380, 0x87fb80, 0x83fb80, 0x81ff80, 0x807f80, 0x801f80, 0x800780, 0x800380, 0x800180, 0x800000, 0x800000), 72:( 0x980000, 0xbe0000, 0xbe0000, 0xbf0000, 0xbf0000, 0xbf0000, 0x9ffff8, 0x8ffff8, 0x8000f0, 0x8000e0, 0x8001c0, 0x801f00, 0x800000, 0x800000, 0x800000), 73:( 0x800f00, 0x83ff80, 0xfffe80, 0xfffec0, 0xfffe40, 0xffe640, 0xff8640, 0xff3e40, 0xfe7e40, 0xfe7e40, 0xfe3e40, 0xff0640, 0xffc640, 0xfffe40, 0xfffe40, 0xfffec0, 0x9fff80, 0x803f00), 74:( 0x810400, 0x81dc00, 0x81fc00, 0x80f800, 0x807000, 0x807000, 0xe07070, 0xfe73f0, 0xbfffe0, 0x8fff80, 0x87fe00, 0x81fc00, 0x807000, 0x807000, 0x807000, 0x807000, 0x807000, 0x807000, 0x807000, 0x807000, 0x802000), 75:( 0x80f800, 0x87de00, 0x8e0380, 0x9e03c0, 0xbfffe0, 0xbf8fe0, 0xee03b0, 0xc60310, 0xc40110, 0xc40110, 0xc40110, 0xc40110, 0xc60330, 0xbf07f0, 0xbfffe0, 0x9f77c0, 0x8e03c0, 0x860300, 0x83fe00, 0x802000), 76:( 0x87c060, 0x9ff090, 0xbc7890, 0xb018f0, 0xf03e00, 0xe0ff80, 0xe1ffc0, 0xe3cce0, 0xf39c70, 0xb73830, 0xbf7830, 0x9ff030, 0x87c030, 0x870030, 0x830070, 0x838060, 0x81c1e0, 0x80ffc0, 0x807f80), 77:( 0x860000, 0x8f0000, 0x9f8000, 0x9fc000, 0xbfe000, 0xbfe000, 0xf0f000, 0xe03000, 0xc63000, 0xcf1000, 0xcf9000, 0xcc1000, 0xc41000, 0xe03000, 0xf07000, 0xbfe000, 0xbfe000, 0x9fc000, 0x9fc000, 0x8f8000, 0x870000), 78:( 0x80f800, 0x87fe00, 0x8f8f80, 0x9c01c0, 0xb800e0, 0xb00060, 0xf00070, 0xe00030, 0xe00030, 0xe03f30, 0xe07f30, 0xe0c030, 0xf18070, 0xb00060, 0xb800e0, 0x9c01c0, 0x8e0380, 0x87ff00, 0x83fe00), 79:( 0x807c00, 0x80fc00, 0x818000, 0xe30000, 0xe37cf8, 0xe37cfc, 0xfe7cfc, 0xff7cfc, 0xe37cfc, 0xe33cf8, 0xe10000, 0x818000, 0x80fc00, 0x803c00), 80:( 0xbfff80, 0xffffc0, 0xe00fc0, 0xe00f00, 0xe00f70, 0xe00f70, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00fc0, 0xe00f70, 0xe00f70, 0xe00f00, 0xe00fc0, 0xffffc0, 0xbfff80), 81:( 0x801000, 0xa03800, 0x983c00, 0x8e7e00, 0x87ff80, 0x83f3c0, 0x81e060, 0x80e010, 0x800000), 82:( 0x9e00f0, 0xb301b8, 0xb88248, 0xf8444c, 0xfc784c, 0xfe1044, 0xfe1044, 0xfc7844, 0xf8c44c, 0xb98248, 0xb301b8, 0x9e00f0), 83:( 0xb83180, 0xfc3180, 0xfc3180, 0xfc7180, 0xb87380, 0x80e380, 0x81c700, 0x87c700, 0xbf8e00, 0xfe1c00, 0xf83c00, 0x80f800, 0x83f000, 0xffc000, 0xff8000, 0xfc0000), 84:( 0x800400, 0x800e00, 0x800700, 0x802300, 0x807380, 0x803180, 0x813980, 0x8318c0, 0xb19cc0, 0xf98cc0, 0xf98cc0, 0xf98cc0, 0x939cc0, 0x8318c0, 0x813980, 0x803180, 0x807380, 0x802300, 0x800700, 0x800600, 0x800000), 85:( 0x9ff800, 0xbff800, 0xbff800, 0xbfff00, 0xffffc0, 0xfff8e0, 0xfff860, 0xfff860, 0xfff860, 0xffffe0, 0xffffc0, 0xbfff00, 0xbff800, 0xbff800, 0x9ff000), 86:( 0xbff000, 0xbff800, 0xfff800, 0xfff980, 0xfff9e0, 0xfff8f0, 0xfff830, 0xfff830, 0xfff830, 0xfffff0, 0xffffe0, 0xffff80, 0xfff800, 0xbff800, 0xbff000), 87:( 0x818000, 0x878000, 0x8f8000, 0x9f0000, 0xbc0000, 0xfc0000, 0xbe0000, 0x9f8000, 0x87e000, 0x81f000, 0x80fc00, 0x803e00, 0x801f00, 0x800700), 88:( 0xe03000, 0xf07000, 0xbde000, 0x9fc000, 0x8f8000, 0x8f8000, 0x9fc000, 0xbde000, 0xf87000, 0xe03000), 89:( 0x81f000, 0x87fc00, 0x8ffe00, 0x9fff00, 0xbfbf80, 0xbfbf80, 0xffbfc0, 0xffbfc0, 0xffbfc0, 0xffbfc0, 0xffbfc0, 0xffbfc0, 0xbfbf80, 0xbfbf80, 0x9fff00, 0x8ffe00, 0x87fc00, 0x81f000), 90:( 0x80f800, 0x83fe00, 0x8fff80, 0x9fffc0, 0x9f8fc0, 0xbf8fe0, 0xbf8fe0, 0xbf8fe0, 0xb800e0, 0xb800e0, 0xbf8fe0, 0xbf8fe0, 0xbf8fe0, 0x9f8fc0, 0x9fffc0, 0x8fff80, 0x83fe00, 0x80f800), 91:( 0x81f000, 0x87fe00, 0x8fff00, 0x9fff80, 0xbdf380, 0xb8e1c0, 0xfc43c0, 0xfe07c0, 0xff0fe0, 0xfe0fe0, 0xfc07e0, 0xf863c0, 0xb8f3c0, 0xbdff80, 0x9fff80, 0x8fff00, 0x87fc00, 0x80f000), 92:( 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000, 0xe00000), 93:( 0x830000, 0x830000, 0x830000, 0x830000, 0x830000, 0xfff800, 0xfff800, 0x830000, 0x830000, 0x830000, 0x830000, 0x830000), 94:( 0x81f800, 0x87ff00, 0x8fdf80, 0x9e03c0, 0xbc00e0, 0xb60060, 0xf30070, 0xe18030, 0xe0c030, 0xe06030, 0xe03030, 0xe01830, 0xf00c70, 0xf00670, 0xb803e0, 0x9c01c0, 0x9f07c0, 0x87ff80, 0x83fe00), 95:( 0x802000, 0x801000, 0xfe1800, 0xfff800, 0xfffc00, 0xbffc38, 0xb7fc7c, 0x987e7c, 0x88003c, 0x880018), 96:( 0x80f800, 0x83fe00, 0x8fff80, 0x9fffc0, 0x9fffe0, 0xbfffe0, 0xbffff0, 0xfbdff0, 0xf80ff0, 0xf80c70, 0xf90c70, 0xfdfc70, 0xfffff0, 0xbffff0, 0xbfffe0, 0x9fffc0, 0x8fffc0, 0x87ff00, 0x83fe00, 0x802000), 97:( 0x800380, 0x8003c0, 0x8003e0, 0x8003f0, 0xf9c070, 0xf9e070, 0xf9f070, 0xb8f870, 0x803df0, 0x801fe0, 0x801fe0, 0x800fc0), 98:( 0x80f800, 0x83fe00, 0x8fff80, 0x9fffc0, 0x9fffc0, 0xbfffe0, 0xbff9e0, 0xfff8f0, 0xf9fcf0, 0xf89cf0, 0xf98cf0, 0xffc0f0, 0xffe1f0, 0xbffbe0, 0xbfffe0, 0x9fffc0, 0x8fff80, 0x87ff00, 0x83fe00, 0x802000), 99:( 0xc00000, 0xf00000, 0xfc0000, 0xfe0000, 0xff8000, 0xffe000, 0xfff800, 0xfffc00, 0xffff00, 0xec0fc0, 0xec0fc0, 0xffff80, 0xfffe00, 0xfff800, 0xfff000, 0xffc000, 0xff0000, 0xfe0000, 0xf80000, 0xe00000), 100:( 0x81f000, 0x87fc00, 0x9f1e00, 0x9c0700, 0xb80380, 0xf001c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xf001c0, 0xb04180, 0xa0c380, 0x81cf00, 0x83fe00, 0x83f800, 0x81c000, 0x80c000, 0x804000), 101:( 0x804000, 0x80c000, 0x81c000, 0x83f800, 0x83fe00, 0x81cf00, 0xa0c380, 0xb04180, 0xf001c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xe000c0, 0xf001c0, 0xb80380, 0x9c0700, 0x8f1e00, 0x87fc00, 0x81f000), 102:( 0x8e0380, 0x8e0380, 0x8e0380, 0x8e0380, 0x8f0780, 0x870f00, 0x878700, 0x83e000, 0x81f000, 0x80f800, 0x823c00, 0x831e00, 0x878f00, 0x8f0700, 0x8e0380, 0x8e0380, 0x8e8380, 0xbf0fe0, 0x9f07c0, 0x8e0380, 0x840100), 103:( 0x802000, 0xf07000, 0xf0f800, 0xf1f800, 0xf3fc00, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xf07000, 0xfff000, 0xfff000, 0xbfe000), 104:( 0x800000, 0x802000, 0x803000, 0xfff800, 0xfffc00, 0xfff000, 0xf02000, 0xf04000, 0xf00000, 0xf00400, 0xf01c00, 0xe01c00, 0xc01c00, 0x801c00, 0x881c00, 0x981c00, 0xbffc00, 0xfffc00, 0xbff800, 0x880000, 0x880000), 105:( 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000), 106:( 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0xe33000, 0x800000, 0x800000, 0x800000, 0x830000, 0x830000, 0x830000, 0x830000, 0xfff000, 0xfff000, 0x830000, 0x830000, 0x830000, 0x830000), 107:( 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0x800000, 0x800000, 0xb83800, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xbc7800), 108:( 0xbfffe0, 0xfffff0, 0xe00030, 0xe00030, 0xe63330, 0xe63330, 0xe63330, 0xe63330, 0xe63330, 0xe63330, 0xe00030, 0xe00030, 0xe00030, 0xfffff0, 0xbfffe0), 109:( 0xbfffe0, 0xfffff0, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xe00030, 0xfffff0, 0xbfffe0), 110:( 0x87fff0, 0x87fff0, 0x860030, 0x860030, 0xffff30, 0xffff30, 0xe00330, 0xe00330, 0xe003f0, 0xe003f0, 0xe003e0, 0xe00300, 0xe00300, 0xffff00, 0xffff00), 111:( 0xbffe00, 0xffff00, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xe00300, 0xffff00, 0xbffe00), 112:( 0x800600, 0x803e00, 0x80ff00, 0x800700, 0xfff380, 0xfff380, 0xfff380, 0xe1f3c0, 0xe073c0, 0xe0f3c0, 0xe3f1e0, 0xe3f0e0, 0xe1f0e0, 0xe1f070, 0xe0f0f0, 0xe073f0, 0xe073c0, 0xe07300, 0xe1f000, 0xfff000, 0xfff000), 113:( 0xe63300, 0xe63300, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xf80f00, 0xfc1f00, 0xfe3f00, 0xfe3f00, 0xff7f00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xe63300, 0xe63300), 114:( 0xbfffe0, 0xfffff0, 0xfffff0, 0xfffff0, 0xf8fff0, 0xf8fff0, 0xf8fff0, 0xf800f0, 0xfc00f0, 0xfff3f0, 0xffc7f0, 0xfffff0, 0xfffff0, 0xfffff0, 0xbfffe0), 115:( 0x81f000, 0xfff800, 0xfffb80, 0xfffbc0, 0xfffbc0, 0xfffbc0, 0xfffbc0, 0xfffbc0, 0xfffb80, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffb00, 0xfffa00, 0x8ff000), 116:( 0x803800, 0x8ffc00, 0xfff800, 0xfffb00, 0xfffb00, 0xfffb40, 0xfe3b40, 0xfe3b40, 0xfefb40, 0xfefb40, 0xfefb40, 0xfefb40, 0xfefb40, 0xfe3b40, 0xff3b40, 0xfffb40, 0xfffb00, 0xfffb00, 0xfff800, 0x87fc00, 0x801800), 117:( 0x800f00, 0x9fff80, 0xbffc80, 0xfffcc0, 0xfffcc0, 0xfffc40, 0xfffc40, 0xfffc40, 0xfffc40, 0xfffcc0, 0xfffcc0, 0xbffcc0, 0xbfff80, 0x80ff80, 0x800000), 118:( 0x9e0000, 0xff0000, 0xff0000, 0xff8000, 0xfec000, 0xfe4400, 0xfe0200, 0xf00300, 0xf07f80, 0xf07fc0, 0xf07fe0, 0xf07fc0, 0xf07f80, 0xf00300, 0xfc0300, 0xfe4200, 0xfec000, 0xfe8000, 0xff8000, 0xff0000, 0xbe0000), 119:( 0xbe0000, 0xff0000, 0xff0000, 0xfd8000, 0xfc8000, 0xfc0400, 0xfc0c00, 0xf01c00, 0xf03fe0, 0xf07fe0, 0xf07fe0, 0xf07fe0, 0xf03fe0, 0xf01c00, 0xfc0c00, 0xfc8400, 0xfc8000, 0xfd8000, 0xff0000, 0xfe0000, 0x9e0000), 120:( 0x8f8000, 0xbfe000, 0xf1fc00, 0xe1ff00, 0xe1ff80, 0xe1f780, 0xe1e780, 0xe1e000, 0xe1c000, 0xe18000, 0xe1c000, 0xe1c000, 0xe1e780, 0xe1f780, 0xe1ff80, 0xe1ff00, 0xe1fc00, 0xbff000, 0x8f8000), 121:( 0x9c0000, 0xfe0000, 0xff0000, 0xff0000, 0xffc000, 0xfff000, 0xfff800, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfff800, 0xfff000, 0xffc000, 0xffc000, 0xffc000, 0xffc000, 0xbf8000, 0x9f0000), 122:( 0x9c0000, 0xbf0000, 0xff0000, 0xff0000, 0xffe000, 0xfff800, 0xfff800, 0xfbfc00, 0xf9fc00, 0x80fe00, 0x803e00, 0x807c00, 0xf9fc00, 0xfbf800, 0xfff000, 0xffe000, 0xffe000, 0xffe000, 0xbfc000, 0xbfc000, 0x8f0000), 123:( 0xfffc00, 0xbffc00, 0xbff800, 0x9ff000, 0x8ff000, 0x8fe000, 0x87e000, 0x87c000, 0x838000, 0x818000, 0x810000), 124:( 0xbfff00, 0xffff00, 0xffff00, 0xbfff00, 0x800000, 0x800000, 0x800000, 0xbffe00, 0xffff00, 0xffff00, 0xbfff00), 125:( 0x83e000, 0x8ff800, 0x9ffc00, 0xbffe00, 0xbffe00, 0xbfff00, 0xffff00, 0xffff00, 0xffff00, 0xbfff00, 0xbffe00, 0x9ffe00, 0x9ffc00, 0x8ff800, 0x83e000), 126:( 0xbffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xfffc00, 0xbffc00), 174:( 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0x800000, 0x800000, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00, 0xfc7c00), 196:( 0xfff800, 0xfff000, 0xbff000, 0x9fe000, 0x9fc000, 0x8fc000, 0x878000, 0x870000, 0x830000, 0xfff800, 0xfff800, 0xbff000, 0x9fe000, 0x9fe000, 0x8fc000, 0x878000, 0x878000, 0x830000, 0x800000), 197:( 0x820000, 0x830000, 0x878000, 0x8f8000, 0x8fc000, 0x9fe000, 0xbfe000, 0xbff000, 0xfff800, 0x800000, 0x830000, 0x870000, 0x878000, 0x8fc000, 0x9fe000, 0xbfe000, 0xbff000, 0xfff800, 0xfff000), 199:( 0xfff800, 0xfff800, 0xfff800, 0x800000, 0x830000, 0x870000, 0x878000, 0x8fc000, 0x8fc000, 0x9fe000, 0xbfe000, 0xbff000, 0xbff000), 201:( 0xbff000, 0xbff000, 0x9fe000, 0x9fe000, 0x8fc000, 0x8f8000, 0x878000, 0x830000, 0x830000, 0xbff000, 0xfff800, 0xfff800, 0xfff800), 209:( 0xfe0000, 0xfc0000, 0xfc0000, 0xfe0000, 0xaf0000, 0x870000, 0x820000, 0x800000, 0x800000, 0x800000, 0x800c00, 0x801e40, 0x801fc0, 0x800fc0, 0x8007c0, 0x8007c0, 0x800fc0), 214:( 0x900000, 0xb80000, 0xfd0000, 0xbf0000, 0x9f0000, 0x8f0000, 0x9f0000, 0x800000, 0x800000, 0x800000, 0x801f80, 0x801f00, 0x801e00, 0x801f80, 0x801fc0, 0x8013c0, 0x800180), 220:( 0xc00000, 0xe00000, 0xe00000, 0xf00000, 0xf00000, 0xf80000, 0xfc0000, 0xfc0000, 0xfe0000, 0xfe0000, 0xff0000, 0xff0000, 0xff8000, 0xffc000, 0xffc000, 0xffe000, 0xffe000, 0xfff000, 0xbff000), 224:( 0xe00000, 0xf00000, 0xb9e000, 0x9cfc00, 0x8e7f00, 0x873f80, 0x939fc0, 0x99c8c0, 0x9ce080, 0x9e7180, 0x9f3900, 0x9f9c00, 0x9f0e00, 0x8f0700, 0x8e3380, 0x87e1c0, 0x83c0e0, 0x800070, 0x800020), 225:( 0x800000, 0x800000, 0x800000, 0x80f800, 0x83fe00, 0x87ff80, 0x87ffc0, 0x8fffe0, 0x8ffe60, 0x8ff860, 0x8ff040, 0x8fe0c0, 0x87c198, 0x87c31e, 0x87860e, 0x838c02, 0x81f860, 0x81e070, 0x800338, 0x800318, 0x800380, 0x800180), 226:( 0x808000, 0x81c000, 0x83e000, 0x87f000, 0x8ff800, 0x9ffc00, 0xbffe00, 0xffff80, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800), 227:( 0x800000, 0x808000, 0x80c000, 0x80e000, 0xfff000, 0xfff800, 0xfffc00, 0xfffe00, 0xffff00, 0xfffe00, 0xfffc00, 0xfff800, 0x80f000, 0x80e000, 0x80c000, 0x808000), 228:( 0x808000, 0x818000, 0x838000, 0x878000, 0x8fff00, 0x9fff00, 0xbfff00, 0xffff00, 0xffff00, 0xbfff00, 0x9fff00, 0x8fff00, 0x878000, 0x838000, 0x818000, 0x808000), 229:( 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0x87f800, 0xffff80, 0xbfff00, 0x9ffe00, 0x8ffc00, 0x87f800, 0x83f000, 0x81e000, 0x80c000), 231:( 0x800000, 0x818000, 0x83c000, 0x87e000, 0x8ff000, 0x9ff800, 0xbff800, 0xfffc00, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000), 232:( 0x808000, 0x80c000, 0x80e000, 0x80f000, 0xfff800, 0xfffc00, 0xfffe00, 0xffff00, 0xfffc00, 0xfff800, 0x80f000, 0x80e000, 0x80c000, 0x808000), 233:( 0x808000, 0x818000, 0x838000, 0x878000, 0x8fff00, 0xbfff00, 0xffff00, 0xffff00, 0xbfff00, 0x9fff00, 0x878000, 0x838000, 0x818000, 0x808000), 234:( 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0x87e000, 0xfffe00, 0xbffc00, 0x9ff800, 0x8ff000, 0x87f000, 0x83e000, 0x83c000, 0x818000), 235:( 0x80fc00, 0x83ff00, 0x8f8780, 0x9e01c0, 0xb800e0, 0xb00060, 0xf03070, 0xe07830, 0xe0fc30, 0xe3fe30, 0xe07830, 0xe07830, 0xf07870, 0xb07860, 0xb800e0, 0x9c01c0, 0x8e03c0, 0x87ff80, 0x81fe00), 236:( 0x80f800, 0x87fe00, 0x8f8f80, 0x9c01c0, 0xb800e0, 0xb00060, 0xf01070, 0xe01830, 0xe3fc30, 0xe3fe30, 0xe3fc30, 0xe3f830, 0xf01070, 0xb02060, 0xb800e0, 0x9c01c0, 0x8e0380, 0x87ff00, 0x83fe00), 237:( 0x80f800, 0x87fe00, 0x8f8f80, 0x9c01c0, 0xb800e0, 0xb00060, 0xf04070, 0xe0c030, 0xe1fe30, 0xe3fe30, 0xe1fe30, 0xe0fe30, 0xf04070, 0xb04060, 0xb800e0, 0x9c01c0, 0x8e0380, 0x87ff00, 0x83fe00), 238:( 0x80fc00, 0x83ff00, 0x8f8780, 0x9e01c0, 0xb800e0, 0xb00060, 0xf07870, 0xe07830, 0xe07830, 0xe07a30, 0xe1fc30, 0xe0f830, 0xf07070, 0xb02060, 0xb800e0, 0x9c01c0, 0x8e03c0, 0x87ff80, 0x81fe00), 239:( 0x808000, 0x80c000, 0xffe000, 0xfff000, 0xfff800, 0xfffc00, 0xfffe00, 0x80ff00, 0x80ff80, 0x80ffc0, 0x80ffc0, 0x80ff80, 0xffff00, 0xfffe00, 0xfffc00, 0xfff800, 0xfff000, 0x80e000, 0x80c000), 241:( 0xfffff0, 0xbffff0, 0x9ffff0, 0x8ffff0, 0x8ffff0, 0x9ffff0, 0xbffff0, 0xfffff0), 242:( 0xbf8000, 0xff8000, 0xe00000, 0xe00000, 0xe3ff80, 0xe7ffc0, 0xe600c0, 0xe600c0, 0xe600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x87ffc0, 0x83ff80), 243:( 0x87fff0, 0x8ffff0, 0x8c0070, 0x98c460, 0x988c60, 0x9188c0, 0xb118c0, 0xb001c0, 0xffff80, 0xffff80, 0xffff80, 0xb00180, 0xb118c0, 0x9188c0, 0x988c60, 0x98c460, 0x8c0060, 0x8ffff0, 0x87fff0), 244:( 0x807c00, 0x80ff00, 0x81c780, 0x830180, 0x8701c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x8600c0, 0x830180, 0x878380, 0x8fff00, 0x9ffe00, 0xbe0000, 0xbc0000, 0xb80000, 0x900000), 246:( 0xb80000, 0xbc0000, 0xfc0000, 0xbc0000, 0x980000, 0x800000, 0x800000, 0x900000, 0xbc0000, 0xfc0000, 0xbc0000, 0xb80000, 0x800000, 0x800000, 0x800000, 0xb80000, 0xfc0000, 0xfc0000, 0xbc0000) }
class AndroidKey: # Key code constant: Unknown key code. UNKNOWN = 0 # Key code constant: Soft Left key. # Usually situated below the display on phones and used as a multi-function # feature key for selecting a software defined function shown on the bottom left # of the display. SOFT_LEFT = 1 # Key code constant: Soft Right key. # Usually situated below the display on phones and used as a multi-function # feature key for selecting a software defined function shown on the bottom right # of the display. SOFT_RIGHT = 2 # Key code constant: Home key. # This key is handled by the framework and is never delivered to applications. HOME = 3 # Key code constant: Back key. BACK = 4 # Key code constant: Call key. CALL = 5 # Key code constant: End Call key. ENDCALL = 6 # Key code constant: '0' key. DIGIT_0 = 7 # Key code constant: '1' key. DIGIT_1 = 8 # Key code constant: '2' key. DIGIT_2 = 9 # Key code constant: '3' key. DIGIT_3 = 10 # Key code constant: '4' key. DIGIT_4 = 11 # Key code constant: '5' key. DIGIT_5 = 12 # Key code constant: '6' key. DIGIT_6 = 13 # Key code constant: '7' key. DIGIT_7 = 14 # Key code constant: '8' key. DIGIT_8 = 15 # Key code constant: '9' key. DIGIT_9 = 16 # Key code constant: '*' key. STAR = 17 # Key code constant: '#' key. POUND = 18 # Key code constant: Directional Pad Up key. # May also be synthesized from trackball motions. DPAD_UP = 19 # Key code constant: Directional Pad Down key. # May also be synthesized from trackball motions. DPAD_DOWN = 20 # Key code constant: Directional Pad Left key. # May also be synthesized from trackball motions. DPAD_LEFT = 21 # Key code constant: Directional Pad Right key. # May also be synthesized from trackball motions. DPAD_RIGHT = 22 # Key code constant: Directional Pad Center key. # May also be synthesized from trackball motions. DPAD_CENTER = 23 # Key code constant: Volume Up key. # Adjusts the speaker volume up. VOLUME_UP = 24 # Key code constant: Volume Down key. # Adjusts the speaker volume down. VOLUME_DOWN = 25 # Key code constant: Power key. POWER = 26 # Key code constant: Camera key. # Used to launch a camera application or take pictures. CAMERA = 27 # Key code constant: Clear key. CLEAR = 28 # Key code constant: 'A' key. A = 29 # Key code constant: 'B' key. B = 30 # Key code constant: 'C' key. C = 31 # Key code constant: 'D' key. D = 32 # Key code constant: 'E' key. E = 33 # Key code constant: 'F' key. F = 34 # Key code constant: 'G' key. G = 35 # Key code constant: 'H' key. H = 36 # Key code constant: 'I' key. I = 37 # Key code constant: 'J' key. J = 38 # Key code constant: 'K' key. K = 39 # Key code constant: 'L' key. L = 40 # Key code constant: 'M' key. M = 41 # Key code constant: 'N' key. N = 42 # Key code constant: 'O' key. O = 43 # Key code constant: 'P' key. P = 44 # Key code constant: 'Q' key. Q = 45 # Key code constant: 'R' key. R = 46 # Key code constant: 'S' key. S = 47 # Key code constant: 'T' key. T = 48 # Key code constant: 'U' key. U = 49 # Key code constant: 'V' key. V = 50 # Key code constant: 'W' key. W = 51 # Key code constant: 'X' key. X = 52 # Key code constant: 'Y' key. Y = 53 # Key code constant: 'Z' key. Z = 54 # Key code constant: ',' key. COMMA = 55 # Key code constant: '.' key. PERIOD = 56 # Key code constant: Left Alt modifier key. ALT_LEFT = 57 # Key code constant: Right Alt modifier key. ALT_RIGHT = 58 # Key code constant: Left Shift modifier key. SHIFT_LEFT = 59 # Key code constant: Right Shift modifier key. SHIFT_RIGHT = 60 # Key code constant: Tab key. TAB = 61 # Key code constant: Space key. SPACE = 62 # Key code constant: Symbol modifier key. # Used to enter alternate symbols. SYM = 63 # Key code constant: Explorer special function key. # Used to launch a browser application. EXPLORER = 64 # Key code constant: Envelope special function key. # Used to launch a mail application. ENVELOPE = 65 # Key code constant: Enter key. ENTER = 66 # Key code constant: Backspace key. # Deletes characters before the insertion point, unlike {@link #FORWARD_DEL}. DEL = 67 # Key code constant: '`' (backtick) key. GRAVE = 68 # Key code constant: '-'. MINUS = 69 # Key code constant: '=' key. EQUALS = 70 # Key code constant: '[' key. LEFT_BRACKET = 71 # Key code constant: ']' key. RIGHT_BRACKET = 72 # Key code constant: '\' key. BACKSLASH = 73 # Key code constant: ';' key. SEMICOLON = 74 # Key code constant: ''' (apostrophe) key. APOSTROPHE = 75 # Key code constant: '/' key. SLASH = 76 # Key code constant: '@' key. AT = 77 # Key code constant: Number modifier key. # Used to enter numeric symbols. # This key is not Num Lock; it is more like {@link #ALT_LEFT} and is # interpreted as an ALT key NUM = 78 # Key code constant: Headset Hook key. # Used to hang up calls and stop media. HEADSETHOOK = 79 # Key code constant: Camera Focus key. # Used to focus the camera. FOCUS = 80 # *Camera* focus # Key code constant: '+' key. PLUS = 81 # Key code constant: Menu key. MENU = 82 # Key code constant: Notification key. NOTIFICATION = 83 # Key code constant: Search key. SEARCH = 84 # Key code constant: Play/Pause media key. MEDIA_PLAY_PAUSE = 85 # Key code constant: Stop media key. MEDIA_STOP = 86 # Key code constant: Play Next media key. MEDIA_NEXT = 87 # Key code constant: Play Previous media key. MEDIA_PREVIOUS = 88 # Key code constant: Rewind media key. MEDIA_REWIND = 89 # Key code constant: Fast Forward media key. MEDIA_FAST_FORWARD = 90 # Key code constant: Mute key. # Mutes the microphone, unlike {@link #VOLUME_MUTE}. MUTE = 91 # Key code constant: Page Up key. PAGE_UP = 92 # Key code constant: Page Down key. PAGE_DOWN = 93 # Key code constant: Picture Symbols modifier key. # Used to switch symbol sets (Emoji, Kao-moji). PICTSYMBOLS = 94 # switch symbol-sets (Emoji,Kao-moji) # Key code constant: Switch Charset modifier key. # Used to switch character sets (Kanji, Katakana). SWITCH_CHARSET = 95 # switch char-sets (Kanji,Katakana) # Key code constant: A Button key. # On a game controller, the A button should be either the button labeled A # or the first button on the bottom row of controller buttons. BUTTON_A = 96 # Key code constant: B Button key. # On a game controller, the B button should be either the button labeled B # or the second button on the bottom row of controller buttons. BUTTON_B = 97 # Key code constant: C Button key. # On a game controller, the C button should be either the button labeled C # or the third button on the bottom row of controller buttons. BUTTON_C = 98 # Key code constant: X Button key. # On a game controller, the X button should be either the button labeled X # or the first button on the upper row of controller buttons. BUTTON_X = 99 # Key code constant: Y Button key. # On a game controller, the Y button should be either the button labeled Y # or the second button on the upper row of controller buttons. BUTTON_Y = 100 # Key code constant: Z Button key. # On a game controller, the Z button should be either the button labeled Z # or the third button on the upper row of controller buttons. BUTTON_Z = 101 # Key code constant: L1 Button key. # On a game controller, the L1 button should be either the button labeled L1 (or L) # or the top left trigger button. BUTTON_L1 = 102 # Key code constant: R1 Button key. # On a game controller, the R1 button should be either the button labeled R1 (or R) # or the top right trigger button. BUTTON_R1 = 103 # Key code constant: L2 Button key. # On a game controller, the L2 button should be either the button labeled L2 # or the bottom left trigger button. BUTTON_L2 = 104 # Key code constant: R2 Button key. # On a game controller, the R2 button should be either the button labeled R2 # or the bottom right trigger button. BUTTON_R2 = 105 # Key code constant: Left Thumb Button key. # On a game controller, the left thumb button indicates that the left (or only) # joystick is pressed. BUTTON_THUMBL = 106 # Key code constant: Right Thumb Button key. # On a game controller, the right thumb button indicates that the right # joystick is pressed. BUTTON_THUMBR = 107 # Key code constant: Start Button key. # On a game controller, the button labeled Start. BUTTON_START = 108 # Key code constant: Select Button key. # On a game controller, the button labeled Select. BUTTON_SELECT = 109 # Key code constant: Mode Button key. # On a game controller, the button labeled Mode. BUTTON_MODE = 110 # Key code constant: Escape key. ESCAPE = 111 # Key code constant: Forward Delete key. # Deletes characters ahead of the insertion point, unlike {@link #DEL}. FORWARD_DEL = 112 # Key code constant: Left Control modifier key. CTRL_LEFT = 113 # Key code constant: Right Control modifier key. CTRL_RIGHT = 114 # Key code constant: Caps Lock key. CAPS_LOCK = 115 # Key code constant: Scroll Lock key. SCROLL_LOCK = 116 # Key code constant: Left Meta modifier key. META_LEFT = 117 # Key code constant: Right Meta modifier key. META_RIGHT = 118 # Key code constant: Function modifier key. FUNCTION = 119 # Key code constant: System Request / Print Screen key. SYSRQ = 120 # Key code constant: Break / Pause key. BREAK = 121 # Key code constant: Home Movement key. # Used for scrolling or moving the cursor around to the start of a line # or to the top of a list. MOVE_HOME = 122 # Key code constant: End Movement key. # Used for scrolling or moving the cursor around to the end of a line # or to the bottom of a list. MOVE_END = 123 # Key code constant: Insert key. # Toggles insert / overwrite edit mode. INSERT = 124 # Key code constant: Forward key. # Navigates forward in the history stack. Complement of {@link #BACK}. FORWARD = 125 # Key code constant: Play media key. MEDIA_PLAY = 126 # Key code constant: Pause media key. MEDIA_PAUSE = 127 # Key code constant: Close media key. # May be used to close a CD tray, for example. MEDIA_CLOSE = 128 # Key code constant: Eject media key. # May be used to eject a CD tray, for example. MEDIA_EJECT = 129 # Key code constant: Record media key. MEDIA_RECORD = 130 # Key code constant: F1 key. F1 = 131 # Key code constant: F2 key. F2 = 132 # Key code constant: F3 key. F3 = 133 # Key code constant: F4 key. F4 = 134 # Key code constant: F5 key. F5 = 135 # Key code constant: F6 key. F6 = 136 # Key code constant: F7 key. F7 = 137 # Key code constant: F8 key. F8 = 138 # Key code constant: F9 key. F9 = 139 # Key code constant: F10 key. F10 = 140 # Key code constant: F11 key. F11 = 141 # Key code constant: F12 key. F12 = 142 # Key code constant: Num Lock key. # This is the Num Lock key; it is different from {@link #NUM}. # This key alters the behavior of other keys on the numeric keypad. NUM_LOCK = 143 # Key code constant: Numeric keypad '0' key. NUMPAD_0 = 144 # Key code constant: Numeric keypad '1' key. NUMPAD_1 = 145 # Key code constant: Numeric keypad '2' key. NUMPAD_2 = 146 # Key code constant: Numeric keypad '3' key. NUMPAD_3 = 147 # Key code constant: Numeric keypad '4' key. NUMPAD_4 = 148 # Key code constant: Numeric keypad '5' key. NUMPAD_5 = 149 # Key code constant: Numeric keypad '6' key. NUMPAD_6 = 150 # Key code constant: Numeric keypad '7' key. NUMPAD_7 = 151 # Key code constant: Numeric keypad '8' key. NUMPAD_8 = 152 # Key code constant: Numeric keypad '9' key. NUMPAD_9 = 153 # Key code constant: Numeric keypad '/' key (for division). NUMPAD_DIVIDE = 154 # Key code constant: Numeric keypad '#' key (for multiplication). NUMPAD_MULTIPLY = 155 # Key code constant: Numeric keypad '-' key (for subtraction). NUMPAD_SUBTRACT = 156 # Key code constant: Numeric keypad '+' key (for addition). NUMPAD_ADD = 157 # Key code constant: Numeric keypad '.' key (for decimals or digit grouping). NUMPAD_DOT = 158 # Key code constant: Numeric keypad ',' key (for decimals or digit grouping). NUMPAD_COMMA = 159 # Key code constant: Numeric keypad Enter key. NUMPAD_ENTER = 160 # Key code constant: Numeric keypad '=' key. NUMPAD_EQUALS = 161 # Key code constant: Numeric keypad '(' key. NUMPAD_LEFT_PAREN = 162 # Key code constant: Numeric keypad ')' key. NUMPAD_RIGHT_PAREN = 163 # Key code constant: Volume Mute key. # Mutes the speaker, unlike {@link #MUTE}. # This key should normally be implemented as a toggle such that the first press # mutes the speaker and the second press restores the original volume. VOLUME_MUTE = 164 # Key code constant: Info key. # Common on TV remotes to show additional information related to what is # currently being viewed. INFO = 165 # Key code constant: Channel up key. # On TV remotes, increments the television channel. CHANNEL_UP = 166 # Key code constant: Channel down key. # On TV remotes, decrements the television channel. CHANNEL_DOWN = 167 # Key code constant: Zoom in key. KEYCODE_ZOOM_IN = 168 # Key code constant: Zoom out key. KEYCODE_ZOOM_OUT = 169 # Key code constant: TV key. # On TV remotes, switches to viewing live TV. TV = 170 # Key code constant: Window key. # On TV remotes, toggles picture-in-picture mode or other windowing functions. WINDOW = 171 # Key code constant: Guide key. # On TV remotes, shows a programming guide. GUIDE = 172 # Key code constant: DVR key. # On some TV remotes, switches to a DVR mode for recorded shows. DVR = 173 # Key code constant: Bookmark key. # On some TV remotes, bookmarks content or web pages. BOOKMARK = 174 # Key code constant: Toggle captions key. # Switches the mode for closed-captioning text, for example during television shows. CAPTIONS = 175 # Key code constant: Settings key. # Starts the system settings activity. SETTINGS = 176 # Key code constant: TV power key. # On TV remotes, toggles the power on a television screen. TV_POWER = 177 # Key code constant: TV input key. # On TV remotes, switches the input on a television screen. TV_INPUT = 178 # Key code constant: Set-top-box power key. # On TV remotes, toggles the power on an external Set-top-box. STB_POWER = 179 # Key code constant: Set-top-box input key. # On TV remotes, switches the input mode on an external Set-top-box. STB_INPUT = 180 # Key code constant: A/V Receiver power key. # On TV remotes, toggles the power on an external A/V Receiver. AVR_POWER = 181 # Key code constant: A/V Receiver input key. # On TV remotes, switches the input mode on an external A/V Receiver. AVR_INPUT = 182 # Key code constant: Red "programmable" key. # On TV remotes, acts as a contextual/programmable key. PROG_RED = 183 # Key code constant: Green "programmable" key. # On TV remotes, actsas a contextual/programmable key. PROG_GREEN = 184 # Key code constant: Yellow "programmable" key. # On TV remotes, acts as a contextual/programmable key. PROG_YELLOW = 185 # Key code constant: Blue "programmable" key. # On TV remotes, acts as a contextual/programmable key. PROG_BLUE = 186 # Key code constant: App switch key. # Should bring up the application switcher dialog. APP_SWITCH = 187 # Key code constant: Generic Game Pad Button #1. BUTTON_1 = 188 # Key code constant: Generic Game Pad Button #2. BUTTON_2 = 189 # Key code constant: Generic Game Pad Button #3. BUTTON_3 = 190 # Key code constant: Generic Game Pad Button #4. BUTTON_4 = 191 # Key code constant: Generic Game Pad Button #5. BUTTON_5 = 192 # Key code constant: Generic Game Pad Button #6. BUTTON_6 = 193 # Key code constant: Generic Game Pad Button #7. BUTTON_7 = 194 # Key code constant: Generic Game Pad Button #8. BUTTON_8 = 195 # Key code constant: Generic Game Pad Button #9. BUTTON_9 = 196 # Key code constant: Generic Game Pad Button #10. BUTTON_10 = 197 # Key code constant: Generic Game Pad Button #11. BUTTON_11 = 198 # Key code constant: Generic Game Pad Button #12. BUTTON_12 = 199 # Key code constant: Generic Game Pad Button #13. BUTTON_13 = 200 # Key code constant: Generic Game Pad Button #14. BUTTON_14 = 201 # Key code constant: Generic Game Pad Button #15. BUTTON_15 = 202 # Key code constant: Generic Game Pad Button #16. BUTTON_16 = 203 # Key code constant: Language Switch key. # Toggles the current input language such as switching between English and Japanese on # a QWERTY keyboard. On some devices, the same function may be performed by # pressing Shift+Spacebar. LANGUAGE_SWITCH = 204 # Key code constant: Manner Mode key. # Toggles silent or vibrate mode on and off to make the device behave more politely # in certain settings such as on a crowded train. On some devices, the key may only # operate when long-pressed. MANNER_MODE = 205 # Key code constant: 3D Mode key. # Toggles the display between 2D and 3D mode. MODE_3D = 206 # Key code constant: Contacts special function key. # Used to launch an address book application. CONTACTS = 207 # Key code constant: Calendar special function key. # Used to launch a calendar application. CALENDAR = 208 # Key code constant: Music special function key. # Used to launch a music player application. MUSIC = 209 # Key code constant: Calculator special function key. # Used to launch a calculator application. CALCULATOR = 210 # Key code constant: Japanese full-width / half-width key. ZENKAKU_HANKAKU = 211 # Key code constant: Japanese alphanumeric key. EISU = 212 # Key code constant: Japanese non-conversion key. MUHENKAN = 213 # Key code constant: Japanese conversion key. HENKAN = 214 # Key code constant: Japanese katakana / hiragana key. KATAKANA_HIRAGANA = 215 # Key code constant: Japanese Yen key. YEN = 216 # Key code constant: Japanese Ro key. RO = 217 # Key code constant: Japanese kana key. KANA = 218 # Key code constant: Assist key. # Launches the global assist activity. Not delivered to applications. ASSIST = 219 # Key code constant: Brightness Down key. # Adjusts the screen brightness down. BRIGHTNESS_DOWN = 220 # Key code constant: Brightness Up key. # Adjusts the screen brightness up. BRIGHTNESS_UP = 221 # Key code constant: Audio Track key. # Switches the audio tracks. MEDIA_AUDIO_TRACK = 222 # Key code constant: Sleep key. # Puts the device to sleep. Behaves somewhat like {@link #POWER} but it # has no effect if the device is already asleep. SLEEP = 223 # Key code constant: Wakeup key. # Wakes up the device. Behaves somewhat like {@link #POWER} but it # has no effect if the device is already awake. WAKEUP = 224 # Key code constant: Pairing key. # Initiates peripheral pairing mode. Useful for pairing remote control # devices or game controllers, especially if no other input mode is # available. PAIRING = 225 # Key code constant: Media Top Menu key. # Goes to the top of media menu. MEDIA_TOP_MENU = 226 # Key code constant: '11' key. KEY_11 = 227 # Key code constant: '12' key. KEY_12 = 228 # Key code constant: Last Channel key. # Goes to the last viewed channel. LAST_CHANNEL = 229 # Key code constant: TV data service key. # Displays data services like weather, sports. TV_DATA_SERVICE = 230 # Key code constant: Voice Assist key. # Launches the global voice assist activity. Not delivered to applications. VOICE_ASSIST = 231 # Key code constant: Radio key. # Toggles TV service / Radio service. TV_RADIO_SERVICE = 232 # Key code constant: Teletext key. # Displays Teletext service. TV_TELETEXT = 233 # Key code constant: Number entry key. # Initiates to enter multi-digit channel nubmber when each digit key is assigned # for selecting separate channel. Corresponds to Number Entry Mode (0x1D) of CEC # User Control Code. TV_NUMBER_ENTRY = 234 # Key code constant: Analog Terrestrial key. # Switches to analog terrestrial broadcast service. TV_TERRESTRIAL_ANALOG = 235 # Key code constant: Digital Terrestrial key. # Switches to digital terrestrial broadcast service. TV_TERRESTRIAL_DIGITAL = 236 # Key code constant: Satellite key. # Switches to digital satellite broadcast service. TV_SATELLITE = 237 # Key code constant: BS key. # Switches to BS digital satellite broadcasting service available in Japan. TV_SATELLITE_BS = 238 # Key code constant: CS key. # Switches to CS digital satellite broadcasting service available in Japan. TV_SATELLITE_CS = 239 # Key code constant: BS/CS key. # Toggles between BS and CS digital satellite services. TV_SATELLITE_SERVICE = 240 # Key code constant: Toggle Network key. # Toggles selecting broacast services. TV_NETWORK = 241 # Key code constant: Antenna/Cable key. # Toggles broadcast input source between antenna and cable. TV_ANTENNA_CABLE = 242 # Key code constant: HDMI #1 key. # Switches to HDMI input #1. TV_INPUT_HDMI_1 = 243 # Key code constant: HDMI #2 key. # Switches to HDMI input #2. TV_INPUT_HDMI_2 = 244 # Key code constant: HDMI #3 key. # Switches to HDMI input #3. TV_INPUT_HDMI_3 = 245 # Key code constant: HDMI #4 key. # Switches to HDMI input #4. TV_INPUT_HDMI_4 = 246 # Key code constant: Composite #1 key. # Switches to composite video input #1. TV_INPUT_COMPOSITE_1 = 247 # Key code constant: Composite #2 key. # Switches to composite video input #2. TV_INPUT_COMPOSITE_2 = 248 # Key code constant: Component #1 key. # Switches to component video input #1. TV_INPUT_COMPONENT_1 = 249 # Key code constant: Component #2 key. # Switches to component video input #2. TV_INPUT_COMPONENT_2 = 250 # Key code constant: VGA #1 key. # Switches to VGA (analog RGB) input #1. TV_INPUT_VGA_1 = 251 # Key code constant: Audio description key. # Toggles audio description off / on. TV_AUDIO_DESCRIPTION = 252 # Key code constant: Audio description mixing volume up key. # Louden audio description volume as compared with normal audio volume. TV_AUDIO_DESCRIPTION_MIX_UP = 253 # Key code constant: Audio description mixing volume down key. # Lessen audio description volume as compared with normal audio volume. TV_AUDIO_DESCRIPTION_MIX_DOWN = 254 # Key code constant: Zoom mode key. # Changes Zoom mode (Normal, Full, Zoom, Wide-zoom, etc.) TV_ZOOM_MODE = 255 # Key code constant: Contents menu key. # Goes to the title list. Corresponds to Contents Menu (0x0B) of CEC User Control # Code TV_CONTENTS_MENU = 256 # Key code constant: Media context menu key. # Goes to the context menu of media contents. Corresponds to Media Context-sensitive # Menu (0x11) of CEC User Control Code. TV_MEDIA_CONTEXT_MENU = 257 # Key code constant: Timer programming key. # Goes to the timer recording menu. Corresponds to Timer Programming (0x54) of # CEC User Control Code. TV_TIMER_PROGRAMMING = 258 # Key code constant: Help key. HELP = 259 # Key code constant: Navigate to previous key. # Goes backward by one item in an ordered collection of items. NAVIGATE_PREVIOUS = 260 # Key code constant: Navigate to next key. # Advances to the next item in an ordered collection of items. NAVIGATE_NEXT = 261 # Key code constant: Navigate in key. # Activates the item that currently has focus or expands to the next level of a navigation # hierarchy. NAVIGATE_IN = 262 # Key code constant: Navigate out key. # Backs out one level of a navigation hierarchy or collapses the item that currently has # focus. NAVIGATE_OUT = 263 # Key code constant: Primary stem key for Wear. # Main power/reset button on watch. STEM_PRIMARY = 264 # Key code constant: Generic stem key 1 for Wear. STEM_1 = 265 # Key code constant: Generic stem key 2 for Wear. STEM_2 = 266 # Key code constant: Generic stem key 3 for Wear. STEM_3 = 267 # Key code constant: Directional Pad Up-Left. DPAD_UP_LEFT = 268 # Key code constant: Directional Pad Down-Left. DPAD_DOWN_LEFT = 269 # Key code constant: Directional Pad Up-Right. DPAD_UP_RIGHT = 270 # Key code constant: Directional Pad Down-Right. DPAD_DOWN_RIGHT = 271 # Key code constant: Skip forward media key. MEDIA_SKIP_FORWARD = 272 # Key code constant: Skip backward media key. MEDIA_SKIP_BACKWARD = 273 # Key code constant: Step forward media key. # Steps media forward, one frame at a time. MEDIA_STEP_FORWARD = 274 # Key code constant: Step backward media key. # Steps media backward, one frame at a time. MEDIA_STEP_BACKWARD = 275 # Key code constant: put device to sleep unless a wakelock is held. SOFT_SLEEP = 276 # Key code constant: Cut key. CUT = 277 # Key code constant: Copy key. COPY = 278 gamepad_buttons = [BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_X, BUTTON_Y, BUTTON_Z, BUTTON_L1, BUTTON_R1, BUTTON_L2, BUTTON_R2, BUTTON_THUMBL, BUTTON_THUMBR, BUTTON_START, BUTTON_SELECT, BUTTON_MODE, BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4, BUTTON_5, BUTTON_6, BUTTON_7, BUTTON_8, BUTTON_9, BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14, BUTTON_15, BUTTON_16] @staticmethod def is_gamepad_button(code): """Returns true if the specified nativekey is a gamepad button.""" return code in AndroidKey.gamepad_buttons confirm_buttons = [DPAD_CENTER, ENTER, SPACE, NUMPAD_ENTER] @staticmethod def is_confirm_key(code): """Returns true if the key will, by default, trigger a click on the focused view.""" return code in AndroidKey.confirm_buttons media_buttons = [MEDIA_PLAY, MEDIA_PAUSE, MEDIA_PLAY_PAUSE, MUTE, HEADSETHOOK, MEDIA_STOP, MEDIA_NEXT, MEDIA_PREVIOUS, MEDIA_REWIND, MEDIA_RECORD, MEDIA_FAST_FORWARD] @staticmethod def is_media_key(code): """Returns true if this key is a media key, which can be send to apps that are interested in media key events.""" return code in AndroidKey.media_buttons system_buttons = [MENU, SOFT_RIGHT, HOME, BACK, CALL, ENDCALL, VOLUME_UP, VOLUME_DOWN, VOLUME_MUTE, MUTE, POWER, HEADSETHOOK, MEDIA_PLAY, MEDIA_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_STOP, MEDIA_NEXT, MEDIA_PREVIOUS, MEDIA_REWIND, MEDIA_RECORD, MEDIA_FAST_FORWARD, CAMERA, FOCUS, SEARCH, BRIGHTNESS_DOWN, BRIGHTNESS_UP, MEDIA_AUDIO_TRACK] @staticmethod def is_system_key(code): """Returns true if the key is a system key, System keys can not be used for menu shortcuts.""" return code in AndroidKey.system_buttons wake_buttons = [BACK, MENU, WAKEUP, PAIRING, STEM_1, STEM_2, STEM_3] @staticmethod def is_wake_key(code): """Returns true if the key is a wake key.""" return code in AndroidKey.wake_buttons
class Fracao(): def __init__(self, n,d): # inicializa o numerador e denominador try: if d != 0: self.n = n self.d = d else: raise Exception except Exception: print('zero nao') def __add__(self, other): # sobrescreve + d = self.d * other.d n = self.n * other.d + other.n * self.d return Fracao(n,d) def __iadd__(self, other): # sobrescreve += d = self.d * other.d n = self.n * other.d + other.n * self.d return Fracao(d, n) def __mul__(self, other): # sobrescreve * n = self.n * other.n d = self.d * other.d return Fracao(n,d) def __sub__(self, other): # sobrescreve - d = self.d * other.d n = self.n * other.d - other.n * self.d return Fracao(n,d) def __div__(self, other): # sobrescreve / pass def __eq__(self, other): # sobrescreve ==, simplifica frações antes de comparar pass a = Fracao(2,3) print(a.n, a.d) b = Fracao(3,2) print(b.n, b.d) #c = a*b #c = a+b #c = a-b #a += Fracao(1,3) #c = a/b #c = a == b #print(a.n, a.d) #print(c.n, c.d)
def value_matcher(value): if value.type.tag == "rat64": return Rat64Printer(value) return None class Rat64Printer(object): def __init__(self, value): self.value = value def to_string(self): numerator = self.value["numerator"] denominator = self.value["denominator"] return str(numerator) + "/" + str(denominator) gdb.current_objfile().pretty_printers.append(value_matcher)
def fn(): print('Generate cache') cache = {} def get_from_cache(key): res = cache.get(key) if res: print('From cache') return res else: print('Calculate and save') res = 'value ' + str(key) cache[key] = res return get_from_cache f1 = fn() f2 = fn() f1(1) f1(2) f1(1) f1(2) f2(1) f2(2) f2(1) f2(2)
def __get_ints(line: str) -> list[int]: strings = line.strip().split(' ') return list(map(lambda x: int(x), strings)) def read_case_from_file(file_path: str) -> tuple[list[int], list[int]]: with open(file_path, 'r') as file: lines = file.readlines() assert len(lines) == 4 ranks = __get_ints(lines[1]) scores = __get_ints(lines[3]) return ranks, scores def read_results_from_file(file_path: str) -> list[int]: results = [] with open(file_path, 'r') as file: lines = file.readlines() for line in lines: number = int(line.strip()) results.append(number) return results
''' The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 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 where 1 ≤ n ≤ 30, generate the nth term of the count-and-say sequence. You can do so recursively, in other words from the previous member read off the digits, counting the number of digits in groups of the same digit. Note: Each term of the sequence of integers will be represented as a string. ''' class Solution: def countAndSay(self, n: int) -> str: outstring = '1' if n == 1: return outstring for i in range(n-1): count = 1 outstr = '' length = len(outstring) for x in range(length-1): if outstring[x] == outstring[x+1]: count += 1 else: outstr = outstr + str(count) + str(outstring[x]) count = 1 outstr = outstr + str(count) + str(outstring[-1]) outstring = outstr return outstring
# # PySNMP MIB module CMM4-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CMM4-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:09:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") Gauge32, NotificationType, Bits, ObjectIdentity, iso, Integer32, MibIdentifier, Counter64, ModuleIdentity, IpAddress, Counter32, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "NotificationType", "Bits", "ObjectIdentity", "iso", "Integer32", "MibIdentifier", "Counter64", "ModuleIdentity", "IpAddress", "Counter32", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") whispBox, whispCMM4, whispModules = mibBuilder.importSymbols("WHISP-GLOBAL-REG-MIB", "whispBox", "whispCMM4", "whispModules") EventString, WhispLUID, WhispMACAddress = mibBuilder.importSymbols("WHISP-TCV2-MIB", "EventString", "WhispLUID", "WhispMACAddress") cmm4MibModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 161, 19, 1, 1, 15)) if mibBuilder.loadTexts: cmm4MibModule.setLastUpdated('200603290000Z') if mibBuilder.loadTexts: cmm4MibModule.setOrganization('Cambium Networks') cmm4Groups = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1)) cmm4Config = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2)) cmm4Status = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3)) cmm4Gps = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4)) cmm4EventLog = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 5)) cmm4Controls = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6)) cmm4Snmp = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7)) cmm4Event = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8)) cmm4GPSEvent = MibIdentifier((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8, 1)) cmm4PortCfgGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 1)).setObjects(("CMM4-MIB", "portCfgIndex"), ("CMM4-MIB", "cmm4PortText"), ("CMM4-MIB", "cmm4PortDevType"), ("CMM4-MIB", "cmm4PortPowerCfg"), ("CMM4-MIB", "cmm4PortResetCfg")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4PortCfgGroup = cmm4PortCfgGroup.setStatus('current') cmm4ConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 2)).setObjects(("CMM4-MIB", "gpsTimingPulse"), ("CMM4-MIB", "lan1Ip"), ("CMM4-MIB", "lan1SubnetMask"), ("CMM4-MIB", "defaultGateway"), ("CMM4-MIB", "cmm4WebAutoUpdate"), ("CMM4-MIB", "cmm4ExtEthPowerReset"), ("CMM4-MIB", "cmm4IpAccessFilter"), ("CMM4-MIB", "cmm4IpAccess1"), ("CMM4-MIB", "cmm4IpAccess2"), ("CMM4-MIB", "cmm4IpAccess3"), ("CMM4-MIB", "cmm4MgmtPortSpeed"), ("CMM4-MIB", "cmm4NTPServerIp"), ("CMM4-MIB", "sessionTimeout"), ("CMM4-MIB", "vlanEnable"), ("CMM4-MIB", "managementVID"), ("CMM4-MIB", "siteInfoViewable")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4ConfigGroup = cmm4ConfigGroup.setStatus('current') cmm4PortStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 3)).setObjects(("CMM4-MIB", "portStatusIndex"), ("CMM4-MIB", "cmm4PortPowerStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4PortStatusGroup = cmm4PortStatusGroup.setStatus('current') cmm4StatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 4)).setObjects(("CMM4-MIB", "deviceType"), ("CMM4-MIB", "cmm4pldVersion"), ("CMM4-MIB", "cmm4SoftwareVersion"), ("CMM4-MIB", "cmm4SystemTime"), ("CMM4-MIB", "cmm4UpTime"), ("CMM4-MIB", "satellitesVisible"), ("CMM4-MIB", "satellitesTracked"), ("CMM4-MIB", "latitude"), ("CMM4-MIB", "longitude"), ("CMM4-MIB", "height"), ("CMM4-MIB", "trackingMode"), ("CMM4-MIB", "syncStatus"), ("CMM4-MIB", "cmm4MacAddress"), ("CMM4-MIB", "cmm4ExtEthPwrStat"), ("CMM4-MIB", "cmm4FPGAVersion"), ("CMM4-MIB", "cmm4FPGAPlatform"), ("CMM4-MIB", "defaultStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4StatusGroup = cmm4StatusGroup.setStatus('current') cmm4GPSGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 5)).setObjects(("CMM4-MIB", "gpsTrackingMode"), ("CMM4-MIB", "gpsTime"), ("CMM4-MIB", "gpsDate"), ("CMM4-MIB", "gpsSatellitesVisible"), ("CMM4-MIB", "gpsSatellitesTracked"), ("CMM4-MIB", "gpsHeight"), ("CMM4-MIB", "gpsAntennaConnection"), ("CMM4-MIB", "gpsLatitude"), ("CMM4-MIB", "gpsLongitude"), ("CMM4-MIB", "gpsInvalidMsg"), ("CMM4-MIB", "gpsRestartCount"), ("CMM4-MIB", "gpsReceiverInfo"), ("CMM4-MIB", "gpsSyncStatus"), ("CMM4-MIB", "gpsSyncMasterSlave"), ("CMM4-MIB", "gpsLog"), ("CMM4-MIB", "gpsReInitCount")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4GPSGroup = cmm4GPSGroup.setStatus('current') cmm4ControlsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 6)).setObjects(("CMM4-MIB", "cmm4Reboot"), ("CMM4-MIB", "cmm4ClearEventLog"), ("CMM4-MIB", "cmm4RebootIfRequired")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4ControlsGroup = cmm4ControlsGroup.setStatus('current') cmm4SNMPGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 7)).setObjects(("CMM4-MIB", "cmm4SnmpComString"), ("CMM4-MIB", "cmm4SnmpAccessSubnet"), ("CMM4-MIB", "cmm4SnmpTrapIp1"), ("CMM4-MIB", "cmm4SnmpTrapIp2"), ("CMM4-MIB", "cmm4SnmpTrapIp3"), ("CMM4-MIB", "cmm4SnmpTrapIp4"), ("CMM4-MIB", "cmm4SnmpTrapIp5"), ("CMM4-MIB", "cmm4SnmpTrapIp6"), ("CMM4-MIB", "cmm4SnmpTrapIp7"), ("CMM4-MIB", "cmm4SnmpTrapIp8"), ("CMM4-MIB", "cmm4SnmpTrapIp9"), ("CMM4-MIB", "cmm4SnmpTrapIp10"), ("CMM4-MIB", "cmm4SnmpReadOnly"), ("CMM4-MIB", "cmm4SnmpGPSSyncTrapEnable"), ("CMM4-MIB", "cmm4SnmpAccessSubnet2"), ("CMM4-MIB", "cmm4SnmpAccessSubnet3"), ("CMM4-MIB", "cmm4SnmpAccessSubnet4"), ("CMM4-MIB", "cmm4SnmpAccessSubnet5"), ("CMM4-MIB", "cmm4SnmpAccessSubnet6"), ("CMM4-MIB", "cmm4SnmpAccessSubnet7"), ("CMM4-MIB", "cmm4SnmpAccessSubnet8"), ("CMM4-MIB", "cmm4SnmpAccessSubnet9"), ("CMM4-MIB", "cmm4SnmpAccessSubnet10")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4SNMPGroup = cmm4SNMPGroup.setStatus('current') cmm4UserTableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 1, 8)).setObjects(("CMM4-MIB", "entryIndex"), ("CMM4-MIB", "userLoginName"), ("CMM4-MIB", "userPswd"), ("CMM4-MIB", "accessLevel")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cmm4UserTableGroup = cmm4UserTableGroup.setStatus('current') gpsTimingPulse = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("master", 1), ("slave", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: gpsTimingPulse.setStatus('current') lan1Ip = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: lan1Ip.setStatus('current') lan1SubnetMask = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: lan1SubnetMask.setStatus('current') defaultGateway = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 4), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: defaultGateway.setStatus('current') cmm4WebAutoUpdate = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 5), Integer32()).setUnits('Seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4WebAutoUpdate.setStatus('current') cmm4ExtEthPowerReset = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("off", 0), ("on", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4ExtEthPowerReset.setStatus('current') cmm4IpAccessFilter = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("off", 0), ("on", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4IpAccessFilter.setStatus('current') cmm4IpAccess1 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 9), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4IpAccess1.setStatus('current') cmm4IpAccess2 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 10), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4IpAccess2.setStatus('current') cmm4IpAccess3 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 11), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4IpAccess3.setStatus('current') cmm4MgmtPortSpeed = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("autoNegotiate", 1), ("force10Half", 2), ("force10Full", 3), ("force100Half", 4), ("force100Full", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4MgmtPortSpeed.setStatus('current') cmm4NTPServerIp = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 13), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4NTPServerIp.setStatus('current') sessionTimeout = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 14), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: sessionTimeout.setStatus('current') vlanEnable = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disable", 0), ("enable", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: vlanEnable.setStatus('current') managementVID = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094))).setMaxAccess("readwrite") if mibBuilder.loadTexts: managementVID.setStatus('current') siteInfoViewable = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("enable", 1), ("disable", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: siteInfoViewable.setStatus('current') cmm4PortCfgTable = MibTable((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7), ) if mibBuilder.loadTexts: cmm4PortCfgTable.setStatus('current') cmm4PortCfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1), ).setIndexNames((0, "CMM4-MIB", "portCfgIndex")) if mibBuilder.loadTexts: cmm4PortCfgEntry.setStatus('current') portCfgIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: portCfgIndex.setStatus('current') cmm4PortText = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 2), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4PortText.setStatus('current') cmm4PortDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("canopy", 1), ("canopy56V", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4PortDevType.setStatus('current') cmm4PortPowerCfg = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("on", 1), ("off", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4PortPowerCfg.setStatus('current') cmm4PortResetCfg = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 2, 7, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("resetPort", 1), ("resetComplete", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4PortResetCfg.setStatus('current') deviceType = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceType.setStatus('current') cmm4pldVersion = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4pldVersion.setStatus('current') cmm4SoftwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4SoftwareVersion.setStatus('current') cmm4SystemTime = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4SystemTime.setStatus('current') cmm4UpTime = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4UpTime.setStatus('current') satellitesVisible = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 7), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: satellitesVisible.setStatus('current') satellitesTracked = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: satellitesTracked.setStatus('current') latitude = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 9), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: latitude.setStatus('current') longitude = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 10), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: longitude.setStatus('current') height = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 11), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: height.setStatus('current') trackingMode = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 12), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: trackingMode.setStatus('current') syncStatus = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 13), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: syncStatus.setStatus('current') cmm4MacAddress = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 14), WhispMACAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4MacAddress.setStatus('current') cmm4ExtEthPwrStat = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("off", 0), ("on", 1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4ExtEthPwrStat.setStatus('current') cmm4FPGAVersion = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 16), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4FPGAVersion.setStatus('current') cmm4FPGAPlatform = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 17), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4FPGAPlatform.setStatus('current') defaultStatus = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("defaultPlugInserted", 1), ("defaultSwitchActive", 2), ("defaultPlugInsertedAndDefaultSwitchActive", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: defaultStatus.setStatus('current') cmm4PortStatusTable = MibTable((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1), ) if mibBuilder.loadTexts: cmm4PortStatusTable.setStatus('current') cmm4PortStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1, 1), ).setIndexNames((0, "CMM4-MIB", "portStatusIndex")) if mibBuilder.loadTexts: cmm4PortStatusEntry.setStatus('current') portStatusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: portStatusIndex.setStatus('current') cmm4PortPowerStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, -1))).clone(namedValues=NamedValues(("on", 1), ("off", 0), ("powerOverEthernetFault", -1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cmm4PortPowerStatus.setStatus('current') gpsTrackingMode = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 1), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsTrackingMode.setStatus('current') gpsTime = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsTime.setStatus('current') gpsDate = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsDate.setStatus('current') gpsSatellitesVisible = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsSatellitesVisible.setStatus('current') gpsSatellitesTracked = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsSatellitesTracked.setStatus('current') gpsHeight = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsHeight.setStatus('current') gpsAntennaConnection = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 7), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsAntennaConnection.setStatus('current') gpsLatitude = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsLatitude.setStatus('current') gpsLongitude = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 9), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsLongitude.setStatus('current') gpsInvalidMsg = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 10), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsInvalidMsg.setStatus('current') gpsRestartCount = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsRestartCount.setStatus('current') gpsReceiverInfo = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 12), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsReceiverInfo.setStatus('current') gpsSyncStatus = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("syncOK", 1), ("noSync", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsSyncStatus.setStatus('current') gpsSyncMasterSlave = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("cmmIsGPSMaster", 1), ("cmmIsGPSSlave", 0)))).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsSyncMasterSlave.setStatus('current') gpsLog = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 15), EventString()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsLog.setStatus('current') gpsReInitCount = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 4, 16), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: gpsReInitCount.setStatus('current') eventLog = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 5, 1), EventString()).setMaxAccess("readonly") if mibBuilder.loadTexts: eventLog.setStatus('current') ntpLog = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 5, 2), EventString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ntpLog.setStatus('current') cmm4Reboot = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("reboot", 1), ("finishedReboot", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4Reboot.setStatus('current') cmm4ClearEventLog = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("clear", 1), ("notClear", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4ClearEventLog.setStatus('current') cmm4RebootIfRequired = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 6, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("rebootifrquired", 1), ("rebootcomplete", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4RebootIfRequired.setStatus('current') cmm4SnmpComString = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpComString.setStatus('current') cmm4SnmpAccessSubnet = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 2), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet.setStatus('current') cmm4SnmpTrapIp1 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp1.setStatus('current') cmm4SnmpTrapIp2 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 4), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp2.setStatus('current') cmm4SnmpTrapIp3 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 5), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp3.setStatus('current') cmm4SnmpTrapIp4 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 6), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp4.setStatus('current') cmm4SnmpTrapIp5 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 7), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp5.setStatus('current') cmm4SnmpTrapIp6 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 8), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp6.setStatus('current') cmm4SnmpTrapIp7 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 9), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp7.setStatus('current') cmm4SnmpTrapIp8 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 10), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp8.setStatus('current') cmm4SnmpTrapIp9 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 11), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp9.setStatus('current') cmm4SnmpTrapIp10 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 12), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpTrapIp10.setStatus('current') cmm4SnmpReadOnly = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("readOnlyPermissions", 1), ("readWritePermissions", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpReadOnly.setStatus('current') cmm4SnmpGPSSyncTrapEnable = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("gpsSyncTrapDisabled", 0), ("gpsSyncTrapEnabled", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpGPSSyncTrapEnable.setStatus('current') cmm4SnmpAccessSubnet2 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 15), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet2.setStatus('current') cmm4SnmpAccessSubnet3 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 16), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet3.setStatus('current') cmm4SnmpAccessSubnet4 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 17), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet4.setStatus('current') cmm4SnmpAccessSubnet5 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 18), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet5.setStatus('current') cmm4SnmpAccessSubnet6 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 19), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet6.setStatus('current') cmm4SnmpAccessSubnet7 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 20), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet7.setStatus('current') cmm4SnmpAccessSubnet8 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 21), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet8.setStatus('current') cmm4SnmpAccessSubnet9 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 22), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet9.setStatus('current') cmm4SnmpAccessSubnet10 = MibScalar((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 7, 23), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cmm4SnmpAccessSubnet10.setStatus('current') cmm4GPSInSync = NotificationType((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8, 1, 1)).setObjects(("CMM4-MIB", "gpsSyncStatus"), ("CMM4-MIB", "cmm4MacAddress")) if mibBuilder.loadTexts: cmm4GPSInSync.setStatus('current') cmm4GPSNoSync = NotificationType((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 8, 1, 2)).setObjects(("CMM4-MIB", "gpsSyncStatus"), ("CMM4-MIB", "cmm4MacAddress")) if mibBuilder.loadTexts: cmm4GPSNoSync.setStatus('current') cmm4UserTable = MibTable((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9), ) if mibBuilder.loadTexts: cmm4UserTable.setStatus('current') cmm4UserEntry = MibTableRow((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1), ).setIndexNames((0, "CMM4-MIB", "entryIndex")) if mibBuilder.loadTexts: cmm4UserEntry.setStatus('current') entryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 5))).setMaxAccess("readonly") if mibBuilder.loadTexts: entryIndex.setStatus('current') userLoginName = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: userLoginName.setStatus('current') userPswd = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: userPswd.setStatus('current') accessLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 161, 19, 3, 6, 9, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("noAdmin", 0), ("guest", 1), ("installer", 2), ("administrator", 3), ("technician", 4), ("engineering", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: accessLevel.setStatus('current') mibBuilder.exportSymbols("CMM4-MIB", cmm4SystemTime=cmm4SystemTime, cmm4SnmpAccessSubnet10=cmm4SnmpAccessSubnet10, cmm4IpAccess1=cmm4IpAccess1, gpsSatellitesVisible=gpsSatellitesVisible, gpsTimingPulse=gpsTimingPulse, cmm4ClearEventLog=cmm4ClearEventLog, lan1Ip=lan1Ip, cmm4PortText=cmm4PortText, cmm4ExtEthPowerReset=cmm4ExtEthPowerReset, cmm4PortCfgEntry=cmm4PortCfgEntry, cmm4PortCfgTable=cmm4PortCfgTable, cmm4NTPServerIp=cmm4NTPServerIp, cmm4SnmpTrapIp4=cmm4SnmpTrapIp4, cmm4SnmpAccessSubnet7=cmm4SnmpAccessSubnet7, cmm4PortPowerCfg=cmm4PortPowerCfg, cmm4StatusGroup=cmm4StatusGroup, cmm4RebootIfRequired=cmm4RebootIfRequired, cmm4IpAccess2=cmm4IpAccess2, gpsRestartCount=gpsRestartCount, cmm4IpAccessFilter=cmm4IpAccessFilter, gpsInvalidMsg=gpsInvalidMsg, PYSNMP_MODULE_ID=cmm4MibModule, cmm4PortCfgGroup=cmm4PortCfgGroup, cmm4GPSNoSync=cmm4GPSNoSync, cmm4SnmpAccessSubnet=cmm4SnmpAccessSubnet, gpsHeight=gpsHeight, cmm4SnmpComString=cmm4SnmpComString, cmm4Controls=cmm4Controls, cmm4ConfigGroup=cmm4ConfigGroup, cmm4SnmpAccessSubnet3=cmm4SnmpAccessSubnet3, trackingMode=trackingMode, cmm4PortStatusGroup=cmm4PortStatusGroup, cmm4FPGAVersion=cmm4FPGAVersion, cmm4MacAddress=cmm4MacAddress, cmm4SnmpTrapIp8=cmm4SnmpTrapIp8, cmm4IpAccess3=cmm4IpAccess3, defaultStatus=defaultStatus, deviceType=deviceType, cmm4GPSInSync=cmm4GPSInSync, sessionTimeout=sessionTimeout, gpsLongitude=gpsLongitude, cmm4Snmp=cmm4Snmp, height=height, cmm4GPSGroup=cmm4GPSGroup, cmm4SnmpTrapIp10=cmm4SnmpTrapIp10, cmm4SnmpAccessSubnet5=cmm4SnmpAccessSubnet5, portStatusIndex=portStatusIndex, userPswd=userPswd, siteInfoViewable=siteInfoViewable, gpsLatitude=gpsLatitude, cmm4UserEntry=cmm4UserEntry, cmm4pldVersion=cmm4pldVersion, cmm4PortDevType=cmm4PortDevType, cmm4PortResetCfg=cmm4PortResetCfg, satellitesTracked=satellitesTracked, syncStatus=syncStatus, cmm4SnmpTrapIp2=cmm4SnmpTrapIp2, gpsSatellitesTracked=gpsSatellitesTracked, cmm4Gps=cmm4Gps, cmm4UserTableGroup=cmm4UserTableGroup, cmm4MibModule=cmm4MibModule, cmm4SnmpAccessSubnet8=cmm4SnmpAccessSubnet8, longitude=longitude, managementVID=managementVID, gpsDate=gpsDate, entryIndex=entryIndex, cmm4Status=cmm4Status, cmm4SnmpReadOnly=cmm4SnmpReadOnly, gpsReInitCount=gpsReInitCount, cmm4SoftwareVersion=cmm4SoftwareVersion, cmm4MgmtPortSpeed=cmm4MgmtPortSpeed, cmm4PortStatusEntry=cmm4PortStatusEntry, gpsAntennaConnection=gpsAntennaConnection, cmm4SnmpTrapIp7=cmm4SnmpTrapIp7, gpsSyncStatus=gpsSyncStatus, cmm4SnmpTrapIp9=cmm4SnmpTrapIp9, cmm4SnmpAccessSubnet4=cmm4SnmpAccessSubnet4, cmm4SnmpGPSSyncTrapEnable=cmm4SnmpGPSSyncTrapEnable, satellitesVisible=satellitesVisible, portCfgIndex=portCfgIndex, cmm4SnmpTrapIp6=cmm4SnmpTrapIp6, defaultGateway=defaultGateway, cmm4Groups=cmm4Groups, cmm4SnmpTrapIp1=cmm4SnmpTrapIp1, eventLog=eventLog, latitude=latitude, vlanEnable=vlanEnable, cmm4UserTable=cmm4UserTable, gpsReceiverInfo=gpsReceiverInfo, cmm4SNMPGroup=cmm4SNMPGroup, cmm4ExtEthPwrStat=cmm4ExtEthPwrStat, cmm4EventLog=cmm4EventLog, cmm4FPGAPlatform=cmm4FPGAPlatform, gpsLog=gpsLog, cmm4GPSEvent=cmm4GPSEvent, cmm4SnmpTrapIp5=cmm4SnmpTrapIp5, cmm4Event=cmm4Event, accessLevel=accessLevel, userLoginName=userLoginName, cmm4SnmpAccessSubnet9=cmm4SnmpAccessSubnet9, cmm4Config=cmm4Config, cmm4SnmpAccessSubnet2=cmm4SnmpAccessSubnet2, cmm4UpTime=cmm4UpTime, cmm4PortStatusTable=cmm4PortStatusTable, ntpLog=ntpLog, cmm4WebAutoUpdate=cmm4WebAutoUpdate, gpsSyncMasterSlave=gpsSyncMasterSlave, cmm4PortPowerStatus=cmm4PortPowerStatus, gpsTime=gpsTime, cmm4SnmpTrapIp3=cmm4SnmpTrapIp3, gpsTrackingMode=gpsTrackingMode, lan1SubnetMask=lan1SubnetMask, cmm4SnmpAccessSubnet6=cmm4SnmpAccessSubnet6, cmm4Reboot=cmm4Reboot, cmm4ControlsGroup=cmm4ControlsGroup)
class SampleSheetError(Exception): """An exception raised when errors are encountered with a sample sheet. Examples include when a sample sheet can't be parsed because it's garbled, or if IRIDA rejects the creation of a run because fields are missing or invalid from the sample sheet. """ def __init__(self, message, errors): """Initalize a SampleSheetError. Args: message: a summary message that's causing the error. errors: a more detailed list of errors. """ self._message = message self._errors = errors @property def message(self): return self._message @property def errors(self): return self._errors def __str__(self): return self.message
# Copyright (C) 2020 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """File's labels and properties.""" class TransformationCSVFields(object): """To transformation fields of CSV files.""" # pylint: disable=too-few-public-methods REVISION_DATE = "Revision Date"
class Container: """A container that holds objects. This is an abstract class. Only child classes should be instantiated. """ def add(self, item): """Add <item> to this Container. @type self: Container @type item: Object @rtype: None """ raise NotImplementedError("Implemented in a subclass") def remove(self): """Remove and return a single item from this Container. @type self: Container @rtype: Object """ raise NotImplementedError("Implemented in a subclass") def is_empty(self): """Return True iff this Container is empty. @type self: Container @rtype: bool """ raise NotImplementedError("Implemented in a subclass") class PriorityQueue(Container): """A queue of items that operates in priority order. Items are removed from the queue according to priority; the item with the highest priority is removed first. Ties are resolved in FIFO order, meaning the item which was inserted *earlier* is the first one to be removed. Priority is defined by the rich comparison methods for the objects in the container (__lt__, __le__, __gt__, __ge__). If x < y, then x has a *HIGHER* priority than y. All objects in the container must be of the same type. """ # === Private Attributes === # @type _items: list # The items stored in the priority queue. # # === Representation Invariants === # _items is a sorted list, where the first item in the queue is the # item with the highest priority. def __init__(self): """Initialize an empty PriorityQueue. @type self: PriorityQueue @rtype: None """ self._items = [] def remove(self): """Remove and return the next item from this PriorityQueue. Precondition: <self> should not be empty. @type self: PriorityQueue @rtype: object >>> pq = PriorityQueue() >>> pq.add("red") >>> pq.add("blue") >>> pq.add("yellow") >>> pq.add("green") >>> pq.remove() 'blue' >>> pq.remove() 'green' >>> pq.remove() 'red' >>> pq.remove() 'yellow' """ return self._items.pop(0) def is_empty(self): """ Return true iff this PriorityQueue is empty. @type self: PriorityQueue @rtype: bool >>> pq = PriorityQueue() >>> pq.is_empty() True >>> pq.add("thing") >>> pq.is_empty() False """ return len(self._items) == 0 def add(self, item): """Add <item> to this PriorityQueue. @type self: PriorityQueue @type item: object @rtype: None >>> pq = PriorityQueue() >>> pq.add("yellow") >>> pq.add("blue") >>> pq.add("red") >>> pq.add("green") >>> pq._items ['blue', 'green', 'red', 'yellow'] """ self._items.append(item) self._items.sort()
""" Package exception types """ __all__ = ["FileFormatError", "AliasError", "UndefinedAliasError"] class FileFormatError(Exception): """ Exception for invalid file format. """ pass class AliasError(Exception): """ Alias related error. """ pass class UndefinedAliasError(AliasError): """ Alias is is not defined. """ pass
class Solution: def nextPermutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. Array. Running time: O(n) where n == len(nums). """ if not nums: return None n = len(nums) p = n - 1 while p > 0 and nums[p] <= nums[p-1]: p -= 1 if p == 0: self._reverse(nums, 0, n - 1) return pos = p - 1 q = n - 1 while q > pos and nums[q] <= nums[pos]: q -= 1 nums[pos], nums[q] = nums[q], nums[pos] return self._reverse(nums, pos + 1, n - 1) def _reverse(self, nums, s, e): while s < e and s < len(nums): nums[s], nums[e] = nums[e], nums[s] s += 1 e -= 1
# visible_spectrum.py # 2021-05-27 version 1.2 # Copyright 2021 Cedar Grove Studios # Spectral Index to Visible (Rainbow) Spectrum RGB Converter Helper # Based on original 1996 Fortran code by Dan Bruton: # physics.sfasu.edu/astro/color/spectra.html def index_to_rgb(index=0, gamma=0.5): """ Converts a spectral index to rainbow (visible light wavelength) spectrum to an RGB value. Spectral index in range of 0.0 to 1.0 (violet --> white). Gamma in range of 0.0 to 1.0 (1.0=linear), default 0.5 for color TFT displays. :return: Returns a 24-bit RGB value :rtype: integer """ wl = (index * 320) + 380 if wl < 440: intensity = 0.1 + (0.9 * (wl - 380) / (440 - 380)) red = ((-1.0 * (wl - 440) / (440 - 380)) * intensity) ** gamma grn = 0.0 blu = (1.0 * intensity) ** gamma if wl >= 440 and wl < 490: red = 0.0 grn = (1.0 * (wl - 440) / (490 - 440)) ** gamma blu = 1.0 ** gamma if wl >= 490 and wl < 510: red = 0.0 grn = 1.0 ** gamma blu = (-1.0 * (wl - 510) / (510 - 490)) ** gamma if wl >= 510 and wl < 580: red = (1.0 * (wl - 510) / (580 - 510)) ** gamma grn = 1.0 ** gamma blu = 0.0 if wl >= 580 and wl < 645: red = 1.0 ** gamma grn = (-1.0 * (wl - 645) / (645 - 580)) ** gamma blu = 0.0 if wl >= 645: intensity = 0.3 + (0.7 * (700 - wl) / (700 - 645)) red = (1.0) ** gamma grn = (1.0 - intensity) ** gamma blu = (1.0 - intensity) ** gamma return (int(red * 255) << 16) + (int(grn * 255) << 8) + int(blu * 255)
#!/usr/bin/python # -*- coding: UTF-8 -*- #生成基本json模板 outbound={ "protocol": "vmess", "settings": { "vnext": [ { "address": "", "port": 0, "users": [ { "alterId": 0, "id": "", "level": 0, "security": "auto" } ] } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path": "/v2ray" } } }
# ---------------------------------------------------------------------------- # Copyright (c) 2022, Franck Lejzerowicz. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- __version__ = "2.0"
""" Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ class Match(object): WORD = 0 TOPIC = 2 THAT = 3 def __init__(self, match_type, node, word): self._matched_node_type = match_type if node is not None: self._matched_node_str = node.to_string(verbose=False) self._matched_node_words = [] if node is not None and \ (node.is_wildcard() or \ node.is_set() or \ node.is_iset() or \ node.is_bot() or \ node.is_regex()): self._matched_node_multi_word = True else: self._matched_node_multi_word = False if node is not None: self._matched_node_wildcard = node.is_wildcard() else: self._matched_node_wildcard = False if word is not None: self.add_word(word) def add_word(self, word): self._matched_node_words.append(word) @property def matched_node_type(self): return self._matched_node_type @property def matched_node_str(self): return self._matched_node_str @property def matched_node_multi_word(self): return self._matched_node_multi_word @property def matched_node_wildcard(self): return self._matched_node_wildcard @property def matched_node_words(self): return self._matched_node_words def joined_words(self, client_context): return client_context.brain.tokenizer.words_to_texts(self._matched_node_words) @staticmethod def type_to_string(match_type): if match_type == Match.WORD: return "Word" elif match_type == Match.TOPIC: return "Topic" elif match_type == Match.THAT: return "That" return "Unknown" @staticmethod def string_to_type(match_type): if match_type == 'Word': return Match.WORD elif match_type == 'Topic': return Match.TOPIC elif match_type == 'That': return Match.THAT return -1 def to_string(self, client_context): return "Match=(%s) Node=(%s) Matched=(%s)"%(Match.type_to_string(self._matched_node_type), self._matched_node_str, self.joined_words(client_context)) def to_json(self): return {"type": Match.type_to_string(self._matched_node_type), "node": self._matched_node_str, "words": self._matched_node_words, "multi_word": self._matched_node_multi_word, "wild_card": self._matched_node_wildcard} @staticmethod def from_json(json_data): match = Match(0, None, None) match._matched_node_type = Match.string_to_type(json_data["type"]) match._matched_node_str = json_data["node"] match._matched_node_words = json_data["words"] match._matched_node_multi_word = json_data["multi_word"] match._matched_node_wildcard = json_data["wild_card"] return match
''' Creating a class Created with the keyword class followed by a name, Common practice is to make the names Pascal Casing: Example '''
__all__ = [ "accuracy", "confusion_matrix", "multi_class_acc", "top_k_svm", "microf1", "macrof1", ]
def add_native_methods(clazz): def init__java_lang_String__boolean__(a0, a1): raise NotImplementedError() def indicateMechs____(): raise NotImplementedError() def inquireNamesForMech____(a0): raise NotImplementedError() def releaseName__long__(a0, a1): raise NotImplementedError() def importName__byte____org_ietf_jgss_Oid__(a0, a1, a2): raise NotImplementedError() def compareName__long__long__(a0, a1, a2): raise NotImplementedError() def canonicalizeName__long__(a0, a1): raise NotImplementedError() def exportName__long__(a0, a1): raise NotImplementedError() def displayName__long__(a0, a1): raise NotImplementedError() def acquireCred__long__int__int__(a0, a1, a2, a3): raise NotImplementedError() def releaseCred__long__(a0, a1): raise NotImplementedError() def getCredName__long__(a0, a1): raise NotImplementedError() def getCredTime__long__(a0, a1): raise NotImplementedError() def getCredUsage__long__(a0, a1): raise NotImplementedError() def importContext__byte____(a0, a1): raise NotImplementedError() def initContext__long__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__(a0, a1, a2, a3, a4, a5): raise NotImplementedError() def acceptContext__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__(a0, a1, a2, a3, a4): raise NotImplementedError() def inquireContext__long__(a0, a1): raise NotImplementedError() def getContextMech__long__(a0, a1): raise NotImplementedError() def getContextName__long__boolean__(a0, a1, a2): raise NotImplementedError() def getContextTime__long__(a0, a1): raise NotImplementedError() def deleteContext__long__(a0, a1): raise NotImplementedError() def wrapSizeLimit__long__int__int__int__(a0, a1, a2, a3, a4): raise NotImplementedError() def exportContext__long__(a0, a1): raise NotImplementedError() def getMic__long__int__byte____(a0, a1, a2, a3): raise NotImplementedError() def verifyMic__long__byte____byte____org_ietf_jgss_MessageProp__(a0, a1, a2, a3, a4): raise NotImplementedError() def wrap__long__byte____org_ietf_jgss_MessageProp__(a0, a1, a2, a3): raise NotImplementedError() def unwrap__long__byte____org_ietf_jgss_MessageProp__(a0, a1, a2, a3): raise NotImplementedError() clazz.init__java_lang_String__boolean__ = staticmethod(init__java_lang_String__boolean__) clazz.indicateMechs____ = staticmethod(indicateMechs____) clazz.inquireNamesForMech____ = inquireNamesForMech____ clazz.releaseName__long__ = releaseName__long__ clazz.importName__byte____org_ietf_jgss_Oid__ = importName__byte____org_ietf_jgss_Oid__ clazz.compareName__long__long__ = compareName__long__long__ clazz.canonicalizeName__long__ = canonicalizeName__long__ clazz.exportName__long__ = exportName__long__ clazz.displayName__long__ = displayName__long__ clazz.acquireCred__long__int__int__ = acquireCred__long__int__int__ clazz.releaseCred__long__ = releaseCred__long__ clazz.getCredName__long__ = getCredName__long__ clazz.getCredTime__long__ = getCredTime__long__ clazz.getCredUsage__long__ = getCredUsage__long__ clazz.importContext__byte____ = importContext__byte____ clazz.initContext__long__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ = initContext__long__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ clazz.acceptContext__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ = acceptContext__long__org_ietf_jgss_ChannelBinding__byte____sun_security_jgss_wrapper_NativeGSSContext__ clazz.inquireContext__long__ = inquireContext__long__ clazz.getContextMech__long__ = getContextMech__long__ clazz.getContextName__long__boolean__ = getContextName__long__boolean__ clazz.getContextTime__long__ = getContextTime__long__ clazz.deleteContext__long__ = deleteContext__long__ clazz.wrapSizeLimit__long__int__int__int__ = wrapSizeLimit__long__int__int__int__ clazz.exportContext__long__ = exportContext__long__ clazz.getMic__long__int__byte____ = getMic__long__int__byte____ clazz.verifyMic__long__byte____byte____org_ietf_jgss_MessageProp__ = verifyMic__long__byte____byte____org_ietf_jgss_MessageProp__ clazz.wrap__long__byte____org_ietf_jgss_MessageProp__ = wrap__long__byte____org_ietf_jgss_MessageProp__ clazz.unwrap__long__byte____org_ietf_jgss_MessageProp__ = unwrap__long__byte____org_ietf_jgss_MessageProp__
class PyVeeException(Exception): pass class InvalidAddressException(PyVeeException): pass class InvalidParameterException(PyVeeException): pass class MissingPrivateKeyException(PyVeeException): pass class MissingPublicKeyException(PyVeeException): pass class MissingAddressException(PyVeeException): pass class InsufficientBalanceException(PyVeeException): pass class NetworkException(PyVeeException): pass
# test builtin type print(type(int)) try: type() except TypeError: print('TypeError') try: type(1, 2) except TypeError: print('TypeError') # second arg should be a tuple try: type('abc', None, None) except TypeError: print('TypeError') # third arg should be a dict try: type('abc', (), None) except TypeError: print('TypeError') # elements of second arg (the bases) should be types try: type('abc', (1,), {}) except TypeError: print('TypeError')
# The MIT License (MIT) # Copyright (c) 2021 Ian Buttimer # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ For information regarding UN/LOCODE, see https://www.unece.org/cefact/locode/welcome.html For information regarding the data format, see https://unece.org/DAM/cefact/locode/UNLOCODE_Manual.pdf and '2021-1 UNLOCODE SecretariatNotes.pdf' in data/loc211csv.zip """ # Columns presented in UN/LOCODE # change indicator that shows if the entry has been modified in any way COL_CHANGE: str = 'change' # the ISO 3166 alpha-2 Country Code COL_LO: str = 'lo' # a 3-character code for the place name COL_CODE: str = 'code' # place name, whenever possible, in their national language COL_LOCAL: str = 'name_local' # place name, without diacritic signs COL_NAME: str = 'name' # ISO 1-3 character code for the administrative division of the country, # as per ISO 3166-2/1998 COL_DIVISION: str = 'subdivision' # 1-digit function classifier code for the location COL_FUNCTION: str = 'function' # status of the entry COL_STATUS: str = 'status' # reference date, showing the year and month of request COL_DATE: str = 'date' # IATA code for the location if different from location code COL_IATA: str = 'iata' # geographical coordinates (latitude/longitude), # ddmmN dddmmW, ddmmS dddmmE, # etc., where the two last digits refer to minutes and the two or three # first digits indicate the degrees COL_COORD: str = 'geo_coord' # reasons for the change COL_REMARK: str = 'remark' FUNCTION_PORT: str = '1' # port, as defined in Rec. 16 FUNCTION_RAIL: str = '2' # rail terminal FUNCTION_ROAD: str = '3' # road terminal FUNCTION_AIRPORT: str = '4' # airport FUNCTION_POST: str = '5' # postal exchange office FUNCTION_MULTIMODAL: str = '6' # multimodal functions, ICD's, etc. FUNCTION_FIXED: str = '7' # fixed transport functions (e.g. oil platform) FUNCTION_BORDER: str = 'B' # border crossing FUNCTION_UNKNOWN: str = '0' # function not known, to be specified
indexes = [(row, col) for row in range(5) for col in range(5)] class Board: def __init__(self, board: list[list[tuple[int, bool]]]) -> None: self.board = board self.done = False def set(self, n: int): if self.done: return True for row, col in indexes: value, _ = self.board[row][col] if value == n: self.board[row][col] = (value, True) self.done = self.check() return self.done def check(self): if any([all([s for _, s in row]) for row in self.board]): return True return any( [all([self.board[row][col][1] for row in range(5)]) for col in range(5)] ) def score(self, num: int): return num * sum([sum([n for n, m in row if not m]) for row in self.board]) @classmethod def from_str_list(cls, lst): return cls([[(int(n), False) for n in line.split() if n != ""] for line in lst]) def parse_input(input: list[str]) -> tuple[list[int], list[Board]]: draws = input[0] acc = [] boards = [] for line in input[2:]: if line == "": boards.append(acc.copy()) acc = [] else: acc.append(line) boards.append(acc.copy()) draw = [int(n) for n in draws.split(",")] games = [Board.from_str_list(b) for b in boards] return draw, games def part1(draws: list[int], games: list[Board]): for n in draws: for g in games: if g.set(n): return g.score(n) def part2(draws: list[int], games: list[Board]): wins = [] for n in draws: for g in filter(lambda g: not g.done, games): if g.set(n): wins.append((n, g)) if all([g.done for g in games]): break n, g = wins.pop() return g.score(n) if __name__ == "__main__": with open("input.txt") as f: input = [l.strip() for l in f.readlines()] draws, boards = parse_input(input) print(f"part 1: {part1(draws, boards)}") draws, boards = parse_input(input) print(f"part 2: {part2(draws, boards)}")
#annapolis latitude = 38.9784 # longitude = -76.4922 longitude = 283.5078 height = 13
# C++ implementation to convert the # given BST to Min Heap # structure of a node of BST class Node: # Constructor to create a new node def __init__(self, data): self.data = data self.left = None self.right = None # function for the inorder traversal # of the tree so as to store the node # values in 'arr' in sorted order def inorderTraversal(root, arr): if root == None: return # first recur on left subtree inorderTraversal(root.left, arr) # then copy the data of the node arr.append(root.data) # now recur for right subtree inorderTraversal(root.right, arr) # function to convert the given # BST to MIN HEAP performs preorder # traversal of the tree def BSTToMinHeap(root, arr, i): if root == None: return # first copy data at index 'i' of # 'arr' to the node i[0] += 1 root.data = arr[i[0]] # then recur on left subtree BSTToMinHeap(root.left, arr, i) # now recur on right subtree BSTToMinHeap(root.right, arr, i) # utility function to convert the # given BST to MIN HEAP def convertToMinHeapUtil(root): # vector to store the data of # all the nodes of the BST arr = [] i = [-1] # inorder traversal to populate 'arr' inorderTraversal(root, arr); # BST to MIN HEAP conversion BSTToMinHeap(root, arr, i) # function for the preorder traversal # of the tree def preorderTraversal(root): if root == None: return # first print the root's data print(root.data, end = " ") # then recur on left subtree preorderTraversal(root.left) # now recur on right subtree preorderTraversal(root.right) # Driver Code if __name__ == '__main__': # BST formation root = Node(4) root.left = Node(2) root.right = Node(6) root.left.left = Node(1) root.left.right = Node(3) root.right.left = Node(5) root.right.right = Node(7) convertToMinHeapUtil(root) print("Preorder Traversal:") preorderTraversal(root) # This code is contributed # by PranchalK
""""Name : ADVAIT GURUNATH CHAVAN ; PRN : 4119008""" file = open('name_prn.txt', 'w') file.write("NAME : ADVAIT GURUNATH CHAVAN \n") file.write("PRN : 4119008") file.close() file = open('name_prn.txt', 'r') for line in file: print(line, "\n") file.close()
""" Constants """ MAX_PARTICLES = 5_000 SCREEN_SIZE = (1250, 750) FPS = 60 MAX_SPEED = 500 MAX_BARRIER_DIST = 500 MAX_REPEL_DIST = 500 MAX_MOUSE_DIST = 500 """ Butterfly mode MAX_SPEED = 1 MAX_BARRIER_DIST = 0 MAX_MOUSE_DIST = 1 MAX_REPEL_DIST = 0 magnitude <= 100 """ """ FONT """ DEFAULT_FONT = "Quicksand-Light.otf" DEFAULT_FONT_BOLD = "Quicksand-Bold.otf" LEFT_BUTTON = 1 MIDDLE_BUTTON = 2 RIGHT_BUTTON = 3