content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def encode_structure_fold(fold, tree):
def encode_node(node):
if node.is_leaf():
return fold.add('boxEncoder', node.box)
elif node.is_adj():
left = encode_node(node.left)
right = encode_node(node.right)
return fold.add('adjEncoder', left, right)
... | def encode_structure_fold(fold, tree):
def encode_node(node):
if node.is_leaf():
return fold.add('boxEncoder', node.box)
elif node.is_adj():
left = encode_node(node.left)
right = encode_node(node.right)
return fold.add('adjEncoder', left, right)
... |
# -*- coding: utf-8 -*-
class TrieNode:
def __init__(self):
self.children = {}
self.leaf = False
class Trie:
def __init__(self):
self.root = TrieNode()
def insert(self, word):
current = self.root
for char in word:
if char not in current.children:
... | class Trienode:
def __init__(self):
self.children = {}
self.leaf = False
class Trie:
def __init__(self):
self.root = trie_node()
def insert(self, word):
current = self.root
for char in word:
if char not in current.children:
current.chil... |
# dataset settings
dataset_type = 'CUB'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='Resize', size=510),
dict(type='RandomCrop', size=384),
dict(type='RandomFlip', flip_prob=0.5, direction... | dataset_type = 'CUB'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [dict(type='LoadImageFromFile'), dict(type='Resize', size=510), dict(type='RandomCrop', size=384), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', **... |
# -*- coding: utf-8 -*-
class Config:
class MongoDB:
database = "crawlib2_test"
| class Config:
class Mongodb:
database = 'crawlib2_test' |
months = "JanFebMarAprMayJunJulAugSepOctNovDec"
n = int(input("Enter month Number: "))
if (n > 0 and n < 13):
mE = (3 * n)
mA = mE - 3
print(months[mA:mE])
else:
print("falsche Zahl")
| months = 'JanFebMarAprMayJunJulAugSepOctNovDec'
n = int(input('Enter month Number: '))
if n > 0 and n < 13:
m_e = 3 * n
m_a = mE - 3
print(months[mA:mE])
else:
print('falsche Zahl') |
#!python
with open('pessoas.csv') as arquivo:
with open('pessoas.txt', 'w') as saida:
for registro in arquivo:
pessoa = registro.strip().split(',')
print('Nome:{}, Idade:{}'.format(*pessoa), file=saida)
if saida.closed:
print('Saida OK')
if arquivo.closed:
print('saida ok'... | with open('pessoas.csv') as arquivo:
with open('pessoas.txt', 'w') as saida:
for registro in arquivo:
pessoa = registro.strip().split(',')
print('Nome:{}, Idade:{}'.format(*pessoa), file=saida)
if saida.closed:
print('Saida OK')
if arquivo.closed:
print('saida ok') |
class ConfigError(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class MercuryUnsupportedService(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class MercuryConnectException(Exception):
def __init__(s... | class Configerror(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class Mercuryunsupportedservice(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class Mercuryconnectexception(Exception):
def __init__(... |
#######################################
graph={}
graph["start"]["a"]=6
graph["start"]["b"]=2
graph["a"]={}
graph["a"]["fin"]=1
graph["b"]={}
graph["b"]["a"]=3
graph["b"]["fin"]=5
graph["fin"]={}
#######################################
infinity = float("inf")
costs={}
costs["a"]=6
costs["b"]=2
costs["fin"]=infinity... | graph = {}
graph['start']['a'] = 6
graph['start']['b'] = 2
graph['a'] = {}
graph['a']['fin'] = 1
graph['b'] = {}
graph['b']['a'] = 3
graph['b']['fin'] = 5
graph['fin'] = {}
infinity = float('inf')
costs = {}
costs['a'] = 6
costs['b'] = 2
costs['fin'] = infinity
parents = {}
parents['a'] = 'start'
parents['b'] = 'start'... |
## using the return statement in python
## execute fct and give the respond back
def cube(num): ## expectin one num
return num*num*num ## allows to return value to the caller
print(cube(3)) ## return none
result = cube(4)
print(result)
| def cube(num):
return num * num * num
print(cube(3))
result = cube(4)
print(result) |
# Used when we want to process an array of requests through a chain of handlers. Respective handler processes the request depending on the value, and send the request to the successor handler if not handled at that handler.
class Handler:
def __init__(self, successor):
self.successor = successor
def ... | class Handler:
def __init__(self, successor):
self.successor = successor
def handle(self, request):
handled = self._handle(request)
if not handled:
print('-- Refering to successor,', request)
self.successor.handle(request)
def _handle(self, request):
... |
def brac_balance(expr):
stack = []
for char in expr:
if char in ["(", "{", "["]:
stack.append(char)
else:
if not stack:
return False
current_char = stack.pop()
if current_char == '(':
if char != ")":
return False
if current_char == '{':
if char != "}":
return False
if curre... | def brac_balance(expr):
stack = []
for char in expr:
if char in ['(', '{', '[']:
stack.append(char)
else:
if not stack:
return False
current_char = stack.pop()
if current_char == '(':
if char != ')':
... |
# Stack implementation
'''
Stack using python list. Use append to push an item
onto the stack and pop to remove an item
'''
my_stack = list()
my_stack.append(4)
my_stack.append(7)
my_stack.append(12)
my_stack.append(19)
print(my_stack)
print(my_stack.pop()) # 19
print(my_stack.pop()) # 12
print(my_stack) # [4,7]
| """
Stack using python list. Use append to push an item
onto the stack and pop to remove an item
"""
my_stack = list()
my_stack.append(4)
my_stack.append(7)
my_stack.append(12)
my_stack.append(19)
print(my_stack)
print(my_stack.pop())
print(my_stack.pop())
print(my_stack) |
class LED_80_64:
keySize = 64
T0 = [0x00BB00DD00AA0055, 0x00BA00D100AE0057, 0x00BC00DF00A5005B, 0x00B500D900A7005A, 0x00B100DC00A40052,
0x00B000D000A00050, 0x00B700D200AF005E, 0x00B900D600A20051, 0x00B600DE00AB005C, 0x00BF00D800A9005D,
0x00BD00D300A10059, 0x00B300D700AC0056, 0x00B800DA00... | class Led_80_64:
key_size = 64
t0 = [52636769843806293, 52355243327750231, 52918253410123867, 50947902803476570, 49822015781339218, 49540489264758864, 51510822692651102, 52073789825089617, 51229399255285852, 53762648275746909, 53199676846964825, 50384944260448342, 51792332028510291, 53481156119429215, 501034864... |
# https://leetcode.com/problems/jump-game/
class Solution:
def canJump(self, nums: list[int]) -> bool:
last = 0
for index in range(len(nums)):
if index > last:
return False
last = max(last, index + nums[index])
if last >= len(nums) - 1:
... | class Solution:
def can_jump(self, nums: list[int]) -> bool:
last = 0
for index in range(len(nums)):
if index > last:
return False
last = max(last, index + nums[index])
if last >= len(nums) - 1:
return True
return True
nums... |
def calculate(mass):
if mass < 6:
return 0
return int(mass/3-2) + calculate(int(mass/3-2))
with open("1.txt", "r") as infile:
print("First part solution: ", sum([int(int(x)/3)-2 for x in infile.readlines()]))
print("Second part solution: ", sum([calculate(int(x)) for x in infile.readlines()]))
| def calculate(mass):
if mass < 6:
return 0
return int(mass / 3 - 2) + calculate(int(mass / 3 - 2))
with open('1.txt', 'r') as infile:
print('First part solution: ', sum([int(int(x) / 3) - 2 for x in infile.readlines()]))
print('Second part solution: ', sum([calculate(int(x)) for x in infile.read... |
class Dimension:
def __init__(self, x1, y1, x2, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
@property
def width(self):
return self.x2 - self.x1
@property
def height(self):
return self.y2 - self.y1
@property
def aspect_ratio(self... | class Dimension:
def __init__(self, x1, y1, x2, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
@property
def width(self):
return self.x2 - self.x1
@property
def height(self):
return self.y2 - self.y1
@property
def aspect_ratio(sel... |
with open("../documentation/resource-doc.txt", "r") as DOC_FILE:
__doc__ = DOC_FILE.read()
def repositionItemInList(__index, __item, __list):
__list.remove(__item)
__list.insert(__index, __item)
return __list
def removeItems(__item_list, __list):
for item in __item_list:
try:
... | with open('../documentation/resource-doc.txt', 'r') as doc_file:
__doc__ = DOC_FILE.read()
def reposition_item_in_list(__index, __item, __list):
__list.remove(__item)
__list.insert(__index, __item)
return __list
def remove_items(__item_list, __list):
for item in __item_list:
try:
... |
# An example with subplots, so an array of axes is returned.
axes = df.plot.line(subplots=True)
type(axes)
# <class 'numpy.ndarray'>
| axes = df.plot.line(subplots=True)
type(axes) |
class Statistics():
def __init__(self):
self.time_cfg_constr = 0 #ok
self.time_verify = 0 #ok
self.time_smt = 0 #ok
self.time_smt_pure = 0
self.time_interp = 0 #ok
self.time_interp_pure = 0 #ok
self.time_to_lia = 0 #ok
self.time_from_lia = 0 #ok
... | class Statistics:
def __init__(self):
self.time_cfg_constr = 0
self.time_verify = 0
self.time_smt = 0
self.time_smt_pure = 0
self.time_interp = 0
self.time_interp_pure = 0
self.time_to_lia = 0
self.time_from_lia = 0
self.time_process_lia = 0
... |
class Gen:
def __init__(self, type, sequence, data_object):
self.type = type
self.sequence = sequence
self.data_object = data_object
class GenType:
CDNA = 'cdna'
DNA = 'dna'
CDS = 'cds'
class DnaType:
dna = '.dna.'
dna_sm = '.dna_sm.'
dna_rm = '.dna_rm.'
| class Gen:
def __init__(self, type, sequence, data_object):
self.type = type
self.sequence = sequence
self.data_object = data_object
class Gentype:
cdna = 'cdna'
dna = 'dna'
cds = 'cds'
class Dnatype:
dna = '.dna.'
dna_sm = '.dna_sm.'
dna_rm = '.dna_rm.' |
# Insert line numbers
in_file = open('Resources/02. Line Numbers/Input.txt', 'r').read().split('\n')
result = [str(number + 1) + '. ' + item for number, item in enumerate(in_file)][:-1]
print(*result, sep = '\n')
out_str = '\n'.join(result)
open('output/02.txt', 'w').write(out_str)
| in_file = open('Resources/02. Line Numbers/Input.txt', 'r').read().split('\n')
result = [str(number + 1) + '. ' + item for (number, item) in enumerate(in_file)][:-1]
print(*result, sep='\n')
out_str = '\n'.join(result)
open('output/02.txt', 'w').write(out_str) |
fib = lambda n: n if n <= 2 else fib(n - 1) + fib(n - 2)
'''
print(fib(10)) #89
'''
| fib = lambda n: n if n <= 2 else fib(n - 1) + fib(n - 2)
'\nprint(fib(10)) #89 \n' |
# Searvice Check Config
#### Global
DOMAIN = 'TEAM'
### HTTP
HTTP_PAGES = [
{ 'url':'', 'expected':'index.html', 'tolerance': 0.05 },
]
### HTTPS
HTTPS_PAGES = [
{ 'url':'', 'expected':'index.html', 'tolerance': 0.05 },
]
### DNS
DNS_QUERIES = [
{ 'type':'A', 'query':'team.local', 'expected':'216.239.32... | domain = 'TEAM'
http_pages = [{'url': '', 'expected': 'index.html', 'tolerance': 0.05}]
https_pages = [{'url': '', 'expected': 'index.html', 'tolerance': 0.05}]
dns_queries = [{'type': 'A', 'query': 'team.local', 'expected': '216.239.32.10'}]
ftp_files = [{'path': '/testfile.txt', 'checksum': '12345ABCDEF'}]
smb_files ... |
class FakeTwilioMessage(object):
status = 'sent'
def __init__(self, price, num_segments=1):
self.price = price
self.num_segments = str(num_segments)
def fetch(self):
return self
class FakeMessageFactory(object):
backend_message_id_to_num_segments = {}
backend_message_id_t... | class Faketwiliomessage(object):
status = 'sent'
def __init__(self, price, num_segments=1):
self.price = price
self.num_segments = str(num_segments)
def fetch(self):
return self
class Fakemessagefactory(object):
backend_message_id_to_num_segments = {}
backend_message_id_to... |
class ValueNotRequired(Exception):
pass
class RaggedListError(Exception):
pass
| class Valuenotrequired(Exception):
pass
class Raggedlisterror(Exception):
pass |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"AttStats": "att_stats.ipynb",
"Attribute": "attribute.ipynb",
"Data": "data.ipynb",
"DataScrambler": "data_scrambler.ipynb",
"configuration": "data_scrambler.ipynb",
... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'AttStats': 'att_stats.ipynb', 'Attribute': 'attribute.ipynb', 'Data': 'data.ipynb', 'DataScrambler': 'data_scrambler.ipynb', 'configuration': 'data_scrambler.ipynb', 'EntropyEvaluator': 'entropy_evaluator.ipynb', 'Instance': 'instance.ipynb', 'Pars... |
# 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' |
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... |
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... |
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) |
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) |
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édé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,))) |
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) |
# -*- 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... |
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) |
# -- 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... |
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... |
# 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 ... |
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' |
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) |
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 |
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 + '.'... |
# 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)) |
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... |
#
# 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... |
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 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 ... |
# Problem0019 - Counting Sundays
#
# https: // github.com/agileshaw/Project-Euler
def totalDays(month, year):
month_list = [4, 6, 9, 11]
if month == 2:
if year % 400 == 0 or ((year % 4 == 0) and year % 100 != 0):
return 29
else:
return 28
elif month in month_list:
... | def total_days(month, year):
month_list = [4, 6, 9, 11]
if month == 2:
if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
return 29
else:
return 28
elif month in month_list:
return 30
return 31
if __name__ == '__main__':
count = 0
weekday =... |
class CraftParser:
@staticmethod
def calculate_mass(craft_filepath: str, masses: dict) -> int:
parts = []
craft_lines = []
with open(craft_filepath) as craft:
craft_lines = [line.strip() for line in craft.readlines()]
for index, line in enumerate(craft_lines):
if "part = " in line:
... | class Craftparser:
@staticmethod
def calculate_mass(craft_filepath: str, masses: dict) -> int:
parts = []
craft_lines = []
with open(craft_filepath) as craft:
craft_lines = [line.strip() for line in craft.readlines()]
for (index, line) in enumerate(craft_lines):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.