content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# fixing the issue in food.py # this is kind of a bug, thats not what we wanted # this can be done by making the class variable an instance variable class Food: def __init__(self, name): self.name = name # instance variable (attr) self.fav_food = [] # class variable fix by making inst var ...
class Food: def __init__(self, name): self.name = name self.fav_food = [] def set_fav_food(self, food: str): self.fav_food.append(food) person_a = food('jerry') person_a.set_fav_food('rice and pancake') print(person_a.fav_food) person_b = food('Lee') person_b.set_fav_food('roated groun...
''' People module for the Derrida project. It provides basic personography, VIAF lookup, and admin functionality to edit people associated with Derrida's library. ''' default_app_config = 'derrida.people.apps.PeopleConfig'
""" People module for the Derrida project. It provides basic personography, VIAF lookup, and admin functionality to edit people associated with Derrida's library. """ default_app_config = 'derrida.people.apps.PeopleConfig'
""" =============== === Purpose === =============== Encodes the hierarchy of US political divisions. This file, together with populations.py, replaces the static data portion of state_info.py. The location names used in this file match FluView names as specified in fluview_locations.py of delphi-epidata. =========...
""" =============== === Purpose === =============== Encodes the hierarchy of US political divisions. This file, together with populations.py, replaces the static data portion of state_info.py. The location names used in this file match FluView names as specified in fluview_locations.py of delphi-epidata. =========...
def calc_size(digest_size, seed_size, num_rounds, lowmc_k, lowmc_r, lowmc_m, is_unruh): lowmc_n = lowmc_k # bytes required to store one input share input_size = (lowmc_k + 7) >> 3; # bytes required to store one output share output_size = (lowmc_n + 7) >> 3; # number of bits per view per LowMC ...
def calc_size(digest_size, seed_size, num_rounds, lowmc_k, lowmc_r, lowmc_m, is_unruh): lowmc_n = lowmc_k input_size = lowmc_k + 7 >> 3 output_size = lowmc_n + 7 >> 3 view_round_size = lowmc_m * 3 view_size = view_round_size * lowmc_r + 7 >> 3 collapsed_challenge_size = num_rounds + 3 >> 2 i...
# -*- coding: utf-8 -*- class dllink: """doubly linked node (that may also be a "head" a list) A Doubly-linked List class. This class simply contains a link of node's. By adding a "head" node (sentinel), deleting a node is extremely fast (see "Introduction to Algorithm"). This class does not keep...
class Dllink: """doubly linked node (that may also be a "head" a list) A Doubly-linked List class. This class simply contains a link of node's. By adding a "head" node (sentinel), deleting a node is extremely fast (see "Introduction to Algorithm"). This class does not keep the length information as...
"""Internal API endpoint constant library. _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1 | ...
"""Internal API endpoint constant library. _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1 | ...
def visit_rate_ate(df, test_set=False): if test_set: treatment_visit_rate = df[df.Treatment == 1].Outcome.mean() * 100 control_visit_rate = df[df.Treatment == 0].Outcome.mean() * 100 average_treatment_effect = treatment_visit_rate - control_visit_rate print("Test set visit rate uplif...
def visit_rate_ate(df, test_set=False): if test_set: treatment_visit_rate = df[df.Treatment == 1].Outcome.mean() * 100 control_visit_rate = df[df.Treatment == 0].Outcome.mean() * 100 average_treatment_effect = treatment_visit_rate - control_visit_rate print('Test set visit rate uplif...
__all__ = [ 'provider', 'songObj', 'spotifyClient', 'utils' ] #! You should be able to do all you want with just theese three lines #! from spotdl.search.spotifyClient import initialize #! from spotdl.search.songObj import songObj #! from spotdl.search.utils import *
__all__ = ['provider', 'songObj', 'spotifyClient', 'utils']
class Registry: def __init__(self, name): self._name = name self._registry_dict = dict() def register(self, name=None, obj=None): if obj is not None: if name is None: name = obj.__name__ return self._register(obj, name) return self._decora...
class Registry: def __init__(self, name): self._name = name self._registry_dict = dict() def register(self, name=None, obj=None): if obj is not None: if name is None: name = obj.__name__ return self._register(obj, name) return self._decor...
#!/usr/bin/env python3 """RZFeeser | Alta3 Research learning about for logic""" # create list of dictionaries for farms farms = [{"name": "NE Farm", "agriculture": ["sheep", "cows", "pigs", "chickens", "llamas", "cats"]}, {"name": "W Farm", "agriculture": ["pigs", "chickens", "llamas"]}, {"name": ...
"""RZFeeser | Alta3 Research learning about for logic""" farms = [{'name': 'NE Farm', 'agriculture': ['sheep', 'cows', 'pigs', 'chickens', 'llamas', 'cats']}, {'name': 'W Farm', 'agriculture': ['pigs', 'chickens', 'llamas']}, {'name': 'SE Farm', 'agriculture': ['chickens', 'carrots', 'celery']}] for farm in farms: ...
def findRoot(x, power, epsilon): """Assumes x and epsilon an int or float, power an int, epsilon > 0 & power >= 1 Returns float y such that y**power is within epsilon of x. If such float does not exist, it returns None""" if x < 0 and power%2 ==0: return None #since negative numbers have no ...
def find_root(x, power, epsilon): """Assumes x and epsilon an int or float, power an int, epsilon > 0 & power >= 1 Returns float y such that y**power is within epsilon of x. If such float does not exist, it returns None""" if x < 0 and power % 2 == 0: return None low = min(-1.0, x) h...
def dobro(n): return n * 2 def metade(n): return n / 2 def aumentar(n): return n + (10 / 100 * n) def diminuir(n): return n - (13 / 100 * n)
def dobro(n): return n * 2 def metade(n): return n / 2 def aumentar(n): return n + 10 / 100 * n def diminuir(n): return n - 13 / 100 * n
g = [ (['p'],[('cat','wff')]), (['q'],[('cat','wff')]), (['r'],[('cat','wff')]), (['s'],[('cat','wff')]), (['t'],[('cat','wff')]), (['not'],[('sel','wff'),('cat','wff')]), (['and'],[('sel','wff'),('sel','wff'),('cat','wff')]), (['or'],[('sel','wff'),('sel'...
g = [(['p'], [('cat', 'wff')]), (['q'], [('cat', 'wff')]), (['r'], [('cat', 'wff')]), (['s'], [('cat', 'wff')]), (['t'], [('cat', 'wff')]), (['not'], [('sel', 'wff'), ('cat', 'wff')]), (['and'], [('sel', 'wff'), ('sel', 'wff'), ('cat', 'wff')]), (['or'], [('sel', 'wff'), ('sel', 'wff'), ('cat', 'wff')]), (['implies'], ...
def f(n, c=1): print(c) if c == n: return c f(n, c+1) f(12)
def f(n, c=1): print(c) if c == n: return c f(n, c + 1) f(12)
MD_HEADER = """\ # Changelog """ MD_ENTRY = """\ ## {version} [PR #{pr_number}]({pr_url}): {summary} (thanks [{committer}]({committer_url})) """ RST_HEADER = """\ Changelog ========= """ RST_ENTRY = """\ {version} ------------------------------------------------- `PR #{pr_number} <{pr_url}>`__: {summary} (thanks `{c...
md_header = '# Changelog\n' md_entry = '## {version}\n[PR #{pr_number}]({pr_url}): {summary} (thanks [{committer}]({committer_url}))\n' rst_header = 'Changelog\n=========\n' rst_entry = '{version}\n-------------------------------------------------\n`PR #{pr_number} <{pr_url}>`__: {summary} (thanks `{committer} <{commit...
nop = b'\x00\x00' brk = b'\x00\xA0' lde = b'\x63\x07' # Load 0x07 (character 'a') into register V3 skp = b'\xE3\xA1' # Skip next instruction if user is NOT pressing character held in V3 with open("sknpvxtest.bin", 'wb') as f: f.write(lde) # 0x0200 <-- Load the byte 0x07 into register V3 f.write(brk) # 0x02...
nop = b'\x00\x00' brk = b'\x00\xa0' lde = b'c\x07' skp = b'\xe3\xa1' with open('sknpvxtest.bin', 'wb') as f: f.write(lde) f.write(brk) f.write(skp) f.write(brk) f.write(nop) f.write(nop) f.write(brk) f.write(skp) f.write(brk) f.write(brk) f.write(brk) f.write(brk)
load("@bazel_skylib//rules:run_binary.bzl", "run_binary") load("@rules_cc//cc:defs.bzl", "cc_library") def rust_cxx_bridge(name, src, deps = []): native.alias( name = "%s/header" % name, actual = src + ".h", ) native.alias( name = "%s/source" % name, actual = src + ".cc", ...
load('@bazel_skylib//rules:run_binary.bzl', 'run_binary') load('@rules_cc//cc:defs.bzl', 'cc_library') def rust_cxx_bridge(name, src, deps=[]): native.alias(name='%s/header' % name, actual=src + '.h') native.alias(name='%s/source' % name, actual=src + '.cc') run_binary(name='%s/generated' % name, srcs=[src...
# Miho Damage Skin success = sm.addDamageSkin(2436044) if success: sm.chat("The Miho Damage Skin has been added to your account's damage skin collection.") sm.consumeItem(2436044)
success = sm.addDamageSkin(2436044) if success: sm.chat("The Miho Damage Skin has been added to your account's damage skin collection.") sm.consumeItem(2436044)
#!/usr/bin/python3 def lie_bracket(f, g, q): """Take the Lie bracket of two vector fields. [f, g] = (d/dq)f * g - (d/dq)g * f Args: f (sympy.matrix): an N x 1 symbolic vector g (sympy.matrix): an N x 1 symbolic q (sympy.matrix or List): a length N array like object of coordinates...
def lie_bracket(f, g, q): """Take the Lie bracket of two vector fields. [f, g] = (d/dq)f * g - (d/dq)g * f Args: f (sympy.matrix): an N x 1 symbolic vector g (sympy.matrix): an N x 1 symbolic q (sympy.matrix or List): a length N array like object of coordinates to take partial deri...
""" 873. Length of Longest Fibonacci Subsequence A sequence X_1, X_2, ..., X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array A of positive integers forming a sequence, find the length of the longest fibonacci-like subsequence of A. If one does not exist, retu...
""" 873. Length of Longest Fibonacci Subsequence A sequence X_1, X_2, ..., X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array A of positive integers forming a sequence, find the length of the longest fibonacci-like subsequence of A. If one does not exist, retu...
DOCKER_IMAGES = { "cpu": { "tensorflow": "ritazh/azk8sml-tensorflow:latest", }, "gpu": { "tensorflow": "ritazh/azk8sml-tensorflow:latest-gpu", } } DEFAULT_DOCKER_IMAGE = "ritazh/azk8sml-tensorflow:latest" DEFAULT_ARCH = "cpu"
docker_images = {'cpu': {'tensorflow': 'ritazh/azk8sml-tensorflow:latest'}, 'gpu': {'tensorflow': 'ritazh/azk8sml-tensorflow:latest-gpu'}} default_docker_image = 'ritazh/azk8sml-tensorflow:latest' default_arch = 'cpu'
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
Test.Summary = '\nTest remap_stats plugin\n' Test.SkipUnless(Condition.PluginExists('remap_stats.so')) Test.SkipIf(Condition.true('Test cannot deterministically wait until the stats appear')) server = Test.MakeOriginServer('server') request_header = {'headers': 'GET /argh HTTP/1.1\r\nHost: one\r\n\r\n', 'timestamp': '1...
# This file has automatically been generated # biogeme 2.6a [Mon May 14 17:32:05 EDT 2018] # <a href='http://people.epfl.ch/michel.bierlaire'>Michel Bierlaire</a>, <a href='http://transp-or.epfl.ch'>Transport and Mobility Laboratory</a>, <a href='http://www.epfl.ch'>Ecole Polytechnique F&eacute;d&eacute;rale de Lausann...
asc_car = beta('ASC_CAR', -1.64275, -10, 10, 0, 'Car cte.') b_cost = beta('B_COST', -0.180929, -10, 10, 0, 'Travel cost') b_time = beta('B_TIME', -0.0232704, -10, 10, 0, 'Travel time') b_relib = beta('B_RELIB', 0.0860714, -10, 10, 0, 'Travel reliability') asc_carrental = beta('ASC_CARRENTAL', -3.43973, -10, 10, 0, 'Car...
def longest_palindromic_substring_DP(s): S = [[False for i in range(len(s))] for j in range(len(s))] max_palindrome = "" for i in range(len(s))[::-1]: for j in range(i, len(s)): S[i][j] = s[i] == s[j] and (j - i < 3 or S[i+1][j-1]) if S[i][j] and j - i + 1 > len(max_palind...
def longest_palindromic_substring_dp(s): s = [[False for i in range(len(s))] for j in range(len(s))] max_palindrome = '' for i in range(len(s))[::-1]: for j in range(i, len(s)): S[i][j] = s[i] == s[j] and (j - i < 3 or S[i + 1][j - 1]) if S[i][j] and j - i + 1 > len(max_palin...
class Solution: def nthUglyNumber(self, n): ugly = [1] i2 = i3 = i5 = 0 while len(ugly) < n: while ugly[i2] * 2 <= ugly[-1]: i2 += 1 while ugly[i3] * 3 <= ugly[-1]: i3 += 1 while ugly[i5] * 5 <= ugly[-1]: i5 += 1 ugly.append(min(ugly[i2] * 2, u...
class Solution: def nth_ugly_number(self, n): ugly = [1] i2 = i3 = i5 = 0 while len(ugly) < n: while ugly[i2] * 2 <= ugly[-1]: i2 += 1 while ugly[i3] * 3 <= ugly[-1]: i3 += 1 while ugly[i5] * 5 <= ugly[-1]: ...
def dividableNumberGenerator(limit, number): dividableNumbers = [] for i in range(0, limit, number): dividableNumbers.append(i) return dividableNumbers def sumDividableNumbers(dividableNumbers): sum = 0 for i in range(0, len(dividableNumbers)): sum += dividableNumbers[i] return sum print(sumDivida...
def dividable_number_generator(limit, number): dividable_numbers = [] for i in range(0, limit, number): dividableNumbers.append(i) return dividableNumbers def sum_dividable_numbers(dividableNumbers): sum = 0 for i in range(0, len(dividableNumbers)): sum += dividableNumbers[i] re...
( ((1,), (), ()), ((2,), (), ()), ((1, 2), (), ()), ((), (0,), ()), ((), (0,), (0,)), ((), (), ()), ((), (), ()), ((), (), ()), ((), (), ()), ((), (0,), (0,)), )
(((1,), (), ()), ((2,), (), ()), ((1, 2), (), ()), ((), (0,), ()), ((), (0,), (0,)), ((), (), ()), ((), (), ()), ((), (), ()), ((), (), ()), ((), (0,), (0,)))
# -*- coding: utf-8 -*- """ Created on Mon Mar 16 19:43:28 2020 @author: Ravi """ def minimumDistance(arr,n): a = set(arr) if len(a) == len(arr): return -1 li = {} for i in range(n): for j in range(n): if arr[i]==arr[j]: if i!=j: ...
""" Created on Mon Mar 16 19:43:28 2020 @author: Ravi """ def minimum_distance(arr, n): a = set(arr) if len(a) == len(arr): return -1 li = {} for i in range(n): for j in range(n): if arr[i] == arr[j]: if i != j: if arr[j] not in li: ...
class Solution: def __init__(self, w: List[int]): self.total = sum(w) for i in range(1, len(w)): w[i] += w[i-1] self.w = w def pickIndex(self) -> int: ans = 0 stop = randrange(self.total) l,r = 0, len(self.w)-1 ...
class Solution: def __init__(self, w: List[int]): self.total = sum(w) for i in range(1, len(w)): w[i] += w[i - 1] self.w = w def pick_index(self) -> int: ans = 0 stop = randrange(self.total) (l, r) = (0, len(self.w) - 1) while l <= r: ...
select_atom ={ 1: "H", 3: "Li", 6: "C", 7: "N", 8: "O", 9: "F", } select_weight ={ 1: 1.00794, 6: 12, 7: 15, 8: 16, 9: 18.998403, }
select_atom = {1: 'H', 3: 'Li', 6: 'C', 7: 'N', 8: 'O', 9: 'F'} select_weight = {1: 1.00794, 6: 12, 7: 15, 8: 16, 9: 18.998403}
config = dict({ "LunarLander-v2": { "DQN": { "eff_batch_size" : 128, "eps_decay" : 0.99, "gamma" : 0.99, "tau" : 0.005, "lr" : 0.0005 }, "EnsembleDQN": { "eff_batch_size" : 64, "eps_decay" : 0.99, "gamma" : 0.99, "tau" : 0.005, "lr" : 0...
config = dict({'LunarLander-v2': {'DQN': {'eff_batch_size': 128, 'eps_decay': 0.99, 'gamma': 0.99, 'tau': 0.005, 'lr': 0.0005}, 'EnsembleDQN': {'eff_batch_size': 64, 'eps_decay': 0.99, 'gamma': 0.99, 'tau': 0.005, 'lr': 0.0005}, 'BootstrapDQN': {'eff_batch_size': 64, 'eps_decay': 0.99, 'gamma': 0.99, 'tau': 0.005, 'lr'...
season = str(input()) gender = str(input()) people = int(input()) time = int(input()) winter = False spring = False summer = False girls = False boys = False mixed = False tax = 0 sport = str() total_price = 0 discount = 0 if season == "Winter": winter = True elif season == "Spring": spring = True elif season...
season = str(input()) gender = str(input()) people = int(input()) time = int(input()) winter = False spring = False summer = False girls = False boys = False mixed = False tax = 0 sport = str() total_price = 0 discount = 0 if season == 'Winter': winter = True elif season == 'Spring': spring = True elif season =...
work_hours = [('Abby',100),('Billy',400),('Cassie',800)] def employee_check(work_hours): current_max = 0 # Set some empty value before the loop employee_of_month = '' for employee,hours in work_hours: if hours > current_max: current_max = hours employee_of_month...
work_hours = [('Abby', 100), ('Billy', 400), ('Cassie', 800)] def employee_check(work_hours): current_max = 0 employee_of_month = '' for (employee, hours) in work_hours: if hours > current_max: current_max = hours employee_of_month = employee else: pass ...
def row_sum_odd_numbers(n): row_first_odd = int(0.5*(n-1)*n) odd_list = range(1, (row_first_odd+n)*2, 2) odd_row = odd_list[row_first_odd:] return sum(odd_row) # Example: # 1 # 3 5 # 7 9 11 # 13 15 17 19 # 21 23 25 27 29 # row_sum_odd_num...
def row_sum_odd_numbers(n): row_first_odd = int(0.5 * (n - 1) * n) odd_list = range(1, (row_first_odd + n) * 2, 2) odd_row = odd_list[row_first_odd:] return sum(odd_row)
""" Tuples. Immutable lists i.e. contents cannot be changed. These are ordered so indexes and duplicates are allowed. tuples vs lists fixed length vs variable length tuples () lists [] tuples - immutable tuples - mutable """ my_tuple = () print(f"Type is : {type(my_tuple)}") # Single element in a tuple needs a trick;...
""" Tuples. Immutable lists i.e. contents cannot be changed. These are ordered so indexes and duplicates are allowed. tuples vs lists fixed length vs variable length tuples () lists [] tuples - immutable tuples - mutable """ my_tuple = () print(f'Type is : {type(my_tuple)}') my_tuple = 9 print(f'Contents: {my_tuple}'...
# -*- coding: utf-8 -*- # Scrapy settings for Downloader project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'CNSpider' SPIDER_MODULES = ['CNSpider.spiders']...
bot_name = 'CNSpider' spider_modules = ['CNSpider.spiders'] newspider_module = 'CNSpider.spiders' randomize_download_delay = True cookies_enabled = False retry_enabled = False downloader_middlewares = {'scrapy.contrib.downloadermiddleware.useragent.UserAgentMiddleware': None, 'CNSpider.rotate_useragent.RotateUserAgentM...
# # Copyright (c) 2019 MagicStack Inc. # All rights reserved. # # See LICENSE for details. ## GET_USER = """ SELECT User { id, name, image, latest_reviews := ( WITH UserReviews := User.<author[IS Review] SELECT UserReviews { id, ...
get_user = '\n SELECT User {\n id,\n name,\n image,\n latest_reviews := (\n WITH UserReviews := User.<author[IS Review]\n SELECT UserReviews {\n id,\n body,\n rating,\n movie: {\n id,\n ...
sequence = [1] n = 0 while n < 40: sequence.append(sequence[n] + sequence[n-1]) n += 1 print('The Fibonacci sequence, up to the 30th term, is \n' + str(sequence) + '.') pisano = input("Please pick a number. ") psequence = [] for item in sequence: psequence.append(item % pisano) print(psequence) # for ...
sequence = [1] n = 0 while n < 40: sequence.append(sequence[n] + sequence[n - 1]) n += 1 print('The Fibonacci sequence, up to the 30th term, is \n' + str(sequence) + '.') pisano = input('Please pick a number. ') psequence = [] for item in sequence: psequence.append(item % pisano) print(psequence)
class OperationHolderMixin: def __and__(self, other): return OperandHolder(AND, self, other) def __or__(self, other): return OperandHolder(OR, self, other) def __rand__(self, other): return OperandHolder(AND, other, self) def __ror__(self, other): return OperandHolder(...
class Operationholdermixin: def __and__(self, other): return operand_holder(AND, self, other) def __or__(self, other): return operand_holder(OR, self, other) def __rand__(self, other): return operand_holder(AND, other, self) def __ror__(self, other): return operand_ho...
class InvalidBackend(Exception): pass class NodeDoesNotExist(Exception): pass class PersistenceError(Exception): pass
class Invalidbackend(Exception): pass class Nodedoesnotexist(Exception): pass class Persistenceerror(Exception): pass
# -*- coding: utf-8 -*- class WebsocketError: CodeInvalidSession = 9001 CodeConnCloseErr = 9005 class AuthenticationFailedError(RuntimeError): def __init__(self, msg): self.msgs = msg def __str__(self): return self.msgs class NotFoundError(RuntimeError): def __init__(self, msg...
class Websocketerror: code_invalid_session = 9001 code_conn_close_err = 9005 class Authenticationfailederror(RuntimeError): def __init__(self, msg): self.msgs = msg def __str__(self): return self.msgs class Notfounderror(RuntimeError): def __init__(self, msg): self.msgs ...
# Problem: https://www.hackerrank.com/challenges/repeated-string/problem # Score: 20 def repeated_string(s, n): return n // len(s) * s.count('a') + s[0: n % len(s)].count('a') s = input() n = int(input()) print(repeated_string(s, n))
def repeated_string(s, n): return n // len(s) * s.count('a') + s[0:n % len(s)].count('a') s = input() n = int(input()) print(repeated_string(s, n))
num1 = int(input()) num2 = int(input()) if num1>=num2: print(num1) else: print(num2)
num1 = int(input()) num2 = int(input()) if num1 >= num2: print(num1) else: print(num2)
class EnergyAnalysisSurface(Element, IDisposable): """ Analytical surface. The collection of analytic openings belonging to this analytical parent surface """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def GetAdjacentAnalyticalSpace(self): "...
class Energyanalysissurface(Element, IDisposable): """ Analytical surface. The collection of analytic openings belonging to this analytical parent surface """ def dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def get_adjacent_analytical_space(self): """ GetA...
__doc__ = """An object oriented solution to the problem.""" class Person: def __init__(self, name): self.name = name def __repr__(self): return self.name def __str__(self): return self.name class FamilyMember(Person): def __init__(self, name): self.name = name def...
__doc__ = 'An object oriented solution to the problem.' class Person: def __init__(self, name): self.name = name def __repr__(self): return self.name def __str__(self): return self.name class Familymember(Person): def __init__(self, name): self.name = name def is_a...
# -- Project information ----------------------------------------------------- project = 'LUNA' copyright = '2020 Great Scott Gadgets' author = 'Katherine J. Temkin' # -- General configuration --------------------------------------------------- master_doc = 'index' extensions = [ 'sphinx.ext.autodoc', 'sph...
project = 'LUNA' copyright = '2020 Great Scott Gadgets' author = 'Katherine J. Temkin' master_doc = 'index' extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon'] templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] ht...
def sample_single_dim(action_space_list_each, is_act_continuous): each = [] if is_act_continuous: each = action_space_list_each.sample() else: if action_space_list_each.__class__.__name__ == "Discrete": each = [0] * action_space_list_each.n idx = action_space_list_ea...
def sample_single_dim(action_space_list_each, is_act_continuous): each = [] if is_act_continuous: each = action_space_list_each.sample() elif action_space_list_each.__class__.__name__ == 'Discrete': each = [0] * action_space_list_each.n idx = action_space_list_each.sample() e...
class Solution(object): def match_note_to_magazine(self, ransom_note, magazine): if ransom_note is None or magazine is None: raise TypeError('ransom_note or magazine cannot be None') seen_chars = {} for char in magazine: if char in seen_chars: seen_ch...
class Solution(object): def match_note_to_magazine(self, ransom_note, magazine): if ransom_note is None or magazine is None: raise type_error('ransom_note or magazine cannot be None') seen_chars = {} for char in magazine: if char in seen_chars: seen_c...
def on_message_deleted(msg, server): return "Deleted: {}".format(msg["previous_message"]["text"]) def on_message_changed(msg, server): text = msg.get("message", {"text": ""}).get("text", "") if text.startswith("!echo"): return "Changed: {}".format(text) def on_message(msg, server): if msg["tex...
def on_message_deleted(msg, server): return 'Deleted: {}'.format(msg['previous_message']['text']) def on_message_changed(msg, server): text = msg.get('message', {'text': ''}).get('text', '') if text.startswith('!echo'): return 'Changed: {}'.format(text) def on_message(msg, server): if msg['tex...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/hunter/github_projects/ROS/catkin_ws/src/my_package/msg/Num.msg" services_str = "/home/hunter/github_projects/ROS/catkin_ws/src/my_package/srv/AddTwoInts.srv" pkg_name = "my_package" dependencies_str = "std_msgs" langs = "gencpp;geneus;genlisp;g...
messages_str = '/home/hunter/github_projects/ROS/catkin_ws/src/my_package/msg/Num.msg' services_str = '/home/hunter/github_projects/ROS/catkin_ws/src/my_package/srv/AddTwoInts.srv' pkg_name = 'my_package' dependencies_str = 'std_msgs' langs = 'gencpp;geneus;genlisp;gennodejs;genpy' dep_include_paths_str = 'my_package;/...
class FunctionDifferentialRegistry(dict): def __setitem__(self, k, v): if not callable(k): raise ValueError("key must be callable") if not callable(v): raise ValueError("value must be callable") super().__setitem__(k, v) global_registry = FunctionDifferentialRegis...
class Functiondifferentialregistry(dict): def __setitem__(self, k, v): if not callable(k): raise value_error('key must be callable') if not callable(v): raise value_error('value must be callable') super().__setitem__(k, v) global_registry = function_differential_regi...
""" The dependencies for running the gen_rust_project binary. """ load("//util/import/raze:crates.bzl", "rules_rust_util_import_fetch_remote_crates") def import_deps(): rules_rust_util_import_fetch_remote_crates() # For legacy support gen_rust_project_dependencies = import_deps
""" The dependencies for running the gen_rust_project binary. """ load('//util/import/raze:crates.bzl', 'rules_rust_util_import_fetch_remote_crates') def import_deps(): rules_rust_util_import_fetch_remote_crates() gen_rust_project_dependencies = import_deps
def timeconverter(days): years = days // 365 days = days % 365 months = days // 30 days = days % 30 print(f"{years} years, {months} months and {days} days") days = input("Enter number of days: ") days = int(days) timeconverter(days)
def timeconverter(days): years = days // 365 days = days % 365 months = days // 30 days = days % 30 print(f'{years} years, {months} months and {days} days') days = input('Enter number of days: ') days = int(days) timeconverter(days)
print("hello world") print("my name is mark zed bruyg") print("555") karachi_city = ["gulshan", "johar", "malir", "defence", "liyari"] print(karachi_city[2]) names_of_student = ["maaz", "musab", "usman", "shuraim", "sudais", "ausaf"] print(names_of_student) age = 12 amount_to_increment = 3 a...
print('hello world') print('my name is mark zed bruyg') print('555') karachi_city = ['gulshan', 'johar', 'malir', 'defence', 'liyari'] print(karachi_city[2]) names_of_student = ['maaz', 'musab', 'usman', 'shuraim', 'sudais', 'ausaf'] print(names_of_student) age = 12 amount_to_increment = 3 age += amount_to_increment pr...
# (raw name, table column) COLS=[ ('cxid', 'cxid'), ('dts', 'dts'), ('Existing Meter Number', 'old_meter_number'), ('Existing Meter Reading', 'old_meter_reading'), ('New Meter Number', 'new_meter_number'), ('New Meter Reading', 'new_meter_reading'), ('Geo Tag', 'geo_tag'), ('GPS', 'gps'...
cols = [('cxid', 'cxid'), ('dts', 'dts'), ('Existing Meter Number', 'old_meter_number'), ('Existing Meter Reading', 'old_meter_reading'), ('New Meter Number', 'new_meter_number'), ('New Meter Reading', 'new_meter_reading'), ('Geo Tag', 'geo_tag'), ('GPS', 'gps'), ('SRV Man Initials', 'initials'), ('Meter Site Insp.', '...
class Solution: def simplifyPath(self, path: str) -> str: stk = [] for p in path.split('/'): if p == '..': if stk: stk.pop() elif p and p != '.': stk.append(p) return '/' + '/'.join(stk)
class Solution: def simplify_path(self, path: str) -> str: stk = [] for p in path.split('/'): if p == '..': if stk: stk.pop() elif p and p != '.': stk.append(p) return '/' + '/'.join(stk)
class Fraction(object): def __init__(self, num, den): self.__num = num self.__den = den self.reduce() def __str__(self): return "%d/%d" % (self.__num, self.__den) def __invert__(self): return Fraction(self.__den,self.__num) def __neg__(self): return Fr...
class Fraction(object): def __init__(self, num, den): self.__num = num self.__den = den self.reduce() def __str__(self): return '%d/%d' % (self.__num, self.__den) def __invert__(self): return fraction(self.__den, self.__num) def __neg__(self): return f...
"""Configuration file for common models/experiments""" MAIN_PARAMS = { 'sent140': { 'small': (10, 2, 2), 'medium': (16, 2, 2), 'large': (24, 2, 2) }, 'femnist': { 'small': (30, 10, 2), 'medium': (100, 10, 2), 'large': (400, 20, 2) }, 'uni-fem...
"""Configuration file for common models/experiments""" main_params = {'sent140': {'small': (10, 2, 2), 'medium': (16, 2, 2), 'large': (24, 2, 2)}, 'femnist': {'small': (30, 10, 2), 'medium': (100, 10, 2), 'large': (400, 20, 2)}, 'uni-femnist': {'small': (30, 10, 2), 'medium': (100, 10, 2), 'large': (400, 20, 2)}, 'shak...
# filter1.py to get even numbers from a list def is_dublicate(item): return not(item in mylist) mylist = ["Orange","Apple", "Banana", "Peach", "Banana"] new_list = list(filter(is_dublicate, mylist)) print(new_list)
def is_dublicate(item): return not item in mylist mylist = ['Orange', 'Apple', 'Banana', 'Peach', 'Banana'] new_list = list(filter(is_dublicate, mylist)) print(new_list)
class strongly_connected_component(): def __init__(self, graph=None, visited=None): self.graph = dict() self.visited = dict() self.stack=list() def add_vertex(self, v, graph, visited): if not graph.get(v): graph[v] = [] visited[v]=0 def add_edge(self, v1, v2, e, gra...
class Strongly_Connected_Component: def __init__(self, graph=None, visited=None): self.graph = dict() self.visited = dict() self.stack = list() def add_vertex(self, v, graph, visited): if not graph.get(v): graph[v] = [] visited[v] = 0 def add_edge(s...
AVAILABLE_LANGUAGES = { "english": "en", "indonesian": "id", "czech": "cs", "german": "de", "spanish": "es-419", "french": "fr", "italian": "it", "latvian": "lv", "lithuanian": "lt", "hungarian": "hu", "dutch": "nl", "norwegian": "no", "polish": "pl", "portuguese ...
available_languages = {'english': 'en', 'indonesian': 'id', 'czech': 'cs', 'german': 'de', 'spanish': 'es-419', 'french': 'fr', 'italian': 'it', 'latvian': 'lv', 'lithuanian': 'lt', 'hungarian': 'hu', 'dutch': 'nl', 'norwegian': 'no', 'polish': 'pl', 'portuguese brasil': 'pt-419', 'portuguese portugal': 'pt-150', 'roma...
sala = [] def AdicionarSala(cod_sala,lotacao): aux = [cod_sala,lotacao] sala.append(aux) print (" === Sala adicionada === ") def StatusOcupada(cod_sala): for s in sala: if (s[0] == cod_sala): s[1] = "Ocupada" return s return None def StatusLivre(cod_sala): for s...
sala = [] def adicionar_sala(cod_sala, lotacao): aux = [cod_sala, lotacao] sala.append(aux) print(' === Sala adicionada === ') def status_ocupada(cod_sala): for s in sala: if s[0] == cod_sala: s[1] = 'Ocupada' return s return None def status_livre(cod_sala): for s ...
""" All wgpu structs. """ # THIS CODE IS AUTOGENERATED - DO NOT EDIT # %% Structs (45) RequestAdapterOptions = {"power_preference": "GPUPowerPreference"} DeviceDescriptor = { "label": "str", "extensions": "GPUExtensionName-list", "limits": "GPULimits", } Limits = { "max_bind_groups": "GPUSize32", ...
""" All wgpu structs. """ request_adapter_options = {'power_preference': 'GPUPowerPreference'} device_descriptor = {'label': 'str', 'extensions': 'GPUExtensionName-list', 'limits': 'GPULimits'} limits = {'max_bind_groups': 'GPUSize32', 'max_dynamic_uniform_buffers_per_pipeline_layout': 'GPUSize32', 'max_dynamic_storage...
class InvalidStateTransition(Exception): pass class State(object): def __init__(self, initial=False, **kwargs): self.initial = initial def __eq__(self, other): if isinstance(other, basestring): return self.name == other elif isinstance(other, State): retur...
class Invalidstatetransition(Exception): pass class State(object): def __init__(self, initial=False, **kwargs): self.initial = initial def __eq__(self, other): if isinstance(other, basestring): return self.name == other elif isinstance(other, State): return...
__author__ = 'Aleksander Chrabaszcz' __all__ = ['config', 'parser', 'pyslate'] __version__ = '1.1'
__author__ = 'Aleksander Chrabaszcz' __all__ = ['config', 'parser', 'pyslate'] __version__ = '1.1'
""" Class to handle landmarkpoints template pt {"y":392,"x":311,"point":0,"state":"visible"} """ class l_point(object): def __init__(self, **kwargs): self.__x__ = kwargs['x'] self.__y__ = kwargs['y'] ''' self.__indx__ = kwargs['point'] if kwargs['state'] in 'visible': ...
""" Class to handle landmarkpoints template pt {"y":392,"x":311,"point":0,"state":"visible"} """ class L_Point(object): def __init__(self, **kwargs): self.__x__ = kwargs['x'] self.__y__ = kwargs['y'] "\n self.__indx__ = kwargs['point']\n if kwargs['state'] in 'visible':\n ...
H, W = map(int, input().split()) for _ in range(H): C = input() print(C) print(C)
(h, w) = map(int, input().split()) for _ in range(H): c = input() print(C) print(C)
class ResponseStatus: """Possible values for attendee's response status * NEEDS_ACTION - The attendee has not responded to the invitation. * DECLINED - The attendee has declined the invitation. * TENTATIVE - The attendee has tentatively accepted the invitation. * ACCEPTED - The attendee has accepte...
class Responsestatus: """Possible values for attendee's response status * NEEDS_ACTION - The attendee has not responded to the invitation. * DECLINED - The attendee has declined the invitation. * TENTATIVE - The attendee has tentatively accepted the invitation. * ACCEPTED - The attendee has accepte...
public_key = 28 # Store the discovered factors in this list factors = [] # Begin testing at 2 test_number = 2 # Loop through all numbers from 2 up until the public_key number while test_number < public_key: # If the public key divides exactly into the test_number, it is a factor if public_key % test_number...
public_key = 28 factors = [] test_number = 2 while test_number < public_key: if public_key % test_number == 0: factors.append(test_number) test_number += 1 print(factors)
# Display default_screen_width = 940 default_screen_height = 600 screen_width = default_screen_width screen_height = default_screen_height is_native = False max_tps = 16 board_width = 13 board_height = 9 theme = "neon" # neon/paper/football # Sound sound_volume = 0.1 sound_muted = False
default_screen_width = 940 default_screen_height = 600 screen_width = default_screen_width screen_height = default_screen_height is_native = False max_tps = 16 board_width = 13 board_height = 9 theme = 'neon' sound_volume = 0.1 sound_muted = False
# -*- coding: utf-8 -*- """ Functions for navigating trees represented as embedded dictionaries. """ __author__ = "Julian Jara-Ettinger" __license__ = "MIT" def BuildKeyList(Dictionary): """ WARNING: This function is for internal use. Return a list of lists where each inner list is chain of valid keys w...
""" Functions for navigating trees represented as embedded dictionaries. """ __author__ = 'Julian Jara-Ettinger' __license__ = 'MIT' def build_key_list(Dictionary): """ WARNING: This function is for internal use. Return a list of lists where each inner list is chain of valid keys which when input access th...
fib = [1, 1] for i in range(2, 11): fib.append(fib[i - 1] + fib[i - 2]) def c2f(c): n = ord(c) b = '' for i in range(10, -1, -1): if n >= fib[i]: n -= fib[i] b += '1' else: b += '0' return b ALPHABET = [chr(i) for i in range(33,126)] print(ALPHABET) flag = ['10000100100','10010000010','10010001010...
fib = [1, 1] for i in range(2, 11): fib.append(fib[i - 1] + fib[i - 2]) def c2f(c): n = ord(c) b = '' for i in range(10, -1, -1): if n >= fib[i]: n -= fib[i] b += '1' else: b += '0' return b alphabet = [chr(i) for i in range(33, 126)] print(ALPHAB...
# -*- coding: utf-8 -*- __version__ = "20.4.1a" __author__ = "Taro Sato" __author_email__ = "okomestudio@gmail.com" __license__ = "MIT"
__version__ = '20.4.1a' __author__ = 'Taro Sato' __author_email__ = 'okomestudio@gmail.com' __license__ = 'MIT'
# represents the format of the string (see http://docs.python.org/library/datetime.html#strftime-strptime-behavior) # format symbol "z" doesn't wok sometimes, maybe you will need to change csv2youtrack.to_unix_date(time_string) DATE_FORMAT_STRING = "" FIELD_NAMES = { "Project" : "project", "Summary" ...
date_format_string = '' field_names = {'Project': 'project', 'Summary': 'summary', 'Reporter': 'reporterName', 'Created': 'created', 'Updated': 'updated', 'Description': 'description'} field_types = {'Fix versions': 'version[*]', 'State': 'state[1]', 'Assignee': 'user[1]', 'Affected versions': 'version[*]', 'Fixed in b...
# taken from: http://pjreddie.com/projects/mnist-in-csv/ # convert reads the binary data and outputs a csv file def convert(image_file_path, label_file_path, csv_file_path, n): # open files images_file = open(image_file_path, "rb") labels_file = open(label_file_path, "rb") csv_file = open(csv_file_path...
def convert(image_file_path, label_file_path, csv_file_path, n): images_file = open(image_file_path, 'rb') labels_file = open(label_file_path, 'rb') csv_file = open(csv_file_path, 'w') images_file.read(16) labels_file.read(8) images = [] for _ in range(n): image = [] for _ in...
# SPDX-License-Identifier: MIT # Source: https://github.com/microsoft/MaskFlownet/tree/5cba12772e2201f0d1c1e27161d224e585334571 class Reader: def __init__(self, obj, full_attr=""): self._object = obj self._full_attr = full_attr def __getattr__(self, name): if self._object is None: ...
class Reader: def __init__(self, obj, full_attr=''): self._object = obj self._full_attr = full_attr def __getattr__(self, name): if self._object is None: ret = None else: ret = self._object.get(name, None) return reader(ret, self._full_attr + '.'...
""" Relaxation methods ------------------ The multigrid cycle is formed by two complementary procedures: relaxation and coarse-grid correction. The role of relaxation is to rapidly damp oscillatory (high-frequency) errors out of the approximate solution. When the error is smooth, it can then be accurately represente...
""" Relaxation methods ------------------ The multigrid cycle is formed by two complementary procedures: relaxation and coarse-grid correction. The role of relaxation is to rapidly damp oscillatory (high-frequency) errors out of the approximate solution. When the error is smooth, it can then be accurately represente...
# Copyright 2016 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. class InitializationError(Exception): """Raised by RemoteClient.initialize on fatal errors.""" def __init__(self, last_error): super(Ini...
class Initializationerror(Exception): """Raised by RemoteClient.initialize on fatal errors.""" def __init__(self, last_error): super(InitializationError, self).__init__('Failed to grab auth headers') self.last_error = last_error class Botcodeerror(Exception): """Raised by RemoteClient.get_...
"""Special Pythagorean triplet A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ def is_pythagorean_triplet(a, b, c): """De...
"""Special Pythagorean triplet A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ def is_pythagorean_triplet(a, b, c): """De...
""" Python program to check whether given tree is binary search tree(BST) or not [BST details - https://en.wikipedia.org/wiki/Binary_search_tree] """ class Node: # Create node for binary tree def __init__(self, v): self.value = v self.left = None self.right = None def inorder_travers...
""" Python program to check whether given tree is binary search tree(BST) or not [BST details - https://en.wikipedia.org/wiki/Binary_search_tree] """ class Node: def __init__(self, v): self.value = v self.left = None self.right = None def inorder_traversal(node, arr): if node is None:...
# Write your solution for 1.4 here! def is_prime(x): # mod = x for i in range(x-1, 1, -1): if x % i == 0 : return False return True # else: # return True # is_prime(8) print(is_prime(5191))
def is_prime(x): for i in range(x - 1, 1, -1): if x % i == 0: return False return True print(is_prime(5191))
#!/usr/bin/env python # Copyright 2020 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
def define_env(env): """Hook function""" @env.macro def kops_feature_table(**kwargs): """ Generate a markdown table which will be rendered when called, along with the supported passed keyword args. :param kwargs: kops_added_ff => Kops version in which this fea...
class CurveLoopIterator(object,IEnumerator[Curve],IDisposable,IEnumerator): """ An iterator to a curve loop. """ def Dispose(self): """ Dispose(self: CurveLoopIterator) """ pass def MoveNext(self): """ MoveNext(self: CurveLoopIterator) -> bool Increments the iterator to the next item. ...
class Curveloopiterator(object, IEnumerator[Curve], IDisposable, IEnumerator): """ An iterator to a curve loop. """ def dispose(self): """ Dispose(self: CurveLoopIterator) """ pass def move_next(self): """ MoveNext(self: CurveLoopIterator) -> bool Increments the iterator ...
class InternalServerError(Exception): pass class SchemaValidationError(Exception): pass class EmailAlreadyExistsError(Exception): pass class UnauthorizedError(Exception): pass class NoAuthorizationError(Exception): pass class UpdatingUserError(Exception): pass class DeletingUserError...
class Internalservererror(Exception): pass class Schemavalidationerror(Exception): pass class Emailalreadyexistserror(Exception): pass class Unauthorizederror(Exception): pass class Noauthorizationerror(Exception): pass class Updatingusererror(Exception): pass class Deletingusererror(Excep...
"""This rule gathers all .proto files used by all of its dependencies. The entire dependency tree is searched. The search crosses through cc_library rules and portable_proto_library rules to collect the transitive set of all .proto dependencies. This is provided to other rules in the form of a "proto" provider, using ...
"""This rule gathers all .proto files used by all of its dependencies. The entire dependency tree is searched. The search crosses through cc_library rules and portable_proto_library rules to collect the transitive set of all .proto dependencies. This is provided to other rules in the form of a "proto" provider, using ...
# # PySNMP MIB module DELL-NETWORKING-COPY-CONFIG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DELL-NETWORKING-COPY-CONFIG-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:37:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pytho...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ...
text = input() first = "AB" second = "BA" flag = False while True: if text.find(first) != -1: text = text[text.find(first)+2:] elif text.find(second) != -1: text = text[text.find(second)+2:] else: break if len(text) == 0: flag = True break if flag == True: ...
text = input() first = 'AB' second = 'BA' flag = False while True: if text.find(first) != -1: text = text[text.find(first) + 2:] elif text.find(second) != -1: text = text[text.find(second) + 2:] else: break if len(text) == 0: flag = True break if flag == True: ...
routes = { '{"command": "devs"}' : {"STATUS":[{"STATUS":"S","When":1553528607,"Code":9,"Msg":"3 GPU(s)","Description":"sgminer 5.6.2-b"}],"DEVS":[{"ASC":0,"Name":"BKLU","ID":0,"Enabled":"Y","Status":"Alive","Temperature":43.00,"MHS av":14131.4720,"MHS 5s":14130.6009,"Accepted":11788,"Rejected":9,"Hardware Errors":0,"...
routes = {'{"command": "devs"}': {'STATUS': [{'STATUS': 'S', 'When': 1553528607, 'Code': 9, 'Msg': '3 GPU(s)', 'Description': 'sgminer 5.6.2-b'}], 'DEVS': [{'ASC': 0, 'Name': 'BKLU', 'ID': 0, 'Enabled': 'Y', 'Status': 'Alive', 'Temperature': 43.0, 'MHS av': 14131.472, 'MHS 5s': 14130.6009, 'Accepted': 11788, 'Rejected'...
TAG_ALBUM = "album" TAG_ALBUM_ARTIST = "album_artist" TAG_ARTIST = "artist" TAG_DURATION = "duration" TAG_GENRE = "genre" TAG_TITLE = "title" TAG_TRACK = "track" TAG_YEAR = "year" TAGS = frozenset([ TAG_ALBUM, TAG_ALBUM_ARTIST, TAG_ARTIST, TAG_DURATION, TAG_GENRE, TAG_TITLE, TAG_TRACK, ...
tag_album = 'album' tag_album_artist = 'album_artist' tag_artist = 'artist' tag_duration = 'duration' tag_genre = 'genre' tag_title = 'title' tag_track = 'track' tag_year = 'year' tags = frozenset([TAG_ALBUM, TAG_ALBUM_ARTIST, TAG_ARTIST, TAG_DURATION, TAG_GENRE, TAG_TITLE, TAG_TRACK, TAG_YEAR])
class Solution: def sortItems(self, n: int, m: int, group: List[int], beforeItems: List[List[int]]) -> List[int]: cnt = 0 groups = collections.defaultdict(list) for i, g in enumerate(group): if g == -1: group[i] = cnt + m cnt += 1 group...
class Solution: def sort_items(self, n: int, m: int, group: List[int], beforeItems: List[List[int]]) -> List[int]: cnt = 0 groups = collections.defaultdict(list) for (i, g) in enumerate(group): if g == -1: group[i] = cnt + m cnt += 1 g...
def calc_eccentricity(dist_list): """Calculate and return eccentricity from list of radii.""" apoapsis = max(dist_list) periapsis = min(dist_list) eccentricity = (apoapsis - periapsis) / (apoapsis + periapsis) return eccentricity
def calc_eccentricity(dist_list): """Calculate and return eccentricity from list of radii.""" apoapsis = max(dist_list) periapsis = min(dist_list) eccentricity = (apoapsis - periapsis) / (apoapsis + periapsis) return eccentricity
description = 'NICOS demo startup setup' group = 'lowlevel' # startupcode = ''' # printinfo("============================================================") # printinfo("Welcome to the NICOS demo.") # printinfo("Run one of the following commands to set up either a triple-axis") # printinfo("or a SANS demo setup:") # pr...
description = 'NICOS demo startup setup' group = 'lowlevel'
#!/usr/bin/env python class Life: def __init__(self, name='unknown'): print('Hello ' + name) self.name = name def live(self): print(self.name) def __del__(self): print('Goodbye ' + self.name) brian = Life('Brian') brian.live() brian = 'leretta'
class Life: def __init__(self, name='unknown'): print('Hello ' + name) self.name = name def live(self): print(self.name) def __del__(self): print('Goodbye ' + self.name) brian = life('Brian') brian.live() brian = 'leretta'
# Copyright (c) 2012 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. { 'variables': { 'lzma_sdk_sources': [ '7z.h', '7zAlloc.c', '7zAlloc.h', '7zArcIn.c', '7zBuf.c', '7zBuf.h', ...
{'variables': {'lzma_sdk_sources': ['7z.h', '7zAlloc.c', '7zAlloc.h', '7zArcIn.c', '7zBuf.c', '7zBuf.h', '7zCrc.c', '7zCrc.h', '7zCrcOpt.c', '7zDec.c', '7zFile.c', '7zFile.h', '7zStream.c', '7zTypes.h', 'Alloc.c', 'Alloc.h', 'Bcj2.c', 'Bcj2.h', 'Bra.c', 'Bra.h', 'Bra86.c', 'Compiler.h', 'CpuArch.c', 'CpuArch.h', 'Delta...
config = { 'sampling_rate': 22050, 'hop_size': 256, 'model_type': 'hifigan_generator', 'hifigan_generator_params': { 'out_channels': 1, 'kernel_size': 7, 'filters': 128, 'use_bias': True, 'upsample_scales': [8, 8, 2, 2], 'stacks': 3, 'stack_kernel_...
config = {'sampling_rate': 22050, 'hop_size': 256, 'model_type': 'hifigan_generator', 'hifigan_generator_params': {'out_channels': 1, 'kernel_size': 7, 'filters': 128, 'use_bias': True, 'upsample_scales': [8, 8, 2, 2], 'stacks': 3, 'stack_kernel_size': [3, 7, 11], 'stack_dilation_rate': [[1, 3, 5], [1, 3, 5], [1, 3, 5]...
def countdown(num): print(num) if num == 0: return else: countdown(num - 1) if __name__ == "__main__": countdown(10)
def countdown(num): print(num) if num == 0: return else: countdown(num - 1) if __name__ == '__main__': countdown(10)
class GridNode(object): """ A structure that represents a particular location in (U,V) from a grid. GridNode(uIndex: int,vIndex: int) """ @staticmethod def __new__(self,uIndex,vIndex): """ __new__[GridNode]() -> GridNode __new__(cls: type,uIndex: int,vIndex: int) """ pass UIn...
class Gridnode(object): """ A structure that represents a particular location in (U,V) from a grid. GridNode(uIndex: int,vIndex: int) """ @staticmethod def __new__(self, uIndex, vIndex): """ __new__[GridNode]() -> GridNode __new__(cls: type,uIndex: int,vIndex: int) """ pas...
class LocationPathFormatError(Exception): pass class LocationStepFormatError(Exception): pass class NodenameFormatError(Exception): pass class PredicateFormatError(Exception): pass class PredicatesFormatError(Exception): pass
class Locationpathformaterror(Exception): pass class Locationstepformaterror(Exception): pass class Nodenameformaterror(Exception): pass class Predicateformaterror(Exception): pass class Predicatesformaterror(Exception): pass
burst_time=[] print("Enter the number of process: ") n=int(input()) print("Enter the burst time of the processes: \n") burst_time=list(map(int, input().split())) waiting_time=[] avg_waiting_time=0 turnaround_time=[] avg_turnaround_time=0 waiting_time.insert(0,0) turnaround_time.insert(0,burst_time[0]) for i ...
burst_time = [] print('Enter the number of process: ') n = int(input()) print('Enter the burst time of the processes: \n') burst_time = list(map(int, input().split())) waiting_time = [] avg_waiting_time = 0 turnaround_time = [] avg_turnaround_time = 0 waiting_time.insert(0, 0) turnaround_time.insert(0, burst_time[0]) f...
lista = [ [1,2,3,4,5,6,7,9,8,10], [1,3,3,4,5,6,7,8,9,10], [1,7,3,4,5,6,7,8,9,10], [1,2,3,4,5,6,7,8,9,10], [1,2,3,4,5,6,7,8,9,10], [1,2,3,4,5,6,7,8,9,10], [1,8,3,4,5,6,7,8,9,10], ] def verificar(lista): ls = lista for index_lista in lista: for aux in index_lista: ...
lista = [[1, 2, 3, 4, 5, 6, 7, 9, 8, 10], [1, 3, 3, 4, 5, 6, 7, 8, 9, 10], [1, 7, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 8, 3, 4, 5, 6, 7, 8, 9, 10]] def verificar(lista): ls = lista for index_lista in lista: for ...