content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# MODFLOW 6 version file automatically created using...make_release.py
# created on...February 18, 2021 08:23:34
major = 6
minor = 2
micro = 1
__version__ = '{:d}.{:d}.{:d}'.format(major, minor, micro)
| major = 6
minor = 2
micro = 1
__version__ = '{:d}.{:d}.{:d}'.format(major, minor, micro) |
def getFuel(data):
return [int(s) for s in data.split("\n")]
def fuelbois(n):
return (n // 3) - 2
def part1(data):
return sum(map(fuelbois, getFuel(data)))
def part2(data):
return sum(map(doTheThing, getFuel(data)))
def doTheThing(n):
s = fuelbois(n)
if s <= 0:
return 0
retur... | def get_fuel(data):
return [int(s) for s in data.split('\n')]
def fuelbois(n):
return n // 3 - 2
def part1(data):
return sum(map(fuelbois, get_fuel(data)))
def part2(data):
return sum(map(doTheThing, get_fuel(data)))
def do_the_thing(n):
s = fuelbois(n)
if s <= 0:
return 0
return... |
class Sidelink:
def __init__(self, name, link, subtitle, http=False, css_classes='sidelink', onclick=''):
self.name = name
self.link = link
self.subtitle = subtitle
self.http = http
self.css_classes = css_classes
self.onclick = onclick
cl... | class Sidelink:
def __init__(self, name, link, subtitle, http=False, css_classes='sidelink', onclick=''):
self.name = name
self.link = link
self.subtitle = subtitle
self.http = http
self.css_classes = css_classes
self.onclick = onclick
class Sidebar:
def __init... |
class InvalidNoteException(Exception):
pass
class InvalidModeException(Exception):
pass
class InvalidChord(Exception):
pass
| class Invalidnoteexception(Exception):
pass
class Invalidmodeexception(Exception):
pass
class Invalidchord(Exception):
pass |
# Middlewares
# https://docs.djangoproject.com/en/3.0/topics/http/middleware/
MIDDLEWARE = [
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middle... | middleware = ['whitenoise.middleware.WhiteNoiseMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.mid... |
# Copyright (c) 2016 EMC Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | class Storopsexception(Exception):
message = 'Storops Error.'
class Vnxexception(StoropsException):
message = 'VNX Error.'
class Vnxstoragegrouperror(VNXException):
pass
class Vnxattachaluerror(VNXException):
pass
class Vnxalualreadyattachederror(VNXAttachAluError):
message = ('LUN already exist... |
#-------------------------------------------------------------------------------
# Name: Signals types (voltage and current)
# Author: d.Fathi
# Created: 31/03/2020
# Modified: 19/09/2021
# Copyright: (c) PyAMS 2020
# Licence: unlicense
#--------------------------------------------------... | voltage = {'discipline': 'electrical', 'nature': 'potential', 'abstol': 1e-08, 'chgtol': 1e-14, 'signalType': 'voltage', 'unit': 'V'}
current = {'discipline': 'electrical', 'nature': 'flow', 'abstol': 1e-08, 'chgtol': 1e-14, 'signalType': 'voltage', 'unit': 'A'}
electrical = {'potential': voltage, 'flow': current} |
# Replaced with the current commit when building the wheels.
__commit__ = "{{CLOUDTIK_COMMIT_SHA}}"
__version__ = "0.9.0"
| __commit__ = '{{CLOUDTIK_COMMIT_SHA}}'
__version__ = '0.9.0' |
def configure(conf):
conf.env.ARCHITECTURE = 'mips'
conf.env.VALID_ARCHITECTURES = ['mips']
conf.env.ARCH_FAMILY = 'mips'
conf.env.ARCH_LP64 = False
conf.env.append_unique('DEFINES', ['_MIPS'])
| def configure(conf):
conf.env.ARCHITECTURE = 'mips'
conf.env.VALID_ARCHITECTURES = ['mips']
conf.env.ARCH_FAMILY = 'mips'
conf.env.ARCH_LP64 = False
conf.env.append_unique('DEFINES', ['_MIPS']) |
s=[1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,... | s = [1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... |
# encoding: utf-8
# module perfmon
# from C:\Python27\lib\site-packages\win32\perfmon.pyd
# by generator 1.147
# no doc
# no imports
# functions
def CounterDefinition(*args, **kwargs): # real signature unknown
pass
def LoadPerfCounterTextStrings(*args, **kwargs): # real signature unknown
pass
def ObjectType... | def counter_definition(*args, **kwargs):
pass
def load_perf_counter_text_strings(*args, **kwargs):
pass
def object_type(*args, **kwargs):
pass
def perf_mon_manager(*args, **kwargs):
pass
def unload_perf_counter_text_strings(*args, **kwargs):
pass |
temperatura_celsus = 0
def convert_celsus(temperatura_celsus):
celsus = ((temperatura_celsus - 32) / 1.8)
return celsus
print(convert_celsus(100))
| temperatura_celsus = 0
def convert_celsus(temperatura_celsus):
celsus = (temperatura_celsus - 32) / 1.8
return celsus
print(convert_celsus(100)) |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def hasCycle(self, head: Optional[ListNode]) -> bool:
## without using any set
## Floyd's Tortoise and Hare method
## https://www.yo... | class Solution:
def has_cycle(self, head: Optional[ListNode]) -> bool:
(slow, fast) = (head, head)
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if slow == fast:
return True
return False
val_pos = set()
w... |
#question 2
#generate the series
#3 8 14 22 34 53 83 129 197 294
print("Enter the lenght of the series:")
seriesLength =int(input())
s1,s2,s3 = 1,5,3
gen_series = []
for itr in range(1,seriesLength):
gen_series.append(s3)
s3 += s2
s2 += s1
s1 += itr
result = (str(gen_series).replace(',','... | print('Enter the lenght of the series:')
series_length = int(input())
(s1, s2, s3) = (1, 5, 3)
gen_series = []
for itr in range(1, seriesLength):
gen_series.append(s3)
s3 += s2
s2 += s1
s1 += itr
result = str(gen_series).replace(',', ' ')[1:-1]
print(result) |
my_name = "Juan Manuel Young Hoyos"
print(my_name[0])
# * Both of them are equal
print(my_name[0:3])
print(my_name[:3])
# * Both of them are equal
print(my_name[1:len(my_name)])
print(my_name[1:])
# * Slicing with steps
print(my_name[1:len(my_name):2])
# * It brings me everything
print(my_name[::])
| my_name = 'Juan Manuel Young Hoyos'
print(my_name[0])
print(my_name[0:3])
print(my_name[:3])
print(my_name[1:len(my_name)])
print(my_name[1:])
print(my_name[1:len(my_name):2])
print(my_name[:]) |
settlement = "ISHUV"
street1="REHOV1"
street2="REHOV2"
road1="KVISH1"
road2="KVISH2"
junction_name = "SHEM_ZOMET"
settlement_sign = "SEMEL_YISHUV"
street_sign = "SEMEL_RECHOV"
street_name = "SHEM_RECHOV"
table_number = "MS_TAVLA"
code = "KOD"
name = "NAME"
sign = "SEMEL"
urban_intersection="ZOMET_IRONI"
non_urban_inter... | settlement = 'ISHUV'
street1 = 'REHOV1'
street2 = 'REHOV2'
road1 = 'KVISH1'
road2 = 'KVISH2'
junction_name = 'SHEM_ZOMET'
settlement_sign = 'SEMEL_YISHUV'
street_sign = 'SEMEL_RECHOV'
street_name = 'SHEM_RECHOV'
table_number = 'MS_TAVLA'
code = 'KOD'
name = 'NAME'
sign = 'SEMEL'
urban_intersection = 'ZOMET_IRONI'
non_u... |
'''
Class that maps to the JSON TokenInfo
'''
class MTTokenInfo():
v = None
code = None
code_desc = None
token_id = None
timestamp_sec = None
timestamp_iso = None
hostname = None
is_dev_host = None
action = None
ip = None
def __init__(self, v: str, code: int, codeDesc: st... | """
Class that maps to the JSON TokenInfo
"""
class Mttokeninfo:
v = None
code = None
code_desc = None
token_id = None
timestamp_sec = None
timestamp_iso = None
hostname = None
is_dev_host = None
action = None
ip = None
def __init__(self, v: str, code: int, codeDesc: str, t... |
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
# O(N)
for idx, t in enumerate(numbers):
targ = target - t
# O(logN)
left, right = 0, len(numbers) - 1
ans = []
while left <= right:
mid = left... | class Solution:
def two_sum(self, numbers: List[int], target: int) -> List[int]:
for (idx, t) in enumerate(numbers):
targ = target - t
(left, right) = (0, len(numbers) - 1)
ans = []
while left <= right:
mid = left + (right - left) // 2
... |
class Sorter:
def __init__(self, group):
self.group = group
self.found = False
def __call__(self, x):
if x in self.group:
self.found = True
return (0, x)
return (1, x)
| class Sorter:
def __init__(self, group):
self.group = group
self.found = False
def __call__(self, x):
if x in self.group:
self.found = True
return (0, x)
return (1, x) |
## Exceptions
__all__ = ['PyDSTool_Error', 'PyDSTool_BoundsError', 'PyDSTool_KeyError',
'PyDSTool_UncertainValueError', 'PyDSTool_TypeError',
'PyDSTool_ExistError', 'PyDSTool_AttributeError',
'PyDSTool_ValueError', 'PyDSTool_UndefinedError',
'PyDSTool_InitError', 'PyDS... | __all__ = ['PyDSTool_Error', 'PyDSTool_BoundsError', 'PyDSTool_KeyError', 'PyDSTool_UncertainValueError', 'PyDSTool_TypeError', 'PyDSTool_ExistError', 'PyDSTool_AttributeError', 'PyDSTool_ValueError', 'PyDSTool_UndefinedError', 'PyDSTool_InitError', 'PyDSTool_ClearError', 'PyDSTool_ContError']
class Pydstool_Error(Exc... |
def modpower(x,y,mod):
ans = 1
x = x % mod
while y:
if ((y & 1) == 1) :
ans = (ans * x) % mod
y = y >> 1
x = (x * x) % mod
return ans
T=int(input())
for tt in range(1,T+1):
N,K=[int(x) for x in input().split()]
S=input()
copyS=list(S)
total=0
M... | def modpower(x, y, mod):
ans = 1
x = x % mod
while y:
if y & 1 == 1:
ans = ans * x % mod
y = y >> 1
x = x * x % mod
return ans
t = int(input())
for tt in range(1, T + 1):
(n, k) = [int(x) for x in input().split()]
s = input()
copy_s = list(S)
total = 0... |
#!/usr/bin/python3
##############
# Load input #
##############
rules = dict()
with open("input.txt", "r") as f:
initial_state = f.readline().strip().split(" ")[2]
f.readline()
for line in f.readlines():
rules[line.split(" => ")[0]] = line.strip().split(" => ")[1]
##############
# Solution 1 #
##... | rules = dict()
with open('input.txt', 'r') as f:
initial_state = f.readline().strip().split(' ')[2]
f.readline()
for line in f.readlines():
rules[line.split(' => ')[0]] = line.strip().split(' => ')[1]
current_state = '....' + initial_state + '....'
for step in range(20):
new_state = ''
for i... |
a = int(input("Please enter the first number: "))
b = int(input("Please enter the second number: "))
count = 0
for i in range(a, b + 1):
if i % 2 == 0:
count += i
print(count) | a = int(input('Please enter the first number: '))
b = int(input('Please enter the second number: '))
count = 0
for i in range(a, b + 1):
if i % 2 == 0:
count += i
print(count) |
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: domainbounds.py
#
# Tests: libsim - connecting to simulation and retrieving data from it.
# mesh - 3D rectilinear mesh
#
# Programmer: Kathleen Biagas
# Date: June 17, 2014
#... | sim = test_simulation('domainbounds', 'domainbounds.sim2')
(started, connected) = test_sim_start_and_connect('domainbounds00', sim)
if connected:
test_sim_meta_data('domainbounds01', sim.metadata())
add_plot('Subset', 'Domains')
draw_plots()
v = get_view3_d()
v.viewNormal = (0.672727, 0.569817, 0.47... |
__author__ = 'Devon Evans dle4qw'
def main():
greeting('hello')
def greeting(msg):
print(msg)
if __name__=='__main__': main() | __author__ = 'Devon Evans dle4qw'
def main():
greeting('hello')
def greeting(msg):
print(msg)
if __name__ == '__main__':
main() |
## emails ##
from_email = ""
to_email = ""
smtp = "" | from_email = ''
to_email = ''
smtp = '' |
class Item:
'''
Component defines entity as an item
'''
def __init__(self, use_function=None, targeting=False, targeting_message=None, **kwargs):
self.use_function = use_function
self.targeting = targeting
self.targeting_message = targeting_message
self.function_kwargs = ... | class Item:
"""
Component defines entity as an item
"""
def __init__(self, use_function=None, targeting=False, targeting_message=None, **kwargs):
self.use_function = use_function
self.targeting = targeting
self.targeting_message = targeting_message
self.function_kwargs =... |
# # # "3 is not equal to 5".
# Save the above proposition in ans1 using the # # == or != operator.
# # ans1 = None
# # # "21 is a number greater than 5*10."
# Save the above proposition in ans2 using # # # or < operator.
# # ans2 = None
# # # "5/3 share is greater than or equal to 1".
# Save the above proposition in... | ans1 = 1 != 0
ans2 = 2 < 1
ans3 = 2 <= 3
print(ans1, ans2, ans3) |
#Configuration details of user
uname = "Guru HariHaraun"
email = "guru@gmail.com"
district_id = 560 # The 506 is the district code for trichy.
vaccine_type = "COVAXIN" # Either user COVISHIED or COVAXIN All should be in UPPERCASE
fee_type ="Free" # The fee type should be Paid or Free All should be in UPPERCASE
a... | uname = 'Guru HariHaraun'
email = 'guru@gmail.com'
district_id = 560
vaccine_type = 'COVAXIN'
fee_type = 'Free'
age_limit = 45
attempt = 1
wait_time = 300
smtp_server = 'smtp.gmail.com'
smtp_port = 587
smtp_user_name = 'test@gmail.com'
smtp_password = 'qwerty@1234'
is_user_notified = 0
available_flag_break = 0 |
# A P I - K E Y S
# ---------------
keys = ['XXXX']
# S F T P - S E R V E R
# ---------------------
hostname = 'XXXX'
username = 'XXXX'
password = 'XXXX'
path = 'XXXX'
# P O R T - C O D E
#------------------
port_num = 'XXXX' | keys = ['XXXX']
hostname = 'XXXX'
username = 'XXXX'
password = 'XXXX'
path = 'XXXX'
port_num = 'XXXX' |
'''
Author: Justin Muirhead
'''
room = 0
rooms = [
'Hall', 'Hall2', 'Courtyard', 'Hall3', 'Kitchen', 'Hall4', 'Hall5',
'Bedroom', 'CheeseRoom'
]
desc = [
'Hall with carpet', 'Hall with paintings', 'Courtyard with paving stones',
'Hallway with plants', 'Kitchen has old moldy food',
'Hallway has ra... | """
Author: Justin Muirhead
"""
room = 0
rooms = ['Hall', 'Hall2', 'Courtyard', 'Hall3', 'Kitchen', 'Hall4', 'Hall5', 'Bedroom', 'CheeseRoom']
desc = ['Hall with carpet', 'Hall with paintings', 'Courtyard with paving stones', 'Hallway with plants', 'Kitchen has old moldy food', 'Hallway has rat droppings', 'Hallway has... |
def main():
n = int(input())
*s, = map(int, input().split())
*t, = map(int, input().split())
inf = 1 << 60
for i in range(2 * n):
i %= n
j = (i + 1) % n
t[j] = min(
t[j],
t[i] + s[i],
)
print(*t, sep='\n')
main()
| def main():
n = int(input())
(*s,) = map(int, input().split())
(*t,) = map(int, input().split())
inf = 1 << 60
for i in range(2 * n):
i %= n
j = (i + 1) % n
t[j] = min(t[j], t[i] + s[i])
print(*t, sep='\n')
main() |
inp = int(input())
sum = 0
for i in range(1, inp + 1):
sum += i
print(sum) | inp = int(input())
sum = 0
for i in range(1, inp + 1):
sum += i
print(sum) |
#!/usr/bin/env python3
if __name__ == '__main__':
mark_1 = int(input('Enter the first number: '))
mark_2 = int(input('Enter the second number: '))
mark_3 = int(input('Enter the third number: '))
mark_4 = int(input('Enter the fourth number: '))
mark_5 = int(input('Enter the fifth number: '))
... | if __name__ == '__main__':
mark_1 = int(input('Enter the first number: '))
mark_2 = int(input('Enter the second number: '))
mark_3 = int(input('Enter the third number: '))
mark_4 = int(input('Enter the fourth number: '))
mark_5 = int(input('Enter the fifth number: '))
max_mark = max([mark_1, ... |
def sieve_of_sundaram(n):
res = []
if n > 2:
res.append(2)
n = int((n - 1) / 2)
table = [0] * (n + 1)
for i in range(1, n + 1):
j = i
while (i + j + 2 * i * j) <= n:
table[i + j + 2 * i * j] = 1
j += 1
for i in range(1, n + 1):
if tabl... | def sieve_of_sundaram(n):
res = []
if n > 2:
res.append(2)
n = int((n - 1) / 2)
table = [0] * (n + 1)
for i in range(1, n + 1):
j = i
while i + j + 2 * i * j <= n:
table[i + j + 2 * i * j] = 1
j += 1
for i in range(1, n + 1):
if table[i] ==... |
class FastLRUCache(object):
__slots__ = ['__key2value', '__max_size', '__weights']
def __init__(self, max_size: int):
self.__max_size = max_size
self.__key2value = {} # key->value
self.__weights = [] # keys ordered in LRU
def __update_weight(self, key):
try:
s... | class Fastlrucache(object):
__slots__ = ['__key2value', '__max_size', '__weights']
def __init__(self, max_size: int):
self.__max_size = max_size
self.__key2value = {}
self.__weights = []
def __update_weight(self, key):
try:
self.__weights.remove(key)
exc... |
weight = int(input("enter your weight ---> " ))
unit = input("(L)bs or (K)g ---> ")
if unit.upper() == "K":
weight_lbs = weight / 0.45
print("your weight in lbs is --->", weight_lbs)
elif unit.upper() == "L":
weight_kg = weight * 0.45
print("your weight in kg is --->", weight_kg)
| weight = int(input('enter your weight ---> '))
unit = input('(L)bs or (K)g ---> ')
if unit.upper() == 'K':
weight_lbs = weight / 0.45
print('your weight in lbs is --->', weight_lbs)
elif unit.upper() == 'L':
weight_kg = weight * 0.45
print('your weight in kg is --->', weight_kg) |
while True:
correto = True
try:
expressao = input()
parenteses_aberto = []
for e in expressao:
if e == '(':
parenteses_aberto.append(e)
if e == ')':
if len(parenteses_aberto) > 0:
parenteses_aberto.pop()
else:
... | while True:
correto = True
try:
expressao = input()
parenteses_aberto = []
for e in expressao:
if e == '(':
parenteses_aberto.append(e)
if e == ')':
if len(parenteses_aberto) > 0:
parenteses_aberto.pop()
... |
# Fibannci-ser
def recur_fibo(n):
if n <= 1:
return n
else:
return(recur_fibo(n-1) + recur_fibo(n-2))
nterms = int(input("How many terms? "))
if nterms <= 0:
print("Plese enter a positive integer")
else:
print("Fibonacci sequence:")
for i in range(nterms):
pr... | def recur_fibo(n):
if n <= 1:
return n
else:
return recur_fibo(n - 1) + recur_fibo(n - 2)
nterms = int(input('How many terms? '))
if nterms <= 0:
print('Plese enter a positive integer')
else:
print('Fibonacci sequence:')
for i in range(nterms):
print(recur_fibo(i)) |
# management canister interface `aaaaa-aa`
# wrap basic interfaces provided by the management canister:
# create_canister, install_code, canister_status, etc.
class Management:
pass
| class Management:
pass |
'''
XMODEM Protocol bytes
=====================
.. data:: SOH
Indicates a packet length of 128 (X/Y)
.. data:: STX
Indicates a packet length of 1024 (X/Y)
.. data:: EOT
End of transmission (X/Y)
.. data:: ACK
Acknowledgement (X/Y)
.. data:: XON
Enable out of band flow control (Z)
.. data:: XOF... | """
XMODEM Protocol bytes
=====================
.. data:: SOH
Indicates a packet length of 128 (X/Y)
.. data:: STX
Indicates a packet length of 1024 (X/Y)
.. data:: EOT
End of transmission (X/Y)
.. data:: ACK
Acknowledgement (X/Y)
.. data:: XON
Enable out of band flow control (Z)
.. data:: XOF... |
def countingSort(arr):
n = len(arr)
max_of_arr = max(arr)
count = [0 for i in range(max_of_arr+1)]
for i in arr:
count[i] += 1
ind = 0
for i in range(max_of_arr+1):
c = count[i]
while c:
arr[ind] = i
ind += 1
c -= 1
return arr
n = ... | def counting_sort(arr):
n = len(arr)
max_of_arr = max(arr)
count = [0 for i in range(max_of_arr + 1)]
for i in arr:
count[i] += 1
ind = 0
for i in range(max_of_arr + 1):
c = count[i]
while c:
arr[ind] = i
ind += 1
c -= 1
return arr
... |
# data config
trainroot = '/data2/dataset/ICD15/train'
testroot = '/data2/dataset/ICD15/test'
output_dir = 'output/east_icd15'
data_shape = 512
# train config
gpu_id = '2'
workers = 12
start_epoch = 0
epochs = 600
lr = 0.0001
lr_decay_step = 10000
lr_gamma = 0.94
train_batch_size_per_gpu = 14
i... | trainroot = '/data2/dataset/ICD15/train'
testroot = '/data2/dataset/ICD15/test'
output_dir = 'output/east_icd15'
data_shape = 512
gpu_id = '2'
workers = 12
start_epoch = 0
epochs = 600
lr = 0.0001
lr_decay_step = 10000
lr_gamma = 0.94
train_batch_size_per_gpu = 14
init_type = 'xavier'
display_interval = 10
show_images_... |
SERVER_HOST_1 = "127.0.0.1"
SERVER_PORT_1 = 2779
SERVER_HOST_2 = "127.0.0.1"
SERVER_PORT_2 = 2775
| server_host_1 = '127.0.0.1'
server_port_1 = 2779
server_host_2 = '127.0.0.1'
server_port_2 = 2775 |
class Texture(object):
def __init__(self):
self.file_path = None
self.file = None
self.data = None
def read(self, files):
for file_path in files:
self.file_path = file_path
self.file = open(self.file_path, "rb")
self.data = self.file.read()
... | class Texture(object):
def __init__(self):
self.file_path = None
self.file = None
self.data = None
def read(self, files):
for file_path in files:
self.file_path = file_path
self.file = open(self.file_path, 'rb')
self.data = self.file.read()
... |
class Flight:
counter = 1
def __init__(self, origin, destination, duration):
# Keep track of id number
self.id = Flight.counter
Flight.counter += 1
# Keep track of passengers
self.passengers = []
# Details about flight
self.origin = origin
sel... | class Flight:
counter = 1
def __init__(self, origin, destination, duration):
self.id = Flight.counter
Flight.counter += 1
self.passengers = []
self.origin = origin
self.destination = destination
self.duration = duration
def print_info(self):
print(f'... |
### Model Architecture hyper parameters
embedding_size = 32
# sequence_length = 500
sequence_length = 33
LSTM_units = 128
### Training parameters
batch_size = 64
epochs = 20
### Preprocessing parameters
# words that occur less than n times to be deleted from dataset
N = 10
# test size in ratio, train... | embedding_size = 32
sequence_length = 33
lstm_units = 128
batch_size = 64
epochs = 20
n = 10
test_size = 0.2 |
result = 0
def solution(numbers, target):
findNum(numbers, 0, 0, target)
return result
def findNum(numbers, index, acc, target):
global result
if len(numbers) == index:
if acc == target:
result += 1
return
num = numbers[index]
findNum(numbers, index + 1, acc - num, target)
findNum(n... | result = 0
def solution(numbers, target):
find_num(numbers, 0, 0, target)
return result
def find_num(numbers, index, acc, target):
global result
if len(numbers) == index:
if acc == target:
result += 1
return
num = numbers[index]
find_num(numbers, index + 1, acc - nu... |
def find_the_secret(f):
for x in f.__code__.co_consts:
if isinstance(x,str) and len(x) == 32:
return x
return '' | def find_the_secret(f):
for x in f.__code__.co_consts:
if isinstance(x, str) and len(x) == 32:
return x
return '' |
def swap(arr,i,j):
arr[i],arr[j] = arr[j],arr[i]
def partition(arr,l,r):
pivot = arr[r]
i = l-1
j = l
for j in range(l,r):
if arr[j] < pivot:
i+=1
swap(arr,i,j)
i+=1
swap(arr,i,r)
return i
def quickSort(arr,l,r):
if l<r :
newIndex = partition(arr,l,r)
quickSort(arr,newIndex+1,r)
quickSort(arr... | def swap(arr, i, j):
(arr[i], arr[j]) = (arr[j], arr[i])
def partition(arr, l, r):
pivot = arr[r]
i = l - 1
j = l
for j in range(l, r):
if arr[j] < pivot:
i += 1
swap(arr, i, j)
i += 1
swap(arr, i, r)
return i
def quick_sort(arr, l, r):
if l < r:
... |
# app config
APP_CONFIG=dict(
SECRET_KEY="SECRET",
WTF_CSRF_SECRET_KEY="SECRET",
# Webservice config
WS_URL="http://localhost:5057", # ws del modello in locale
DATASET_REQ = "/dataset",
OPERATIVE_CENTERS_REQ = "/operative-centers",
OC_DATE_REQ = "/oc-date",
OC_DATA_REQ = "/oc-data",
PREDIC... | app_config = dict(SECRET_KEY='SECRET', WTF_CSRF_SECRET_KEY='SECRET', WS_URL='http://localhost:5057', DATASET_REQ='/dataset', OPERATIVE_CENTERS_REQ='/operative-centers', OC_DATE_REQ='/oc-date', OC_DATA_REQ='/oc-data', PREDICT_REQ='/predict', DATA_CHARSET='ISO-8859-1') |
__all__ = ['__version__']
# major, minor, patch
version_info = 1, 4, 0
# suffix
suffix = None
# version string
__version__ = '.'.join(map(str, version_info)) + (f'.{suffix}' if suffix else '')
| __all__ = ['__version__']
version_info = (1, 4, 0)
suffix = None
__version__ = '.'.join(map(str, version_info)) + (f'.{suffix}' if suffix else '') |
#percorrendo itens do dicionario com for
dicionario = {'chave1':'valor1','chave2':'valor2','chave3':3}
for a,b in dicionario.items():
print(a,b) | dicionario = {'chave1': 'valor1', 'chave2': 'valor2', 'chave3': 3}
for (a, b) in dicionario.items():
print(a, b) |
# Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = 'default',
kineticsEstimator = 'rate rules',
)
# List of species
species(
label='ethane',
reactive=True,
structur... | database(thermoLibraries=['primaryThermoLibrary'], reactionLibraries=[], seedMechanisms=[], kineticsDepositories=['training'], kineticsFamilies='default', kineticsEstimator='rate rules')
species(label='ethane', reactive=True, structure=smiles('CC'))
species(label='O2', reactive=True, structure=smiles('[O][O]'))
species... |
#BEGIN_HEADER
#END_HEADER
class pranjan77ContigFilter:
'''
Module Name:
pranjan77ContigFilter
Module Description:
A KBase module: pranjan77ContigFilter
'''
######## WARNING FOR GEVENT USERS #######
# Since asynchronous IO can lead to methods - even the same method -
# interruptin... | class Pranjan77Contigfilter:
"""
Module Name:
pranjan77ContigFilter
Module Description:
A KBase module: pranjan77ContigFilter
"""
def __init__(self, config):
pass |
a = float( input('give a number: ') )
b = float( input('give a number: ') )
print(a, '+', b, '=', a+b)
print(a, '-', b, '=', a-b)
print(a, '*', b, '=', a*b)
print(a, '/', b, '=', a/b)
| a = float(input('give a number: '))
b = float(input('give a number: '))
print(a, '+', b, '=', a + b)
print(a, '-', b, '=', a - b)
print(a, '*', b, '=', a * b)
print(a, '/', b, '=', a / b) |
# These are all the settings that are specific to a jurisdiction
###############################
# These settings are required #
###############################
OCD_JURISDICTION_ID = 'ocd-jurisdiction/country:us/state:il/place:chicago/government'
OCD_CITY_COUNCIL_ID = 'ocd-organization/ef168607-9135-4177-ad8e-c1f7a48... | ocd_jurisdiction_id = 'ocd-jurisdiction/country:us/state:il/place:chicago/government'
ocd_city_council_id = 'ocd-organization/ef168607-9135-4177-ad8e-c1f7a4806c3a'
city_council_name = 'Sacramento City Council'
legislative_sessions = ['2007', '2011', '2015']
city_name = 'Chicago'
city_name_short = 'Chicago'
city_vocab =... |
{
"targets": [
{
"target_name": "cld-c",
"type": "static_library",
"include_dirs": [
"internal",
],
"sources": [
"internal/cldutil.cc",
"internal/cldutil_shared.cc",
"internal/compact_lang_det.cc",
"internal/compact_lang_det_hint_code.cc",
... | {'targets': [{'target_name': 'cld-c', 'type': 'static_library', 'include_dirs': ['internal'], 'sources': ['internal/cldutil.cc', 'internal/cldutil_shared.cc', 'internal/compact_lang_det.cc', 'internal/compact_lang_det_hint_code.cc', 'internal/compact_lang_det_impl.cc', 'internal/debug.cc', 'internal/fixunicodevalue.cc'... |
def handle(event, context):
# This lambda function will be triggered by a CloudWatch cron-job.
# Collect a list of BD phone numbers and the recipient name
# from some file located in an s3 and store in `recipient` variable.
# You can collect phone numbers from your google contacts.
# Now, validate... | def handle(event, context):
invalid_numbers = [{'name': 'Abdullah', 'phone': '+8819xxxxxxxx'}]
is_valid = event['is_valid']
recipients = [{'name': 'Rayhan', 'phone': '+88018xxxxxxxx'}]
message = event.get('message_body')
if is_valid:
response = {'action': 'send', 'recipients': recipients, 'm... |
print('---------- If Condition ----------')
a = 1
if a > 0:
print('A is a positive number')
print('---------- If Else ----------')
a = -1
if a > 0:
print('A is a positive number')
else:
print('A is a negative number')
print('---------- If Elif Else ----------')
a = 0
if a > 0:
print('A is a positive n... | print('---------- If Condition ----------')
a = 1
if a > 0:
print('A is a positive number')
print('---------- If Else ----------')
a = -1
if a > 0:
print('A is a positive number')
else:
print('A is a negative number')
print('---------- If Elif Else ----------')
a = 0
if a > 0:
print('A is a positive num... |
load(
"@bazel_toolchains//rules:docker_config.bzl",
"docker_toolchain_autoconfig",
)
def _tensorflow_rbe_config(name, compiler, python_version, cuda_version = None, cudnn_version = None, tensorrt_version = None):
base = "@ubuntu16.04//image"
config_repos = [
"local_config_python",
"loca... | load('@bazel_toolchains//rules:docker_config.bzl', 'docker_toolchain_autoconfig')
def _tensorflow_rbe_config(name, compiler, python_version, cuda_version=None, cudnn_version=None, tensorrt_version=None):
base = '@ubuntu16.04//image'
config_repos = ['local_config_python', 'local_config_cc']
env = {'ABI_VERS... |
#
# PySNMP MIB module Unisphere-Data-COPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-COPS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:23:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) ... |
def run(proj,OG):
n1 = int(proj.parameters['n1'])
OG.add("base","o")
for i in range(n1):
OG.add("level1",str(i),{},OG["base"])
OG.add("level2","o", {}, OG["base"] + OG["level1"])
| def run(proj, OG):
n1 = int(proj.parameters['n1'])
OG.add('base', 'o')
for i in range(n1):
OG.add('level1', str(i), {}, OG['base'])
OG.add('level2', 'o', {}, OG['base'] + OG['level1']) |
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().rstrip().split()))
arr.reverse()
for i in arr:
print(i, end= " ")
| if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().rstrip().split()))
arr.reverse()
for i in arr:
print(i, end=' ') |
class map_config:
width=500
height=500
obstacle=[
{"shape":"rectangle","center":(60,70),"width":30,"height":40},
{"shape":"rectangle","center":(350,370),"width":20,"height":50},
{"shape":"circle","center":(250,250),"radius":50},
{"shape":"circle","center":(50,150),"radius":30... | class Map_Config:
width = 500
height = 500
obstacle = [{'shape': 'rectangle', 'center': (60, 70), 'width': 30, 'height': 40}, {'shape': 'rectangle', 'center': (350, 370), 'width': 20, 'height': 50}, {'shape': 'circle', 'center': (250, 250), 'radius': 50}, {'shape': 'circle', 'center': (50, 150), 'radius': 3... |
# Basic Sekeleton of Plan - Storing - At Particular Date - City where Tourist is supposed to be
# And storing travelling period(starting and ending time of travel) on that day
class SkeletonEvent:
def __init__(self, planid, date, city, startingTime, endingTime, stayingHotel) -> None:
self.planid = planid
... | class Skeletonevent:
def __init__(self, planid, date, city, startingTime, endingTime, stayingHotel) -> None:
self.planid = planid
self.date = date
self.city = city
self.startingTime = startingTime
self.endingTime = endingTime
self.stayingHotel = stayingHotel |
stock_dict = { 'GE': 'General Electric',
'CAT': 'Caterpillar',
'GM': 'General Motors'
}
purchases = [ ( 'GE', 100, '10-sep-2001', 48 ),
( 'CAT', 100, '1-apr-1999', 24 ),
( 'GM', 200, '1-jul-1998', 56 ),
( 'GM', 150, '3-jul-1998', 47 )... | stock_dict = {'GE': 'General Electric', 'CAT': 'Caterpillar', 'GM': 'General Motors'}
purchases = [('GE', 100, '10-sep-2001', 48), ('CAT', 100, '1-apr-1999', 24), ('GM', 200, '1-jul-1998', 56), ('GM', 150, '3-jul-1998', 47)]
total_portfolio_value = 0
for transaction in purchases:
stock_ticker = transaction[0]
n... |
N, M, *C = map(int, open(0).read().split())
C.sort()
for i in range(N):
M -= C[i]
if M <= 0:
break
if M >= 0:
print(i + 1)
elif M < 0:
print(i)
| (n, m, *c) = map(int, open(0).read().split())
C.sort()
for i in range(N):
m -= C[i]
if M <= 0:
break
if M >= 0:
print(i + 1)
elif M < 0:
print(i) |
#
# PySNMP MIB module ESI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ESI-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:06:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ... |
SEED1_DUNGEON = [
' ',
' ',
' ',
' ... | seed1_dungeon = [' ', ' ', ' ', ' ... |
'''
If an element in an MxN matrix is 0, set the entire row and column
to 0
'''
def setZero(mat):
m = len(mat)
n = len(mat[0])
zero_rows = []
zero_cols = []
for i in range(m):
for j in range(n):
if mat[i][j] == 0 and i not in zero_rows and j not in zero_cols:
mat... | """
If an element in an MxN matrix is 0, set the entire row and column
to 0
"""
def set_zero(mat):
m = len(mat)
n = len(mat[0])
zero_rows = []
zero_cols = []
for i in range(m):
for j in range(n):
if mat[i][j] == 0 and i not in zero_rows and (j not in zero_cols):
... |
#
# PySNMP MIB module ALTIGA-GLOBAL-REG (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-GLOBAL-REG
# Produced by pysmi-0.3.4 at Mon Apr 29 17:05:29 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, constraints_union, value_range_constraint) ... |
# -*- coding: utf-8 -*-
class Modifier(object):
def __init__(self):
self.is_disable = False
self.is_show_only = False
self.is_debug = False
self.is_transparent = False
def turn_on_disable(self):
self.is_disable = True
def turn_off_disable(self):
self.is_d... | class Modifier(object):
def __init__(self):
self.is_disable = False
self.is_show_only = False
self.is_debug = False
self.is_transparent = False
def turn_on_disable(self):
self.is_disable = True
def turn_off_disable(self):
self.is_disable = False
def tu... |
# import libraries here ...
# Stickbreak function
def stickbreak(v):
batch_ndims = len(v.shape) - 1
cumprod_one_minus_v = tf.math.cumprod(1 - v, axis=-1)
one_v = tf.pad(v, [[0, 0]] * batch_ndims + [[0, 1]], "CONSTANT",
constant_values=1)
c_one = tf.pad(cumprod_one_minus_v, [[0, 0]] *... | def stickbreak(v):
batch_ndims = len(v.shape) - 1
cumprod_one_minus_v = tf.math.cumprod(1 - v, axis=-1)
one_v = tf.pad(v, [[0, 0]] * batch_ndims + [[0, 1]], 'CONSTANT', constant_values=1)
c_one = tf.pad(cumprod_one_minus_v, [[0, 0]] * batch_ndims + [[1, 0]], 'CONSTANT', constant_values=1)
return one... |
def build_uri(asset_uri, site_uri):
asset_uri = asset_uri.strip("..")
if asset_uri.startswith("http"):
return asset_uri
separator = ""
if not asset_uri.startswith("/"):
separator = "/"
return "%s%s%s" % (site_uri, separator, asset_uri)
def join_uri(site_uri, file_path):
return ... | def build_uri(asset_uri, site_uri):
asset_uri = asset_uri.strip('..')
if asset_uri.startswith('http'):
return asset_uri
separator = ''
if not asset_uri.startswith('/'):
separator = '/'
return '%s%s%s' % (site_uri, separator, asset_uri)
def join_uri(site_uri, file_path):
return '... |
# rotate a list N places to the left
def rotate(n, l):
return l[n:] + l[0:n]
def test_rotate():
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']
expected = ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'a', 'b', 'c']
assert rotate(3,l) == expected
expected = ['j', 'k', 'a', 'b', ... | def rotate(n, l):
return l[n:] + l[0:n]
def test_rotate():
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']
expected = ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'a', 'b', 'c']
assert rotate(3, l) == expected
expected = ['j', 'k', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
assert rot... |
# Puzzle Input ----------
with open('Day04-Input.txt', 'r') as file:
puzzle = file.read().split('\n\n')
with open('Day04-Test01.txt', 'r') as file:
test01 = file.read().split('\n\n')
# Main Code ----------
# Convert the board string into a list
def process_board(raw_board):
new_board = []
for row in... | with open('Day04-Input.txt', 'r') as file:
puzzle = file.read().split('\n\n')
with open('Day04-Test01.txt', 'r') as file:
test01 = file.read().split('\n\n')
def process_board(raw_board):
new_board = []
for row in raw_board.split('\n'):
new_board += [row.split()]
return new_board
def find_n... |
print("Hi, are you having trouble making a password?")
print("let me help you!")
number = input("give me a number from 1-3")
password = number
animal = input("do you prefer dogs or cats?")
password = number + animal
color=input("what is your favorite color?")
password = color+number+animal
book=input("ok, last question... | print('Hi, are you having trouble making a password?')
print('let me help you!')
number = input('give me a number from 1-3')
password = number
animal = input('do you prefer dogs or cats?')
password = number + animal
color = input('what is your favorite color?')
password = color + number + animal
book = input('ok, last ... |
# settings.py
# sdNum = subdomain number
# p1 = spatial bandwidth
# p2 = temporal bandwidth
# p3 = spatial resolution
# p4 = temporal resolution
# p5 = number of points threshold (T1)
# p6 = buffer ratio threshold (T2)
# dir1 = point files (resulting from decomposition)
# dir2 = time files (resulting from de... | def init():
global sdNum, p1, p2, p3, p4, p5, p6, dir1, dir2, pList, cList
(sd_num, p1, p2, p3, p4, p5, p6, dir1, dir2, p_list, c_list) = (0, 0, 0, 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]) |
class AutoTrackConfig:
hog_cell_size=4
hog_n_dim=31
gray_cell_size=4
cn_use_for_gray=False
cn_cell_size=4
cn_n_dim=10
search_area_shape = 'square' # the shape of the samples
search_area_scale = 5.0 # the scaling of the target size to get the search area
... | class Autotrackconfig:
hog_cell_size = 4
hog_n_dim = 31
gray_cell_size = 4
cn_use_for_gray = False
cn_cell_size = 4
cn_n_dim = 10
search_area_shape = 'square'
search_area_scale = 5.0
min_image_sample_size = 150 ** 2
max_image_sample_size = 200 ** 2
feature_downsample_ratio = ... |
#
# PySNMP MIB module TPLINK-DHCPSERVER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-DHCPSERVER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:17:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_intersection, constraints_union, value_size_constraint) ... |
print('first')
print('second')
if True:
x = 1
y = 2
print('hi')
| print('first')
print('second')
if True:
x = 1
y = 2
print('hi') |
'''
sekarang kita menghitung bunganya! ooh ya,
apakah anda tahu bahwa kita bisa merantai perhitungan
seperti ini
jawaban = 2000 * /100
kita buat hal serupa di sini
'''
'''
ciptakan variabel suku_bunga dan berikan nilai
antara 5 hingga 30
-ciptakan juga varibel jumlah_bunga yang merupakan
hasil perkalian sisa_cicilan d... | """
sekarang kita menghitung bunganya! ooh ya,
apakah anda tahu bahwa kita bisa merantai perhitungan
seperti ini
jawaban = 2000 * /100
kita buat hal serupa di sini
"""
'\nciptakan variabel suku_bunga dan berikan nilai\nantara 5 hingga 30\n-ciptakan juga varibel jumlah_bunga yang merupakan\nhasil perkalian sisa_cicilan... |
# Title : Insert new element before each element
# Author : Kiran raj R.
# Date : 23:10:2020
def insert_b4(list_in, str_elem):
out = [elem for list_elem in list_in for elem in (str_elem, list_elem)]
print(f"After inserting element: {out}")
def insert_after(list_in, str_elem):
out = [elem for list_el... | def insert_b4(list_in, str_elem):
out = [elem for list_elem in list_in for elem in (str_elem, list_elem)]
print(f'After inserting element: {out}')
def insert_after(list_in, str_elem):
out = [elem for list_elem in list_in for elem in (list_elem, str_elem)]
print(f'After inserting element: {out}')
insert... |
NOP = 0
RD = 1
WR = 2
class mmiodev(object):
def __init__(self):
self.regmap = {}
self.regidx = {}
def addReg(self, name, addr, length, readonly=0, default=0):
# make sure it doesn't overlap with anything.
for (a0,a1) in self.regmap:
assert addr < a0 or addr >= a... | nop = 0
rd = 1
wr = 2
class Mmiodev(object):
def __init__(self):
self.regmap = {}
self.regidx = {}
def add_reg(self, name, addr, length, readonly=0, default=0):
for (a0, a1) in self.regmap:
assert addr < a0 or addr >= a1
assert name not in self.regidx
self.... |
def of(n, acc1=0, acc2=1):
if n < 0:
raise ValueError
if n == 0:
return 0
elif n <= 1:
return acc2
else:
return of(n - 1, acc2, acc1 + acc2)
| def of(n, acc1=0, acc2=1):
if n < 0:
raise ValueError
if n == 0:
return 0
elif n <= 1:
return acc2
else:
return of(n - 1, acc2, acc1 + acc2) |
#!/usr/bin/python3
# Create a file and call it lyrics.txt (it does not need to have any content)
# Create a new file and call it songs.docx and in this file write 3 lines
# of text to it.
# Open and read the content and write it to your terminal
# window. * you should use the read(), readline(), and readlines()
# ... | songs_dox = '../files/songs.docx'
def separator(text):
print(f'\n#----- Reading from songs.docx with {text} -----#\n')
lyrics_file = open('../files/lyrics.txt', 'w+')
print('lyrics.txt has been created in folder files,', 'any previous data has been deleted')
lyricsFile.close()
songs_file = open(songs_dox, 'w+')
so... |
class Star:
def __init__(self):
self.x = random(-width/2, width/2)
self.y = random(-height/2, height/2)
self.z = random(width/2)
self.pz = self.z
def update(self, speed):
self.z = self.z - speed
if self.z < 1:
self.z = width/2
... | class Star:
def __init__(self):
self.x = random(-width / 2, width / 2)
self.y = random(-height / 2, height / 2)
self.z = random(width / 2)
self.pz = self.z
def update(self, speed):
self.z = self.z - speed
if self.z < 1:
self.z = width / 2
... |
DATABASE_AUTO_CREATE_INDEX = True
DATABASES = {
'default': {
'db': 'billing',
'host': 'localhost',
'port': 27017,
'username': '',
'password': ''
}
}
CACHES = {
'default': {},
'local': {
'backend': 'spaceone.core.cache.local_cache.LocalCache',
'max... | database_auto_create_index = True
databases = {'default': {'db': 'billing', 'host': 'localhost', 'port': 27017, 'username': '', 'password': ''}}
caches = {'default': {}, 'local': {'backend': 'spaceone.core.cache.local_cache.LocalCache', 'max_size': 128, 'ttl': 300}}
handlers = {}
connectors = {'BillingPluginConnector':... |
# We're trying to find the sum of the even fibonacci numbers
# from 1 to `max_num`
class Solution:
# We're going to do fibonacci iteratively
def solution(self, max_num: int) -> int:
# `minus1` and `minus2` keep track of the last two values
# starting with 0 and 1, `num` keeps track of the curren... | class Solution:
def solution(self, max_num: int) -> int:
(minus1, minus2) = (1, 0)
num = 0
sum = 0
while num < max_num:
num = minus1 + minus2
minus2 = minus1
minus1 = num
if num % 2 == 0:
sum += num
return sum |
class Solution:
def maxDistance(self, position: List[int], m: int) -> int:
position=sorted(position)
dis=position[-1]-position[0]
if m==2:
return position[-1]-position[0]
low=1
high=dis
def validInterval(interval):
n=m-1
... | class Solution:
def max_distance(self, position: List[int], m: int) -> int:
position = sorted(position)
dis = position[-1] - position[0]
if m == 2:
return position[-1] - position[0]
low = 1
high = dis
def valid_interval(interval):
n = m - 1
... |
project = 'django-sms'
copyright = '2021, Roald Nefs'
author = 'Roald Nefs'
release = '0.4.0'
extensions = ['m2r2']
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
source_suffix = ['.rst', '.md']
html_theme = 'alabaster'
html_theme_options = {
"description": "A Django app f... | project = 'django-sms'
copyright = '2021, Roald Nefs'
author = 'Roald Nefs'
release = '0.4.0'
extensions = ['m2r2']
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
source_suffix = ['.rst', '.md']
html_theme = 'alabaster'
html_theme_options = {'description': 'A Django app for send... |
def main():
f = [int(i) for i in [line.rstrip("\n") for line in open("Data.txt")][0].split(",")]
f[1] = 12
f[2] = 2
i = 0
while True:
if f[i] == 99:
break
elif f[i] == 1:
f[f[i + 3]] = f[f[i + 1]] + f[f[i + 2]]
elif f[i] == 2:
f[f[i + 3]] =... | def main():
f = [int(i) for i in [line.rstrip('\n') for line in open('Data.txt')][0].split(',')]
f[1] = 12
f[2] = 2
i = 0
while True:
if f[i] == 99:
break
elif f[i] == 1:
f[f[i + 3]] = f[f[i + 1]] + f[f[i + 2]]
elif f[i] == 2:
f[f[i + 3]] =... |
def register(mf):
mf.register_event("main", lambda: print("tests"), unique=False)
register_parents = False
| def register(mf):
mf.register_event('main', lambda : print('tests'), unique=False)
register_parents = False |
# https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def buildTree(se... | class Solution:
def build_tree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
map_inorder = {}
for (i, val) in enumerate(inorder):
map_inorder[val] = i
def recur(low, high):
if low > high:
return None
x = tree_node(postorder... |
# compose tree to describe object dictionary
# assume all instrument readings are four-byte floats
theTree = {
0x1000: {
0x00: {0x40: 0, 'size': 4}
},
0x6001: {
0x00: {0x40: 5},
0x01: {0x40: 'INST:SEL CH1;:SOUR:VOLT?', 0x23: 'INST:SEL CH1;:SOUR:VOLT'},
0x02: {0x40: 'INST:SEL CH1;:SOUR:CURR?', 0x23: 'INST:SEL... | the_tree = {4096: {0: {64: 0, 'size': 4}}, 24577: {0: {64: 5}, 1: {64: 'INST:SEL CH1;:SOUR:VOLT?', 35: 'INST:SEL CH1;:SOUR:VOLT'}, 2: {64: 'INST:SEL CH1;:SOUR:CURR?', 35: 'INST:SEL CH1;:SOUR:CURR'}, 3: {64: 'FETCH:VOLT? CH1'}, 4: {64: 'FETCH:CURR? CH1'}, 5: {64: 'FETCH:POW? CH1'}}, 24578: {0: {64: 5}, 1: {64: 'INST:SEL... |
api_key = ""
api_secret = ""
access_token_key = ""
access_token_secret = ""
| api_key = ''
api_secret = ''
access_token_key = ''
access_token_secret = '' |
USERS = {}
def update_user(user):
if user not in USERS:
USERS[user] = 0
USERS[user] += 1
return {'name': user, 'access': USERS[user]}
| users = {}
def update_user(user):
if user not in USERS:
USERS[user] = 0
USERS[user] += 1
return {'name': user, 'access': USERS[user]} |
N, A, B = map(int, input().split())
if B >= A*N:
print(A*N)
else:
print(B) | (n, a, b) = map(int, input().split())
if B >= A * N:
print(A * N)
else:
print(B) |
class Network:
def __init__(self):
self.layer_list = []
self.num_layer = 0
def add(self, layer):
self.num_layer = self.num_layer + 1
self.layer_list.append(layer)
def forward(self, x):
for i in range(self.num_layer):
x = self.layer_list[i].forward(x)
... | class Network:
def __init__(self):
self.layer_list = []
self.num_layer = 0
def add(self, layer):
self.num_layer = self.num_layer + 1
self.layer_list.append(layer)
def forward(self, x):
for i in range(self.num_layer):
x = self.layer_list[i].forward(x)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.