content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def import_class(path): """ Import a class from a dot-delimited module path. Accepts both dot and colon seperators for the class portion of the path. ex:: import_class('package.module.ClassName') or import_class('package.module:ClassName') """ if ':' in path: ...
def import_class(path): """ Import a class from a dot-delimited module path. Accepts both dot and colon seperators for the class portion of the path. ex:: import_class('package.module.ClassName') or import_class('package.module:ClassName') """ if ':' in path: (...
answerDict = { "New York" : "albany", "California" : "sacramento", "Alabama" : "montgomery", "Ohio": "columbus", "Utah": "salt lake city" } def checkAnswer(answer): resultsDict = {} for k,v in answer.items(): if answerDict[k] == v: resultsDict[k] = True else: resultsDict...
answer_dict = {'New York': 'albany', 'California': 'sacramento', 'Alabama': 'montgomery', 'Ohio': 'columbus', 'Utah': 'salt lake city'} def check_answer(answer): results_dict = {} for (k, v) in answer.items(): if answerDict[k] == v: resultsDict[k] = True else: resultsDic...
# this will create a 60 GB dummy asset file for testing the upload via # the admin GUI. LARGE_FILE_SIZE = 60 * 1024**3 # this is 60 GB with open("xxxxxxl_asset_file.zip", "wb") as dummy_file: dummy_file.seek(int(LARGE_FILE_SIZE) - 1) dummy_file.write(b"\0")
large_file_size = 60 * 1024 ** 3 with open('xxxxxxl_asset_file.zip', 'wb') as dummy_file: dummy_file.seek(int(LARGE_FILE_SIZE) - 1) dummy_file.write(b'\x00')
class Solution: def calculate(self, s: str) -> int: stack = [] zero = ord('0') operand = 0 res = 0 sign = 1 for ch in s: if ch.isdigit(): operand = operand * 10 + ord(ch) - zero elif ch == '+': res += sign * oper...
class Solution: def calculate(self, s: str) -> int: stack = [] zero = ord('0') operand = 0 res = 0 sign = 1 for ch in s: if ch.isdigit(): operand = operand * 10 + ord(ch) - zero elif ch == '+': res += sign * ope...
"""Assorted class utilities and tools""" class AttrDisplay: def __repr__(self): """ Get representation object. Returns ------- str Object representation. """ return "{}".format({key: value for key, value in self.__dict__.items() if not key.star...
"""Assorted class utilities and tools""" class Attrdisplay: def __repr__(self): """ Get representation object. Returns ------- str Object representation. """ return '{}'.format({key: value for (key, value) in self.__dict__.items() if not key.sta...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Requires python 3.6+ ####################################################################################################################### # Global variables # Can be reassigned by the settings from the configuration file ##############################################...
config_path = 'gitmon.conf' data_path = 'data.json' update_interval = 0 github_base_url = 'https://api.github.com/repos' app_logs_type = 'console' app_logs_file = 'gitmon.log' logger = None options = {}
def swap(i, j, arr): temp = arr[i] arr[i] = arr[j] arr[j] = temp def quicksort(arr, low, high): if(low < high): p = partition(arr, low, high); quicksort(arr, low, p-1); quicksort(arr, p+1, high); def partition(arr, low, high): pivot = arr[low] i = low j = high while(i < j): while(arr[i] <= pivot and i...
def swap(i, j, arr): temp = arr[i] arr[i] = arr[j] arr[j] = temp def quicksort(arr, low, high): if low < high: p = partition(arr, low, high) quicksort(arr, low, p - 1) quicksort(arr, p + 1, high) def partition(arr, low, high): pivot = arr[low] i = low j = high w...
expected_output = { "system_auth_control": False, "version": 3, "interfaces": { "Ethernet1/2": { "interface": "Ethernet1/2", "pae": "authenticator", "port_control": "not auto", "host_mode": "double host", "re_authentication": False, ...
expected_output = {'system_auth_control': False, 'version': 3, 'interfaces': {'Ethernet1/2': {'interface': 'Ethernet1/2', 'pae': 'authenticator', 'port_control': 'not auto', 'host_mode': 'double host', 're_authentication': False, 'timeout': {'quiet_period': 59, 'server_timeout': 29, 'supp_timeout': 29, 'tx_period': 29,...
# -*- coding: utf-8 -*- # From http://www.w3.org/WAI/ER/IG/ert/iso639.htm # ISO 639: 2-letter codes languages = { 'aa': 'afar', 'ab': 'abkhazian', 'af': 'afrikaans', 'am': 'amharic', 'ar': 'arabic', 'as': 'assamese', 'ay': 'aymara', 'az': 'azerbaijani', 'ba': 'bashkir', 'be': 'byelorussian', 'bg': 'bulgarian', 'bh': '...
languages = {'aa': 'afar', 'ab': 'abkhazian', 'af': 'afrikaans', 'am': 'amharic', 'ar': 'arabic', 'as': 'assamese', 'ay': 'aymara', 'az': 'azerbaijani', 'ba': 'bashkir', 'be': 'byelorussian', 'bg': 'bulgarian', 'bh': 'bihari', 'bi': 'bislama', 'bn': 'bengali', 'bo': 'tibetan', 'br': 'breton', 'ca': 'catalan', 'co': 'co...
class EDGARQueryError(Exception): """ This error is thrown when a query receives a response that is not a 200 response. """ def __str__(self): return "An error occured while making the query." class EDGARFieldError(Exception): """ This error is thrown when an invalid field is given to...
class Edgarqueryerror(Exception): """ This error is thrown when a query receives a response that is not a 200 response. """ def __str__(self): return 'An error occured while making the query.' class Edgarfielderror(Exception): """ This error is thrown when an invalid field is given to ...
#FileExample2.py ----Writing data to file #opening file in write mode fp = open("info.dat",'w') #Writing data to file fp.write("Hello Suprit this is Python") #Check message print("Data Inserted to file Successfully!\nPlease Verify.")
fp = open('info.dat', 'w') fp.write('Hello Suprit this is Python') print('Data Inserted to file Successfully!\nPlease Verify.')
class EnvVariableFile(object): T_WORK = '/ade/kgurupra_dte8028/oracle/work/build_run_robot1/../' VIEW_ROOT = '/ade/kgurupra_dte8028' BROWSERTYPE = 'firefox' ########################For OID info################################################ OID_HOST = 'slc06xgk.us.oracle.com' OID_PORT = '15635' OID_SSL_PORT =...
class Envvariablefile(object): t_work = '/ade/kgurupra_dte8028/oracle/work/build_run_robot1/../' view_root = '/ade/kgurupra_dte8028' browsertype = 'firefox' oid_host = 'slc06xgk.us.oracle.com' oid_port = '15635' oid_ssl_port = '22718' oid_admin = 'cn=orcladmin' oid_admin_password = 'welc...
List_of_numbers = [5,10,15,20,25] for numbers in List_of_numbers: print (numbers **10) Values_list=[] Values_list.append(numbers **10) print(Values_list)
list_of_numbers = [5, 10, 15, 20, 25] for numbers in List_of_numbers: print(numbers ** 10) values_list = [] Values_list.append(numbers ** 10) print(Values_list)
# 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 isSymmetric(self, root): """ :type root: TreeNode :rtype: bool """ q...
class Solution(object): def is_symmetric(self, root): """ :type root: TreeNode :rtype: bool """ queue = [] queue.append(root) (queue_front, queue_back) = (1, 0) while queueBack < queueFront: increase = 0 while queueBack < queue...
q = 'a' while(q != 'q'): print("estou em looping") q = input("Insira algo> ") else: print("fim")
q = 'a' while q != 'q': print('estou em looping') q = input('Insira algo> ') else: print('fim')
# -*- coding: utf-8 -*- """Collection of useful http error for the Api""" class GKJsonApiException(Exception): """Base exception class for unknown errors""" title = 'Unknown error' status = '500' source = None def __init__(self, detail, source=None, title=None, status=None, code=None, id_=None,...
"""Collection of useful http error for the Api""" class Gkjsonapiexception(Exception): """Base exception class for unknown errors""" title = 'Unknown error' status = '500' source = None def __init__(self, detail, source=None, title=None, status=None, code=None, id_=None, links=None, meta=None): ...
# cnt = int(input()) # for i in range(cnt): # rep = int(input()) # arr = list(str(input())) # for j in range(len(arr)): # prt = arr[j] # for _ in range(rep): # print(prt,end="") # print() cnt = int(input()) for i in range(cnt): (rep,arr) = map(str,inpu...
cnt = int(input()) for i in range(cnt): (rep, arr) = map(str, input().split()) arr = list(str(arr)) for j in range(len(arr)): prt = arr[j] for _ in range(int(rep)): print(prt, end='') print()
class SwapUser: def __init__(self, exposure, collateral_perc, fee_perc): self.exposure = exposure self.collateral = collateral_perc self.collateral_value = collateral_perc * exposure self.fee = fee_perc * exposure self.is_active = True self.is_liquidated = ...
class Swapuser: def __init__(self, exposure, collateral_perc, fee_perc): self.exposure = exposure self.collateral = collateral_perc self.collateral_value = collateral_perc * exposure self.fee = fee_perc * exposure self.is_active = True self.is_liquidated = False ...
"""HTML related constants. """ SCRIPT_START_TAG: str = '<script type="text/javascript">' SCRIPT_END_TAG: str = '</script>'
"""HTML related constants. """ script_start_tag: str = '<script type="text/javascript">' script_end_tag: str = '</script>'
class SquareGrid: def __init__(self, width, height): self.width = width self.height = height self.walls = [] def in_bounds(self, node_id): (x, y) = node_id return 0 <= x < self.width and 0 <= y < self.height def passable(self, node_id): return node_id not in...
class Squaregrid: def __init__(self, width, height): self.width = width self.height = height self.walls = [] def in_bounds(self, node_id): (x, y) = node_id return 0 <= x < self.width and 0 <= y < self.height def passable(self, node_id): return node_id not i...
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- # vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab # 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 ...
""" A collection of Web browser user agent strings. Culled from actual apache log file. """ user_agents = {'atw_crawl': 'FAST-WebCrawler/3.6 (atw-crawler at fast dot no; http://fast.no/support/crawler.asp)', 'becomebot': 'Mozilla/5.0 (compatible; BecomeBot/3.0; MSIE 6.0 compatible; +http://www.become.com/site_owners.h...
# # PySNMP MIB module NETSCREEN-OSPF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-OSPF-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:10:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) ...
test_dic = { "SERVICETYPE": { "SC": { "SITEVERSION": {"T33L": "1"} }, "EC": { "SITEVERSION": { "T33L": "1", "T31L": { "BROWSERVERSION": { "9.1": "1", "59.0": "1" ...
test_dic = {'SERVICETYPE': {'SC': {'SITEVERSION': {'T33L': '1'}}, 'EC': {'SITEVERSION': {'T33L': '1', 'T31L': {'BROWSERVERSION': {'9.1': '1', '59.0': '1'}}, 'T32L': '1'}}, 'TC': {'OSVERSION': {'10.13': '1', 'Other': {'BROWSERVERSION': {'52.0': '1'}}}}}}
# # @lc app=leetcode id=977 lang=python3 # # [977] Squares of a Sorted Array # # @lc code=start class Solution: def sortedSquares(self, A: List[int]) -> List[int]: newls = [item * item for item in A] return sorted(newls) # @lc code=end
class Solution: def sorted_squares(self, A: List[int]) -> List[int]: newls = [item * item for item in A] return sorted(newls)
def get_firts_two_characters(string): # 6.1.A return string[:2] def get_last_three_characters(string): # 6.1.B return string[-3:] def print_every_two(string): # 6.1.C return string[::2] def reverse(string): # 6.1.D return string[::-1] def reverse_and_concact(string): # 6.1.D ...
def get_firts_two_characters(string): return string[:2] def get_last_three_characters(string): return string[-3:] def print_every_two(string): return string[::2] def reverse(string): return string[::-1] def reverse_and_concact(string): return string + reverse(string) def str_insert_character(st...
#!/usr/bin/env python3 def stalinsort(x=[]): if x == []: return x for i in range(len(x)-1): if x[i] < x[i+1]: continue else: x.pop(i+1) return x
def stalinsort(x=[]): if x == []: return x for i in range(len(x) - 1): if x[i] < x[i + 1]: continue else: x.pop(i + 1) return x
# -*- coding: utf-8 -*- """ Time penalties for Digiroad 2.0. Created on Thu Apr 26 13:50:03 2018 @author: Henrikki Tenkanen """ penalties = { # Rush hour penalties for different road types ('rt') 'r': { 'rt12' : 12.195 / 60, 'rt3' : 11.199 / 60, 'rt456...
""" Time penalties for Digiroad 2.0. Created on Thu Apr 26 13:50:03 2018 @author: Henrikki Tenkanen """ penalties = {'r': {'rt12': 12.195 / 60, 'rt3': 11.199 / 60, 'rt456': 10.633 / 60, 'median': 2.022762}, 'm': {'rt12': 9.979 / 60, 'rt3': 6.65 / 60, 'rt456': 7.752 / 60, 'median': 1.66775}, 'avg': {'rt12': 11.311 / ...
# Author: thisHermit ASCENDING = 1 DESCENDING = 0 N = 5 def main(): input_array = [5, 4, 3, 2, 5] a = input_array.copy() # sort the array sort(a, N) # test and show assert a, sorted(input_array) show(a, N) def exchange(i, j, a, n): a[i], a[j] = a[j], a[i] def compare(i...
ascending = 1 descending = 0 n = 5 def main(): input_array = [5, 4, 3, 2, 5] a = input_array.copy() sort(a, N) assert a, sorted(input_array) show(a, N) def exchange(i, j, a, n): (a[i], a[j]) = (a[j], a[i]) def compare(i, j, dirr, a, n): if dirr == (a[i] > a[j]): exchange(i, j, a, ...
input_data = raw_input(">") upper_case_letters = [] lower_case_letter = [] for x in input_data: if str(x).isalpha() and str(x).isupper(): upper_case_letters.append(str(x)) elif str(x).isalpha() and str(x).islower(): lower_case_letter.append(str(x)) print("Upper case: " + str(len(upper_case_le...
input_data = raw_input('>') upper_case_letters = [] lower_case_letter = [] for x in input_data: if str(x).isalpha() and str(x).isupper(): upper_case_letters.append(str(x)) elif str(x).isalpha() and str(x).islower(): lower_case_letter.append(str(x)) print('Upper case: ' + str(len(upper_case_lette...
# Test for breakage in the co_lnotab decoder locals() dict def foo(): locals() """ ...
locals() dict def foo(): locals() '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n...
""" General config file for Bot Server """ token = '<YOUR-BOT-TOKEN>' telegram_base_url = 'https://api.telegram.org/bot{}/' timeout = 100 model_download_url = '<MODEL-DOWNLOAD-URL>' model_zip = 'pipeline_models.zip' model_folder = '/pipeline_models' CELERY_RESULT_BACKEND = 'redis://localhost:6379/0' CELERY_BROKER_URL ...
""" General config file for Bot Server """ token = '<YOUR-BOT-TOKEN>' telegram_base_url = 'https://api.telegram.org/bot{}/' timeout = 100 model_download_url = '<MODEL-DOWNLOAD-URL>' model_zip = 'pipeline_models.zip' model_folder = '/pipeline_models' celery_result_backend = 'redis://localhost:6379/0' celery_broker_url =...
''' While loop - it keeps looping while a given condition is valid ''' name = "Kevin" age = 24 letter_index = 0 while letter_index < len(name): print(name[letter_index]) letter_index = letter_index + 1 else: print("Finished with the while loop") ''' line 4 - we define the name with a string "Kevin" line 5 -...
""" While loop - it keeps looping while a given condition is valid """ name = 'Kevin' age = 24 letter_index = 0 while letter_index < len(name): print(name[letter_index]) letter_index = letter_index + 1 else: print('Finished with the while loop') '\nline 4 - we define the name with a string "Kevin"\nline 5 -...
# List transports = ["airplane", "car", "ferry"] modes = ["air", "ground", "water"] # Lists contain simple data (index based item) and can be edited after being assigned. # E.g. as transport types are not as limited as in this list, it can be updated by adding or removing. # Let's create a couple of functions for add...
transports = ['airplane', 'car', 'ferry'] modes = ['air', 'ground', 'water'] print('\nLIST DATA TYPE') print('--------------\n') def add_transport(): global transports global modes message = input('Do you want to ADD a new transport? [Type yes/no]: ').lower().strip() if message == 'yes': name =...
class WordDictionary: def __init__(self): self.list=set() def add_word(self, word): self.list.add(word) def search(self, s): if s in self.list: return True for i in self.list: if len(i)!=len(s): continue flag=True ...
class Worddictionary: def __init__(self): self.list = set() def add_word(self, word): self.list.add(word) def search(self, s): if s in self.list: return True for i in self.list: if len(i) != len(s): continue flag = True ...
# Coastline harmonization with a landmask def coastlineHarmonize(maskFile, ds, outmaskFile, outDEM, minimum, waterVal=0): ''' This function is designed to take a coastline mask and harmonize elevation values to it, such that no elevation values that are masked as water cells will have elevation >0, ...
def coastline_harmonize(maskFile, ds, outmaskFile, outDEM, minimum, waterVal=0): """ This function is designed to take a coastline mask and harmonize elevation values to it, such that no elevation values that are masked as water cells will have elevation >0, and no land cells will have an elevation < mi...
# This program gets a numberic test score from the # user and displays the corresponding letter grade. # Named constants to represent the grade thresholds A_SCORE = 90 B_SCORE = 80 C_SCORE = 70 D_SCORE = 60 # Get a test score from the user. score = int(input('Enter your test score: ')) # Determine th...
a_score = 90 b_score = 80 c_score = 70 d_score = 60 score = int(input('Enter your test score: ')) if score >= A_SCORE: print('Your grade is A.') elif score >= B_SCORE: print('Your grade is B.') elif score >= C_SCORE: print('Your grade is C.') elif score >= D_SCORE: print('Your grade is D.') else: pr...
{ 'target_defaults': { 'variables': { 'deps': [ 'libbrillo-<(libbase_ver)', 'libchrome-<(libbase_ver)', 'libndp', 'libshill-client', 'protobuf-lite', ], }, }, 'targets': [ { 'target_name': 'protos', 'type': 'static_library', 'variab...
{'target_defaults': {'variables': {'deps': ['libbrillo-<(libbase_ver)', 'libchrome-<(libbase_ver)', 'libndp', 'libshill-client', 'protobuf-lite']}}, 'targets': [{'target_name': 'protos', 'type': 'static_library', 'variables': {'proto_in_dir': '.', 'proto_out_dir': 'include/arc-networkd'}, 'sources': ['<(proto_in_dir)/i...
class ApplicationException(Exception): def __init__(self, java_exception): self.java_exception = java_exception def message(self): return self.java_exception.getMessage()
class Applicationexception(Exception): def __init__(self, java_exception): self.java_exception = java_exception def message(self): return self.java_exception.getMessage()
EXPECTED_TABULATED_HTML = """ <table> <thead> <tr> <th>category</th> <th>date</th> <th>downloads</th> </tr> </thead> <tbody> <tr> <td align="left">2.6</td> <td align="left">2018-08-15</td> <td align="right">51</t...
expected_tabulated_html = '\n<table>\n <thead>\n <tr>\n <th>category</th>\n <th>date</th>\n <th>downloads</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td align="left">2.6</td>\n <td align="left">2018-08-15</td>\n <td align="r...
# def t1(): # l = [] # for i in range(10000): # l = l + [i] # def t2(): # l = [] # for i in range(10000): # l.append(i) # def t3(): # l = [i for i in range(10000)] # def t4(): # l = list(range(10000)) # # from timeit import Timer # # timer1 = Timer("t1()", "from __main__ import t1") # prin...
i = [] for i in range(4): I.append({'num': i}) print(I) i = [] a = {'num': 0} for i in range(4): a['num'] = i I.append(a) print(I)
#!/usr/bin/env python3 class ProjectNameException(Exception): pass class MissingEnv(ProjectNameException): pass class CreateDirectoryException(ProjectNameException): pass class ConfigError(ProjectNameException): pass
class Projectnameexception(Exception): pass class Missingenv(ProjectNameException): pass class Createdirectoryexception(ProjectNameException): pass class Configerror(ProjectNameException): pass
# Here go your api methods. def get_prod_list(): prod_list = db(db.products).select( db.products.id, db.products.name, db.products.description, db.products.price, orderby=~db.products.price ).as_list() return response.json(dict(prod_list=prod_list)) def get_rev...
def get_prod_list(): prod_list = db(db.products).select(db.products.id, db.products.name, db.products.description, db.products.price, orderby=~db.products.price).as_list() return response.json(dict(prod_list=prod_list)) def get_rev_list(): review_list = db(db.reviews).select(db.reviews.usr, db.reviews.prod...
######## # BASE # ######## # Registration NICK = 'NICK' PASS = 'PASS' QUIT = 'QUIT' USER = 'USER' # Sent when registering a new user. # Channel ops INVITE = 'INVITE' JOIN = 'JOIN' KICK = 'KICK' LIST = 'LIST' MODE = 'MODE' NAMES = 'NAMES' PART = 'PART' TOPIC = 'TOPIC' # Server ops ADMIN = 'ADMIN' CONNECT = 'CONNECT'...
nick = 'NICK' pass = 'PASS' quit = 'QUIT' user = 'USER' invite = 'INVITE' join = 'JOIN' kick = 'KICK' list = 'LIST' mode = 'MODE' names = 'NAMES' part = 'PART' topic = 'TOPIC' admin = 'ADMIN' connect = 'CONNECT' info = 'INFO' links = 'LINKS' oper = 'OPER' rehash = 'REHASH' restart = 'RESTART' server = 'SERVER' squit = ...
# -*- coding: utf-8 -*- if __name__ == '__main__': Plant = lambda x: x + 2 FFC = lambda x: 1.1 * x + 1.9 FBC = lambda y: 0.9*y - 1.8 x = 5 x_ = x y = Plant(x) for k in range(100): ypre = FFC(x_) x_ = FFC(ypre) x_ = (x + x_) / 2 print(y, ypre)
if __name__ == '__main__': plant = lambda x: x + 2 ffc = lambda x: 1.1 * x + 1.9 fbc = lambda y: 0.9 * y - 1.8 x = 5 x_ = x y = plant(x) for k in range(100): ypre = ffc(x_) x_ = ffc(ypre) x_ = (x + x_) / 2 print(y, ypre)
""" Chaos 'probes' module. This module contains *probes* that collect state from an indy-node pool. By design, chaostoolkit runs an experiment if and only if 'steady state' is met. Steady state is composed of one or more '*probes*'. *Probes* gather and return system state data. An experiment defines a 'tolerance' (pr...
""" Chaos 'probes' module. This module contains *probes* that collect state from an indy-node pool. By design, chaostoolkit runs an experiment if and only if 'steady state' is met. Steady state is composed of one or more '*probes*'. *Probes* gather and return system state data. An experiment defines a 'tolerance' (pr...
def gcdIter(a, b): ''' a, b: positive integers returns: a positive integer, the greatest common divisor of a & b. ''' # Your code here gcd = 1 if a > b: for i in range(b, 0, -1): if a % i == 0 and b % i == 0: gcd = i break else: ...
def gcd_iter(a, b): """ a, b: positive integers returns: a positive integer, the greatest common divisor of a & b. """ gcd = 1 if a > b: for i in range(b, 0, -1): if a % i == 0 and b % i == 0: gcd = i break else: for i in range(a, ...
#English alphabet to be used in #decipher/encipher calculations. Alpha=['a','b','c','d','e','f','g', 'h','i','j','k','l','m','n', 'o','p','q','r','s','t','u', 'v','w','x','y','z'] def v_cipher(mode, text): if(mode == "encipher"): plainTxt = text cipher...
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] def v_cipher(mode, text): if mode == 'encipher': plain_txt = text cipher = '' key = input('Key:') key = key.upper() if len(key) > len(pl...
class Match: def __init__(self, first_team, second_team, first_team_score, second_team_score): self.first_team = first_team self.second_team = second_team self.first_team_score = first_team_score self.second_team_score = second_team_score self.commentary = [] def __repr_...
class Match: def __init__(self, first_team, second_team, first_team_score, second_team_score): self.first_team = first_team self.second_team = second_team self.first_team_score = first_team_score self.second_team_score = second_team_score self.commentary = [] def __repr...
def millis_interval(start, end): diff = end - start millis = diff.days * 24 * 60 * 60 * 1000 millis += diff.seconds * 1000 millis += diff.microseconds / 1000 return int(round(millis))
def millis_interval(start, end): diff = end - start millis = diff.days * 24 * 60 * 60 * 1000 millis += diff.seconds * 1000 millis += diff.microseconds / 1000 return int(round(millis))
class Node(object): """docstring for Node""" def __init__(self, value): self.value = value self.edges = [] class Edge(object): """docstring for Edge""" def __init__(self, value, node_from, node_to): self.value = value self.node_from = node_from self.node_to = no...
class Node(object): """docstring for Node""" def __init__(self, value): self.value = value self.edges = [] class Edge(object): """docstring for Edge""" def __init__(self, value, node_from, node_to): self.value = value self.node_from = node_from self.node_to = n...
''' module for calculating factorials of large numbers efficiently ''' def factorial(n: int): ''' Calculating factorial using prime decomposition ''' prime = [True] * (n + 1) result = 1 for i in range (2, n + 1): if (prime[i]): j = 2 * i while (j <= ...
""" module for calculating factorials of large numbers efficiently """ def factorial(n: int): """ Calculating factorial using prime decomposition """ prime = [True] * (n + 1) result = 1 for i in range(2, n + 1): if prime[i]: j = 2 * i while j <= n: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 6 16:29:07 2017 @author: Young """ # Placeholder
""" Created on Fri Oct 6 16:29:07 2017 @author: Young """
class Solution: def frequencySort(self, s: str) -> str: freq_dict = dict() output = "" for x in s: if x in freq_dict: freq_dict[x] += 1 else: freq_dict[x] = 1 refined_freq = sorted(freq_dict.items(), key=operator.itemg...
class Solution: def frequency_sort(self, s: str) -> str: freq_dict = dict() output = '' for x in s: if x in freq_dict: freq_dict[x] += 1 else: freq_dict[x] = 1 refined_freq = sorted(freq_dict.items(), key=operator.itemgetter(1)...
class Solution: def minMeetingRooms(self, intervals: List[List[int]]) -> int: time = [] for i in intervals: time.append((i[0], 1)) time.append((i[1], 0)) time.sort() count = maxCount = 0 for t in time: if t[1] == 1: count +=...
class Solution: def min_meeting_rooms(self, intervals: List[List[int]]) -> int: time = [] for i in intervals: time.append((i[0], 1)) time.append((i[1], 0)) time.sort() count = max_count = 0 for t in time: if t[1] == 1: coun...
class Company(object): def __init__(self, name, title, start_date): self.name = name self.title = title self.start_date = start_date def getName(self): return self.name def getTitle(self): return self.title def getStartDate(self): return self.start_dat...
class Company(object): def __init__(self, name, title, start_date): self.name = name self.title = title self.start_date = start_date def get_name(self): return self.name def get_title(self): return self.title def get_start_date(self): return self.start...
class FastSort2(): def __init__(self, elems = []): self._elems = elems def FS2(self, low, high): if low >= high: return i = low pivot = self._elems[low] for m in range(low + 1, high + 1): if self._elems[m] < pivot: i += ...
class Fastsort2: def __init__(self, elems=[]): self._elems = elems def fs2(self, low, high): if low >= high: return i = low pivot = self._elems[low] for m in range(low + 1, high + 1): if self._elems[m] < pivot: i += 1 ...
descriptor = ' {:<30} {}' message_help_required_tagname = descriptor.format('', 'required: provide a tag to scrape') message_help_required_login_username = descriptor.format('', 'required: add a login username') message_help_required_login_password = descriptor.format('', 'required: add a login password') message_help...
descriptor = ' {:<30} {}' message_help_required_tagname = descriptor.format('', 'required: provide a tag to scrape') message_help_required_login_username = descriptor.format('', 'required: add a login username') message_help_required_login_password = descriptor.format('', 'required: add a login password') message_help...
# # PySNMP MIB module Juniper-TSM-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-TSM-CONF # Produced by pysmi-0.3.4 at Mon Apr 29 19:53:51 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(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 ready_jobs_dict_to_key(ready_jobs_list_dict): ready_jobs_list_key = ( "ready_jobs" + "_cpu_credits_" + str(ready_jobs_list_dict["cpu_credits"]) + "_gpu_credits_" + str(ready_jobs_list_dict["gpu_credits"]) ) return ready_jobs_list_key
def ready_jobs_dict_to_key(ready_jobs_list_dict): ready_jobs_list_key = 'ready_jobs' + '_cpu_credits_' + str(ready_jobs_list_dict['cpu_credits']) + '_gpu_credits_' + str(ready_jobs_list_dict['gpu_credits']) return ready_jobs_list_key
{'application':{'type':'Application', 'name':'Template', 'backgrounds': [ {'type':'Background', 'name':'standaloneBuilder', 'title':u'PythonCard standaloneBuilder', 'size':(800, 610), 'statusBar':1, 'menubar': {'type':'MenuBar', 'menus': [ ...
{'application': {'type': 'Application', 'name': 'Template', 'backgrounds': [{'type': 'Background', 'name': 'standaloneBuilder', 'title': u'PythonCard standaloneBuilder', 'size': (800, 610), 'statusBar': 1, 'menubar': {'type': 'MenuBar', 'menus': [{'type': 'Menu', 'name': 'menuFile', 'label': '&File', 'items': [{'type':...
class Error(Exception): def __init__(self, typ, start_pos, end_pos, details) -> None: self.typ = typ self.details = details self.start_pos = start_pos self.end_pos = end_pos def __repr__(self) -> str: return f"{self.typ} : {self.details} ({self.start_pos.idx}, {self....
class Error(Exception): def __init__(self, typ, start_pos, end_pos, details) -> None: self.typ = typ self.details = details self.start_pos = start_pos self.end_pos = end_pos def __repr__(self) -> str: return f'{self.typ} : {self.details} ({self.start_pos.idx}, {self.end...
class PathAnalyzerStore: """ Maps extensions to analyzers. To be used for storing the analyzers that should be used for specific extensions in a directory. """ #################################################################################################################### # Constructor. ...
class Pathanalyzerstore: """ Maps extensions to analyzers. To be used for storing the analyzers that should be used for specific extensions in a directory. """ def __init__(self): self._analyzers_by_extensions = {} def add_analyzer(self, extensions, analyzer): for extension in ...
class ListNode: def __init__(self, x): self.val = x self.next = None def insert(head, x): new_node = ListNode(x) if head is None: head = new_node return last_node = head while last_node.next: last_node = last_node.next last_node.next = new_node d...
class Listnode: def __init__(self, x): self.val = x self.next = None def insert(head, x): new_node = list_node(x) if head is None: head = new_node return last_node = head while last_node.next: last_node = last_node.next last_node.next = new_node def pri...
class Client(): def __init__(self, player): #self.clientSocket pass def connect(self): pass def sending(self): pass def getting(self): pass def serverHandling(self): pass
class Client: def __init__(self, player): pass def connect(self): pass def sending(self): pass def getting(self): pass def server_handling(self): pass
""" Monthly Backups Description: This script is run weekly on Sunday at 2 AM and generates weekly backups. On Rojo we keep weekly backups going back 1 month, we keep monthly backups going back 6 months, and we put older backups into cold storage. Directory Stucture: junkinthetrunk/ backups/ ...
""" Monthly Backups Description: This script is run weekly on Sunday at 2 AM and generates weekly backups. On Rojo we keep weekly backups going back 1 month, we keep monthly backups going back 6 months, and we put older backups into cold storage. Directory Stucture: junkinthetrunk/ backups/ ...
# -*- coding: utf-8 -*- # Scrapy settings for state_scrapper project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://docs.scrapy.org/en/latest/topics/settings.html # https://docs.scrapy.org/en/lat...
bot_name = 'state_scrapper' spider_modules = ['state_scrapper.spiders'] newspider_module = 'state_scrapper.spiders' user_agent = 'state_scrapper (+http://www.mobicrol.com)' robotstxt_obey = True download_delay = 3.0 concurrent_requests_per_domain = 16 item_pipelines = {'state_scrapper.pipelines.DuplicatesPipeline': 200...
__author__ = 'Robbert Harms' __date__ = "2015-05-04" __maintainer__ = "Robbert Harms" __email__ = "robbert.harms@maastrichtuniversity.nl" class ScannerSettingsParser(object): def get_value(self, key): """Read a value for a given key for all sessions in settings file. The settings file is suppose...
__author__ = 'Robbert Harms' __date__ = '2015-05-04' __maintainer__ = 'Robbert Harms' __email__ = 'robbert.harms@maastrichtuniversity.nl' class Scannersettingsparser(object): def get_value(self, key): """Read a value for a given key for all sessions in settings file. The settings file is supposed...
n = int(input()) a = sorted(list(map(int, input().split(" ")))) while len(a) > 0: print(len(a)) a = sorted(list(filter(lambda x: x > 0, map(lambda x: x - a[0], a))))
n = int(input()) a = sorted(list(map(int, input().split(' ')))) while len(a) > 0: print(len(a)) a = sorted(list(filter(lambda x: x > 0, map(lambda x: x - a[0], a))))
config = dict( agent=dict(), algo=dict(), env=dict( game="pong", num_img_obs=1, ), model=dict(), optim=dict(), runner=dict( n_steps=5e6, # log_interval_steps=1e5, ), sampler=dict( batch_T=20, batch_B=32, max_decorrelation_steps=...
config = dict(agent=dict(), algo=dict(), env=dict(game='pong', num_img_obs=1), model=dict(), optim=dict(), runner=dict(n_steps=5000000.0), sampler=dict(batch_T=20, batch_B=32, max_decorrelation_steps=1000)) configs = dict(default=config)
class Solution: def findGoodStrings(self, n, s1, s2, evil): M = 10 ** 9 + 7 m = len(evil) memo = {} # KMP dfa = self.failure(evil) def dfs(i, x, bound): if x == m: return 0 if i == n: return 1 ...
class Solution: def find_good_strings(self, n, s1, s2, evil): m = 10 ** 9 + 7 m = len(evil) memo = {} dfa = self.failure(evil) def dfs(i, x, bound): if x == m: return 0 if i == n: return 1 if (i, x, bound) ...
""" RANGE: 3 parameters [start,stop,step] Code to print the odd integers in the specified range from 5 to -10 by assigning negative step value """ start = 5 stop = -10 step = -2 print("Odd numbers from 5 to -10 are: ") for num in range(start,stop,step): print(num) ''' OUTPUT: Odd numbers from 5 to ...
""" RANGE: 3 parameters [start,stop,step] Code to print the odd integers in the specified range from 5 to -10 by assigning negative step value """ start = 5 stop = -10 step = -2 print('Odd numbers from 5 to -10 are: ') for num in range(start, stop, step): print(num) '\nOUTPUT:\nOdd numbers from 5 to -10 are: \n5\n...
#!/usr/bin/env python xlist = [1, 3, 5, 7, 1] ylist = [1, 1, 1, 1, 2] totaltrees = 1 with open('input.txt', 'r', encoding='utf-8') as input: all_lines = input.readlines() for i in range(5): x = xlist[i] y = ylist[i] trees = 0 posx = 0 posy = 0 iterations = 1 for line in all_lines: ...
xlist = [1, 3, 5, 7, 1] ylist = [1, 1, 1, 1, 2] totaltrees = 1 with open('input.txt', 'r', encoding='utf-8') as input: all_lines = input.readlines() for i in range(5): x = xlist[i] y = ylist[i] trees = 0 posx = 0 posy = 0 iterations = 1 for line in all_lines: if y == 2 and posy %...
class PriorityQueue: def __init__(self, arr: list = [], is_min=True): self.arr = arr self.minmax = min if is_min else max self.heapify() @staticmethod def children(i): return (2 * i + 1, 2 * i + 2) @staticmethod def parent(i): return (i - 1) // 2 @stati...
class Priorityqueue: def __init__(self, arr: list=[], is_min=True): self.arr = arr self.minmax = min if is_min else max self.heapify() @staticmethod def children(i): return (2 * i + 1, 2 * i + 2) @staticmethod def parent(i): return (i - 1) // 2 @static...
# Written by Pavel Jahoda #This class is used for evaluating and processing the results of the simulations class Evaluation: #TODO, implement evaluation class def __init__(self): pass def processResults(self,n_of_blocked_calls, n_of_dropped_calls, n_of_calls, n_of_channels_reverved): p...
class Evaluation: def __init__(self): pass def process_results(self, n_of_blocked_calls, n_of_dropped_calls, n_of_calls, n_of_channels_reverved): pass def evaluate(self): pass class Generator: def __init__(self): self.dummy_return_value = 0 def generate_speed(se...
def fetching_episode(episode_name, stream_page): tag = "[ FETCHING ]" print(tag, episode_name, stream_page) def fetched_episode(episode_name, stream_url, success): tag = "[ SUCCESS ] " if success else "[ FAILED ] " print(tag, episode_name, stream_url, end="\n\n") def fetching_list(anime_url): pri...
def fetching_episode(episode_name, stream_page): tag = '[ FETCHING ]' print(tag, episode_name, stream_page) def fetched_episode(episode_name, stream_url, success): tag = '[ SUCCESS ] ' if success else '[ FAILED ] ' print(tag, episode_name, stream_url, end='\n\n') def fetching_list(anime_url): pri...
# definition class OriginalException(Exception): pass
class Originalexception(Exception): pass
menu = ['deathnote', 'netflix', 'teaching'] # for i in range(len(menu)): # print(i + 1,'. ',menu[i],sep='') for index, item in enumerate(menu): print(index + 1,'. ',item,sep='') # for item in menu: # print(item)
menu = ['deathnote', 'netflix', 'teaching'] for (index, item) in enumerate(menu): print(index + 1, '. ', item, sep='')
class landShift(): def __init__(self): self.shiftList = [] self.unwarpPts = [] def addPos(self, shift): self.shiftList.append(shift) if len(self.shiftList)>10: self.shiftList = self.shiftList[1:] def getVelocity(self): if len(self.shiftList): ...
class Landshift: def __init__(self): self.shiftList = [] self.unwarpPts = [] def add_pos(self, shift): self.shiftList.append(shift) if len(self.shiftList) > 10: self.shiftList = self.shiftList[1:] def get_velocity(self): if len(self.shiftList): ...
def swap_case(s): returnString = "" for character in s: if character.islower(): returnString += character.upper() else: returnString += character.lower() return returnString
def swap_case(s): return_string = '' for character in s: if character.islower(): return_string += character.upper() else: return_string += character.lower() return returnString
def no_teen_sum(a, b, c): def fix_teen(n): if n ==15 or n==16: return n if 13<=n<=19: return 0 else: return n sum = fix_teen(a)+ fix_teen(b)+ fix_teen(c) return sum def round_sum(a, b, c): def round10(num): if num%10<5: ...
def no_teen_sum(a, b, c): def fix_teen(n): if n == 15 or n == 16: return n if 13 <= n <= 19: return 0 else: return n sum = fix_teen(a) + fix_teen(b) + fix_teen(c) return sum def round_sum(a, b, c): def round10(num): if num % 10 < 5: ...
''' This code is written by bidongqinxian ''' def quick_sort(lst): if not lst: return [] base = lst[0] left = quick_sort([x for x in lst[1: ] if x < base]) right = quick_sort([x for x in lst[1: ] if x >= base]) return left + [base] + right
""" This code is written by bidongqinxian """ def quick_sort(lst): if not lst: return [] base = lst[0] left = quick_sort([x for x in lst[1:] if x < base]) right = quick_sort([x for x in lst[1:] if x >= base]) return left + [base] + right
K, N, F = map(int, input().split()) A = list(map(int, input().split())) t = K * N - sum(A) if t < 0: print(-1) else: print(t)
(k, n, f) = map(int, input().split()) a = list(map(int, input().split())) t = K * N - sum(A) if t < 0: print(-1) else: print(t)
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='FCOS', pretrained='open-mmlab://detectron/resnet50_caffe', backbone=dict( type='ResNet', depth=50, num_stages=4, ...
_base_ = ['../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'] model = dict(type='FCOS', pretrained='open-mmlab://detectron/resnet50_caffe', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', r...
#!/usr/bin/python print("How you doing man???")
print('How you doing man???')
""" Django settings for ribbon. For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ # Application definition INSTALLED_APPS = ('rest_framework', )
""" Django settings for ribbon. For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ installed_apps = ('rest_framework',)
# ======================== # Information # ======================== # Direct Link: https://www.hackerrank.com/challenges/write-a-function/problem # Difficulty: Medium # Max Score: 10 # Language: Python # ======================== # Solution # ======================== def is_leap(YEAR): '''Checking w...
def is_leap(YEAR): """Checking whether year is a leap year""" return YEAR % 4 == 0 and (YEAR % 400 == 0 or YEAR % 100 != 0) year = int(input()) print(is_leap(YEAR))
# Name: config.py # Description: defines configurations for the various components of audio extraction and processing class AudioConfig: # The format to store audio in AUDIO_FORMAT = 'mp3' # Prefix to save audio features to FEATURE_DESTINATION = '/features/' # Checkpoint frequency in number of tra...
class Audioconfig: audio_format = 'mp3' feature_destination = '/features/' checkpoint_frequency = 10 min_clip_length = 29 class Displayconfig: cmap = 'Greys' figsize_width = 10 figsize_height = 10 class Featureextractorconfig: supported_features = ['chroma_stft', 'rms', 'spec_cent', 's...
class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: intervals.sort(key=lambda x: x[0]) res = [] for i in range(0, len(intervals)): if not res or res[-1][1] < intervals[i][0]: res.append(intervals[i]) else: re...
class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: intervals.sort(key=lambda x: x[0]) res = [] for i in range(0, len(intervals)): if not res or res[-1][1] < intervals[i][0]: res.append(intervals[i]) else: r...
# -*- coding: utf-8 -*- # Source: https://leetcode.com/problems/search-in-rotated-sorted-array/ def search(nums, left, right, target): if left > right: return -1 mid = int((left + right) / 2) if nums[mid] == target: return mid # left --- target --- mid --- right if nums[mid] <= nu...
def search(nums, left, right, target): if left > right: return -1 mid = int((left + right) / 2) if nums[mid] == target: return mid if nums[mid] <= nums[right]: if target < nums[mid] or target > nums[right]: return search(nums, left, mid - 1, target) else: ...
'''Use an IF statement inside a FOR loop to select only positive numbers.''' def printAllPositive(numberList): '''Print only the positive numbers in numberList.''' for num in numberList: if num > 0: print(num) printAllPositive([3, -5, 2, -1, 0, 7])
"""Use an IF statement inside a FOR loop to select only positive numbers.""" def print_all_positive(numberList): """Print only the positive numbers in numberList.""" for num in numberList: if num > 0: print(num) print_all_positive([3, -5, 2, -1, 0, 7])
# The tests rely on a lot of absolute paths so this file # configures all of that music_folder = u'/home/rudi/music' o_path = u'/home/rudi/throwaway/ACDC_-_Back_In_Black-sample-64kbps.ogg' watch_path = u'/home/rudi/throwaway/watch/', real_path1 = u'/home/rudi/throwaway/watch/unknown/unknown/ACDC_-_Back_In_Black-sample...
music_folder = u'/home/rudi/music' o_path = u'/home/rudi/throwaway/ACDC_-_Back_In_Black-sample-64kbps.ogg' watch_path = (u'/home/rudi/throwaway/watch/',) real_path1 = u'/home/rudi/throwaway/watch/unknown/unknown/ACDC_-_Back_In_Black-sample-64kbps-64kbps.ogg' opath = u'/home/rudi/Airtime/python_apps/media-monitor2/tests...
# python3 def max_ammount(W, weights): values = [[0 for _ in weights + [0]] for _ in range(W + 1)] for w in range(1, W + 1): for i, wi in enumerate(weights): values[w][i + 1] = max([ values[w][i], values[w - wi][i] + wi if w - wi >= 0 else 0 ]) ...
def max_ammount(W, weights): values = [[0 for _ in weights + [0]] for _ in range(W + 1)] for w in range(1, W + 1): for (i, wi) in enumerate(weights): values[w][i + 1] = max([values[w][i], values[w - wi][i] + wi if w - wi >= 0 else 0]) return values[-1][-1] if __name__ == '__main__': ...
abcd = (1 + 2 + 3 + 4 + 5 + 6) aaaa = (8188107138941 <= 90) bbbb = (123 ** 456 & 780) cccc = (123 ** 456 & 780 | 89 / 8)
abcd = 1 + 2 + 3 + 4 + 5 + 6 aaaa = 8188107138941 <= 90 bbbb = 123 ** 456 & 780 cccc = 123 ** 456 & 780 | 89 / 8
# -*- coding: utf-8 -*- # auto raise exception def auto_raise(exception, silent): if not silent: raise exception class APIError(Exception): """ Common API Error """ class APINetworkError(APIError): """ Failed to load API request """ class APIJSONParesError(APIError): """ Failed to parse ...
def auto_raise(exception, silent): if not silent: raise exception class Apierror(Exception): """ Common API Error """ class Apinetworkerror(APIError): """ Failed to load API request """ class Apijsonpareserror(APIError): """ Failed to parse target """ class Apisigninfailederror(APIError): ...
def temperature_format(value): return round(int(value) * 0.1, 1) class OkofenDefinition: def __init__(self, name=None): self.domain = name self.__datas = {} def set(self, target, value): self.__datas[target] = value def get(self, target): if target in self.__datas: ...
def temperature_format(value): return round(int(value) * 0.1, 1) class Okofendefinition: def __init__(self, name=None): self.domain = name self.__datas = {} def set(self, target, value): self.__datas[target] = value def get(self, target): if target in self.__datas: ...
def findMin(a, n): su = 0 su = sum(a) dp = [[0 for i in range(su + 1)] for j in range(n + 1)] for i in range(n + 1): dp[i][0] = True for j in range(1, su + 1): dp[0][j] = False for i in range(1, n + 1): for j in range(1, su + 1): dp[i][j] = dp[i ...
def find_min(a, n): su = 0 su = sum(a) dp = [[0 for i in range(su + 1)] for j in range(n + 1)] for i in range(n + 1): dp[i][0] = True for j in range(1, su + 1): dp[0][j] = False for i in range(1, n + 1): for j in range(1, su + 1): dp[i][j] = dp[i - 1][j] ...
class AboutDialog: def __init__(self, builder): self._win = builder.get_object('dialog_about', target=self, include_children=True) def run(self): result = self._win.run() self._win.hide() return result
class Aboutdialog: def __init__(self, builder): self._win = builder.get_object('dialog_about', target=self, include_children=True) def run(self): result = self._win.run() self._win.hide() return result
def extractChichipephCom(item): ''' Parser for 'chichipeph.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('the former wife', 'The Former Wife of Invisible Wealthy Man', ...
def extract_chichipeph_com(item): """ Parser for 'chichipeph.com' """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None tagmap = [('the former wife', 'The Former Wife of Invisible Wealthy Man',...
""" Not sure how to scientifically prove this. In order to turn all the 1 to 0, every row need to have "the same pattern". Or it is imposible. This same pattern is means they are 1. identical 2. entirely different. For example 101 and 101, 101 and 010. 110011 and 110011. 110011 and 001100. Time: O(N), N is the number ...
""" Not sure how to scientifically prove this. In order to turn all the 1 to 0, every row need to have "the same pattern". Or it is imposible. This same pattern is means they are 1. identical 2. entirely different. For example 101 and 101, 101 and 010. 110011 and 110011. 110011 and 001100. Time: O(N), N is the number ...
# # PySNMP MIB module PDN-IFEXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-IFEXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:30:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_size_constraint, constraints_union, value_range_constraint) ...