content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Body(object): def __init__(self, mass, position, velocity, name = None): if (name != None): self.name = name self.mass = mass self.position = position self.velocity = velocity
class Body(object): def __init__(self, mass, position, velocity, name=None): if name != None: self.name = name self.mass = mass self.position = position self.velocity = velocity
# -- coding: utf-8 -- """Collection of defaults assumed by the download script. The defaults are all the allowed values for each of the variables. More details are available are Copernicus Climate Data Store [0]. [0] https://cds.climate.copernicus.eu/cdsapp """ def time(): return [ "00:00", "01:...
"""Collection of defaults assumed by the download script. The defaults are all the allowed values for each of the variables. More details are available are Copernicus Climate Data Store [0]. [0] https://cds.climate.copernicus.eu/cdsapp """ def time(): return ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00',...
def _wrapper(page): """ Wraps some text in common HTML. """ return (""" <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <style> body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; max-width: 24em; ...
def _wrapper(page): """ Wraps some text in common HTML. """ return '\n <!DOCTYPE HTML>\n <html>\n <head>\n <meta charset="utf-8">\n <style>\n body {\n font-family: -apple-system, BlinkMacSystemFont, sans-serif;\n max-width: 24em;\n ...
"""Kata: Sum of odd numbers Given the triangle of consecutive odd numbers \ calculate the row sums of this triangle from the row index. #1 Best Practices Solution by kevinplybon (plus 546 more warriors): def row_sum_odd_numbers(n): return n ** 3 """ def row_sum_odd_numbers(n): """function takes in number ...
"""Kata: Sum of odd numbers Given the triangle of consecutive odd numbers calculate the row sums of this triangle from the row index. #1 Best Practices Solution by kevinplybon (plus 546 more warriors): def row_sum_odd_numbers(n): return n ** 3 """ def row_sum_odd_numbers(n): """function takes in number and...
"""Metadata for readcomp""" __title__ = "readcomp" __description__ = "Reading comprehension passage generator" __url__ = "https://github.com/acciochris/readcomp" __version__ = "0.1.0" __author__ = "Chang Liu" __license__ = "MIT" __copyright__ = "Copyright 2020 Chang Liu"
"""Metadata for readcomp""" __title__ = 'readcomp' __description__ = 'Reading comprehension passage generator' __url__ = 'https://github.com/acciochris/readcomp' __version__ = '0.1.0' __author__ = 'Chang Liu' __license__ = 'MIT' __copyright__ = 'Copyright 2020 Chang Liu'
def config(args): """ This command configure eggs """ print("configure eggs")
def config(args): """ This command configure eggs """ print('configure eggs')
"""lds-bde-loader exception classes.""" class Error(Exception): """Generic errors.""" def __init__(self, msg): super(Error, self).__init__() self.msg = msg def __str__(self): return "%s: %s" % (self.__class__.__name__, self.msg) class ConfigError(Error): """Config related err...
"""lds-bde-loader exception classes.""" class Error(Exception): """Generic errors.""" def __init__(self, msg): super(Error, self).__init__() self.msg = msg def __str__(self): return '%s: %s' % (self.__class__.__name__, self.msg) class Configerror(Error): """Config related err...
""" Project Euler Problem 3: Largest Prime Factor """ # What is the largest prime factor of the number 600851475143? number = 600851475143 prime_list = [2] # Declare the list of prime numbers i = 3 # First prime number j = 0 # Initialize index counter while i**2 <= number: # The largest pos...
""" Project Euler Problem 3: Largest Prime Factor """ number = 600851475143 prime_list = [2] i = 3 j = 0 while i ** 2 <= number: is_prime = True while prime_list[j] ** 2 <= i: if i % prime_list[j] == 0: is_prime = False j += 1 if isPrime: prime_list.append(i) if isPri...
"""Class represents response format. { status, successful/fail data, response msg, error messages } """ def ok(data): return { "data": data, "msg": None, "status": "successful" } def err(msg): return { "data": None,...
"""Class represents response format. { status, successful/fail data, response msg, error messages } """ def ok(data): return {'data': data, 'msg': None, 'status': 'successful'} def err(msg): return {'data': None, 'msg': msg, 'status': 'fail'}
#!/usr/bin/env python3 # https://www.codechef.com/JULY18A/problems/JERRYTOM def max_clique(g): n = 0 for x in g: n = max(n, len(x)) l = [set() for _ in range(n + 1)] s = [0] * len(g) for i, x in enumerate(g): ll = len(x) l[ll].add(i) s[i] = ll m = 0 for _ in range(len...
def max_clique(g): n = 0 for x in g: n = max(n, len(x)) l = [set() for _ in range(n + 1)] s = [0] * len(g) for (i, x) in enumerate(g): ll = len(x) l[ll].add(i) s[i] = ll m = 0 for _ in range(len(g)): for i in range(n + 1): if len(l[i]) > 0:...
# follow pytorch GAN-Studio, random flip is used in the dataset _base_ = [ '../_base_/models/sngan_proj_32x32.py', '../_base_/datasets/cifar10_nopad.py', '../_base_/default_runtime.py' ] num_classes = 10 model = dict( num_classes=num_classes, generator=dict( act_cfg=dict(type='ReLU', inplace=T...
_base_ = ['../_base_/models/sngan_proj_32x32.py', '../_base_/datasets/cifar10_nopad.py', '../_base_/default_runtime.py'] num_classes = 10 model = dict(num_classes=num_classes, generator=dict(act_cfg=dict(type='ReLU', inplace=True), num_classes=num_classes), discriminator=dict(act_cfg=dict(type='ReLU', inplace=True), nu...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/IrSourceInfo.msg;/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/State.msg;/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/TimedSwitch.msg" ...
messages_str = '/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/IrSourceInfo.msg;/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/State.msg;/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/TimedSwitch.msg' services_str = '' pkg_name = 'wiimote' dependencies_s...
num1=10 num2=20 num3=300 num3=30 num4=40
num1 = 10 num2 = 20 num3 = 300 num3 = 30 num4 = 40
# -*- coding: utf-8 -*- def bytes(num): for x in ['bytes','KB','MB','GB']: if num < 1024.0 and num > -1024.0: return "{0:.1f} {1}".format(num, x) num /= 1024.0 return "{0:.1f} {1}".format(num, 'TB')
def bytes(num): for x in ['bytes', 'KB', 'MB', 'GB']: if num < 1024.0 and num > -1024.0: return '{0:.1f} {1}'.format(num, x) num /= 1024.0 return '{0:.1f} {1}'.format(num, 'TB')
#inputs_pdm.py # #Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. #The Universal Permissive License (UPL), Version 1.0 # #by Joe Hahn, joe.hahn@oracle.come, 11 September 2018 #input parameters used to generate mock pdm data #turn debugging output on? debug = True #number of devices N_devices = ...
debug = True n_devices = 1000 sensor_sigma = 0.01 n_timesteps = 20000 time_start = 0 output_interval = 10 strategy = 'pdm' pdm_threshold_time = 400 pdm_threshold_probability = 0.5 pdm_skip_time = 5 n_technicians = N_devices / 10 repair_duration = 100 maintenance_duration = repair_duration / 4 rn_seed = 17 + 1 issues = ...
basepath = "<path to dataset>" with open(basepath+"/**/train_bg/wav.scp") as f: lines = f.read().strip().split('\n') for line in tqdm.tqdm(lines): # name, _ = line.strip().split('\t') name = line.strip().split(' ')[0] shutil.copy(basepath+"/audio/"+name+".flac", basepath+"/**/train_wav/"+name+".fl...
basepath = '<path to dataset>' with open(basepath + '/**/train_bg/wav.scp') as f: lines = f.read().strip().split('\n') for line in tqdm.tqdm(lines): name = line.strip().split(' ')[0] shutil.copy(basepath + '/audio/' + name + '.flac', basepath + '/**/train_wav/' + name + '.flac') with open(basepath + '/**/de...
def merge_dicts(*dict_args): """ Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts. """ result = {} for dictionary in dict_args: result.update(dictionary) return result def move_to_end(d, k): v = d.pop(k) d...
def merge_dicts(*dict_args): """ Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts. """ result = {} for dictionary in dict_args: result.update(dictionary) return result def move_to_end(d, k): v = d.pop(k) d[...
#!/usr/bin/env python code_file = 'node_modules/terser-webpack-plugin/dist/TaskRunner.js' bad_code = 'const cpus = _os2.default.cpus() || { length: 1 };' good_code = 'const cpus = { length: 1 };' new_text = None with open(code_file) as f: print('Reading %s' % code_file) file_content = f.read() if bad_co...
code_file = 'node_modules/terser-webpack-plugin/dist/TaskRunner.js' bad_code = 'const cpus = _os2.default.cpus() || { length: 1 };' good_code = 'const cpus = { length: 1 };' new_text = None with open(code_file) as f: print('Reading %s' % code_file) file_content = f.read() if bad_code in file_content: ...
class ParsimoniousError(Exception): def __init__(self, exception): """ A class for wrapping parsimonious errors to make them a bit more sensible to users of this library. :param exception: The original parsimonious exception :return: self """ self.exception = except...
class Parsimoniouserror(Exception): def __init__(self, exception): """ A class for wrapping parsimonious errors to make them a bit more sensible to users of this library. :param exception: The original parsimonious exception :return: self """ self.exception = except...
A, B = map(int,input().split()) a = str(A) b = str(B) new_a1 = int(a[0]) new_a2 = int(a[1]) new_a3 = int(a[2]) new_a = new_a3 * 100 + new_a2 * 10 + new_a1 * 1 new_b1 = int(b[0]) new_b2 = int(b[1]) new_b3 = int(b[2]) new_b = new_b3 * 100 + new_b2 * 10 + new_b1 * 1 if new_a > new_b: print(new_a) else: print(n...
(a, b) = map(int, input().split()) a = str(A) b = str(B) new_a1 = int(a[0]) new_a2 = int(a[1]) new_a3 = int(a[2]) new_a = new_a3 * 100 + new_a2 * 10 + new_a1 * 1 new_b1 = int(b[0]) new_b2 = int(b[1]) new_b3 = int(b[2]) new_b = new_b3 * 100 + new_b2 * 10 + new_b1 * 1 if new_a > new_b: print(new_a) else: print(ne...
#!/usr/bin/env python # -*- coding: utf-8 -*- class ErrorObj: def __init__(self, code, message): self.code = code self.message = message EOBJ_PARSE_ERROR = ErrorObj(-32700, 'parse error.') EOBJ_INVALID_REQUEST = ErrorObj(-32600, 'invalid request.') EOBJ_METHOD_NOT_FOUND = ErrorObj(-32601, 'metho...
class Errorobj: def __init__(self, code, message): self.code = code self.message = message eobj_parse_error = error_obj(-32700, 'parse error.') eobj_invalid_request = error_obj(-32600, 'invalid request.') eobj_method_not_found = error_obj(-32601, 'method not found.') eobj_invalid_params = error_obj...
# The interval between temperature readings in seconds READINGS_INTERVAL = 600 DATA_PIN = 3 SCX_PIN = 2 REDIS_HOST = 'localhost' REDIS_PORT = 6379 LAST_MEASUREMENT_KEY = 'last_measurement' LAST_MEASUREMENT_KEY_TEMPLATE = 'measurement_{}' TIME_KEY = 'time' TEMPERATURE_KEY = 'temperature' HUMIDITY_KEY = 'humidity' PREV_...
readings_interval = 600 data_pin = 3 scx_pin = 2 redis_host = 'localhost' redis_port = 6379 last_measurement_key = 'last_measurement' last_measurement_key_template = 'measurement_{}' time_key = 'time' temperature_key = 'temperature' humidity_key = 'humidity' prev_key = 'prev' measurement_expire_hours = 48 num_of_readin...
mistring = 'Curso de python3' print(mistring [0:10]) palabra ="hola" print (len(palabra))
mistring = 'Curso de python3' print(mistring[0:10]) palabra = 'hola' print(len(palabra))
def Insertion_Sort(alist): ''' Sorting alist via Insertion Sort ''' for index in range(1, len(alist)): currentValue = alist[index] position = index while position > 0 and alist[position-1] > currentValue: alist[position] = alist[position-1] position = posi...
def insertion__sort(alist): """ Sorting alist via Insertion Sort """ for index in range(1, len(alist)): current_value = alist[index] position = index while position > 0 and alist[position - 1] > currentValue: alist[position] = alist[position - 1] position ...
""" Module :module:`shelter.core.constants` contains useful constants used in Shelter. """ __all__ = ['SERVICE_PROCESS', 'TORNADO_WORKER'] SERVICE_PROCESS = 'service_process' """ Indicates that type of the process is a service process. *kwargs* argument in method :meth:`shelter.core.context.initialize_child` contains...
""" Module :module:`shelter.core.constants` contains useful constants used in Shelter. """ __all__ = ['SERVICE_PROCESS', 'TORNADO_WORKER'] service_process = 'service_process' '\nIndicates that type of the process is a service process. *kwargs* argument\nin method :meth:`shelter.core.context.initialize_child` contains *...
class ConnectGame: def __init__(self, board): self.board = board.replace(' ', '').split('\n') def get_winner(self): print(self.board) visited = set() to_visit = [] directions = [(-1, 0), (0, -1), (1, -1), (1, 0), (0, 1), (-1, 1)] ...
class Connectgame: def __init__(self, board): self.board = board.replace(' ', '').split('\n') def get_winner(self): print(self.board) visited = set() to_visit = [] directions = [(-1, 0), (0, -1), (1, -1), (1, 0), (0, 1), (-1, 1)] for y in range(len(self.board)):...
def get_parameter_value(fhir_operation, parameter_name): """ Find the parameter value provided in the parameters :param fhir_operation: the fhir operation definition :param parameter_name: the name of the parameter to get the value of :return: a string representation of th value """ p...
def get_parameter_value(fhir_operation, parameter_name): """ Find the parameter value provided in the parameters :param fhir_operation: the fhir operation definition :param parameter_name: the name of the parameter to get the value of :return: a string representation of th value """ paramete...
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external") def dependencies(): import_external( name = "javax_servlet_javax_servlet_api", artifact = "javax.servlet:javax.servlet-api:3.1.0", jar_sha256 = "af456b2dd41c4e82cf54f3e743bc678973d9fe35bd4d3071fa05c7e5333b8482...
load('//:import_external.bzl', import_external='safe_wix_scala_maven_import_external') def dependencies(): import_external(name='javax_servlet_javax_servlet_api', artifact='javax.servlet:javax.servlet-api:3.1.0', jar_sha256='af456b2dd41c4e82cf54f3e743bc678973d9fe35bd4d3071fa05c7e5333b8482', srcjar_sha256='5c6d640f...
primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31} def is_prime(n): if n in primes: return True else: if n == 1: return False i = 2 while i*i <= n: if n % i == 0: return False i += 1 primes.add(n) return True for _ in range(int(input())): N = int(input()) if is_prime(N): print(N, N) e...
primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31} def is_prime(n): if n in primes: return True else: if n == 1: return False i = 2 while i * i <= n: if n % i == 0: return False i += 1 primes.add(n) return True f...
class NaryConfig: def __init__( self, embedding_size=300, hidden_size=150, vocab_size=10000, hidden_dropout_prob=0., cell_type='lstm', use_attention=False, use_bert=False, tune_bert=False, normalize_bert_embeddings=False, xav...
class Naryconfig: def __init__(self, embedding_size=300, hidden_size=150, vocab_size=10000, hidden_dropout_prob=0.0, cell_type='lstm', use_attention=False, use_bert=False, tune_bert=False, normalize_bert_embeddings=False, xavier_init=True, N=2, **kwargs): super().__init__(**kwargs) self.vocab_size ...
class Foo: num1 : int num2 : int foo1 = Foo() id_foo1_before = id(foo1) foo1.num1 = 1 id_foo1_after = id(foo1) if id_foo1_before == id_foo1_after: print('Foo is immutable') else: print('Foo is mutable')
class Foo: num1: int num2: int foo1 = foo() id_foo1_before = id(foo1) foo1.num1 = 1 id_foo1_after = id(foo1) if id_foo1_before == id_foo1_after: print('Foo is immutable') else: print('Foo is mutable')
# This file is Copyright 2019 Volatility Foundation and licensed under the Volatility Software License 1.0 # which is available at https://www.volatilityfoundation.org/license/vsl-v1.0 # """The official list of format hints that text renderers and plugins can rely upon existing within the framework. These hints allow ...
"""The official list of format hints that text renderers and plugins can rely upon existing within the framework. These hints allow a plugin to indicate how they would like data from a particular column to be represented. Text renderers should attempt to honour all hints provided in this module where possible """ cl...
def cadicao(n1,n2): return n1 + n2 def csubtracao (n1,n2): return n1 - n2 def cdivisao (n1,n2): return n1 / n2 def cdivisaoint (n1,n2): return n1 // n2 def cmultiplicacao (n1,n2): return n1 * n2 def cpotenciacao(n1,n2): return n1 ** n2 def craiz (n1,n2): return n1 ** (1/n2) def c...
def cadicao(n1, n2): return n1 + n2 def csubtracao(n1, n2): return n1 - n2 def cdivisao(n1, n2): return n1 / n2 def cdivisaoint(n1, n2): return n1 // n2 def cmultiplicacao(n1, n2): return n1 * n2 def cpotenciacao(n1, n2): return n1 ** n2 def craiz(n1, n2): return n1 ** (1 / n2) def cr...
def main(): print('Please enter x as base and exp as exponent.') try: while 1: x = float(input('x = ')) exp = int(input('exp = ')) print("%.3f to the power %d is %.5f\n" % (x,exp,x ** exp)) print("Please enter next pair or q to quit.") except:print('Ho...
def main(): print('Please enter x as base and exp as exponent.') try: while 1: x = float(input('x = ')) exp = int(input('exp = ')) print('%.3f to the power %d is %.5f\n' % (x, exp, x ** exp)) print('Please enter next pair or q to quit.') except: ...
def define_targets(rules): rules.cc_library( name = "TypeCast", srcs = ["TypeCast.cpp"], hdrs = ["TypeCast.h"], linkstatic = True, local_defines = ["C10_BUILD_MAIN_LIB"], visibility = ["//visibility:public"], deps = [ ":base", "//c10/co...
def define_targets(rules): rules.cc_library(name='TypeCast', srcs=['TypeCast.cpp'], hdrs=['TypeCast.h'], linkstatic=True, local_defines=['C10_BUILD_MAIN_LIB'], visibility=['//visibility:public'], deps=[':base', '//c10/core:ScalarType', '//c10/macros']) rules.cc_library(name='base', srcs=rules.glob(['*.cpp'], ex...
v = input("digite um valor em dias: ") a = int(int(v)/365) m = int((int(v)%365)/30) d = int((int(v)%365)%30) print(str(a)+" ano(s)") print(str(m)+" mes(es)") print(str(d)+" dias(s)")
v = input('digite um valor em dias: ') a = int(int(v) / 365) m = int(int(v) % 365 / 30) d = int(int(v) % 365 % 30) print(str(a) + ' ano(s)') print(str(m) + ' mes(es)') print(str(d) + ' dias(s)')
"""Re-export of some bazel rules with repository-wide defaults.""" load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") load("@build_bazel_rules_nodejs//:index.bzl", _nodejs_binary = "nodejs_binary", _pkg_npm = "pkg_npm") load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test") load("@...
"""Re-export of some bazel rules with repository-wide defaults.""" load('@bazel_tools//tools/build_defs/pkg:pkg.bzl', 'pkg_tar') load('@build_bazel_rules_nodejs//:index.bzl', _nodejs_binary='nodejs_binary', _pkg_npm='pkg_npm') load('@npm_bazel_jasmine//:index.bzl', _jasmine_node_test='jasmine_node_test') load('@npm_baz...
class Solution: def threeSumClosest(self, nums: List[int], target: int) -> int: nums.sort() opt = float("inf") for i in range(len(nums)): # Fix one integer fixed = nums[i] newTarget = target-fixed l,r = i+1, len(nums)-1 while(l<r): ...
class Solution: def three_sum_closest(self, nums: List[int], target: int) -> int: nums.sort() opt = float('inf') for i in range(len(nums)): fixed = nums[i] new_target = target - fixed (l, r) = (i + 1, len(nums) - 1) while l < r: ...
class MetricUnitError(Exception): pass class SchemaValidationError(Exception): pass class MetricValueError(Exception): pass class UniqueNamespaceError(Exception): pass
class Metricuniterror(Exception): pass class Schemavalidationerror(Exception): pass class Metricvalueerror(Exception): pass class Uniquenamespaceerror(Exception): pass
# is_lower_case # # Checks if a string is lower case. # # Convert the given string to lower case, using str.lower() method and compare it to the original. def is_lower_case(string): return string == string.lower() is_lower_case('abc') # True is_lower_case('a3@$') # True is_lower_case('Ab4') # False
def is_lower_case(string): return string == string.lower() is_lower_case('abc') is_lower_case('a3@$') is_lower_case('Ab4')
""" 18. How to convert the first character of each element in a series to uppercase? """ """ Difficulty Level: L2 """ """ Change the first character of each word to upper case in each word of ser. """ """ ser = pd.Series(['how', 'to', 'kick', 'ass?']) """
""" 18. How to convert the first character of each element in a series to uppercase? """ '\nDifficulty Level: L2\n' '\nChange the first character of each word to upper case in each word of ser.\n' "\nser = pd.Series(['how', 'to', 'kick', 'ass?'])\n"
# Class Variable class Employee: no_of_emp = 0 raise_amount = 1.04 def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay self.email = first + "." + last + "@gmail.com" Employee.no_of_emp += 1 def apply_raise(self): s...
class Employee: no_of_emp = 0 raise_amount = 1.04 def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay self.email = first + '.' + last + '@gmail.com' Employee.no_of_emp += 1 def apply_raise(self): self.pay = int(self.p...
#Written by: Karim shoair - D4Vinci ( Dr0p1t-Framework ) #In this script I store some SE tricks to use ;) #Start #Get the user password by fooling him and then uses it to run commands as the user by psexec to bypass UAC def ask_pwd(): while True: cmd = '''Powershell "$cred=$host.ui.promptforcredential('Windows fire...
def ask_pwd(): while True: cmd = 'Powershell "$cred=$host.ui.promptforcredential(\'Windows firewall permission\',\'\',[Environment]::UserName,[Environment]::UserDomainName); echo $cred.getnetworkcredential().password;"' response = get_output(cmd) if response.strip() != '' and (not response.s...
main = { 'General': { 'Prop': { 'Labels': 'rw', 'AlarmStatus': 'r-' } } } cfgm = { 'Logicalport': { 'Cmd': ( 'Create', 'Delete' ) } }
main = {'General': {'Prop': {'Labels': 'rw', 'AlarmStatus': 'r-'}}} cfgm = {'Logicalport': {'Cmd': ('Create', 'Delete')}}
model = dict( type='MonoRUnDetector', pretrained='torchvision://resnet101', backbone=dict( type='ResNet', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='p...
model = dict(type='MonoRUnDetector', pretrained='torchvision://resnet101', backbone=dict(type='ResNet', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch'), neck=dict(type='FPNplus', in_channels=[256, 512, 1024, 2048], out_ch...
#!/usr/bin/env python3 class Test: @classmethod def assert_equals(cls, func_out, expected_out): assert func_out == expected_out, f"The function out '{func_out}' != '{expected_out}'"
class Test: @classmethod def assert_equals(cls, func_out, expected_out): assert func_out == expected_out, f"The function out '{func_out}' != '{expected_out}'"
def max(a, b): if a > b: return a elif b > a: return b else: return 'a = b' print(max(123,445))
def max(a, b): if a > b: return a elif b > a: return b else: return 'a = b' print(max(123, 445))
kernel = [1,0,1] # averaging of neighbors #kernel = np.exp(-np.linspace(-2,2,5)**2) ## Gaussian kernel /= np.sum(kernel) # normalize smooth = np.convolve(y, kernel, mode='same') # find the average value of neighbors rms_noise = np.average((y[1:]-y[:-1])**2)**.5 # estimate what the average no...
kernel = [1, 0, 1] kernel /= np.sum(kernel) smooth = np.convolve(y, kernel, mode='same') rms_noise = np.average((y[1:] - y[:-1]) ** 2) ** 0.5 where_not_excess = np.abs(y - smooth) < rms_noise * 3 (x, y) = (x[where_not_excess], y[where_not_excess])
def boolean_true(): return value # Change the varable named value to the correct answer print(boolean_true())
def boolean_true(): return value print(boolean_true())
iot_devices = { "cl01": "HostName=znetinnn12ioth01.azure-devices.net;DeviceId=cl01;SharedAccessKey=C3lI2jbo0DVgPtUqMjg7BYxXpBRvGsvXCCP/33zRK34=", # Cristian's Device "js01": "HostName=znetinnn12ioth01.azure-devices.net;DeviceId=js01;SharedAccessKey=9g4Qmbfoi/WZPNTA3HqePqrCjYd1mtj15CKu8hMow9Y=", # John's Devic...
iot_devices = {'cl01': 'HostName=znetinnn12ioth01.azure-devices.net;DeviceId=cl01;SharedAccessKey=C3lI2jbo0DVgPtUqMjg7BYxXpBRvGsvXCCP/33zRK34=', 'js01': 'HostName=znetinnn12ioth01.azure-devices.net;DeviceId=js01;SharedAccessKey=9g4Qmbfoi/WZPNTA3HqePqrCjYd1mtj15CKu8hMow9Y=', 'rd01': 'HostName=znetinnn12ioth01.azure-devi...
""" Red, green or blue tiles """ def f(m, n): ways = [0] * (n + 1) for i in range(m): ways[i] = 1 for i in range(m, n + 1): ways[i] += ways[i - 1] + ways[i - m] return ways[n] - 1 if __name__ == '__main__': print(f(2, 50) + f(3, 50) + f(4, 50))
""" Red, green or blue tiles """ def f(m, n): ways = [0] * (n + 1) for i in range(m): ways[i] = 1 for i in range(m, n + 1): ways[i] += ways[i - 1] + ways[i - m] return ways[n] - 1 if __name__ == '__main__': print(f(2, 50) + f(3, 50) + f(4, 50))
"""Constants for HTTP""" class HttpConstants: HTTP_METHOD_GET = 'GET' HTTP_METHOD_POST = 'POST' HTTP_METHOD_PUT = 'PUT' HTTP_METHOD_OPTIONS = 'OPTIONS' HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = 'Access-Control-Allow-Origin' @staticmethod def http_method_get(): """Returns the HTT...
"""Constants for HTTP""" class Httpconstants: http_method_get = 'GET' http_method_post = 'POST' http_method_put = 'PUT' http_method_options = 'OPTIONS' http_header_access_control_allow_origin = 'Access-Control-Allow-Origin' @staticmethod def http_method_get(): """Returns the HTTP m...
__title__ = 'fobi.contrib.plugins.form_elements.fields.input.constants' __author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' __copyright__ = '2014-2017 Artur Barseghyan' __license__ = 'GPL 2.0/LGPL 2.1' __all__ = ( 'FORM_FIELD_TYPE_CHOICES', 'FIELD_TYPE_TO_DJANGO_FORM_FIELD_MAPPING', 'FIELD_TYPE_TO_DJAN...
__title__ = 'fobi.contrib.plugins.form_elements.fields.input.constants' __author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' __copyright__ = '2014-2017 Artur Barseghyan' __license__ = 'GPL 2.0/LGPL 2.1' __all__ = ('FORM_FIELD_TYPE_CHOICES', 'FIELD_TYPE_TO_DJANGO_FORM_FIELD_MAPPING', 'FIELD_TYPE_TO_DJANGO_FORM_W...
t = int(input()) ans = [] for testcase in range(t): n, m = [int(i) for i in input().split()] if (n == 2) and (m == 2): folds = [] for i in range(n): folds += [int(i) for i in input().split()] for i in range(n - 1): folds += [int(i) for i in input().split()] ...
t = int(input()) ans = [] for testcase in range(t): (n, m) = [int(i) for i in input().split()] if n == 2 and m == 2: folds = [] for i in range(n): folds += [int(i) for i in input().split()] for i in range(n - 1): folds += [int(i) for i in input().split()] ...
#This is ACSL 2018 ALl-Star Problem. This code is written by Robin Gan. And it is incompleted. #more info check out acsl.org #probelm name=Compressed_Tree def main(): global orgSet global editSet global targetWord global answerStr answerStr="" ipl=input() useWord=ipl[0:len(ipl)-1...
def main(): global orgSet global editSet global targetWord global answerStr answer_str = '' ipl = input() use_word = ipl[0:len(ipl) - 1] target_word = ipl[len(ipl) - 1] org_set = [] edit_set = [] for char in useWord: orgSet.append(char) editSet.append(char) d...
class StartAppReportObject: def __init__(self, result): self.data = result["data"] def __eq__(self, other): if type(other) != type(self): return False if self.data == other.data: return True return False
class Startappreportobject: def __init__(self, result): self.data = result['data'] def __eq__(self, other): if type(other) != type(self): return False if self.data == other.data: return True return False
string_to_revers = input() for x in string_to_revers[::-1]: print(x, end='')
string_to_revers = input() for x in string_to_revers[::-1]: print(x, end='')
#!/usr/bin/python # Copyright 2015 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Subcommand codes that specify the crypto module.""" # Keep these codes in sync with include/extension.h. AES = 0 HASH = 1
"""Subcommand codes that specify the crypto module.""" aes = 0 hash = 1
## Mel-filterbank mel_window_length = 50 # In milliseconds 25 mel_window_step = 10 # In milliseconds 10 mel_n_channels = 40 ## Audio sampling_rate = 16000 # Number of spectrogram frames in a partial utterance partials_n_frames = 160 # 1600 ms # Number of spectrogram frames at inference inference_n...
mel_window_length = 50 mel_window_step = 10 mel_n_channels = 40 sampling_rate = 16000 partials_n_frames = 160 inference_n_frames = 80 vad_window_length = 30 vad_moving_average_width = 8 vad_max_silence_length = 6 audio_norm_target_d_bfs = -30
src = Split(''' base64.c ''') component = aos_component('base64', src)
src = split('\n base64.c\n') component = aos_component('base64', src)
jogador = {} gols = [] soma = 0 nome = input('Digite o nome do jogador: ') partidas = int(input(f'Quantas partidas o {nome} jogou: ')) for i in range(0, partidas): gol = int(input(f'Digite quantos gols na {i}: ')) soma += gol gols.append(gol) jogador['Nome'] = nome jogador['Partidas'] = partidas jogador['Go...
jogador = {} gols = [] soma = 0 nome = input('Digite o nome do jogador: ') partidas = int(input(f'Quantas partidas o {nome} jogou: ')) for i in range(0, partidas): gol = int(input(f'Digite quantos gols na {i}: ')) soma += gol gols.append(gol) jogador['Nome'] = nome jogador['Partidas'] = partidas jogador['Go...
# Copyright (c) 2018-2020 Simons Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http:#www.apache.org/licenses/LICENSE-2.0.txt # # Unless required by applicable law or agre...
""" DOC """ class Cpp2Pyinfo: table_imports = {} table_converters = {'nda::basic_array': 'nda_py/cpp2py_converters.hpp', 'nda::basic_array_view': 'nda_py/cpp2py_converters.hpp'} __all__ = ['Cpp2pyInfo']
def method1(n: int) -> int: divisors = [d for d in range(2, n // 2 + 1) if n % d == 0] return [d for d in divisors if all(d % od != 0 for od in divisors if od != d)] if __name__ == "__main__": """ from timeit import timeit print(timeit(lambda: method1(20), number=10000)) # 0.028740440000547096 ...
def method1(n: int) -> int: divisors = [d for d in range(2, n // 2 + 1) if n % d == 0] return [d for d in divisors if all((d % od != 0 for od in divisors if od != d))] if __name__ == '__main__': '\n from timeit import timeit\n print(timeit(lambda: method1(20), number=10000)) # 0.028740440000547096\n ...
def _revisions(revs, is_dirty): revisions = revs or [] if len(revisions) <= 1: if len(revisions) == 0 and is_dirty: revisions.append("HEAD") revisions.append("working tree") return revisions def diff(repo, *args, revs=None, **kwargs): return repo.plots.show( *args, ...
def _revisions(revs, is_dirty): revisions = revs or [] if len(revisions) <= 1: if len(revisions) == 0 and is_dirty: revisions.append('HEAD') revisions.append('working tree') return revisions def diff(repo, *args, revs=None, **kwargs): return repo.plots.show(*args, revs=_revi...
cities = [ 'Santa Cruz de la Sierra', 'Cochabamba', 'La Paz', 'Sucre', 'Oruro', 'Tarija', 'Potosi', 'Sacaba', 'Montero', 'Quillacollo', 'Trinidad', 'Yacuiba', 'Riberalta', 'Tiquipaya', 'Guayaramerin', 'Bermejo', 'Mizque', 'Villazon', 'Llallagua...
cities = ['Santa Cruz de la Sierra', 'Cochabamba', 'La Paz', 'Sucre', 'Oruro', 'Tarija', 'Potosi', 'Sacaba', 'Montero', 'Quillacollo', 'Trinidad', 'Yacuiba', 'Riberalta', 'Tiquipaya', 'Guayaramerin', 'Bermejo', 'Mizque', 'Villazon', 'Llallagua', 'Camiri', 'Cobija', 'San Borja', 'San Ignacio de Velasco', 'Tupiza', 'Warn...
while(True): try: n = int(input()) if(n==2002): print("Acesso Permitido") break else: print("Senha Invalida") except EOFError: break
while True: try: n = int(input()) if n == 2002: print('Acesso Permitido') break else: print('Senha Invalida') except EOFError: break
class Person: def __init__(self, name, age): self.name = name self.age = age def __repr__(self): return f'Person(name={self.name}, age={self.age}' def __eq__(self, other): if isinstance(other, Person): return self.name == other.name and self.age == other.age ...
class Person: def __init__(self, name, age): self.name = name self.age = age def __repr__(self): return f'Person(name={self.name}, age={self.age}' def __eq__(self, other): if isinstance(other, Person): return self.name == other.name and self.age == other.age ...
# Author : Salim Suprayogi # Ref : freeCodeCamp.org ( youtube ) def translate(phrase): "mengganti huruf tertentu" translation = "" # loop for letter in phrase: # cek apakah ada huruf AEIOUaeiou # jika ada ganti dengan huruf "g" if letter.lower() in "aeiou": ...
def translate(phrase): """mengganti huruf tertentu""" translation = '' for letter in phrase: if letter.lower() in 'aeiou': if letter.isupper(): translation = translation + 'G' else: translation = translation + 'g' else: tran...
# -*- coding: utf-8 -*- ''' File name: code\prime_subset_sums\sol_249.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #249 :: Prime Subset Sums # # For more information see: # https://projecteuler.net/problem=249 # Problem Statement '''...
""" File name: code\\prime_subset_sums\\sol_249.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nLet S = {2, 3, 5, ..., 4999} be the set of prime numbers less than 5000.\nFind the number of subsets of S, the sum of whose elements is a prime number.\nEnter the rightmost 16 di...
#!/bin/python3 DIRECTIONS = { 'n': (0, -1), 's': (0, 1), 'e': (1, 0), 'w': (-1, 0), } def get_route(preferred_direction): x_pos, y_pos = preferred_direction return [ preferred_direction, (y_pos, x_pos), (-y_pos, -x_pos), (-x_pos, -y_pos) ] class Boar...
directions = {'n': (0, -1), 's': (0, 1), 'e': (1, 0), 'w': (-1, 0)} def get_route(preferred_direction): (x_pos, y_pos) = preferred_direction return [preferred_direction, (y_pos, x_pos), (-y_pos, -x_pos), (-x_pos, -y_pos)] class Board(object): def __init__(self, size): self._array = [[0] * size fo...
class Solution(object): def isUgly(self, num): """ :type num: int :rtype: bool """ if num < 1: return False bad_factors = (2, 3, 5, ) stack = [num] while len(stack) > 0: x = stack.pop() if x ...
class Solution(object): def is_ugly(self, num): """ :type num: int :rtype: bool """ if num < 1: return False bad_factors = (2, 3, 5) stack = [num] while len(stack) > 0: x = stack.pop() if x == 1: ret...
""" 349. Intersection of Two Arrays Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. """ # binary search class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ ...
""" 349. Intersection of Two Arrays Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. """ class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ nums1.sort() nums2...
class FriendshipsStorage(object): def __init__(self): self.friendships = [] def add(self, note): pass def clear(self): pass def get_friends_of(self, name): pass
class Friendshipsstorage(object): def __init__(self): self.friendships = [] def add(self, note): pass def clear(self): pass def get_friends_of(self, name): pass
class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: anagrams = {} for i in range(len(strs)): x= ''.join(sorted(strs[i])) if x not in anagrams: anagrams[x]=[strs[i]] else: anagrams[x].append(strs[i]) ...
class Solution: def group_anagrams(self, strs: List[str]) -> List[List[str]]: anagrams = {} for i in range(len(strs)): x = ''.join(sorted(strs[i])) if x not in anagrams: anagrams[x] = [strs[i]] else: anagrams[x].append(strs[i]) ...
# 350111 # a3_p10.py # Irakli Mtvarelishvili # i.mtvarelisvhili@jacobs-university.de n = int(input("Please enter the length of rectangle: ")) m = int(input("Please enter the width of rectangle: ")) c = chr(ord(input("Please enter a character: "))) def print_rectangle(n, m, c): for i in range(m) : ...
n = int(input('Please enter the length of rectangle: ')) m = int(input('Please enter the width of rectangle: ')) c = chr(ord(input('Please enter a character: '))) def print_rectangle(n, m, c): for i in range(m): for j in range(n): if i == 0 or i == m - 1: print(c, end='') ...
# yacctab.py # This file is automatically generated. Do not edit. _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMOD_BOOL _COMPLEX AUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUB...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMOD_BOOL _COMPLEX AUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EXTERN FLOAT FOR GOTO IF INLINE INT LONG REGISTER OFFSET...
""" A Trie/Prefix Tree is a kind of search tree used to provide quick lookup of words/patterns in a set of words. A basic Trie however has O(n^2) space complexity making it impractical in practice. It however provides O(max(search_string, length of longest word)) lookup time making it an optimal approach when space is ...
""" A Trie/Prefix Tree is a kind of search tree used to provide quick lookup of words/patterns in a set of words. A basic Trie however has O(n^2) space complexity making it impractical in practice. It however provides O(max(search_string, length of longest word)) lookup time making it an optimal approach when space is ...
''' write a procedure, called how_many, which returns the sum of the number of values associated with a dictionary ''' def how_many(aDict): ''' aDict: A dictionary, where all the values are lists. returns: int, how many values are in the dictionary. ''' values = 0 for i in aDict: values...
""" write a procedure, called how_many, which returns the sum of the number of values associated with a dictionary """ def how_many(aDict): """ aDict: A dictionary, where all the values are lists. returns: int, how many values are in the dictionary. """ values = 0 for i in aDict: value...
# Solution to [Check Subset](https://www.hackerrank.com/challenges/py-check-subset) def get_set() -> set: """returns set""" _ = input() return set(map(int, input().split())) def main(): for _ in range(int(input())): set_a = get_set() set_b = get_set() a_not_b = set_a.differenc...
def get_set() -> set: """returns set""" _ = input() return set(map(int, input().split())) def main(): for _ in range(int(input())): set_a = get_set() set_b = get_set() a_not_b = set_a.difference(set_b) print(False if a_not_b else True) if __name__ == '__main__': main...
def diameter_of_binary_tree(root): return diameter_of_binary_tree_func(root)[1] def diameter_of_binary_tree_func(root): """ Diameter for a particular BinaryTree Node will be: 1. Either diameter of left subtree 2. Or diameter of a right subtree 3. Sum of left-height and right-hei...
def diameter_of_binary_tree(root): return diameter_of_binary_tree_func(root)[1] def diameter_of_binary_tree_func(root): """ Diameter for a particular BinaryTree Node will be: 1. Either diameter of left subtree 2. Or diameter of a right subtree 3. Sum of left-height and right-height ...
debian_os = ['debian', 'ubuntu'] rhel_os = ['redhat', 'centos'] def test_repo_file(host): f = None if host.system_info.distribution.lower() in debian_os: f = host.file('/etc/apt/sources.list.d/powerdns-rec-42.list') if host.system_info.distribution.lower() in rhel_os: f = host.file('/etc/...
debian_os = ['debian', 'ubuntu'] rhel_os = ['redhat', 'centos'] def test_repo_file(host): f = None if host.system_info.distribution.lower() in debian_os: f = host.file('/etc/apt/sources.list.d/powerdns-rec-42.list') if host.system_info.distribution.lower() in rhel_os: f = host.file('/etc/yu...
class Empty(object): def __bool__(self): return False def __nonzero__(self): return False empty = Empty()
class Empty(object): def __bool__(self): return False def __nonzero__(self): return False empty = empty()
# -*- coding: utf-8 -*- """Provides all the data related to text.""" SAFE_COLORS = [ "#1abc9c", "#16a085", "#2ecc71", "#27ae60", "#3498db", "#2980b9", "#9b59b6", "#8e44ad", "#34495e", "#2c3e50", "#f1c40f", "#f39c12", "#e67e22", "#d35400", "#e74c3c", "#c0...
"""Provides all the data related to text.""" safe_colors = ['#1abc9c', '#16a085', '#2ecc71', '#27ae60', '#3498db', '#2980b9', '#9b59b6', '#8e44ad', '#34495e', '#2c3e50', '#f1c40f', '#f39c12', '#e67e22', '#d35400', '#e74c3c', '#c0392b', '#ecf0f1', '#bdc3c7', '#95a5a6', '#7f8c8d']
""" Pipeline defines all steps required by an algorithm to obtain predictions. Pipelines are typically a chain of sklearn compatible transformers and end with an sklearn compatible estimator. """
""" Pipeline defines all steps required by an algorithm to obtain predictions. Pipelines are typically a chain of sklearn compatible transformers and end with an sklearn compatible estimator. """
# Network parameters IMAGE_WIDTH = 84 IMAGE_HEIGHT = 84 NUM_CHANNELS = 4 # dqn inputs 4 image at same time as state
image_width = 84 image_height = 84 num_channels = 4
class MyCircularDeque: def __init__(self, k: int): """ Initialize your data structure here. Set the size of the deque to be k. """ self.nums = [0] * k self.k = k self.size = 0 self.front = -1 self.back = 0 def insertFront(self, value: in...
class Mycirculardeque: def __init__(self, k: int): """ Initialize your data structure here. Set the size of the deque to be k. """ self.nums = [0] * k self.k = k self.size = 0 self.front = -1 self.back = 0 def insert_front(self, value: int) -> bo...
""" Name: Josh Hickman Pawprint: hickmanjv Assignment: Challenge: Cipher Date: 04/17/20 """ # Cipher based on assignment requirements CIPHER = {'a' : '0', 'b' : '1', 'c' : '2', 'd' : '3', 'e' : '4', 'f' : '5', 'g' : '6', 'h' : '7', 'i' : '8', 'j' : '9', 'k' : '!', 'l' : '@', 'm' : '#', 'n' : '$', 'o' : '%', 'p' ...
""" Name: Josh Hickman Pawprint: hickmanjv Assignment: Challenge: Cipher Date: 04/17/20 """ cipher = {'a': '0', 'b': '1', 'c': '2', 'd': '3', 'e': '4', 'f': '5', 'g': '6', 'h': '7', 'i': '8', 'j': '9', 'k': '!', 'l': '@', 'm': '#', 'n': '$', 'o': '%', 'p': '^', 'q': '&', 'r': '*', 's': '(', 't': ')', 'u': '-', 'v': '+'...
def parse_input(raw_input): return [ # strip multiline strings when testing [line.strip() for line in group.split('\n')] for group in raw_input.split('\n\n') ] with open('inputs/input6.txt') as file: input6 = parse_input(file.read()) def count_any_yeses(groups): return sum( ...
def parse_input(raw_input): return [[line.strip() for line in group.split('\n')] for group in raw_input.split('\n\n')] with open('inputs/input6.txt') as file: input6 = parse_input(file.read()) def count_any_yeses(groups): return sum((len(set(''.join(g))) for g in groups)) def count_every_yeses(groups): ...
game_name = input("The name of the game:") num_timesteps = input("The num of timesteps:") total_gpu_num = 3 gpu_use_index = 0 print('conda activate openaivezen; cd baselines; ' + 'CUDA_VISIBLE_DEVICES={} '.format(gpu_use_index) + 'python -m baselines.run --alg=deepq ' + '--env={}NoFrameskip-v4 --num...
game_name = input('The name of the game:') num_timesteps = input('The num of timesteps:') total_gpu_num = 3 gpu_use_index = 0 print('conda activate openaivezen; cd baselines; ' + 'CUDA_VISIBLE_DEVICES={} '.format(gpu_use_index) + 'python -m baselines.run --alg=deepq ' + '--env={}NoFrameskip-v4 --num_timesteps={} '.form...
print(" Calculator \n") print(" ") num1 = float(input("Please enter your first number: ")) op = input("Please enter your o...
print(' Calculator \n') print(' ') num1 = float(input('Please enter your first number: ')) op = input('Please enter your operat...
class PrimesBelow: def __init__(self, bound): self.candidate_numbers = list(range(2,bound)) def __iter__(self): return self def __next__(self): if len(self.candidate_numbers) == 0: raise StopIteration next_prime = self.candidate_numbers...
class Primesbelow: def __init__(self, bound): self.candidate_numbers = list(range(2, bound)) def __iter__(self): return self def __next__(self): if len(self.candidate_numbers) == 0: raise StopIteration next_prime = self.candidate_numbers[0] self.candida...
# -*- coding: utf-8 -*- def Mag_V_L(I, RL, Ro, w, C): return I * (1/(1/RL + 1/Ro)) / (1 + (w * (1/(1/RL + 1/Ro)) * C)**2)**.5 def Mag_I_L(I, RL, Ro, w, C): I_L = 1 / RL * I / (1 / Ro + 1 / RL + 1j * w * C) return abs(I_L) def Z_o_from_VLa_VLb(RLa, RLb, VLa, VLb): Z_o = (RLa * RLb * (VLb - VLa)) / (VLa * RL...
def mag_v_l(I, RL, Ro, w, C): return I * (1 / (1 / RL + 1 / Ro)) / (1 + (w * (1 / (1 / RL + 1 / Ro)) * C) ** 2) ** 0.5 def mag_i_l(I, RL, Ro, w, C): i_l = 1 / RL * I / (1 / Ro + 1 / RL + 1j * w * C) return abs(I_L) def z_o_from_v_la_v_lb(RLa, RLb, VLa, VLb): z_o = RLa * RLb * (VLb - VLa) / (VLa * RLb ...
# Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! version = '9.6.beta6' date = '2022-03-27' banner = 'SageMath version 9.6.beta6, Release Date: 2022-03-27'
version = '9.6.beta6' date = '2022-03-27' banner = 'SageMath version 9.6.beta6, Release Date: 2022-03-27'
w_dic = {'example': 'eg', 'Example': 'eg', 'important': 'imp', 'Important': 'Imp', 'mathematics': 'math', 'Mathematics': 'Math', 'algorithm': 'algo', 'Algorithm': 'Algo', 'frequency': 'freq', 'Frequency': 'Freq', 'input': 'i/p', 'Input': 'i/p', 'output': 'o/p', 'Output': 'o/p',...
w_dic = {'example': 'eg', 'Example': 'eg', 'important': 'imp', 'Important': 'Imp', 'mathematics': 'math', 'Mathematics': 'Math', 'algorithm': 'algo', 'Algorithm': 'Algo', 'frequency': 'freq', 'Frequency': 'Freq', 'input': 'i/p', 'Input': 'i/p', 'output': 'o/p', 'Output': 'o/p', 'software': 's/w', 'Software': 's/w', 'ha...
# -*- coding: utf-8 -*- """ meraki_sdk This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ). """ class UpdateOrganizationBrandingPoliciesPrioritiesModel(object): """Implementation of the 'updateOrganizationBrandingPoliciesPriorities' model. TODO: t...
""" meraki_sdk This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ). """ class Updateorganizationbrandingpoliciesprioritiesmodel(object): """Implementation of the 'updateOrganizationBrandingPoliciesPriorities' model. TODO: type model description here. Attribu...
class Edge: def __init__(self, dest, capa): self.dest = dest self.capa = capa self.rmng = capa class Node: def __init__(self, name, level=0, edges=None): self.name = name self.level = level if edges is None: self.edges = [] def add_edge(self, de...
class Edge: def __init__(self, dest, capa): self.dest = dest self.capa = capa self.rmng = capa class Node: def __init__(self, name, level=0, edges=None): self.name = name self.level = level if edges is None: self.edges = [] def add_edge(self, d...
def insertion_sort(lst): """Returns a sorted array. A provided list will be sorted out of place. Returns a new list sorted smallest to largest.""" for i in range (1, len(lst)): current_idx = i temp_vlaue = lst[i] while current_idx > 0 and lst[current_idx - 1] > temp_vlaue: ...
def insertion_sort(lst): """Returns a sorted array. A provided list will be sorted out of place. Returns a new list sorted smallest to largest.""" for i in range(1, len(lst)): current_idx = i temp_vlaue = lst[i] while current_idx > 0 and lst[current_idx - 1] > temp_vlaue: ...
src = Split(''' cli.c dumpsys.c ''') component = aos_component('cli', src) component.add_component_dependencis('kernel/hal') component.add_global_macro('HAVE_NOT_ADVANCED_FORMATE') component.add_global_macro('CONFIG_AOS_CLI') component.add_global_includes('include')
src = split('\n cli.c \n dumpsys.c\n') component = aos_component('cli', src) component.add_component_dependencis('kernel/hal') component.add_global_macro('HAVE_NOT_ADVANCED_FORMATE') component.add_global_macro('CONFIG_AOS_CLI') component.add_global_includes('include')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 16 10:32:58 2019 @author: allen """
""" Created on Mon Sep 16 10:32:58 2019 @author: allen """
# USITTAsciiParser # # by Claude Heintz # copyright 2014 by Claude Heintz Design # # see license included with this distribution or # https://www.claudeheintzdesign.com/lx/opensource.html ##### This is an abstract class for parsing strings to extract # data formatted as specified in: # # ASCII Text Represen...
class Usittasciiparser: end_data = -1 no_primary = 0 cue_collect = 1 group_collect = 2 sub_collect = 3 mfg_collect = 5 def __init__(self): self.line = 0 self.state = USITTAsciiParser.NO_PRIMARY self.startedLine = False self.tokens = [] self.cstring = ...