content
stringlengths
7
1.05M
class BTNode: __slots__ = "value", "left", "right" def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right def test_BTNode(): parent = BTNode(10) left = BTNode(20) right = BTNode(30) parent.left = left parent.right = right print (parent.value) print (parent.left.value) print (parent.right.value) if __name__ == '__main__': test_BTNode()
""" Convenience classes for returning multiple values from functions Examples: Success w/ data: return ok_resp(some_obj) Success w/ data and a message: return ok_resp(some_obj, 'It worked') Error w/ message: return err_resp('some error message') Error w/ message and data: return err_resp('some error message', dict(failed_lines=[45, 72]) """ class BasicResponse: def __init__(self, success, message=None, data=None): """ Initialize """ assert success in (True, False), "Success must be a Python boolean" self.success = success self.message = message self.data = data def as_dict(self): """ Return as a Python dict - Can be sent back as a Django JSONResponse """ info = dict(success=self.success) if self.message: info['message'] = self.message if self.data: info['data'] = self.data return info def is_success(self): """ Can also use .success """ return self.success def ok_resp(data, message=None): """Return a SuccessResponse with success=True and data""" return BasicResponse(True, message=message, data=data) def err_resp(err_msg, data=None): """Return a ErrorResponse with success=False and err_msg""" return BasicResponse(False, message=err_msg, data=data) if __name__ == '__main__': br = ok_resp(dict(median=34)) print(br.as_dict()) br = ok_resp(dict(median=34), 'it worked!') print(br.as_dict()) br = err_resp('did not go so well') print(br.as_dict()) br = err_resp('did not go so well', dict(failed_term=45)) print(br.as_dict())
#!/usr/bin/python # -*- coding: utf-8 -*- DEBUG = True USE_TZ = True SECRET_KEY = "KEY" DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", } } ROOT_URLCONF = "tests.urls" INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.messages", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.sites", "beerfest", "rest_framework", ] MIDDLEWARE = ( "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", ) SITE_ID = 1 TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": ["tests/templates"], "OPTIONS": { "context_processors": [ "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", ], }, }, ]
#!/home/rob/.pyenv/shims/python3 def example(param): """param must be greater than 0""" assert param > 0 #if __debug__: # if not param > 0: # raise AssertionError # do stuff here... if __name__ == '__main__': example(0)
""" VIS_DATA """ #def get_img_figure(n_subplots=1): def plot_img(ax, img, **kwargs): title = kwargs.pop('title', 'Image') ax.imshow(img) ax.set_title(title)
# -*- coding: utf-8 -*- """ /*************************************************************************** Configuration file The PlanHeat tool was implemented as part of the PLANHEAT project. This file contains several global variables used inside the different sub-modules. ------------------- begin : 2019-04-25 git sha : $Format:%H$ copyright : (C) 2019 by PlanHeat consortium email : stefano.barberis@rina.org ***************************************************************************/ """ ### Files and directories WORKING_DIRECTORY_NAME = "planheat_data" TEMP_WORKING_DIRECTORY_NAME = "temp" MAPPING_DIRECTORY_NAME = "mapping" PLANNING_DIRECTORY_NAME = "planning" PROJECT_INFO_JSON_NAME = "info.json" # Mapping files MAPPING_CMM_SMM_DB_FILE_NAME = "planheat.db" DMM_FOLDER = "DMM" DMM_PREFIX = "DMM_result" DMM_FUTURE_SUFFIX = "_future" DMM_HOURLY_SUFFIX = "_hourly" DMM_FUTURE_HOURLY_SUFFIX = "_future_hourly" SMM_FOLDER = "SMM" CMM_BASELINE_FOLDER = "CMMB" CMM_FUTURE_FOLDER = "CMMF" INPUT_FOLDER = "input_files" # Planning District files DISTRICT_FOLDER = "District" BASELINE_FOLDER = "Baseline" FUTURE_FOLDER = "Future" TOOLS_FOLDER = "Tools" KPIS_FOLDER = "KPIs" STREETS_FOLDER = "Streets" BUILDING_SHAPE = "Building_shape" # Planning City files CITY_FOLDER = "City" CMM_WIZARD_FOLDER = "Wizard" # Clean files for master plugins PROJECTS_CLEAN_DATA_DIR = "project_init_data" ANTWERP_TEST_CASE_FILE_NAME = "antwerp_scenario_clean.zip" # Objects constants names PROJECT_NAME_KEY = "Name" PROJECT_DESCRIPTION_KEY = "Description" PROJECT_CREATION_DATE_KEY = "Creation date" PROJECT_ID_KEY = "Id" KEYS_TO_SHOW = [PROJECT_NAME_KEY, PROJECT_CREATION_DATE_KEY, PROJECT_DESCRIPTION_KEY] DATE_FMT = "%Y-%m-%d %H:%M" PROJECT_NAME_DEFAULT = "Unamed project"
''' pequeno script que informa se é possivel ou não formar um triangulo com base nos angulos ''' a = int(input('digite seu primeiro angulo: ')) b = int(input('digite seu segundo angulo: ')) c = int(input('digite seu terceiro angulo: ')) res = a + b if res > c: print('é possivel formar um triangulo!') else: print('não é possivel formar triangulo!')
class Solution: # @param prices, a list of integer # @return an integer def maxProfit(self, prices): n = len(prices) if n < 2: return 0 min_price = prices[0] res = 0 for i in xrange(1, n): res = max(res, prices[i]-min_price) min_price = min(min_price, prices[i]) return res
# Python 3: Simple output (with Unicode) print("Hello, I'm Python!") # Input, assignment name = input('What is your name?\n') print('Hi, %s.' % name)
# Time complexity: O(n) where n is number of nodes in Tree # Approach: Checking binary search tree conditions on each node recursively. # 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 isValidBST(self, root: Optional[TreeNode], l=-2**31-1, r=2**31) -> bool: if not root: return True elif l<root.val and root.val<r: return self.isValidBST(root.left, l, root.val) and self.isValidBST(root.right, root.val, r) return False
""" 1. Clarification 2. Possible solutions - simulation - math 3. Coding 4. Tests """ # T=O(n), S=O(n) class Solution: def totalMoney(self, n: int) -> int: return sum(i%7 + 1 + i//7 for i in range(n)) # # T=O(1), S=O(1) # class Solution: # def totalMoney(self, n: int) -> int: # extra, weeks = n % 7, n // 7 # return 28*weeks + 7*weeks*(weeks-1)//2 + weeks*extra + extra*(extra+1)//2
class Node(): def __init__(self): self.children = {} self.endofword = False self.string = "" class Trie(): def __init__(self): self.root = Node() def insert(self, word): pointer = self.root for char in word: if char not in pointer.children: pointer.children[char] = Node() pointer = pointer.children[char] pointer.endofword = True pointer.string = word def search(self, word): pointer = self.root for char in word: if char not in pointer.children: # print("here") return "" pointer = pointer.children[char] if pointer.endofword is True: return pointer.string return "" class Solution: def replaceWords(self, dict: List[str], sentence: str) -> str: prefixtree = Trie() ans = "" for word in dict: prefixtree.insert(word) for word in sentence.split(): root = prefixtree.search(word) if root == "": ans += word else: ans += root ans += " " return ans[:-1]
#----------------------------------------------------------------------- # helper modules for argparse: # - check if values are in a certain range, are positive, etc. # - https://github.com/Sorbus/artichoke #----------------------------------------------------------------------- def check_range(value): ivalue = int(value) if ivalue < 1 or ivalue > 3200: raise argparse.ArgumentTypeError("%s is not a valid positive int value" % value) return ivalue def check_positive(value): ivalue = int(value) if ivalue < 0: raise argparse.ArgumentTypeError("%s is not a valid positive int value" % value) return ivalue
#logaritmica #No. de digitos de un numero def digitos(i): cont=0 if i == 0: return '0' while i > 0: cont=cont+1 i = i//10 return cont numeros=list(range(1,1000)) print(numeros) ite=[] for a in numeros: ite.append(digitos(a)) print(digitos(a))
# -*- coding: utf-8 -*- """ Created on Mon Oct 21 00:23:43 2019 @author: yanxi """ def addDummyNP(fname): res=[] with open(fname) as f: for line in f: l = line.split(',') l.insert(2,'0') res.append(','.join(l)) if len(res) != 0: with open(fname, 'w') as f: for line in res: f.write(line)
# Guess Number Higher or Lower II class Solution(object): def getMoneyAmount(self, n): """ the strategy is to choose the option that if the worst consequence of that option occurs, it's the least worst case among all options specifically, if picking any number in a range, find the highest amount of money to pay, then choose the minimal highest amount (minmax) dp[i][j]: smallest amount of money to pay to win in guessing from i to j dp[i][i] = 0 no cost for one number dp[i][i+1] = i pick the first in two numbers so that worst case is i dp[i][j] = min(k + max(dp[i][k-1], dp[k+1][j])) i < k < j (if k is picked, check highest amount to pay if the answer is on the left or right) """ dp = [[0] * (n + 1) for _ in range(n + 1)] for i in range(1, n): dp[i][i + 1] = i for width in range(3, n + 1): for i in range(1, n - width + 2): j = i + width - 1 range_min = float('inf') for k in range(i + 1, j): curr_max = k + max(dp[i][k - 1], dp[k + 1][j]) range_min = min(range_min, curr_max) dp[i][j] = range_min return dp[1][n]
class FakeSerial: def __init__( self, port=None, baudrate = 19200, timeout=1, bytesize = 8, parity = 'N', stopbits = 1, xonxoff=0, rtscts = 0): print("Port is ", port) self.halfduplex = True self.name = port self.port = port self.timeout = timeout self.parity = parity self.baudrate = baudrate self.bytesize = bytesize self.stopbits = stopbits self.xonxoff = xonxoff self.rtscts = rtscts self._data = b'0000:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,00\r\n' if isinstance(self.port, str): self.port = open(self.port, "wb+") def close(self): pass def flush(self): self.port.flush() def write(self, data): written = self.port.write(data) return written def readline(self): self.halfduplex = not self.halfduplex if self.halfduplex: return b"OK\r\n" return self._data
""" Recipes which illustrate augmentation of ORM SELECT behavior as used by :meth:`_orm.Session.execute` with :term:`2.0 style` use of :func:`_sql.select`, as well as the :term:`1.x style` :class:`_orm.Query` object. Examples include demonstrations of the :func:`_orm.with_loader_criteria` option as well as the :meth:`_orm.SessionEvents.do_orm_execute` hook. As of SQLAlchemy 1.4, the :class:`_orm.Query` construct is unified with the :class:`_expression.Select` construct, so that these two objects are mostly the same. .. autosource:: """ # noqa
class CustomException(Exception): def __init__(self, *args): if args: self.message = args[0] else: self.message = None def get_str(self, class_name): if self.message: return '{0}, {1} '.format(self.message, class_name) else: return '{0} has been raised'.format(class_name) class CommunicationChannelException(CustomException): def __str__(self): return super().get_str('CommunicationChannelException') class MissingDataException(CustomException): def __str__(self): return super().get_str('MissingDataException') class NoFormsException(CustomException): def __str__(self): return super().get_str('NoFormsException') class NoPeersException(CustomException): def __str__(self): return super().get_str('NoPeersException') class NotExistentEmployeeException(CustomException): def __str__(self): return super().get_str('NotExistentEmployeeException')
# Copyright 2014 Cloudera Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Base identifiers base_identifiers = [ 'add', 'aggregate', 'all', 'alter', 'and', 'api_version', 'as', 'asc', 'avro', 'between', 'bigint', 'binary', 'boolean', 'by', 'cached', 'case', 'cast', 'change', 'char', 'class', 'close_fn', 'column', 'columns', 'comment', 'compute', 'create', 'cross', 'data', 'database', 'databases', 'date', 'datetime', 'decimal', 'delimited', 'desc', 'describe', 'distinct', 'div', 'double', 'drop', 'else', 'end', 'escaped', 'exists', 'explain', 'external', 'false', 'fields', 'fileformat', 'finalize_fn', 'first', 'float', 'format', 'formatted', 'from', 'full', 'function', 'functions', 'group', 'having', 'if', 'in', 'incremental', 'init_fn', 'inner', 'inpath', 'insert', 'int', 'integer', 'intermediate', 'interval', 'into', 'invalidate', 'is', 'join', 'last', 'left', 'like', 'limit', 'lines', 'load', 'location', 'merge_fn', 'metadata', 'not', 'null', 'nulls', 'offset', 'on', 'or', 'order', 'outer', 'overwrite', 'parquet', 'parquetfile', 'partition', 'partitioned', 'partitions', 'prepare_fn', 'produced', 'rcfile', 'real', 'refresh', 'regexp', 'rename', 'replace', 'returns', 'right', 'rlike', 'row', 'schema', 'schemas', 'select', 'semi', 'sequencefile', 'serdeproperties', 'serialize_fn', 'set', 'show', 'smallint', 'stats', 'stored', 'straight_join', 'string', 'symbol', 'table', 'tables', 'tblproperties', 'terminated', 'textfile', 'then', 'timestamp', 'tinyint', 'to', 'true', 'uncached', 'union', 'update_fn', 'use', 'using', 'values', 'view', 'when', 'where', 'with', ]
# Faça um programa em que troque todas as ocorrencias de uma letra L1 pela letra L2 em uma string. A string e as letras L1 e L2 devem ser fornecidas pelo usuario. palavra = input('\nDigite uma palavra: ') print(f'A palavra fornecida foi: {palavra}') resp1 = input('\nDigite a letra a ser substituida: ') resp2 = input('Digite a letra que será posta no lugar: ') for i in range(0, len(resp1)): palavra = palavra.replace(resp1, resp2) print(palavra) # tive problemas: minha forma natural foi essa de baixo: # # ocorrencia = palavra.find(resp1) # resultado = palavra + palavra[ocorrencia].replace(resp1, resp2) # print(resultado)
# -*- coding: utf-8 -*- """Top-level package for Grbl Link.""" __author__ = """Darius Montez""" __email__ = 'darius.montez@gmail.com' __version__ = '0.1.4'
H = {0: [0], 1: [1, 2, 4, 8], 2: [3, 5, 6, 9, 10], 3: [7, 11]} M = {0: [0], 1: [1, 2, 4, 8, 16, 32], 2: [3, 5, 6, 9, 10, 12, 17, 18, 20, 24, 33, 34, 36, 40, 48], 3: [7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56], 4: [15, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58], 5: [31, 47, 55, 59]} class Solution: def readBinaryWatch(self, num: int) -> List[str]: result = [] for i in range(num + 1): for h in H.get(i, []): for m in M.get(num - i, []): result.append('%d:%02d' % (h, m)) return result
class SDCMeter(object): """Stores the SDCs probabilities""" def __init__(self): self.reset() def updateAcc(self, acc1, acc5): self.acc1 = acc1 self.acc5 = acc5 def updateGoldenData(self, scoreTensors): for scores in scoreTensors.cpu().numpy(): self.goldenScoresAll.append(scores) def updateFaultyData(self, scoreTensors): for scores in scoreTensors.cpu().numpy(): self.faultyScoresAll.append(scores) def updateGoldenBatchPred(self, predTensors): self.goldenPred.append(predTensors) def updateFaultyBatchPred(self, predTensors): self.faultyPred.append(predTensors) def updateGoldenBatchScore(self, scoreTensors): self.goldenScores.append(scoreTensors) def updateFaultyBatchScore(self, scoreTensors): self.faultyScores.append(scoreTensors) def calculteSDCs(self): top1Sum = 0 top5Sum = 0 for goldenTensor, faultyTensor in zip(self.goldenPred, self.faultyPred): correct = goldenTensor.ne(faultyTensor) top1Sum += correct[:1].view(-1).int().sum(0, keepdim=True) for goldenRow, faultyRow in zip(goldenTensor.t(), faultyTensor.t()): if goldenRow[0] not in faultyRow: top5Sum += 1 # calculate top1 and top5 SDCs by dividing sum to numBatches * batchSize self.top1SDC = float(top1Sum[0]) / float(len(self.goldenPred) * len(self.goldenPred[0][0])) self.top5SDC = float(top5Sum) / float(len(self.goldenPred) * len(self.goldenPred[0][0])) self.top1SDC *= 100 self.top5SDC *= 100 def reset(self): self.acc1 = 0 self.acc5 = 0 self.top1SDC = 0.0 self.top5SDC = 0.0 self.goldenPred = [] self.faultyPred = [] self.goldenScores = [] self.faultyScores = [] self.goldenScoresAll = [] self.faultyScoresAll = []
yusuke_power = {"Yusuke Urameshi": "Spirit Gun"} hiei_power = {"Hiei": "Jagan Eye"} powers = dict() # Iteration for dictionary in (yusuke_power, hiei_power): for key, value in dictionary.items(): powers[key] = value # Dictionary Comprehension powers = {key: value for d in (yusuke_power, hiei_power) for key, value in d.items()} # Copy and update powers = yusuke_power.copy() powers.update(hiei_power) # Dictionary unpacking powers = {**yusuke_power, **hiei_power}
SIMPLE_QUEUE = 'simple' WORK_QUEUE = 'work_queue' RABBITMQ_HOST = '0.0.0.0' LOG_EXCHANGE = 'logs' ROUTING_EXCHANGE = 'direct_exchange' TOPIC_EXCHANGE = 'topic_exchange' SEVERITIES = ['err', 'info', 'debug'] FACILITIES = ['kern', 'mail', 'user', 'local0']
# triple nested exceptions passed = 1 def f(): try: foo() passed = 0 except: print("except 1") try: bar() passed = 0 except: print("except 2") try: baz() passed = 0 except: print("except 3") bak() passed = 0 try: f() passed = 0 except: print("f except") if (passed): print("PASS") else: print("FAIL")
""" Take Home Project 1. Write a program for an e-commerce store. The program must accept at least 10 products on the first run. The storekeeper should be given the option to Add a product, remove a product, empty the product catalog and close the program. 2. Create a membership system that allows users to register and login after registration. 3. Write a budget for the United states of America for any 20 states of your choice in tabular form with the following columns, index, State, Allocation, Population, allocation per head\ """ #================ Number 1================== """ 1. Write a program for an e-commerce store. The program must accept at least 10 products on the first run. The storekeeper should be given the option to Add a product, remove a product, empty the product catalog and close the program. Code for Number 1 print("Welcome to Lizzy Autos") catalog = [] isMoreProduct = "yes" for i in range(4): name_of_product = input("Enter Product:\t") catalog.append(name_of_product) while isMoreProduct == "yes": isMoreProduct = input("Do you have more products to add?\t") isMoreProduct = isMoreProduct.lower() if isMoreProduct == "yes": name_of_product = input("Enter Product:\t") catalog.append(name_of_product) else: break print("\n\nList of Products\n") while True: for x in catalog: print(x) print("") print("1. Add a Product") print("2. Remove a Product") print("3. Clear The Catalog") print("4. Quit") print("") option = int(input("Choose an Option\t")) print("") if option == 1: name_of_product = input("Enter Product:\t") catalog.append(name_of_product) elif option == 2: product_to_remove = int(input("Enter Product index:\t")) catalog.pop(product_to_remove - 1) elif option == 3: catalog.clear() elif option == 4: break else: print("Invalid Input") """ #================ Number 2================== """ 2. Create a membership system that allows users to register and login after registration. """ #================Number 3================ """ 3. Write a budget for the United states of America for any 20 states of your choice in tabular form with the following columns: State, Allocation, Population, allocation per head\ """ print("Welcome to the United States Data Center\n") print("State\tAllocation($)\tPopulation(M)\tAllocation/Head($)\n") print(f"California\t\t2\t\t3\t{round(2/3,3)}")
class MetaSingleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(MetaSingleton, cls).__call__(*args, **kwargs) return cls._instances[cls] class Processing(metaclass=MetaSingleton): def __init__(self): self.report = None def set_report(self, report): self.report = report def get_cluster(self): return self.report class Model(object): # todo SINGLETON class @staticmethod def send_report(report): print(report) # todo initialization SINGLETON if python can Processing().set_report(report) @staticmethod def get_response(): return "Отчёт принят!\n{}".format(Processing().get_cluster())
uctable = [ [ 194, 178 ], [ 194, 179 ], [ 194, 185 ], [ 194, 188 ], [ 194, 189 ], [ 194, 190 ], [ 224, 167, 180 ], [ 224, 167, 181 ], [ 224, 167, 182 ], [ 224, 167, 183 ], [ 224, 167, 184 ], [ 224, 167, 185 ], [ 224, 173, 178 ], [ 224, 173, 179 ], [ 224, 173, 180 ], [ 224, 173, 181 ], [ 224, 173, 182 ], [ 224, 173, 183 ], [ 224, 175, 176 ], [ 224, 175, 177 ], [ 224, 175, 178 ], [ 224, 177, 184 ], [ 224, 177, 185 ], [ 224, 177, 186 ], [ 224, 177, 187 ], [ 224, 177, 188 ], [ 224, 177, 189 ], [ 224, 177, 190 ], [ 224, 181, 176 ], [ 224, 181, 177 ], [ 224, 181, 178 ], [ 224, 181, 179 ], [ 224, 181, 180 ], [ 224, 181, 181 ], [ 224, 188, 170 ], [ 224, 188, 171 ], [ 224, 188, 172 ], [ 224, 188, 173 ], [ 224, 188, 174 ], [ 224, 188, 175 ], [ 224, 188, 176 ], [ 224, 188, 177 ], [ 224, 188, 178 ], [ 224, 188, 179 ], [ 225, 141, 169 ], [ 225, 141, 170 ], [ 225, 141, 171 ], [ 225, 141, 172 ], [ 225, 141, 173 ], [ 225, 141, 174 ], [ 225, 141, 175 ], [ 225, 141, 176 ], [ 225, 141, 177 ], [ 225, 141, 178 ], [ 225, 141, 179 ], [ 225, 141, 180 ], [ 225, 141, 181 ], [ 225, 141, 182 ], [ 225, 141, 183 ], [ 225, 141, 184 ], [ 225, 141, 185 ], [ 225, 141, 186 ], [ 225, 141, 187 ], [ 225, 141, 188 ], [ 225, 159, 176 ], [ 225, 159, 177 ], [ 225, 159, 178 ], [ 225, 159, 179 ], [ 225, 159, 180 ], [ 225, 159, 181 ], [ 225, 159, 182 ], [ 225, 159, 183 ], [ 225, 159, 184 ], [ 225, 159, 185 ], [ 225, 167, 154 ], [ 226, 129, 176 ], [ 226, 129, 180 ], [ 226, 129, 181 ], [ 226, 129, 182 ], [ 226, 129, 183 ], [ 226, 129, 184 ], [ 226, 129, 185 ], [ 226, 130, 128 ], [ 226, 130, 129 ], [ 226, 130, 130 ], [ 226, 130, 131 ], [ 226, 130, 132 ], [ 226, 130, 133 ], [ 226, 130, 134 ], [ 226, 130, 135 ], [ 226, 130, 136 ], [ 226, 130, 137 ], [ 226, 133, 144 ], [ 226, 133, 145 ], [ 226, 133, 146 ], [ 226, 133, 147 ], [ 226, 133, 148 ], [ 226, 133, 149 ], [ 226, 133, 150 ], [ 226, 133, 151 ], [ 226, 133, 152 ], [ 226, 133, 153 ], [ 226, 133, 154 ], [ 226, 133, 155 ], [ 226, 133, 156 ], [ 226, 133, 157 ], [ 226, 133, 158 ], [ 226, 133, 159 ], [ 226, 134, 137 ], [ 226, 145, 160 ], [ 226, 145, 161 ], [ 226, 145, 162 ], [ 226, 145, 163 ], [ 226, 145, 164 ], [ 226, 145, 165 ], [ 226, 145, 166 ], [ 226, 145, 167 ], [ 226, 145, 168 ], [ 226, 145, 169 ], [ 226, 145, 170 ], [ 226, 145, 171 ], [ 226, 145, 172 ], [ 226, 145, 173 ], [ 226, 145, 174 ], [ 226, 145, 175 ], [ 226, 145, 176 ], [ 226, 145, 177 ], [ 226, 145, 178 ], [ 226, 145, 179 ], [ 226, 145, 180 ], [ 226, 145, 181 ], [ 226, 145, 182 ], [ 226, 145, 183 ], [ 226, 145, 184 ], [ 226, 145, 185 ], [ 226, 145, 186 ], [ 226, 145, 187 ], [ 226, 145, 188 ], [ 226, 145, 189 ], [ 226, 145, 190 ], [ 226, 145, 191 ], [ 226, 146, 128 ], [ 226, 146, 129 ], [ 226, 146, 130 ], [ 226, 146, 131 ], [ 226, 146, 132 ], [ 226, 146, 133 ], [ 226, 146, 134 ], [ 226, 146, 135 ], [ 226, 146, 136 ], [ 226, 146, 137 ], [ 226, 146, 138 ], [ 226, 146, 139 ], [ 226, 146, 140 ], [ 226, 146, 141 ], [ 226, 146, 142 ], [ 226, 146, 143 ], [ 226, 146, 144 ], [ 226, 146, 145 ], [ 226, 146, 146 ], [ 226, 146, 147 ], [ 226, 146, 148 ], [ 226, 146, 149 ], [ 226, 146, 150 ], [ 226, 146, 151 ], [ 226, 146, 152 ], [ 226, 146, 153 ], [ 226, 146, 154 ], [ 226, 146, 155 ], [ 226, 147, 170 ], [ 226, 147, 171 ], [ 226, 147, 172 ], [ 226, 147, 173 ], [ 226, 147, 174 ], [ 226, 147, 175 ], [ 226, 147, 176 ], [ 226, 147, 177 ], [ 226, 147, 178 ], [ 226, 147, 179 ], [ 226, 147, 180 ], [ 226, 147, 181 ], [ 226, 147, 182 ], [ 226, 147, 183 ], [ 226, 147, 184 ], [ 226, 147, 185 ], [ 226, 147, 186 ], [ 226, 147, 187 ], [ 226, 147, 188 ], [ 226, 147, 189 ], [ 226, 147, 190 ], [ 226, 147, 191 ], [ 226, 157, 182 ], [ 226, 157, 183 ], [ 226, 157, 184 ], [ 226, 157, 185 ], [ 226, 157, 186 ], [ 226, 157, 187 ], [ 226, 157, 188 ], [ 226, 157, 189 ], [ 226, 157, 190 ], [ 226, 157, 191 ], [ 226, 158, 128 ], [ 226, 158, 129 ], [ 226, 158, 130 ], [ 226, 158, 131 ], [ 226, 158, 132 ], [ 226, 158, 133 ], [ 226, 158, 134 ], [ 226, 158, 135 ], [ 226, 158, 136 ], [ 226, 158, 137 ], [ 226, 158, 138 ], [ 226, 158, 139 ], [ 226, 158, 140 ], [ 226, 158, 141 ], [ 226, 158, 142 ], [ 226, 158, 143 ], [ 226, 158, 144 ], [ 226, 158, 145 ], [ 226, 158, 146 ], [ 226, 158, 147 ], [ 226, 179, 189 ], [ 227, 134, 146 ], [ 227, 134, 147 ], [ 227, 134, 148 ], [ 227, 134, 149 ], [ 227, 136, 160 ], [ 227, 136, 161 ], [ 227, 136, 162 ], [ 227, 136, 163 ], [ 227, 136, 164 ], [ 227, 136, 165 ], [ 227, 136, 166 ], [ 227, 136, 167 ], [ 227, 136, 168 ], [ 227, 136, 169 ], [ 227, 137, 136 ], [ 227, 137, 137 ], [ 227, 137, 138 ], [ 227, 137, 139 ], [ 227, 137, 140 ], [ 227, 137, 141 ], [ 227, 137, 142 ], [ 227, 137, 143 ], [ 227, 137, 145 ], [ 227, 137, 146 ], [ 227, 137, 147 ], [ 227, 137, 148 ], [ 227, 137, 149 ], [ 227, 137, 150 ], [ 227, 137, 151 ], [ 227, 137, 152 ], [ 227, 137, 153 ], [ 227, 137, 154 ], [ 227, 137, 155 ], [ 227, 137, 156 ], [ 227, 137, 157 ], [ 227, 137, 158 ], [ 227, 137, 159 ], [ 227, 138, 128 ], [ 227, 138, 129 ], [ 227, 138, 130 ], [ 227, 138, 131 ], [ 227, 138, 132 ], [ 227, 138, 133 ], [ 227, 138, 134 ], [ 227, 138, 135 ], [ 227, 138, 136 ], [ 227, 138, 137 ], [ 227, 138, 177 ], [ 227, 138, 178 ], [ 227, 138, 179 ], [ 227, 138, 180 ], [ 227, 138, 181 ], [ 227, 138, 182 ], [ 227, 138, 183 ], [ 227, 138, 184 ], [ 227, 138, 185 ], [ 227, 138, 186 ], [ 227, 138, 187 ], [ 227, 138, 188 ], [ 227, 138, 189 ], [ 227, 138, 190 ], [ 227, 138, 191 ], [ 234, 160, 176 ], [ 234, 160, 177 ], [ 234, 160, 178 ], [ 234, 160, 179 ], [ 234, 160, 180 ], [ 234, 160, 181 ], [ 240, 144, 132, 135 ], [ 240, 144, 132, 136 ], [ 240, 144, 132, 137 ], [ 240, 144, 132, 138 ], [ 240, 144, 132, 139 ], [ 240, 144, 132, 140 ], [ 240, 144, 132, 141 ], [ 240, 144, 132, 142 ], [ 240, 144, 132, 143 ], [ 240, 144, 132, 144 ], [ 240, 144, 132, 145 ], [ 240, 144, 132, 146 ], [ 240, 144, 132, 147 ], [ 240, 144, 132, 148 ], [ 240, 144, 132, 149 ], [ 240, 144, 132, 150 ], [ 240, 144, 132, 151 ], [ 240, 144, 132, 152 ], [ 240, 144, 132, 153 ], [ 240, 144, 132, 154 ], [ 240, 144, 132, 155 ], [ 240, 144, 132, 156 ], [ 240, 144, 132, 157 ], [ 240, 144, 132, 158 ], [ 240, 144, 132, 159 ], [ 240, 144, 132, 160 ], [ 240, 144, 132, 161 ], [ 240, 144, 132, 162 ], [ 240, 144, 132, 163 ], [ 240, 144, 132, 164 ], [ 240, 144, 132, 165 ], [ 240, 144, 132, 166 ], [ 240, 144, 132, 167 ], [ 240, 144, 132, 168 ], [ 240, 144, 132, 169 ], [ 240, 144, 132, 170 ], [ 240, 144, 132, 171 ], [ 240, 144, 132, 172 ], [ 240, 144, 132, 173 ], [ 240, 144, 132, 174 ], [ 240, 144, 132, 175 ], [ 240, 144, 132, 176 ], [ 240, 144, 132, 177 ], [ 240, 144, 132, 178 ], [ 240, 144, 132, 179 ], [ 240, 144, 133, 181 ], [ 240, 144, 133, 182 ], [ 240, 144, 133, 183 ], [ 240, 144, 133, 184 ], [ 240, 144, 134, 138 ], [ 240, 144, 134, 139 ], [ 240, 144, 139, 161 ], [ 240, 144, 139, 162 ], [ 240, 144, 139, 163 ], [ 240, 144, 139, 164 ], [ 240, 144, 139, 165 ], [ 240, 144, 139, 166 ], [ 240, 144, 139, 167 ], [ 240, 144, 139, 168 ], [ 240, 144, 139, 169 ], [ 240, 144, 139, 170 ], [ 240, 144, 139, 171 ], [ 240, 144, 139, 172 ], [ 240, 144, 139, 173 ], [ 240, 144, 139, 174 ], [ 240, 144, 139, 175 ], [ 240, 144, 139, 176 ], [ 240, 144, 139, 177 ], [ 240, 144, 139, 178 ], [ 240, 144, 139, 179 ], [ 240, 144, 139, 180 ], [ 240, 144, 139, 181 ], [ 240, 144, 139, 182 ], [ 240, 144, 139, 183 ], [ 240, 144, 139, 184 ], [ 240, 144, 139, 185 ], [ 240, 144, 139, 186 ], [ 240, 144, 139, 187 ], [ 240, 144, 140, 160 ], [ 240, 144, 140, 161 ], [ 240, 144, 140, 162 ], [ 240, 144, 140, 163 ], [ 240, 144, 161, 152 ], [ 240, 144, 161, 153 ], [ 240, 144, 161, 154 ], [ 240, 144, 161, 155 ], [ 240, 144, 161, 156 ], [ 240, 144, 161, 157 ], [ 240, 144, 161, 158 ], [ 240, 144, 161, 159 ], [ 240, 144, 161, 185 ], [ 240, 144, 161, 186 ], [ 240, 144, 161, 187 ], [ 240, 144, 161, 188 ], [ 240, 144, 161, 189 ], [ 240, 144, 161, 190 ], [ 240, 144, 161, 191 ], [ 240, 144, 162, 167 ], [ 240, 144, 162, 168 ], [ 240, 144, 162, 169 ], [ 240, 144, 162, 170 ], [ 240, 144, 162, 171 ], [ 240, 144, 162, 172 ], [ 240, 144, 162, 173 ], [ 240, 144, 162, 174 ], [ 240, 144, 162, 175 ], [ 240, 144, 163, 187 ], [ 240, 144, 163, 188 ], [ 240, 144, 163, 189 ], [ 240, 144, 163, 190 ], [ 240, 144, 163, 191 ], [ 240, 144, 164, 150 ], [ 240, 144, 164, 151 ], [ 240, 144, 164, 152 ], [ 240, 144, 164, 153 ], [ 240, 144, 164, 154 ], [ 240, 144, 164, 155 ], [ 240, 144, 166, 188 ], [ 240, 144, 166, 189 ], [ 240, 144, 167, 128 ], [ 240, 144, 167, 129 ], [ 240, 144, 167, 130 ], [ 240, 144, 167, 131 ], [ 240, 144, 167, 132 ], [ 240, 144, 167, 133 ], [ 240, 144, 167, 134 ], [ 240, 144, 167, 135 ], [ 240, 144, 167, 136 ], [ 240, 144, 167, 137 ], [ 240, 144, 167, 138 ], [ 240, 144, 167, 139 ], [ 240, 144, 167, 140 ], [ 240, 144, 167, 141 ], [ 240, 144, 167, 142 ], [ 240, 144, 167, 143 ], [ 240, 144, 167, 146 ], [ 240, 144, 167, 147 ], [ 240, 144, 167, 148 ], [ 240, 144, 167, 149 ], [ 240, 144, 167, 150 ], [ 240, 144, 167, 151 ], [ 240, 144, 167, 152 ], [ 240, 144, 167, 153 ], [ 240, 144, 167, 154 ], [ 240, 144, 167, 155 ], [ 240, 144, 167, 156 ], [ 240, 144, 167, 157 ], [ 240, 144, 167, 158 ], [ 240, 144, 167, 159 ], [ 240, 144, 167, 160 ], [ 240, 144, 167, 161 ], [ 240, 144, 167, 162 ], [ 240, 144, 167, 163 ], [ 240, 144, 167, 164 ], [ 240, 144, 167, 165 ], [ 240, 144, 167, 166 ], [ 240, 144, 167, 167 ], [ 240, 144, 167, 168 ], [ 240, 144, 167, 169 ], [ 240, 144, 167, 170 ], [ 240, 144, 167, 171 ], [ 240, 144, 167, 172 ], [ 240, 144, 167, 173 ], [ 240, 144, 167, 174 ], [ 240, 144, 167, 175 ], [ 240, 144, 167, 176 ], [ 240, 144, 167, 177 ], [ 240, 144, 167, 178 ], [ 240, 144, 167, 179 ], [ 240, 144, 167, 180 ], [ 240, 144, 167, 181 ], [ 240, 144, 167, 182 ], [ 240, 144, 167, 183 ], [ 240, 144, 167, 184 ], [ 240, 144, 167, 185 ], [ 240, 144, 167, 186 ], [ 240, 144, 167, 187 ], [ 240, 144, 167, 188 ], [ 240, 144, 167, 189 ], [ 240, 144, 167, 190 ], [ 240, 144, 167, 191 ], [ 240, 144, 169, 128 ], [ 240, 144, 169, 129 ], [ 240, 144, 169, 130 ], [ 240, 144, 169, 131 ], [ 240, 144, 169, 132 ], [ 240, 144, 169, 133 ], [ 240, 144, 169, 134 ], [ 240, 144, 169, 135 ], [ 240, 144, 169, 189 ], [ 240, 144, 169, 190 ], [ 240, 144, 170, 157 ], [ 240, 144, 170, 158 ], [ 240, 144, 170, 159 ], [ 240, 144, 171, 171 ], [ 240, 144, 171, 172 ], [ 240, 144, 171, 173 ], [ 240, 144, 171, 174 ], [ 240, 144, 171, 175 ], [ 240, 144, 173, 152 ], [ 240, 144, 173, 153 ], [ 240, 144, 173, 154 ], [ 240, 144, 173, 155 ], [ 240, 144, 173, 156 ], [ 240, 144, 173, 157 ], [ 240, 144, 173, 158 ], [ 240, 144, 173, 159 ], [ 240, 144, 173, 184 ], [ 240, 144, 173, 185 ], [ 240, 144, 173, 186 ], [ 240, 144, 173, 187 ], [ 240, 144, 173, 188 ], [ 240, 144, 173, 189 ], [ 240, 144, 173, 190 ], [ 240, 144, 173, 191 ], [ 240, 144, 174, 169 ], [ 240, 144, 174, 170 ], [ 240, 144, 174, 171 ], [ 240, 144, 174, 172 ], [ 240, 144, 174, 173 ], [ 240, 144, 174, 174 ], [ 240, 144, 174, 175 ], [ 240, 144, 179, 186 ], [ 240, 144, 179, 187 ], [ 240, 144, 179, 188 ], [ 240, 144, 179, 189 ], [ 240, 144, 179, 190 ], [ 240, 144, 179, 191 ], [ 240, 144, 185, 160 ], [ 240, 144, 185, 161 ], [ 240, 144, 185, 162 ], [ 240, 144, 185, 163 ], [ 240, 144, 185, 164 ], [ 240, 144, 185, 165 ], [ 240, 144, 185, 166 ], [ 240, 144, 185, 167 ], [ 240, 144, 185, 168 ], [ 240, 144, 185, 169 ], [ 240, 144, 185, 170 ], [ 240, 144, 185, 171 ], [ 240, 144, 185, 172 ], [ 240, 144, 185, 173 ], [ 240, 144, 185, 174 ], [ 240, 144, 185, 175 ], [ 240, 144, 185, 176 ], [ 240, 144, 185, 177 ], [ 240, 144, 185, 178 ], [ 240, 144, 185, 179 ], [ 240, 144, 185, 180 ], [ 240, 144, 185, 181 ], [ 240, 144, 185, 182 ], [ 240, 144, 185, 183 ], [ 240, 144, 185, 184 ], [ 240, 144, 185, 185 ], [ 240, 144, 185, 186 ], [ 240, 144, 185, 187 ], [ 240, 144, 185, 188 ], [ 240, 144, 185, 189 ], [ 240, 144, 185, 190 ], [ 240, 145, 129, 146 ], [ 240, 145, 129, 147 ], [ 240, 145, 129, 148 ], [ 240, 145, 129, 149 ], [ 240, 145, 129, 150 ], [ 240, 145, 129, 151 ], [ 240, 145, 129, 152 ], [ 240, 145, 129, 153 ], [ 240, 145, 129, 154 ], [ 240, 145, 129, 155 ], [ 240, 145, 129, 156 ], [ 240, 145, 129, 157 ], [ 240, 145, 129, 158 ], [ 240, 145, 129, 159 ], [ 240, 145, 129, 160 ], [ 240, 145, 129, 161 ], [ 240, 145, 129, 162 ], [ 240, 145, 129, 163 ], [ 240, 145, 129, 164 ], [ 240, 145, 129, 165 ], [ 240, 145, 135, 161 ], [ 240, 145, 135, 162 ], [ 240, 145, 135, 163 ], [ 240, 145, 135, 164 ], [ 240, 145, 135, 165 ], [ 240, 145, 135, 166 ], [ 240, 145, 135, 167 ], [ 240, 145, 135, 168 ], [ 240, 145, 135, 169 ], [ 240, 145, 135, 170 ], [ 240, 145, 135, 171 ], [ 240, 145, 135, 172 ], [ 240, 145, 135, 173 ], [ 240, 145, 135, 174 ], [ 240, 145, 135, 175 ], [ 240, 145, 135, 176 ], [ 240, 145, 135, 177 ], [ 240, 145, 135, 178 ], [ 240, 145, 135, 179 ], [ 240, 145, 135, 180 ], [ 240, 145, 156, 186 ], [ 240, 145, 156, 187 ], [ 240, 145, 163, 170 ], [ 240, 145, 163, 171 ], [ 240, 145, 163, 172 ], [ 240, 145, 163, 173 ], [ 240, 145, 163, 174 ], [ 240, 145, 163, 175 ], [ 240, 145, 163, 176 ], [ 240, 145, 163, 177 ], [ 240, 145, 163, 178 ], [ 240, 150, 173, 155 ], [ 240, 150, 173, 156 ], [ 240, 150, 173, 157 ], [ 240, 150, 173, 158 ], [ 240, 150, 173, 159 ], [ 240, 150, 173, 160 ], [ 240, 150, 173, 161 ], [ 240, 157, 141, 160 ], [ 240, 157, 141, 161 ], [ 240, 157, 141, 162 ], [ 240, 157, 141, 163 ], [ 240, 157, 141, 164 ], [ 240, 157, 141, 165 ], [ 240, 157, 141, 166 ], [ 240, 157, 141, 167 ], [ 240, 157, 141, 168 ], [ 240, 157, 141, 169 ], [ 240, 157, 141, 170 ], [ 240, 157, 141, 171 ], [ 240, 157, 141, 172 ], [ 240, 157, 141, 173 ], [ 240, 157, 141, 174 ], [ 240, 157, 141, 175 ], [ 240, 157, 141, 176 ], [ 240, 157, 141, 177 ], [ 240, 158, 163, 135 ], [ 240, 158, 163, 136 ], [ 240, 158, 163, 137 ], [ 240, 158, 163, 138 ], [ 240, 158, 163, 139 ], [ 240, 158, 163, 140 ], [ 240, 158, 163, 141 ], [ 240, 158, 163, 142 ], [ 240, 158, 163, 143 ], [ 240, 159, 132, 128 ], [ 240, 159, 132, 129 ], [ 240, 159, 132, 130 ], [ 240, 159, 132, 131 ], [ 240, 159, 132, 132 ], [ 240, 159, 132, 133 ], [ 240, 159, 132, 134 ], [ 240, 159, 132, 135 ], [ 240, 159, 132, 136 ], [ 240, 159, 132, 137 ], [ 240, 159, 132, 138 ], [ 240, 159, 132, 139 ], [ 240, 159, 132, 140 ] ]
#A def greeting(x :str) -> str: return "hello, "+ x def main(): # input s = input() # compute # output print(greeting(s)) if __name__ == '__main__': main()
# Calculadora de desconto valor_prod = float(input('Valor do produto: ')) desc = float(input('Valor do desconto: ')) valor_final = valor_prod * (desc / 100) print(f'O valor final do produto com desconto é {valor_final:.2f}')
def test_delete_first__group(app): app.session.open_home_page() app.session.login("admin", "secret") app.group.delete_first_group() app.session.logout()
#####count freq of words in text file word_count= dict() with open(r'C:/Users/Jen/Downloads/resumes/PracticeCodeM/cantrbry/plrabn12.txt', 'r') as fi: for line in fi: words = line.split() prepared_words = [w.lower() for w in words] for w in prepared_words: word_count[w] = 1 if w not in word_count else word_count[w]+1 def most_commmon_words(num=10): sorted_words = sorted(word_count, key=word_count.get, reverse=True) return sorted_words[:num] pprint_here = '\n'.join(most_commmon_words(5)) print(pprint_here)
""" Writing to a textfile: 1. open the file as either "w" or "a" (write or append) 2. write the data """ with open("hello.txt", "w") as fout: fout.write("Hello World\n") with open("/etc/shells", "r") as fin: with open("hello.txt", "a") as fout: for line in fin: fout.write(line)
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml. def _jar_artifact_impl(ctx): jar_name = "%s.jar" % ctx.name ctx.download( output=ctx.path("jar/%s" % jar_name), url=ctx.attr.urls, sha256=ctx.attr.sha256, executable=False ) src_name="%s-sources.jar" % ctx.name srcjar_attr="" has_sources = len(ctx.attr.src_urls) != 0 if has_sources: ctx.download( output=ctx.path("jar/%s" % src_name), url=ctx.attr.src_urls, sha256=ctx.attr.src_sha256, executable=False ) srcjar_attr ='\n srcjar = ":%s",' % src_name build_file_contents = """ package(default_visibility = ['//visibility:public']) java_import( name = 'jar', tags = ['maven_coordinates={artifact}'], jars = ['{jar_name}'],{srcjar_attr} ) filegroup( name = 'file', srcs = [ '{jar_name}', '{src_name}' ], visibility = ['//visibility:public'] )\n""".format(artifact = ctx.attr.artifact, jar_name = jar_name, src_name = src_name, srcjar_attr = srcjar_attr) ctx.file(ctx.path("jar/BUILD"), build_file_contents, False) return None jar_artifact = repository_rule( attrs = { "artifact": attr.string(mandatory = True), "sha256": attr.string(mandatory = True), "urls": attr.string_list(mandatory = True), "src_sha256": attr.string(mandatory = False, default=""), "src_urls": attr.string_list(mandatory = False, default=[]), }, implementation = _jar_artifact_impl ) def jar_artifact_callback(hash): src_urls = [] src_sha256 = "" source=hash.get("source", None) if source != None: src_urls = [source["url"]] src_sha256 = source["sha256"] jar_artifact( artifact = hash["artifact"], name = hash["name"], urls = [hash["url"]], sha256 = hash["sha256"], src_urls = src_urls, src_sha256 = src_sha256 ) native.bind(name = hash["bind"], actual = hash["actual"]) def list_dependencies(): return [ {"artifact": "com.google.protobuf:protobuf-java:3.5.1", "lang": "java", "sha1": "8c3492f7662fa1cbf8ca76a0f5eb1146f7725acd", "sha256": "b5e2d91812d183c9f053ffeebcbcda034d4de6679521940a19064714966c2cd4", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/google/protobuf/protobuf-java/3.5.1/protobuf-java-3.5.1.jar", "source": {"sha1": "7235a28a13938050e8cd5d9ed5133bebf7a4dca7", "sha256": "3be3115498d543851443bfa725c0c5b28140e363b3b7dec97f4028cd17040fa4", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/google/protobuf/protobuf-java/3.5.1/protobuf-java-3.5.1-sources.jar"} , "name": "com_google_protobuf_protobuf_java", "actual": "@com_google_protobuf_protobuf_java//jar", "bind": "jar/com/google/protobuf/protobuf_java"}, {"artifact": "com.lihaoyi:fastparse-utils_2.12:1.0.0", "lang": "java", "sha1": "02900ec8460abec27913f4154b338e61fd482607", "sha256": "fb6cd6484e21459e11fcd45f22f07ad75e3cb29eca0650b39aa388d13c8e7d0a", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/fastparse-utils_2.12/1.0.0/fastparse-utils_2.12-1.0.0.jar", "source": {"sha1": "891f76cff455350adc2f122421b67855f93c8dc3", "sha256": "19e055e9d870f2a2cec5a8e0b892f9afb6e4350ecce315ca519458c4f52f9253", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/fastparse-utils_2.12/1.0.0/fastparse-utils_2.12-1.0.0-sources.jar"} , "name": "com_lihaoyi_fastparse_utils_2_12", "actual": "@com_lihaoyi_fastparse_utils_2_12//jar", "bind": "jar/com/lihaoyi/fastparse_utils_2_12"}, {"artifact": "com.lihaoyi:fastparse_2.12:1.0.0", "lang": "java", "sha1": "2473a344aa1200fd50b7ff78281188c172f9cfcb", "sha256": "1227a00a26a4ad76ddcfa6eae2416687df7f3c039553d586324b32ba0a528fcc", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/fastparse_2.12/1.0.0/fastparse_2.12-1.0.0.jar", "source": {"sha1": "b1fdfd4c95bdb3f49ec78837be78d657a5ac86c0", "sha256": "290c1e9a4bad4d3724daec48324083fd0d97f51981a3fabbf75e2de1303da5ca", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/fastparse_2.12/1.0.0/fastparse_2.12-1.0.0-sources.jar"} , "name": "com_lihaoyi_fastparse_2_12", "actual": "@com_lihaoyi_fastparse_2_12//jar", "bind": "jar/com/lihaoyi/fastparse_2_12"}, {"artifact": "com.lihaoyi:sourcecode_2.12:0.1.4", "lang": "java", "sha1": "ef9a771975cb0860f2b42778c5cf1f5d76818979", "sha256": "9a3134484e596205d0acdcccd260e0854346f266cb4d24e1b8a31be54fbaf6d9", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/sourcecode_2.12/0.1.4/sourcecode_2.12-0.1.4.jar", "source": {"sha1": "ffb135dacaf0d989c260a486c8b86867bcab2e22", "sha256": "c5c53ba31a9f891988f9e21595e8728956be22d9ab9442e140840d0a73be8261", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/sourcecode_2.12/0.1.4/sourcecode_2.12-0.1.4-sources.jar"} , "name": "com_lihaoyi_sourcecode_2_12", "actual": "@com_lihaoyi_sourcecode_2_12//jar", "bind": "jar/com/lihaoyi/sourcecode_2_12"}, {"artifact": "com.thesamet.scalapb:lenses_2.12:0.8.0-RC1", "lang": "java", "sha1": "63f6dfbea05fa9793e20368d5b563db9b9444f16", "sha256": "6e061e15fa9f37662d89d1d0a3f4da64c73e3129108b672c792b36bf490ae8e2", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/thesamet/scalapb/lenses_2.12/0.8.0-RC1/lenses_2.12-0.8.0-RC1.jar", "source": {"sha1": "05b9aeff30f2b2fbc3682eefd05743577769ee4d", "sha256": "cf2899b36193b3fa7b99fd0476aca8453f0c4bd284d37da8a564cfbc69f24244", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/thesamet/scalapb/lenses_2.12/0.8.0-RC1/lenses_2.12-0.8.0-RC1-sources.jar"} , "name": "com_thesamet_scalapb_lenses_2_12", "actual": "@com_thesamet_scalapb_lenses_2_12//jar", "bind": "jar/com/thesamet/scalapb/lenses_2_12"}, {"artifact": "com.thesamet.scalapb:scalapb-runtime_2.12:0.8.0-RC1", "lang": "java", "sha1": "f9879e234145d4e9e9874509a538f3d64ad205ac", "sha256": "d922c788c8997e2524a39b1f43bac3c859516fc0ae580eab82c0db7e40aef944", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/thesamet/scalapb/scalapb-runtime_2.12/0.8.0-RC1/scalapb-runtime_2.12-0.8.0-RC1.jar", "source": {"sha1": "ea3d3cb5b134aef3a22ce41dd99ce4271ac5e6b0", "sha256": "fbc11c3ceffbd1d146c039e40c34fe8aa9b467f15f91668ebfe796c4cd0b91e4", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/thesamet/scalapb/scalapb-runtime_2.12/0.8.0-RC1/scalapb-runtime_2.12-0.8.0-RC1-sources.jar"} , "name": "com_thesamet_scalapb_scalapb_runtime_2_12", "actual": "@com_thesamet_scalapb_scalapb_runtime_2_12//jar", "bind": "jar/com/thesamet/scalapb/scalapb_runtime_2_12"}, # duplicates in org.scala-lang:scala-library promoted to 2.12.8 # - com.lihaoyi:fastparse-utils_2.12:1.0.0 wanted version 2.12.3 # - com.lihaoyi:fastparse_2.12:1.0.0 wanted version 2.12.3 # - com.lihaoyi:sourcecode_2.12:0.1.4 wanted version 2.12.2 # - com.thesamet.scalapb:lenses_2.12:0.8.0-RC1 wanted version 2.12.6 # - com.thesamet.scalapb:scalapb-runtime_2.12:0.8.0-RC1 wanted version 2.12.6 # - org.scalameta:common_2.12:4.1.6 wanted version 2.12.8 # - org.scalameta:io_2.12:4.1.6 wanted version 2.12.8 # - org.scalameta:semanticdb-javac_2.12:4.1.6 wanted version 2.12.8 # - org.scalameta:semanticdb_2.12:4.1.6 wanted version 2.12.8 {"artifact": "org.scala-lang:scala-library:2.12.8", "lang": "java", "sha1": "36b234834d8f842cdde963c8591efae6cf413e3f", "sha256": "321fb55685635c931eba4bc0d7668349da3f2c09aee2de93a70566066ff25c28", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scala-lang/scala-library/2.12.8/scala-library-2.12.8.jar", "source": {"sha1": "45ccb865e040cbef5d5620571527831441392f24", "sha256": "11482bcb49b2e47baee89c3b1ae10c6a40b89e2fbb0da2a423e062f444e13492", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scala-lang/scala-library/2.12.8/scala-library-2.12.8-sources.jar"} , "name": "org_scala_lang_scala_library", "actual": "@org_scala_lang_scala_library//jar", "bind": "jar/org/scala_lang/scala_library"}, {"artifact": "org.scalameta:common_2.12:4.1.6", "lang": "java", "sha1": "34c19fe6e9141bb8014453af7706c58844f58468", "sha256": "4bcf81a9734c14e881dd62d3934127b3dbfd8fdb5603cad249a4ec73492af0de", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/common_2.12/4.1.6/common_2.12-4.1.6.jar", "source": {"sha1": "84454c925612885d0ffba8fcbdba4cd7d19e0721", "sha256": "d7f71a0ebd2ec659c19c82974e09da5afd5598aa4bc4c59a624959845ca97c72", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/common_2.12/4.1.6/common_2.12-4.1.6-sources.jar"} , "name": "org_scalameta_common_2_12", "actual": "@org_scalameta_common_2_12//jar", "bind": "jar/org/scalameta/common_2_12"}, {"artifact": "org.scalameta:io_2.12:4.1.6", "lang": "java", "sha1": "b7aa0c103a59aa97fa1d273e56089621526d0d22", "sha256": "296e593460f5f700c01589dc717b35d44d6474d8f30c005bf6e7b13bbc5b9734", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/io_2.12/4.1.6/io_2.12-4.1.6.jar", "source": {"sha1": "f4da2f7b1f9ce2c86281c0fe8473e099e4073c5a", "sha256": "9d3ec1d68f6aed526b3956264f5223db95326608df71511c5b60db31e4e02ab6", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/io_2.12/4.1.6/io_2.12-4.1.6-sources.jar"} , "name": "org_scalameta_io_2_12", "actual": "@org_scalameta_io_2_12//jar", "bind": "jar/org/scalameta/io_2_12"}, {"artifact": "org.scalameta:semanticdb-javac_2.12:4.1.6", "lang": "scala", "sha1": "d16dd9ca4aebaabe6f3887a15a0bc12e26f06e51", "sha256": "74456b658ee596ce56d817ebf1e9cbd0181a04e73596c5ff9c94b9c32d929ef6", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/semanticdb-javac_2.12/4.1.6/semanticdb-javac_2.12-4.1.6.jar", "source": {"sha1": "5383f4da130713de35bed96506fed0800bd8b4be", "sha256": "f2a593828ed76ee00a207a5e748c8b6f71dd464ccce5d64eddacd9b49d03f671", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/semanticdb-javac_2.12/4.1.6/semanticdb-javac_2.12-4.1.6-sources.jar"} , "name": "org_scalameta_semanticdb_javac_2_12", "actual": "@org_scalameta_semanticdb_javac_2_12//jar:file", "bind": "jar/org/scalameta/semanticdb_javac_2_12"}, {"artifact": "org.scalameta:semanticdb_2.12:4.1.6", "lang": "java", "sha1": "38cdb3c7664b86ef54b414b53c4d80cf02a3b508", "sha256": "201fa1f10778e5b9c69ab9d524ca795be4f08e179506ae2ad7a8dcc6efeeb5cb", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/semanticdb_2.12/4.1.6/semanticdb_2.12-4.1.6.jar", "source": {"sha1": "39aaf6f189e7fa185001eff68d0b24d10e54e80c", "sha256": "6d9932d7830516f903ed2ff9cc6bf5af0e99b22b502014469a2b420e92fa596a", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/semanticdb_2.12/4.1.6/semanticdb_2.12-4.1.6-sources.jar"} , "name": "org_scalameta_semanticdb_2_12", "actual": "@org_scalameta_semanticdb_2_12//jar", "bind": "jar/org/scalameta/semanticdb_2_12"}, ] def maven_dependencies(callback = jar_artifact_callback): for hash in list_dependencies(): callback(hash)
# Copyright 2018 Oinam Romesh Meitei. All Rights Reserved. # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. class molog: filname = '' def __init__(self): apple = 0 def set_name(self,string): molog.filname = string def initiate(self): out = open(molog.filname,'w') out.write(' ******************\n') out.write(' ***** MOLEPY *****\n') out.write(' ******************\n') out.write('\n') out.close() def writer(self,str1,*args): out = open(molog.filname,'a') out.write(str1.format(*args)) out.close()
Dev = { "db_server": "Dbsed4555", "user": "<db_username>", "passwd": "<password>", "driver": "SQL Server", "port": "1433" } Oracle = { "db_server": "es20-scan01", "port": "1521", "user": "<db_username>", "passwd": "<password>", "service_name": "cmc1st01svc.uhc.com" } Sybase = { "db_server": "DBSPS0181", "user": "<db_username>", "passwd": "<password>", "driver": "Adaptive Server Enterprise", "port": "4106" } # Test = { # "db_server": "", # "user": "", # "passwd": "my secret password", # "driver": "SQL Server" # } # # Stage = { # "db_server": "Dbsed4555", # "user": "<db_username>", # "passwd": "<password>", # "driver": "SQL Server" # } # # Prod = { # "db_server": "localhost", # "user": "", # "passwd": "my secret password", # "driver": "SQL Server" # }
message_id = { b"\x00\x00": "init", b"\x00\x01": "ping", b"\x00\x02": "pong", b"\x00\x03": "give nodes", b"\x00\x04": "take nodes", b"\x00\x05": "give next headers", b"\x00\x06": "take the headers", b"\x00\x07": "give blocks", b"\x00\x08": "take the blocks", b"\x00\x09": "give the txos", b"\x00\x0a": "take the txos", b"\x00\x0b": "give outputs", b"\x00\x0c": "take TBM transaction", b"\x00\x0d": "give TBM transaction", b"\x00\x0e": "take tip info", b"\x00\x0f": "find common root", b"\x00\x10": "find common root response" } inv_message_id = {v: k for k, v in message_id.items()}
""" math 模块提供了对 C 标准定义的数学函数的访问。 本模块需要带有硬件 FPU,精度是32位,这个模块需要浮点功能支持。 """ e = ... # type: int pi = ... # type: int def acos(x) -> None: """传入弧度值,计算cos(x)的反三角函数。""" ... def acosh(x) -> None: """返回 x 的逆双曲余弦。""" ... def asin(x) -> None: """传入弧度值,计算sin(x)的反三角函数。 示例: - x = math.asin(0.5) - print(x) 0.5235988""" ... def asinh(x) -> None: """返回 x 的逆双曲正弦。""" ... def atan(x) -> None: """返回 x 的逆切线。""" ... def atan2(y, x) -> None: """Return the principal value of the inverse tangent of y/x.""" ... def atanh(x) -> None: """Return the inverse hyperbolic tangent of x.""" ... def ceil(x) -> None: """向上取整。 示例: - x = math.ceil(5.6454) - print(x) - 6 """ ... def copysign(x, y) -> None: """Return x with the sign of y.""" ... def cos(x) -> None: """传入弧度值,计算余弦。 示例:计算cos60° - math.cos(math.radians(60)) - 0.5 """ ... def cosh(x) -> None: """Return the hyperbolic cosine of x.""" ... def degrees(x) -> None: """弧度转化为角度。 示例: - x = math.degrees(1.047198) - print(x) - 60.00002""" ... def erf(x) -> None: """Return the error function of x.""" ... def erfc(x) -> None: """Return the complementary error function of x.""" ... def exp(x) -> None: """计算e的x次方(幂)。 示例: - x = math.exp(2) - print(x) - 7.389056""" ... def expm1(x) -> None: """计算 math.exp(x) - 1。""" ... def fabs(x) -> None: """计算绝对值。 示例: - x = math.fabs(-5) - print(x) - 5.0 - y = math.fabs(5.0) - print(y) - 5.0 """ ... def floor(x) -> None: """向下取整。 示例: - x = math.floor(2.99) - print(x) 2 - y = math.floor(-2.34) - print(y) -3 """ ... def fmod(x, y) -> None: """取x除以y的模。 示例: - x = math.fmod(4, 5) - print(x) 4.0 """ ... def frexp(x) -> None: """Decomposes a floating-point number into its mantissa and exponent. The returned value is the tuple (m, e) such that x == m * 2**e exactly. If x == 0 then the function returns (0.0, 0), otherwise the relation 0.5 <= abs(m) < 1 holds.""" ... def gamma(x) -> None: """返回伽马函数。 示例: - x = math.gamma(5.21) - print(x) 33.08715。 """ ... def isfinite(x) -> None: """Return True if x is finite.""" ... def isinf(x) -> None: """Return True if x is infinite.""" ... def isnan(x) -> None: """Return True if x is not-a-number""" ... def ldexp(x, exp) -> None: """Return x * (2**exp).""" ... def lgamma(x) -> None: """返回伽马函数的自然对数。 示例: - x = math.lgamma(5.21) - print(x) 3.499145""" ... def log(x) -> None: """计算以e为底的x的对数。 示例: - x = math.log(10) - print(x) 2.302585""" ... def log10(x) -> None: """计算以10为底的x的对数。 示例: - x = math.log10(10) - print(x) 1.0""" ... def log2(x) -> None: """计算以2为底的x的对数。 示例: - x = math.log2(8) - print(x) 3.0""" ... def modf(x) -> None: """Return a tuple of two floats, being the fractional and integral parts of x. Both return values have the same sign as x.""" ... def pow(x, y) -> None: """计算 x 的 y 次方(幂)。 示例: - x = math.pow(2, 3) - print(x) 8.0""" ... def radians(x) -> None: """角度转化为弧度。 示例: - x = math.radians(60) - print(x) 1.047198""" ... def sin(x) -> None: """传入弧度值,计算正弦。 示例:计算sin90° - math.sin(math.radians(90)) 1.0""" ... def sinh(x) -> None: """Return the hyperbolic sine of x.""" ... def sqrt(x) -> None: """ 计算平方根。 示例: - x = math.sqrt(9) - print(x) 3.0""" ... def tan(x) -> None: """ 传入弧度值,计算正切。 示例:计算tan60° - math.tan(math.radians(60)) 1.732051""" ... def tanh(x) -> None: """Return the hyperbolic tangent of x.""" ... def trunc(x) -> None: """ 取整。 示例: - x = math.trunc(5.12) - print(x) 5 - y = math.trunc(-6.8) - print(y) -6""" ...
def accuracy(y_test, y): cont = 0 for i in range(len(y)): if y[i] == y_test[i]: cont += 1 return cont / float(len(y)) def f_measure(y_test, y, beta=1): tp = 0.0 # true pos fp = 0.0 # false pos tn = 0.0 # true neg fn = 0.0 # false neg for i in range(len(y)): if y_test[i] == 1.0 and y[i] == 1.0: tp += 1.0 elif y_test[i] == 1.0 and y[i] == 0.0: fp += 1.0 elif y_test[i] == 0.0 and y[i] == 0.0: tn += 1.0 elif y_test[i] == 0.0 and y[i] == 1.0: fn += 1.0 if (tp + fp) != 0.0: precision = tp / (tp + fp) else: precision = 0.0 if (tp + fn) != 0.0: recall = tp / (tp + fn) else: recall = 0.0 if (((beta ** 2.0) * precision) + recall) != 0: resultado = (1.0 + (beta ** 2.0)) * ((precision * recall) / (((beta ** 2.0) * precision) + recall)) else: resultado = 0.0 return resultado
# MIT License # (C) Copyright 2021 Hewlett Packard Enterprise Development LP. # # applianceCrashHistory : returns and posts all Appliances crash history def appliance_crash_history( self, action: str = None, ): """Get appliance crash history. Can optionally send crash reports to Cloud Portal .. list-table:: :header-rows: 1 * - Swagger Section - Method - Endpoint * - applianceCrashHistory - GET - /gms/applianceCrashHistory :param action: If this paramter has a value, the appliance crash reports will be sent to Cloud Portal, defaults to None :type action: str, optional :return: Returns True/False based on successful call sending crash reports to Cloud Portal. If action is None, will return dict of appliance crash history. :rtype: bool or dict """ if action is not None: return self._get( "/gms/applianceCrashHistory?action={}".format(action), expected_status=[204], return_type="bool", ) else: return self._get("/gms/applianceCrashHistory")
name0_1_1_0_1_0_0 = None name0_1_1_0_1_0_1 = None name0_1_1_0_1_0_2 = None name0_1_1_0_1_0_3 = None name0_1_1_0_1_0_4 = None
class HandResponse: cost = None han = None fu = None fu_details = None yaku = None error = None is_open_hand = False def __init__(self, cost=None, han=None, fu=None, yaku=None, error=None, fu_details=None, is_open_hand=False): """ :param cost: dict :param han: int :param fu: int :param yaku: list :param error: str :param fu_details: dict """ self.cost = cost self.han = han self.fu = fu self.error = error self.is_open_hand = is_open_hand # adding this field for yaku reporting if fu_details: self.fu_details = sorted(fu_details, key=lambda x: x["fu"], reverse=True) else: self.fu_details = None if yaku: self.yaku = sorted(yaku, key=lambda x: x.yaku_id) else: self.yaku = None def __str__(self): if self.error: return self.error else: return "{} han, {} fu".format(self.han, self.fu)
''' - Leetcode problem: 653 - Difficulty: Easy - Brief problem description: Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. Example 1: Input: 5 / \ 3 6 / \ \ 2 4 7 Target = 9 Output: True Example 2: Input: 5 / \ 3 6 / \ \ 2 4 7 Target = 28 Output: False - Solution Summary: 1. Search the tree recursively, maintain a set of targets. - Used Resources: --- Bo Zhou ''' # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def findTarget(self, root, k): """ :type root: TreeNode :type k: int :rtype: bool """ targets = set() return self.findTarget2(root, k, targets) def findTarget2(self, root, k, targets): if root == None: return False elif root.val in targets: return True else: targets.add(k - root.val) return self.findTarget2(root.left, k, targets) or self.findTarget2(root.right, k, targets)
# 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 isSymmetric(self, root: Optional[TreeNode]) -> bool: # both does not exist if not root.left and not root.right: return True # one exists - left or right elif not root.left or not root.right: return False # both left and right exists stack1=[root.left] output1=[root.left.val] stack2=[root.right] output2=[root.right.val] # append left first while(stack1): cur = stack1.pop(0) if cur.left: stack1.append(cur.left) output1.append(cur.left.val) else: output1.append(101) # 101 = null if cur.right: stack1.append(cur.right) output1.append(cur.right.val) else: output1.append(101) # append right first while(stack2): cur = stack2.pop(0) if cur.right: output2.append(cur.right.val) stack2.append(cur.right) else: output2.append(101) if cur.left: output2.append(cur.left.val) stack2.append(cur.left) else: output2.append(101) if output1==output2: return True else: return False
load("@bazel_gazelle//:deps.bzl", "go_repository") def go_dependencies(): go_repository( name = "com_github_aws_aws_sdk_go", importpath = "github.com/aws/aws-sdk-go", sum = "h1:3+AsCrxxnhiUQEhWV+j3kEs7aBCIn2qkDjA+elpxYPU=", version = "v1.33.13", ) go_repository( name = "com_github_bazelbuild_remote_apis", importpath = "github.com/bazelbuild/remote-apis", patches = ["@com_github_buildbarn_bb_storage//:patches/com_github_bazelbuild_remote_apis/golang.diff"], sum = "h1:in8ww8rHwdcmLN3J9atiRDvAaYHobXBJzp7uAxlUREU=", version = "v0.0.0-20201030192148-aa8e718768c2", ) go_repository( name = "com_github_beorn7_perks", importpath = "github.com/beorn7/perks", sum = "h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=", version = "v1.0.1", ) go_repository( name = "com_github_buildbarn_bb_storage", importpath = "github.com/buildbarn/bb-storage", sum = "h1:3AAcc2jsQLIZKhJn3NFPX6FLDDpnF9qNEGJhvHmW+4k=", version = "v0.0.0-20210107084738-1b5cc8edeecb", ) go_repository( name = "com_github_golang_mock", importpath = "github.com/golang/mock", patches = ["@com_github_buildbarn_bb_storage//:patches/com_github_golang_mock/mocks-for-funcs.diff"], sum = "h1:YS+8QJ8yKSoB7Qy3WF0DMDFj2TkfASqhc0aNIIxjl6I=", version = "v1.4.4-0.20200406172829-6d816de489c1", ) go_repository( name = "com_github_google_uuid", importpath = "github.com/google/uuid", sum = "h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=", version = "v1.1.1", ) go_repository( name = "com_github_go_redis_redis", importpath = "github.com/go-redis/redis", sum = "h1:BKZuG6mCnRj5AOaWJXoCgf6rqTYnYJLe4en2hxT7r9o=", version = "v6.15.8+incompatible", ) go_repository( name = "com_github_grpc_ecosystem_go_grpc_prometheus", importpath = "github.com/grpc-ecosystem/go-grpc-prometheus", patches = ["@com_github_buildbarn_bb_storage//:patches/com_github_grpc_ecosystem_go_grpc_prometheus/client-metrics-prevent-handled-twice.diff"], sum = "h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=", version = "v1.2.0", ) go_repository( name = "com_github_lazybeaver_xorshift", importpath = "github.com/lazybeaver/xorshift", sum = "h1:TfmftEfB1zJiDTFi3Qw1xlbEbfJPKUhEDC19clfBMb8=", version = "v0.0.0-20170702203709-ce511d4823dd", ) go_repository( name = "com_github_matttproud_golang_protobuf_extensions", importpath = "github.com/matttproud/golang_protobuf_extensions", sum = "h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=", version = "v1.0.1", ) go_repository( name = "com_github_prometheus_client_golang", importpath = "github.com/prometheus/client_golang", sum = "h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA=", version = "v1.7.1", ) go_repository( name = "com_github_cespare_xxhash_v2", importpath = "github.com/cespare/xxhash/v2", sum = "h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=", version = "v2.1.1", ) go_repository( name = "com_github_prometheus_client_model", importpath = "github.com/prometheus/client_model", sum = "h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=", version = "v0.2.0", ) go_repository( name = "com_github_prometheus_common", importpath = "github.com/prometheus/common", sum = "h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=", version = "v0.10.0", ) go_repository( name = "com_github_prometheus_procfs", importpath = "github.com/prometheus/procfs", sum = "h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=", version = "v0.1.3", ) go_repository( name = "com_github_stretchr_testify", importpath = "github.com/stretchr/testify", sum = "h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=", version = "v1.6.1", ) go_repository( name = "in_gopkg_yaml_v2", importpath = "gopkg.in/yaml.v2", sum = "h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=", version = "v2.3.0", ) go_repository( name = "io_opencensus_go_contrib_exporter_prometheus", importpath = "contrib.go.opencensus.io/exporter/prometheus", sum = "h1:9PUk0/8V0LGoPqVCrf8fQZJkFGBxudu8jOjQSMwoD6w=", version = "v0.2.0", ) go_repository( name = "io_opencensus_go_contrib_exporter_jaeger", importpath = "contrib.go.opencensus.io/exporter/jaeger", sum = "h1:nhTv/Ry3lGmqbJ/JGvCjWxBl5ozRfqo86Ngz59UAlfk=", version = "v0.2.0", ) go_repository( name = "dev_gocloud", importpath = "gocloud.dev", sum = "h1:mbEKMfnyPV7W1Rj35R1xXfjszs9dXkwSOq2KoFr25g8=", version = "v0.20.0", ) go_repository( name = "org_golang_google_api", importpath = "google.golang.org/api", sum = "h1:BaiDisFir8O4IJxvAabCGGkQ6yCJegNQqSVoYUNAnbk=", version = "v0.29.0", ) go_repository( name = "com_github_uber_jaeger_client_go", importpath = "github.com/uber/jaeger-client-go", sum = "h1:Q2Pp6v3QYiocMxomCaJuwQGFt7E53bPYqEgug/AoBtY=", version = "v2.16.0+incompatible", ) go_repository( name = "org_golang_x_sync", importpath = "golang.org/x/sync", sum = "h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=", version = "v0.0.0-20200625203802-6e8e738ad208", ) go_repository( name = "io_opencensus_go", importpath = "go.opencensus.io", sum = "h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto=", version = "v0.22.4", ) go_repository( name = "com_google_cloud_go", importpath = "cloud.google.com/go", sum = "h1:vtAfVc723K3xKq1BQydk/FyCldnaNFhGhpJxaJzgRMQ=", version = "v0.58.0", ) go_repository( name = "org_golang_x_xerrors", importpath = "golang.org/x/xerrors", sum = "h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=", version = "v0.0.0-20191204190536-9bdfabe68543", ) go_repository( name = "com_github_hashicorp_golang_lru", importpath = "github.com/hashicorp/golang-lru", sum = "h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=", version = "v0.5.1", ) go_repository( name = "com_github_googleapis_gax_go", importpath = "github.com/googleapis/gax-go", sum = "h1:silFMLAnr330+NRuag/VjIGF7TLp/LBrV2CJKFLWEww=", version = "v2.0.2+incompatible", ) go_repository( name = "org_golang_x_oauth2", importpath = "golang.org/x/oauth2", sum = "h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=", version = "v0.0.0-20200107190931-bf48bf16ab8d", ) go_repository( name = "com_github_google_wire", build_extra_args = ["--exclude=internal/wire/testdata"], importpath = "github.com/google/wire", sum = "h1:kXcsA/rIGzJImVqPdhfnr6q0xsS9gU0515q1EPpJ9fE=", version = "v0.4.0", ) go_repository( name = "com_github_azure_azure_pipeline_go", importpath = "github.com/Azure/azure-pipeline-go", sum = "h1:6oiIS9yaG6XCCzhgAgKFfIWyo4LLCiDhZot6ltoThhY=", version = "v0.2.2", ) go_repository( name = "com_github_azure_azure_storage_blob_go", importpath = "github.com/Azure/azure-storage-blob-go", sum = "h1:evCwGreYo3XLeBV4vSxLbLiYb6e0SzsJiXQVRGsRXxs=", version = "v0.10.0", ) go_repository( name = "com_github_google_go_jsonnet", importpath = "github.com/google/go-jsonnet", patches = ["@com_github_buildbarn_bb_storage//:patches/com_github_google_go_jsonnet/astgen.diff"], sum = "h1:Nb4EEOp+rdeGGyB1rQ5eisgSAqrTnhf9ip+X6lzZbY0=", version = "v0.16.0", ) go_repository( name = "com_github_fatih_color", importpath = "github.com/fatih/color", sum = "h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=", version = "v1.9.0", ) go_repository( name = "com_github_gorilla_mux", importpath = "github.com/gorilla/mux", sum = "h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=", version = "v1.7.4", ) go_repository( name = "com_github_googleapis_gax_go_v2", importpath = "github.com/googleapis/gax-go/v2", sum = "h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=", version = "v2.0.5", ) go_repository( name = "com_github_mattn_go_ieproxy", importpath = "github.com/mattn/go-ieproxy", sum = "h1:qiyop7gCflfhwCzGyeT0gro3sF9AIg9HU98JORTkqfI=", version = "v0.0.1", ) go_repository( name = "org_golang_google_grpc", build_file_proto_mode = "disable", importpath = "google.golang.org/grpc", sum = "h1:T7P4R73V3SSDPhH7WW7ATbfViLtmamH0DKrP3f9AuDI=", version = "v1.31.0", ) go_repository( name = "org_golang_x_lint", importpath = "golang.org/x/lint", sum = "h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=", version = "v0.0.0-20200302205851-738671d3881b", ) go_repository( name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", sum = "h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=", version = "v0.0.1-2020.1.4", ) go_repository( name = "com_github_alecthomas_template", importpath = "github.com/alecthomas/template", sum = "h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=", version = "v0.0.0-20190718012654-fb15b899a751", ) go_repository( name = "com_github_alecthomas_units", importpath = "github.com/alecthomas/units", sum = "h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E=", version = "v0.0.0-20190717042225-c3de453c63f4", ) go_repository( name = "com_github_azure_azure_amqp_common_go_v3", importpath = "github.com/Azure/azure-amqp-common-go/v3", sum = "h1:j9tjcwhypb/jek3raNrwlCIl7iKQYOug7CLpSyBBodc=", version = "v3.0.0", ) go_repository( name = "com_github_azure_azure_sdk_for_go", importpath = "github.com/Azure/azure-sdk-for-go", sum = "h1:aFlw3lP7ZHQi4m1kWCpcwYtczhDkGhDoRaMTaxcOf68=", version = "v37.1.0+incompatible", ) go_repository( name = "com_github_azure_azure_service_bus_go", importpath = "github.com/Azure/azure-service-bus-go", sum = "h1:w9foWsHoOt1n8R0O58Co/ddrazx5vfDY0g64/6UWyuo=", version = "v0.10.1", ) go_repository( name = "com_github_azure_go_amqp", importpath = "github.com/Azure/go-amqp", sum = "h1:/Uyqh30J5JrDFAOERQtEqP0qPWkrNXxr94vRnSa54Ac=", version = "v0.12.7", ) go_repository( name = "com_github_azure_go_autorest_autorest", importpath = "github.com/Azure/go-autorest/autorest", sum = "h1:OZEIaBbMdUE/Js+BQKlpO81XlISgipr6yDJ+PSwsgi4=", version = "v0.9.3", ) go_repository( name = "com_github_azure_go_autorest_autorest_adal", importpath = "github.com/Azure/go-autorest/autorest/adal", sum = "h1:O1AGG9Xig71FxdX9HO5pGNyZ7TbSyHaVg+5eJO/jSGw=", version = "v0.8.3", ) go_repository( name = "com_github_azure_go_autorest_autorest_azure_auth", importpath = "github.com/Azure/go-autorest/autorest/azure/auth", sum = "h1:iM6UAvjR97ZIeR93qTcwpKNMpV+/FTWjwEbuPD495Tk=", version = "v0.4.2", ) go_repository( name = "com_github_azure_go_autorest_autorest_azure_cli", importpath = "github.com/Azure/go-autorest/autorest/azure/cli", sum = "h1:LXl088ZQlP0SBppGFsRZonW6hSvwgL5gRByMbvUbx8U=", version = "v0.3.1", ) go_repository( name = "com_github_azure_go_autorest_autorest_date", importpath = "github.com/Azure/go-autorest/autorest/date", sum = "h1:yW+Zlqf26583pE43KhfnhFcdmSWlm5Ew6bxipnr/tbM=", version = "v0.2.0", ) go_repository( name = "com_github_azure_go_autorest_autorest_mocks", importpath = "github.com/Azure/go-autorest/autorest/mocks", sum = "h1:qJumjCaCudz+OcqE9/XtEPfvtOjOmKaui4EOpFI6zZc=", version = "v0.3.0", ) go_repository( name = "com_github_azure_go_autorest_autorest_to", importpath = "github.com/Azure/go-autorest/autorest/to", sum = "h1:zebkZaadz7+wIQYgC7GXaz3Wb28yKYfVkkBKwc38VF8=", version = "v0.3.0", ) go_repository( name = "com_github_azure_go_autorest_autorest_validation", importpath = "github.com/Azure/go-autorest/autorest/validation", sum = "h1:15vMO4y76dehZSq7pAaOLQxC6dZYsSrj2GQpflyM/L4=", version = "v0.2.0", ) go_repository( name = "com_github_azure_go_autorest_logger", importpath = "github.com/Azure/go-autorest/logger", sum = "h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=", version = "v0.1.0", ) go_repository( name = "com_github_azure_go_autorest_tracing", importpath = "github.com/Azure/go-autorest/tracing", sum = "h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=", version = "v0.5.0", ) go_repository( name = "com_github_burntsushi_toml", importpath = "github.com/BurntSushi/toml", sum = "h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=", version = "v0.3.1", ) go_repository( name = "com_github_burntsushi_xgb", importpath = "github.com/BurntSushi/xgb", sum = "h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=", version = "v0.0.0-20160522181843-27f122750802", ) go_repository( name = "com_github_census_instrumentation_opencensus_proto", build_extra_args = ["-exclude=src"], importpath = "github.com/census-instrumentation/opencensus-proto", sum = "h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=", version = "v0.2.1", ) go_repository( name = "com_github_chzyer_logex", importpath = "github.com/chzyer/logex", sum = "h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=", version = "v1.1.10", ) go_repository( name = "com_github_chzyer_readline", importpath = "github.com/chzyer/readline", sum = "h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=", version = "v0.0.0-20180603132655-2972be24d48e", ) go_repository( name = "com_github_chzyer_test", importpath = "github.com/chzyer/test", sum = "h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=", version = "v0.0.0-20180213035817-a1ea475d72b1", ) go_repository( name = "com_github_client9_misspell", importpath = "github.com/client9/misspell", sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", version = "v0.3.4", ) go_repository( name = "com_github_cncf_udpa_go", importpath = "github.com/cncf/udpa/go", sum = "h1:WBZRG4aNOuI15bLRrCgN8fCq8E5Xuty6jGbmSNEvSsU=", version = "v0.0.0-20191209042840-269d4d468f6f", ) go_repository( name = "com_github_davecgh_go_spew", importpath = "github.com/davecgh/go-spew", sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", version = "v1.1.1", ) go_repository( name = "com_github_devigned_tab", importpath = "github.com/devigned/tab", sum = "h1:3mD6Kb1mUOYeLpJvTVSDwSg5ZsfSxfvxGRTxRsJsITA=", version = "v0.1.1", ) go_repository( name = "com_github_dgrijalva_jwt_go", importpath = "github.com/dgrijalva/jwt-go", sum = "h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=", version = "v3.2.0+incompatible", ) go_repository( name = "com_github_dimchansky_utfbom", importpath = "github.com/dimchansky/utfbom", sum = "h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4=", version = "v1.1.0", ) go_repository( name = "com_github_envoyproxy_go_control_plane", importpath = "github.com/envoyproxy/go-control-plane", sum = "h1:rEvIZUSZ3fx39WIi3JkQqQBitGwpELBIYWeBVh6wn+E=", version = "v0.9.4", ) go_repository( name = "com_github_envoyproxy_protoc_gen_validate", importpath = "github.com/envoyproxy/protoc-gen-validate", sum = "h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=", version = "v0.1.0", ) go_repository( name = "com_github_fortytw2_leaktest", importpath = "github.com/fortytw2/leaktest", sum = "h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=", version = "v1.3.0", ) go_repository( name = "com_github_fsnotify_fsnotify", importpath = "github.com/fsnotify/fsnotify", sum = "h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=", version = "v1.4.9", ) go_repository( name = "com_github_go_gl_glfw", importpath = "github.com/go-gl/glfw", sum = "h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0=", version = "v0.0.0-20190409004039-e6da0acd62b1", ) go_repository( name = "com_github_go_gl_glfw_v3_3_glfw", importpath = "github.com/go-gl/glfw/v3.3/glfw", sum = "h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=", version = "v0.0.0-20200222043503-6f7a984d4dc4", ) go_repository( name = "com_github_go_ini_ini", importpath = "github.com/go-ini/ini", sum = "h1:Mujh4R/dH6YL8bxuISne3xX2+qcQ9p0IxKAP6ExWoUo=", version = "v1.25.4", ) go_repository( name = "com_github_go_kit_kit", importpath = "github.com/go-kit/kit", sum = "h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk=", version = "v0.9.0", ) go_repository( name = "com_github_go_logfmt_logfmt", importpath = "github.com/go-logfmt/logfmt", sum = "h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=", version = "v0.4.0", ) go_repository( name = "com_github_go_sql_driver_mysql", importpath = "github.com/go-sql-driver/mysql", sum = "h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=", version = "v1.5.0", ) go_repository( name = "com_github_go_stack_stack", importpath = "github.com/go-stack/stack", sum = "h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=", version = "v1.8.0", ) go_repository( name = "com_github_gogo_protobuf", importpath = "github.com/gogo/protobuf", sum = "h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo=", version = "v1.1.1", ) go_repository( name = "com_github_golang_glog", importpath = "github.com/golang/glog", sum = "h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=", version = "v0.0.0-20160126235308-23def4e6c14b", ) go_repository( name = "com_github_golang_groupcache", importpath = "github.com/golang/groupcache", sum = "h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=", version = "v0.0.0-20200121045136-8c9f03a8e57e", ) go_repository( name = "com_github_golang_protobuf", importpath = "github.com/golang/protobuf", sum = "h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=", version = "v1.4.2", ) go_repository( name = "com_github_google_btree", importpath = "github.com/google/btree", sum = "h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=", version = "v1.0.0", ) go_repository( name = "com_github_google_go_cmp", importpath = "github.com/google/go-cmp", sum = "h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=", version = "v0.5.1", ) go_repository( name = "com_github_google_go_replayers_grpcreplay", importpath = "github.com/google/go-replayers/grpcreplay", sum = "h1:eNb1y9rZFmY4ax45uEEECSa8fsxGRU+8Bil52ASAwic=", version = "v0.1.0", ) go_repository( name = "com_github_google_go_replayers_httpreplay", importpath = "github.com/google/go-replayers/httpreplay", sum = "h1:AX7FUb4BjrrzNvblr/OlgwrmFiep6soj5K2QSDW7BGk=", version = "v0.1.0", ) go_repository( name = "com_github_google_gofuzz", importpath = "github.com/google/gofuzz", sum = "h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=", version = "v1.0.0", ) go_repository( name = "com_github_google_martian", importpath = "github.com/google/martian", sum = "h1:xmapqc1AyLoB+ddYT6r04bD9lIjlOqGaREovi0SzFaE=", version = "v2.1.1-0.20190517191504-25dcb96d9e51+incompatible", ) go_repository( name = "com_github_google_pprof", importpath = "github.com/google/pprof", sum = "h1:lIC98ZUNah83ky7d9EXktLFe4H7Nwus59dTOLXr8xAI=", version = "v0.0.0-20200507031123-427632fa3b1c", ) go_repository( name = "com_github_google_renameio", importpath = "github.com/google/renameio", sum = "h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA=", version = "v0.1.0", ) go_repository( name = "com_github_google_subcommands", importpath = "github.com/google/subcommands", sum = "h1:/eqq+otEXm5vhfBrbREPCSVQbvofip6kIz+mX5TUH7k=", version = "v1.0.1", ) go_repository( name = "com_github_googlecloudplatform_cloudsql_proxy", importpath = "github.com/GoogleCloudPlatform/cloudsql-proxy", sum = "h1:sTOp2Ajiew5XIH92YSdwhYc+bgpUX5j5TKK/Ac8Saw8=", version = "v0.0.0-20191009163259-e802c2cb94ae", ) go_repository( name = "com_github_hpcloud_tail", importpath = "github.com/hpcloud/tail", sum = "h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=", version = "v1.0.0", ) go_repository( name = "com_github_ianlancetaylor_demangle", importpath = "github.com/ianlancetaylor/demangle", sum = "h1:UDMh68UUwekSh5iP2OMhRRZJiiBccgV7axzUG8vi56c=", version = "v0.0.0-20181102032728-5e5cf60278f6", ) go_repository( name = "com_github_jmespath_go_jmespath", importpath = "github.com/jmespath/go-jmespath", sum = "h1:OS12ieG61fsCg5+qLJ+SsW9NicxNkg3b25OyT2yCeUc=", version = "v0.3.0", ) go_repository( name = "com_github_joho_godotenv", importpath = "github.com/joho/godotenv", sum = "h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=", version = "v1.3.0", ) go_repository( name = "com_github_json_iterator_go", importpath = "github.com/json-iterator/go", sum = "h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=", version = "v1.1.10", ) go_repository( name = "com_github_jstemmer_go_junit_report", importpath = "github.com/jstemmer/go-junit-report", sum = "h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=", version = "v0.9.1", ) go_repository( name = "com_github_julienschmidt_httprouter", importpath = "github.com/julienschmidt/httprouter", sum = "h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g=", version = "v1.2.0", ) go_repository( name = "com_github_kisielk_gotool", importpath = "github.com/kisielk/gotool", sum = "h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=", version = "v1.0.0", ) go_repository( name = "com_github_konsorten_go_windows_terminal_sequences", importpath = "github.com/konsorten/go-windows-terminal-sequences", sum = "h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=", version = "v1.0.1", ) go_repository( name = "com_github_kr_logfmt", importpath = "github.com/kr/logfmt", sum = "h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=", version = "v0.0.0-20140226030751-b84e30acd515", ) go_repository( name = "com_github_kr_pretty", importpath = "github.com/kr/pretty", sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=", version = "v0.1.0", ) go_repository( name = "com_github_kr_pty", importpath = "github.com/kr/pty", sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", version = "v1.1.1", ) go_repository( name = "com_github_kr_text", importpath = "github.com/kr/text", sum = "h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=", version = "v0.1.0", ) go_repository( name = "com_github_lib_pq", importpath = "github.com/lib/pq", sum = "h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=", version = "v1.1.1", ) go_repository( name = "com_github_mattn_go_colorable", importpath = "github.com/mattn/go-colorable", sum = "h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=", version = "v0.1.4", ) go_repository( name = "com_github_mattn_go_isatty", importpath = "github.com/mattn/go-isatty", sum = "h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=", version = "v0.0.11", ) go_repository( name = "com_github_mitchellh_go_homedir", importpath = "github.com/mitchellh/go-homedir", sum = "h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=", version = "v1.1.0", ) go_repository( name = "com_github_mitchellh_mapstructure", importpath = "github.com/mitchellh/mapstructure", sum = "h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=", version = "v1.1.2", ) go_repository( name = "com_github_modern_go_concurrent", importpath = "github.com/modern-go/concurrent", sum = "h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=", version = "v0.0.0-20180306012644-bacd9c7ef1dd", ) go_repository( name = "com_github_modern_go_reflect2", importpath = "github.com/modern-go/reflect2", sum = "h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=", version = "v1.0.1", ) go_repository( name = "com_github_mwitkow_go_conntrack", importpath = "github.com/mwitkow/go-conntrack", sum = "h1:F9x/1yl3T2AeKLr2AMdilSD8+f9bvMnNN8VS5iDtovc=", version = "v0.0.0-20161129095857-cc309e4a2223", ) go_repository( name = "com_github_nxadm_tail", importpath = "github.com/nxadm/tail", sum = "h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=", version = "v1.4.4", ) go_repository( name = "com_github_onsi_ginkgo", importpath = "github.com/onsi/ginkgo", sum = "h1:jMU0WaQrP0a/YAEq8eJmJKjBoMs+pClEr1vDMlM/Do4=", version = "v1.14.1", ) go_repository( name = "com_github_onsi_gomega", importpath = "github.com/onsi/gomega", sum = "h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs=", version = "v1.10.2", ) go_repository( name = "com_github_pkg_errors", importpath = "github.com/pkg/errors", sum = "h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=", version = "v0.9.1", ) go_repository( name = "com_github_pmezard_go_difflib", importpath = "github.com/pmezard/go-difflib", sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", version = "v1.0.0", ) go_repository( name = "com_github_prometheus_statsd_exporter", importpath = "github.com/prometheus/statsd_exporter", sum = "h1:UiwC1L5HkxEPeapXdm2Ye0u1vUJfTj7uwT5yydYpa1E=", version = "v0.15.0", ) go_repository( name = "com_github_rogpeppe_go_internal", importpath = "github.com/rogpeppe/go-internal", sum = "h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=", version = "v1.6.1", ) go_repository( name = "com_github_sergi_go_diff", importpath = "github.com/sergi/go-diff", sum = "h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=", version = "v1.1.0", ) go_repository( name = "com_github_sirupsen_logrus", importpath = "github.com/sirupsen/logrus", sum = "h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=", version = "v1.4.2", ) go_repository( name = "com_github_stretchr_objx", importpath = "github.com/stretchr/objx", sum = "h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=", version = "v0.2.0", ) go_repository( name = "com_github_yuin_goldmark", importpath = "github.com/yuin/goldmark", sum = "h1:5tjfNdR2ki3yYQ842+eX2sQHeiwpKJ0RnHO4IYOc4V8=", version = "v1.1.32", ) go_repository( name = "com_google_cloud_go_bigquery", importpath = "cloud.google.com/go/bigquery", sum = "h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA=", version = "v1.8.0", ) go_repository( name = "com_google_cloud_go_datastore", importpath = "cloud.google.com/go/datastore", sum = "h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ=", version = "v1.1.0", ) go_repository( name = "com_google_cloud_go_firestore", importpath = "cloud.google.com/go/firestore", sum = "h1:zrl+2VJAYC/C6WzEPnkqZIBeHyHFs/UmtzJdXU4Bvmo=", version = "v1.2.0", ) go_repository( name = "com_google_cloud_go_pubsub", importpath = "cloud.google.com/go/pubsub", sum = "h1:ukjixP1wl0LpnZ6LWtZJ0mX5tBmjp1f8Sqer8Z2OMUU=", version = "v1.3.1", ) go_repository( name = "com_google_cloud_go_storage", importpath = "cloud.google.com/go/storage", sum = "h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09bA=", version = "v1.10.0", ) go_repository( name = "com_shuralyov_dmitri_gpu_mtl", importpath = "dmitri.shuralyov.com/gpu/mtl", sum = "h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY=", version = "v0.0.0-20190408044501-666a987793e9", ) go_repository( name = "in_gopkg_alecthomas_kingpin_v2", importpath = "gopkg.in/alecthomas/kingpin.v2", sum = "h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=", version = "v2.2.6", ) go_repository( name = "in_gopkg_check_v1", importpath = "gopkg.in/check.v1", sum = "h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=", version = "v1.0.0-20190902080502-41f04d3bba15", ) go_repository( name = "in_gopkg_errgo_v2", importpath = "gopkg.in/errgo.v2", sum = "h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=", version = "v2.1.0", ) go_repository( name = "in_gopkg_fsnotify_v1", importpath = "gopkg.in/fsnotify.v1", sum = "h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=", version = "v1.4.7", ) go_repository( name = "in_gopkg_tomb_v1", importpath = "gopkg.in/tomb.v1", sum = "h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=", version = "v1.0.0-20141024135613-dd632973f1e7", ) go_repository( name = "in_gopkg_yaml_v3", importpath = "gopkg.in/yaml.v3", sum = "h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=", version = "v3.0.0-20200313102051-9f266ea9e77c", ) go_repository( name = "io_opencensus_go_contrib_exporter_aws", importpath = "contrib.go.opencensus.io/exporter/aws", sum = "h1:YsbWYxDZkC7x2OxlsDEYvvEXZ3cBI3qBgUK5BqkZvRw=", version = "v0.0.0-20181029163544-2befc13012d0", ) go_repository( name = "io_opencensus_go_contrib_exporter_stackdriver", importpath = "contrib.go.opencensus.io/exporter/stackdriver", sum = "h1:ZRVpDigsb+nVI/yps/NLDOYzYjFFmm3OCsBhmYocxR0=", version = "v0.12.9", ) go_repository( name = "io_opencensus_go_contrib_integrations_ocsql", importpath = "contrib.go.opencensus.io/integrations/ocsql", sum = "h1:kfg5Yyy1nYUrqzyfW5XX+dzMASky8IJXhtHe0KTYNS4=", version = "v0.1.4", ) go_repository( name = "io_opencensus_go_contrib_resource", importpath = "contrib.go.opencensus.io/resource", sum = "h1:4r2CANuYhKGmYWP02+5E94rLRcS/YeD+KlxSrOsMxk0=", version = "v0.1.1", ) go_repository( name = "io_rsc_binaryregexp", importpath = "rsc.io/binaryregexp", sum = "h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE=", version = "v0.2.0", ) go_repository( name = "io_rsc_quote_v3", importpath = "rsc.io/quote/v3", sum = "h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY=", version = "v3.1.0", ) go_repository( name = "io_rsc_sampler", importpath = "rsc.io/sampler", sum = "h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=", version = "v1.3.0", ) go_repository( name = "org_bazil_fuse", importpath = "bazil.org/fuse", sum = "h1:FNCRpXiquG1aoyqcIWVFmpTSKVcx2bQD38uZZeGtdlw=", version = "v0.0.0-20180421153158-65cc252bf669", ) go_repository( name = "org_golang_google_appengine", importpath = "google.golang.org/appengine", sum = "h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=", version = "v1.6.6", ) go_repository( name = "org_golang_google_genproto", importpath = "google.golang.org/genproto", sum = "h1:HJaAqDnKreMkv+AQyf1Mcw0jEmL9kKBNL07RDJu1N/k=", version = "v0.0.0-20200726014623-da3ae01ef02d", ) go_repository( name = "org_golang_google_protobuf", importpath = "google.golang.org/protobuf", sum = "h1:UhZDfRO8JRQru4/+LlLE0BRKGF8L+PICnvYZmx/fEGA=", version = "v1.24.0", ) go_repository( name = "org_golang_x_crypto", importpath = "golang.org/x/crypto", sum = "h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=", version = "v0.0.0-20200622213623-75b288015ac9", ) go_repository( name = "org_golang_x_exp", importpath = "golang.org/x/exp", sum = "h1:5XVKs2rlCg8EFyRcvO8/XFwYxh1oKJO1Q3X5vttIf9c=", version = "v0.0.0-20200908183739-ae8ad444f925", ) go_repository( name = "org_golang_x_image", importpath = "golang.org/x/image", sum = "h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=", version = "v0.0.0-20190802002840-cff245a6509b", ) go_repository( name = "org_golang_x_mobile", importpath = "golang.org/x/mobile", sum = "h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=", version = "v0.0.0-20190719004257-d2bd2a29d028", ) go_repository( name = "org_golang_x_mod", importpath = "golang.org/x/mod", sum = "h1:xUIPaMhvROX9dhPvRCenIJtU78+lbEenGbgqB5hfHCQ=", version = "v0.3.1-0.20200828183125-ce943fd02449", ) go_repository( name = "org_golang_x_net", importpath = "golang.org/x/net", sum = "h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=", version = "v0.0.0-20200707034311-ab3426394381", ) go_repository( name = "org_golang_x_sys", importpath = "golang.org/x/sys", sum = "h1:gtF+PUC1CD1a9ocwQHbVNXuTp6RQsAYt6tpi6zjT81Y=", version = "v0.0.0-20200727154430-2d971f7391a4", ) go_repository( name = "org_golang_x_text", importpath = "golang.org/x/text", sum = "h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=", version = "v0.3.2", ) go_repository( name = "org_golang_x_time", importpath = "golang.org/x/time", sum = "h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=", version = "v0.0.0-20191024005414-555d28b269f0", ) go_repository( name = "org_golang_x_tools", importpath = "golang.org/x/tools", sum = "h1:qKpj8TpV+LEhel7H/fR788J+KvhWZ3o3V6N2fU/iuLU=", version = "v0.0.0-20200731060945-b5fad4ed8dd6", ) go_repository( name = "com_github_opentracing_opentracing_go", importpath = "github.com/opentracing/opentracing-go", sum = "h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=", version = "v1.2.0", ) go_repository( name = "com_github_uber_jaeger_lib", importpath = "github.com/uber/jaeger-lib", sum = "h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw=", version = "v2.2.0+incompatible", ) go_repository( name = "com_github_uber_go_atomic", importpath = "github.com/uber-go/atomic", sum = "h1:yOuPqEq4ovnhEjpHmfFwsqBXDYbQeT6Nb0bwD6XnD5o=", version = "v1.4.0", ) go_repository( name = "com_github_golang_lint", importpath = "github.com/golang/lint", sum = "h1:2hRPrmiwPrp3fQX967rNJIhQPtiGXdlQWAxKbKw3VHA=", version = "v0.0.0-20180702182130-06c8688daad7", ) go_repository( name = "com_github_gordonklaus_ineffassign", importpath = "github.com/gordonklaus/ineffassign", sum = "h1:vc7Dmrk4JwS0ZPS6WZvWlwDflgDTA26jItmbSj83nug=", version = "v0.0.0-20200309095847-7953dde2c7bf", ) go_repository( name = "com_github_benbjohnson_clock", importpath = "github.com/benbjohnson/clock", sum = "h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJyXg=", version = "v1.0.3", ) go_repository( name = "com_github_datadog_sketches_go", importpath = "github.com/DataDog/sketches-go", sum = "h1:qELHH0AWCvf98Yf+CNIJx9vOZOfHFDDzgDRYsnNk/vs=", version = "v0.0.0-20190923095040-43f19ad77ff7", ) go_repository( name = "com_github_dgryski_go_rendezvous", importpath = "github.com/dgryski/go-rendezvous", sum = "h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=", version = "v0.0.0-20200823014737-9f7001d12a5f", ) go_repository( name = "com_github_go_redis_redis_v8", importpath = "github.com/go-redis/redis/v8", sum = "h1:PC0VsF9sFFd2sko5bu30aEFc8F1TKl6n65o0b8FnCIE=", version = "v8.0.0", ) go_repository( name = "io_opentelemetry_go_otel", build_file_proto_mode = "disable", importpath = "go.opentelemetry.io/otel", sum = "h1:IN2tzQa9Gc4ZVKnTaMbPVcHjvzOdg5n9QfnmlqiET7E=", version = "v0.11.0", ) go_repository( name = "com_github_go_redis_redisext", importpath = "github.com/go-redis/redisext", sum = "h1:rgukAuvD0qvfw2CZF9bSEstzBb3WnSgRvHK+hj8Nwp0=", version = "v0.1.7", ) go_repository( name = "cc_mvdan_gofumpt", importpath = "mvdan.cc/gofumpt", sum = "h1:QQ9mYdTscaVSaHC8A1wtLkECzvpD/YO2E2GyPvU1D/Y=", version = "v0.0.0-20201027171050-85d5401eb0f6", ) go_repository( name = "com_github_hanwen_go_fuse", importpath = "github.com/hanwen/go-fuse", sum = "h1:GxS9Zrn6c35/BnfiVsZVWmsG803xwE7eVRDvcf/BEVc=", version = "v1.0.0", ) go_repository( name = "com_github_hanwen_go_fuse_v2", importpath = "github.com/hanwen/go-fuse/v2", patches = [ "@com_github_buildbarn_bb_remote_execution//:patches/com_github_hanwen_go_fuse_v2/daemon_timeout.diff", "@com_github_buildbarn_bb_remote_execution//:patches/com_github_hanwen_go_fuse_v2/direntrylist-testability.diff", "@com_github_buildbarn_bb_remote_execution//:patches/com_github_hanwen_go_fuse_v2/fuse-712-for-invalidation.diff", "@com_github_buildbarn_bb_remote_execution//:patches/com_github_hanwen_go_fuse_v2/notify-testability.diff", ], sum = "h1:kpV28BKeSyVgZREItBLnaVBvOEwv2PuhNdKetwnvNHo=", version = "v2.0.3", ) go_repository( name = "com_github_kylelemons_godebug", importpath = "github.com/kylelemons/godebug", sum = "h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4=", version = "v0.0.0-20170820004349-d65d576e9348", )
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. def source(): pass def sinkA(x): pass def sinkB(x): pass def sinkC(x): pass def sinkD(x): pass def split(x): y = x._params sinkB(y) sinkC(y) sinkD(y) return x def wrapper(x): y = split(x) sinkA(y) def issue(): x = source() wrapper(x) def splitwrapper(x): return split(x) class QueryBase: def send(self): pass class Query(QueryBase): _params = None def send(self): return splitwrapper(self) def params(self, data): self._params = data return self def log_call(params, response): sinkA(params) sinkA(response) def wrapper2(x: Query): params = x._params response = None try: response = x.send() except Exception as ex: raise ex log_call(params, response) def issue2(): taint = source() query = Query().params(taint) wrapper2(query)
x=[11,12,13,14] y=[50,60,70] for i in range(1,10,2): x.append("Item# "+str(i)) for i in x: print(i) x.extend(y) print(x) x.append(y) print(x) x.remove(y) print(x) """ this is multiine comment operator... for i in x: #if int(i.replace("Item# ",""))%2!=0: if(isinstance(i,str)==False): if(i%2==0): x.remove (i) """ print(x)
# @file motion_sensor.py # @author marco # @date 07 Oct 2021 class MotionSensor: def __init__(self, pin): self._pin = pin pinMode(self._pin, INPUT) def movement_detected(self): """Return True if motion has been detected""" return digitalRead(self._pin) == 1 def value(self): """Return value caught by sensor. 1 = movement, 0 = quietness.""" return digitalRead(self._pin)
#output comments variables input calculations output constants def display_output(): print('hello') def test_config(): return True
n = int(input()) f = {} while n > 1: i = 2 while True: if n % i == 0: if i not in f: f[i] = 0 f[i] += 1 n = n // i break i = i + 1 s = "" for k, v in f.items(): s += "{}".format(k) if v != 1: s += "^{}".format(v) s += " x " print(s[:-3])
def divisors(x): divisorList = [] for i in range(1, x+1): if x%i == 0: divisorList.append(i) return divisorList def main(): while True: try: x = int(input("Type a number please:")) break except ValueError: pass y = divisors(x) print(y) if __name__ == "__main__": main()
# Exercise 8.2 # You can call a method directly on the string, as well as on a variable # of type string. So here I call count directly on 'banana', with the # argument 'a' as the letter/substring to count. print('banana'.count('a')) # Exercise 8.3 def is_palindrome(s): # The slice uses the entire string if the start and end are left out. # So s[::1]==s[0:len(s):1]. And s[::-1] knows you're moving backwards # (since the last argument to the slice is negative), so it automatically # starts at the last (rightmost) element of the string. # Since s[::-1] is the reverse of s, we just have to see if it's equal # to s. If it is, then s is a palindrome. So we can just return the # result of that comparison directly return s==s[::-1] # Exercise 8.4 # (Possibly) incorrect functions # This function checks to see if the *first* letter in a string is lowercase. # If the first letter is uppercase, it exits the function with # return False def any_lowercase1(s): for c in s: if c.islower(): return True # Since we have an else clause, we're guaranteed to do either # the body of the if statement or the body of the else statment. # Which means this function will be returning (and thus exiting) # after the first letter, no matter what. else: return False # This time it returns a string # that reads "True" or "False", instead of a boolean. So if you wanted # to use it in other code it would probably be useless, since Python # treats nonempty strings as True. Basically this function returns True # no matter what. # False is False, but 'False' is True. # if('False'): do thing <-- would do the thing # if(False): do thing <-- would not do the thing # The other problem is instead of checking characters in the string, it # just checks the character 'c', which of course is lower case. # So it will actually never return 'False', and always return 'True'. def any_lowercase2(s): for c in s: if 'c'.islower(): # Should be if c.islower():, no quote return 'True' else: return 'False' # Getting closer, but now it just tells us whether the *last* character # in the string is lowercase. Since it doesn't combine new knowledge with any # previous information, it just sets the flag anew with each character it reads def any_lowercase3(s): for c in s: flag = c.islower() return flag # This one works! It initializes the flag to false, since we haven't found # any lowercase letters yet. Then it uses or, which returns true if # either of the arguments is true. So once we find a lower case letter, # flag will stay true for the rest of the program. def any_lowercase4(s): flag = False for c in s: flag = flag or c.islower() return flag # This one determines whether *all* letters are lowercase. The first time # it encounters a non-lowercase letter, it stops and returns False. def any_lowercase5(s): for c in s: if not c.islower(): return False return True # A more efficient version of any_lowercase4, inspired by anylowercase_5. # For something like a counter, we need to run # through the whole list. For this, as soon as we find the first lowercase # letter we're done, because we know there's at least one. So we can return True # and stop execution of the function as soon as the first lowercase letter # pops up. def any_lowercase6(s): for c in s: if c.islower(): return True return False
''' Created on 30 de nov de 2018 @author: filiped ''' class Base: def __init__(self): self.s="" self.p=0 self.fim="@" self.pilha = ["z0"] def le_palavra(self,palavra="@"): self.p=0 self.s = palavra+"@" def xp(self,c=""): print(self.s[self.p]==c, self.s[self.p], c) return self.s[self.p]==c def np(self): self.p+=1 return True def aceite(self): return "aceitou: "+str(self.p+1) def rejeicao(self): return "rejeitou: "+str(self.p+1) #------------------------------------------------------------------------------ def topo(self,val): if val == self.pilha[-1]: self.pop() return True return False def put(self,val): print(self.pilha) self.pilha.append(val) return True def pop(self): print(self.pilha) return self.pilha.pop(-1) def esta_vazia(self): print(self.pilha) return len(self.pilha) > 0 #------------------------------------------------------------------------------ def verificar(self, func): if func and self.xp(self.fim): print(self.aceite()) else: print(self.rejeicao()) #------------------------------------------------------------------------------ def w(self,val): print(val) return True
class ConsumptionTax: def __init__(self, tax_rate): self.tax_rate = tax_rate def apply(self, price): return int((price * self.tax_rate) / 100) + price
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' def dict_to_url_params(json_data, root): def deep(node, root, items): if isinstance(node, list): for i, value in enumerate(node): node_root = root + f'[{i}]' deep(value, node_root, items) elif isinstance(node, dict): for key, value in node.items(): node_root = root + f'[{key}]' deep(value, node_root, items) else: root += '=' + node items.append(root) items = [] deep(json_data, root, items) return items if __name__ == '__main__': JSON_FORM_DATA = { "add": [ { "source_name": "WEB сайт", "source_uid": "a1fee7c0fc436088e64ba2e8822ba2b3", "created_at": "1529007000", "incoming_entities": { "leads": [ { "name": "Покупка" }, ], "contacts": [ { "name": "Федя", "responsible_user_id": "1903006", "custom_fields": [ { "id": "382707", "values": [ { "value": "+77777777777", "enum": "WORK" } ] }, { "id": "389993", "values": [ { "value": "sfgh3gh233h3h3h3" } ] }, { "id": "389995", "values": [ { "value": "Обратный звонок" } ] } ] } ] }, "incoming_lead_info": { "form_id": "329248", "form_page": "vdtest.ru", "ip": "127.0.0.1", "service_code": "QkKwSam8" } } ] } items = dict_to_url_params(JSON_FORM_DATA['add'], root='add') params = '&'.join(items) print('Params: ' + params) print() print('Params:') for x in items: print(x)
# -*- coding: utf-8 -*- #センサデバイスに送信するためのコマンドを生成し、文字列として返す。 #文字列の終わりには改行も含まれているため、そのままwriteで使える #during_sec:何秒ごとにデータを送るか。(最低でも60以上の数字を入れること) #send_no:何回送った後に夜間休暇に入るか(例:10分おきで10時間(600秒)連続稼働の場合は 600/10 = 60と入力) #wait_sec:夜間休暇の秒数 #なお、夜間休暇明けには再度スタートコマンドを送る必要があります def make_senser_start_cmd(during_sec,send_no,wait_sec): DEV_ID = 0X0F CMD = 0X00 send_cmd = ":" + format(DEV_ID,"02X") + format(CMD,"02X") send_cmd = send_cmd + format(during_sec,"04X") + format(send_no,"04X") + format(wait_sec,"08X") send_cmd = send_cmd + "X" +"\r\n" return send_cmd #室外デバイスに送信するためのコマンドを生成し、文字列として返す。 #なお、色の名前についてはデータベースからの応答の通り全部大文字であること def make_LED_cmd(color): DEV_ID = 0X10 if color == "RED" : CMD = 0X01 elif color == "YELLOW": CMD = 0X02 elif color == "GREEN": CMD = 0X03 elif color == "": CMD = 0X00 else: return send_cmd = ":" + format(DEV_ID,"02X") + format(CMD,"02X") + "X" +"\r\n" return send_cmd
# -*- coding: utf-8 -*- __author__ = 'gzp' class Solution: def maxTurbulenceSize(self, A): """ :type A: List[int] :rtype: int """ len_a = len(A) dp = {0: 1} i = 1 last_cmp = None while i < len_a: if A[i - 1] < A[i] and last_cmp != '<': dp[i] = dp.get(i - 1, 0) + 1 last_cmp = '<' elif A[i - 1] > A[i] and last_cmp != '>': dp[i] = dp.get(i - 1, 0) + 1 last_cmp = '>' elif A[i - 1] == A[i]: dp[i] = 1 else: dp[i] = 2 i += 1 return max(dp.values())
# Nach einer Idee von Kevin Workman # (https://happycoding.io/examples/p5js/images/image-palette) WIDTH = 800 HEIGHT = 640 palette = ["#264653", "#2a9d8f", "#e9c46a", "#f4a261", "#e76f51"] def setup(): global img size(WIDTH, HEIGHT) this.surface.setTitle("Image Palette") img = loadImage("akt.jpg") image(img, 0, 0) noLoop() def draw(): global y, img for x in range(width/2): for y in range(height): img_color = img.get(x, y) palette_color = get_palette_color(img_color) set(x + width/2, y, palette_color) def get_palette_color(img_color): min_distance = 999999 img_r = red(img_color) img_g = green(img_color) img_b = blue(img_color) for c in palette: palette_r = red(c) palette_g = green(c) palette_b = blue(c) color_distance = dist(img_r, img_g, img_b, palette_r, palette_g, palette_b) if color_distance < min_distance: target_color = c min_distance = color_distance return(target_color)
def front_and_back_search(lst, item): rear=0 front=len(lst)-1 u=None if rear>front: return False else: while rear<=front: if item==lst[rear] or item==lst[front]: u='' return True elif item!=lst[rear] and item!=lst[front]: if item > lst[rear]: rear=rear+1 elif item < lst[front]: front=front-1 if u==None: return False
# Darren Keenan 2018-02-27 # Exercise 4 - Project Euler 5 # What is the smallest number divisible by 1 to 20 def divisibleby1to20(n): for i in range(1, 21): if n % i != 0: return False return True n = 1 while True: if divisibleby1to20(n): break n += 1 print(n) # The smallest number divisible by 1 to 20 = 232792560
#Entrada de dados numero = int(input('Digite um número :')) #Processamento e Saida de dados if numero % 2 == 0: print('O número é PAR') else: print('O número é IMPAR')
# Three number sum def threeSumProblem(arr: list, target: int) : arr.sort() result = list() for i in range(0, len(arr) - 2) : left = i+1;right=len(arr)-1 while left < right : curren_sum = arr[i] + arr[left] + arr[right] if curren_sum == target : result.append([arr[i], arr[left], arr[right]]) left+=1 right-=1 elif curren_sum < target : left+=1 else : right -= 1 return result if __name__ == '__main__' : print(threeSumProblem([12,3,1,2,-6,5,-8,6], 0))
class animal: def eat(self): print("eat") class mammal(animal): def walk(self): print("walk") class fish(animal): def swim(self): print("swim") moka = mammal() moka.eat() moka.walk()
# Copyright 2018 Cyril Roelandt # # Licensed under the 3-clause BSD license. See the LICENSE file. class InvalidPackageNameError(Exception): """Invalid package name or non-existing package.""" def __init__(self, frontend, pkg_name): self.frontend = frontend self.pkg_name = pkg_name def __str__(self): return (f'The package {self.pkg_name} could not be found by frontend ' f'{self.frontend}') class InvalidPackageVersionError(Exception): """Invalid or non-existing version of a valid package""" def __init__(self, frontend, pkg_name, version): self.frontend = frontend self.pkg_name = pkg_name self.version = version def __str__(self): return (f'Version {self.version} of package {self.pkg_name} ' f'could not be found by frontend {self.frontend}') class UnhandledFrontendError(Exception): """Frontend not supported by backend.""" def __init__(self, backend, frontend): self.backend = backend self.frontend = frontend def __str__(self): return (f'The {self.backend} backend does not work well with the ' f'{self.frontend} frontend (yet!). Unable to generate a ' f'package definition.')
g1 = 1 def display(): global g1 g1 = 2 print(g1) print("inside",id(g1)) display() print(g1) print("outside",id(g1))
showroom = set() showroom.add('Chevrolet SS') showroom.add('Mazda Miata') showroom.add('GMC Yukon XL Denali') showroom.add('Porsche Cayman') # print(showroom) # print (len(showroom)) showroom.update(['Jaguar F-Type', 'Ariel Atom 3']) # print (showroom) showroom.remove('GMC Yukon XL Denali') # print (showroom) junkyard = set() junkyard.update([ 'Mazda Miata', 'Chevy Caprice', 'Isuzu Trooper', 'Saturn SC2', 'Porsche Cayman' ]) # print(junkyard) def intersect(showroom, junkyard): return list(set(showroom) & set(junkyard)) # print(intersect(showroom, junkyard)) showroom = showroom.union(junkyard) # print(showroom) showroom.discard('Isuzu Trooper') print(showroom)
class Solution: def validSquare(self, p1, p2, p3, p4): """ :type p1: List[int] :type p2: List[int] :type p3: List[int] :type p4: List[int] :rtype: bool """ def dis(P, Q): "Return distance between two points." return sum((p - q) * (p - q) for p, q in zip(P, Q)) d = {dis(P, Q) for P, Q in itertools.combinations((p1, p2, p3, p4), 2)} return len(d) == 2 and min(d) != 0 and max(d) // min(d) == 2
""" From Kapil Sharma's lecture 11 Jun 2020 Given the head of a sll and a value, delete the node with that value. Return True if successful; False otherwise. """ class Node: def __init__(self, data): self.data = data self.next = None def delete_node_given_value(value, head): # Edge cases if head == None or value == None: return False if head.data == value: head.next = None return True # Iterate thru sll until find the value or reach the tail prev = None curr = head while curr is not None and curr.data != value: prev = curr curr = curr.next # If reached tail w/o finding the value if not curr: return False # If found value, reassign the next pointer of prev node to skip node with the value prev.next = curr.next return True def print_ll(head): ll_list = [] curr = head while curr is not None: ll_list.append(curr.data) curr = curr.next print(ll_list) return ll_list node1 = Node(1) node2 = Node(2) node3 = Node(3) node1.next = node2 node2.next = node3 test = delete_node_given_value(2, node1) print(test) # True print_ll(node1) # Should be only 1 and 3 node1 = Node(1) node2 = Node(2) node3 = Node(3) node1.next = node2 node2.next = node3 test2 = delete_node_given_value(1, node1) print(test2) # True print_ll(node1) # Should just show the 1 because it is not detached from the sll print_ll(node2) # Now 2 is the head node1 = Node(1) node2 = Node(2) node3 = Node(3) node1.next = node2 node2.next = node3 test3 = delete_node_given_value(3, node1) print(test3) # True print_ll(node1) # Should just show tail is gone node4 = Node(4) test4 = delete_node_given_value(4, node1) print(test4) # Should be False b/c no node with value of 4 exists in sll
input = """ 8 2 2 3 0 0 8 2 4 5 0 0 8 2 6 7 0 0 6 0 4 0 2 3 4 5 1 1 1 1 0 4 c 3 b 7 f 2 a 6 e 5 d 0 B+ 0 B- 1 0 1 """ output = """ COST 2@1 """
TARGET_COL = 'class' ID_COL = 'id' N_FOLD = 5 N_CLASS = 3 SEED = 42
# # PySNMP MIB module ROHC-UNCOMPRESSED-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ROHC-UNCOMPRESSED-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:49:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint") rohcChannelID, rohcContextCID = mibBuilder.importSymbols("ROHC-MIB", "rohcChannelID", "rohcContextCID") NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance") IpAddress, TimeTicks, Unsigned32, Bits, mib_2, NotificationType, ModuleIdentity, Counter64, ObjectIdentity, iso, MibIdentifier, Gauge32, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "TimeTicks", "Unsigned32", "Bits", "mib-2", "NotificationType", "ModuleIdentity", "Counter64", "ObjectIdentity", "iso", "MibIdentifier", "Gauge32", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") rohcUncmprMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 113)) rohcUncmprMIB.setRevisions(('2004-06-03 00:00',)) if mibBuilder.loadTexts: rohcUncmprMIB.setLastUpdated('200406030000Z') if mibBuilder.loadTexts: rohcUncmprMIB.setOrganization('IETF Robust Header Compression Working Group') rohcUncmprObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 113, 1)) rohcUncmprConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 113, 2)) rohcUncmprContextTable = MibTable((1, 3, 6, 1, 2, 1, 113, 1, 1), ) if mibBuilder.loadTexts: rohcUncmprContextTable.setStatus('current') rohcUncmprContextEntry = MibTableRow((1, 3, 6, 1, 2, 1, 113, 1, 1, 1), ).setIndexNames((0, "ROHC-MIB", "rohcChannelID"), (0, "ROHC-MIB", "rohcContextCID")) if mibBuilder.loadTexts: rohcUncmprContextEntry.setStatus('current') rohcUncmprContextState = MibTableColumn((1, 3, 6, 1, 2, 1, 113, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("initAndRefresh", 1), ("normal", 2), ("noContext", 3), ("fullContext", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rohcUncmprContextState.setStatus('current') rohcUncmprContextMode = MibTableColumn((1, 3, 6, 1, 2, 1, 113, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("unidirectional", 1), ("bidirectional", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rohcUncmprContextMode.setStatus('current') rohcUncmprContextACKs = MibTableColumn((1, 3, 6, 1, 2, 1, 113, 1, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rohcUncmprContextACKs.setStatus('current') rohcUncmprCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 113, 2, 1)) rohcUncmprGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 113, 2, 2)) rohcUncmprCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 113, 2, 1, 1)).setObjects(("ROHC-UNCOMPRESSED-MIB", "rohcUncmprContextGroup"), ("ROHC-UNCOMPRESSED-MIB", "rohcUncmprStatisticsGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): rohcUncmprCompliance = rohcUncmprCompliance.setStatus('current') rohcUncmprContextGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 113, 2, 2, 1)).setObjects(("ROHC-UNCOMPRESSED-MIB", "rohcUncmprContextState"), ("ROHC-UNCOMPRESSED-MIB", "rohcUncmprContextMode")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): rohcUncmprContextGroup = rohcUncmprContextGroup.setStatus('current') rohcUncmprStatisticsGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 113, 2, 2, 2)).setObjects(("ROHC-UNCOMPRESSED-MIB", "rohcUncmprContextACKs")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): rohcUncmprStatisticsGroup = rohcUncmprStatisticsGroup.setStatus('current') mibBuilder.exportSymbols("ROHC-UNCOMPRESSED-MIB", rohcUncmprContextState=rohcUncmprContextState, rohcUncmprMIB=rohcUncmprMIB, rohcUncmprConformance=rohcUncmprConformance, rohcUncmprContextEntry=rohcUncmprContextEntry, rohcUncmprContextMode=rohcUncmprContextMode, rohcUncmprStatisticsGroup=rohcUncmprStatisticsGroup, rohcUncmprObjects=rohcUncmprObjects, rohcUncmprContextACKs=rohcUncmprContextACKs, rohcUncmprCompliances=rohcUncmprCompliances, rohcUncmprCompliance=rohcUncmprCompliance, rohcUncmprContextTable=rohcUncmprContextTable, rohcUncmprContextGroup=rohcUncmprContextGroup, rohcUncmprGroups=rohcUncmprGroups, PYSNMP_MODULE_ID=rohcUncmprMIB)
# 11. print(list(range(1, 10))) # 12. print(list(range(100, 20, -5)))
#Crie um programa onde o usuário possa digitar sete valores numéricos # e cadastre-os em uma lista única que mantenha separados os valores pares e ímpares. # No final, mostre os valores pares e ímpares em ordem crescente. lista = [[], []] for c in range(0, 7): valor = int(input(f'Digite o valor número {c}:')) if valor % 2 == 0: lista[0].append(valor) else: lista[1].append(valor) lista[0].sort() lista[1].sort() print(f'Os valores pares digitados foram:{lista[0]}') print(f'Os valores ímpars digitados foram: {lista[1]}')
def A(m, n): if m == 0: return n + 1 if m > 0 and n == 0: return A(m - 1, 1) if m > 0 and n > 0: return A(m - 1, A(m, n - 1)) def main() -> None: print(A(2, 2)) if __name__ == "__main__": main()
"""Test for W0623, overwriting names in exception handlers.""" __revision__ = '' class MyError(Exception): """Special exception class.""" pass def some_function(): """A function.""" try: {}["a"] except KeyError as some_function: # W0623 pass
# input -1 n = int(input('input nilai: ')) if n <= 0: # Menentukan pengecualian & teks yang akan di tampilkan raise ValueError('nilai n harus bilangan positif') try: n = int(input('input nilai: ')) if n <= 0: # Menentukan pengecualian & teks yang akan di tampilkan raise ValueError('nilai n harus bilangan positif') except ValueError as ve: # Menampilkan teks dari pengecualian yang terjadi print(ve)
# # PySNMP MIB module CYCLONE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CYCLONE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:34:24 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") ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter64, NotificationType, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, IpAddress, Bits, Unsigned32, ObjectIdentity, Integer32, Counter32, Gauge32, ModuleIdentity, MibIdentifier, enterprises = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "NotificationType", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "IpAddress", "Bits", "Unsigned32", "ObjectIdentity", "Integer32", "Counter32", "Gauge32", "ModuleIdentity", "MibIdentifier", "enterprises") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") adaptec = MibIdentifier((1, 3, 6, 1, 4, 1, 795)) storagemanagement = MibIdentifier((1, 3, 6, 1, 4, 1, 795, 2)) cyclone = MibIdentifier((1, 3, 6, 1, 4, 1, 795, 2, 5)) cycTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000)) cycManagerID = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9001), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: cycManagerID.setStatus('mandatory') if mibBuilder.loadTexts: cycManagerID.setDescription('ASCII String description of SCSI Manager') cycHostAdapterID = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9002), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: cycHostAdapterID.setStatus('mandatory') if mibBuilder.loadTexts: cycHostAdapterID.setDescription('ASCII String description of Hostadapter') cycHostAdapterNumber = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9003), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycHostAdapterNumber.setStatus('mandatory') if mibBuilder.loadTexts: cycHostAdapterNumber.setDescription('The unique Hostadapter Number') cycVendor = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9004), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: cycVendor.setStatus('mandatory') if mibBuilder.loadTexts: cycVendor.setDescription('This indicates the Name of the Vendor') cycProduct = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9005), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: cycProduct.setStatus('mandatory') if mibBuilder.loadTexts: cycProduct.setDescription('This indicates the product information') cycControllerModel = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9006), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: cycControllerModel.setStatus('mandatory') if mibBuilder.loadTexts: cycControllerModel.setDescription('The model of the associated controller e.g ATHENA, VIKING etc') cycBusNumber = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9007), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycBusNumber.setStatus('mandatory') if mibBuilder.loadTexts: cycBusNumber.setDescription('The PCI Bus number') cycChannelNumber = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9008), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycChannelNumber.setStatus('mandatory') if mibBuilder.loadTexts: cycChannelNumber.setDescription('Channel Number') cycScsiTargetID = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9009), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycScsiTargetID.setStatus('mandatory') if mibBuilder.loadTexts: cycScsiTargetID.setDescription('SCSI Target ID') cycLun = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9010), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycLun.setStatus('mandatory') if mibBuilder.loadTexts: cycLun.setDescription('The LUN of the device ID') cycArrayName = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9011), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: cycArrayName.setStatus('mandatory') if mibBuilder.loadTexts: cycArrayName.setDescription('Array name') cycMisCompares = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9012), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycMisCompares.setStatus('mandatory') if mibBuilder.loadTexts: cycMisCompares.setDescription('The number of miscompares in verify ') cycDriver = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9013), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycDriver.setStatus('mandatory') if mibBuilder.loadTexts: cycDriver.setDescription('The Driver version') cycManager = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9014), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycManager.setStatus('mandatory') if mibBuilder.loadTexts: cycManager.setDescription('The CI/O Manager version') cycOldArrayName = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9015), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: cycOldArrayName.setStatus('mandatory') if mibBuilder.loadTexts: cycOldArrayName.setDescription('Old Array name') cycNewArrayName = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9016), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: cycNewArrayName.setStatus('mandatory') if mibBuilder.loadTexts: cycNewArrayName.setDescription('Changed Array name') cycPriority = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9017), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycPriority.setStatus('mandatory') if mibBuilder.loadTexts: cycPriority.setDescription('The Priority of the operation') cycSenseInfo = MibScalar((1, 3, 6, 1, 4, 1, 795, 2, 5, 9000, 9018), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cycSenseInfo.setStatus('mandatory') if mibBuilder.loadTexts: cycSenseInfo.setDescription('The sense info of the PFA') sCSISmart1 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,101)) if mibBuilder.loadTexts: sCSISmart1.setDescription('SNMP Agent is up.') sCSISmart2 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,102)) if mibBuilder.loadTexts: sCSISmart2.setDescription('SNMP Agent is down.') sCSISmart3 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,107)) if mibBuilder.loadTexts: sCSISmart3.setDescription('Cyclone: duplicate hostadapter ID') sCSISmart4 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,108)).setObjects(("CYCLONE-MIB", "cycHostAdapterNumber"), ("CYCLONE-MIB", "cycHostAdapterID"), ("CYCLONE-MIB", "cycManagerID")) if mibBuilder.loadTexts: sCSISmart4.setDescription('The HostAdapter# %d with HostAdapter Id %s and Manager Id %s is discovered') sCSISmart5 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,109)).setObjects(("CYCLONE-MIB", "cycHostAdapterNumber"), ("CYCLONE-MIB", "cycHostAdapterID"), ("CYCLONE-MIB", "cycManagerID")) if mibBuilder.loadTexts: sCSISmart5.setDescription('The HostAdapter# %d has new HostAdapter Id %s and Manager Id %s') sCSISmart6 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,110)).setObjects(("CYCLONE-MIB", "cycHostAdapterNumber")) if mibBuilder.loadTexts: sCSISmart6.setDescription('The HostAdapter# %d has Failed') sCSISmart7 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,111)).setObjects(("CYCLONE-MIB", "cycHostAdapterNumber")) if mibBuilder.loadTexts: sCSISmart7.setDescription('Host Adapter# %d recovered') sCSISmart8 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,112)).setObjects(("CYCLONE-MIB", "cycHostAdapterNumber"), ("CYCLONE-MIB", "cycScsiTargetID"), ("CYCLONE-MIB", "cycLun")) if mibBuilder.loadTexts: sCSISmart8.setDescription('The HostAdapter# %d, TargetID %d, Lun# %d has failed') sCSISmart9 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,113)).setObjects(("CYCLONE-MIB", "cycHostAdapterNumber"), ("CYCLONE-MIB", "cycScsiTargetID"), ("CYCLONE-MIB", "cycLun"), ("CYCLONE-MIB", "cycVendor"), ("CYCLONE-MIB", "cycProduct")) if mibBuilder.loadTexts: sCSISmart9.setDescription('The HostAdapter# %d, TargetID %d, Lun# %d of vendor %s product %s has discovered') sCSISmart10 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,114)).setObjects(("CYCLONE-MIB", "cycHostAdapterNumber"), ("CYCLONE-MIB", "cycScsiTargetID"), ("CYCLONE-MIB", "cycLun")) if mibBuilder.loadTexts: sCSISmart10.setDescription('The HostAdapter# %d, TargetID %d,Lun# %d has recovered') sCSISmart11 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,115)).setObjects(("CYCLONE-MIB", "cycHostAdapterNumber"), ("CYCLONE-MIB", "cycScsiTargetID"), ("CYCLONE-MIB", "cycLun"), ("CYCLONE-MIB", "cycVendor"), ("CYCLONE-MIB", "cycProduct")) if mibBuilder.loadTexts: sCSISmart11.setDescription('The HostAdapter# %d, TargetID %d, Lun# %d has new Vendor %s and Product %s information') sCSISmart12 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,116)).setObjects(("CYCLONE-MIB", "cycHostAdapterNumber"), ("CYCLONE-MIB", "cycScsiTargetID"), ("CYCLONE-MIB", "cycLun"), ("CYCLONE-MIB", "cycVendor"), ("CYCLONE-MIB", "cycProduct"), ("CYCLONE-MIB", "cycSenseInfo")) if mibBuilder.loadTexts: sCSISmart12.setDescription('The HostAdapter# %d, TargetID %d, Lun# %d has Predictive Failure Condition on vendor %s product %s with sense info MSB(sense code), next 8 bits (sense code Qual) next 8 bits (Add sense code Qual) LSB (0000) %d') sCSISmart13 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,117)) if mibBuilder.loadTexts: sCSISmart13.setDescription('The Aspi database is cleared and therefore all the previous information are not available') sCSISmart14 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,118)) if mibBuilder.loadTexts: sCSISmart14.setDescription('The Aspi has crashed') sCSISmart15 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,119)) if mibBuilder.loadTexts: sCSISmart15.setDescription('No memory left for Aspi Operations') sCSISmart16 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,120)) if mibBuilder.loadTexts: sCSISmart16.setDescription('Unable to open Aspi file for writing, problem exists in server hard disk') sCSISmart17 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,121)) if mibBuilder.loadTexts: sCSISmart17.setDescription('Unable to open Aspi file, problem exists in server hard disk') sCSISmart18 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,122)) if mibBuilder.loadTexts: sCSISmart18.setDescription('Aspi device file doesnot exist') sCSISmart19 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,123)) if mibBuilder.loadTexts: sCSISmart19.setDescription('Aspi: Memory allocation is failing') sCSISmart20 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,124)) if mibBuilder.loadTexts: sCSISmart20.setDescription('Aspi: unable to read the file server hard disk might have problems') sCSISmart21 = NotificationType((1, 3, 6, 1, 4, 1, 795, 2, 5) + (0,125)) if mibBuilder.loadTexts: sCSISmart21.setDescription('Aspi: database is corrupted') mibBuilder.exportSymbols("CYCLONE-MIB", cycSenseInfo=cycSenseInfo, sCSISmart19=sCSISmart19, sCSISmart10=sCSISmart10, cycPriority=cycPriority, cycBusNumber=cycBusNumber, sCSISmart1=sCSISmart1, sCSISmart12=sCSISmart12, cycDriver=cycDriver, sCSISmart13=sCSISmart13, sCSISmart3=sCSISmart3, cyclone=cyclone, sCSISmart21=sCSISmart21, sCSISmart16=sCSISmart16, cycMisCompares=cycMisCompares, cycLun=cycLun, sCSISmart17=sCSISmart17, sCSISmart8=sCSISmart8, cycOldArrayName=cycOldArrayName, cycNewArrayName=cycNewArrayName, cycHostAdapterNumber=cycHostAdapterNumber, sCSISmart4=sCSISmart4, sCSISmart20=sCSISmart20, cycControllerModel=cycControllerModel, sCSISmart14=sCSISmart14, adaptec=adaptec, sCSISmart15=sCSISmart15, cycVendor=cycVendor, cycManager=cycManager, sCSISmart18=sCSISmart18, cycArrayName=cycArrayName, cycScsiTargetID=cycScsiTargetID, cycTraps=cycTraps, sCSISmart7=sCSISmart7, cycHostAdapterID=cycHostAdapterID, cycManagerID=cycManagerID, cycChannelNumber=cycChannelNumber, sCSISmart6=sCSISmart6, sCSISmart9=sCSISmart9, sCSISmart2=sCSISmart2, cycProduct=cycProduct, sCSISmart11=sCSISmart11, storagemanagement=storagemanagement, sCSISmart5=sCSISmart5)
def tapcode_to_fingers(tapcode:int): return '{0:05b}'.format(1)[::-1] def mouse_data_msg(data: bytearray): vx = int.from_bytes(data[1:3],"little", signed=True) vy = int.from_bytes(data[3:5],"little", signed=True) prox = data[9] == 1 return vx, vy, prox def air_gesture_data_msg(data: bytearray): return [data[0]] def tap_data_msg(data: bytearray): return [data[0]] def raw_data_msg(data: bytearray): ''' raw data is packed into messages with the following structure: [msg_type (1 bit)][timestamp (31 bit)][payload (12 - 30 bytes)] * msg type - '0' for imu message - '1' for accelerometers message * timestamp - unsigned int, given in milliseconds * payload - for imu message is 12 bytes composed by a series of 6 uint16 numbers representing [g_x, g_y, g_z, xl_x, xl_y, xl_z] - for accelerometers message is 30 bytes composed by a series of 15 uint16 numbers representing [xl_x_thumb , xl_y_thumb, xl_z_thumb, xl_x_finger, xl_y_finger, xl_z_finger, ...] ''' L = len(data) ptr = 0 messages = [] while ptr <= L: # decode timestamp and message type ts = int.from_bytes(data[ptr:ptr+4],"little", signed=False) if ts == 0: break ptr += 4 # resolve message type if ts > raw_data_msg.msg_type_value: msg = "accl" ts -= raw_data_msg.msg_type_value num_of_samples = 15 else: msg = "imu" num_of_samples = 6 # parse payload payload = [] for i in range(num_of_samples): payload.append(int.from_bytes(data[ptr:ptr+2],"little", signed=True)) ptr += 2 messages.append({"type":msg, "ts":ts, "payload":payload}) return messages raw_data_msg.msg_type_value = 2**31
# Copyright 2019 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ A rule for generating the environment plist """ load( "@build_bazel_rules_apple//apple/internal:rule_factory.bzl", "rule_factory", ) load( "@build_bazel_apple_support//lib:apple_support.bzl", "apple_support", ) load( "@build_bazel_rules_apple//apple/internal:platform_support.bzl", "platform_support", ) load( "@bazel_skylib//lib:dicts.bzl", "dicts", ) def _environment_plist(ctx): # Only need as much platform information as this rule is able to give, for environment plist # processing. platform_prerequisites = platform_support.platform_prerequisites( apple_fragment = ctx.fragments.apple, config_vars = ctx.var, device_families = None, disabled_features = ctx.disabled_features, explicit_minimum_deployment_os = None, explicit_minimum_os = None, features = ctx.features, objc_fragment = None, platform_type_string = str(ctx.fragments.apple.single_arch_platform.platform_type), uses_swift = False, xcode_path_wrapper = ctx.executable._xcode_path_wrapper, xcode_version_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig], ) platform = platform_prerequisites.platform sdk_version = platform_prerequisites.sdk_version apple_support.run( actions = ctx.actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = [ "--platform", platform.name_in_plist.lower() + str(sdk_version), "--output", ctx.outputs.plist.path, ], executable = ctx.executable._environment_plist_tool, outputs = [ctx.outputs.plist], xcode_config = platform_prerequisites.xcode_version_config, ) environment_plist = rule( attrs = dicts.add( rule_factory.common_tool_attributes, { "_environment_plist_tool": attr.label( cfg = "exec", executable = True, default = Label("@build_bazel_rules_apple//tools/environment_plist"), ), "platform_type": attr.string( mandatory = True, doc = """ The platform for which the plist is being generated """, ), }, ), doc = """ This rule generates the plist containing the required variables about the versions the target is being built for and with. This is used by Apple when submitting to the App Store. This reduces the amount of duplicative work done generating these plists for the same platforms. """, fragments = ["apple"], outputs = {"plist": "%{name}.plist"}, implementation = _environment_plist, )
class DBConnector: def save_graph(self, local_graph): pass def get_reader_endpoint(self): pass def get_writer_endpoint(self): pass def disconnect(self): pass
test = { 'name': 'contains?', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (contains? odds 3) ; True or False True """, 'hidden': False, 'locked': False }, { 'code': r""" scm> (contains? odds 9) ; True or False True """, 'hidden': False, 'locked': False }, { 'code': r""" scm> (contains? odds 6) ; True or False False """, 'hidden': False, 'locked': False } ], 'scored': True, 'setup': r""" scm> (load 'hw07) scm> (define odds (list 3 5 7 9)) """, 'teardown': '', 'type': 'scheme' } ] }
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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. # # Const Class # this is a auto generated file generated by Cheetah # Libre Office Version: 7.3 # Namespace: com.sun.star.sheet class DataPilotFieldGroupBy(object): """ Const Class These constants select different types for grouping members of a DataPilot field by date or time. See Also: `API DataPilotFieldGroupBy <https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1sheet_1_1DataPilotFieldGroupBy.html>`_ """ __ooo_ns__: str = 'com.sun.star.sheet' __ooo_full_ns__: str = 'com.sun.star.sheet.DataPilotFieldGroupBy' __ooo_type_name__: str = 'const' SECONDS = 1 """ Groups all members of a DataPilot field containing a date/time value by their current value for seconds. Example: The group :02 will contain all members that contain a time with a seconds value of 2, regardless of the date, hours and minutes of the member, e.g. 2002-Jan-03 00:00:02 or 1999-May-02 12:45:02. """ MINUTES = 2 """ Groups all members of a DataPilot field containing a date/time value by their current value for minutes. Example: The group :02 will contain all members that contain a time with a minutes value of 2, regardless of the date, hours and seconds of the member, e.g. 2002-Jan-03 00:02:00 or 1999-May-02 12:02:45. """ HOURS = 4 """ Groups all members of a DataPilot field containing a date/time value by their current value for hours. Example: The group 02 will contain all members that contain a time with a hour value of 2, regardless of the date, minutes and seconds of the member, e.g. 2002-Jan-03 02:00:00 or 1999-May-02 02:12:45. """ DAYS = 8 """ Groups all members of a DataPilot field containing a date/time value by their calendar day, or by ranges of days. Examples: See descriptions for XDataPilotFieldGrouping.createDateGroup() for more details about day grouping. """ MONTHS = 16 """ Groups all members of a DataPilot field containing a date/time value by their month. Example: The group Jan will contain all members with a date in the month January, regardless of the year, day, or time of the member, e.g. 2002-Jan-03 00:00:00 or 1999-Jan-02 02:12:45. """ QUARTERS = 32 """ Groups all members of a DataPilot field containing a date/time value by their quarter. Example: The group Q1 will contain all members with a date in the first quarter of a year (i.e. the months January, February, and march), regardless of the year, day, or time of the member, e.g. 2002-Jan-03 00:00:00 or 1999-Mar-02 02:12:45. """ YEARS = 64 """ Groups all members of a DataPilot field containing a date/time value by their year. Example: The group 1999 will contain all members with a date in the year 1999, regardless of the month, day, or time of the member, e.g. 1999-Jan-03 00:00:00 or 1999-May-02 02:12:45. """ __all__ = ['DataPilotFieldGroupBy']
input = """ 1 2 2 1 3 4 1 3 2 1 2 4 1 4 0 0 1 5 1 0 2 1 6 1 0 5 1 5 1 0 6 0 3 d 2 c 6 b 5 a 0 B+ 0 B- 1 0 1 """ output = """ {d} {c, a, b} """
#! python # Problem # : 50A # Created on : 2019-01-14 21:29:26 def Main(): m, n = map(int, input().split(' ')) val = m * n cnt = int(val / 2) print(cnt) if __name__ == '__main__': Main()
# Maximum Absolute Difference # https://www.interviewbit.com/problems/maximum-absolute-difference/ # # You are given an array of N integers, A1, A2 ,…, AN. Return maximum value of f(i, j) for all 1 ≤ i, j ≤ N. # # f(i, j) is defined as |A[i] - A[j]| + |i - j|, where |x| denotes absolute value of x. # # For example, # # A=[1, 3, -1] # # f(1, 1) = f(2, 2) = f(3, 3) = 0 # f(1, 2) = f(2, 1) = |1 - 3| + |1 - 2| = 3 # f(1, 3) = f(3, 1) = |1 - (-1)| + |1 - 3| = 4 # f(2, 3) = f(3, 2) = |3 - (-1)| + |2 - 3| = 5 # # So, we return 5. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class Solution: # @param A : list of integers # @return an integer def maxArr(self, A): max1 = max2 = -float('inf') min1 = min2 = float('inf') for x, i in enumerate(A): max1, min1 = max(max1, i + x), min(min1, i + x) max2, min2 = max(max2, i - x), min(min2, i - x) return max(max1 - min1, max2 - min2) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if __name__ == "__main__": A = [1, 3, -1] s = Solution() print(s.maxArr(A))
def organize_data(lines): max_x = 0 max_y = 0 line_segments = [] # store all of the line segments for line in lines: points = line.split(" -> ") point1 = points[0].split(",") point2 = points[1].split(",") x1 = int(point1[0].strip()) y1 = int(point1[1].strip()) x2 = int(point2[0].strip()) y2 = int(point2[1].strip()) line_segments.append([(x1, y1), (x2, y2)]) # keep track of the maximum row and column values if x1 > max_x: max_x = x1 if y1 > max_y: max_y = y1 if x2 > max_x: max_x = x2 if y2 > max_y: max_y = y2 return line_segments, max_x, max_y def main(): data = open("day05/input.txt", "r") lines = [line for line in data] line_segments, max_x, max_y = organize_data(lines) # initialize diagram diagram = [] for y in range(max_y + 1): diagram.append([]) for x in range(max_x + 1): diagram[y].append(0) # fill out diagram for segment in line_segments: (x1, y1), (x2, y2) = segment if x1 == x2: larger_y = max([y1, y2]) smaller_y = min([y1, y2]) for y in range(smaller_y, larger_y + 1): diagram[y][x1] += 1 elif y1 == y2: larger_x = max([x1, x2]) smaller_x = min([x1, x2]) for x in range(smaller_x, larger_x + 1): diagram[y1][x] += 1 else: while x1 != x2 and y1 != y2: diagram[y1][x1] += 1 if x1 > x2: x1 -= 1 else: x1 += 1 if y1 > y2: y1 -= 1 else: y1 += 1 diagram[y2][x2] += 1 # count the values in the diagram that are >= 2 counter = 0 for row in diagram: for val in row: if val >= 2: counter += 1 print(counter) if __name__ == "__main__": main()
class Config: def __init__(self, name:str=None, username:str=None, pin:int=2, email:str=None, password:str=None, set_password:bool=False, set_email_notify:bool=False): self.name = name self.username = username self.pin = pin self.email = email self.password = password self.set_password = set_password self.set_email_notify = set_email_notify
# https://leetcode.com/problems/longest-increasing-subsequence/ class Solution: def lengthOfLIS(self, nums: list[int]) -> int: # Patience sorting-like approach, but keeping track # only of the topmost element at each stack. stack_tops = [nums[0]] for num in nums[1:]: for idx in range(len(stack_tops)): if stack_tops[idx] >= num: stack_tops[idx] = num break else: stack_tops.append(num) return len(stack_tops)
# -*- coding: utf-8 -*- """ Created on Wed Dec 30 13:55:35 2020 @author: SethHarden BINARY SEARCH - ITERATIVE """ # Iterative Binary Search Function # It returns index of x in given array arr if present, # else returns -1 def binary_search(arr, x): low = 0 high = len(arr) - 1 mid = 0 while low <= high: mid = (high + low) // 2 # Check if x is present at mid if arr[mid] < x: low = mid + 1 # If x is greater, ignore left half elif arr[mid] > x: high = mid - 1 # If x is smaller, ignore right half else: return mid # If we reach here, then the element was not present return -1 # Test array arr = [ 2, 3, 4, 10, 40 ] x = 10 # Function call result = binary_search(arr, x) if result != -1: print("Element is present at index", str(result)) else: print("Element is not present in array")
l = float(input('Qual a largura da parede (em m)? ')) h = float(input('Qual a altura da parede (em m)? ')) m = float(l*h) print('A quantida de litros necessária para pintar essa parede é {:.2f}'.format(m/2))
""" This is the helper module. The attributes of this module do not interact withy facebook rather help get better info about the objects fethced from facebook. """ D=type( {1:1} ) L=type( [1,2] ) def get_fields(d, s): if type(d) == D: for i in d.keys(): if type(d[i]) == L: print(s+i+"(list)") else: print(s+i) r = len(i) r = ' '*r get_fields(d[i], r+s) elif type(d) == L: a = d[0] l = len(a) for i in a.keys(): if type(a[i]) == L: print(s+i+"(list)") else: print(s+i) r = len(i) r = " "*r get_fields(a[i], r+s) def fields(d): return get_fields(d, '')
# # @lc app=leetcode id=497 lang=python3 # # [497] Random Point in Non-overlapping Rectangles # # @lc code=start class Solution: def __init__(self, rects): """ :type rects: List[List[int]] """ self.rects = rects self.N = len(rects) areas = [(x2 - x1 + 1) * (y2 - y1 + 1) for x1, y1, x2, y2 in rects] self.preSum = [0] * self.N self.preSum[0] = areas[0] for i in range(1, self.N): self.preSum[i] = self.preSum[i - 1] + areas[i] self.total = self.preSum[-1] def pickRect(self): rand = random.randint(0, self.total - 1) return bisect.bisect_right(self.preSum, rand) def pickPoint(self, rect): x1, y1, x2, y2 = rect x = random.randint(x1, x2) y = random.randint(y1, y2) return x, y def pick(self): """ :rtype: List[int] """ rectIndex = self.pickRect() rect = self.rects[rectIndex] return self.pickPoint(rect) # Your Solution object will be instantiated and called as such: # obj = Solution(rects) # param_1 = obj.pick() # @lc code=end
""" Осуществить программу работы с органическими клетками, состоящими из ячеек. Необходимо создать класс «Клетка». В его конструкторе инициализировать параметр, соответствующий количеству ячеек клетки (целое число). В классе должны быть реализованы методы перегрузки арифметических операторов: сложение (__add__()), вычитание (__sub__()), умножение (__mul__()), деление (__floordiv__, __truediv__()). Эти методы должны применяться только к клеткам и выполнять увеличение, уменьшение, умножение и округление до целого числа деления клеток, соответственно. Сложение. Объединение двух клеток. При этом число ячеек общей клетки должно равняться сумме ячеек исходных двух клеток. Вычитание. Участвуют две клетки. Операцию необходимо выполнять, только если разность количества ячеек двух клеток больше нуля, иначе выводить соответствующее сообщение. Умножение. Создаётся общая клетка из двух. Число ячеек общей клетки — произведение количества ячеек этих двух клеток. Деление. Создаётся общая клетка из двух. Число ячеек общей клетки определяется как целочисленное деление количества ячеек этих двух клеток. В классе необходимо реализовать метод make_order(), принимающий экземпляр класса и количество ячеек в ряду. Этот метод позволяет организовать ячейки по рядам. Метод должен возвращать строку вида *****\n*****\n*****..., где количество ячеек между \n равно переданному аргументу. Если ячеек на формирование ряда не хватает, то в последний ряд записываются все оставшиеся. Например, количество ячеек клетки равняется 12, а количество ячеек в ряду — 5. В этом случае метод make_order() вернёт строку: *****\n*****\n**. """ class Cell: def checker(self, other): if not isinstance(other, Cell): raise TypeError(f'{other} not a Cell class') def __init__(self, cell_numbers: int): self.cells = cell_numbers def __str__(self): return f'в данной клетке: {self.cells} ячеек' def __add__(self, other): self.checker(other) return Cell(self.cells + other.cells) def __sub__(self, other): self.checker(other) if not self.cells - other.cells > 0: print('разность клеток 0 или меньше') return Cell(self.cells - other.cells) def __mul__(self, other): self.checker(other) return Cell(self.cells + other.cells) def __floordiv__(self, other): self.checker(other) return Cell(self.cells // other.cells) def __truediv__(self, other): self.checker(other) return Cell(int(self.cells / other.cells)) def make_order(self, n): lines = self.cells // n rest = self.cells % n result = '' for i in range(lines): result += f'{"*" * n}\n' result += f'{"*" * n}\n' return result cell = Cell(15) cell_1 = Cell(10) cell_2 = Cell(3) print(cell_1 + cell_2) print(cell_1 - cell_2) print(cell_1 * cell_2) print(cell_1 / cell_2) print(cell_1 // cell_2) print(cell.make_order(5))
{ "targets": [{ "target_name": "binding", "sources": ["binding.cc"], "include_dirs": [ "<!(node -e \"require('nan')\")", "/opt/vc/include", "/opt/vc/include/interface/vcos/pthreads", "/opt/vc/include/interface/vmcs_host/linux" ], "libraries": ["-lbcm_host", "-L/opt/vc/lib"] }] }
RES_SPA_MASSAGE_PARLOR = [ "spa", "table", "shower", "nuru", "slide", "therapy", "therapist", "bodyrub", "sauna", "gel", "shiatsu", "jacuzzi" ]
'''function in python ''' print('=== function in python ===') def func_args(*args): print('* function *args') for x in args: print(x) def func_kwargs(**kwargs): print('* function **kwargs') print('kwargs[name]', kwargs['name']) func_args('hainv', '23') func_kwargs(name="Tobias", lname="Refsnes") print('=== lambda functions ===')
# config.py class Config(object): num_channels = 256 linear_size = 256 output_size = 4 max_epochs = 10 lr = 0.001 batch_size = 128 seq_len = 300 # 1014 in original paper dropout_keep = 0.5
arr = input() for i in range(0, len(arr), 7): bits = arr[i:i + 7] result = 0 n = 1 for b in bits[::-1]: result += n * int(b) n *= 2 print(result)