content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def startRightHand():
##############
i01.startRightHand(rightPort)
i01.rightHand.thumb.setMinMax(0,115)
i01.rightHand.index.setMinMax(35,130)
i01.rightHand.majeure.setMinMax(35,130)
i01.rightHand.ringFinger.setMinMax(35,130)
i01.rightHand.pinky.setMinMax(35,130)
i01.rightHand.wrist.map(90,90,90,... | def start_right_hand():
i01.startRightHand(rightPort)
i01.rightHand.thumb.setMinMax(0, 115)
i01.rightHand.index.setMinMax(35, 130)
i01.rightHand.majeure.setMinMax(35, 130)
i01.rightHand.ringFinger.setMinMax(35, 130)
i01.rightHand.pinky.setMinMax(35, 130)
i01.rightHand.wrist.map(90, 90, 90, 9... |
# <auto-generated>
# This code was generated by the UnitCodeGenerator tool
#
# Changes to this file will be lost if the code is regenerated
# </auto-generated>
def to_bits(value):
return value * 1048576.0
def to_kilobits(value):
return value * 1048.58
def to_megabits(value):
return value * 1.04858
def to_gigabit... | def to_bits(value):
return value * 1048576.0
def to_kilobits(value):
return value * 1048.58
def to_megabits(value):
return value * 1.04858
def to_gigabits(value):
return value / 953.67431640625
def to_terabits(value):
return value / 953674.0
def to_kilobytes(value):
return value / 0.0076293... |
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | repo_root = 'io_bazel_rules_kotlin'
kotlin_repo_root = 'com_github_jetbrains_kotlin'
kotlin_info = provider(fields={'src': 'the source files. [intelij-aspect]', 'outputs': 'output jars produced by this rule. [intelij-aspect]'}) |
SECRET_KEY = '123'
#
# For mysql in python3.5, uncomment if you will Use MySQL database driver
# import pymysql
# pymysql.install_as_MySQLdb()
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
}
}
KB_NAME_FILE_PATH = '/home/g10k/git/knowledge_base/kb_li... | secret_key = '123'
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3'}}
kb_name_file_path = '/home/g10k/git/knowledge_base/kb_links.json' |
class Solution:
def isDividingNumber(self, num):
if '0' in str(num):
return False
return 0 == sum(num % int(i) for i in str(num))
def selfDividingNumbers(self, left: int, right: int) -> List[int]:
divlist = []
for i in range(left, right + 1, +1):
if self.... | class Solution:
def is_dividing_number(self, num):
if '0' in str(num):
return False
return 0 == sum((num % int(i) for i in str(num)))
def self_dividing_numbers(self, left: int, right: int) -> List[int]:
divlist = []
for i in range(left, right + 1, +1):
i... |
# coding:utf-8
'''
@author = super_fazai
@File : __init__.py.py
@Time : 2016/12/13 15:39
@connect : superonesfazai@gmail.com
''' | """
@author = super_fazai
@File : __init__.py.py
@Time : 2016/12/13 15:39
@connect : superonesfazai@gmail.com
""" |
class Manager:
def __init__(self):
self.states = []
def process_input(self, event):
self.states[-1].process_input(event)
def update(self):
self.states[-1].update()
def draw(self, screen):
for state in self.states:
state.draw(screen)
def push(self, stat... | class Manager:
def __init__(self):
self.states = []
def process_input(self, event):
self.states[-1].process_input(event)
def update(self):
self.states[-1].update()
def draw(self, screen):
for state in self.states:
state.draw(screen)
def push(self, sta... |
#!/usr/bin/env python
class Real(object):
def method(self):
return "method"
@property
def prop(self):
# print "prop called"
return "prop"
class PropertyProxy(object):
def __init__( self, object, name ):
self._object = object
self._name = name
def __get__(sel... | class Real(object):
def method(self):
return 'method'
@property
def prop(self):
return 'prop'
class Propertyproxy(object):
def __init__(self, object, name):
self._object = object
self._name = name
def __get__(self, obj, type):
return obj.__getattribute__(... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
#Filename: print_index.py
colors = [ 'red', 'green', 'blue', 'yellow' ]
for i in range(len(colors)):
print (i, '->', colors[i])
# >>> 0 -> red
# 1 -> green
# 2 -> blue
# 3 -> yellow
# >>>
for i, color in enumerate(colors):
print (i, '->', color)... | colors = ['red', 'green', 'blue', 'yellow']
for i in range(len(colors)):
print(i, '->', colors[i])
for (i, color) in enumerate(colors):
print(i, '->', color) |
set_A = set(map(int,input().split()))
N = int(input())
for i in range(N):
arr_A = set(input().split())
arr_N = set(input().split())
if not arr_A.issuperset(arr_N):
print(False)
else:
print(True)
| set_a = set(map(int, input().split()))
n = int(input())
for i in range(N):
arr_a = set(input().split())
arr_n = set(input().split())
if not arr_A.issuperset(arr_N):
print(False)
else:
print(True) |
def main():
a = "Java"
b = a.replace("a", "ao")
print(b)
c = a.replace("a", "")
print(c)
print(b[1:3])
d = a[0] + b[5]
print("PRINTS D: " + d)
e = 3 * len(a)
print("prints e: " + str(e))
print(d + "k" + "e")
print(a[2])
main() | def main():
a = 'Java'
b = a.replace('a', 'ao')
print(b)
c = a.replace('a', '')
print(c)
print(b[1:3])
d = a[0] + b[5]
print('PRINTS D: ' + d)
e = 3 * len(a)
print('prints e: ' + str(e))
print(d + 'k' + 'e')
print(a[2])
main() |
#Your Own list.
List_of_transportation = ["car","bike","truck"]
print("I just love to ride a "+List_of_transportation[1]+".")
print("But i also love to sit in a "+List_of_transportation[0]+" comfortably and drive.")
print("I also play simulator games of "+List_of_transportation[2]+".")
| list_of_transportation = ['car', 'bike', 'truck']
print('I just love to ride a ' + List_of_transportation[1] + '.')
print('But i also love to sit in a ' + List_of_transportation[0] + ' comfortably and drive.')
print('I also play simulator games of ' + List_of_transportation[2] + '.') |
supported_languages = {
# .c,.h: C
"c": "C",
"h": "C",
# .cc .cpp .cxx .c++ .h .hh : CPP
"cc": "CPP",
"cpp": "CPP",
"cxx": "CPP",
"c++": "CPP",
"h": "CPP",
"hh": "CPP",
# .py .pyw, .pyc, .pyo, .pyd : PYTHON
"py": "PYTHON",
"pyw": "PYTHON",
"pyc": "PYTHON",
"py... | supported_languages = {'c': 'C', 'h': 'C', 'cc': 'CPP', 'cpp': 'CPP', 'cxx': 'CPP', 'c++': 'CPP', 'h': 'CPP', 'hh': 'CPP', 'py': 'PYTHON', 'pyw': 'PYTHON', 'pyc': 'PYTHON', 'pyo': 'PYTHON', 'pyd': 'PYTHON', 'clj': 'CLOJURE', 'edn': 'CLOJURE', 'js': 'JAVASCRIPT', 'java': 'JAVA', 'class': 'JAVA', 'jar': 'JAVA', 'rb': 'RU... |
def buildPalindrome(st):
if st == st[::-1]: # Check for initial palindrome
return st
index = 0
subStr = st[index:]
while subStr != subStr[::-1]: # while substring is not a palindrome
index += 1
subStr = st[index:]
return st + st[index - 1 :: -1]
| def build_palindrome(st):
if st == st[::-1]:
return st
index = 0
sub_str = st[index:]
while subStr != subStr[::-1]:
index += 1
sub_str = st[index:]
return st + st[index - 1::-1] |
class node:
def __init__(self, ID, log):
self.ID = ID
self.log = log
self.peers = list()
class ISP(node):
def __init__(self, ID, log):
super().__init__(ID, log)
self.type = 'ISP'
def print(self):
print(self.ID, self.log, self.peers, self.type)
class butt(... | class Node:
def __init__(self, ID, log):
self.ID = ID
self.log = log
self.peers = list()
class Isp(node):
def __init__(self, ID, log):
super().__init__(ID, log)
self.type = 'ISP'
def print(self):
print(self.ID, self.log, self.peers, self.type)
class Butt(... |
__all__ = [
"gen_init_string"
, "gen_function_declaration_string"
, "gen_array_declaration"
]
def gen_init_string(_type, initializer, indent):
init_code = ""
if initializer is not None:
raw_code = _type.gen_usage_string(initializer)
# add indent to initializer code
init_code_l... | __all__ = ['gen_init_string', 'gen_function_declaration_string', 'gen_array_declaration']
def gen_init_string(_type, initializer, indent):
init_code = ''
if initializer is not None:
raw_code = _type.gen_usage_string(initializer)
init_code_lines = raw_code.split('\n')
init_code = '@b=@b'... |
with open("data/iris.csv") as f:
for line in f:
print (line.split(',')[:4]) | with open('data/iris.csv') as f:
for line in f:
print(line.split(',')[:4]) |
n, m = map(int, input().split())
s = input().split()
t = input().split()
q = int(input())
for _ in range(q):
y = int(input())
print(s[(y-1)%len(s)]+t[(y-1)%len(t)])
| (n, m) = map(int, input().split())
s = input().split()
t = input().split()
q = int(input())
for _ in range(q):
y = int(input())
print(s[(y - 1) % len(s)] + t[(y - 1) % len(t)]) |
pkgname = "scdoc"
pkgver = "1.11.2"
pkgrel = 0
build_style = "makefile"
make_cmd = "gmake"
hostmakedepends = ["pkgconf", "gmake"]
pkgdesc = "Tool for generating roff manual pages"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
url = "https://git.sr.ht/~sircmpwn/scdoc"
source = f"https://git.sr.ht/~sircmpwn/... | pkgname = 'scdoc'
pkgver = '1.11.2'
pkgrel = 0
build_style = 'makefile'
make_cmd = 'gmake'
hostmakedepends = ['pkgconf', 'gmake']
pkgdesc = 'Tool for generating roff manual pages'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'MIT'
url = 'https://git.sr.ht/~sircmpwn/scdoc'
source = f'https://git.sr.ht/~sircmpwn/... |
#Simple calc
operations_math = ['+', '-', '*', '/']
print('This is simle calc')
try:
a = float(input('a = '))
b = float(input('b = '))
choice = input('Please input math operations: +, -, *, / and get result for you')
if choice == operations_math[0]:
print(a+b)
elif choice == operations_math[1]:
... | operations_math = ['+', '-', '*', '/']
print('This is simle calc')
try:
a = float(input('a = '))
b = float(input('b = '))
choice = input('Please input math operations: +, -, *, / and get result for you')
if choice == operations_math[0]:
print(a + b)
elif choice == operations_math[1]:
... |
# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
a = int(input())
b = list(map(int, input().split()))
maximun = b[0]
minimun = b[0]
for data in b:
if maximun < data:
maximun = data
if minimun > data:
minimun = data
if(maximun - minimun + 1 == a):
print("YES")
else:
print("NO")
| a = int(input())
b = list(map(int, input().split()))
maximun = b[0]
minimun = b[0]
for data in b:
if maximun < data:
maximun = data
if minimun > data:
minimun = data
if maximun - minimun + 1 == a:
print('YES')
else:
print('NO') |
class Solution:
def convertToTitle(self, columnNumber: int) -> str:
if columnNumber < 27:
return chr(ord('A') - 1 + columnNumber)
val = list()
columnNumber = columnNumber - 1
while(True):
val.append(columnNumber % 26)
if (columnNumber < 26):
... | class Solution:
def convert_to_title(self, columnNumber: int) -> str:
if columnNumber < 27:
return chr(ord('A') - 1 + columnNumber)
val = list()
column_number = columnNumber - 1
while True:
val.append(columnNumber % 26)
if columnNumber < 26:
... |
a = b = source()
c = 3
if c:
b = source2()
sink(b) | a = b = source()
c = 3
if c:
b = source2()
sink(b) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def garage(init_arr, final_arr):
init_arr = init_arr[::]
seqs = 0
seq = []
while init_arr != final_arr:
zero = init_arr.index(0)
if zero != final_arr.index(0):
tmp_val = final_arr[zero]
tmp_pos = init_arr.index(tmp_val... | def garage(init_arr, final_arr):
init_arr = init_arr[:]
seqs = 0
seq = []
while init_arr != final_arr:
zero = init_arr.index(0)
if zero != final_arr.index(0):
tmp_val = final_arr[zero]
tmp_pos = init_arr.index(tmp_val)
(init_arr[zero], init_arr[tmp_pos... |
def test_environment_is_qa(app_config):
base_url = app_config.base_url
port = app_config.app_port
assert base_url == 'https://myqa-env.com'
assert port == '80'
def test_environment_is_dev(app_config):
base_url = app_config.base_url
port = app_config.app_port
assert base_url == 'https://myd... | def test_environment_is_qa(app_config):
base_url = app_config.base_url
port = app_config.app_port
assert base_url == 'https://myqa-env.com'
assert port == '80'
def test_environment_is_dev(app_config):
base_url = app_config.base_url
port = app_config.app_port
assert base_url == 'https://myde... |
class MyClass:
def __init__(self, my_val):
self.my_val = my_val
my_class = MyClass(1)
print(my_class.my_val)
print(2)
res = 2 | class Myclass:
def __init__(self, my_val):
self.my_val = my_val
my_class = my_class(1)
print(my_class.my_val)
print(2)
res = 2 |
'''
This problem was asked by Facebook.
Given a binary tree, return all paths from the root to leaves.
For example, given the tree:
1
/ \
2 3
/ \
4 5
Return [[1, 2], [1, 3, 4], [1, 3, 5]].
'''
# Definition for a binary tree node
class TreeNode:
def __init__(self, x, left=None, right=None):
... | """
This problem was asked by Facebook.
Given a binary tree, return all paths from the root to leaves.
For example, given the tree:
1
/ 2 3
/ 4 5
Return [[1, 2], [1, 3, 4], [1, 3, 5]].
"""
class Treenode:
def __init__(self, x, left=None, right=None):
self.val = x
self.left = le... |
def loadPostSample():
posts = [['my','dog','has','flea','problems','help','please'],
['maybe','not','take','him','to','dog','park','stupid'],
['my','dalmation','is','so','cute','I','love','him'],
['stop','posting','stupid','worthless','garbage'],
['mr','licks','at... | def load_post_sample():
posts = [['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'], ['my', 'dalmation', 'is', 'so', 'cute', 'I', 'love', 'him'], ['stop', 'posting', 'stupid', 'worthless', 'garbage'], ['mr', 'licks', 'ate', 'my', 'steak', 'how'... |
PROVIDER = "S3"
KEY = ""
SECRET = ""
CONTAINER = "yoredis.com"
# FOR LOCAL
PROVIDER = "LOCAL"
CONTAINER = "container_1"
CONTAINER2 = "container_2" | provider = 'S3'
key = ''
secret = ''
container = 'yoredis.com'
provider = 'LOCAL'
container = 'container_1'
container2 = 'container_2' |
def propagate_go(go_id, parent_set, go_term_dict):
if len(go_term_dict[go_id]) == 0:
return parent_set
for parent in go_term_dict[go_id]:
parent_set.add(parent)
for parent in go_term_dict[go_id]:
propagate_go(parent, parent_set, go_term_dict)
return parent_set
def form_all_go_pa... | def propagate_go(go_id, parent_set, go_term_dict):
if len(go_term_dict[go_id]) == 0:
return parent_set
for parent in go_term_dict[go_id]:
parent_set.add(parent)
for parent in go_term_dict[go_id]:
propagate_go(parent, parent_set, go_term_dict)
return parent_set
def form_all_go_pa... |
def collide(obj1, obj2):
offset_x = obj2.x - obj1.x
offset_y = obj2.y - obj1.y
return obj1.mask.overlap(obj2.mask, (offset_x, offset_y)) != None
| def collide(obj1, obj2):
offset_x = obj2.x - obj1.x
offset_y = obj2.y - obj1.y
return obj1.mask.overlap(obj2.mask, (offset_x, offset_y)) != None |
L1 = [1, 2, 3, 4]
L2 = ['A', 'B', 'C', 'D']
meshtuple = []
for x in L1:
for y in L2:
meshtuple.append([x, y])
print(meshtuple)
| l1 = [1, 2, 3, 4]
l2 = ['A', 'B', 'C', 'D']
meshtuple = []
for x in L1:
for y in L2:
meshtuple.append([x, y])
print(meshtuple) |
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
TERM_FILTERS_QUERY = {
"bool": {
"must": [
{
"multi_match": {
"query": "mock_feature",
"fields": [
"feature_name.raw^25",
... | term_filters_query = {'bool': {'must': [{'multi_match': {'query': 'mock_feature', 'fields': ['feature_name.raw^25', 'feature_name^7', 'feature_group.raw^15', 'feature_group^7', 'version^7', 'description^3', 'status', 'entity', 'tags', 'badges'], 'type': 'cross_fields'}}], 'filter': [{'wildcard': {'badges': 'pii'}}, {'b... |
# THEMES
# Requires restart
# Change the theme variable in config.py to one of these:
black = {
'foreground': '#FFFFFF',
'background': '#000000',
'fontshadow': '#010101'
}
orange = {
'foreground': '#d75f00',
'background': '#303030',
'fontshadow': '#010101'
... | black = {'foreground': '#FFFFFF', 'background': '#000000', 'fontshadow': '#010101'}
orange = {'foreground': '#d75f00', 'background': '#303030', 'fontshadow': '#010101'} |
def exchange(A, i, j):
temp = A[i]
A[i] = A[j]
A[j] = temp
return A
| def exchange(A, i, j):
temp = A[i]
A[i] = A[j]
A[j] = temp
return A |
while True:
num_items = int(input())
if num_items == 0:
break
# Normal sort also works
# items = list(sorted(map(int, input().split())))
# print(" ".join(map(str, items)))
buckets = [0 for i in range(101)]
for age in map(int, input().split()):
buckets[age] += 1
for i, j in enumerate(bu... | while True:
num_items = int(input())
if num_items == 0:
break
buckets = [0 for i in range(101)]
for age in map(int, input().split()):
buckets[age] += 1
for (i, j) in enumerate(buckets):
if j > 0:
if num_items > j:
print(' '.join([str(i)] * j), end=... |
src =Split('''
aos/board.c
aos/board_cli.c
aos/st7789.c
aos/soc_init.c
Src/stm32l4xx_hal_msp.c
''')
component =aos_board_component('starterkit', 'stm32l4xx_cube', src)
if aos_global_config.compiler == "armcc":
component.add_sources('startup_stm32l433xx_keil.s')
elif aos_global_config... | src = split('\n aos/board.c\n aos/board_cli.c\n aos/st7789.c\n aos/soc_init.c\n Src/stm32l4xx_hal_msp.c\n')
component = aos_board_component('starterkit', 'stm32l4xx_cube', src)
if aos_global_config.compiler == 'armcc':
component.add_sources('startup_stm32l433xx_keil.s')
elif aos_global_config.compile... |
return_date = list(map(lambda x: int(x), input().split()))
due_date = list(map(lambda x: int(x), input().split()))
day = 0
month = 1
year = 2
if return_date[year] > due_date[year]:
fine = 10000
elif return_date[year] < due_date[year]:
fine = 0
elif return_date[month] > due_date[month]:
fine = 500 * (retur... | return_date = list(map(lambda x: int(x), input().split()))
due_date = list(map(lambda x: int(x), input().split()))
day = 0
month = 1
year = 2
if return_date[year] > due_date[year]:
fine = 10000
elif return_date[year] < due_date[year]:
fine = 0
elif return_date[month] > due_date[month]:
fine = 500 * (return_... |
#coding=utf-8
nombre = input("Dime tu nombre: ")
edad = int(input("dime tu edad wey: "))
nombre2 = input("dime tu nombre tambien wey: ")
edad2 = int(input("y tu edad es?... "))
if (edad>edad2):
print ("%s, eres mayor que %s" % (nombre , nombre2))
elif (edad<edad2):
print ("%s, eres mayor que %s" % (nombre2 , nomb... | nombre = input('Dime tu nombre: ')
edad = int(input('dime tu edad wey: '))
nombre2 = input('dime tu nombre tambien wey: ')
edad2 = int(input('y tu edad es?... '))
if edad > edad2:
print('%s, eres mayor que %s' % (nombre, nombre2))
elif edad < edad2:
print('%s, eres mayor que %s' % (nombre2, nombre))
else:
p... |
class SimpleAgg:
def __init__(self, query, size=0):
self.__size = size
self.__query = query
def build(self):
return {
"size": self.__size,
"query": {
"multi_match": {
"query": self.__query,
... | class Simpleagg:
def __init__(self, query, size=0):
self.__size = size
self.__query = query
def build(self):
return {'size': self.__size, 'query': {'multi_match': {'query': self.__query, 'analyzer': 'english_expander', 'fields': ['name.keyword']}}, 'aggs': {'categ_agg': {'terms': {'fie... |
'''
The purpose of this directory is to contain files used by multiple
platforms, but not by all. (In some cases GTK and Mac impls. can share code,
for example.)
'''
| """
The purpose of this directory is to contain files used by multiple
platforms, but not by all. (In some cases GTK and Mac impls. can share code,
for example.)
""" |
__all__ = [
"__name__",
"__version__",
"__author__",
"__author_email__",
"__description__",
"__license__"
]
__name__ = "python-fullcontact"
__version__ = "3.1.0"
__author__ = "FullContact"
__author_email__ = "pypy@fullcontact.com"
__description__ = "Client library for FullContact V3 Enrich and ... | __all__ = ['__name__', '__version__', '__author__', '__author_email__', '__description__', '__license__']
__name__ = 'python-fullcontact'
__version__ = '3.1.0'
__author__ = 'FullContact'
__author_email__ = 'pypy@fullcontact.com'
__description__ = 'Client library for FullContact V3 Enrich and Resolve APIs'
__license__ =... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def longestConsecutive(self, root: TreeNode) -> int:
ret = 0
def helper(node):
nonlocal ret
if n... | class Solution:
def longest_consecutive(self, root: TreeNode) -> int:
ret = 0
def helper(node):
nonlocal ret
if not node:
return (0, 0)
(ld, lu) = helper(node.left)
(rd, ru) = helper(node.right)
(curd, curu) = (1, 1)
... |
#!/usr/bin/env python
NAME = 'InfoGuard Airlock'
def is_waf(self):
# credit goes to W3AF
return self.matchcookie('^AL[_-]?(SESS|LB)=')
| name = 'InfoGuard Airlock'
def is_waf(self):
return self.matchcookie('^AL[_-]?(SESS|LB)=') |
def splitT(l):
l = l.split(" ")
for i,e in enumerate(l):
try:
val = int(e)
except ValueError:
val = e
l[i] = val
return l
def strToTupple(l):
return [tuple(splitT(e)) if len(tuple(splitT(e))) != 1 else splitT(e)[0] for e in l]
lines = strToTupple(lines)
sys.stderr.write(str(lines))
f = lines.pop(0)
... | def split_t(l):
l = l.split(' ')
for (i, e) in enumerate(l):
try:
val = int(e)
except ValueError:
val = e
l[i] = val
return l
def str_to_tupple(l):
return [tuple(split_t(e)) if len(tuple(split_t(e))) != 1 else split_t(e)[0] for e in l]
lines = str_to_tupp... |
def shell_sort(arr):
sublistcount = len(arr)/2
# While we still have sub lists
while sublistcount > 0:
for start in range(sublistcount):
# Use a gap insertion
gap_insertion_sort(arr,start,sublistcount)
sublistcount = sublistcount / 2
def ga... | def shell_sort(arr):
sublistcount = len(arr) / 2
while sublistcount > 0:
for start in range(sublistcount):
gap_insertion_sort(arr, start, sublistcount)
sublistcount = sublistcount / 2
def gap_insertion_sort(arr, start, gap):
for i in range(start + gap, len(arr), gap):
cu... |
def format_si(number, places=2):
number = float(number)
if number > 10**9:
return ("{0:.%sf} G" % places).format(number / 10**9)
if number > 10**6:
return ("{0:.%sf} M" % places).format(number / 10**6)
if number > 10**3:
return ("{0:.%sf} K" % places).format(number / 10**3)
... | def format_si(number, places=2):
number = float(number)
if number > 10 ** 9:
return ('{0:.%sf} G' % places).format(number / 10 ** 9)
if number > 10 ** 6:
return ('{0:.%sf} M' % places).format(number / 10 ** 6)
if number > 10 ** 3:
return ('{0:.%sf} K' % places).format(number / 10... |
def check_user(user, session_type=False):
frontend.page(
"dashboard",
expect={
"script_user": testing.expect.script_user(user)
})
if session_type is False:
if user.id is None:
# Anonymous user.
session_type = None
else:
ses... | def check_user(user, session_type=False):
frontend.page('dashboard', expect={'script_user': testing.expect.script_user(user)})
if session_type is False:
if user.id is None:
session_type = None
else:
session_type = 'normal'
frontend.json('sessions/current', params={'fi... |
class Solution:
# @param S, a list of integer
# @return a list of lists of integer
def subsets(self, S):
S.sort()
return self._subsets(S, len(S))
def _subsets(self, S, k):
if k == 0:
return [[]]
else:
res = [[]]
for i in range(len(S)):... | class Solution:
def subsets(self, S):
S.sort()
return self._subsets(S, len(S))
def _subsets(self, S, k):
if k == 0:
return [[]]
else:
res = [[]]
for i in range(len(S)):
rest_subsets = self._subsets(S[i + 1:], k - 1)
... |
def _exec_hook(hook_name, self):
if hasattr(self, hook_name):
getattr(self, hook_name)()
def hooks(fn):
def hooked(self):
fn_name = fn.func_name if hasattr(fn, 'func_name') else fn.__name__
_exec_hook('pre_' + fn_name, self)
val = fn(self)
_exec_hook('post_' + fn_name, ... | def _exec_hook(hook_name, self):
if hasattr(self, hook_name):
getattr(self, hook_name)()
def hooks(fn):
def hooked(self):
fn_name = fn.func_name if hasattr(fn, 'func_name') else fn.__name__
_exec_hook('pre_' + fn_name, self)
val = fn(self)
_exec_hook('post_' + fn_name, ... |
def print_formatted(number):
# your code goes here
for i in range(1, number + 1):
print('{0:>{w}d} {0:>{w}o} {0:>{w}X} {0:>{w}b}'.format(i, w=len(bin(number)) - 2))
if __name__ == '__main__':
n = int(input())
print_formatted(n)
| def print_formatted(number):
for i in range(1, number + 1):
print('{0:>{w}d} {0:>{w}o} {0:>{w}X} {0:>{w}b}'.format(i, w=len(bin(number)) - 2))
if __name__ == '__main__':
n = int(input())
print_formatted(n) |
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = ['./t.py']
base = '_base_.item8'
item11 = {{ _base_.item8 }}
item12 = {{ _base_.item9 }}
item13 = {{ _base_.item10 }}
item14 = {{ _base_.item1 }}
item15 = dict(
a = dict( b = {{ _base_.item2 }} ),
b = [{{ _base_.item3 }}],
c = [{{ _base_.item4 }}],
... | _base_ = ['./t.py']
base = '_base_.item8'
item11 = {{_base_.item8}}
item12 = {{_base_.item9}}
item13 = {{_base_.item10}}
item14 = {{_base_.item1}}
item15 = dict(a=dict(b={{_base_.item2}}), b=[{{_base_.item3}}], c=[{{_base_.item4}}], d=[[dict(e={{_base_.item5.a}})], {{_base_.item6}}], e={{_base_.item1}}) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def recursion(n):
if n == 1:
return 1
return n + recursion(n - 1)
if __name__ == '__main__':
n = int(input("Enter n: "))
summary = 0
for i in range(1, n + 1):
summary += i
print(f"Iterative sum: {summary}")
print(f"Recursion ... | def recursion(n):
if n == 1:
return 1
return n + recursion(n - 1)
if __name__ == '__main__':
n = int(input('Enter n: '))
summary = 0
for i in range(1, n + 1):
summary += i
print(f'Iterative sum: {summary}')
print(f'Recursion sum: {recursion(n)}') |
#
# PySNMP MIB module SVRSYS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SVRSYS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:04:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ... |
chemin = r'c:\temp\demo.txt'
fichier = open(chemin,'r')
ligne = fichier.readline()
while ligne:
print(ligne, end='')
ligne = fichier.readline()
fichier.close() | chemin = 'c:\\temp\\demo.txt'
fichier = open(chemin, 'r')
ligne = fichier.readline()
while ligne:
print(ligne, end='')
ligne = fichier.readline()
fichier.close() |
def index(r):
pass
def sum(r):
pass | def index(r):
pass
def sum(r):
pass |
class Planet:
def count_age(self, earth_years, planet):
if type(earth_years) is int and type(planet) is str:
if earth_years < 0:
raise Exception('Wiek nie moze byc ujemny')
stala = earth_years / 31557600
if planet == 'Ziemia':
return round(... | class Planet:
def count_age(self, earth_years, planet):
if type(earth_years) is int and type(planet) is str:
if earth_years < 0:
raise exception('Wiek nie moze byc ujemny')
stala = earth_years / 31557600
if planet == 'Ziemia':
return round... |
imports = ["base.py"]
train_option = {
"n_train_iteration": 6000,
"interval_iter": 2000,
}
train_artifact_dir = "artifacts/train"
evaluate_artifact_dir = "artifacts/evaluate"
reference = False
model = torch.nn.Sequential(
modules=collections.OrderedDict(
items=[
[
"encod... | imports = ['base.py']
train_option = {'n_train_iteration': 6000, 'interval_iter': 2000}
train_artifact_dir = 'artifacts/train'
evaluate_artifact_dir = 'artifacts/evaluate'
reference = False
model = torch.nn.Sequential(modules=collections.OrderedDict(items=[['encoder', torch.nn.Sequential(modules=collections.OrderedDict... |
# Copyright (c) 2010-2013 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | class Clientexception(Exception):
def __init__(self, msg, http_scheme='', http_host='', http_port='', http_path='', http_query='', http_status=0, http_reason='', http_device='', http_response_content=''):
Exception.__init__(self, msg)
self.msg = msg
self.http_scheme = http_scheme
se... |
class Solution:
def regionsBySlashes(self, grid: List[str]) -> int:
def dfs(i, j, k):
if 0 <= i < n > j >= 0 and not matrix[i][j][k]:
if grid[i][j] == "*":
if k <= 1:
matrix[i][j][0] = matrix[i][j][1] = cnt
dfs(i... | class Solution:
def regions_by_slashes(self, grid: List[str]) -> int:
def dfs(i, j, k):
if 0 <= i < n > j >= 0 and (not matrix[i][j][k]):
if grid[i][j] == '*':
if k <= 1:
matrix[i][j][0] = matrix[i][j][1] = cnt
... |
class SubroutineDeclaration:
def __init__(self, header, varrefs, body, function=False):
'''
@param header: a tuple of (name, arglist)
@param body: a tuple of (subroutine statements string, span in source file);
The span is a (startpos, endpos) tuple.
... | class Subroutinedeclaration:
def __init__(self, header, varrefs, body, function=False):
"""
@param header: a tuple of (name, arglist)
@param body: a tuple of (subroutine statements string, span in source file);
The span is a (startpos, endpos) tuple.
... |
class AccessDeniedException(Exception):
def __init__(self, message):
pass
# Call the base class constructor
# super().__init__(message, None)
# Now custom code
# self.errors = errors
class InvalidEndpointException(Exception):
def __init__(self, message):
self.m... | class Accessdeniedexception(Exception):
def __init__(self, message):
pass
class Invalidendpointexception(Exception):
def __init__(self, message):
self.message = message
class Bucketmightnotexistexception(Exception):
def __init__(self):
pass |
def includeme(config):
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('login', '/login')
config.add_route('launchpad', '/launchpad')
config.add_route('request_rx', '/request_rx')
config.add_route('rx_portal', '/rx_portal')
config... | def includeme(config):
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('login', '/login')
config.add_route('launchpad', '/launchpad')
config.add_route('request_rx', '/request_rx')
config.add_route('rx_portal', '/rx_portal')
config... |
class DocumentTemplate:
def __init__(self):
pass
@staticmethod
def create_db_template(server, db_id, label, **kwargs):
db_url = "{}{}".format(server, db_id)
comment = kwargs.get("comment")
language = kwargs.get("language", "en")
allow_origin = kwargs.get("allow_origi... | class Documenttemplate:
def __init__(self):
pass
@staticmethod
def create_db_template(server, db_id, label, **kwargs):
db_url = '{}{}'.format(server, db_id)
comment = kwargs.get('comment')
language = kwargs.get('language', 'en')
allow_origin = kwargs.get('allow_orig... |
numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
#using list comprehension to make square of given numbers in list
squared_numbers=[ n * n for n in numbers]
print(squared_numbers) | numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
squared_numbers = [n * n for n in numbers]
print(squared_numbers) |
class NothingToProcess(ValueError):
pass
class FileAlreadyProcessed(ValueError):
pass
| class Nothingtoprocess(ValueError):
pass
class Filealreadyprocessed(ValueError):
pass |
# kpbochenek@gmail.com
def most_difference(*args):
if not args:
return 0
mn = min(args)
mx = max(args)
return mx - mn
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
def almost_equal(checked, correct, significant_digits):
... | def most_difference(*args):
if not args:
return 0
mn = min(args)
mx = max(args)
return mx - mn
if __name__ == '__main__':
def almost_equal(checked, correct, significant_digits):
precision = 0.1 ** significant_digits
return correct - precision < checked < correct + precision
... |
scope_configuration = dict(
drivers = ( # order is important!
('stand', 'leica.stand.Stand'),
('stage', 'leica.stage.Stage'),
#('nosepiece', 'leica.nosepiece.MotorizedNosepieceWithSafeMode'), # dm6000
#('nosepiece', 'leica.nosepiece.MotorizedNosepiece'), # dmi8
#('nosepiece',... | scope_configuration = dict(drivers=(('stand', 'leica.stand.Stand'), ('stage', 'leica.stage.Stage'), ('iotool', 'iotool.IOTool'), ('tl.lamp', 'tl_lamp.SutterLED_Lamp'), ('camera.acquisition_sequencer', 'acquisition_sequencer.AcquisitionSequencer'), ('camera.autofocus', 'autofocus.Autofocus'), ('job_runner', 'runner_devi... |
a = set(input().split())
n = int(input())
for _ in range(n):
b = set(input().split())
if not a.issuperset(b):
print(False)
break
else:
print(True)
| a = set(input().split())
n = int(input())
for _ in range(n):
b = set(input().split())
if not a.issuperset(b):
print(False)
break
else:
print(True) |
def move(disks, source, auxiliary, target):
if disks > 0:
# move `N-1` discs from source to auxiliary using the target
# as an intermediate pole
move(disks - 1, source, target, auxiliary)
print("Move disk {} from {} to {}".format(disks, source, target))
# move `N-1` discs f... | def move(disks, source, auxiliary, target):
if disks > 0:
move(disks - 1, source, target, auxiliary)
print('Move disk {} from {} to {}'.format(disks, source, target))
move(disks - 1, auxiliary, source, target)
if __name__ == '__main__':
n = 3
move(N, 1, 2, 3) |
# Runners group
runners = ['harry', 'ron', 'harmoine']
our_group = ['mukul']
while runners:
athlete = runners.pop()
print("Adding user: " + athlete.title())
our_group.append(athlete)
print("That's our group:- ")
for our_group in our_group:
print(our_group.title() + " from harry potter!")
Dream_vacatio... | runners = ['harry', 'ron', 'harmoine']
our_group = ['mukul']
while runners:
athlete = runners.pop()
print('Adding user: ' + athlete.title())
our_group.append(athlete)
print("That's our group:- ")
for our_group in our_group:
print(our_group.title() + ' from harry potter!')
dream_vacation = {}
polling_act... |
n = int(input(" "))
S = 0
a = list(map(int,input(" ").split()))
#A massiv
for i in range(-n,0):
S+=a[i]
for i in range(-n,0):
if a[i] <= S/n:
print(" ",a[i])
| n = int(input(' '))
s = 0
a = list(map(int, input(' ').split()))
for i in range(-n, 0):
s += a[i]
for i in range(-n, 0):
if a[i] <= S / n:
print(' ', a[i]) |
class User:
'''
User class for user input
'''
user_list = [] # User Empty list
def __init__(self, username, password):
self.username = username
self.password = password
def save_user(self):
'''
save_usermethod saves user objects into user_list
'''... | class User:
"""
User class for user input
"""
user_list = []
def __init__(self, username, password):
self.username = username
self.password = password
def save_user(self):
"""
save_usermethod saves user objects into user_list
"""
User.user_list.... |
#==================== Engine ====================
def run(code):
state = EngineState()
while True:
ip = state.ip
if ip >= len(code): break
state.ip = ip + 1
(fun,arg) = code[ip]
fun(state, arg)
class EngineState:
def __init__(self):
self.ip = 0
self.g... | def run(code):
state = engine_state()
while True:
ip = state.ip
if ip >= len(code):
break
state.ip = ip + 1
(fun, arg) = code[ip]
fun(state, arg)
class Enginestate:
def __init__(self):
self.ip = 0
self.gctx = []
self.lctx = []
... |
# GET /app/hello_world
print("hello world!")
| print('hello world!') |
class Solution(object):
def combinationSum(self, candidates, target):
return self.helper(candidates, target, [], set())
def helper(self, arr, target, comb, result):
for num in arr:
if target - num == 0:
result.add(tuple(sorted(comb[:] + [num])))
elif ... | class Solution(object):
def combination_sum(self, candidates, target):
return self.helper(candidates, target, [], set())
def helper(self, arr, target, comb, result):
for num in arr:
if target - num == 0:
result.add(tuple(sorted(comb[:] + [num])))
elif ta... |
# Consider a list (list = []).
# You can perform the following commands:
# insert i e: Insert integer 'e' at position 'i'.
# print: Print the list.
# remove e: Delete the first occurrence of integer .
# append e: Insert integer at the end of the list.
# sort: Sort the list.
# pop: Pop the last... | if __name__ == '__main__':
n = int(input())
my_list = []
for _ in range(0, N):
command = input()
command_parts = command.split()
key_word = command_parts[0]
if key_word == 'insert':
index = int(command_parts[1])
value = int(command_parts[2])
... |
n = int(input())
arr = input().split()
for i in range(0,len(arr)):
arr[i] = int(arr[i])
count = 0
Max = max(arr)
for i in range(0,len(arr)):
if(arr[i]==Max):
count +=1
print(str(count))
| n = int(input())
arr = input().split()
for i in range(0, len(arr)):
arr[i] = int(arr[i])
count = 0
max = max(arr)
for i in range(0, len(arr)):
if arr[i] == Max:
count += 1
print(str(count)) |
def alphabet_position(character):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
lower = character.lower()
return alphabet.index(lower)
def rotate_string_13(text):
rotated = ''
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for char in text:
rotated_idx = (alphabet_position(char) + 13) % 26
... | def alphabet_position(character):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
lower = character.lower()
return alphabet.index(lower)
def rotate_string_13(text):
rotated = ''
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for char in text:
rotated_idx = (alphabet_position(char) + 13) % 26
i... |
description = 'Additional rotation table'
group = 'optional'
tango_base = 'tango://motorbox05.stressi.frm2.tum.de:10000/box/'
devices = dict(
addphi_m = device('nicos.devices.entangle.Motor',
tangodevice = tango_base + 'channel4/motor',
fmtstr = '%.2f',
visibility = (),
speed = 4,... | description = 'Additional rotation table'
group = 'optional'
tango_base = 'tango://motorbox05.stressi.frm2.tum.de:10000/box/'
devices = dict(addphi_m=device('nicos.devices.entangle.Motor', tangodevice=tango_base + 'channel4/motor', fmtstr='%.2f', visibility=(), speed=4), addphi=device('nicos.devices.generic.Axis', desc... |
NEW2OLD = {'AD': 'ADCY8', 'DP': 'DPYS', 'GA': 'GARL1', 'HA9': 'HOXA9',
'GR': 'GRM6', 'H12': 'HOXD12', 'HD9': 'HOXD9', 'PR': 'PRAC',
'PT': 'PTGDR', 'SA': 'SALL3', 'SI': 'SIX6', 'SL': 'SLC6A2',
'TL': 'TLX3', 'TR': 'TRIM58', 'ZF': 'ZFP41'}
OLD2NEW = {NEW2OLD[i]: i for i in NEW2OLD.keys() i... | new2_old = {'AD': 'ADCY8', 'DP': 'DPYS', 'GA': 'GARL1', 'HA9': 'HOXA9', 'GR': 'GRM6', 'H12': 'HOXD12', 'HD9': 'HOXD9', 'PR': 'PRAC', 'PT': 'PTGDR', 'SA': 'SALL3', 'SI': 'SIX6', 'SL': 'SLC6A2', 'TL': 'TLX3', 'TR': 'TRIM58', 'ZF': 'ZFP41'}
old2_new = {NEW2OLD[i]: i for i in NEW2OLD.keys() if NEW2OLD[i] is not None}
def ... |
# Single Responsibility Principle (SRP) or Separation Of Concerns (SOC)
class Journal():
def __init__(self):
self.entries = []
self.count = 0
def add_entry(self, text):
self.count += 1
self.entries.append(f'{self.count}: {text}')
def remove_entry(self, index):
... | class Journal:
def __init__(self):
self.entries = []
self.count = 0
def add_entry(self, text):
self.count += 1
self.entries.append(f'{self.count}: {text}')
def remove_entry(self, index):
self.count -= 1
self.entries.pop(index)
def __str__(self):
... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
# Override to dynamically link the cras (ChromeOS audio) library.
'use_cras%': 0,
# Option e.g. fo... | {'variables': {'chromium_code': 1, 'use_cras%': 0, 'linux_link_pulseaudio%': 0, 'conditions': [['OS == "android" or OS == "ios"', {'media_use_ffmpeg%': 0, 'media_use_libvpx%': 0}, {'media_use_ffmpeg%': 1, 'media_use_libvpx%': 1}], ['OS=="win" or OS=="mac" or (OS=="linux" and use_x11==1)', {'screen_capture_supported%': ... |
def replaceSlice(string, l_index, r_index, replaceable):
string = string[0:l_index] + string[r_index - 1:]
string = string[0:l_index] + replaceable + string[r_index:]
return string
def correctSpaces(expression):
return expression.replace(" ", "")
def replaceAlternateOperationSigns(expression):
r... | def replace_slice(string, l_index, r_index, replaceable):
string = string[0:l_index] + string[r_index - 1:]
string = string[0:l_index] + replaceable + string[r_index:]
return string
def correct_spaces(expression):
return expression.replace(' ', '')
def replace_alternate_operation_signs(expression):
... |
def changeFeather(value):
for s in nuke.selectedNodes():
selNode = nuke.selectedNode()
if s.Class() == "Roto" or s.Class() == "RotoPaint":
for item in s['curves'].rootLayer:
attr = item.getAttributes()
attr.set('ff',value)
feather_value = 0
changeFeathe... | def change_feather(value):
for s in nuke.selectedNodes():
sel_node = nuke.selectedNode()
if s.Class() == 'Roto' or s.Class() == 'RotoPaint':
for item in s['curves'].rootLayer:
attr = item.getAttributes()
attr.set('ff', value)
feather_value = 0
change_feath... |
def mongoify(doc):
if 'id' in doc:
doc['_id'] = doc['id']
del doc['id']
return doc
def demongoify(doc):
if "_id" in doc:
doc['id'] = doc['_id']
del doc['_id']
return doc
| def mongoify(doc):
if 'id' in doc:
doc['_id'] = doc['id']
del doc['id']
return doc
def demongoify(doc):
if '_id' in doc:
doc['id'] = doc['_id']
del doc['_id']
return doc |
def main() -> None:
# fermat's little theorem
n, k, m = map(int, input().split())
# m^(k^n)
MOD = 998_244_353
m %= MOD
print(pow(m, pow(k, n, MOD - 1), MOD))
if __name__ == "__main__":
main()
| def main() -> None:
(n, k, m) = map(int, input().split())
mod = 998244353
m %= MOD
print(pow(m, pow(k, n, MOD - 1), MOD))
if __name__ == '__main__':
main() |
class Solution:
def reversePrefix(self, word: str, ch: str) -> str:
try:
idx = word.index(ch) + 1
except Exception:
return word
return ''.join(word[:idx][::-1] + word[idx:]) | class Solution:
def reverse_prefix(self, word: str, ch: str) -> str:
try:
idx = word.index(ch) + 1
except Exception:
return word
return ''.join(word[:idx][::-1] + word[idx:]) |
rest_days = int(input())
year_in_days = 365
work_days = year_in_days - rest_days
play_time = (work_days * 63 + rest_days * 127)
if play_time <= 30000:
play_time1 = 30000 - play_time
else:
play_time1 = play_time - 30000
hours = play_time1 // 60
minutes = play_time1 % 60
if play_time > 30000:
print(f"Tom w... | rest_days = int(input())
year_in_days = 365
work_days = year_in_days - rest_days
play_time = work_days * 63 + rest_days * 127
if play_time <= 30000:
play_time1 = 30000 - play_time
else:
play_time1 = play_time - 30000
hours = play_time1 // 60
minutes = play_time1 % 60
if play_time > 30000:
print(f'Tom will r... |
# -*- coding: utf-8 -*-
__author__ = 'guti'
'''
Default configurations for the Web application.
'''
configs = {
'db': {
'host': '127.0.0.1',
'port': 5432,
'user': 'test_usr',
'password': 'test_pw',
'database': 'test_db'
},
'session': {
'secret': '0IH9c71HS86... | __author__ = 'guti'
'\nDefault configurations for the Web application.\n'
configs = {'db': {'host': '127.0.0.1', 'port': 5432, 'user': 'test_usr', 'password': 'test_pw', 'database': 'test_db'}, 'session': {'secret': '0IH9c71HS86KSnqmQFAbBiwnEUqMYEo9vAQFb+DA9Ns='}} |
class UnetOptions:
def __init__(self):
self.in_channels=1
self.n_classes=2
self.depth=5
self.wf=6
self.padding=False
self.up_mode='upconv'
self.batch_norm=True
self.non_neg = True
self.pose_predict_mode = False
self.pretrained_mode =... | class Unetoptions:
def __init__(self):
self.in_channels = 1
self.n_classes = 2
self.depth = 5
self.wf = 6
self.padding = False
self.up_mode = 'upconv'
self.batch_norm = True
self.non_neg = True
self.pose_predict_mode = False
self.pretr... |
# Python - 2.7.6
def find_next_square(sq):
num = int(sq ** 0.5)
return (num + 1) ** 2 if (num ** 2) == sq else -1
| def find_next_square(sq):
num = int(sq ** 0.5)
return (num + 1) ** 2 if num ** 2 == sq else -1 |
# value of A represent its position in C
# value of C represent its position in B
def count_sort(A, k):
B = [0 for i in range(len(A))]
C = [0 for i in range(k)]
# count the frequency of each elements in A and save them in the coresponding position in B
for i in range(0, len(A)):
C[A[i] - 1] +=... | def count_sort(A, k):
b = [0 for i in range(len(A))]
c = [0 for i in range(k)]
for i in range(0, len(A)):
C[A[i] - 1] += 1
for i in range(1, k, 1):
C[i] = C[i - 1] + C[i]
for i in range(len(A) - 1, -1, -1):
B[C[A[i] - 1] - 1] = A[i]
C[A[i] - 1] -= 1
return B
b = c... |
class Params:
# -------------------------------
# GENERAL
# -------------------------------
gpu_ewc = '4' # GPU number
gpu_rewc = '3' # GPU number
data_size = 224 # Data size
batch_size = 32 # Batch size
nb_cl = 50 # Classes ... | class Params:
gpu_ewc = '4'
gpu_rewc = '3'
data_size = 224
batch_size = 32
nb_cl = 50
nb_groups = 4
nb_val = 0
epochs = 50
num_samples = 5
lr_init = 0.001
lr_strat = [40, 80]
lr_factor = 5.0
wght_decay = 1e-05
ratio = 100.0
eval_single = True
save_path = '... |
place_needed = int(input().split()[1])
scores = [j for j in reversed(sorted([int(i) for i in input().split() if int(i) > 0]))]
try:
score_needed = scores[place_needed - 1]
except IndexError:
score_needed = 0
amount = 0
for i in scores:
if i >= score_needed:
amount += 1
print(amount)
| place_needed = int(input().split()[1])
scores = [j for j in reversed(sorted([int(i) for i in input().split() if int(i) > 0]))]
try:
score_needed = scores[place_needed - 1]
except IndexError:
score_needed = 0
amount = 0
for i in scores:
if i >= score_needed:
amount += 1
print(amount) |
# List aa images with query stringa available
def list_all_images_subparser(subparser):
list_all_images = subparser.add_parser(
'list-all-images',
description=('***List all'
... | def list_all_images_subparser(subparser):
list_all_images = subparser.add_parser('list-all-images', description='***List all images of producers/consumers account', help='List all images of producers/consumers account')
group_key = list_all_images.add_mutually_exclusive_group(required=True)
group_key.add_ar... |
# No good name, sorry, lol :)
def combinations(list, k):
return 0
print( combinations([1, 2, 3, 4], 3) ) | def combinations(list, k):
return 0
print(combinations([1, 2, 3, 4], 3)) |
#Find the difference between the sum of the squares of the first one hundred natural numbers
# and the square of the sum.
#Generating a list with natural numbers 1-100.
nums = list(range(101))
#print(nums)
#Find the square of the sum (1+...+100).
# The following is old code: (that does work.)
#LIST = nums
... | nums = list(range(101))
list = list(range(101))
def tri_num(n):
n = int(n)
sum = n * (n + 1)
sum = sum / 2
sum = int(sum)
return sum
a = tri_num(100)
print(a)
print(a * a)
def tri_num_sqrd(n):
n = int(n)
sum = n * (n + 1) * (2 * n + 1)
sum = sum / 6
sum = int(sum)
return sum
b ... |
class Message:
# type id_message id_device timestamp
type = 'default'
id = 0
source_id = 0
source_timestamp = 0
payload = bytearray(0)
def __init__(self, type, id, source_id, source_timestamp, payload):
self.type = type
self.id = id
self.source_id = source_id
... | class Message:
type = 'default'
id = 0
source_id = 0
source_timestamp = 0
payload = bytearray(0)
def __init__(self, type, id, source_id, source_timestamp, payload):
self.type = type
self.id = id
self.source_id = source_id
self.source_timestamp
self.payloa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.