content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class FieldsEnum: ACCOUNT: str = 'account' ASC: str = 'asc' BALANCE: str = 'balance' GAS_PRICE: str = 'eth_gasPrice' LATEST: str = 'latest' PROXY: str = 'proxy' TXLIST: str = 'txlist' TXLIST_INTERNAL: str = 'txlistinternal'
class Fieldsenum: account: str = 'account' asc: str = 'asc' balance: str = 'balance' gas_price: str = 'eth_gasPrice' latest: str = 'latest' proxy: str = 'proxy' txlist: str = 'txlist' txlist_internal: str = 'txlistinternal'
fps = 30 width = 960 height = 700 screenDimensions = (width, height) backgroundColor = (161, 173, 255) mario_x = 100 mario_y = 500 jumpCount = 10
fps = 30 width = 960 height = 700 screen_dimensions = (width, height) background_color = (161, 173, 255) mario_x = 100 mario_y = 500 jump_count = 10
# coding: utf-8 class ModelDatabaseRouter(object): """ A router to control all database operations on models for different databases. In case an model object's Meta is provided with db_name, the router will take that database for all its transactions. Settings example: class Meta: db...
class Modeldatabaserouter(object): """ A router to control all database operations on models for different databases. In case an model object's Meta is provided with db_name, the router will take that database for all its transactions. Settings example: class Meta: db_name = 'foo' ...
def par(i): return i % 2 == 0 def impar(i): return i % 2 == 1
def par(i): return i % 2 == 0 def impar(i): return i % 2 == 1
# README # Substitute the layer string point to the correct path # depending where your gis_sample_data are myVector = QgsVectorLayer("/qgis_sample_data/shapfiles/alaska.shp", "MyFirstVector", "ogr") QgsMapLayerRegistry.instance().addMapLayers([myVector]) # get data provider myDataProvider = myVector.dataProvider() #...
my_vector = qgs_vector_layer('/qgis_sample_data/shapfiles/alaska.shp', 'MyFirstVector', 'ogr') QgsMapLayerRegistry.instance().addMapLayers([myVector]) my_data_provider = myVector.dataProvider() features = myVector.getFeatures(qgs_feature_request(599)) my_feature = features.next() bbox = myFeature.geometry().boundingBox...
class UnknownTld(Exception): pass class FailedParsingWhoisOutput(Exception): pass class UnknownDateFormat(Exception): pass class WhoisCommandFailed(Exception): pass
class Unknowntld(Exception): pass class Failedparsingwhoisoutput(Exception): pass class Unknowndateformat(Exception): pass class Whoiscommandfailed(Exception): pass
""" Module: 'uasyncio.funcs' on pyboard 1.13.0-95 """ # MCU: (sysname='pyboard', nodename='pyboard', release='1.13.0', version='v1.13-95-g0fff2e03f on 2020-10-03', machine='PYBv1.1 with STM32F405RG') # Stubber: 1.3.4 core = None gather = None wait_for = None def wait_for_ms(): pass
""" Module: 'uasyncio.funcs' on pyboard 1.13.0-95 """ core = None gather = None wait_for = None def wait_for_ms(): pass
mouse, cat, dog = "small", "medium", "large" try: print(camel) except: print("not difined") finally: print("Defined Animals list is:") print("mouse:" , mouse, "cat:", cat, "dog:", dog)
(mouse, cat, dog) = ('small', 'medium', 'large') try: print(camel) except: print('not difined') finally: print('Defined Animals list is:') print('mouse:', mouse, 'cat:', cat, 'dog:', dog)
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isSubtree(self, s: TreeNode, t: TreeNode) -> bool: return self.traverse(s, t) def helper(self, s: TreeNode, t: TreeN...
class Solution: def is_subtree(self, s: TreeNode, t: TreeNode) -> bool: return self.traverse(s, t) def helper(self, s: TreeNode, t: TreeNode) -> bool: if s is None and t is None: return True if s is None or t is None: return False return s.val == t.val a...
def solveQuestion(inputPath): fileP = open(inputPath, 'r') fileLines = fileP.readlines() fileP.close() file = fileLines[0] file = file.strip('\n') fileLength = len(file) counter = -1 bracketOpen = False repeatLength = '' repeatTimes = '' repeatLengthFound = False ...
def solve_question(inputPath): file_p = open(inputPath, 'r') file_lines = fileP.readlines() fileP.close() file = fileLines[0] file = file.strip('\n') file_length = len(file) counter = -1 bracket_open = False repeat_length = '' repeat_times = '' repeat_length_found = False ...
def prime(x): print(f'{x%17}') def dprime(x): print(f'{x%13}') prime(41)
def prime(x): print(f'{x % 17}') def dprime(x): print(f'{x % 13}') prime(41)
assert xxx and yyy # Alternative 1a. Check both expressions are true assert xxx, yyy # Alternative 1b. Check 'xxx' is true, 'yyy' is the failure message. tuple = (xxx, yyy) # Alternative 2. Check both elements of the tuple match expectations. assert tuple[0]==xxx assert tuple[1]==yyy
assert xxx and yyy assert xxx, yyy tuple = (xxx, yyy) assert tuple[0] == xxx assert tuple[1] == yyy
def named_property(name, doc=None): def get_prop(self): return self._contents.get(name) def set_prop(self, value): self._contents[name] = value self.validate() return property(get_prop, set_prop, doc=doc)
def named_property(name, doc=None): def get_prop(self): return self._contents.get(name) def set_prop(self, value): self._contents[name] = value self.validate() return property(get_prop, set_prop, doc=doc)
USER_AGENT_LIST = [ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36', 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.29 Safari/525.13', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ...
user_agent_list = ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36', 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.29 Safari/525.13', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleW...
""" Author: Mauro Mendez. Date: 02/11/2020. Hyperparameters for a run. """ parameters = { # Random Seed 'seed': 123, # Data 'train_file': '../data/train_labels.csv', # Path to the training dataset csv 'val_file': '../data/val_labels.csv', # Path to the validation dataset csv 'tes...
""" Author: Mauro Mendez. Date: 02/11/2020. Hyperparameters for a run. """ parameters = {'seed': 123, 'train_file': '../data/train_labels.csv', 'val_file': '../data/val_labels.csv', 'test_file': '../data/test_labels.csv', 'k_fold_files': '../data/k_fold/', 'img_size': 224, 'batch_size': 32, 'data_mean': [0...
""" Using a Queue, this isn't as hard. Going with recursion and (by their definition, O(1) space) is trickier. This is a first inefficient solution. `total_nodes` and `visited` show how this isn't O(N) (for 1043 nodes, we visit 23k times). I need to look into this again. """ class Solution: def connect(self, root...
""" Using a Queue, this isn't as hard. Going with recursion and (by their definition, O(1) space) is trickier. This is a first inefficient solution. `total_nodes` and `visited` show how this isn't O(N) (for 1043 nodes, we visit 23k times). I need to look into this again. """ class Solution: def connect(self, root...
class FieldProperty: def __init__(self, data_type, required=False, if_missing=None): """ :param data_type: :param required: :param if_missing: callable or default value """ self.data_type = data_type self.required = required self.if_missing = if_missi...
class Fieldproperty: def __init__(self, data_type, required=False, if_missing=None): """ :param data_type: :param required: :param if_missing: callable or default value """ self.data_type = data_type self.required = required self.if_missing = if_miss...
# Ex072.2 """Create a program that has a fully populated tuple with a count in full, from zero to twenty Your program should read a number from the keyboard (between 0 and 20) and display it in full.""" number_in_full = ('Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', ...
"""Create a program that has a fully populated tuple with a count in full, from zero to twenty Your program should read a number from the keyboard (between 0 and 20) and display it in full.""" number_in_full = ('Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'T...
largura = int(input("digite a largura: ")) altura = int(input("digite a altura: ")) x = 1 while x <= altura: y = 1 while y <= largura: if x == 1 or x == altura: print("#", end = "") else: if y == 1 or y == largura: print("#", end = "") else: ...
largura = int(input('digite a largura: ')) altura = int(input('digite a altura: ')) x = 1 while x <= altura: y = 1 while y <= largura: if x == 1 or x == altura: print('#', end='') elif y == 1 or y == largura: print('#', end='') else: print(' ', end='')...
# # PySNMP MIB module CISCO-CIDS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CIDS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:35:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint, constraints_union) ...
def parse_rules(filename): rule_text = open(filename).read().strip().split('\n') return dict([r.split(' bags contain ') for r in rule_text]) rules = parse_rules('input.txt') queue = ['shiny gold'] seen = [] while len(queue): item = queue.pop(0) for key, val in rules.items(): if key not in se...
def parse_rules(filename): rule_text = open(filename).read().strip().split('\n') return dict([r.split(' bags contain ') for r in rule_text]) rules = parse_rules('input.txt') queue = ['shiny gold'] seen = [] while len(queue): item = queue.pop(0) for (key, val) in rules.items(): if key not in seen...
class UserFacingError(Exception): """An error suitable for presenting to the user. The message of a UserFacingError must be appropriate for displaying to the end user, e.g. it should not reference class or method names. An example of a UserFacingError is a setting value that has the wrong type. ...
class Userfacingerror(Exception): """An error suitable for presenting to the user. The message of a UserFacingError must be appropriate for displaying to the end user, e.g. it should not reference class or method names. An example of a UserFacingError is a setting value that has the wrong type. ...
class RuntimeProtocol (object): def __init__ (self, transport): self.transport = transport def send (self, topic, payload, context): self.transport.send('runtime', topic, payload, context) def receive (self, topic, payload, context): if topic == 'getruntime': return self.getRuntim...
class Runtimeprotocol(object): def __init__(self, transport): self.transport = transport def send(self, topic, payload, context): self.transport.send('runtime', topic, payload, context) def receive(self, topic, payload, context): if topic == 'getruntime': return self.g...
# -*- encoding: utf-8 -*- SUCCESS = (0, "Success") ERR_PARAM_ERROR = (40000, "Params error") ERR_AUTH_ERROR = (40001, "Unauthorized") ERR_PERMISSION_ERROR = (40003, "Forbidden") ERR_NOT_FOUND_ERROR = (40004, "Not Found") ERR_METHOD_NOT_ALLOWED = (40005, "Method Not Allowed") ERR_TOKEN_CHANGED_ERROR = (40006, "Token h...
success = (0, 'Success') err_param_error = (40000, 'Params error') err_auth_error = (40001, 'Unauthorized') err_permission_error = (40003, 'Forbidden') err_not_found_error = (40004, 'Not Found') err_method_not_allowed = (40005, 'Method Not Allowed') err_token_changed_error = (40006, 'Token has been changed.') err_admin...
""" Module: 'uzlib' on esp32 1.9.4 """ # MCU: (sysname='esp32', nodename='esp32', release='1.9.4', version='v1.9.4 on 2018-05-11', machine='ESP32 module with ESP32') # Stubber: 1.2.0 class DecompIO: '' def read(): pass def readinto(): pass def readline(): pass def decompress(...
""" Module: 'uzlib' on esp32 1.9.4 """ class Decompio: """""" def read(): pass def readinto(): pass def readline(): pass def decompress(): pass
#!/usr/bin/env python3 class Args : # dataset size... Use positive number to sample subset of the full dataset. dataset_sz = -1 # Archive outputs of training here for animating later. anim_dir = "anim" # images size we will work on. (sz, sz, 3) sz = 64 # alpha, used by leaky relu of ...
class Args: dataset_sz = -1 anim_dir = 'anim' sz = 64 alpha_d = 0.2 alpha_g = 0.2 batch_sz = 64 noise_shape = (1, 1, 100) snapshot_dir = './snapshots' dropout = 0.3 label_noise = 0.1 history_sz = 8 genw = 'gen.hdf5' discw = 'disc.hdf5' kernel_initializer = 'glorot...
class QualityError(Exception): pass
class Qualityerror(Exception): pass
# Rename this file as settings.py and set the client ID and secrets values # according to the values from https://code.google.com/apis/console/ # Client IDs, secrets, user-agents and host-messages are indexed by host name, # to allow the application to be run on different hosts, (e.g., test and production), # withou...
client_ids = {'import-tasks.appspot.com': '123456789012.apps.googleusercontent.com', 'import-tasks-test.appspot.com': '987654321987.apps.googleusercontent.com', 'localhost:8084': '999999999999.apps.googleusercontent.com'} client_secrets = {'import-tasks.appspot.com': 'MyVerySecretKeyForProdSvr', 'import-tasks-test.apps...
#----------------------------------------------------------------------------- # Copyright (c) 2013, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License with exception # for distributing bootloader. # # The full license is in the file COPYING.txt, distributed with this softwa...
""" Python library httplib does not work when trying to use ssl. The following modules should be included with httplib. """ hiddenimports = ['_ssl', 'ssl']
pkgname = "base-cross" pkgver = "0.1" pkgrel = 0 build_style = "meta" depends = ["clang-rt-cross", "musl-cross", "libcxx-cross"] pkgdesc = "Base metapackage for cross-compiling" maintainer = "q66 <q66@chimera-linux.org>" license = "custom:meta" url = "https://chimera-linux.org" options = ["!cross", "brokenlinks"] _tar...
pkgname = 'base-cross' pkgver = '0.1' pkgrel = 0 build_style = 'meta' depends = ['clang-rt-cross', 'musl-cross', 'libcxx-cross'] pkgdesc = 'Base metapackage for cross-compiling' maintainer = 'q66 <q66@chimera-linux.org>' license = 'custom:meta' url = 'https://chimera-linux.org' options = ['!cross', 'brokenlinks'] _targ...
""" Copyright 2018-present Open Networking Foundation 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 agre...
""" Copyright 2018-present Open Networking Foundation 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 agre...
def isprime(n): nn = n - 1 for i in xrange(2, nn): if n % i == 0: return False return True def primes(n): count = 0 for i in xrange(2, n): if isprime(i): count = count + 1 return count N = 10 * 10000 print(primes(N))
def isprime(n): nn = n - 1 for i in xrange(2, nn): if n % i == 0: return False return True def primes(n): count = 0 for i in xrange(2, n): if isprime(i): count = count + 1 return count n = 10 * 10000 print(primes(N))
def res_net(prod, usage): net = {res: p for res, p in prod.items()} for res, u in usage.items(): if res in net: net[res] = net[res] - u else: net[res] = -u return net
def res_net(prod, usage): net = {res: p for (res, p) in prod.items()} for (res, u) in usage.items(): if res in net: net[res] = net[res] - u else: net[res] = -u return net
class Creature: def __init__(self, name, terror_rating): self.name = name self.terror_rating = int(terror_rating) self.item_ls = [] self.times = 1 def take(self, item): self.item_ls.append(item) self.location.item_ls.remove(item) self.terror_rat...
class Creature: def __init__(self, name, terror_rating): self.name = name self.terror_rating = int(terror_rating) self.item_ls = [] self.times = 1 def take(self, item): self.item_ls.append(item) self.location.item_ls.remove(item) self.terror_rating += it...
def genNum(digit, times): result = digit if times>=1 and digit>0 and digit<10: for i in range(1, times): result = result*10+digit return result def sum(digit, num): result = 0 for x in range(1, num+1): result += genNum(digit, x) return result print(sum(1, 3)) def ge...
def gen_num(digit, times): result = digit if times >= 1 and digit > 0 and (digit < 10): for i in range(1, times): result = result * 10 + digit return result def sum(digit, num): result = 0 for x in range(1, num + 1): result += gen_num(digit, x) return result print(su...
class DataLoader: pass class DataSaver: pass
class Dataloader: pass class Datasaver: pass
# -*- coding: utf-8 -*- ''' File name: code\2x2_positive_integer_matrix\sol_420.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #420 :: 2x2 positive integer matrix # # For more information see: # https://projecteuler.net/problem=420 # Pr...
""" File name: code\x02x2_positive_integer_matrix\\sol_420.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nA positive integer matrix is a matrix whose elements are all positive integers.\nSome positive integer matrices can be expressed as a square of a positive integer matr...
class Node(object): id = None neighbours=[]#stores the ids of neighbour nodes distance_vector = [] neighbours_distance_vector = {}#stores the distance vector of neighbours def __init__(self, id): self.id = id #Initializing the distance vector and finding the neighbours def distance_from_neighbours(self,matri...
class Node(object): id = None neighbours = [] distance_vector = [] neighbours_distance_vector = {} def __init__(self, id): self.id = id def distance_from_neighbours(self, matrix, n): self.distance_vector = list(matrix[int(self.id)]) for i in range(n): if sel...
coordinates_80317C = ((155, 185), (155, 187), (155, 189), (156, 186), (156, 188), (156, 190), (157, 186), (157, 188), (157, 189), (157, 191), (158, 187), (158, 189), (158, 190), (158, 193), (159, 188), (159, 190), (159, 191), (159, 194), (159, 195), (159, 196), (160, 188), (160, 190), (160, 191), (160, 192), (160, 19...
coordinates_80317_c = ((155, 185), (155, 187), (155, 189), (156, 186), (156, 188), (156, 190), (157, 186), (157, 188), (157, 189), (157, 191), (158, 187), (158, 189), (158, 190), (158, 193), (159, 188), (159, 190), (159, 191), (159, 194), (159, 195), (159, 196), (160, 188), (160, 190), (160, 191), (160, 192), (160, 193...
# Maple Adjustment Period (57458) | Kanna 2nd Job haku = 9130081 cacophonous = 1142507 sm.removeEscapeButton() sm.setSpeakerID(haku) sm.setBoxChat() sm.sendNext("Finally, your real skills are coming back! I'm tired of doing all the work!") sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.sendNext("What exactly d...
haku = 9130081 cacophonous = 1142507 sm.removeEscapeButton() sm.setSpeakerID(haku) sm.setBoxChat() sm.sendNext("Finally, your real skills are coming back! I'm tired of doing all the work!") sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.sendNext('What exactly do you do, other than sleep?') sm.setSpeakerID(haku) sm...
"""BLPose Train: Data Utils Author: Bo Lin (@linbo0518) Date: 2021-01-02 """ """BLPose Data Format: type: List[List[int]] shape: (n_keypoints, 3) format: [[x1, y1, v1], [x2, y2, v2], ... [xk, yk, vk]] x: the x coordinate of the keypoint, dtype: int y: the y coordinate of the keypoint, dtype...
"""BLPose Train: Data Utils Author: Bo Lin (@linbo0518) Date: 2021-01-02 """ 'BLPose Data Format:\ntype: List[List[int]]\nshape: (n_keypoints, 3)\nformat:\n [[x1, y1, v1],\n [x2, y2, v2],\n ...\n [xk, yk, vk]]\n\n x: the x coordinate of the keypoint, dtype: int\n y: the y coordinate of the keypoin...
# -*- coding: utf-8 -*- ''' File name: code\problem_500\sol_500.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #500 :: Problem 500!!! # # For more information see: # https://projecteuler.net/problem=500 # Problem Statement ''' The numb...
""" File name: code\\problem_500\\sol_500.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nThe number of divisors of 120 is 16.\nIn fact 120 is the smallest number having 16 divisors.\n\n\nFind the smallest number with 2500500 divisors.\nGive your answer modulo 500500507.\n'...
''' 03 - barplots, pointplots and countplots The final group of categorical plots are barplots, pointplots and countplot which create statistical summaries of the data. The plots follow a similar API as the other plots and allow further customization for the specific problem at hand ''' # 1 - Countplots # Cr...
""" 03 - barplots, pointplots and countplots The final group of categorical plots are barplots, pointplots and countplot which create statistical summaries of the data. The plots follow a similar API as the other plots and allow further customization for the specific problem at hand """ sns.countplot(data=df...
# Page Definitions # See Page Format.txt for instructions and examples on how to modify your display settings PAGES_Play = { 'name':"Play", 'pages': [ { 'name':"Album_Artist_Title", 'duration':20, 'hidewhenempty':'all', 'hidewhenemptyvars': [ "album", "artist", "title" ], ...
pages__play = {'name': 'Play', 'pages': [{'name': 'Album_Artist_Title', 'duration': 20, 'hidewhenempty': 'all', 'hidewhenemptyvars': ['album', 'artist', 'title'], 'lines': [{'name': 'top', 'variables': ['album', 'artist', 'title'], 'format': '{0} {1} {2}', 'justification': 'left', 'scroll': True}, {'name': 'bottom'...
def test_presign_S3(_admin_client): patientID = "PH0001" payload = { "prefix": patientID, "filename": patientID + "_" + "a_file.vcf", "contentType": "multipart/form-data", } resp = _admin_client.post("/preSignS3URL", json=payload, content_type="application/json") assert resp....
def test_presign_s3(_admin_client): patient_id = 'PH0001' payload = {'prefix': patientID, 'filename': patientID + '_' + 'a_file.vcf', 'contentType': 'multipart/form-data'} resp = _admin_client.post('/preSignS3URL', json=payload, content_type='application/json') assert resp.status_code == 200 assert ...
# # PySNMP MIB module TIMETRA-SAS-PORT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-SAS-PORT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:14:36 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection, constraints_union) ...
# https://edabit.com/challenge/jwzgYjymYK7Gmro93 # Create a function that returns the indices of all occurrences of an item in the list. def get_indices(user_list: list, item: str or int) -> list: current_indice = 0 occurence_list = [] while len(user_list): if user_list[0] == item: ...
def get_indices(user_list: list, item: str or int) -> list: current_indice = 0 occurence_list = [] while len(user_list): if user_list[0] == item: occurence_list.append(current_indice) current_indice += 1 else: current_indice += 1 del user_list[0] ...
class Rectangulo: def __init__(self, base, altura): self.base = base self.altura = altura class CalculadorArea: def __init__(self, figuras): assert isinstance(figuras, list), "`shapes` should be of type `list`." self.figuras = figuras def suma_areas(self): total ...
class Rectangulo: def __init__(self, base, altura): self.base = base self.altura = altura class Calculadorarea: def __init__(self, figuras): assert isinstance(figuras, list), '`shapes` should be of type `list`.' self.figuras = figuras def suma_areas(self): total =...
class Error(Exception): """Base class for simphony errors.""" pass class DuplicateModelError(Error): def __init__(self, component_type): """Error for a duplicate component type. Parameters ---------- component_type : UniqueModelName The object containing the na...
class Error(Exception): """Base class for simphony errors.""" pass class Duplicatemodelerror(Error): def __init__(self, component_type): """Error for a duplicate component type. Parameters ---------- component_type : UniqueModelName The object containing the na...
load("//az/private:rules/config.bzl", _config = "config") load("//az/private:rules/datafactory/main.bzl", _datafactory = "datafactory") load("//az/private:rules/storage/main.bzl", _storage = "storage") az_config = _config az_datafactory = _datafactory az_storage = _storage
load('//az/private:rules/config.bzl', _config='config') load('//az/private:rules/datafactory/main.bzl', _datafactory='datafactory') load('//az/private:rules/storage/main.bzl', _storage='storage') az_config = _config az_datafactory = _datafactory az_storage = _storage
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class TypeFileSearchResultEnum(object): """Implementation of the 'Type_FileSearchResult' enum. Specifies the type of the file document such as KDirectory, kFile, etc. Attributes: KDIRECTORY: TODO: type description here. KFILE: TODO: ...
class Typefilesearchresultenum(object): """Implementation of the 'Type_FileSearchResult' enum. Specifies the type of the file document such as KDirectory, kFile, etc. Attributes: KDIRECTORY: TODO: type description here. KFILE: TODO: type description here. KEMAIL: TODO: type descrip...
num_1 = 1 num_2 = 2 num = 276 min = 3600 for a in range(1, 21): for b in range(2, 11): min_ = abs(a * (b - 1) * 20 - num) if min_ == 0: num_1 = a num_2 = b break if min_ < min: min = min_ num_1 = a num_2 = b else: ...
num_1 = 1 num_2 = 2 num = 276 min = 3600 for a in range(1, 21): for b in range(2, 11): min_ = abs(a * (b - 1) * 20 - num) if min_ == 0: num_1 = a num_2 = b break if min_ < min: min = min_ num_1 = a num_2 = b else: ...
# ABOUT : This program deals with the accumulation pattern # used with the help of dictionary # Here in this program we will find minimum value associated with the # key : character in the string # initialize a string words = "Welcome back. Take a look in your calendar and mark this date. Today is the day yo...
words = 'Welcome back. Take a look in your calendar and mark this date. Today is the day you are crossing over the line, from someone who can just write code that does something to being a real programmer, someone who can abstract from a bit of code that works on one piece of data, to writing a function that will opera...
""" 1. Write a function that accepts two integers num1 and num2. The function should divide num1 by num2 and return the quotient and remainder. The output can be rounded to 2 decimal places. """ def quot_rem(num1,num2): q = round((num1 / num2), 2) r = round((num1 % num2), 2) return (q,r)
""" 1. Write a function that accepts two integers num1 and num2. The function should divide num1 by num2 and return the quotient and remainder. The output can be rounded to 2 decimal places. """ def quot_rem(num1, num2): q = round(num1 / num2, 2) r = round(num1 % num2, 2) return (q, r)
list_of_urls = [ "www.cnn.com", "www.bbc.co.uk", "nytimes.com", "ipv6.google.com" # ,"site2.example.com" ]
list_of_urls = ['www.cnn.com', 'www.bbc.co.uk', 'nytimes.com', 'ipv6.google.com']
""" Version of Petronia. This file will become auto-generated. """ PROGRAM = 'Petronia' NAME = 'Petronia, The Cross-Platform Window Manager' VERSION = '3.0.0 alpha-1'
""" Version of Petronia. This file will become auto-generated. """ program = 'Petronia' name = 'Petronia, The Cross-Platform Window Manager' version = '3.0.0 alpha-1'
# -*- coding: utf-8 -*- """ Created on Wed Jul 15 11:35:30 2020 @author: Castellano """ def ExploreIsland(t1=int,m=int,n=int, neighbors=[]): coordinates = T[t1] candidates = [] if neighbors == []: neighbors.append(t1) row_candidates = [(coordinates[0],coordinates[1]-1),...
""" Created on Wed Jul 15 11:35:30 2020 @author: Castellano """ def explore_island(t1=int, m=int, n=int, neighbors=[]): coordinates = T[t1] candidates = [] if neighbors == []: neighbors.append(t1) row_candidates = [(coordinates[0], coordinates[1] - 1), (coordinates[0], coordinates[1] + 1)] ...
class cached_property(object): # noqa # From the excellent Bottle (c) Marcel Hellkamp # https://github.com/bottlepy/bottle # MIT licensed """ A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the propert...
class Cached_Property(object): """ A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the property. """ def __init__(self, func): self.__doc__ = getattr(func, '__doc__') self.func = func def ...
#set midpoint midpoint = 5 # make 2 empty lists lower = []; upper = [] #to terminate a line to put two statements on a single line #split the numbers into the lists based on conditional logic for i in range(10): if (i < midpoint): lower.append(i) else: upper.append(i) print("Lower values are:...
midpoint = 5 lower = [] upper = [] for i in range(10): if i < midpoint: lower.append(i) else: upper.append(i) print('Lower values are: ', lower) print('Upper values are: ', upper) x = 1 + 2 + 5 + 6 print(x)
# Copyright 2012 Google Inc. All rights reserved. # -*- coding: utf-8 -*- """ Nicely formatted cipher suite definitions for TLS A list of cipher suites in the form of CipherSuite objects. These are supposed to be immutable; don't mess with them. """ class CipherSuite(object): """ Encapsulates a cipher suite....
""" Nicely formatted cipher suite definitions for TLS A list of cipher suites in the form of CipherSuite objects. These are supposed to be immutable; don't mess with them. """ class Ciphersuite(object): """ Encapsulates a cipher suite. Members/args: * code: two-byte ID code, as int * kx: key exch...
# Time: O(n^2) # Space: O(n^2) # We are playing the Guess Game. The game is as follows: # # I pick a number from 1 to n. You have to guess which number I picked. # # Every time you guess wrong, I'll tell you whether the number I picked is higher or lower. # # However, when you guess a particular number x, and you gue...
class Solution(object): def get_money_amount(self, n): """ :type n: int :rtype: int """ pay = [[0] * n for _ in xrange(n + 1)] for i in reversed(xrange(n)): for j in xrange(i + 1, n): pay[i][j] = min((k + 1 + max(pay[i][k - 1], pay[k + 1][...
def handle(argv): prop = properties() command_map = ('compile', 'test' , 'help') argv = argv[1:] if len(argv) == 0: raise Exception('scalu must be provided with a command to run: compile, test, help, etc') if argv[0] in command_map: prop.mode = argv[0] else: bad_arg(arg) return prop def bad_arg(arg): rai...
def handle(argv): prop = properties() command_map = ('compile', 'test', 'help') argv = argv[1:] if len(argv) == 0: raise exception('scalu must be provided with a command to run: compile, test, help, etc') if argv[0] in command_map: prop.mode = argv[0] else: bad_arg(arg) ...
#https://leetcode.com/problems/maximum-subarray/ """ [0] if we know the max value of the subarray that ends at i index is Mi what is the max value of the subarray that ends at i+1 index? its either nums[i+1] or nums[i+1]+Mi so code below, maxCurrent[i] stores the max value of subarray that ends at i [1] the max value ...
""" [0] if we know the max value of the subarray that ends at i index is Mi what is the max value of the subarray that ends at i+1 index? its either nums[i+1] or nums[i+1]+Mi so code below, maxCurrent[i] stores the max value of subarray that ends at i [1] the max value of the subarray that ends at 0, has to be nums[0]...
""" Performance of DFT calculation is better when array size = power of 2 arrays whose size is product of 2, 3, and 5 also quite efficient for performance: ue zero padding OpenCV - manually pad 0s Numpy - specify new size of FFT calculation, automatically pads 0s """ # to calculate optimal size: use OpenCV func...
""" Performance of DFT calculation is better when array size = power of 2 arrays whose size is product of 2, 3, and 5 also quite efficient for performance: ue zero padding OpenCV - manually pad 0s Numpy - specify new size of FFT calculation, automatically pads 0s """ cv2.getOptimalDFTSize(rows) cv2.getOptimalDF...
A = 26 MASKS = (A + 1) * 4 MOD = 10**9 + 7 def solve(): m = int(input()) parts = [input() for _ in range(m)] s = "".join(parts) s = [ord(c) - ord('a') for c in s] n = len(s) edge = [True] + [False] * n i = 0 for w in parts: i += len(w) edge[i] = True a = [[[0] * MASKS for i in range(n + 1)] for j in range...
a = 26 masks = (A + 1) * 4 mod = 10 ** 9 + 7 def solve(): m = int(input()) parts = [input() for _ in range(m)] s = ''.join(parts) s = [ord(c) - ord('a') for c in s] n = len(s) edge = [True] + [False] * n i = 0 for w in parts: i += len(w) edge[i] = True a = [[[0] * MA...
src = Glob('*.c') component = aos_component('libkm', src) component.add_global_includes('include') component.add_component_dependencis('security/plat_gen', 'security/alicrypto') component.add_prebuilt_lib('lib/' + component.get_global_arch() + '/libkm.a')
src = glob('*.c') component = aos_component('libkm', src) component.add_global_includes('include') component.add_component_dependencis('security/plat_gen', 'security/alicrypto') component.add_prebuilt_lib('lib/' + component.get_global_arch() + '/libkm.a')
class Algo(object) : def __init__(self) : self.n_clusters = None def run(self, matrix) : """ Abstract method to be redefine on each childs """ raise NotImplemented()
class Algo(object): def __init__(self): self.n_clusters = None def run(self, matrix): """ Abstract method to be redefine on each childs """ raise not_implemented()
myemp = { 'Name': 'Steve', 'Age':58, 'Sex': 'Male'} print(myemp)# K1 print(myemp.keys())# K2 myrem = myemp.popitem() print(myrem, 'is removed')# K3 print(myemp.keys())# K4 print(list(myemp.keys()))# K5 for key in myemp.keys(): # K6 print(key)
myemp = {'Name': 'Steve', 'Age': 58, 'Sex': 'Male'} print(myemp) print(myemp.keys()) myrem = myemp.popitem() print(myrem, 'is removed') print(myemp.keys()) print(list(myemp.keys())) for key in myemp.keys(): print(key)
''' Created on 10 Feb 2016 @author: BenShelly ''' class RacecardConsoleView(object): ''' classdocs ''' def __init__(self): ''' Constructor ''' def printRacecard(self, horseOddsArray): for horseOdds in horseOddsArray: print(h...
""" Created on 10 Feb 2016 @author: BenShelly """ class Racecardconsoleview(object): """ classdocs """ def __init__(self): """ Constructor """ def print_racecard(self, horseOddsArray): for horse_odds in horseOddsArray: print(horseOdds.toString())
with open('./inputs/22.txt') as f: instructions = f.readlines() def solve(part): def logic(status, part): nonlocal infected, direction if part == 1: if status == 0: infected += 1 direction *= (1 - 2*status) * 1j else: if status == 1: ...
with open('./inputs/22.txt') as f: instructions = f.readlines() def solve(part): def logic(status, part): nonlocal infected, direction if part == 1: if status == 0: infected += 1 direction *= (1 - 2 * status) * 1j elif status == 1: in...
def f(x, l=[]): for i in range(x): l.append(i * i) print(l) f(2) f(3, [3, 2, 1]) f(3)
def f(x, l=[]): for i in range(x): l.append(i * i) print(l) f(2) f(3, [3, 2, 1]) f(3)
''' This is a docstring This code subtracts 2 numbers ''' a = 3 b = 5 c = b-a print(c)
""" This is a docstring This code subtracts 2 numbers """ a = 3 b = 5 c = b - a print(c)
load( "//:deps.bzl", "com_github_grpc_grpc", "com_google_protobuf", "io_bazel_rules_python", "six", ) def python_proto_compile(**kwargs): com_google_protobuf(**kwargs) def python_grpc_compile(**kwargs): python_proto_compile(**kwargs) com_github_grpc_grpc(**kwargs) io_bazel_rules_py...
load('//:deps.bzl', 'com_github_grpc_grpc', 'com_google_protobuf', 'io_bazel_rules_python', 'six') def python_proto_compile(**kwargs): com_google_protobuf(**kwargs) def python_grpc_compile(**kwargs): python_proto_compile(**kwargs) com_github_grpc_grpc(**kwargs) io_bazel_rules_python(**kwargs) six(...
class Node: """Node for singly-linked list.""" def __init__(self, data): self.data = data self.next = None def __str__(self): return str(self.data) class LinkedList: """Singly-linked list with tail.""" def __init__(self, nodes=None): # nodes is a list. must learn type h...
class Node: """Node for singly-linked list.""" def __init__(self, data): self.data = data self.next = None def __str__(self): return str(self.data) class Linkedlist: """Singly-linked list with tail.""" def __init__(self, nodes=None): self.head = None self....
# Time: O(n) # Space: O(h) # 337 # The thief has found himself a new place for his thievery again. # There is only one entrance to this area, called the "root." # Besides the root, each house has one and only one parent house. # After a tour, the smart thief realized that "all houses in this # place forms a binary tr...
class Solution(object): def rob(self, root): """ :type root: TreeNode :rtype: int """ def rob_helper(root): if not root: return (0, 0) (l_take, l_skip) = rob_helper(root.left) (r_take, r_skip) = rob_helper(root.right) ...
{ "targets":[ { "target_name": "hcaptha", "conditions": [ ["OS==\"mac\"", { "sources": [ "addon/hcaptha.cc" ,"addon/cap.cc"], "libraries": [], "cflags_cc": ["-fex...
{'targets': [{'target_name': 'hcaptha', 'conditions': [['OS=="mac"', {'sources': ['addon/hcaptha.cc', 'addon/cap.cc'], 'libraries': [], 'cflags_cc': ['-fexceptions', '-Dcimg_display=0'], 'xcode_settings': {'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'}}], ['OS=="linux"', {'sources': ['addon/jpeglib/jaricom.c', 'addon/jpeglib/jcap...
class TTBusDeviceAddress: def __init__(self, address, node): self.address = address self.node = node @property def id(self): return f"{self.address:02X}_{self.node:02X}" @property def as_tuple(self): return self.address, self.node def __str__(self): ret...
class Ttbusdeviceaddress: def __init__(self, address, node): self.address = address self.node = node @property def id(self): return f'{self.address:02X}_{self.node:02X}' @property def as_tuple(self): return (self.address, self.node) def __str__(self): ...
def pos_to_line_col(source, pos): offset = 0 line = 0 for line in source.splitlines(): _offset = offset line += 1 offset += len(line) + 1 if offset > pos: return line, pos - _offset + 1
def pos_to_line_col(source, pos): offset = 0 line = 0 for line in source.splitlines(): _offset = offset line += 1 offset += len(line) + 1 if offset > pos: return (line, pos - _offset + 1)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") def rules_helm_go_dependencies(): """Pull in external Go packages needed by Go binarie...
load('@bazel_gazelle//:deps.bzl', 'gazelle_dependencies', 'go_repository') load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') load('@io_bazel_rules_go//go:deps.bzl', 'go_register_toolchains', 'go_rules_dependencies') def rules_helm_go_dependencies(): """Pull in external Go packages needed by Go binarie...
def validate_json(json): required_fields = ['Name', 'DateOfPublication', 'Type', 'Author', 'Description'] missing_fields = [] for key in required_fields: if key not in json.keys(): missing_fields.append(key) elif json[key] == "": missing_fields.append(key) if le...
def validate_json(json): required_fields = ['Name', 'DateOfPublication', 'Type', 'Author', 'Description'] missing_fields = [] for key in required_fields: if key not in json.keys(): missing_fields.append(key) elif json[key] == '': missing_fields.append(key) if len(...
ans=[] #create a new node class Node: def __init__(self, data): self.data = data self.left = None self.right = None #top of stack def peek(s): if len(s) > 0: return s[-1] return None def postOrderTraversal(root): # if tree is empty if root is None:...
ans = [] class Node: def __init__(self, data): self.data = data self.left = None self.right = None def peek(s): if len(s) > 0: return s[-1] return None def post_order_traversal(root): if root is None: return s = [] while True: while root: ...
{ "variables": { "os_linux_compiler%": "gcc", "build_v8_with_gn": "false" }, "targets": [ { "target_name": "cbor-extract", "win_delay_load_hook": "false", "sources": [ "src/extract.cpp", ], "include_dirs": [ "<!(node -e \"require('nan')\")", ], ...
{'variables': {'os_linux_compiler%': 'gcc', 'build_v8_with_gn': 'false'}, 'targets': [{'target_name': 'cbor-extract', 'win_delay_load_hook': 'false', 'sources': ['src/extract.cpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'conditions': [["OS=='linux'", {'variables': {'gcc_version': "<!(<(os_linux_compiler) ...
""" Extension classes enhance TouchDesigner component networks with python functionality. An extension can be accessed via ext.ExtensionClassName from any operator within the extended component. If the extension is "promoted", all its attributes with capitalized names can be accessed directly through the extended ...
""" Extension classes enhance TouchDesigner component networks with python functionality. An extension can be accessed via ext.ExtensionClassName from any operator within the extended component. If the extension is "promoted", all its attributes with capitalized names can be accessed directly through the extended compo...
__author__ = 'Ralph' # import app # import canvas # import widgets
__author__ = 'Ralph'
class TextWrapper(object): def __init__(self): self._wrap_chars = " " self.unwrapped = "" self.cursor_loc = [0, 0] self.prev_line_break = 0 self.rows = [] def add_line(self, end): new_line = self.unwrapped[self.prev_line_break:end].replace("\n", " ") self...
class Textwrapper(object): def __init__(self): self._wrap_chars = ' ' self.unwrapped = '' self.cursor_loc = [0, 0] self.prev_line_break = 0 self.rows = [] def add_line(self, end): new_line = self.unwrapped[self.prev_line_break:end].replace('\n', ' ') sel...
with open("input.txt", 'r') as file: file = file.read() file = file.split("\n") file = file[:-1] file = [int(i) for i in file] frequency = 0 prev = set() prev.add(0) stop = True while (stop): for n in file: frequency += n if frequency not in prev: ...
with open('input.txt', 'r') as file: file = file.read() file = file.split('\n') file = file[:-1] file = [int(i) for i in file] frequency = 0 prev = set() prev.add(0) stop = True while stop: for n in file: frequency += n if frequency not in prev: ...
"""Top-level package for gridverse-experiments.""" __author__ = """sammie katt""" __email__ = "sammie.katt@gmail.com" __version__ = "0.1.0"
"""Top-level package for gridverse-experiments.""" __author__ = 'sammie katt' __email__ = 'sammie.katt@gmail.com' __version__ = '0.1.0'
def twenty_nineteen(): """Come up with the most creative expression that evaluates to 2019, using only numbers and the +, *, and - operators. >>> twenty_nineteen() 2019 """ return 2018+1
def twenty_nineteen(): """Come up with the most creative expression that evaluates to 2019, using only numbers and the +, *, and - operators. >>> twenty_nineteen() 2019 """ return 2018 + 1
def repeatedString(s, n): lss=n%len(s) tfs=int(n/len(s)) cnt=s.count('a') sc=s.count('a',0,lss) tc=(tfs*cnt)+sc return tc
def repeated_string(s, n): lss = n % len(s) tfs = int(n / len(s)) cnt = s.count('a') sc = s.count('a', 0, lss) tc = tfs * cnt + sc return tc
# Helper for formatting time strings def smart_time(t): tstr = 't = ' if t < 2*60.: tstr += '{0:.4f} sec'.format(t) elif t < 90.*60: tstr += '{0:.4f} min'.format(t/60) elif t < 48.*60*60: tstr += '{0:.4f} hrs'.format(t/(60*60)) else: tstr += '{0:.4f} day'.format(t/(2...
def smart_time(t): tstr = 't = ' if t < 2 * 60.0: tstr += '{0:.4f} sec'.format(t) elif t < 90.0 * 60: tstr += '{0:.4f} min'.format(t / 60) elif t < 48.0 * 60 * 60: tstr += '{0:.4f} hrs'.format(t / (60 * 60)) else: tstr += '{0:.4f} day'.format(t / (24 * 60 * 60)) r...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class FileSizePolicyEnum(object): """Implementation of the 'FileSizePolicy' enum. Specifies policy to select a file to migrate based on its size. eg. A file can be selected to migrate if its size is greater than or smaller than the FileSizeBytes....
class Filesizepolicyenum(object): """Implementation of the 'FileSizePolicy' enum. Specifies policy to select a file to migrate based on its size. eg. A file can be selected to migrate if its size is greater than or smaller than the FileSizeBytes. enum: kGreaterThan, kSmallerThan. Specifies poli...
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. _BASE85_CHARACTERS = ('0123456789' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' ...
_base85_characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~' _char_to_value = {} def decode_base85(encoded_str): """Decodes a base85 string. The input string length must be a multiple of 5, and the resultant binary length is always a multiple of 4. """ ...
print('salut') a = 1 print(a.denominator) # print(a.to_bytes()) class Salut: def __init__(self, truc): self.truc = truc def stuff(self) -> dict: return {'truc': self.truc} s = Salut('bidule') s.truc b = s.stuff() wesh = b.pop('truc') print(wesh.replace('dule', 'de'))
print('salut') a = 1 print(a.denominator) class Salut: def __init__(self, truc): self.truc = truc def stuff(self) -> dict: return {'truc': self.truc} s = salut('bidule') s.truc b = s.stuff() wesh = b.pop('truc') print(wesh.replace('dule', 'de'))
students = { "Ivan": 5.00, "Alex": 3.50, "Maria": 5.50, "Georgy": 5.00, } # Print out the names of the students, which scores > 4.00 names = list(students.keys()) scores = list(students.values()) max_score = max(scores) max_score_index = scores.index(max_score) min_score = min(scores) min_score_index...
students = {'Ivan': 5.0, 'Alex': 3.5, 'Maria': 5.5, 'Georgy': 5.0} names = list(students.keys()) scores = list(students.values()) max_score = max(scores) max_score_index = scores.index(max_score) min_score = min(scores) min_score_index = scores.index(min_score) print('{} - {}'.format(names[max_score_index], max_score))...
#!/usr/bin/env python3 class Event(object): pass class TickEvent(Event): def __init__(self, product, time, sequence, price, bid, ask, spread, side, size): self.type = 'TICK' self.sequence = sequence self.product = product self.time = time self.price = price se...
class Event(object): pass class Tickevent(Event): def __init__(self, product, time, sequence, price, bid, ask, spread, side, size): self.type = 'TICK' self.sequence = sequence self.product = product self.time = time self.price = price self.bid = bid self...
#!/usr/bin/env python ''' config.py NOTE: I'M INCLUDING THIS FILE IN MY REPOSITORY TO SHOW YOU ITS FORMAT, BUT YOU SHOULD NOT KEEP CONFIG FILES WITH LOGIN CREDENTIALS IN YOUR REPOSITORY. In fact, I generally put a .gitignore file with "config.py" in it in whatever directory is supposed ...
""" config.py NOTE: I'M INCLUDING THIS FILE IN MY REPOSITORY TO SHOW YOU ITS FORMAT, BUT YOU SHOULD NOT KEEP CONFIG FILES WITH LOGIN CREDENTIALS IN YOUR REPOSITORY. In fact, I generally put a .gitignore file with "config.py" in it in whatever directory is supposed to house the config file. It's...
class Facade: pass facade_1 = Facade() facade_1_type = type(facade_1) print(facade_1_type)
class Facade: pass facade_1 = facade() facade_1_type = type(facade_1) print(facade_1_type)
#!/usr/bin/env python # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 20...
""" CRTP Driver main class. """ __author__ = 'Bitcraze AB' __all__ = ['CRTPDriver'] class Crtpdriver: """ CTRP Driver main class This class in inherited by all the CRTP link drivers. """ def __init__(self): """Driver constructor. Throw an exception if the driver is unable to open the ...
test_cases = int(input().strip()) for t in range(1, test_cases + 1): n, m = tuple(map(int, input().strip().split())) strings = [input().strip() for _ in range(n)] for i in range(n): for j in range(n - m + 1): r_left = j r_right = j + m - 1 c_top = j ...
test_cases = int(input().strip()) for t in range(1, test_cases + 1): (n, m) = tuple(map(int, input().strip().split())) strings = [input().strip() for _ in range(n)] for i in range(n): for j in range(n - m + 1): r_left = j r_right = j + m - 1 c_top = j ...
class Solution: def solve(self, nums, k): dp = [0] ans = 0 for i in range(len(nums)): mx = nums[i] cur_ans = 0 for j in range(i,max(-1,i-k),-1): mx = max(mx, nums[j]) cur_ans = max(cur_ans, mx*(i-j+1) + dp[j]) ...
class Solution: def solve(self, nums, k): dp = [0] ans = 0 for i in range(len(nums)): mx = nums[i] cur_ans = 0 for j in range(i, max(-1, i - k), -1): mx = max(mx, nums[j]) cur_ans = max(cur_ans, mx * (i - j + 1) + dp[j]) ...