content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Config:
@staticmethod
def get(repo, config_key):
splitted_keys = config_key.split('.')
splitted_keys_in_byte = [key.encode() for key in splitted_keys]
if splitted_keys.__len__() > 2:
section = tuple(splitted_keys_in_byte[:-1])
arg = splitted_keys_in_byte[-1]
else:
se... | class Config:
@staticmethod
def get(repo, config_key):
splitted_keys = config_key.split('.')
splitted_keys_in_byte = [key.encode() for key in splitted_keys]
if splitted_keys.__len__() > 2:
section = tuple(splitted_keys_in_byte[:-1])
arg = splitted_keys_in_byte[-1... |
path = 'home/sample.mp4'
akhil = []
akhil = path.split(".")
video = akhil[0].split("/")
print(video[len(video)-1]) | path = 'home/sample.mp4'
akhil = []
akhil = path.split('.')
video = akhil[0].split('/')
print(video[len(video) - 1]) |
def converteHora(hora):
# Se a hora for 00:
if int(hora[:2]) == 0:
return f"12{hora[2:]} AM"
# Se for 12
if int(hora[:2]) == 12:
return f"12{hora[2:]} PM"
# Se for de tarde
if int(hora[:2]) > 12:
return f"0{int(hora[:2]) - 12 }{hora[2:]} PM"
return f"{hora} AM"
print(converteHora(... | def converte_hora(hora):
if int(hora[:2]) == 0:
return f'12{hora[2:]} AM'
if int(hora[:2]) == 12:
return f'12{hora[2:]} PM'
if int(hora[:2]) > 12:
return f'0{int(hora[:2]) - 12}{hora[2:]} PM'
return f'{hora} AM'
print(converte_hora('09:39')) |
# Copyright (c) 2009 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.
{
'includes': [
'../../build/common.gypi',
],
'targets': [
{
'target_name': 'libpng',
'type': '<(library)',
'dependencies... | {'includes': ['../../build/common.gypi'], 'targets': [{'target_name': 'libpng', 'type': '<(library)', 'dependencies': ['../zlib/zlib.gyp:zlib'], 'defines': ['CHROME_PNG_WRITE_SUPPORT', 'PNG_USER_CONFIG'], 'msvs_guid': 'C564F145-9172-42C3-BFCB-6014CA97DBCD', 'sources': ['png.c', 'png.h', 'pngconf.h', 'pngerror.c', 'pngg... |
#
# PySNMP MIB module HPN-ICF-FC-PSM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-FC-PSM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:38:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ... |
print('=-'*25)
print(f'{"Sequencia de fibonacci": ^50}')
print('=-'*25, '\n')
termos = int(input('Quantos termos voce quer mostrar: '))
controle = 0
fibonacci = 0
n1 = 0
n2 = 1
print(n1, '->', n2, end=' -> ')
while controle != termos - 2:
controle += 1
fibonacci = n1 + n2
n1 = n2
n2 = fibonacci
p... | print('=-' * 25)
print(f"{'Sequencia de fibonacci': ^50}")
print('=-' * 25, '\n')
termos = int(input('Quantos termos voce quer mostrar: '))
controle = 0
fibonacci = 0
n1 = 0
n2 = 1
print(n1, '->', n2, end=' -> ')
while controle != termos - 2:
controle += 1
fibonacci = n1 + n2
n1 = n2
n2 = fibonacci
... |
def count_and_say(palavra):
dicionario = {}
palavra = palavra.replace(' ', '')
for letra in palavra:
if not letra in dicionario.keys():
dicionario[letra] = 1
else:
dicionario[letra] += 1
retorno = ''
for letra, quantidade in dicionario.items(... | def count_and_say(palavra):
dicionario = {}
palavra = palavra.replace(' ', '')
for letra in palavra:
if not letra in dicionario.keys():
dicionario[letra] = 1
else:
dicionario[letra] += 1
retorno = ''
for (letra, quantidade) in dicionario.items():
retor... |
# https://www.hackerrank.com/challenges/recursive-digit-sum
def super_digit(n, k):
def _compute(num):
num_str = str(num)
total = sum(map(int, num_str))
if len(str(total)) == 1:
return total
else:
return _compute(total)
# n, k = [int(x) for x in ra... | def super_digit(n, k):
def _compute(num):
num_str = str(num)
total = sum(map(int, num_str))
if len(str(total)) == 1:
return total
else:
return _compute(total)
concat = int(str(n) * k)
if len(str(concat)) == 1:
return concat
else:
r... |
def remove_char(str,n):
first_part = str[:n]
last_part = str[n+1:]
return first_part + last_part
def unify(E1, E2):
E1_Variable = E1[0].isupper()
E2_Variable = E2[0].isupper()
SUBSET = ""
if not E1_Variable and not E2_Variable or(len(E1) == 0 and len(E2) == 0):
if E1[0] == E2[0]:
... | def remove_char(str, n):
first_part = str[:n]
last_part = str[n + 1:]
return first_part + last_part
def unify(E1, E2):
e1__variable = E1[0].isupper()
e2__variable = E2[0].isupper()
subset = ''
if not E1_Variable and (not E2_Variable) or (len(E1) == 0 and len(E2) == 0):
if E1[0] == E... |
# Create a script that has:
#a function accept a list of grades (i.e. [99, 88, 77])
#and returns a grading report for that list.
# Data
# List of Integers
# blank_list = []
# grades = [99, 75, 89, 45, 68, 94, 87, 86, 80]
# Conditional logic
# A >= 90
# B < 90 and B >= 80
# C < 80 and C >= 70
# D < 70 and D >= 60
... | def scorer(scores):
class_scores = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'F': 0}
for grade in scores:
if grade >= 90:
print(f'{grade} is an A!')
print(str(grade) + ' is an A!')
class_scores['A'] += 1
elif grade >= 80:
print(f'{grade} is a B!')
... |
def titulo(txt):
print('-' * 35)
print(f'{txt:^35}')
print('-' * 35)
| def titulo(txt):
print('-' * 35)
print(f'{txt:^35}')
print('-' * 35) |
def make_shirt(size='Large', message='I love Python'):
print(f"The size of the shirt is {size} and the message is {message}")
make_shirt()
make_shirt('m')
make_shirt('xs', "I'm okay")
| def make_shirt(size='Large', message='I love Python'):
print(f'The size of the shirt is {size} and the message is {message}')
make_shirt()
make_shirt('m')
make_shirt('xs', "I'm okay") |
def fib(n):
'''Takes in a number n, and returns the nth fibonacci number, starting with: 1, 1, 2, 3, 5,...'''
if n<=1:
return n
else:
f = [0, 1]
for i in range(2,n+1):
f.append(f[i-1] + f[i-2])
return f[n]
| def fib(n):
"""Takes in a number n, and returns the nth fibonacci number, starting with: 1, 1, 2, 3, 5,..."""
if n <= 1:
return n
else:
f = [0, 1]
for i in range(2, n + 1):
f.append(f[i - 1] + f[i - 2])
return f[n] |
# Created by MechAviv
# Map ID :: 940011080
# Western Region of Pantheon : Heliseum Hideout
# [SET_DRESS_CHANGED] [00 00 ]
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.forcedInput(0)
sm.forcedInput(2)
sm.sendDelay(60)
sm.forcedInput(0)
sm.setSpeakerID(0)
... | sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.forcedInput(0)
sm.forcedInput(2)
sm.sendDelay(60)
sm.forcedInput(0)
sm.setSpeakerID(0)
sm.removeEscapeButton()
sm.flipDialoguePlayerAsSpeaker()
sm.setSpeakerType(3)
sm.sendNext('What am I gonna do?! Maybe I can ju... |
class Solution:
# @param root, a tree link node
# @return nothing
def connect(self, root):
if not root or (not root.left and not root.right):
return root
strut = dict()
level_0 = [root]
lv = 0
strut[lv] = level_0
is_last_level = False
... | class Solution:
def connect(self, root):
if not root or (not root.left and (not root.right)):
return root
strut = dict()
level_0 = [root]
lv = 0
strut[lv] = level_0
is_last_level = False
while not is_last_level:
new_level = []
... |
class Solution:
def partition(self, s: str) -> List[List[str]]:
res=[]
self.helper(res,s,[])
return res
def helper(self,res,s,path):
if not s:
res.append(path)
return
for i in range(1,len(s)+1):
if self.check(s[:i])==True:
... | class Solution:
def partition(self, s: str) -> List[List[str]]:
res = []
self.helper(res, s, [])
return res
def helper(self, res, s, path):
if not s:
res.append(path)
return
for i in range(1, len(s) + 1):
if self.check(s[:i]) == True:... |
#entrada
nFuncionarios = int(input())
qEventos = int(input())
#processamento
mesas = []
for i in range(1, nFuncionarios + 1): #inserindo funcionarios nas mesas
mesas.append(i)
for i in range(0, qEventos):
entrada = str(input()).split()
eTipo = int(entrada[0])
a = int(entrada[1])
if eTipo == 1: #up... | n_funcionarios = int(input())
q_eventos = int(input())
mesas = []
for i in range(1, nFuncionarios + 1):
mesas.append(i)
for i in range(0, qEventos):
entrada = str(input()).split()
e_tipo = int(entrada[0])
a = int(entrada[1])
if eTipo == 1:
b = int(entrada[2])
aux = mesas.index(b)
... |
#58: Next Day
a=input("Enter the date:")
b=[1,3,5,7,8,10,12]
c=[4,6,9,11]
d=a.split('-')
year=int(d[0])
month=int(d[1])
date=int(d[2])
if year%400==0:
x=True
elif year%100==0:
x=False
elif year%4==0:
x=True
else:
x=False
if 1<=month<=12 and 1<=date<=31:
if month in b:
date+... | a = input('Enter the date:')
b = [1, 3, 5, 7, 8, 10, 12]
c = [4, 6, 9, 11]
d = a.split('-')
year = int(d[0])
month = int(d[1])
date = int(d[2])
if year % 400 == 0:
x = True
elif year % 100 == 0:
x = False
elif year % 4 == 0:
x = True
else:
x = False
if 1 <= month <= 12 and 1 <= date <= 31:
if month ... |
def get_soundex(token):
temp=''
token=token.upper()
temp+=token[0]
dic={'BFPV':1,'CGJKQSXZ':2,'DT':3,'L':4,'MN':5,'R':6,'AEIOUYHW':''}
for char in token[1:]:
for key in dic.keys():
if char in key:
code=str(dic[key])
break
if... | def get_soundex(token):
temp = ''
token = token.upper()
temp += token[0]
dic = {'BFPV': 1, 'CGJKQSXZ': 2, 'DT': 3, 'L': 4, 'MN': 5, 'R': 6, 'AEIOUYHW': ''}
for char in token[1:]:
for key in dic.keys():
if char in key:
code = str(dic[key])
break
... |
# 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 minDepth(self, root: TreeNode) -> int:
def depth(node, x):
if node == None:
... | class Solution:
def min_depth(self, root: TreeNode) -> int:
def depth(node, x):
if node == None:
return x - 1
if node.left == None and node.right == None:
return x
l = 10 ** 5
r = 10 ** 5
if node.left != None:
... |
#!/usr/bin/env python3
# Import data
with open('/home/agaspari/aoc2021/dec_8/dec8_input.txt') as f:
signal_list = f.read().split('\n')
unique_signals_one = {'c', 'f'}
unique_signals_four = {'b', 'c', 'd', 'f'}
unique_signals_seven = {'a', 'c', 'f'}
unique_signals_eight = {'a', 'b', 'c', 'd', 'e', 'f', 'g'}
uniqu... | with open('/home/agaspari/aoc2021/dec_8/dec8_input.txt') as f:
signal_list = f.read().split('\n')
unique_signals_one = {'c', 'f'}
unique_signals_four = {'b', 'c', 'd', 'f'}
unique_signals_seven = {'a', 'c', 'f'}
unique_signals_eight = {'a', 'b', 'c', 'd', 'e', 'f', 'g'}
unique_signals = [unique_signals_one, unique_... |
x = 1 + 2 * 3 - 3 ** 5 / 2
y = 3 ** 5 - 2
z = x / y
zz = x // y
z -= z
zz += zz
xx = -x
xx %= 10
if type(x) is int:
print(x and y)
| x = 1 + 2 * 3 - 3 ** 5 / 2
y = 3 ** 5 - 2
z = x / y
zz = x // y
z -= z
zz += zz
xx = -x
xx %= 10
if type(x) is int:
print(x and y) |
class Queue:
qu = []
size = 0
front = 0
rear = 0
def __init__(self, size):
self.size = size
def en_queue(self, data):
self.qu.append(data)
self.size = self.size + 1
self.rear = self.rear + 1
def de_queue(self):
temp = self.qu[self.front]
del... | class Queue:
qu = []
size = 0
front = 0
rear = 0
def __init__(self, size):
self.size = size
def en_queue(self, data):
self.qu.append(data)
self.size = self.size + 1
self.rear = self.rear + 1
def de_queue(self):
temp = self.qu[self.front]
del... |
class parser(object):
def __call__(self, line):
self.rank = 0
self.in_garbage = False # if False, then we're in garbage
self.ignore = False
self.points = []
self.garbage_count = 0
for char in line:
self._inc(char)
return self.points
... | class Parser(object):
def __call__(self, line):
self.rank = 0
self.in_garbage = False
self.ignore = False
self.points = []
self.garbage_count = 0
for char in line:
self._inc(char)
return self.points
def _inc(self, char):
if self.ignor... |
class Text():
'''text to write to console'''
def __init__(self, text, fg='black', bg='white'):
self.text = text
self.fg = fg
self.bg = bg
class Value():
'''a value for the status bar'''
def __init__(self, name, text, row=0, fg='black', bg='white'):
self.name = name
... | class Text:
"""text to write to console"""
def __init__(self, text, fg='black', bg='white'):
self.text = text
self.fg = fg
self.bg = bg
class Value:
"""a value for the status bar"""
def __init__(self, name, text, row=0, fg='black', bg='white'):
self.name = name
... |
m = int(input())
n = int(input()) + 1
for i in range(m, n, ):
if (i % 17 == 0) or (i % 10 == 9) or (i % 3 == 0 and i % 5 == 0):
print(i)
| m = int(input())
n = int(input()) + 1
for i in range(m, n):
if i % 17 == 0 or i % 10 == 9 or (i % 3 == 0 and i % 5 == 0):
print(i) |
def print_formatted(number):
binlen = len(str(bin(number))) - 2
for i in range(1, number+1):
print("{0} {1} {2} {3}".format(str(i).rjust(binlen), str(oct(i))[1:].rjust(binlen), format(i, 'x').upper().rjust(binlen), bin(i)[2:].rjust(binlen)))
| def print_formatted(number):
binlen = len(str(bin(number))) - 2
for i in range(1, number + 1):
print('{0} {1} {2} {3}'.format(str(i).rjust(binlen), str(oct(i))[1:].rjust(binlen), format(i, 'x').upper().rjust(binlen), bin(i)[2:].rjust(binlen))) |
class RequestHandler:
def __init__ (self, logger):
self.logger = logger
def log (self, message, type = "info"):
self.logger.log ("%s - %s" % (self.request.uri, message), type)
def log_info (self, message, type='info'):
self.log (message, type)
def trace (self):
self.logger.trace (self.request.uri)
... | class Requesthandler:
def __init__(self, logger):
self.logger = logger
def log(self, message, type='info'):
self.logger.log('%s - %s' % (self.request.uri, message), type)
def log_info(self, message, type='info'):
self.log(message, type)
def trace(self):
self.logger.tr... |
#
# PySNMP MIB module HH3C-LOCAL-AAA-SERVER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-LOCAL-AAA-SERVER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:15:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, single_value_constraint, constraints_union, value_range_constraint) ... |
__version__ = '1.0.1'
default_app_config = (
'django_selectel_storage.apps.'
'DjangoSelectelStorageAppConfig'
)
| __version__ = '1.0.1'
default_app_config = 'django_selectel_storage.apps.DjangoSelectelStorageAppConfig' |
XMajor = [[15, 13.333333333333334, 26.666666666666668, 46.666666666666664, 13.333333333333334, 0.0, 0.0, 0.0],[13, 15.384615384615385, 38.46153846153846, 7.6923076923076925, 15.384615384615385, 15.384615384615385, 0.0, 7.6923076923076925],[4, 25.0, 0.0, 25.0, 50.0, 0.0, 0.0, 0.0],[10, 20.0, 30.0, 0.0, 0.0, 0.0, 20.0, 3... | x_major = [[15, 13.333333333333334, 26.666666666666668, 46.666666666666664, 13.333333333333334, 0.0, 0.0, 0.0], [13, 15.384615384615385, 38.46153846153846, 7.6923076923076925, 15.384615384615385, 15.384615384615385, 0.0, 7.6923076923076925], [4, 25.0, 0.0, 25.0, 50.0, 0.0, 0.0, 0.0], [10, 20.0, 30.0, 0.0, 0.0, 0.0, 20.... |
# Define Functions
# Function that handles all litre conversions
def litreconv():
print("you have selected Litres")
conversion = int(input("input Litres to convert: "))
print(str(conversion) + " Litres")
converted = 0.21997 * conversion
print(str(round(converted, 4)) + " UK Gallons")
converted... | def litreconv():
print('you have selected Litres')
conversion = int(input('input Litres to convert: '))
print(str(conversion) + ' Litres')
converted = 0.21997 * conversion
print(str(round(converted, 4)) + ' UK Gallons')
converted = conversion / 3.785
print(str(round(converted, 4)) + 'US Gall... |
dff = data
df_sk = dff.loc[(dff['scenario']=='ND_NO_SKAVICA')|(dff['scenario']=='ND_SKAVICA')]
df_sk['scenario'].replace({"ND_NO_SKAVICA":"No Skavica", "ND_SKAVICA":"With Skavica"}, inplace=True)
df_sk1 = df_sk.loc[(df_sk['country']=='Albania')&(df_sk['tech']!='AL-Import')]
df_sk1 = df_sk1.groupby(['country','tech','y... | dff = data
df_sk = dff.loc[(dff['scenario'] == 'ND_NO_SKAVICA') | (dff['scenario'] == 'ND_SKAVICA')]
df_sk['scenario'].replace({'ND_NO_SKAVICA': 'No Skavica', 'ND_SKAVICA': 'With Skavica'}, inplace=True)
df_sk1 = df_sk.loc[(df_sk['country'] == 'Albania') & (df_sk['tech'] != 'AL-Import')]
df_sk1 = df_sk1.groupby(['count... |
# ASL ALPHABET, j,Z OMITTED
language = {
'letter_a' : [
"http://science.opposingviews.com/DM-Resize/photos.demandstudios.com/getty/article/81/210/78033946.jpg?w=600&h=600&keep_ratio=1",
"http://www.lifeprint.com/asl101/signjpegs/a/a.jpg",
"http://thumbs.dreamstime.com/x/letter-sign-language-587184.jpg",
"http:/... | language = {'letter_a': ['http://science.opposingviews.com/DM-Resize/photos.demandstudios.com/getty/article/81/210/78033946.jpg?w=600&h=600&keep_ratio=1', 'http://www.lifeprint.com/asl101/signjpegs/a/a.jpg', 'http://thumbs.dreamstime.com/x/letter-sign-language-587184.jpg', 'http://i.imgur.com/ei3jaNZ.jpg', 'http://imgu... |
def get_access_by_username (cursor, username) :
try :
sql_statement = 'SELECT username,password,active FROM access WHERE username = %s'
cursor.execute(sql_statement,(username,))
data = cursor.fetchone()
except Exception as ex:
print('[ERROR] get_access_by_username : ' + ex.__str_... | def get_access_by_username(cursor, username):
try:
sql_statement = 'SELECT username,password,active FROM access WHERE username = %s'
cursor.execute(sql_statement, (username,))
data = cursor.fetchone()
except Exception as ex:
print('[ERROR] get_access_by_username : ' + ex.__str__(... |
def misspelled(words):
misspelled_words = []
for keys, values in words.items():
if ''.join(values) != keys:
misspelled_words.append(keys)
return misspelled_words | def misspelled(words):
misspelled_words = []
for (keys, values) in words.items():
if ''.join(values) != keys:
misspelled_words.append(keys)
return misspelled_words |
#!/usr/bin/python
class VideoData(object):
percent_confidence_limit = 25
def __init__(self):
# Standard Data
self._video_id = None
self._title = None
self._description = None
self._published = None
# Metrics
self._date_start = None
self._date_... | class Videodata(object):
percent_confidence_limit = 25
def __init__(self):
self._video_id = None
self._title = None
self._description = None
self._published = None
self._date_start = None
self._date_end = None
self._views = None
self._monetizedPla... |
'''
Description: exercise: your age
Version: 1.0.0.20210113
Author: Arvin Zhao
Date: 2021-01-13 09:44:34
Last Editors: Arvin Zhao
LastEditTime: 2021-01-13 10:27:55
'''
def check_age(age: int) -> None:
'''
Check an age and print what he/she can do regarding the age.
Parameters
----------
age : his/... | """
Description: exercise: your age
Version: 1.0.0.20210113
Author: Arvin Zhao
Date: 2021-01-13 09:44:34
Last Editors: Arvin Zhao
LastEditTime: 2021-01-13 10:27:55
"""
def check_age(age: int) -> None:
"""
Check an age and print what he/she can do regarding the age.
Parameters
----------
age : his/... |
#!/usr/bin/env python3
DOCTL = "/usr/local/bin/doctl"
PK_FILE = "/home/ndjuric/.ssh/id_rsa.pub"
SWARM_DIR = TAG = "swarm"
OVERLAY_NETWORK = "swarmnet"
DOCKER_REGISTRY = {
'master': 'private.docker.registry.example.com:5000/master',
'worker': 'private.docker.registry.example.com:5000/worker'
}
NFS_SERVER = '10.... | doctl = '/usr/local/bin/doctl'
pk_file = '/home/ndjuric/.ssh/id_rsa.pub'
swarm_dir = tag = 'swarm'
overlay_network = 'swarmnet'
docker_registry = {'master': 'private.docker.registry.example.com:5000/master', 'worker': 'private.docker.registry.example.com:5000/worker'}
nfs_server = '10.135.69.119'
' CALL_MAP is a list e... |
x = int(input('Enter a number: '))
index = 0
for i in range(1, int(x/2) +1):
if x % i == 0:
print(i)
index += 1
print(x)
print(f'There were {index + 1} divisors') | x = int(input('Enter a number: '))
index = 0
for i in range(1, int(x / 2) + 1):
if x % i == 0:
print(i)
index += 1
print(x)
print(f'There were {index + 1} divisors') |
# CALCULATING THE WORK ON AN OBJECT, GIVEN THE FORCE AND DISPLACEMENT OF THE OBJECT.
# creating a function to calculate the work.
def calc_work (force, displacement):
# arithmetic calculation to determine the work on an object.
work = force * displacement
work = round(work, 2)
# returning th... | def calc_work(force, displacement):
work = force * displacement
work = round(work, 2)
return work
force = int(input('Enter the amount of force in Newtons please:'))
displacement = int(input('Enter the amount of displacement in meters please:'))
print('The work on the object is:', calc_work(force, displaceme... |
class DiseaseError(Exception):
"Base class for disease module exceptions."
pass
class ParserError(DiseaseError): pass
| class Diseaseerror(Exception):
"""Base class for disease module exceptions."""
pass
class Parsererror(DiseaseError):
pass |
class SaveCurrentUser():
def save_model(self, request, obj, form, change):
obj.current_user = request.user
super().save_model(request, obj, form, change)
class SaveCurrentUserAdmin():
def save_model(self, request, obj, form, change):
obj.current_user = request.user
super().sa... | class Savecurrentuser:
def save_model(self, request, obj, form, change):
obj.current_user = request.user
super().save_model(request, obj, form, change)
class Savecurrentuseradmin:
def save_model(self, request, obj, form, change):
obj.current_user = request.user
super().save_mo... |
# CSV related
ROW_MOST_RECENT_DAY = 1 # First row with data (i.e row 2)
ROW_FIRST_COMPLETE_DAY = 3 # First row with valid data for the 7-day total (i.e row 4)
COL_AREA_CODE = 0
COL_AREA_NAME = 1
COL_AREA_TYPE = 2
COL_DATE = 3
COL_TOTAL_DEATHS = 4
COL_HOSPITAL_CASES = 5
COL_NEW_CASES = 6
| row_most_recent_day = 1
row_first_complete_day = 3
col_area_code = 0
col_area_name = 1
col_area_type = 2
col_date = 3
col_total_deaths = 4
col_hospital_cases = 5
col_new_cases = 6 |
DEFAULT_AUTOPILOT_CONFIG = {
'region_name': 'YOUR_REGION',
's3_bucket': 'YOUR_S3_BUCKET',
'role_arn': 'YOUR_ROLE_ARN',
}
| default_autopilot_config = {'region_name': 'YOUR_REGION', 's3_bucket': 'YOUR_S3_BUCKET', 'role_arn': 'YOUR_ROLE_ARN'} |
#
t = int(input("T:"))
list = []
for i in range(0,t):
k = input("A B :")
list.append(k)
print(list)
for z in range(0,len(list)):
q = str(list[z])
m = q.split(" ")
print(int(m[0])+int(m[1]))
| t = int(input('T:'))
list = []
for i in range(0, t):
k = input('A B :')
list.append(k)
print(list)
for z in range(0, len(list)):
q = str(list[z])
m = q.split(' ')
print(int(m[0]) + int(m[1])) |
class BianPlugin():
def ready(self):
return True
def run(self,core,*params):
if len(params) != 4:
raise Exception("missing params:"+str(params))
init = "from halo_bian.bian.exceptions import BianException\n\nfrom halo_bian.bian.bian import ActionTerms\n\nfrom botocore.exce... | class Bianplugin:
def ready(self):
return True
def run(self, core, *params):
if len(params) != 4:
raise exception('missing params:' + str(params))
init = 'from halo_bian.bian.exceptions import BianException\n\nfrom halo_bian.bian.bian import ActionTerms\n\nfrom botocore.exc... |
V,E=map(int,input().split())
edges=[set() for i in range(V)]
for i in range(E):
a,b=map(int,input().split())
edges[a-1].add(b-1)
edges[b-1].add(a-1)
for i in range(V):
print(len({n for v in edges[i] for n in edges[v] if not n in edges[i] and n!=i})) | (v, e) = map(int, input().split())
edges = [set() for i in range(V)]
for i in range(E):
(a, b) = map(int, input().split())
edges[a - 1].add(b - 1)
edges[b - 1].add(a - 1)
for i in range(V):
print(len({n for v in edges[i] for n in edges[v] if not n in edges[i] and n != i})) |
'''
Copyright (C) 2021 Sovrasov V. - All Rights Reserved
* You may use, distribute and modify this code under the
* terms of the MIT license.
* You should have received a copy of the MIT license with
* this file. If not visit https://opensource.org/licenses/MIT
'''
def flops_to_string(flops, units='GMac', precisi... | """
Copyright (C) 2021 Sovrasov V. - All Rights Reserved
* You may use, distribute and modify this code under the
* terms of the MIT license.
* You should have received a copy of the MIT license with
* this file. If not visit https://opensource.org/licenses/MIT
"""
def flops_to_string(flops, units='GMac', precisio... |
a=[12,9,1,3]
a1=[12,9,1,3]
s=[]
z=0
c=0
#expected a=[1,3,12,9]
for i in range(len(a)):
q=0
while(a1[i]>0):
z=a1[i]%10
q=q+z
a1[i]=a1[i]//10
s.append(q)
print(a)
s.sort()
print(s)
| a = [12, 9, 1, 3]
a1 = [12, 9, 1, 3]
s = []
z = 0
c = 0
for i in range(len(a)):
q = 0
while a1[i] > 0:
z = a1[i] % 10
q = q + z
a1[i] = a1[i] // 10
s.append(q)
print(a)
s.sort()
print(s) |
# host and port for client and tracker
HOST = '192.168.43.92'
PORT = 9992
# redis key prefixes
TRANSACTION_QUEUE_KEY = 'transactions.queue'
BLOCK_KEY_PREFIX = 'chain.block.'
PREV_HASH_KEY = 'prev_hash'
SEND_TRANSACTIONS_QUEUE_KEY = 'send.transactions.queue'
TRANSACTIONS_SIGNATURE = 'transactions.signature.'
# number ... | host = '192.168.43.92'
port = 9992
transaction_queue_key = 'transactions.queue'
block_key_prefix = 'chain.block.'
prev_hash_key = 'prev_hash'
send_transactions_queue_key = 'send.transactions.queue'
transactions_signature = 'transactions.signature.'
transactions_in_block = 1
gamer_bawa = 1024 |
# -*- coding: utf-8 -*-
description = 'Monitoring for DNS setup'
group = 'basic'
tango_base = 'tango://localhost:10000/test/'
devices = dict(
dns_main_voltages = device('nicos_mlz.emc.devices.janitza_online.VectorInput',
description = 'Voltage monitoring',
tangodevice = tango_base + 'janitza_dns/... | description = 'Monitoring for DNS setup'
group = 'basic'
tango_base = 'tango://localhost:10000/test/'
devices = dict(dns_main_voltages=device('nicos_mlz.emc.devices.janitza_online.VectorInput', description='Voltage monitoring', tangodevice=tango_base + 'janitza_dns/voltages'), dns_main_currents=device('nicos_mlz.emc.de... |
#
# PySNMP MIB module HPN-ICF-DHCPSNOOP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-DHCPSNOOP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:25:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) ... |
## HTML lists ##
CHECKBOX_TOGGLES = [
"accelerometer",
"gps",
"calls",
"texts",
"wifi",
"bluetooth",
"power_state",
"proximity",
"gyro",
"magnetometer",
"devicemotion",
"ambient_audio",
"reachability",
"allow_upload_over_cellular_data",
"use_anonymized_hashing... | checkbox_toggles = ['accelerometer', 'gps', 'calls', 'texts', 'wifi', 'bluetooth', 'power_state', 'proximity', 'gyro', 'magnetometer', 'devicemotion', 'ambient_audio', 'reachability', 'allow_upload_over_cellular_data', 'use_anonymized_hashing', 'use_gps_fuzzing', 'call_clinician_button_enabled', 'call_research_assistan... |
# Comments allow for programers to write reminders or create a better understanding of the code and program
city_name = "St. Potatosburg"
# The amount of people living in the city of St. Potatosburg:
city_pop = 340000 | city_name = 'St. Potatosburg'
city_pop = 340000 |
class Solution:
def dropNegatives(self, A):
j = 0
newlist = []
for i in range(len(A)):
if A[i] > 0:
newlist.append(A[i])
return newlist
def firstMissingPositive(self, nums: List[int]) -> int:
A = self.dropNegatives(nums)
if len(A)==0:
... | class Solution:
def drop_negatives(self, A):
j = 0
newlist = []
for i in range(len(A)):
if A[i] > 0:
newlist.append(A[i])
return newlist
def first_missing_positive(self, nums: List[int]) -> int:
a = self.dropNegatives(nums)
if len(A) ... |
def group_weekly(df, date_col):
weekly = df.copy()
weekly['week'] = weekly[date_col].dt.isocalendar().week
weekly['year'] = weekly[date_col].dt.isocalendar().year
weekly['year_week'] = weekly['year'].astype(str) + "-" + weekly['week'].astype(str)
weekly = weekly.groupby('year_week').sum()
weekly... | def group_weekly(df, date_col):
weekly = df.copy()
weekly['week'] = weekly[date_col].dt.isocalendar().week
weekly['year'] = weekly[date_col].dt.isocalendar().year
weekly['year_week'] = weekly['year'].astype(str) + '-' + weekly['week'].astype(str)
weekly = weekly.groupby('year_week').sum()
weekly... |
# coding:utf-8
workers = 4
threads = 4
bind = '0.0.0.0:5000'
worker_class = 'eventlet' # 'gevent'
worker_connections = 2000
pidfile = 'gunicorn.pid'
accesslog = './logs/gunicorn_acess.log'
errorlog = './logs/gunicorn_error.log'
loglevel = 'info'
reload = True
| workers = 4
threads = 4
bind = '0.0.0.0:5000'
worker_class = 'eventlet'
worker_connections = 2000
pidfile = 'gunicorn.pid'
accesslog = './logs/gunicorn_acess.log'
errorlog = './logs/gunicorn_error.log'
loglevel = 'info'
reload = True |
# The below function calculates the BMI or Body Mass Index of a person
# Created by Agamdeep Singh / CodeWithAgam
# Youtube: CodeWithAgam
# Github: CodeWithAgam
# Instagram: @agamdeep_21, @coderagam001
# Twitter: @CoderAgam001
# Linkdin: Agamdeep Singh
def calculate_BMI():
# Get the inputs from the user
height... | def calculate_bmi():
height = float(input('Enter your height in M: '))
weight = float(input('Enter your weight in KG: '))
bmi = int(weight / height ** 2)
if BMI < 18.5:
print(f'Your BMI is {BMI}, you are underweight!')
elif BMI < 25:
print(f'Your BMI is {BMI}, you have a normal weigh... |
{
"includes": [
"common.gypi",
],
"targets": [
{
"target_name": "colony-lua",
"product_name": "colony-lua",
"type": "static_library",
"defines": [
'LUA_USELONGLONG',
],
"sources": [
'<(colony_lua_path)/src/lapi.c',
'<(colony_lua_path)/src/lauxl... | {'includes': ['common.gypi'], 'targets': [{'target_name': 'colony-lua', 'product_name': 'colony-lua', 'type': 'static_library', 'defines': ['LUA_USELONGLONG'], 'sources': ['<(colony_lua_path)/src/lapi.c', '<(colony_lua_path)/src/lauxlib.c', '<(colony_lua_path)/src/lbaselib.c', '<(colony_lua_path)/src/lcode.c', '<(colon... |
awnser = 5
print('Enter a number between 1 and 10')
for i in range(0, 4):
guess = int(input(f'You have {4-i} guesses left: '))
if guess == 5 or guess == 10:
print('You guessed correct!')
break
else:
print(f'The guess of {guess} was not correct')
if guess > awnser:
print('Your guess was too l... | awnser = 5
print('Enter a number between 1 and 10')
for i in range(0, 4):
guess = int(input(f'You have {4 - i} guesses left: '))
if guess == 5 or guess == 10:
print('You guessed correct!')
break
else:
print(f'The guess of {guess} was not correct')
if guess > awnser:
... |
class WrongInputDataType(Exception):
def __init__(self, message="Input data must be a pandas.Series."):
self.message = message
super().__init__(self.message)
class NotFittedError(Exception):
def __init__(self, message="Please call fit() before detect().", tip=""):
self.message = " ".jo... | class Wronginputdatatype(Exception):
def __init__(self, message='Input data must be a pandas.Series.'):
self.message = message
super().__init__(self.message)
class Notfittederror(Exception):
def __init__(self, message='Please call fit() before detect().', tip=''):
self.message = ' '.j... |
alpha = "abcdefghijklmnopqrstuvwxyz"
key = "xznlwebgjhqdyvtkfuompciasr"
message = input("enter the message : ")
cipher = ""
for i in message:
cipher+=key[alpha.index(i)]
print(cipher) | alpha = 'abcdefghijklmnopqrstuvwxyz'
key = 'xznlwebgjhqdyvtkfuompciasr'
message = input('enter the message : ')
cipher = ''
for i in message:
cipher += key[alpha.index(i)]
print(cipher) |
def keep(sequence, predicate):
pass
def discard(sequence, predicate):
pass
| def keep(sequence, predicate):
pass
def discard(sequence, predicate):
pass |
n1=int(input('Digite a idade da primeira pessoa:'))
n2=int(input('Digite a idade da segunda pessoa:'))
n3=int(input('Digite a idade da terceira pessoa:'))
#Maior ou igual a 100
#menor que 100
soma = n1+ n2+ n3
if soma > 100 or soma == 100:
print('Maior ou igual a 100')
else:
print('Menor que 100')
| n1 = int(input('Digite a idade da primeira pessoa:'))
n2 = int(input('Digite a idade da segunda pessoa:'))
n3 = int(input('Digite a idade da terceira pessoa:'))
soma = n1 + n2 + n3
if soma > 100 or soma == 100:
print('Maior ou igual a 100')
else:
print('Menor que 100') |
print ("Angka Pertama : ")
a = int(input())
print ("Angka Kedua : ")
b = int (input())
print (hasil = a * b)
| print('Angka Pertama : ')
a = int(input())
print('Angka Kedua : ')
b = int(input())
print(hasil=a * b) |
'''
LC1413: Minimum Value to Get Positive Step by Step Sum
Given an array of integers nums, you start
with an initial positive value startValue.
In each iteration, you calculate the step by
step sum of startValue plus elements in nums (from left to right).
Return the minimum positive value of startValue
such that the s... | """
LC1413: Minimum Value to Get Positive Step by Step Sum
Given an array of integers nums, you start
with an initial positive value startValue.
In each iteration, you calculate the step by
step sum of startValue plus elements in nums (from left to right).
Return the minimum positive value of startValue
such that the s... |
def solve_part_one(puzzle: list) -> int:
turn = 1
numbers = []
while turn <= 2020:
if turn <= len(puzzle):
numbers.append(puzzle[turn - 1])
turn += 1
continue
# We finished the initial list. Look at the last number
last_num = numbers[-1]
if... | def solve_part_one(puzzle: list) -> int:
turn = 1
numbers = []
while turn <= 2020:
if turn <= len(puzzle):
numbers.append(puzzle[turn - 1])
turn += 1
continue
last_num = numbers[-1]
if last_num in numbers[:len(numbers) - 1]:
previous_tu... |
#
# PySNMP MIB module BNET-ATM-ATOM-AUG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BNET-ATM-ATOM-AUG-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:40:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint, constraints_union) ... |
UP_KEY = 16777235
DOWN_KEY = 16777237
TAB_KEY = 16777217 | up_key = 16777235
down_key = 16777237
tab_key = 16777217 |
#author Kollen Gruizenga
#function to return all words in list L who start with letter "let"
def beginWith(L, let):
result = []
for x in L:
if (x[0] == let):
result += [x]
return result
| def begin_with(L, let):
result = []
for x in L:
if x[0] == let:
result += [x]
return result |
CAMPAIGN_INCIDENT_CONTEXT = {
"EmailCampaign": {
"firstIncidentDate": "2021-11-21T14:00:07.425185+00:00",
"incidents": [
{
"emailfrom": "examplesupport@example2.com",
"emailfromdomain": "example.com",
"id": "1",
"name": "Ver... | campaign_incident_context = {'EmailCampaign': {'firstIncidentDate': '2021-11-21T14:00:07.425185+00:00', 'incidents': [{'emailfrom': 'examplesupport@example2.com', 'emailfromdomain': 'example.com', 'id': '1', 'name': 'Verify your example account 798', 'occurred': '2021-11-21T14:00:07.119800133Z', 'recipients': ['victim-... |
'''
Class to represent plant care.
'''
class Plant_Care:
'''
General representation of abstract plant care.
'''
def __init__(self,
times_monthly=2,
plant_type='Cacti',
soil_moisutre='Arid'):
self.times_monthly = times_monthly
self.plan... | """
Class to represent plant care.
"""
class Plant_Care:
"""
General representation of abstract plant care.
"""
def __init__(self, times_monthly=2, plant_type='Cacti', soil_moisutre='Arid'):
self.times_monthly = times_monthly
self.plant_type = plant_type
self.soil_moisture = so... |
#
# PySNMP MIB module NTWS-AP-CONFIG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTWS-AP-CONFIG-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:25:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, constraints_intersection, value_range_constraint) ... |
class CarTablePage(Page):
add_car_form = AddCarForm()
car_table = CarTable()
def add_car(self, car: Car):
self.add_car_form.add_car(car)
def remove_car(self, car: Car):
self.car_table.remove_car(car)
@property
def cars(self) -> List[Car]:
return self.car_table.cars
| class Cartablepage(Page):
add_car_form = add_car_form()
car_table = car_table()
def add_car(self, car: Car):
self.add_car_form.add_car(car)
def remove_car(self, car: Car):
self.car_table.remove_car(car)
@property
def cars(self) -> List[Car]:
return self.car_table.cars |
#
# PySNMP MIB module UBNT-AirMAX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/UBNT-AirMAX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:28:21 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ... |
def handle_annotations(annotations):
new_global = {}
new_local = {}
if 'global' in annotations:
for key in annotations['global']:
key_new = key.replace('__EQUALS__', '=')
new_global[key_new] = annotations['global'][key]
if 'local' in annotations:
for key in anno... | def handle_annotations(annotations):
new_global = {}
new_local = {}
if 'global' in annotations:
for key in annotations['global']:
key_new = key.replace('__EQUALS__', '=')
new_global[key_new] = annotations['global'][key]
if 'local' in annotations:
for key in annota... |
# Fields
NAME = 'name'
NUMBER = 'number'
SET = 'set'
TYPE = 'type'
IS_INSTANT = 'is-instant'
MEDICINE = 'medicine'
PLUS_DIG = 'plus-dig'
PLUS_HUNT = 'plus-hunt'
PLUS_FIGHT = 'plus-fight'
ABILITY = 'ability'
TEXT = 'text'
# Set values
BASE = 'base'
HQ_EXP = 'hq'
RECON_EXP = 'recon'
# Type values
JUNKYARD = 'junkyard'
... | name = 'name'
number = 'number'
set = 'set'
type = 'type'
is_instant = 'is-instant'
medicine = 'medicine'
plus_dig = 'plus-dig'
plus_hunt = 'plus-hunt'
plus_fight = 'plus-fight'
ability = 'ability'
text = 'text'
base = 'base'
hq_exp = 'hq'
recon_exp = 'recon'
junkyard = 'junkyard'
contested_resource = 'contested-resour... |
class LocationFailureException(Exception):
pass
class BadLatitudeException(Exception):
pass
class BadLongitudeException(Exception):
pass
class BadAltitudeException(Exception):
pass
class BadNumberException(Exception):
pass
class GetPassesException(Exception):
pass
class AstronautFail... | class Locationfailureexception(Exception):
pass
class Badlatitudeexception(Exception):
pass
class Badlongitudeexception(Exception):
pass
class Badaltitudeexception(Exception):
pass
class Badnumberexception(Exception):
pass
class Getpassesexception(Exception):
pass
class Astronautfailureexc... |
# 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 constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode:
def maxTree(nums):
... | class Solution:
def construct_maximum_binary_tree(self, nums: List[int]) -> TreeNode:
def max_tree(nums):
idx = nums.index(max(nums))
node = tree_node(nums[idx])
if len(nums[idx + 1:]) > 0:
node.right = max_tree(nums[idx + 1:])
if len(nums[:i... |
# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int, input().split()))
pre = [0]*len(A)
pre[0] = A[0]
aft = [0]*len(A)
aft[-1] = A[-1]
for pos, it in enumerate(A[1:], 1):
pre[pos] = pre[pos-1]+it
for pos in range(len(A)-2, -1, -1):
aft[pos] = aft[pos+1]+A[pos]
ans = 0;
print(pre)
print(aft)
for pos in ra... | n = int(input())
a = list(map(int, input().split()))
pre = [0] * len(A)
pre[0] = A[0]
aft = [0] * len(A)
aft[-1] = A[-1]
for (pos, it) in enumerate(A[1:], 1):
pre[pos] = pre[pos - 1] + it
for pos in range(len(A) - 2, -1, -1):
aft[pos] = aft[pos + 1] + A[pos]
ans = 0
print(pre)
print(aft)
for pos in range(len(A)... |
def group(it, n):
it = iter(it)
block = []
for elem in it:
block.append(elem)
if len(block) == n:
yield block
block = []
if block:
yield block
| def group(it, n):
it = iter(it)
block = []
for elem in it:
block.append(elem)
if len(block) == n:
yield block
block = []
if block:
yield block |
class CriteriaBuilder():
'''Defines the CriteriaBuilder class'''
__and = None
__where = None
__or = None
__criteria = None
__cmd = None
__sql = None
@property
def AND( self ):
if self.__and is not None:
return self.__and
@property
def WHERE( self ):
... | class Criteriabuilder:
"""Defines the CriteriaBuilder class"""
__and = None
__where = None
__or = None
__criteria = None
__cmd = None
__sql = None
@property
def and(self):
if self.__and is not None:
return self.__and
@property
def where(self):
if... |
description = 'testing qmesydaq'
group = 'optional'
excludes = []
sysconfig = dict(
datasinks = ['LiveViewSink'],
)
tango_base = 'tango://localhost:10000/test/qmesydaq/'
devices = dict(
# RAWFileSaver = device('nicos.devices.datasinks.RawImageSink',
# description = 'Saves image data in RAW format',... | description = 'testing qmesydaq'
group = 'optional'
excludes = []
sysconfig = dict(datasinks=['LiveViewSink'])
tango_base = 'tango://localhost:10000/test/qmesydaq/'
devices = dict(LiveViewSink=device('nicos.devices.datasinks.LiveViewSink', description='Sends image data to LiveViewWidget'), qm_ctr0=device('nicos.devices... |
NUMBER = (1 << 15)
OPERATOR = (1 << 16)
FUNCTION = (1 << 17)
OTHER = (1 << 18)
OPERATOR_PRIORITY_1 = (1 << 10)
OPERATOR_PRIORITY_2 = (1 << 11) # Multiplication & Division
OPERATOR_PRIORITY_3 = (1 << 12) # Implicit Multiplication (0.5/2x, a/b(c))
OPERATOR_PRIORITY_4 = (1 << 13) # Root & Exponent
STUndefined = 0
ST... | number = 1 << 15
operator = 1 << 16
function = 1 << 17
other = 1 << 18
operator_priority_1 = 1 << 10
operator_priority_2 = 1 << 11
operator_priority_3 = 1 << 12
operator_priority_4 = 1 << 13
st_undefined = 0
st_number = NUMBER | 1
st_factor = NUMBER | 2
st_addition = OPERATOR | OPERATOR_PRIORITY_1 | 2
st_subtraction = ... |
# test for function notation
def helloworld(txt:dict(type=str,help='input text')):
print(txt)
if __name__ == '__main__' :
helloworld('hawken')
print(helloworld.__annotations__) | def helloworld(txt: dict(type=str, help='input text')):
print(txt)
if __name__ == '__main__':
helloworld('hawken')
print(helloworld.__annotations__) |
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_RENDERER_CLASSES': (
'rest_framewo... | admins = ()
managers = ADMINS
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}
rest_framework = {'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',), 'DEFAULT_RENDERER_CLASSES': ('rest_framework.renderers.JSONRenderer',)}
allowed_hosts = []
time_zone = 'UTC... |
# Motor Controller class initialization constants
ZERO_POWER = 309 # Value to set thrusters to 0 power
NEG_MAX_POWER = 226 # Value to set thrusters to max negative power
POS_MAX_POWER = 391 # Value to set thrusters to max positive power
FREQUENCY = 49.5 # Frequency at which the i2c to pwm will be updated
POWER_THRE... | zero_power = 309
neg_max_power = 226
pos_max_power = 391
frequency = 49.5
power_thresh = 115
manipulator_pin = 15
obs_tool_pin = 14
reverse_polarity = [] |
class Solution:
def checkIfExist(self, arr: List[int]) -> bool:
for i in range(len(arr)):
for j in range(len(arr)):
if i != j and arr[i] == 2*arr[j]:
return True
return False
| class Solution:
def check_if_exist(self, arr: List[int]) -> bool:
for i in range(len(arr)):
for j in range(len(arr)):
if i != j and arr[i] == 2 * arr[j]:
return True
return False |
def pattern(N):
if(N==2):
for i in range(N):
print(("#"*1+" ")*N)
if(N==3):
for i in range(N-1):
print(("#"*2+" ")*N)
if(N==4):
for i in range(N-2):
print(("#"*3+" ")*N)
pattern(2)
pattern(3)
pattern(4) | def pattern(N):
if N == 2:
for i in range(N):
print(('#' * 1 + ' ') * N)
if N == 3:
for i in range(N - 1):
print(('#' * 2 + ' ') * N)
if N == 4:
for i in range(N - 2):
print(('#' * 3 + ' ') * N)
pattern(2)
pattern(3)
pattern(4) |
# import numpy as np
# a = np.array([17,22,4,2,14,24,0,5,8,7,27,28,15,25,12,9,20,3,29,16,10,6,1,13,18,23,11,26,21,19])
# np.random.shuffle(a)
# print(a.tolist())
# np.random.shuffle(a)
# print(a.tolist())
# np.random.shuffle(a)
# print(a.tolist())
need_rerun = [
{'bodies': [300, 301, 302, 303, 304, 305, 306, 307,... | need_rerun = [{'bodies': [300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315], 'seed': 4, 'method': 'align'}, {'bodies': [300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315], 'seed': 6, 'method': 'random'}, {'bodies': [500, 501, 502, 503, 504, 505, 506, 507, 508, ... |
class _Food:
color = (107, 0, 0)
def __init__(self, pos_x, pos_y, live = 100):
self.pos_x = pos_x
self.pos_y = pos_y
self.live = live
def get_pos_x(self):
return self.pos_x
def get_pos_y(self):
return self.pos_y
def live_decrement(self):
self.live -=1 | class _Food:
color = (107, 0, 0)
def __init__(self, pos_x, pos_y, live=100):
self.pos_x = pos_x
self.pos_y = pos_y
self.live = live
def get_pos_x(self):
return self.pos_x
def get_pos_y(self):
return self.pos_y
def live_decrement(self):
self.live -=... |
while True:
print('Enter you age: ')
age = input()
if age.isdecimal():
break
print('Please enter a number for age')
while True:
print('Select a new password (letters and numbers only):')
password = input()
if password.isalnum():
break
print('Passwords can only have letters and numbers') | while True:
print('Enter you age: ')
age = input()
if age.isdecimal():
break
print('Please enter a number for age')
while True:
print('Select a new password (letters and numbers only):')
password = input()
if password.isalnum():
break
print('Passwords can only have letter... |
# -*- coding: utf-8 -*-
class ApiException(Exception):
errors = []
def __init__(self, errors, code):
self.errors = errors
self.code = code
| class Apiexception(Exception):
errors = []
def __init__(self, errors, code):
self.errors = errors
self.code = code |
#
# PySNMP MIB module HP-ICF-DHCPv6-SNOOP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-DHCPv6-SNOOP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:21:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, value_range_constraint, constraints_union, single_value_constraint) ... |
#
# 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 Mon Apr 29 18:52:21 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)... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) ... |
# Copyright 2018 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
doc="range"
a = range(255)
b = [e for e in a]
assert len(a) == len(b)
a = range(5, 100, 5)
b = [e for e in a]
assert len(a) == len(b)
a = range(100 ,0, 1)
... | doc = 'range'
a = range(255)
b = [e for e in a]
assert len(a) == len(b)
a = range(5, 100, 5)
b = [e for e in a]
assert len(a) == len(b)
a = range(100, 0, 1)
b = [e for e in a]
assert len(a) == len(b)
a = range(100, 0, -1)
b = [e for e in a]
assert len(a) == 100
assert len(b) == 100
doc = 'range_get_item'
a = range(3)
a... |
def selectionsort(arr):
i=0
while(i<len(arr)):
#find index of minimum number between index i and index n-1 where n=len(arr)
num,ind=arr[i],i
for j in range(i+1,len(arr)):
if(arr[j]<num):
num=arr[j]
ind=j
#swap number at ind with number at i
temp=arr[i]
arr[i]=arr[ind]
arr[ind]=temp
i+=1
re... | def selectionsort(arr):
i = 0
while i < len(arr):
(num, ind) = (arr[i], i)
for j in range(i + 1, len(arr)):
if arr[j] < num:
num = arr[j]
ind = j
temp = arr[i]
arr[i] = arr[ind]
arr[ind] = temp
i += 1
return arr
def... |
__title__ = 'road-surface-detection'
__version__ = '0.0.0'
__author__ = 'Esri Advanced Analytics Team'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2020 by Esri Advanced Analytics Team'
# add specific imports below if you want more control over what is visible
## from . import utils
| __title__ = 'road-surface-detection'
__version__ = '0.0.0'
__author__ = 'Esri Advanced Analytics Team'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2020 by Esri Advanced Analytics Team' |
ImgHeight = 32
data_roots = {
'iam_word': '/mydrive/MyDrive/khoa_luan/khoa_luan/data/'
}
data_paths = {
'iam_word': {'trnval': 'trnvalset_words%d.hdf5'%ImgHeight,
'test': 'testset_words%d.hdf5'%ImgHeight},
'iam_word_org': {'trnval': 'trnvalset_words%d_OrgSz.hdf5'%ImgHeight,
... | img_height = 32
data_roots = {'iam_word': '/mydrive/MyDrive/khoa_luan/khoa_luan/data/'}
data_paths = {'iam_word': {'trnval': 'trnvalset_words%d.hdf5' % ImgHeight, 'test': 'testset_words%d.hdf5' % ImgHeight}, 'iam_word_org': {'trnval': 'trnvalset_words%d_OrgSz.hdf5' % ImgHeight, 'test': 'testset_words%d_OrgSz.hdf5' % Im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.