content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#--------------------------------------------------------------------------------
# SoCaTel - Backend data storage API endpoints docker container
# These tokens are needed for database access.
#--------------------------------------------------------------------------------
#===========================================... | elastic_user_index = 'so_user'
elastic_group_index = 'so_group'
elastic_organisation_index = 'so_organisation'
elastic_service_index = 'so_service'
elastic_host = '<insert_elastic_host>'
elastic_port = '9200'
elastic_user = '<insert_elasticsearch_username>'
elastic_passwd = '<insert_elasticsearch_password>'
path = 'htt... |
x1 = 1
y1 = 0
x2 = 0
y2 = -2
m1 = (y2 / x1)
x1 = 2
y1 = 2
x2 = 6
y2 = 10
m2 = (y2 - y1 / x2 - x1)
diff = m1 - m2
print(f'Diff of 8 and 9: {diff:.2f}') # 10 | x1 = 1
y1 = 0
x2 = 0
y2 = -2
m1 = y2 / x1
x1 = 2
y1 = 2
x2 = 6
y2 = 10
m2 = y2 - y1 / x2 - x1
diff = m1 - m2
print(f'Diff of 8 and 9: {diff:.2f}') |
# https://www.codechef.com/problems/COPS
for T in range(int(input())):
M,x,y=map(int,input().split())
m,a = list(map(int,input().split())),list(range(1,101))
for i in m:
for j in range(i-x*y,i+1+x*y):
if(j in a): a.remove(j)
print(len(a)) | for t in range(int(input())):
(m, x, y) = map(int, input().split())
(m, a) = (list(map(int, input().split())), list(range(1, 101)))
for i in m:
for j in range(i - x * y, i + 1 + x * y):
if j in a:
a.remove(j)
print(len(a)) |
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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
#
# U... | class Jquery:
def __init__(self):
self.scripts = []
def render(self):
pass
def autocomplete(self, id):
ret = jquery_autocomplete(id)
self.scripts.append(ret)
return ret
def button(self, id):
ret = jquery_button(id)
self.scripts.append(ret)
... |
description = 'Verify the user cannot log in if password value is missing'
pages = ['login']
def test(data):
navigate(data.env.url)
send_keys(login.username_input, 'admin')
click(login.login_button)
capture('Verify the correct error message is shown')
verify_text_in_element(login.error_list, 'Pas... | description = 'Verify the user cannot log in if password value is missing'
pages = ['login']
def test(data):
navigate(data.env.url)
send_keys(login.username_input, 'admin')
click(login.login_button)
capture('Verify the correct error message is shown')
verify_text_in_element(login.error_list, 'Passw... |
#######################################################################
# Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
################################... | class Constantschedule:
def __init__(self, val):
self.val = val
def __call__(self, steps=1):
return self.val
class Linearschedule:
def __init__(self, start, end=None, steps=None):
if end is None:
end = start
steps = 1
self.inc = (end - start) / flo... |
def forward(w,s,b,y):
Yhat= w * s + b
output = (Yhat-y)**2
return output, Yhat
def derivative_W(x, output, Yhat, y):
return ((2 * output) * (Yhat - y)) * x # w
def derivative_B(b, output, Yhat, y):
return ((2 * output) * (Yhat - y)) * b #bias
def main():
w = 1.0 #weight
x = 2.0 #samp... | def forward(w, s, b, y):
yhat = w * s + b
output = (Yhat - y) ** 2
return (output, Yhat)
def derivative_w(x, output, Yhat, y):
return 2 * output * (Yhat - y) * x
def derivative_b(b, output, Yhat, y):
return 2 * output * (Yhat - y) * b
def main():
w = 1.0
x = 2.0
b = 1.0
y = 2.0 * ... |
def banner(message, length, header='=', footer='*'):
print()
print(header * length)
print((' ' * (length//2 - len(message)//2)), message)
print(footer * length)
def banner_v2(length, footer='-'):
print(footer * length)
print()
| def banner(message, length, header='=', footer='*'):
print()
print(header * length)
print(' ' * (length // 2 - len(message) // 2), message)
print(footer * length)
def banner_v2(length, footer='-'):
print(footer * length)
print() |
# Soft-serve Damage Skin
success = sm.addDamageSkin(2434951)
if success:
sm.chat("The Soft-serve Damage Skin has been added to your account's damage skin collection.")
| success = sm.addDamageSkin(2434951)
if success:
sm.chat("The Soft-serve Damage Skin has been added to your account's damage skin collection.") |
num1 = 100
num2 = 200
num3 = 300
num4 = 400
num5 = 500
mum6 = 600
num7 = 700
num8 = 800
| num1 = 100
num2 = 200
num3 = 300
num4 = 400
num5 = 500
mum6 = 600
num7 = 700
num8 = 800 |
def required_model(name: object, kwargs: object) -> object:
required_fields = kwargs['required_fields'] if 'required_fields' in kwargs else []
task_f = kwargs['required_task_fields'] if 'required_task_fields' in kwargs else []
proc_f = kwargs['required_proc_fields'] if 'required_proc_fields' in kwargs else []
disp... | def required_model(name: object, kwargs: object) -> object:
required_fields = kwargs['required_fields'] if 'required_fields' in kwargs else []
task_f = kwargs['required_task_fields'] if 'required_task_fields' in kwargs else []
proc_f = kwargs['required_proc_fields'] if 'required_proc_fields' in kwargs else ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Unit:
def __init__(self, x, y, color, name):
self.x = x
self.y = y
self.color = color
self.name = name
self.taken = False
class OpUnit(Unit):
def __init__(self, x, y, color, name):
super().__init__(x, y, color... | class Unit:
def __init__(self, x, y, color, name):
self.x = x
self.y = y
self.color = color
self.name = name
self.taken = False
class Opunit(Unit):
def __init__(self, x, y, color, name):
super().__init__(x, y, color, name)
self.blue = 0.0 |
#!/usr/bin/env python
#coding: utf-8
class Node:
def __init__(self, elem=None, next=None):
self.elem = elem
self.next = next
if __name__ == "__main__":
n1 = Node(1, None)
n2 = Node(2, None)
n1.next = n2
| class Node:
def __init__(self, elem=None, next=None):
self.elem = elem
self.next = next
if __name__ == '__main__':
n1 = node(1, None)
n2 = node(2, None)
n1.next = n2 |
def test_check_sanity(client):
resp = client.get('/sanity')
assert resp.status_code == 200
assert 'Sanity check passed.' == resp.data.decode()
# 'list collections' tests
def test_get_api_root(client):
resp = client.get('/', content_type='application/json')
assert resp.status_code == 200
resp_d... | def test_check_sanity(client):
resp = client.get('/sanity')
assert resp.status_code == 200
assert 'Sanity check passed.' == resp.data.decode()
def test_get_api_root(client):
resp = client.get('/', content_type='application/json')
assert resp.status_code == 200
resp_data = resp.get_json()
as... |
'''
Single perceptron can replicate a NAND gate
https://en.wikipedia.org/wiki/NAND_logic
inputs | output
0 0 1
0 1 1
1 0 1
1 1 0
'''
def dot_product(vec1,vec2):
if (len(vec1) != len(vec2)):
print("input vector lengths are not equal")
print(len(vec1))
print(len(vec2))
reslt=0
for... | """
Single perceptron can replicate a NAND gate
https://en.wikipedia.org/wiki/NAND_logic
inputs | output
0 0 1
0 1 1
1 0 1
1 1 0
"""
def dot_product(vec1, vec2):
if len(vec1) != len(vec2):
print('input vector lengths are not equal')
print(len(vec1))
print(len(vec2))
... |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
dictionary = {}
for number in A:
if dictionary.get(number) == None:
dictionary[number] = 1
else:
dictionary[number] += 1
for ke... | def solution(A):
dictionary = {}
for number in A:
if dictionary.get(number) == None:
dictionary[number] = 1
else:
dictionary[number] += 1
for key in dictionary.keys():
if dictionary.get(key) % 2 == 1:
return key |
print(4+3);
print("Hello");
print('Who are you');
print('This is Pradeep\'s python program');
print(r'C:\Users\N51254\Documents\NetBeansProjects');
print("Pradeep "*5); | print(4 + 3)
print('Hello')
print('Who are you')
print("This is Pradeep's python program")
print('C:\\Users\\N51254\\Documents\\NetBeansProjects')
print('Pradeep ' * 5) |
class Bank():
def __init__(self):
pass
def reduce(self, source, to):
return source.reduce(to)
| class Bank:
def __init__(self):
pass
def reduce(self, source, to):
return source.reduce(to) |
SQLALCHEMY_DATABASE_URI = 'sqlite:///database.sqlite'
SECRET_KEY = 'F12Zr47j\3yX R~X@H!jmM]Lwf/,?KT'
SAVE_FOLDER = '../../../projects'
SQLALCHEMY_TRACK_MODIFICATIONS = 'False'
PORT = '3000'
STATIC_FOLDER = '../../client/dist/static'
| sqlalchemy_database_uri = 'sqlite:///database.sqlite'
secret_key = 'F12Zr47j\x03yX R~X@H!jmM]Lwf/,?KT'
save_folder = '../../../projects'
sqlalchemy_track_modifications = 'False'
port = '3000'
static_folder = '../../client/dist/static' |
discovery_node_rpc_url='https://ctz.solidwallet.io/api/v3'
request_data = {
"jsonrpc": "2.0",
"id": 1234,
"method": "icx_call",
"params": {
"to": "cx0000000000000000000000000000000000000000",
"dataType": "call",
"data": {
... | discovery_node_rpc_url = 'https://ctz.solidwallet.io/api/v3'
request_data = {'jsonrpc': '2.0', 'id': 1234, 'method': 'icx_call', 'params': {'to': 'cx0000000000000000000000000000000000000000', 'dataType': 'call', 'data': {'method': 'getPReps', 'params': {'startRanking': '0x1', 'endRanking': '0xaaa'}}}} |
# jaylin
hours = float(input("Enter hours worked: "))
rate = float(input("Enter hourly rate: "))
if (rate >= 15):
pay=(hours* rate)
print("Pay: $", pay)
else:
print("I'm sorry " + str(rate) + " is lower than the minimum wage!")
| hours = float(input('Enter hours worked: '))
rate = float(input('Enter hourly rate: '))
if rate >= 15:
pay = hours * rate
print('Pay: $', pay)
else:
print("I'm sorry " + str(rate) + ' is lower than the minimum wage!') |
# This is a namespace package. See also:
# http://pythonhosted.org/distribute/setuptools.html#namespace-packages
# http://osdir.com/ml/python.distutils.devel/2006-08/msg00029.html
__import__('pkg_resources').declare_namespace(__name__)
| __import__('pkg_resources').declare_namespace(__name__) |
# put your python code here
def event_time(hours, minutes, seconds):
return (hours * 3600) + (minutes * 60) + seconds
def time_difference(a, b):
return abs(a - b)
hours_1 = int(input())
minutes_1 = int(input())
seconds_1 = int(input())
hours_2 = int(input())
minutes_2 = int(input())
seconds_2 = int(input()... | def event_time(hours, minutes, seconds):
return hours * 3600 + minutes * 60 + seconds
def time_difference(a, b):
return abs(a - b)
hours_1 = int(input())
minutes_1 = int(input())
seconds_1 = int(input())
hours_2 = int(input())
minutes_2 = int(input())
seconds_2 = int(input())
event_1 = event_time(hours_1, minu... |
def get_config_cs2en():
config = {}
# Settings which should be given at start time, but are not, for convenience
config['the_task'] = 0
# Settings ----------------------------------------------------------------
config['allTagsSplit'] = 'allTagsSplit/' # can be 'allTagsSplit/', 'POSextra/' or ... | def get_config_cs2en():
config = {}
config['the_task'] = 0
config['allTagsSplit'] = 'allTagsSplit/'
config['identity_init'] = True
config['early_stopping'] = False
config['use_attention'] = True
config['error_fct'] = 'categorical_cross_entropy'
config['seq_len'] = 50
config['enc_nhid... |
ALLOWED_HOSTS = ['testserver']
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOC... | allowed_hosts = ['testserver']
email_backend = 'django.core.mail.backends.console.EmailBackend'
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}
caches = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'iosDevCourse'}, 'local': {'BACKEND': 'djang... |
my_dictionary = {
'type': 'Fruits',
'name': 'Apple',
'color': 'Green',
'available': True,
'number': 25
}
print(my_dictionary)
print(my_dictionary['name'])
# searching with wrong key
print(my_dictionary['weight'])
###############################################################
# printing keys and ... | my_dictionary = {'type': 'Fruits', 'name': 'Apple', 'color': 'Green', 'available': True, 'number': 25}
print(my_dictionary)
print(my_dictionary['name'])
print(my_dictionary['weight'])
for d in my_dictionary:
print(d, my_dictionary[d])
for data in my_dictionary.values():
print(data)
my_dictionary['color'] = 'Red... |
vTotal = 0
i = 0
vMenorValor = 0
cont = 1
vMenorValorItem = ''
while True:
vItem = str(input('Insira o nome do produto: '))
vValor = float(input('Valor do produto: R$'))
vTotal = vTotal + vValor
if vValor >= 1000:
i = i + 1
if cont == 1:
vMenorValor = vValor
vM... | v_total = 0
i = 0
v_menor_valor = 0
cont = 1
v_menor_valor_item = ''
while True:
v_item = str(input('Insira o nome do produto: '))
v_valor = float(input('Valor do produto: R$'))
v_total = vTotal + vValor
if vValor >= 1000:
i = i + 1
if cont == 1:
v_menor_valor = vValor
v_meno... |
# Tai Sakuma <tai.sakuma@gmail.com>
##__________________________________________________________________||
class Parallel(object):
def __init__(self, progressMonitor, communicationChannel, workingarea=None):
self.progressMonitor = progressMonitor
self.communicationChannel = communicationChannel
... | class Parallel(object):
def __init__(self, progressMonitor, communicationChannel, workingarea=None):
self.progressMonitor = progressMonitor
self.communicationChannel = communicationChannel
self.workingarea = workingarea
def __repr__(self):
name_value_pairs = (('progressMonitor'... |
# Algorithms > Warmup > Compare the Triplets
# Compare the elements in two triplets.
#
# https://www.hackerrank.com/challenges/compare-the-triplets/problem
#
a = map(int, input().split())
b = map(int, input().split())
alice, bob = 0, 0
for i, j in zip(a, b):
if i > j:
alice += 1
elif i < ... | a = map(int, input().split())
b = map(int, input().split())
(alice, bob) = (0, 0)
for (i, j) in zip(a, b):
if i > j:
alice += 1
elif i < j:
bob += 1
print(alice, bob) |
'''
Normal Counting sort without any associated array to keep track of
Time Complexity = O(n)
Space Complexity = O(n + k)
Auxilary Space = O(k)
'''
def countingSort(a):
b = [0]*(max(a) + 1)
c = []
for i in range(len(a)):
b[a[i]] += 1
for i in range(len(b)):
if(b[i] != 0)... | """
Normal Counting sort without any associated array to keep track of
Time Complexity = O(n)
Space Complexity = O(n + k)
Auxilary Space = O(k)
"""
def counting_sort(a):
b = [0] * (max(a) + 1)
c = []
for i in range(len(a)):
b[a[i]] += 1
for i in range(len(b)):
if b[i] !=... |
n,m=map(int,input().split())
L = [list(map(int,input().split())) for i in range(m)]
ans = 0
L.sort(key = lambda t:t[0],reverse = True)
for i in L[:-1]:
ans += max(0,n-i[0])
print(ans) | (n, m) = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
ans = 0
L.sort(key=lambda t: t[0], reverse=True)
for i in L[:-1]:
ans += max(0, n - i[0])
print(ans) |
N = int(input())
def factorial(N):
if N == 0:
return 1
return N * factorial(N-1)
print(factorial(N))
| n = int(input())
def factorial(N):
if N == 0:
return 1
return N * factorial(N - 1)
print(factorial(N)) |
class AreWeUnitTesting(object):
# no doc
Value = False
__all__ = []
| class Areweunittesting(object):
value = False
__all__ = [] |
CJ_PATH = r''
COOKIES_PATH = r''
CHAN_ID = ''
VID_ID = ''
| cj_path = ''
cookies_path = ''
chan_id = ''
vid_id = '' |
class Rectangle:
def __init__(self, length, breadth, unit_cost=0):
self.length = length
self.breadth = breadth
self.unit_cost = unit_cost
def get_area(self):
return self.length * self.breadth
def calculate_cost(self):
area = self.get_area()
return area * self.unit_cost... | class Rectangle:
def __init__(self, length, breadth, unit_cost=0):
self.length = length
self.breadth = breadth
self.unit_cost = unit_cost
def get_area(self):
return self.length * self.breadth
def calculate_cost(self):
area = self.get_area()
return area * se... |
# URLs processed simultaneously
class Batch():
def __init__(self):
self._batch = 0
def set_batch(self, n_batch):
try:
self._batch = n_batch
except BaseException:
print("[ERROR] Can't set task batch number.")
def get_batch(self):
try:
r... | class Batch:
def __init__(self):
self._batch = 0
def set_batch(self, n_batch):
try:
self._batch = n_batch
except BaseException:
print("[ERROR] Can't set task batch number.")
def get_batch(self):
try:
return self._batch
except Bas... |
playerFilesWin = {
"lib/avcodec-56.dll" : { "flag_deps" : True, "should_be_removed" : True },
"lib/avformat-56.dll" : { "flag_deps" : True, "should_be_removed" : True },
"lib/avutil-54.dll" : { "flag_deps" : True, "should_be_removed" : True },
"lib/swscale-3.dll" : { "flag_deps" : True, "shou... | player_files_win = {'lib/avcodec-56.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/avformat-56.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/avutil-54.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/swscale-3.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/gen_files_list.p... |
# Hello world program to demonstrate running PYthon files
print('Hello, world!')
print('I live on a volcano!')
| print('Hello, world!')
print('I live on a volcano!') |
class Productivity:
def __init__(self, irradiance, hours,capacity):
self.irradiance = irradiance
self.hours = hours
self.capacity = capacity
def getUnits(self):
print(self.irradiance)
totalpower = 0
print(totalpower)
for i in self.irradiance... | class Productivity:
def __init__(self, irradiance, hours, capacity):
self.irradiance = irradiance
self.hours = hours
self.capacity = capacity
def get_units(self):
print(self.irradiance)
totalpower = 0
print(totalpower)
for i in self.irradiance:
... |
def create_platform_routes(server):
metrics = server._augur.metrics
| def create_platform_routes(server):
metrics = server._augur.metrics |
__version__ = '0.1.7'
default_app_config = 'dynamic_databases.apps.DynamicDatabasesConfig'
| __version__ = '0.1.7'
default_app_config = 'dynamic_databases.apps.DynamicDatabasesConfig' |
PHYSICS_TECHS = {
"tech_databank_uplinks",
"tech_basic_science_lab_1",
"tech_curator_lab",
"tech_archeology_lab",
"tech_physics_lab_1",
"tech_physics_lab_2",
"tech_physics_lab_3",
"tech_global_research_initiative",
"tech_administrative_ai",
"tech_cryostasis_1",
"tech_cryostas... | physics_techs = {'tech_databank_uplinks', 'tech_basic_science_lab_1', 'tech_curator_lab', 'tech_archeology_lab', 'tech_physics_lab_1', 'tech_physics_lab_2', 'tech_physics_lab_3', 'tech_global_research_initiative', 'tech_administrative_ai', 'tech_cryostasis_1', 'tech_cryostasis_2', 'tech_self_aware_logic', 'tech_automat... |
# Custom errors in classes.
class TooManyPagesReadError(ValueError):
pass
class Book:
def __init__(self, title, page_count):
self.title = title
self.page_count = page_count
self.pages_read = 0
def __repr__(self):
return (
f"<Book {self.title}, read {self.pages_... | class Toomanypagesreaderror(ValueError):
pass
class Book:
def __init__(self, title, page_count):
self.title = title
self.page_count = page_count
self.pages_read = 0
def __repr__(self):
return f'<Book {self.title}, read {self.pages_read} pages out of {self.page_count}>'
... |
Candies = [int(x) for x in input("Enter the numbers with space: ").split()]
extraCandies=int(input("Enter the number of extra candies: "))
Output=[ ]
i=0
while(i<len(Candies)):
if(Candies[i]+extraCandies>=max(Candies)):
Output.append("True")
else:
Output.append("False")
i+=1
print(Output)
| candies = [int(x) for x in input('Enter the numbers with space: ').split()]
extra_candies = int(input('Enter the number of extra candies: '))
output = []
i = 0
while i < len(Candies):
if Candies[i] + extraCandies >= max(Candies):
Output.append('True')
else:
Output.append('False')
i += 1
prin... |
class MicromagneticModell:
def __init__(self, name, Ms, calc):
self.name = name
self.Ms = Ms
self.field = None
self.calc = calc
def __str__(self):
return "AbstractMicromagneticModell(name={})".format(self.name)
def relax(self):
self.calc.relax(self)
def... | class Micromagneticmodell:
def __init__(self, name, Ms, calc):
self.name = name
self.Ms = Ms
self.field = None
self.calc = calc
def __str__(self):
return 'AbstractMicromagneticModell(name={})'.format(self.name)
def relax(self):
self.calc.relax(self)
de... |
# eventually we will have a proper config
ANONYMIZATION_THRESHOLD = 10
WAREHOUSE_URI = 'postgres://localhost'
WAGE_RECORD_URI = 'postgres://localhost'
| anonymization_threshold = 10
warehouse_uri = 'postgres://localhost'
wage_record_uri = 'postgres://localhost' |
N = int(input().strip())
names = []
for _ in range(N):
name,email = input().strip().split(' ')
name,email = [str(name),str(email)]
if email.endswith("@gmail.com"):
names.append(name)
names.sort()
for n in names:
print(n)
| n = int(input().strip())
names = []
for _ in range(N):
(name, email) = input().strip().split(' ')
(name, email) = [str(name), str(email)]
if email.endswith('@gmail.com'):
names.append(name)
names.sort()
for n in names:
print(n) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def upper_print(f):
def wrapper(*args, **kwargs):
f(*[i.upper() if hasattr(i, 'upper') else i for i in args], **kwargs)
return wrapper
if __name__ == '__main__':
text = 'hello world!'
print(text) # hello world!
ol... | __author__ = 'ipetrash'
def upper_print(f):
def wrapper(*args, **kwargs):
f(*[i.upper() if hasattr(i, 'upper') else i for i in args], **kwargs)
return wrapper
if __name__ == '__main__':
text = 'hello world!'
print(text)
old_print = print
print = upper_print(print)
print(text)
p... |
if __name__ == '__main__':
# Check correct price prediction
price_input_path = 'tests/data/Price_Simple.csv'
price_input = open(price_input_path, 'r').read().splitlines()[0].split(';')
price_prediction = open('price_prediction.csv', 'r').read().splitlines()[0].split(';')
assert price_input == price_... | if __name__ == '__main__':
price_input_path = 'tests/data/Price_Simple.csv'
price_input = open(price_input_path, 'r').read().splitlines()[0].split(';')
price_prediction = open('price_prediction.csv', 'r').read().splitlines()[0].split(';')
assert price_input == price_prediction[:3]
ground_truth = 130... |
rows = []
try:
while True:
rows.append(int(input()))
except EOFError:
pass
rows.sort()
goal = 2020
l = 0
r = len(rows) - 1
while rows[l] + rows[r] != goal and l < r:
if rows[l] + rows[r] < goal:
l += 1
else:
r -= 1
if rows[l] + rows[r] == goal:
print(rows[l] * rows[r])
e... | rows = []
try:
while True:
rows.append(int(input()))
except EOFError:
pass
rows.sort()
goal = 2020
l = 0
r = len(rows) - 1
while rows[l] + rows[r] != goal and l < r:
if rows[l] + rows[r] < goal:
l += 1
else:
r -= 1
if rows[l] + rows[r] == goal:
print(rows[l] * rows[r])
else:
... |
class Telecom:
def __init__(self, contact_db_id, system, value, use, rank, period):
self.contact_db_id = contact_db_id
self.system = system
self.value = value
self.use = use
self.rank = rank
self.period = period
def get_contact_db_id(self):
return self.contact_db_id
def get_system(self):
return se... | class Telecom:
def __init__(self, contact_db_id, system, value, use, rank, period):
self.contact_db_id = contact_db_id
self.system = system
self.value = value
self.use = use
self.rank = rank
self.period = period
def get_contact_db_id(self):
return self.c... |
# kasutaja sisestab 3 numbrit
number1 = int(input("Sisesta esimene arv: "))
number2 = int(input("Sisesta teine arv: "))
number3 = int(input("Sisesta kolmas arv: "))
# funktsioon, mis tagastab kolmes sisestatud arvust suurima
def largest(number1, number2, number3):
biggest = 0
if number1 > biggest:
big... | number1 = int(input('Sisesta esimene arv: '))
number2 = int(input('Sisesta teine arv: '))
number3 = int(input('Sisesta kolmas arv: '))
def largest(number1, number2, number3):
biggest = 0
if number1 > biggest:
biggest = number1
if number2 > number1:
biggest = number2
if number3 > number2... |
#Tuplas
numeros = [1,2,4,5,6,7,8,9] #lista
usuario = {'Nome':'Mateus' , 'senha':123456789 } #dicionario
pessoa = ('Mateus' , 'Alves' , 16 , 14 , 90) #tupla
print(numeros)
print(usuario)
print(pessoa)
numeros[1] = 8
usuario['senha'] = 4545343
| numeros = [1, 2, 4, 5, 6, 7, 8, 9]
usuario = {'Nome': 'Mateus', 'senha': 123456789}
pessoa = ('Mateus', 'Alves', 16, 14, 90)
print(numeros)
print(usuario)
print(pessoa)
numeros[1] = 8
usuario['senha'] = 4545343 |
###############################################################################
# Utils functions for language models.
#
# NOTE: source from https://github.com/litian96/FedProx
###############################################################################
ALL_LETTERS = "\n !\"&'(),-.0123456789:;>?ABCDEFGHIJKLMNOPQRST... | all_letters = '\n !"&\'(),-.0123456789:;>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz}'
num_letters = len(ALL_LETTERS)
def _one_hot(index, size):
"""returns one-hot vector with given size and value 1 at given index
"""
vec = [0 for _ in range(size)]
vec[int(index)] = 1
return vec
def le... |
a = str(input())
b = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0}
for i in a:
b[i] = b[i] + 1
for i in range(len(b)):
if b[str(i)] == 0:
continue
print(str(i) + ':' + str(b[str(i)]))
| a = str(input())
b = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0}
for i in a:
b[i] = b[i] + 1
for i in range(len(b)):
if b[str(i)] == 0:
continue
print(str(i) + ':' + str(b[str(i)])) |
class ModeIndicator:
LENGTH = 4
TERMINATOR_VALUE = 0x0
NUMERIC_VALUE = 0x1
ALPHANUMERIC_VALUE = 0x2
STRUCTURED_APPEND_VALUE = 0x3
BYTE_VALUE = 0x4
KANJI_VALUE = 0x8
| class Modeindicator:
length = 4
terminator_value = 0
numeric_value = 1
alphanumeric_value = 2
structured_append_value = 3
byte_value = 4
kanji_value = 8 |
# 11/03/21
# What does this code do?
# This code introduces a new idea, Dictionaries. The codes purpose is to take an input, and convert it into the numbers you'd need to press
# on an alphanumeric keypad, as shown in the picture.
# How do Dictionaries work?
# To use our dictionary, we first need to initial... | keypad = {'A': '2', 'B': '2', 'C': '2', 'D': '3', 'E': '3', 'F': '3', 'G': '4', 'H': '4', 'I': '4', 'J': '5', 'K': '5', 'L': '5', 'M': '6', 'N': '6', 'O': '6', 'P': '7', 'Q': '7', 'R': '7', 'S': '7', 'T': '8', 'U': '8', 'V': '8', 'W': '9', 'X': '9', 'Y': '9', 'Z': '9'}
word = input('Enter word: ')
for key in word:
... |
#
# PySNMP MIB module Juniper-V35-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-V35-CONF
# Produced by pysmi-0.3.4 at Wed May 1 14:04:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ... |
def maior_numero(lista):
a = lista[0]
for i in range(len(lista)):
if lista[i] > a:
a = lista[i]
return a
def remove_divisores_do_maior(lista):
maiornumero=maior_numero(lista)
for i in range(len(lista)-1,-1,-1):
if (maiornumero%lista[i])==0:
lista.pop(i)
re... | def maior_numero(lista):
a = lista[0]
for i in range(len(lista)):
if lista[i] > a:
a = lista[i]
return a
def remove_divisores_do_maior(lista):
maiornumero = maior_numero(lista)
for i in range(len(lista) - 1, -1, -1):
if maiornumero % lista[i] == 0:
lista.pop(... |
# sample\core.py
def run_core():
print("In pycharm run_core")
| def run_core():
print('In pycharm run_core') |
raise NotImplementedError("Getting an NPE trying to parse this code")
class KeyValue:
def __init__(self, key, value):
self.key = key
self.value = value
def __repr__(self):
return f"{self.key}->{self.value}"
class MinHeap:
def __init__(self, start_size):
self.heap = [None]... | raise not_implemented_error('Getting an NPE trying to parse this code')
class Keyvalue:
def __init__(self, key, value):
self.key = key
self.value = value
def __repr__(self):
return f'{self.key}->{self.value}'
class Minheap:
def __init__(self, start_size):
self.heap = [No... |
n = int(input())
c = [0]*n
for i in range(n):
l = int(input())
S = input()
for j in range(l):
if (S[j]=='0'):
continue
for k in range(j,l):
if (S[k]=='1'):
c[i] = c[i]+1
for i in range(n):
print(c[i])
| n = int(input())
c = [0] * n
for i in range(n):
l = int(input())
s = input()
for j in range(l):
if S[j] == '0':
continue
for k in range(j, l):
if S[k] == '1':
c[i] = c[i] + 1
for i in range(n):
print(c[i]) |
#
# PySNMP MIB module CHECKPOINT-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHECKPOINT-TRAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:31:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
colors_per_chi = {2: 'green', 3: 'orange', 4: 'purple', 5: 'pink', 6: 'red'}
style_per_chi = {2: '-', 3: '-.', 4: 'dotted'}
markers_per_reason = {'converged': 'o', 'progress': 'x', 'ressources': 'v'}
linewidth = 5.31596
| colors_per_chi = {2: 'green', 3: 'orange', 4: 'purple', 5: 'pink', 6: 'red'}
style_per_chi = {2: '-', 3: '-.', 4: 'dotted'}
markers_per_reason = {'converged': 'o', 'progress': 'x', 'ressources': 'v'}
linewidth = 5.31596 |
def get_failed_ids(txt_file):
id = []
fh = open(txt_file, 'r')
for row in fh:
id.append(row.split('/')[1].split('.')[0])
return(id)
| def get_failed_ids(txt_file):
id = []
fh = open(txt_file, 'r')
for row in fh:
id.append(row.split('/')[1].split('.')[0])
return id |
d=int(input("enter d"))
n=''
max=''
for i in range(d):
if i==0:
n=n+str(1)
else :
n=n+str(0)
max=max+str(9)
n=int(n)+1 #smallest odd no. with d digits if d>1 or 2 if d==1
max=int(max) #largest no. with d digits
def check_prime(m_odd): #returns truth value of an odd no. or of 2 being prime
if m_odd==2:return T... | d = int(input('enter d'))
n = ''
max = ''
for i in range(d):
if i == 0:
n = n + str(1)
else:
n = n + str(0)
max = max + str(9)
n = int(n) + 1
max = int(max)
def check_prime(m_odd):
if m_odd == 2:
return True
i = 3
while m_odd % i != 0 and i < m_odd:
i = i + 2
... |
class Boolable:
def __bool__(self):
return False
class DescriptiveTrue(Boolable):
def __init__(self, description):
self.description = description
def __bool__(self):
return True
def __str__(self):
return f"{self.description}"
def __repr__(self):
return f"... | class Boolable:
def __bool__(self):
return False
class Descriptivetrue(Boolable):
def __init__(self, description):
self.description = description
def __bool__(self):
return True
def __str__(self):
return f'{self.description}'
def __repr__(self):
return f... |
def fuel_required(weight: int) -> int:
return weight // 3 - 2
def fuel_required_accurate(weight: int) -> int:
fuel = 0
while weight > 0:
weight = max(0, weight // 3 - 2)
fuel += weight
return fuel
def test_fuel_required() -> None:
cases = [(12, 2), (14, 2), (1969, 654), (100756, ... | def fuel_required(weight: int) -> int:
return weight // 3 - 2
def fuel_required_accurate(weight: int) -> int:
fuel = 0
while weight > 0:
weight = max(0, weight // 3 - 2)
fuel += weight
return fuel
def test_fuel_required() -> None:
cases = [(12, 2), (14, 2), (1969, 654), (100756, 33... |
class Node:
def __init__(self, value, index, next, previous):
self.value = value
self.next_value = value
self.index = index
self.next = next
self.previous = previous
def main():
input_data = read_input()
initial_row = input_data.pop(0) # Extract the initial state... | class Node:
def __init__(self, value, index, next, previous):
self.value = value
self.next_value = value
self.index = index
self.next = next
self.previous = previous
def main():
input_data = read_input()
initial_row = input_data.pop(0)
input_data.pop(0)
rule... |
# David Hickox
# Jan 12 17
# HickoxProject2
# Displayes name and classes
# prints my name and classes in columns and waits for the user to hit enter to end the program
print("David Hickox")
print()
print("1st Band")
print("2nd Programming")
print("3rd Ap Pysics C")
print("4th Lunch")
print("5th Ap Lang... | print('David Hickox')
print()
print('1st Band')
print('2nd Programming')
print('3rd Ap Pysics C')
print('4th Lunch')
print('5th Ap Lang')
print('6th TA for R&D')
print('7th Gym')
print('8th AP Calc BC')
print()
input('Press Enter To Continue') |
class Node():
def __init__(self, value):
self.value = value
self.adjacentlist = []
self.visited = False
class Graph():
def DFS(self, node, traversal):
node.visited = True
traversal.append(node.value)
for element in node.adjacentlist:
if element... | class Node:
def __init__(self, value):
self.value = value
self.adjacentlist = []
self.visited = False
class Graph:
def dfs(self, node, traversal):
node.visited = True
traversal.append(node.value)
for element in node.adjacentlist:
if element.visited ... |
# https://www.hackerrank.com/challenges/utopian-tree
def tree_height(tree, N, start):
if not N:
return tree
if start == 'spring':
for i in range(N // 2):
tree = tree * 2 + 1
if N % 2:
return tree * 2
else:
return tree
elif start == 'summer... | def tree_height(tree, N, start):
if not N:
return tree
if start == 'spring':
for i in range(N // 2):
tree = tree * 2 + 1
if N % 2:
return tree * 2
else:
return tree
elif start == 'summer':
for i in range(N // 2):
tree = ... |
### Maximum Number of Coins You Can Get - Solution
class Solution:
def maxCoins(self, piles: List[int]) -> int:
piles.sort()
max_coin, n = 0, len(piles)
for i in range(n//3, n, 2):
max_coin += piles[i]
return max_coin | class Solution:
def max_coins(self, piles: List[int]) -> int:
piles.sort()
(max_coin, n) = (0, len(piles))
for i in range(n // 3, n, 2):
max_coin += piles[i]
return max_coin |
#Antonio Karlo Mijares
#ICS4U-01
#November 24 2016
#1D_2D_arrays.py
#Creates 1D arrays, for the variables to be placed in
characteristics = []
num = []
#Creates a percentage value for the numbers to be calculated with
base = 20
percentage = 100
#2d Arrays
#Ugly Arrays
ugly_one_D = []
ugly_one_D_two = []
ugly_two_D ... | characteristics = []
num = []
base = 20
percentage = 100
ugly_one_d = []
ugly_one_d_two = []
ugly_two_d = []
nice_two_d = []
filename = 'character'
def strength():
with open(str(filename) + '.txt', 'r') as s:
line = s.read().splitlines()
name = line[3].strip(': 17')
number = line[3].strip('... |
kamus = {"elephant" : "gajah", "zebra" : "zebra", "dog" : "anjing", "camel" : "unta"}
kata = input("Masukan kata berbahasa inggris : ")
if kata in kamus:
print("Terjemahan dari " + kata + " adalah " + kamus[kata])
else:
print("Kata tersebt belum ada di kamus") | kamus = {'elephant': 'gajah', 'zebra': 'zebra', 'dog': 'anjing', 'camel': 'unta'}
kata = input('Masukan kata berbahasa inggris : ')
if kata in kamus:
print('Terjemahan dari ' + kata + ' adalah ' + kamus[kata])
else:
print('Kata tersebt belum ada di kamus') |
# -*- coding: utf-8 -*-
'''
nbpkg defspec
'''
NBPKG_MAGIC_NUMBER = b'\x1f\x8b'
NBPKG_HEADER_MAGIC_NUMBER = '\037\213'
NBPKGINFO_MIN_NUMBER = 1000
NBPKGINFO_MAX_NUMBER = 1146
# data types definition
NBPKG_DATA_TYPE_NULL = 0
NBPKG_DATA_TYPE_CHAR = 1
NBPKG_DATA_TYPE_INT8 = 2
NBPKG_DATA_TYPE_INT16 = 3
NBPKG_DATA_TYPE_IN... | """
nbpkg defspec
"""
nbpkg_magic_number = b'\x1f\x8b'
nbpkg_header_magic_number = '\x1f\x8b'
nbpkginfo_min_number = 1000
nbpkginfo_max_number = 1146
nbpkg_data_type_null = 0
nbpkg_data_type_char = 1
nbpkg_data_type_int8 = 2
nbpkg_data_type_int16 = 3
nbpkg_data_type_int32 = 4
nbpkg_data_type_int64 = 5
nbpkg_data_type_s... |
#Write a program which can compute the factorial of a given numbers.
#The results should be printed in a comma-separated sequence on a single line
number=int(input("Please Enter factorial Number: "))
j=1
fact = 1
for i in range(number,0,-1):
fact =fact*i
print(fact) | number = int(input('Please Enter factorial Number: '))
j = 1
fact = 1
for i in range(number, 0, -1):
fact = fact * i
print(fact) |
##Write a program to input from the input file a familiar greeting of any length, each word on a line. Output the greeting file you just received on a single line, the words separated by a space
#Mo file voi mode='r' de doc file
with open('05_ip.txt', 'r') as fileInp:
#Dung ham read() doc toan bo du lieu tu file
F... | with open('05_ip.txt', 'r') as file_inp:
filecomplete = fileInp.read()
list_ofligne = Filecomplete.splitlines()
phrasecomplete = ' '.join(listOfligne)
print(phrasecomplete)
with open('05_out.txt', 'w') as file_out:
fileOut.write(phrasecomplete) |
def fuel_required_single_module(mass):
fuel = int(mass / 3) - 2
return fuel if fuel > 0 else 0
def fuel_required_multiple_modules(masses):
total_fuel = 0
for mass in masses:
total_fuel += fuel_required_single_module(mass)
return total_fuel
def recursive_fuel_required_single_module(mass):... | def fuel_required_single_module(mass):
fuel = int(mass / 3) - 2
return fuel if fuel > 0 else 0
def fuel_required_multiple_modules(masses):
total_fuel = 0
for mass in masses:
total_fuel += fuel_required_single_module(mass)
return total_fuel
def recursive_fuel_required_single_module(mass):
... |
str_xdigits = [
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"a",
"b",
"c",
"d",
"e",
"f",
]
def convert_digit(value: int, base: int) -> str:
return str_xdigits[value % base]
def convert_to_val(value: int, base: int) -> str:
if value == No... | str_xdigits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
def convert_digit(value: int, base: int) -> str:
return str_xdigits[value % base]
def convert_to_val(value: int, base: int) -> str:
if value == None:
return 'Error'
current = int(value)
result = ''
... |
class SimpleOpt():
def __init__(self):
self.method = 'cpgan'
self.max_epochs = 100
self.graph_type = 'ENZYMES'
self.data_dir = './data/facebook.graphs'
self.gpu = '2'
self.lr = 0.003
self.encode_size = 16
self.decode_size = 16
self.pool_size = ... | class Simpleopt:
def __init__(self):
self.method = 'cpgan'
self.max_epochs = 100
self.graph_type = 'ENZYMES'
self.data_dir = './data/facebook.graphs'
self.gpu = '2'
self.lr = 0.003
self.encode_size = 16
self.decode_size = 16
self.pool_size = 1... |
# What will the gender ratio be after every family stops having children after
# after they have a girl and not until then.
def birth_ratio():
# Everytime a child is born, there is a 0.5 chance of the baby being male
# and 0.5 chance of the baby being a girl. So the ratio is 1:1.
return 1
| def birth_ratio():
return 1 |
# You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are(i, 0) and (i, height[i]).
# Find two lines that together with the x-axis form a container, such that the container contains the most water.
# Return the maximum amount of water a conta... | class Solution:
def max_area(self, height: List[int]) -> int:
(left, right) = (0, len(height) - 1)
result = 0
while left < right:
water = (right - left) * min(height[left], height[right])
if water > result:
result = water
if height[left] <... |
# server backend
server = 'cherrypy'
# debug error messages
debug = False
# auto-reload
reloader = False
# database url
db_url = 'postgresql://user:pass@localhost/dbname'
# echo database engine messages
db_echo = False
| server = 'cherrypy'
debug = False
reloader = False
db_url = 'postgresql://user:pass@localhost/dbname'
db_echo = False |
#decorators
def decorator(myfunc):
def wrapper(*args):
return myfunc(*args)
return wrapper
@decorator
def display():
print('display function')
@decorator
def info(name, age):
print('name is {} and age is {}'.format(name,age))
info('john', 23)
#hi = decorator(display)
#hi()
display() | def decorator(myfunc):
def wrapper(*args):
return myfunc(*args)
return wrapper
@decorator
def display():
print('display function')
@decorator
def info(name, age):
print('name is {} and age is {}'.format(name, age))
info('john', 23)
display() |
def connected_tree(n, edge_list):
current_edges = len(edge_list)
edges_needed = (n-1) - current_edges
return edges_needed
def main():
with open('datasets/rosalind_tree.txt') as input_file:
input_data = input_file.read().strip().split('\n')
n = int(input_data.pop(0))
edge_l... | def connected_tree(n, edge_list):
current_edges = len(edge_list)
edges_needed = n - 1 - current_edges
return edges_needed
def main():
with open('datasets/rosalind_tree.txt') as input_file:
input_data = input_file.read().strip().split('\n')
n = int(input_data.pop(0))
edge_list = list((ma... |
# Released under the MIT License. See LICENSE for details.
#
# This file was automatically generated from "rampage.ma"
# pylint: disable=all
points = {}
# noinspection PyDictCreation
boxes = {}
boxes['area_of_interest_bounds'] = (0.3544110667, 5.616383286,
-4.066055072) + (0.0, 0.0,... | points = {}
boxes = {}
boxes['area_of_interest_bounds'] = (0.3544110667, 5.616383286, -4.066055072) + (0.0, 0.0, 0.0) + (19.90053969, 10.34051135, 8.16221072)
boxes['edge_box'] = (0.3544110667, 5.438284793, -4.100357672) + (0.0, 0.0, 0.0) + (12.57718032, 4.645176013, 3.605557343)
points['ffa_spawn1'] = (0.5006944438, 5... |
#
# PySNMP MIB module HPN-ICF-8021PAE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-8021PAE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:24:57 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_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ... |
class SchemaError(Exception):
def __init__(self, schema, code):
self.schema = schema
self.code = code
msg = schema.errors[code].format(**schema.__dict__)
super().__init__(msg)
class NoCurrentApp(Exception):
pass
class ConfigurationError(Exception):
pass
| class Schemaerror(Exception):
def __init__(self, schema, code):
self.schema = schema
self.code = code
msg = schema.errors[code].format(**schema.__dict__)
super().__init__(msg)
class Nocurrentapp(Exception):
pass
class Configurationerror(Exception):
pass |
__author__ = "Wild Print"
__maintainer__ = __author__
__email__ = "telegram_coin_bot@rambler.ru"
__license__ = "MIT"
__version__ = "0.0.1"
__all__ = (
"__author__",
"__email__",
"__license__",
"__maintainer__",
"__version__",
)
| __author__ = 'Wild Print'
__maintainer__ = __author__
__email__ = 'telegram_coin_bot@rambler.ru'
__license__ = 'MIT'
__version__ = '0.0.1'
__all__ = ('__author__', '__email__', '__license__', '__maintainer__', '__version__') |
'''
Created on Oct 10, 2012
@author: Brian Jimenez-Garcia
@contact: brian.jimenez@bsc.es
'''
class Color:
def __init__(self, red=0., green=0., blue=0., alpha=1.0):
self.__red = red
self.__green = green
self.__blue = blue
self.__alpha = alpha
def get_rgba(self):
... | """
Created on Oct 10, 2012
@author: Brian Jimenez-Garcia
@contact: brian.jimenez@bsc.es
"""
class Color:
def __init__(self, red=0.0, green=0.0, blue=0.0, alpha=1.0):
self.__red = red
self.__green = green
self.__blue = blue
self.__alpha = alpha
def get_rgba(self):
ret... |
__COL_GOOD = '\033[32m'
__COL_FAIL = '\033[31m'
__COL_INFO = '\033[34m'
__COL_BOLD = '\033[1m'
__COL_ULIN = '\033[4m'
__COL_ENDC = '\033[0m'
def __TEST__(status, msg, color, args):
args = ", ".join([str(key)+'='+str(args[key]) for key in args.keys()])
if args:
args = "(" + args + ")"
return "[{colo... | __col_good = '\x1b[32m'
__col_fail = '\x1b[31m'
__col_info = '\x1b[34m'
__col_bold = '\x1b[1m'
__col_ulin = '\x1b[4m'
__col_endc = '\x1b[0m'
def __test__(status, msg, color, args):
args = ', '.join([str(key) + '=' + str(args[key]) for key in args.keys()])
if args:
args = '(' + args + ')'
return '[{... |
def find_metric_transformation_by_name(metric_transformations, metric_name):
for metric in metric_transformations:
if metric["metricName"] == metric_name:
return metric
def find_metric_transformation_by_namespace(metric_transformations, metric_namespace):
for metric in metric_transformatio... | def find_metric_transformation_by_name(metric_transformations, metric_name):
for metric in metric_transformations:
if metric['metricName'] == metric_name:
return metric
def find_metric_transformation_by_namespace(metric_transformations, metric_namespace):
for metric in metric_transformation... |
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
# metrics namespaced under 'scylla'
SCYLLA_ALIEN = {
'scylla_alien_receive_batch_queue_length': 'alien.receive_batch_queue_length',
'scylla_alien_total_received_messages': 'alien.total_received_me... | scylla_alien = {'scylla_alien_receive_batch_queue_length': 'alien.receive_batch_queue_length', 'scylla_alien_total_received_messages': 'alien.total_received_messages', 'scylla_alien_total_sent_messages': 'alien.total_sent_messages'}
scylla_batchlog = {'scylla_batchlog_manager_total_write_replay_attempts': 'batchlog_man... |
# List of tables that should be routed to this app.
# Note that this is not intended to be a complete list of the available tables.
TABLE_NAMES = (
'lemma',
'inflection',
'aspect_pair',
)
| table_names = ('lemma', 'inflection', 'aspect_pair') |
nome = []
temp = []
pesoMaior = pesoMenor = 0
count = 1
while True:
temp.append(str(input('Nome: ')))
temp.append(float(input('Peso: ')))
if count == 1:
pesoMaior = pesoMenor = temp[1]
else:
if temp[1] >= pesoMaior:
pesoMaior = temp[1]
elif temp[1] <= pesoMenor:
... | nome = []
temp = []
peso_maior = peso_menor = 0
count = 1
while True:
temp.append(str(input('Nome: ')))
temp.append(float(input('Peso: ')))
if count == 1:
peso_maior = peso_menor = temp[1]
elif temp[1] >= pesoMaior:
peso_maior = temp[1]
elif temp[1] <= pesoMenor:
peso_menor =... |
tcase = int(input())
while(tcase):
str= input() [::-1]
print(int(str))
tcase -= 1 | tcase = int(input())
while tcase:
str = input()[::-1]
print(int(str))
tcase -= 1 |
class FixtureException(Exception):
pass
class FixtureUploadError(FixtureException):
pass
class DuplicateFixtureTagException(FixtureUploadError):
pass
class ExcelMalformatException(FixtureUploadError):
pass
class FixtureAPIException(Exception):
pass
class FixtureTypeCheckError(Exception):
... | class Fixtureexception(Exception):
pass
class Fixtureuploaderror(FixtureException):
pass
class Duplicatefixturetagexception(FixtureUploadError):
pass
class Excelmalformatexception(FixtureUploadError):
pass
class Fixtureapiexception(Exception):
pass
class Fixturetypecheckerror(Exception):
pa... |
#!/usr/bin/env python3
# tuples is a type of list.
# tuples is immutable.
# the structure of a tuple: (1, "nice work", 2.3, [1,2,"hey"])
my_tuple = ("hey", 1, 2, "hey ho!", "hey", "hey")
print("My tuple:", my_tuple)
# to get a tuple value use it's index
print("Second item in my_tuple:", my_tuple[1])
# to count how ... | my_tuple = ('hey', 1, 2, 'hey ho!', 'hey', 'hey')
print('My tuple:', my_tuple)
print('Second item in my_tuple:', my_tuple[1])
print("How many 'hey' in my_tuple:", my_tuple.count('hey'))
print("Index position of 'hey ho!' in my_tuple:", my_tuple.index('hey ho!')) |
def possibleHeights(parent):
edges = [[] for i in range(len(parent))]
height = [0 for i in range(len(parent))]
isPossibleHeight = [False for i in range(len(parent))]
def initGraph(parent):
for i in range(1, len(parent)):
edges[parent[i]].append(i)
def calcHeight(v):
fo... | def possible_heights(parent):
edges = [[] for i in range(len(parent))]
height = [0 for i in range(len(parent))]
is_possible_height = [False for i in range(len(parent))]
def init_graph(parent):
for i in range(1, len(parent)):
edges[parent[i]].append(i)
def calc_height(v):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.