content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
RESOURCES = {
'posts': {
'schema': {
'title': {
'type': 'string',
'minlength': 3,
'maxlength': 30,
'required': True,
'unique': False
},
'body': {
'type': 'string',
... | resources = {'posts': {'schema': {'title': {'type': 'string', 'minlength': 3, 'maxlength': 30, 'required': True, 'unique': False}, 'body': {'type': 'string', 'required': True, 'unique': True}, 'published': {'type': 'boolean', 'default': False}, 'category': {'type': 'objectid', 'data_relation': {'resource': 'categories'... |
pkgname = "python-sphinx-removed-in"
pkgver = "0.2.1"
pkgrel = 0
build_style = "python_module"
hostmakedepends = ["python-setuptools"]
checkdepends = ["python-sphinx"]
depends = ["python-sphinx"]
pkgdesc = "Sphinx extension for versionremoved and removed-in directives"
maintainer = "q66 <q66@chimera-linux.org>"
license... | pkgname = 'python-sphinx-removed-in'
pkgver = '0.2.1'
pkgrel = 0
build_style = 'python_module'
hostmakedepends = ['python-setuptools']
checkdepends = ['python-sphinx']
depends = ['python-sphinx']
pkgdesc = 'Sphinx extension for versionremoved and removed-in directives'
maintainer = 'q66 <q66@chimera-linux.org>'
license... |
class Solution:
def canPartition(self, nums: List[int]) -> bool:
dp, s = set([0]), sum(nums)
if s&1:
return False
for num in nums:
dp.update([v+num for v in dp if v+num <= s>>1])
return s>>1 in dp
| class Solution:
def can_partition(self, nums: List[int]) -> bool:
(dp, s) = (set([0]), sum(nums))
if s & 1:
return False
for num in nums:
dp.update([v + num for v in dp if v + num <= s >> 1])
return s >> 1 in dp |
class Solution:
def sortLinkedList(self, head: Optional[ListNode]) -> Optional[ListNode]:
prev = head
curr = head.next
while curr:
if curr.val < 0:
prev.next = curr.next
curr.next = head
head = curr
curr = prev.next
else:
prev = curr
curr = curr... | class Solution:
def sort_linked_list(self, head: Optional[ListNode]) -> Optional[ListNode]:
prev = head
curr = head.next
while curr:
if curr.val < 0:
prev.next = curr.next
curr.next = head
head = curr
curr = prev.ne... |
class Pessoa: #substantivo
def __init__(self, nome: str, idade: int) -> None:
self.nome = nome #substantivo
self.idade = idade #substantivo
def dirigir(self, veiculo: str) -> None: #verbos
print(f'Dirigindo um(a) {veiculo}')
def cantar(self) -> None: #verbos
print('lalalala... | class Pessoa:
def __init__(self, nome: str, idade: int) -> None:
self.nome = nome
self.idade = idade
def dirigir(self, veiculo: str) -> None:
print(f'Dirigindo um(a) {veiculo}')
def cantar(self) -> None:
print('lalalala')
def apresentar_idade(self) -> int:
ret... |
API_GROUPS = {
'authentication': ['/api-auth/', '/api/auth-valimo/',],
'user': ['/api/users/', '/api/user-invitations/', '/api/user-counters/',],
'organization': [
'/api/customers/',
'/api/customer-permissions-log/',
'/api/customer-permissions-reviews/',
'/api/customer-permis... | api_groups = {'authentication': ['/api-auth/', '/api/auth-valimo/'], 'user': ['/api/users/', '/api/user-invitations/', '/api/user-counters/'], 'organization': ['/api/customers/', '/api/customer-permissions-log/', '/api/customer-permissions-reviews/', '/api/customer-permissions/'], 'marketplace': ['/api/marketplace-book... |
df = pd.read_csv(DATA)
df = df.sample(frac=1.0)
df.reset_index(drop=True, inplace=True)
result = df.tail(n=10)
| df = pd.read_csv(DATA)
df = df.sample(frac=1.0)
df.reset_index(drop=True, inplace=True)
result = df.tail(n=10) |
def to_binary(number):
binarynumber=""
if (number!=0):
while (number>=1):
if (number %2==0):
binarynumber=binarynumber+"0"
number=number/2
else:
binarynumber=binarynumber+"1"
number=(number-1)/2
else:
bi... | def to_binary(number):
binarynumber = ''
if number != 0:
while number >= 1:
if number % 2 == 0:
binarynumber = binarynumber + '0'
number = number / 2
else:
binarynumber = binarynumber + '1'
number = (number - 1) / 2
... |
x = 5
y = 3
z = x + y
print(x)
print(y)
print(x + y)
print(z)
w = z
print(w) | x = 5
y = 3
z = x + y
print(x)
print(y)
print(x + y)
print(z)
w = z
print(w) |
#Calculadora de tabuada
n = int(input('Deseja ver tabuada de que numero?'))
for c in range(1, 13):
print('{} X {:2}= {} '. format(n, c, n * c))
| n = int(input('Deseja ver tabuada de que numero?'))
for c in range(1, 13):
print('{} X {:2}= {} '.format(n, c, n * c)) |
COLUMNS = [
'tipo_registro',
'nro_pv_matriz',
'vl_total_bruto',
'qtde_cvnsu',
'vl_total_rejeitado',
'vl_total_rotativo',
'vl_total_parcelado_sem_juros',
'vl_total_parcelado_iata',
'vl_total_dolar',
'vl_total_desconto',
'vl_total_liquido',
'vl_total_gorjeta',
'vl_total... | columns = ['tipo_registro', 'nro_pv_matriz', 'vl_total_bruto', 'qtde_cvnsu', 'vl_total_rejeitado', 'vl_total_rotativo', 'vl_total_parcelado_sem_juros', 'vl_total_parcelado_iata', 'vl_total_dolar', 'vl_total_desconto', 'vl_total_liquido', 'vl_total_gorjeta', 'vl_total_tx_embarque', 'qtde_cvnsu_acatados'] |
# Ask user to enter their country name.
# print out their phone code.
l_country_phone_code = ["China","86","Germany","49","Turkey","90"]
def country_name_to_phone_code_list(country_name):
for index in range(len(l_country_phone_code)):
if l_country_phone_code[index] == country_name:
return l_country_phone_code[... | l_country_phone_code = ['China', '86', 'Germany', '49', 'Turkey', '90']
def country_name_to_phone_code_list(country_name):
for index in range(len(l_country_phone_code)):
if l_country_phone_code[index] == country_name:
return l_country_phone_code[index + 1]
def country_name_to_phone_code_dict(c... |
def palavras_repetidas(fileName, word):
file = open(fileName, 'r')
count = 0
for i in file.readlines():
if word in i:
count += 1
print(f'{word} aparece no arquivo {fileName} {count} vez(es).') | def palavras_repetidas(fileName, word):
file = open(fileName, 'r')
count = 0
for i in file.readlines():
if word in i:
count += 1
print(f'{word} aparece no arquivo {fileName} {count} vez(es).') |
n = int(input())
x = 0
for i in range(n):
l = set([j for j in input()])
if "+" in l:
x += 1
else :
x -= 1
print(x)
| n = int(input())
x = 0
for i in range(n):
l = set([j for j in input()])
if '+' in l:
x += 1
else:
x -= 1
print(x) |
client = pymongo.MongoClient("mongodb+srv://usermgs:udUnpg6aJnCp9d2W@cluster0.2ivys.mongodb.net/baseteste?retryWrites=true&w=majority")
db = client.test
| client = pymongo.MongoClient('mongodb+srv://usermgs:udUnpg6aJnCp9d2W@cluster0.2ivys.mongodb.net/baseteste?retryWrites=true&w=majority')
db = client.test |
class Mammal:
x = 10
def walk(self):
print("Walking")
# class Dog:
# def walk(self):
# print("Walking")
# class Cat:
# def walk(self):
# print("Walking")
class Dog(Mammal):
def bark(self):
print("Woof, woof!")
class Cat(Mammal):
pass # Just used here as Py... | class Mammal:
x = 10
def walk(self):
print('Walking')
class Dog(Mammal):
def bark(self):
print('Woof, woof!')
class Cat(Mammal):
pass
rover = dog()
print(rover.x)
rover.bark()
fluffy = cat()
fluffy.walk() |
#
# @lc app=leetcode.cn id=1203 lang=python3
#
# [1203] print-in-order
#
None
# @lc code=end | None |
def check_hgt(h):
if "cm" in h:
return 150 <= int(h.replace("cm","")) <= 193
elif "in" in h:
return 59 <= int(h.replace("in","")) <= 76
else:
return False
def check_hcl(h):
if h[0] != '#' or len(h) != 7:
return False
for x in h[1:]:
if not x in list("... | def check_hgt(h):
if 'cm' in h:
return 150 <= int(h.replace('cm', '')) <= 193
elif 'in' in h:
return 59 <= int(h.replace('in', '')) <= 76
else:
return False
def check_hcl(h):
if h[0] != '#' or len(h) != 7:
return False
for x in h[1:]:
if not x in list('abcdef... |
def test_deploying_contract(client, hex_accounts):
pre_balance = client.get_balance(hex_accounts[1])
client.send_transaction(
_from=hex_accounts[0],
to=hex_accounts[1],
value=1234,
)
post_balance = client.get_balance(hex_accounts[1])
assert post_balance - pre_balance == 12... | def test_deploying_contract(client, hex_accounts):
pre_balance = client.get_balance(hex_accounts[1])
client.send_transaction(_from=hex_accounts[0], to=hex_accounts[1], value=1234)
post_balance = client.get_balance(hex_accounts[1])
assert post_balance - pre_balance == 1234 |
if __name__ == '__main__':
_, X = input().split()
subjects = list()
for _ in range(int(X)):
subjects.append(map(float, input().split()))
for i in zip(*subjects):
print("{0:.1f}".format(sum(i)/len(i)))
| if __name__ == '__main__':
(_, x) = input().split()
subjects = list()
for _ in range(int(X)):
subjects.append(map(float, input().split()))
for i in zip(*subjects):
print('{0:.1f}'.format(sum(i) / len(i))) |
promt = "Here you can enter"
promt += "a series of toppings>>>"
message = True
while message:
message = input(promt)
if message == "Quit":
print(" I'll add " + message + " to your pizza.")
else:
break
promt = "How old are you?"
promt += "\nEnter 'quit' when you a... | promt = 'Here you can enter'
promt += 'a series of toppings>>>'
message = True
while message:
message = input(promt)
if message == 'Quit':
print(" I'll add " + message + ' to your pizza.')
else:
break
promt = 'How old are you?'
promt += "\nEnter 'quit' when you are finished >>>"
while True:... |
def foo(a, b):
x = a * b
y = 3
return y
def foo(a, b):
x = __report_assign(7, 8, 3)
x = __report_assign(pos, v, 3)
y = __report_assign(lineno, col, 3)
print("hello world")
foo(3, 2)
report_call(0, 3, foo, (report_eval(3), report_eval(2),))
| def foo(a, b):
x = a * b
y = 3
return y
def foo(a, b):
x = __report_assign(7, 8, 3)
x = __report_assign(pos, v, 3)
y = __report_assign(lineno, col, 3)
print('hello world')
foo(3, 2)
report_call(0, 3, foo, (report_eval(3), report_eval(2))) |
class Solution:
def addBinary(self, a: str, b: str) -> str:
return bin(int(a, 2) + int(b, 2))[2:]
if __name__ == '__main__':
a = "11"
b = "1"
solution = Solution()
result = solution.addBinary(a, b)
print(result)
result1 = int(a, 2)
result2 = int(b, 2)
print(result1)
pr... | class Solution:
def add_binary(self, a: str, b: str) -> str:
return bin(int(a, 2) + int(b, 2))[2:]
if __name__ == '__main__':
a = '11'
b = '1'
solution = solution()
result = solution.addBinary(a, b)
print(result)
result1 = int(a, 2)
result2 = int(b, 2)
print(result1)
pri... |
a=int(input())
b=int(input())
print (a/b)
a=float(a)
b=float(b)
print (a/b) | a = int(input())
b = int(input())
print(a / b)
a = float(a)
b = float(b)
print(a / b) |
def test_Dict():
x: dict[i32, i32]
x = {1: 2, 3: 4}
# x = {1: "2", "3": 4} -> sematic error
y: dict[str, i32]
y = {"a": -1, "b": -2}
z: i32
z = y["a"]
z = y["b"]
z = x[1]
def test_dict_insert():
y: dict[str, i32]
y = {"a": -1, "b": -2}
y["c"] = -3
def test_dict_get(... | def test__dict():
x: dict[i32, i32]
x = {1: 2, 3: 4}
y: dict[str, i32]
y = {'a': -1, 'b': -2}
z: i32
z = y['a']
z = y['b']
z = x[1]
def test_dict_insert():
y: dict[str, i32]
y = {'a': -1, 'b': -2}
y['c'] = -3
def test_dict_get():
y: dict[str, i32]
y = {'a': -1, 'b':... |
states = {'Pending', 'Ready', 'Creating', 'Running', 'Cancelled', 'Error', 'Failed', 'Success'}
complete_states = ('Cancelled', 'Error', 'Failed', 'Success')
valid_state_transitions = {
'Pending': {'Ready'},
'Ready': {'Creating', 'Running', 'Cancelled', 'Error'},
'Creating': {'Ready', 'Running'},
'Run... | states = {'Pending', 'Ready', 'Creating', 'Running', 'Cancelled', 'Error', 'Failed', 'Success'}
complete_states = ('Cancelled', 'Error', 'Failed', 'Success')
valid_state_transitions = {'Pending': {'Ready'}, 'Ready': {'Creating', 'Running', 'Cancelled', 'Error'}, 'Creating': {'Ready', 'Running'}, 'Running': {'Ready', 'C... |
def assigned_type_mismatch():
x = 666
x = '666'
return x
def annotation_type_mismatch(x: int = '666'):
return x
def assigned_type_mismatch_between_calls(case):
if case:
x = 666
else:
x = '666'
return x
| def assigned_type_mismatch():
x = 666
x = '666'
return x
def annotation_type_mismatch(x: int='666'):
return x
def assigned_type_mismatch_between_calls(case):
if case:
x = 666
else:
x = '666'
return x |
# https://www.codewars.com/kata/576757b1df89ecf5bd00073b/train/python
def tower_builder(n_floors):
times = 1
space = ((2*n_floors -1) // 2)
tower = []
for _ in range(n_floors):
tower.append((' '*space) + ('*' * times) + (' '*space))
times += 2
space -= 1
return tower
| def tower_builder(n_floors):
times = 1
space = (2 * n_floors - 1) // 2
tower = []
for _ in range(n_floors):
tower.append(' ' * space + '*' * times + ' ' * space)
times += 2
space -= 1
return tower |
#! /usr/bin/env python
# Programs that are runnable.
ns3_runnable_programs = ['build/src/aodv/examples/ns3.27-aodv-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-one-hop-debug', 'build/src/buildings/examples/ns3.27-buildings-pathloss-profiler-debug', 'build/... | ns3_runnable_programs = ['build/src/aodv/examples/ns3.27-aodv-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-one-hop-debug', 'build/src/buildings/examples/ns3.27-buildings-pathloss-profiler-debug', 'build/src/config-store/examples/ns3.27-config-store-save-deb... |
# Arithmetic progression
# A + (A+B) + (A+2B) + (A+3B) + ... + (A+(C-1)B))
def main():
N = int(input("data:\n"))
l = []
for x in range(0,N):
a,b,c = input().split(" ")
a,b,c = int(a),int(b),int(c)
s = 0
for each in range(0,c):
s += a + (b*each)
... | def main():
n = int(input('data:\n'))
l = []
for x in range(0, N):
(a, b, c) = input().split(' ')
(a, b, c) = (int(a), int(b), int(c))
s = 0
for each in range(0, c):
s += a + b * each
l.append(s)
print('\nanswer:')
for each in l:
print(each... |
col = {
"owid": {
"Notes": "notes",
"Entity": "entity",
"Date": "time",
"Source URL": "src",
"Source label": "src_lb",
"Cumulative total": "tot_n_tests",
"Daily change in cumulative total": "n_tests",
"Cumulative total per thousand": "tot_n_tests_pthab... | col = {'owid': {'Notes': 'notes', 'Entity': 'entity', 'Date': 'time', 'Source URL': 'src', 'Source label': 'src_lb', 'Cumulative total': 'tot_n_tests', 'Daily change in cumulative total': 'n_tests', 'Cumulative total per thousand': 'tot_n_tests_pthab', 'Daily change in cumulative total per thousand': 'n_tests_pthab', '... |
# https://codeforces.com/problemset/problem/1030/A
n = int(input())
o = list(map(int, input().split()))
print('HARD' if o.count(1) != 0 else 'EASY') | n = int(input())
o = list(map(int, input().split()))
print('HARD' if o.count(1) != 0 else 'EASY') |
class Solution:
# @param {integer[]} candidates
# @param {integer} target
# @return {integer[][]}
def combinationSum(self, candidates, target):
candidates.sort()
return self.combsum(candidates, target)
def combsum(self, nums, target):
if target == 0:
return [[]]
... | class Solution:
def combination_sum(self, candidates, target):
candidates.sort()
return self.combsum(candidates, target)
def combsum(self, nums, target):
if target == 0:
return [[]]
if not nums or nums[0] > target or target < 1:
return []
res = [... |
def decimal2base(num, base):
convert_string = "0123456789ABCDEF"
if num < base:
return convert_string[num]
remainder = num % base
num = num // base
return decimal2base(num, base) + convert_string[remainder]
print(decimal2base(1453, 16))
| def decimal2base(num, base):
convert_string = '0123456789ABCDEF'
if num < base:
return convert_string[num]
remainder = num % base
num = num // base
return decimal2base(num, base) + convert_string[remainder]
print(decimal2base(1453, 16)) |
# wykys 2019
def bin_print(byte_array: list, num_in_line: int = 8, space: str = ' | '):
def bin_to_str(byte_array: list) -> str:
return ''.join([
chr(c) if c > 32 and c < 127 else '.' for c in byte_array
])
tmp = ''
for i, byte in enumerate(byte_array):
tmp = ''.join([t... | def bin_print(byte_array: list, num_in_line: int=8, space: str=' | '):
def bin_to_str(byte_array: list) -> str:
return ''.join([chr(c) if c > 32 and c < 127 else '.' for c in byte_array])
tmp = ''
for (i, byte) in enumerate(byte_array):
tmp = ''.join([tmp, f'{byte:02X}'])
if (i + 1)... |
expected_output = {
'environment-information': {
'environment-item': [{
'class': 'Temp',
'name': 'PSM 0',
'status': 'OK',
'temperature': {
'#text': '25 '
'degrees '
'C '
'/ '
'77 '... | expected_output = {'environment-information': {'environment-item': [{'class': 'Temp', 'name': 'PSM 0', 'status': 'OK', 'temperature': {'#text': '25 degrees C / 77 degrees F', '@junos:celsius': '25'}}, {'class': 'Temp', 'name': 'PSM 1', 'status': 'OK', 'temperature': {'#text': '24 degrees C / 75 degrees F', '@junos:cels... |
# Declan Barr 19 Mar 2018
# Script that contains function sumultiply that takes two integer arguments and
# returns their product. Does this without the * or / operators
def sumultiply(x, y):
sumof = 0
for i in range(1, x+1):
sumof = sumof + y
return sumof
print(sumultiply(11, 13))
print(sumultip... | def sumultiply(x, y):
sumof = 0
for i in range(1, x + 1):
sumof = sumof + y
return sumof
print(sumultiply(11, 13))
print(sumultiply(5, 123)) |
class Node:
def __init__(self, value, child, parent):
self._value = value
self._child = child
self._parent = parent
def get_value(self):
#Return the value of a node
return self._value
def get_child(self):
#Return the value of a node
return self._chil... | class Node:
def __init__(self, value, child, parent):
self._value = value
self._child = child
self._parent = parent
def get_value(self):
return self._value
def get_child(self):
return self._child
def get_parent(self):
return self._parent
def set_v... |
def find_sum(arr, s):
curr_sum = arr[0]
start = 0
n = len(arr) - 1
i = 1
while i <= n:
while curr_sum > s and start < i:
curr_sum = curr_sum - arr[start]
start += 1
if curr_sum == s:
return "Found between {} and {}".format(start, i ... | def find_sum(arr, s):
curr_sum = arr[0]
start = 0
n = len(arr) - 1
i = 1
while i <= n:
while curr_sum > s and start < i:
curr_sum = curr_sum - arr[start]
start += 1
if curr_sum == s:
return 'Found between {} and {}'.format(start, i - 1)
cur... |
class HoloResponse:
def __init__(self, success, response=None):
self.success = success
if response != None:
self.response = response
| class Holoresponse:
def __init__(self, success, response=None):
self.success = success
if response != None:
self.response = response |
x = float(1)
y = float(2.8)
z = float("3")
w = float("4.2")
print(x)
print(y)
print(z)
print(w)
# Author: Bryan G
| x = float(1)
y = float(2.8)
z = float('3')
w = float('4.2')
print(x)
print(y)
print(z)
print(w) |
def capture_high_res(filename):
return "./camerapi/tmp_large.jpg"
def capture_low_res(filename):
return "./camerapi/tmp_small.jpg"
def init():
return
def deinit():
return
| def capture_high_res(filename):
return './camerapi/tmp_large.jpg'
def capture_low_res(filename):
return './camerapi/tmp_small.jpg'
def init():
return
def deinit():
return |
'''
Constants
---
Constants used in other scripts. These are mostly interpretations of fields
provided in the Face2Gene jsons.
'''
HGVS_ERRORDICT_VERSION = 0
# Bucket name, from where Face2Gene vcf and json files will be downloaded
AWS_BUCKET_NAME = "fdna-pedia-dump"
# caching directory
CACHE_DIR = ".cache"
# tests... | """
Constants
---
Constants used in other scripts. These are mostly interpretations of fields
provided in the Face2Gene jsons.
"""
hgvs_errordict_version = 0
aws_bucket_name = 'fdna-pedia-dump'
cache_dir = '.cache'
chromosomal_tests = ['CHROMOSOMAL_MICROARRAY', 'FISH', 'KARYOTYPE']
positive_results = ['ABNORMAL', 'ABNO... |
def f(x):
return ((2*(x**4))+(3*(x**3))-(6*(x**2))+(5*x)-8)
def reachEnd(previousm,currentm):
if abs(previousm - currentm) <= 10**(-6):
return True
return False
def printFormat(a,b,c,m,count):
print("Step %s" %count)
print("a=%.6f b=%.6f c=%.6f" %(a,b,c))
print("f(a)=%.6f f(... | def f(x):
return 2 * x ** 4 + 3 * x ** 3 - 6 * x ** 2 + 5 * x - 8
def reach_end(previousm, currentm):
if abs(previousm - currentm) <= 10 ** (-6):
return True
return False
def print_format(a, b, c, m, count):
print('Step %s' % count)
print('a=%.6f b=%.6f c=%.6f' % (a, b, c))
print('f(a)... |
class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
result = []
rows, columns = len(matrix), len(matrix[0])
up = left = 0
right = columns-1
down = rows-1
while len(result) < rows*columns:
for col in r... | class Solution:
def spiral_order(self, matrix: List[List[int]]) -> List[int]:
result = []
(rows, columns) = (len(matrix), len(matrix[0]))
up = left = 0
right = columns - 1
down = rows - 1
while len(result) < rows * columns:
for col in range(left, right + ... |
class NoProxy:
def get(self, _):
return None
def ban_proxy(self, proxies):
return None
class RateLimitProxy:
def __init__(self, proxies, paths, default=None):
self.proxies = proxies
self.proxy_count = len(proxies)
self.access_counter = {
path: {"limit":... | class Noproxy:
def get(self, _):
return None
def ban_proxy(self, proxies):
return None
class Ratelimitproxy:
def __init__(self, proxies, paths, default=None):
self.proxies = proxies
self.proxy_count = len(proxies)
self.access_counter = {path: {'limit': paths[path]... |
months_json = {
"1": "January",
"2": "February",
"3": "March",
"4": "April",
"5": "May",
"6": "June",
"7": "July",
"8": "August",
"9": "September",
"01": "January",
"02": "February",
"03": "March",
"04": "April",
"05": "May",
"06": "June",
"07": "July",
"08": "August",
"09": "Septem... | months_json = {'1': 'January', '2': 'February', '3': 'March', '4': 'April', '5': 'May', '6': 'June', '7': 'July', '8': 'August', '9': 'September', '01': 'January', '02': 'February', '03': 'March', '04': 'April', '05': 'May', '06': 'June', '07': 'July', '08': 'August', '09': 'September', '10': 'October', '11': 'November... |
#coding: utf-8
'''
@Time: 2019/4/25 11:15
@Author: fangyoucai
'''
| """
@Time: 2019/4/25 11:15
@Author: fangyoucai
""" |
__all__ = ['EncryptException', 'DecryptException', 'DefaultKeyNotSet', 'NoValidKeyFound']
class EncryptException(BaseException):
pass
class DecryptException(BaseException):
pass
class DefaultKeyNotSet(EncryptException):
pass
class NoValidKeyFound(DecryptException):
pass
| __all__ = ['EncryptException', 'DecryptException', 'DefaultKeyNotSet', 'NoValidKeyFound']
class Encryptexception(BaseException):
pass
class Decryptexception(BaseException):
pass
class Defaultkeynotset(EncryptException):
pass
class Novalidkeyfound(DecryptException):
pass |
#
# @lc app=leetcode id=86 lang=python3
#
# [86] Partition List
#
# https://leetcode.com/problems/partition-list/description/
#
# algorithms
# Medium (43.12%)
# Likes: 1981
# Dislikes: 384
# Total Accepted: 256.4K
# Total Submissions: 585.7K
# Testcase Example: '[1,4,3,2,5,2]\n3'
#
# Given the head of a linked l... | class Solution:
def partition(self, head: ListNode, x: int) -> ListNode:
if not head:
return head
smaller_dummy = list_node(0)
greater_dummy = list_node(0)
smaller = smaller_dummy
greater = greater_dummy
node = head
while node:
if node... |
with open("input.txt", "r") as input_file:
input = input_file.read().split("\n")
passwords = list(map(lambda line: [list(map(int, line.split(" ")[0].split("-"))), line.split(" ")[1][0], line.split(" ")[2]], input))
valid = 0
for password in passwords:
count_letter = password[2].count(password[1])
if pass... | with open('input.txt', 'r') as input_file:
input = input_file.read().split('\n')
passwords = list(map(lambda line: [list(map(int, line.split(' ')[0].split('-'))), line.split(' ')[1][0], line.split(' ')[2]], input))
valid = 0
for password in passwords:
count_letter = password[2].count(password[1])
if passwor... |
music = {
'kb': '''
Instrument(Flute)
Piece(Undine, Reinecke)
Piece(Carmen, Bourne)
(Instrument(x) & Piece(w, c) & Era(c, r)) ==> Program(w)
Era(Reinecke, Romantic)
Era(Bourne, Romantic)
''',
'queries': '''
Program(x)
''',
}
life = {
'kb': '''
Musician(x) ==> Stressed(x)
(Student(x) & Te... | music = {'kb': '\nInstrument(Flute)\nPiece(Undine, Reinecke)\nPiece(Carmen, Bourne)\n\n\n(Instrument(x) & Piece(w, c) & Era(c, r)) ==> Program(w)\nEra(Reinecke, Romantic)\nEra(Bourne, Romantic)\n\n\n ', 'queries': '\n Program(x)\n '}
life = {'kb': '\nMusician(x) ==> Stressed(x)\n(Student(x) & Text(y)) ==> Stre... |
myl1 = []
num = int(input("Enter the number of elements: "))
for loop in range(num):
myl1.append(input(f"Enter element at index {loop} : "))
print(myl1)
print(type(myl1))
myt1 = tuple(myl1)
print(myt1)
print(type(myt1))
print("The elements of tuple object are: ")
for loop in myt1:
print(loop) | myl1 = []
num = int(input('Enter the number of elements: '))
for loop in range(num):
myl1.append(input(f'Enter element at index {loop} : '))
print(myl1)
print(type(myl1))
myt1 = tuple(myl1)
print(myt1)
print(type(myt1))
print('The elements of tuple object are: ')
for loop in myt1:
print(loop) |
# Scrapy settings for scraper project
BOT_NAME = 'scraper'
SPIDER_MODULES = ['scraper.spiders']
NEWSPIDER_MODULE = 'scraper.spiders'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
USER_AGENT = 'Googlebot-News'
# Obey robots.txt rules
ROBOTSTXT_OBEY = True
# MONGO URI for accessing... | bot_name = 'scraper'
spider_modules = ['scraper.spiders']
newspider_module = 'scraper.spiders'
user_agent = 'Googlebot-News'
robotstxt_obey = True
mongo_uri = ''
mongo_database = ''
sqlite_db = ''
item_pipelines = {} |
## Data Categorisation
'''
1) Whole Number (Ints) - 100, 1000, -450, 999
2) Real Numbers (Floats) - 33.33, 44.01, -1000.033
3) String - "Bangalore", "India", "Raj", "abc123"
4) Boolean - True, False
Variables in python are dynamic in nature
'''
a = 10
print(a)
print(type(a))
a = 10.33
print(a)
print(type(a))
a =... | """
1) Whole Number (Ints) - 100, 1000, -450, 999
2) Real Numbers (Floats) - 33.33, 44.01, -1000.033
3) String - "Bangalore", "India", "Raj", "abc123"
4) Boolean - True, False
Variables in python are dynamic in nature
"""
a = 10
print(a)
print(type(a))
a = 10.33
print(a)
print(type(a))
a = 'New Jersey'
print(a)
prin... |
class RelationType(object):
ONE_TO_MANY = "one_to_many"
ONE_TO_ONE = "one_to_one"
class Relation(object):
def __init__(self, cls):
self.cls = cls
class HasOne(Relation):
def get(self, id):
return self.cls.get(id=id)
class HasMany(Relation):
def get(self, id):
value = []... | class Relationtype(object):
one_to_many = 'one_to_many'
one_to_one = 'one_to_one'
class Relation(object):
def __init__(self, cls):
self.cls = cls
class Hasone(Relation):
def get(self, id):
return self.cls.get(id=id)
class Hasmany(Relation):
def get(self, id):
value = []... |
description = 'Alphai alias device'
group = 'lowlevel'
devices = dict(
alphai = device('nicos.devices.generic.DeviceAlias'),
)
| description = 'Alphai alias device'
group = 'lowlevel'
devices = dict(alphai=device('nicos.devices.generic.DeviceAlias')) |
{
'targets': [
{
'target_name': 'overlay_window',
'sources': [
'src/lib/addon.c',
'src/lib/napi_helpers.c'
],
'include_dirs': [
'src/lib'
],
'conditions': [
['OS=="win"', {
'defines': [
'WIN32_LEAN_AND_MEAN'
],
... | {'targets': [{'target_name': 'overlay_window', 'sources': ['src/lib/addon.c', 'src/lib/napi_helpers.c'], 'include_dirs': ['src/lib'], 'conditions': [['OS=="win"', {'defines': ['WIN32_LEAN_AND_MEAN'], 'link_settings': {'libraries': ['oleacc.lib']}, 'sources': ['src/lib/windows.c']}], ['OS=="linux"', {'defines': ['_GNU_S... |
# ---------------------------------------------------------------------
# Gufo Labs Loader:
# a plugin
# ---------------------------------------------------------------------
# Copyright (C) 2022, Gufo Labs
# ---------------------------------------------------------------------
class APlugin(object):
name = "a"
... | class Aplugin(object):
name = 'a'
def get_name(self) -> str:
return self.name |
class InvalidProxyType(Exception): pass
class ApiConnectionError(Exception): pass
class ApplicationNotFound(Exception): pass
class SqlmapFailedStart(Exception): pass
class SpiderTestFailure(Exception): pass
class InvalidInputProvided(Exception): pass
class InvalidTamperProvided(Exception): pass
class Port... | class Invalidproxytype(Exception):
pass
class Apiconnectionerror(Exception):
pass
class Applicationnotfound(Exception):
pass
class Sqlmapfailedstart(Exception):
pass
class Spidertestfailure(Exception):
pass
class Invalidinputprovided(Exception):
pass
class Invalidtamperprovided(Exception):... |
test = { 'name': 'q1_3',
'points': 1,
'suites': [ { 'cases': [ {'code': '>>> type(max_estimate) in set([int, np.int32, np.int64])\nTrue', 'hidden': False, 'locked': False},
{'code': '>>> max_estimate in observations.column(0)\nTrue', 'hidden': False, 'locked': False}],... | test = {'name': 'q1_3', 'points': 1, 'suites': [{'cases': [{'code': '>>> type(max_estimate) in set([int, np.int32, np.int64])\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> max_estimate in observations.column(0)\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': '... |
TYPES = {"int","float","str","bool","list"}
MATCH_TYPES = {"int": int, "float": float, "str": str, "bool": bool, "list": list}
CONSTRAINTS = {
"is_same_type": lambda x, y: type(x) == type(y),
"int" :{
"min_inc": lambda integer, min: integer >= min,
"min_exc": lambda integer, ... | types = {'int', 'float', 'str', 'bool', 'list'}
match_types = {'int': int, 'float': float, 'str': str, 'bool': bool, 'list': list}
constraints = {'is_same_type': lambda x, y: type(x) == type(y), 'int': {'min_inc': lambda integer, min: integer >= min, 'min_exc': lambda integer, min: integer > min, 'max_inc': lambda inte... |
def main():
video = "NET20070330_thlep_1_2"
file_path = "optical_flow_features_train/" + video
optical_flow_features_train = open(file_path + "/optical_flow_features_train.txt", "r")
clear_of_features_train = open(file_path + "/clear_opt_flow_features_train.txt", "w")
visual_ids = []
for line ... | def main():
video = 'NET20070330_thlep_1_2'
file_path = 'optical_flow_features_train/' + video
optical_flow_features_train = open(file_path + '/optical_flow_features_train.txt', 'r')
clear_of_features_train = open(file_path + '/clear_opt_flow_features_train.txt', 'w')
visual_ids = []
for line in... |
prize_file_1 = open("/Users/MatBook/Downloads/prize3.txt")
List = []
prizes = []
for line in prize_file_1:
List.append(int(line))
first_line = List.pop(0)
for i in List:
print(i)
for j in List:
if i + j == first_line:
prizes.append((i,j))
print (... | prize_file_1 = open('/Users/MatBook/Downloads/prize3.txt')
list = []
prizes = []
for line in prize_file_1:
List.append(int(line))
first_line = List.pop(0)
for i in List:
print(i)
for j in List:
if i + j == first_line:
prizes.append((i, j))
print(List)
print('you can have:', prizes) |
def classfinder(k):
res=1
while res*(res+1)//2<k:
res+=1
return res
# cook your dish here
for t in range(int(input())):
#n=int(input())
n,k=map(int,input().split())
clas=classfinder(k)
i=k-clas*(clas-1)//2
str=""
for z in range(n):
if ... | def classfinder(k):
res = 1
while res * (res + 1) // 2 < k:
res += 1
return res
for t in range(int(input())):
(n, k) = map(int, input().split())
clas = classfinder(k)
i = k - clas * (clas - 1) // 2
str = ''
for z in range(n):
if z == n - clas - 1 or z == n - i:
... |
class Config:
conf = {
"labels": {
"pageTitle": "Weatherman V0.0.1"
},
"db.database": "weatherman",
"db.username": "postgres",
"db.password": "postgres",
"navigation": [
{
"url": "/",
"name": "Home"
}... | class Config:
conf = {'labels': {'pageTitle': 'Weatherman V0.0.1'}, 'db.database': 'weatherman', 'db.username': 'postgres', 'db.password': 'postgres', 'navigation': [{'url': '/', 'name': 'Home'}, {'url': '/cakes', 'name': 'Cakes'}, {'url': '/mqtt', 'name': 'MQTT'}]}
def get_config(self):
return self.co... |
def is_leap(year):
leap = False
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
leap = True
else:
leap = False
else:
leap = True
return leap
year = int(input())
print(is_leap(year))
'''
In the Gregorian calend... | def is_leap(year):
leap = False
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
leap = True
else:
leap = False
else:
leap = True
return leap
year = int(input())
print(is_leap(year))
'\nIn the Gregorian calendar, th... |
# -*- coding: utf-8 -*-
class DummyTile:
def __init__(self, pos, label=None):
self.pos = pos
# Label tells adjacent mine count for this tile. Int between 0...8 or None if unknown
self.label = label
self.checked = False
self.marked = False
self.adj_mines = None
... | class Dummytile:
def __init__(self, pos, label=None):
self.pos = pos
self.label = label
self.checked = False
self.marked = False
self.adj_mines = None
self.adj_tiles = 0
self.adj_checked = 0
self.adj_unchecked = None
def set_label(self, label):
... |
##Write code to switch the order of the winners list so that it is now Z to A. Assign this list to the variable z_winners.
winners = ['Alice Munro', 'Alvin E. Roth', 'Kazuo Ishiguro', 'Malala Yousafzai', 'Rainer Weiss', 'Youyou Tu']
z_winners = winners
z_winners.reverse()
print(z_winners) | winners = ['Alice Munro', 'Alvin E. Roth', 'Kazuo Ishiguro', 'Malala Yousafzai', 'Rainer Weiss', 'Youyou Tu']
z_winners = winners
z_winners.reverse()
print(z_winners) |
class Vector:
#exercise 01
def __init__(self,inputlist):
self._vector = []
_vector = inputlist
#exercise 02
def __str__(self):
return "<" + str(self._vector).strip("[]") + ">"
#exercise 03
def dim(self):
return len(self._vector)
#exercise 04
def get... | class Vector:
def __init__(self, inputlist):
self._vector = []
_vector = inputlist
def __str__(self):
return '<' + str(self._vector).strip('[]') + '>'
def dim(self):
return len(self._vector)
def get(self, index):
return self._vector[index]
def set(self, i... |
# Protein sequence given
seq = "MPISEPTFFEIF"
# Split the sequence into its component amino acids
seq_list = list(seq)
# Use a set to establish the unique amino acids
unique_amino_acids = set(seq_list)
# Print out the unique amino acids
print(unique_amino_acids)
| seq = 'MPISEPTFFEIF'
seq_list = list(seq)
unique_amino_acids = set(seq_list)
print(unique_amino_acids) |
DEPTH = 16 # the number of filters of the first conv layer of the encoder of the UNet
# Training hyperparameters
BATCHSIZE = 16
EPOCHS = 100
OPTIMIZER = "adam"
| depth = 16
batchsize = 16
epochs = 100
optimizer = 'adam' |
string=input("Enter a string:")
length=len(string)
mid=length//2
rev=-1
for a in range(mid):
if string[a]==string[rev]:
a+=1
rev=-1
else:
print(string,"is a palindrome")
break
else:
print(string,"is not a palindrome")
| string = input('Enter a string:')
length = len(string)
mid = length // 2
rev = -1
for a in range(mid):
if string[a] == string[rev]:
a += 1
rev = -1
else:
print(string, 'is a palindrome')
break
else:
print(string, 'is not a palindrome') |
# Argus was charged with guarding Io, which is not an ordinary cow. Io is quite an explorer, and she wanders off rather frequently, making Argus' life stressful. So the cowherd decided to construct an enclosed pasture for Io.
# There are nnn trees growing along the river, where Argus tends Io. For this problem, the riv... | t = int(input())
for i in range(t):
n = int(input())
xs = list(map(int, input().split())) |
''' Compute a digest message '''
def answer(digest):
''' solve for m[1] '''
message = []
for i, v in enumerate(digest):
pv = message[i - 1] if i > 0 else 0
m = 0.1
a = 0
while m != int(m):
m = ((256 * a) + (v ^ pv)) / 129.0
a += 1
m = int(m)
... | """ Compute a digest message """
def answer(digest):
""" solve for m[1] """
message = []
for (i, v) in enumerate(digest):
pv = message[i - 1] if i > 0 else 0
m = 0.1
a = 0
while m != int(m):
m = (256 * a + (v ^ pv)) / 129.0
a += 1
m = int(m)
... |
# October 27th, 2021
# INFOTC 4320
# Josh Block
# Challenge: Anagram Alogrithm and Big-O
# References: https://bradfieldcs.com/algos/analysis/an-anagram-detection-example/
print("===Anagram Dector===")
print("This program determines if two words are anagrams of each other\n")
first_word = input("Please enter first wo... | print('===Anagram Dector===')
print('This program determines if two words are anagrams of each other\n')
first_word = input('Please enter first word: ')
second_word = input('Please enter second word: ')
def dector(first_word, second_word):
return sorted(first_word) == sorted(second_word)
print(dector(first_word, s... |
a=int(input())
b=int(input())
c=int(input())
if(a>b and a>c):
print("number 1 is greatest")
elif(b>a and b>c):
print("number 2 is greatest")
else:
print("number 3 is greatest")
| a = int(input())
b = int(input())
c = int(input())
if a > b and a > c:
print('number 1 is greatest')
elif b > a and b > c:
print('number 2 is greatest')
else:
print('number 3 is greatest') |
def main():
# Create and print a list named fruit.
fruit_list = ["pear", "banana", "apple", "mango"]
print(f"original: {fruit_list}")
fruit_list.reverse()
print(f"Reverse {fruit_list}")
fruit_list.append("Orange")
print(f"Append Orange {fruit_list}")
pos = fruit_list.index("apple")
... | def main():
fruit_list = ['pear', 'banana', 'apple', 'mango']
print(f'original: {fruit_list}')
fruit_list.reverse()
print(f'Reverse {fruit_list}')
fruit_list.append('Orange')
print(f'Append Orange {fruit_list}')
pos = fruit_list.index('apple')
fruit_list.insert(pos, 'cherry')
print(f... |
__author__ = "Eric Dose :: New Mexico Mira Project, Albuquerque"
# PyInstaller (__init__.py file should be in place as peer to .py file to run):
# in Windows Command Prompt (E. Dose dev PC):
# cd c:\Dev\prepoint\prepoint
# C:\Programs\Miniconda\Scripts\pyinstaller app.spec
| __author__ = 'Eric Dose :: New Mexico Mira Project, Albuquerque' |
def make_interval(depth, depth_integer_multiplier, num, step_num, start_val):
all_groups_str = "[\n"
for n in range(num):
all_groups_str += "\t["
for d in range(depth):
val = str(start_val * pow(depth_integer_multiplier, d))
if d == depth - 1:
i... | def make_interval(depth, depth_integer_multiplier, num, step_num, start_val):
all_groups_str = '[\n'
for n in range(num):
all_groups_str += '\t['
for d in range(depth):
val = str(start_val * pow(depth_integer_multiplier, d))
if d == depth - 1:
if n == num ... |
class AFGR:
@staticmethod
def af_to_gr(dict_af):
dict_swap = {}
for keys in dict_af:
dict_swap[keys] = []
for list in dict_af[keys]:
dict_swap[keys].insert(len(dict_swap[keys]), list[0])
dict_swap[keys].insert(len(dict_swap[keys]), list[1]... | class Afgr:
@staticmethod
def af_to_gr(dict_af):
dict_swap = {}
for keys in dict_af:
dict_swap[keys] = []
for list in dict_af[keys]:
dict_swap[keys].insert(len(dict_swap[keys]), list[0])
dict_swap[keys].insert(len(dict_swap[keys]), list[1]... |
animals = ["Gully", "Rhubarb", "Zephyr", "Henry"]
for index, animal in enumerate(animals):
# if index % 2 == 0:
# continue
# print(animal)
print(f"{index+1}.\t{animal}")
| animals = ['Gully', 'Rhubarb', 'Zephyr', 'Henry']
for (index, animal) in enumerate(animals):
print(f'{index + 1}.\t{animal}') |
# Given an integer array arr, count element x such that x + 1 is also in arr.
# If there're duplicates in arr, count them seperately.
# Example 1:
# Input: arr = [1,2,3]
# Output: 2
# Explanation: 1 and 2 are counted cause 2 and 3 are in arr.
# Example 2:
# Input: arr = [1,1,3,3,5,5,7,7]
# Output: 0
# Explanatio... | def count_elements(arr):
d = {}
for i in arr:
d[i] = 1
count = 0
for num in arr:
num_plus = num + 1
if num_plus in d:
count += 1
return count
print(count_elements([1, 1, 2, 2])) |
ES_HOST = 'localhost:9200'
ES_INDEX = 'pending-uberon'
ES_DOC_TYPE = 'anatomy'
API_PREFIX = 'uberon'
API_VERSION = ''
| es_host = 'localhost:9200'
es_index = 'pending-uberon'
es_doc_type = 'anatomy'
api_prefix = 'uberon'
api_version = '' |
class Solution:
def solve(self, nums):
integersDict = {}
for i in range(len(nums)):
try:
integersDict[nums[i]] += 1
except:
integersDict[nums[i]] = 1
for integer in integersDict:
if integersDict[integer] != 3:
... | class Solution:
def solve(self, nums):
integers_dict = {}
for i in range(len(nums)):
try:
integersDict[nums[i]] += 1
except:
integersDict[nums[i]] = 1
for integer in integersDict:
if integersDict[integer] != 3:
... |
class CharacterRaceList(object):
DEVA = 'DEVA'
DRAGONBORN = 'DRAGONBORN'
DWARF = 'DWARF'
ELADRIN = 'ELADRIN'
ELF = 'ELF'
GITHZERAI = 'GITHZERAI'
GNOME = 'GNOME'
GOLIATH = 'GOLIATH'
HALFELF = 'HALFELF'
HALFLING = 'HALFLING'
HALFORC = 'HALFORC'
HUMAN = 'HUMAN'
MINOTAUR... | class Characterracelist(object):
deva = 'DEVA'
dragonborn = 'DRAGONBORN'
dwarf = 'DWARF'
eladrin = 'ELADRIN'
elf = 'ELF'
githzerai = 'GITHZERAI'
gnome = 'GNOME'
goliath = 'GOLIATH'
halfelf = 'HALFELF'
halfling = 'HALFLING'
halforc = 'HALFORC'
human = 'HUMAN'
minotaur ... |
def inner_stroke(im):
pass
def outer_stroke(im):
pass
| def inner_stroke(im):
pass
def outer_stroke(im):
pass |
a, b, c = map(int, input().split())
h, l = map(int, input().split())
if a <= h and b <= l:
print("S")
elif a <= h and c <= l:
print("S")
elif b <= h and a <= l:
print("S")
elif b <= h and c <= l:
print("S")
elif c <= h and a <= l:
print("S")
elif c <= h and b <= l:
print("S")
else:... | (a, b, c) = map(int, input().split())
(h, l) = map(int, input().split())
if a <= h and b <= l:
print('S')
elif a <= h and c <= l:
print('S')
elif b <= h and a <= l:
print('S')
elif b <= h and c <= l:
print('S')
elif c <= h and a <= l:
print('S')
elif c <= h and b <= l:
print('S')
else:
print... |
def funcao1 (a, b):
mult= a * b
return mult
def funcao2 (a, b):
divi = a / b
return divi
multiplicacao = funcao1(3, 2)
valor = funcao2(multiplicacao, 2)
print(multiplicacao)
print(int(valor))
| def funcao1(a, b):
mult = a * b
return mult
def funcao2(a, b):
divi = a / b
return divi
multiplicacao = funcao1(3, 2)
valor = funcao2(multiplicacao, 2)
print(multiplicacao)
print(int(valor)) |
# Plotting distributions pairwise (1)
# Print the first 5 rows of the DataFrame
print(auto.head())
# Plot the pairwise joint distributions from the DataFrame
sns.pairplot(auto)
# Display the plot
plt.show()
| print(auto.head())
sns.pairplot(auto)
plt.show() |
def log_text(file_path, log):
if not log.endswith('\n'):
log += '\n'
print(log)
with open(file_path, 'a') as f:
f.write(log)
def log_args(file_path, args):
log = f"Args: {args}\n"
log_text(file_path, log)
def log_train_epoch(file_path, epoch, train_loss, train_accuracy):
log... | def log_text(file_path, log):
if not log.endswith('\n'):
log += '\n'
print(log)
with open(file_path, 'a') as f:
f.write(log)
def log_args(file_path, args):
log = f'Args: {args}\n'
log_text(file_path, log)
def log_train_epoch(file_path, epoch, train_loss, train_accuracy):
log = ... |
class Node:
def __init__(self, value, next):
self.value = value
self.next = next
class LinkedList:
def __init__(self):
self.head = None
def add(self, value):
self.head = Node(value, self.head)
def remove(self):
to_remove = self.head
self.head = self.hea... | class Node:
def __init__(self, value, next):
self.value = value
self.next = next
class Linkedlist:
def __init__(self):
self.head = None
def add(self, value):
self.head = node(value, self.head)
def remove(self):
to_remove = self.head
self.head = self.h... |
#!/usr/bin/env python
#
# ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University of Chicago
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://ge... | __all__ = ['EqDeformation', 'Explicit', 'Implicit', 'Problem', 'Solver', 'SolverLinear', 'SolverNonlinear', 'TimeDependent', 'TimeStep', 'TimeStepUniform', 'TimeStepUser', 'TimeStepAdapt', 'ProgressMonitor'] |
t = int(input())
while (t!=0):
a,b,c = map(int,input().split())
if (a+b+c == 180):
print('YES')
else:
print('NO')
t-=1
| t = int(input())
while t != 0:
(a, b, c) = map(int, input().split())
if a + b + c == 180:
print('YES')
else:
print('NO')
t -= 1 |
# cool.py
def cool_func():
print('cool_func(): Super Cool!')
print('__name__:', __name__)
if __name__ == '__main__':
print('Call it locally')
cool_func()
| def cool_func():
print('cool_func(): Super Cool!')
print('__name__:', __name__)
if __name__ == '__main__':
print('Call it locally')
cool_func() |
class FieldDoesNotExist(Exception):
def __init__(self, **kwargs):
super().__init__(f"{self.__class__.__name__}: {kwargs}")
self.kwargs = kwargs
| class Fielddoesnotexist(Exception):
def __init__(self, **kwargs):
super().__init__(f'{self.__class__.__name__}: {kwargs}')
self.kwargs = kwargs |
#
# PySNMP MIB module Unisphere-Products-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Products-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:26:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) ... |
# Calculate factorial of a number
def factorial(n):
''' Returns the factorial of n.
e.g. factorial(7) = 7x76x5x4x3x2x1 = 5040.
'''
answer = 1
for i in range(1,n+1):
answer = answer * i
return answer
if __name__ == "__main__":
assert factorial(7) == 5040 | def factorial(n):
""" Returns the factorial of n.
e.g. factorial(7) = 7x76x5x4x3x2x1 = 5040.
"""
answer = 1
for i in range(1, n + 1):
answer = answer * i
return answer
if __name__ == '__main__':
assert factorial(7) == 5040 |
line = input().split()
n = int(line[0])
m = int(line[1])
print(str(abs(n-m)))
| line = input().split()
n = int(line[0])
m = int(line[1])
print(str(abs(n - m))) |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"c_imshow": "01_nn_utils.ipynb",
"Flatten": "01_nn_utils.ipynb",
"conv3x3": "01_nn_utils.ipynb",
"get_proto_accuracy": "01_nn_utils.ipynb",
"get_accuracy": "02_maml_pl.ipyn... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'c_imshow': '01_nn_utils.ipynb', 'Flatten': '01_nn_utils.ipynb', 'conv3x3': '01_nn_utils.ipynb', 'get_proto_accuracy': '01_nn_utils.ipynb', 'get_accuracy': '02_maml_pl.ipynb', 'collate_task': '01b_data_loaders_pl.ipynb', 'collate_task_batch': '01b_d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.