content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# This file is part of the dune-gdt project:
# https://github.com/dune-community/dune-gdt
# Copyright 2010-2017 dune-gdt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (http://opensource.org/licenses/... | class Grids(object):
def __init__(self, cache):
try:
have_alugrid = cache['dune-alugrid']
except KeyError:
have_alugrid = False
self.all_parts_fmt = [self.alu_conf_part_fmt, self.alu_cube_part_fmt, self.yasp_part_fmt] if have_alugrid else [self.yasp_part_fmt]
... |
# BASE
URL = "http://download.geofabrik.de/"
suffix = "-latest.osm.pbf"
africa_url = "africa/"
asia_url = "asia/"
australia_oceania_url = "australia-oceania/"
central_america_url = "central-america/"
europe_url = "europe/"
north_america_url = "north-america/"
south_america_url = "south-america/"
baden_wuerttemberg_url... | url = 'http://download.geofabrik.de/'
suffix = '-latest.osm.pbf'
africa_url = 'africa/'
asia_url = 'asia/'
australia_oceania_url = 'australia-oceania/'
central_america_url = 'central-america/'
europe_url = 'europe/'
north_america_url = 'north-america/'
south_america_url = 'south-america/'
baden_wuerttemberg_url = 'euro... |
t=int(input())
for sss in range(t):
sum=0
n,k=map(int,input().split())
a=[0]*(n+1)
for i in range(1,n+1):
if k==0 or k==n:
break
if (sum+1<=i+1 and k>0):
a[i]=i
sum+=i
i+=1
k-=1
continue
if sum>... | t = int(input())
for sss in range(t):
sum = 0
(n, k) = map(int, input().split())
a = [0] * (n + 1)
for i in range(1, n + 1):
if k == 0 or k == n:
break
if sum + 1 <= i + 1 and k > 0:
a[i] = i
sum += i
i += 1
k -= 1
c... |
#!/usr/bin/env python
# md5: 30abdfb918f7a6b87bd580600c506058
# coding: utf-8
databasename = 'ml-004_clickstream_video.sqlite'
def getDatabaseName():
return databasename
| databasename = 'ml-004_clickstream_video.sqlite'
def get_database_name():
return databasename |
class Proxy(object):
response_type = "proxy"
def __init__(self, url, client_certificate=None, client_key=None):
self.url = url
self.certificate = client_certificate
self.key = client_key
def as_dict(self):
proxy = {
'to': self.url
}
... | class Proxy(object):
response_type = 'proxy'
def __init__(self, url, client_certificate=None, client_key=None):
self.url = url
self.certificate = client_certificate
self.key = client_key
def as_dict(self):
proxy = {'to': self.url}
if self.certificate:
pr... |
'''Defines the `JavaCompilationInfo` provider.
'''
JavaCompilationInfo = provider(
doc = "Describes the inputs, outputs, and options of a Java compiler invocation for a particular Java target.",
fields = {
"srcs": "A depset of the Java source `File`s directly included in a Java target. (This does not i... | """Defines the `JavaCompilationInfo` provider.
"""
java_compilation_info = provider(doc='Describes the inputs, outputs, and options of a Java compiler invocation for a particular Java target.', fields={'srcs': 'A depset of the Java source `File`s directly included in a Java target. (This does not include either generat... |
def agent_settings(arglist, agent_name):
if agent_name[-1] == "1": return arglist.model1
elif agent_name[-1] == "2": return arglist.model2
elif agent_name[-1] == "3": return arglist.model3
elif agent_name[-1] == "4": return arglist.model4
else: raise ValueError("Agent name doesn't follow the right ... | def agent_settings(arglist, agent_name):
if agent_name[-1] == '1':
return arglist.model1
elif agent_name[-1] == '2':
return arglist.model2
elif agent_name[-1] == '3':
return arglist.model3
elif agent_name[-1] == '4':
return arglist.model4
else:
raise value_err... |
# cp857_7x7.py - CP857 7x7 font file for Python
#
# Copyright (c) 2019-2022 Ercan Ersoy
# This file is written by Ercan Ersoy.
# This file is licensed under CC0-1.0 Universal License.
cp857_7x7 = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x03... | cp857_7x7 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 3, 0, 3, 0, 0, 20, 20, 127, 20, 127, 20, 20, 4, 42, 42, 127, 42, 42, 16, 67, 35, 16, 8, 4, 98, 97, 48, 74, 69, 42, 16, 40, 64, 0, 0, 4, 3, 0, 0, 0, 0, 0, 62, 65, 0, 0, 0, 0, 0, 0, 65, 62, 0, 0, 0, 0, 10, 7, 10, 0, 0, 0, 8, 8, 62, 8, 8, 0, 0, 0, 64, 48, 0, 0,... |
config = {
'bot': {
'username': "", # Robinhood credentials. If you don't want to keep them stored here, launch "./2fa.py" to setup the access token interactively
'password': "",
'trades_enabled': False, # if False, just collect data
'simulate_api_calls': False, # if enabled, just pr... | config = {'bot': {'username': '', 'password': '', 'trades_enabled': False, 'simulate_api_calls': False, 'data_source': 'robinhood', 'minutes_between_updates': 5, 'cancel_pending_after_minutes': 20, 'save_charts': True, 'max_data_rows': 2000}, 'ticker_list': {'XETHZUSD': 'ETH'}, 'trade_signals': {'buy': {'function': 'em... |
class DeprecatedLogger(object):
def __init__(self):
print(
"Deprecated logger, please use 'from puts import get_logger; logger = get_logger();' instead"
)
def debug(self, msg):
print(msg)
def info(self, msg):
print(msg)
def warning(self, msg):
print... | class Deprecatedlogger(object):
def __init__(self):
print("Deprecated logger, please use 'from puts import get_logger; logger = get_logger();' instead")
def debug(self, msg):
print(msg)
def info(self, msg):
print(msg)
def warning(self, msg):
print(msg)
def error(... |
def run_functions(proteins, species):
interactions = GetSTRINGInteractions()
IDs_df = interactions.map_identifiers_string(list(proteins.values()), species)
if IDs_df.empty: return
IDs = IDs_df.values.flatten()
known_interactions = interactions.get_interactions(IDs, species)
known_interactions['Original geneID_... | def run_functions(proteins, species):
interactions = get_string_interactions()
i_ds_df = interactions.map_identifiers_string(list(proteins.values()), species)
if IDs_df.empty:
return
i_ds = IDs_df.values.flatten()
known_interactions = interactions.get_interactions(IDs, species)
known_int... |
# https://www.codingame.com/training/easy/detective-pikaptcha-ep1
def get_neighbors(row, col, grid):
if row > 0: yield row - 1, col
if row < len(grid) - 1: yield row + 1, col
if col > 0: yield row, col - 1
if col < len(grid[row]) - 1: yield row, col + 1
def solution():
width, height = [int(i) fo... | def get_neighbors(row, col, grid):
if row > 0:
yield (row - 1, col)
if row < len(grid) - 1:
yield (row + 1, col)
if col > 0:
yield (row, col - 1)
if col < len(grid[row]) - 1:
yield (row, col + 1)
def solution():
(width, height) = [int(i) for i in input().split()]
... |
def parse_commands(lines):
commands = []
for l in lines:
c, offset = l.split()
commands.append([c, int(offset)])
return commands
def run_command(command, idx, acc):
c, offset = command
if c == 'acc':
acc += offset
idx += 1
elif c == 'jmp':
idx += offset
... | def parse_commands(lines):
commands = []
for l in lines:
(c, offset) = l.split()
commands.append([c, int(offset)])
return commands
def run_command(command, idx, acc):
(c, offset) = command
if c == 'acc':
acc += offset
idx += 1
elif c == 'jmp':
idx += offs... |
languages = ["Python", "Perl", "Ruby", "Go", "Java", "C"]
lengths = [len(language) for language in languages]
print(lengths)
z = [x for x in range(0,101) if x%3 ==0]
print(z)
| languages = ['Python', 'Perl', 'Ruby', 'Go', 'Java', 'C']
lengths = [len(language) for language in languages]
print(lengths)
z = [x for x in range(0, 101) if x % 3 == 0]
print(z) |
class RGB:
def __init__(self, r: int, g: int, b: int):
self.r = r
self.g = g
self.b = b | class Rgb:
def __init__(self, r: int, g: int, b: int):
self.r = r
self.g = g
self.b = b |
N = int(input())
if N % 2 == 0:
print(N)
else:
print(2 * N)
| n = int(input())
if N % 2 == 0:
print(N)
else:
print(2 * N) |
# Class which represents the university object and its data
class University:
def __init__(self, world_rank, name, national_rank, education_quality, alumni_employment, faculty_quality,
publications, influence, citations, impact, patents, aggregate_rank):
self.id = world_rank
self.... | class University:
def __init__(self, world_rank, name, national_rank, education_quality, alumni_employment, faculty_quality, publications, influence, citations, impact, patents, aggregate_rank):
self.id = world_rank
self.name = name
self.national_rank = national_rank
self.education_... |
'''
Since 1926, the Belmont Stakes is a 1.5 mile-long race of 3-year old thoroughbred horses. Secretariat ran the fastest Belmont Stakes in history in 1973. While that was the fastest year, 1970 was the slowest because of unusually wet and sloppy conditions. With these two outliers removed from the data set, compute th... | """
Since 1926, the Belmont Stakes is a 1.5 mile-long race of 3-year old thoroughbred horses. Secretariat ran the fastest Belmont Stakes in history in 1973. While that was the fastest year, 1970 was the slowest because of unusually wet and sloppy conditions. With these two outliers removed from the data set, compute th... |
#if else can be done as
a=int(input())
b=int(input())
c=a%2
if a>b:
print("{} is greater than {}".format(a,b))
elif a==b:
print("{} and {} are equal".format(a,b))
else:
print("{} is greater than {}".format(b,a))
#if can be done in single line as
if a>b: print("{} is greater".format(a))
print("{} is even"... | a = int(input())
b = int(input())
c = a % 2
if a > b:
print('{} is greater than {}'.format(a, b))
elif a == b:
print('{} and {} are equal'.format(a, b))
else:
print('{} is greater than {}'.format(b, a))
if a > b:
print('{} is greater'.format(a))
print('{} is even'.format(a)) if c == 0 else print('{} is ... |
# Reading first input, not used anywhere in the program
first_input = input()
# Reading the input->split->parse to int->elements to set
set1 = set(map(int, input().split()))
# Same as second_input
second_input = input()
# Same as set2
set2 = set(map(int, input().split()))
# Union of set1 and set2 returns the set of all... | first_input = input()
set1 = set(map(int, input().split()))
second_input = input()
set2 = set(map(int, input().split()))
set3 = set1.union(set2)
print(len(set3)) |
self.description = "Remove a no longer needed package (multiple provision)"
lp1 = pmpkg("pkg1")
lp1.provides = ["imaginary"]
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2")
lp2.provides = ["imaginary"]
self.addpkg2db("local", lp2)
lp3 = pmpkg("pkg3")
lp3.depends = ["imaginary"]
self.addpkg2db("local", lp3)
self.ar... | self.description = 'Remove a no longer needed package (multiple provision)'
lp1 = pmpkg('pkg1')
lp1.provides = ['imaginary']
self.addpkg2db('local', lp1)
lp2 = pmpkg('pkg2')
lp2.provides = ['imaginary']
self.addpkg2db('local', lp2)
lp3 = pmpkg('pkg3')
lp3.depends = ['imaginary']
self.addpkg2db('local', lp3)
self.args =... |
def multiple(first,second):
return first * second * 3
def add(x,y):
return x+y
| def multiple(first, second):
return first * second * 3
def add(x, y):
return x + y |
config = {
'max_length' : 512,
'class_names' : ['O', 'B-C', 'B-P', 'I-C', 'I-P'],
'ft_data_folders' : ['/content/change-my-view-modes/v2.0/data/'],
'max_tree_size' : 10,
'max_labelled_users_per_tree':10,
'batch_size' : 4,
'd_model': 512,
'init_alphas': [0.0, 0.0, 0.0, -10000., -1000... | config = {'max_length': 512, 'class_names': ['O', 'B-C', 'B-P', 'I-C', 'I-P'], 'ft_data_folders': ['/content/change-my-view-modes/v2.0/data/'], 'max_tree_size': 10, 'max_labelled_users_per_tree': 10, 'batch_size': 4, 'd_model': 512, 'init_alphas': [0.0, 0.0, 0.0, -10000.0, -10000.0], 'transition_init': [[0.01, -10000.0... |
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "commons_lang_commons_lang",
artifact = "commons-lang:commons-lang:2.6",
jar_sha256 = "50f11b09f877c294d56f24463f47d28f929cf5044f648661c0f0cfbae9a2f49c",
srcja... | load('//:import_external.bzl', import_external='safe_wix_scala_maven_import_external')
def dependencies():
import_external(name='commons_lang_commons_lang', artifact='commons-lang:commons-lang:2.6', jar_sha256='50f11b09f877c294d56f24463f47d28f929cf5044f648661c0f0cfbae9a2f49c', srcjar_sha256='66c2760945cec226f26286... |
## Class responsible for representing a Sonobouy within Hunting the Plark
class Sonobuoy():
def __init__(self, active_range):
self.type = "SONOBUOY"
self.col = None
self.row = None
self.range = active_range
self.state = "COLD"
self.size = 1
## Setstate allows the change of state which will happen when... | class Sonobuoy:
def __init__(self, active_range):
self.type = 'SONOBUOY'
self.col = None
self.row = None
self.range = active_range
self.state = 'COLD'
self.size = 1
def set_state(self, state):
self.state = state
def get_state(self):
return s... |
def clamp(a, b):
if (b < 0 and a >= b) or (b > 0 and a <= b):
return a
def field(a, b, then):
val = clamp(a, b)
if val is not None:
return round(then(val), 3)
def sign_and_magnitude(intg, fract):
if fract > 100:
return None
val = (intg & 0x7F) + fract * 0.01
if int... | def clamp(a, b):
if b < 0 and a >= b or (b > 0 and a <= b):
return a
def field(a, b, then):
val = clamp(a, b)
if val is not None:
return round(then(val), 3)
def sign_and_magnitude(intg, fract):
if fract > 100:
return None
val = (intg & 127) + fract * 0.01
if intg & 128 ... |
def countfreq(input):
freq={}
for i in input:
freq[i]=input.count(i)
for key,value in freq.items():
print("%d:%d"%(key,value))
input=[1, 1, 1, 5, 5, 3, 1, 3, 3, 1, 4, 4, 4, 2, 2, 2, 2]
countfreq(input)
| def countfreq(input):
freq = {}
for i in input:
freq[i] = input.count(i)
for (key, value) in freq.items():
print('%d:%d' % (key, value))
input = [1, 1, 1, 5, 5, 3, 1, 3, 3, 1, 4, 4, 4, 2, 2, 2, 2]
countfreq(input) |
#
# @lc app=leetcode.cn id=66 lang=python3
#
# [66] plus-one
#
None
# @lc code=end | None |
for i in range(1,5):
for j in range(i,5):
print(j," " ,end="")
print()
str1 = "ABCD"
str2 = "PQR"
for i in range(4):
print(str1[:i+1]+str2[i:]) | for i in range(1, 5):
for j in range(i, 5):
print(j, ' ', end='')
print()
str1 = 'ABCD'
str2 = 'PQR'
for i in range(4):
print(str1[:i + 1] + str2[i:]) |
def new(a,b):
return a - b
def x(a,b):
return a
def y(z,t):
return z(*t)
def inModule2(a,b):
return a+b
def outerMethod(a,b):
def innerMethod(a,b):
if a < b:
return a+b
else:
return a-b
return innerMethod(a+2, b+4)
| def new(a, b):
return a - b
def x(a, b):
return a
def y(z, t):
return z(*t)
def in_module2(a, b):
return a + b
def outer_method(a, b):
def inner_method(a, b):
if a < b:
return a + b
else:
return a - b
return inner_method(a + 2, b + 4) |
# This function takes a single parameter and prints it.
def print_value(x):
print(x)
print_value(12)
print_value("dog") | def print_value(x):
print(x)
print_value(12)
print_value('dog') |
__version__ = '1.3.0'
__url__ = 'https://github.com/mdawar/rq-exporter'
__description__ = 'Prometheus exporter for Python RQ (Redis Queue)'
__author__ = 'Pierre Mdawar'
__author_email__ = 'pierre@mdawar.dev'
__license__ = 'MIT'
| __version__ = '1.3.0'
__url__ = 'https://github.com/mdawar/rq-exporter'
__description__ = 'Prometheus exporter for Python RQ (Redis Queue)'
__author__ = 'Pierre Mdawar'
__author_email__ = 'pierre@mdawar.dev'
__license__ = 'MIT' |
# All possible values that should be constant through the entire script
ERR_CODE_NON_EXISTING_FILE = 404
ERR_CODE_CREATING_XML = 406
ERR_CODE_COMMAND_LINE_ARGS = 407
ERR_CODE_NON_EXISTING_DIRECTORY = 408
ERR_CODE_NON_EXISTING_W_E = 409
WARNING_CODE_INVALID_FORMAT = 405
WARNING_CODE_NO_PAIR_FOUND = 406
WARNING_NOT_A_... | err_code_non_existing_file = 404
err_code_creating_xml = 406
err_code_command_line_args = 407
err_code_non_existing_directory = 408
err_code_non_existing_w_e = 409
warning_code_invalid_format = 405
warning_code_no_pair_found = 406
warning_not_a_tmx_file = 407
command_line_min_args = 2
command_line_command_name_position... |
# -*- coding: utf-8 -*-
class wcstr(str):
def __new__(*args, **kwargs):
return str.__new__(*args, **kwargs)
def __init__(self, *args, **kwargs):
self._update()
def _update(self):
self.bitindex = []
for i,j in zip(str(self), range(len(str(self)))):
iwidth = 1 if... | class Wcstr(str):
def __new__(*args, **kwargs):
return str.__new__(*args, **kwargs)
def __init__(self, *args, **kwargs):
self._update()
def _update(self):
self.bitindex = []
for (i, j) in zip(str(self), range(len(str(self)))):
iwidth = 1 if len(i.encode('utf8')... |
T = (1,) + (2,3)
print(T)
print(type(T)) #<class 'tuple'>
T = T[0], T[1:2], T * 3 # (1, (2,), (1, 2, 3, 1, 2, 3, 1, 2, 3))
print(T)
# sorting is not available
T = ('aa', 'cc', 'dd', 'bb')
tmp = list(T)
tmp.sort()
T = tuple(tmp)
print(T)
# or sorted(T)
T = ('aa', 'cc', 'dd', 'bb')
T = sorted(T) # ['aa', 'bb', 'cc... | t = (1,) + (2, 3)
print(T)
print(type(T))
t = (T[0], T[1:2], T * 3)
print(T)
t = ('aa', 'cc', 'dd', 'bb')
tmp = list(T)
tmp.sort()
t = tuple(tmp)
print(T)
t = ('aa', 'cc', 'dd', 'bb')
t = sorted(T)
print(T)
t = (1, 2, 3, 4, 5)
l = [x + 100 for x in T]
print(L)
t = (1, 2, 2, 3, 4, 2, 5)
print(T.count(2))
print(T.index(2... |
class Solution:
def exist(self, board, word):
m, n, o = len(board), len(board and board[0]), len(word)
def explore(i, j, k, q):
for x, y in ((i - 1, j), (i, j - 1), (i + 1, j), (i, j + 1)):
if k>=o or (0<=x<m and 0<=y<n and board[x][y]==word[k] and (x,y) not in q and expl... | class Solution:
def exist(self, board, word):
(m, n, o) = (len(board), len(board and board[0]), len(word))
def explore(i, j, k, q):
for (x, y) in ((i - 1, j), (i, j - 1), (i + 1, j), (i, j + 1)):
if k >= o or (0 <= x < m and 0 <= y < n and (board[x][y] == word[k]) and (... |
f=open("input.txt")
Input=sorted(map(int, f.read().split("\n")))
Input = [0] + Input
f.close()
print(Input)
combinationCounts = [1] + [0] * (len(Input) - 1)
for i, value in enumerate(Input):
for j, adapterValue in enumerate(Input[i+1:], start=i+1):
if(adapterValue > value + 3):
break
c... | f = open('input.txt')
input = sorted(map(int, f.read().split('\n')))
input = [0] + Input
f.close()
print(Input)
combination_counts = [1] + [0] * (len(Input) - 1)
for (i, value) in enumerate(Input):
for (j, adapter_value) in enumerate(Input[i + 1:], start=i + 1):
if adapterValue > value + 3:
brea... |
# coding: utf-8
country = {
'ARG': 'Argentina',
'BOL': 'Bolivia',
'CHI': 'Chile',
'COL': 'Colombia',
'COS': 'Costa Rica',
'CUB': 'Cuba',
'EQU': 'Ecuador',
'SPA': 'Spain',
'MEX': 'Mexico',
'PER': 'Peru',
'POR': 'Portugal',
'BRA': 'Brazil',
'SOU': 'South Africa',
'... | country = {'ARG': 'Argentina', 'BOL': 'Bolivia', 'CHI': 'Chile', 'COL': 'Colombia', 'COS': 'Costa Rica', 'CUB': 'Cuba', 'EQU': 'Ecuador', 'SPA': 'Spain', 'MEX': 'Mexico', 'PER': 'Peru', 'POR': 'Portugal', 'BRA': 'Brazil', 'SOU': 'South Africa', 'URY': 'Uruguay', 'VEN': 'Venezuela', 'BUL': 'Switzerland', 'ANN': 'Italy',... |
class Solution:
def subsets(self, nums):
count = len(nums)
result = [[]]
for i in range(1, 2 ** count):
result.append([nums[j] for j in range(count) if i & (2 ** j)])
return result
| class Solution:
def subsets(self, nums):
count = len(nums)
result = [[]]
for i in range(1, 2 ** count):
result.append([nums[j] for j in range(count) if i & 2 ** j])
return result |
class Solution:
def maximumTime(self, time: str) -> str:
hour = time.split(':')[0]
minite = time.split(':')[1]
if hour[0] == '?':
if hour[1] == '?':
res_hour = '23'
elif hour[1] <= '3':
res_hour = str(2)+str(hour[1])
else:
... | class Solution:
def maximum_time(self, time: str) -> str:
hour = time.split(':')[0]
minite = time.split(':')[1]
if hour[0] == '?':
if hour[1] == '?':
res_hour = '23'
elif hour[1] <= '3':
res_hour = str(2) + str(hour[1])
els... |
texto = 'python'
for l in texto:
if l == 't':
l += 't'.upper()
print(l,end='')
else:
print(l,end='') | texto = 'python'
for l in texto:
if l == 't':
l += 't'.upper()
print(l, end='')
else:
print(l, end='') |
def flatten(lst_of_lst: list) -> list:
return [item for sublist in lst_of_lst for item in sublist]
def tests() -> None:
print(flatten([[1, 2], [3, 4], [5, 6]]))
print(flatten([[1, 4], [5, 4], [5, 6]]))
if __name__ == "__main__":
tests()
| def flatten(lst_of_lst: list) -> list:
return [item for sublist in lst_of_lst for item in sublist]
def tests() -> None:
print(flatten([[1, 2], [3, 4], [5, 6]]))
print(flatten([[1, 4], [5, 4], [5, 6]]))
if __name__ == '__main__':
tests() |
__version__ = "0.19.0-dev"
__libnetwork_plugin_version__ = "v0.8.0-dev"
__libcalico_version__ = "v0.14.0-dev"
__felix_version__ = "1.4.0b1-dev"
| __version__ = '0.19.0-dev'
__libnetwork_plugin_version__ = 'v0.8.0-dev'
__libcalico_version__ = 'v0.14.0-dev'
__felix_version__ = '1.4.0b1-dev' |
#
# Created on Mon Jun 14 2021
#
# The MIT License (MIT)
# Copyright (c) 2021 Vishnu Suresh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation... | class Righthandtree:
def __init__(self):
self.left = None
self.right = None
self.data = None
def insert_node(self, value):
if self.data == None:
self.data = value
elif '$' in self.data:
temp = self.data
self.data = value
s... |
class Attachment(object):
def __init__(self, name, data, length, content_type, origin):
self.name = name
self.data = data
self.length = length
self.content_type = content_type
self.origin = origin
def __str__(self):
return f"[{self.length} byte; {self.content_ty... | class Attachment(object):
def __init__(self, name, data, length, content_type, origin):
self.name = name
self.data = data
self.length = length
self.content_type = content_type
self.origin = origin
def __str__(self):
return f'[{self.length} byte; {self.content_ty... |
#!/usr/bin/env python
NAME = 'Wallarm (Wallarm Inc.)'
def is_waf(self):
if self.matchheader(('Server', r"nginx\-wallarm")):
return True
return False
| name = 'Wallarm (Wallarm Inc.)'
def is_waf(self):
if self.matchheader(('Server', 'nginx\\-wallarm')):
return True
return False |
class Point:
def __init__(self, new_x=0, new_y=0):
self.x = new_x
self.y = new_y
def set_point(self, point):
(self.x, self.y) = (point.x, point.y)
| class Point:
def __init__(self, new_x=0, new_y=0):
self.x = new_x
self.y = new_y
def set_point(self, point):
(self.x, self.y) = (point.x, point.y) |
test = { 'name': 'q7b',
'points': 1,
'suites': [ { 'cases': [ { 'code': '>>> '
"movies.head(1)['plots'][0]=='Two "
'imprisoned men bond over a '
'number of years... | test = {'name': 'q7b', 'points': 1, 'suites': [{'cases': [{'code': ">>> movies.head(1)['plots'][0]=='Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.'\nTrue", 'hidden': False, 'locked': False}, {'code': ">>> movies['plots'][23]=='An undercover cop an... |
csp = {
'default-src': [
'\'self\''
],
'script-src': [
'https://kit.fontawesome.com/4b9ba14b0f.js',
'http://localhost:5500/livereload.js',
'https://use.fontawesome.com/releases/v5.3.1/js/all.js',
'http://localhost:5000/static/js/base.js',
'http://localhost:550... | csp = {'default-src': ["'self'"], 'script-src': ['https://kit.fontawesome.com/4b9ba14b0f.js', 'http://localhost:5500/livereload.js', 'https://use.fontawesome.com/releases/v5.3.1/js/all.js', 'http://localhost:5000/static/js/base.js', 'http://localhost:5500/static/js/base.js', "'sha256-MclZcNa5vMtp/wzxRW6+KS3i8mRUf6thpmj... |
#encoding:utf-8
subreddit = 'pics'
t_channel = '@r_pics_redux'
def send_post(submission, r2t):
return r2t.send_simple(submission,
text=False,
gif=False,
img='{title}\n{short_link}',
album=False,
other=False
)
| subreddit = 'pics'
t_channel = '@r_pics_redux'
def send_post(submission, r2t):
return r2t.send_simple(submission, text=False, gif=False, img='{title}\n{short_link}', album=False, other=False) |
# Lesson3: while loop
# source: code/while.py
text = ''
while text != 'stop':
text = input('Tell me something:\n')
print('you told me:', text)
print('... and I\'m stopping')
| text = ''
while text != 'stop':
text = input('Tell me something:\n')
print('you told me:', text)
print("... and I'm stopping") |
workers = 1
worker_class = 'gevent'
bind = '0.0.0.0:5000'
pidfile = '/tmp/gunicorn-inspector.pid'
debug = True
reload = True
loglevel = 'info'
errorlog = '/tmp/gunicorn_inspector_error.log'
accesslog = '/tmp/gunicorn_inspector_access.log'
daemon = False
| workers = 1
worker_class = 'gevent'
bind = '0.0.0.0:5000'
pidfile = '/tmp/gunicorn-inspector.pid'
debug = True
reload = True
loglevel = 'info'
errorlog = '/tmp/gunicorn_inspector_error.log'
accesslog = '/tmp/gunicorn_inspector_access.log'
daemon = False |
# (User) Problem
# We know / We have: 3 number: win draw lose
# We need / We don't have: points for team
# We must: use: 3 points for win, 1 for draw, 0 for loss
# name of function must be: football_points
#
# Solution (Product)
# function with 3 inputs
def football_points(wins, draws, losses):
return wins * 3 + dr... | def football_points(wins, draws, losses):
return wins * 3 + draws |
users = [
{ "id": 0, "name": "Hero" },
{ "id": 1, "name": "Dunn" },
{ "id": 2, "name": "Sue" },
{ "id": 3, "name": "Chi" },
{ "id": 4, "name": "Thor" },
{ "id": 5, "name": "Clive" },
{ "id": 6, "name": "Hicks" },
{ "id": 7, "name": "Devin" },
{ "id": 8, "name": "Kate" },
{ "id": ... | users = [{'id': 0, 'name': 'Hero'}, {'id': 1, 'name': 'Dunn'}, {'id': 2, 'name': 'Sue'}, {'id': 3, 'name': 'Chi'}, {'id': 4, 'name': 'Thor'}, {'id': 5, 'name': 'Clive'}, {'id': 6, 'name': 'Hicks'}, {'id': 7, 'name': 'Devin'}, {'id': 8, 'name': 'Kate'}, {'id': 9, 'name': 'Klein'}]
friendships = [(0, 1), (0, 2), (1, 2), ... |
# Constants
Background = 'FF111111'
BackgroundDark = 'FF0A0A0A'
# OverlayVeryDark = GetAlpha(FF000000, 90),
# OverlayDark = GetAlpha(FF000000, 70),
# OverlayMed = GetAlpha(FF000000, 50),
# OverlayLht = GetAlpha(FF000000, 35),
Border = 'FF1F1F1F'
Empty = 'FF1F1F1F'
Card = 'FF1F1F1F'
Button = 'FF1F1F1F'
ButtonDark ... | background = 'FF111111'
background_dark = 'FF0A0A0A'
border = 'FF1F1F1F'
empty = 'FF1F1F1F'
card = 'FF1F1F1F'
button = 'FF1F1F1F'
button_dark = 'FF171717'
button_lht = 'FF555555'
button_med = 'FF2D2D2D'
indicator = 'FF999999'
text = 'FFFFFFFF'
subtitle = 'FF999999'
transparent = '00000000'
black = 'FF000000'
blue = 'FF... |
API_KEY = "PK3OA9F3DZ47286MDM81"
SECRET_KEY = "oJxGYAqcrIrhpLyXGJyIb3wsCrh2cR3xwaO662yp"
HEADERS = {
'APCA-API-KEY-ID': API_KEY,
'APCA-API-SECRET-KEY': SECRET_KEY
}
BARS_URL = 'https://data.alpaca.markets/v1/bars'
| api_key = 'PK3OA9F3DZ47286MDM81'
secret_key = 'oJxGYAqcrIrhpLyXGJyIb3wsCrh2cR3xwaO662yp'
headers = {'APCA-API-KEY-ID': API_KEY, 'APCA-API-SECRET-KEY': SECRET_KEY}
bars_url = 'https://data.alpaca.markets/v1/bars' |
n=int(input())
a=[int(i) for i in input().split()]
d=[a[0]]
for i in range(1,n):
x=a[i]
if x>d[-1]: d+=[x]
elif d[0]>=x: d[0]=x
else:
l,r=0,len(d)
while(r>l+1):
m=(l+r)//2
if(d[m]<x): l=m
else: r=m
d[r]=x
print(len(d)) ... | n = int(input())
a = [int(i) for i in input().split()]
d = [a[0]]
for i in range(1, n):
x = a[i]
if x > d[-1]:
d += [x]
elif d[0] >= x:
d[0] = x
else:
(l, r) = (0, len(d))
while r > l + 1:
m = (l + r) // 2
if d[m] < x:
l = m
... |
# Copyright 2016 Twitter. 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 law or agree... | config_opts = dict()
verbose_flag = False
trace_execution_flag = False
def get_heron_config():
opt_list = []
for (k, v) in config_opts.items():
opt_list.append('%s=%s' % (k, v))
all_opts = '-Dheron.options=' + ','.join(opt_list).replace(' ', '%%%%')
return all_opts
def get_config(k):
globa... |
ENABLE_EXTERNAL_PATHS = False
SOURCE_DEFINITION = ['Landroid/telephony/TelephonyManager;->getDeviceId(',
'Landroid/telephony/TelephonyManager;->getSubscriberId(',
'Landroid/telephony/TelephonyManager;->getSimSerialNumber(',
'Landroid/telephony/TelephonyManager;->getLine1Number(']
#[
# 'Landroid/accounts/AccountMana... | enable_external_paths = False
source_definition = ['Landroid/telephony/TelephonyManager;->getDeviceId(', 'Landroid/telephony/TelephonyManager;->getSubscriberId(', 'Landroid/telephony/TelephonyManager;->getSimSerialNumber(', 'Landroid/telephony/TelephonyManager;->getLine1Number(']
sink_definition = ['Landroid/util/Log;-... |
weather = []
for i in range(4):
x = input().split()
| weather = []
for i in range(4):
x = input().split() |
def sol(preorder,inorder):
ret = []
def print_postorder(preorder, inorder):
n = len(preorder)
if n == 0:
return
root = preorder[0]
i = inorder.index(root)
print_postorder(preorder[1 : i + 1], inorder[:i])
print_postorder(preorder[i + 1 :], inorder[i ... | def sol(preorder, inorder):
ret = []
def print_postorder(preorder, inorder):
n = len(preorder)
if n == 0:
return
root = preorder[0]
i = inorder.index(root)
print_postorder(preorder[1:i + 1], inorder[:i])
print_postorder(preorder[i + 1:], inorder[i + 1... |
__version__ = '0.2.0'
__pdoc__ = {
'__version__': "The version of the installed nflfan module.",
}
| __version__ = '0.2.0'
__pdoc__ = {'__version__': 'The version of the installed nflfan module.'} |
{
"targets": [
{
"target_name": "math",
"sources": [ "math.cc" ],
"libraries": [
"<(module_root_dir)/libmath.a"
]
}
]
} | {'targets': [{'target_name': 'math', 'sources': ['math.cc'], 'libraries': ['<(module_root_dir)/libmath.a']}]} |
{
'target_defaults': {
'default_configuration': 'Release'
},
"targets": [
{
'configurations': {
'Debug': {
'cflags': ['-g3', '-O0'],
'msvs_settings': {
'VCCLCompilerTool': {
'BasicRuntimeChecks': 3, # /RTC1
'ExceptionHand... | {'target_defaults': {'default_configuration': 'Release'}, 'targets': [{'configurations': {'Debug': {'cflags': ['-g3', '-O0'], 'msvs_settings': {'VCCLCompilerTool': {'BasicRuntimeChecks': 3, 'ExceptionHandling': 1, 'Optimization': '0', 'WarningLevel': 4}, 'VCLinkerTool': {'GenerateDebugInformation': 'true', 'LinkIncreme... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,md,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.4.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # Jonathan Date-Chong
# *... | def question_1(answer):
answers = {'A': 'Monday morning', 'B': 'Sunday night', 'C': 'Monday evening', 'D': "I don't know"}
try:
return answers[answer]
except:
return 'Not a valid answer'
answer_question_1 = lambda : question_1('C')
def question_2(answer):
answers = {'A': 'No', 'B': 'May... |
for i in range(1, 10+1):
if i%3 == 0:
print('hello')
elif i%5 == 0:
print('world')
else:
print(i)
| for i in range(1, 10 + 1):
if i % 3 == 0:
print('hello')
elif i % 5 == 0:
print('world')
else:
print(i) |
def place(arr, mask, vals):
# TODO(beam2d): Implement it
raise NotImplementedError
def put(a, ind, v, mode='raise'):
# TODO(beam2d): Implement it
raise NotImplementedError
def putmask(a, mask, values):
# TODO(beam2d): Implement it
raise NotImplementedError
def fill_diagonal(a, val, wrap=Fa... | def place(arr, mask, vals):
raise NotImplementedError
def put(a, ind, v, mode='raise'):
raise NotImplementedError
def putmask(a, mask, values):
raise NotImplementedError
def fill_diagonal(a, val, wrap=False):
raise NotImplementedError |
# maps biome IDs to supported biomes
biome_map = {
"Plains": [1, 129],
"Forest": [4, 18, 132],
"Birch Forest": [27, 28, 155, 156],
"Dark Forest": [29, 157],
"Swamp": [6, 134],
"Jungle": [21, 22, 23, 149, 151],
"River Beach": [7, 11, 16, 25],
"Taiga": [5, 19, 133, 30, 31, 158, 32, 33, 160... | biome_map = {'Plains': [1, 129], 'Forest': [4, 18, 132], 'Birch Forest': [27, 28, 155, 156], 'Dark Forest': [29, 157], 'Swamp': [6, 134], 'Jungle': [21, 22, 23, 149, 151], 'River Beach': [7, 11, 16, 25], 'Taiga': [5, 19, 133, 30, 31, 158, 32, 33, 160, 161], 'Ice': [12, 140, 26], 'Mountains': [3, 13, 34, 131, 162, 20], ... |
def pprint(obj):
return repr(obj)
def to_hex_str(data):
return ''.join("{0:x}".format(b) for b in data)
| def pprint(obj):
return repr(obj)
def to_hex_str(data):
return ''.join(('{0:x}'.format(b) for b in data)) |
# -*- coding: utf-8 -*-
class PluginException(Exception):
pass
class PluginTypeNotFound(PluginException):
pass
| class Pluginexception(Exception):
pass
class Plugintypenotfound(PluginException):
pass |
class gr():
def __init__(self):
age = 28
def stop(self):
return 1+1
if __name__ == "__main__":
print("hello")
pass | class Gr:
def __init__(self):
age = 28
def stop(self):
return 1 + 1
if __name__ == '__main__':
print('hello')
pass |
# Kata url: https://www.codewars.com/kata/574b1916a3ebd6e4fa0012e7.
def is_opposite(s1: str, s2: str) -> bool:
return len(s1) and s1 == s2.swapcase()
| def is_opposite(s1: str, s2: str) -> bool:
return len(s1) and s1 == s2.swapcase() |
def sectrails(domain,requests,api):
print("[+] Consultando securitytrails")
url = "https://api.securitytrails.com/v1/domain/"+domain+"/subdomains"
querystring = {"children_only":"false","include_inactive":"true"}
headers = {"Accept": "application/json","APIKEY": api}
subs = []
# Insira sua chav... | def sectrails(domain, requests, api):
print('[+] Consultando securitytrails')
url = 'https://api.securitytrails.com/v1/domain/' + domain + '/subdomains'
querystring = {'children_only': 'false', 'include_inactive': 'true'}
headers = {'Accept': 'application/json', 'APIKEY': api}
subs = []
try:
... |
class Node:
def __init__(self, data):
self.data = data
self.right_child = None
self.left_child = None
| class Node:
def __init__(self, data):
self.data = data
self.right_child = None
self.left_child = None |
secret_number = 9
guess_count = 0
guess_limit = 3
while guess_count < guess_limit:
guess = int(input("Guess any no. from 1-10: "))
guess_count+=1
if guess == secret_number:
print("You won")
break
else:
print("Better luck next time")
| secret_number = 9
guess_count = 0
guess_limit = 3
while guess_count < guess_limit:
guess = int(input('Guess any no. from 1-10: '))
guess_count += 1
if guess == secret_number:
print('You won')
break
else:
print('Better luck next time') |
# Linear Search Implementation
def linear_search(arr, search):
# Iterate over the array
for _, ele in enumerate(arr):
# Check for search element
if ele == search:
return True
return False
if __name__ == "__main__":
# Read input array from stdin
arr = list(map(int, input().strip().split()))
# Read sear... | def linear_search(arr, search):
for (_, ele) in enumerate(arr):
if ele == search:
return True
return False
if __name__ == '__main__':
arr = list(map(int, input().strip().split()))
search = list(map(int, input().strip().split()))
for s in search:
print(f'Searching for {s} ... |
BASE_URL = "https://www.zhixue.com"
class Url:
SERVICE_URL = f"{BASE_URL}:443/ssoservice.jsp"
SSO_URL = f"https://sso.zhixue.com/sso_alpha/login?service={SERVICE_URL}"
TEST_PASSWORD_URL = f"{BASE_URL}/weakPwdLogin/?from=web_login"
TEST_URL = f"{BASE_URL}/container/container/teacher/teacherAccountNew"
... | base_url = 'https://www.zhixue.com'
class Url:
service_url = f'{BASE_URL}:443/ssoservice.jsp'
sso_url = f'https://sso.zhixue.com/sso_alpha/login?service={SERVICE_URL}'
test_password_url = f'{BASE_URL}/weakPwdLogin/?from=web_login'
test_url = f'{BASE_URL}/container/container/teacher/teacherAccountNew'
... |
#!/usr/bin/env python2.7
# Copyright (c) 2014 Franco Fichtner <franco@packetwerk.com>
# Copyright (c) 2014 Tobias Boertitz <tobias@packetwerk.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and th... | countries = []
with open('contrib/tzdata/iso3166.tab', 'r') as lines:
for line in lines:
country = line.strip().split('\t')
if country[0][0] == '#' or len(country) != 2:
continue
country[0] = country[0].upper()
countries.append(country)
if len(countries) == 0:
exit(0)... |
#
# PySNMP MIB module HPN-ICF-LI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-LI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:27:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, constraints_intersection, value_size_constraint, value_range_constraint) ... |
def inorder(root):
res = []
if not root:
return res
stack = []
while root and stack:
while root:
stack.append(root)
root = root.left
root = stack.pop()
res.add(root.val)
root = root.right
return res
| def inorder(root):
res = []
if not root:
return res
stack = []
while root and stack:
while root:
stack.append(root)
root = root.left
root = stack.pop()
res.add(root.val)
root = root.right
return res |
class Solution:
def partition(self, s: str) -> list[list[str]]:
# TODO: add explanation, make clearer
if len(s) == 0:
return [[]]
result = []
def backtrack(current: list[str], prefix: str) -> None:
if len(prefix) == 0:
result.append(current)
... | class Solution:
def partition(self, s: str) -> list[list[str]]:
if len(s) == 0:
return [[]]
result = []
def backtrack(current: list[str], prefix: str) -> None:
if len(prefix) == 0:
result.append(current)
return
for index i... |
def geobox2rect(geobox):
x, y, w, h = geobox
return x - int(w / 2), y - int(h / 2), w, h
def geobox2ptrect(geobox):
x, y, w, h = geobox2rect(geobox)
return x, y, x + w, y + h
def rect2geobox(x, y, w, h):
return x + int(w / 2), y + int(h / 2), w, h
def ptrect2geobox(x1, y1, x2, y2... | def geobox2rect(geobox):
(x, y, w, h) = geobox
return (x - int(w / 2), y - int(h / 2), w, h)
def geobox2ptrect(geobox):
(x, y, w, h) = geobox2rect(geobox)
return (x, y, x + w, y + h)
def rect2geobox(x, y, w, h):
return (x + int(w / 2), y + int(h / 2), w, h)
def ptrect2geobox(x1, y1, x2, y2):
... |
def pythag_triple(n):
for a in range(1, n // 2):
b = (n**2/2 - n*a)/(n - a)
if b.is_integer():
return int(a*b*(n - a - b))
return None
print(pythag_triple(1000))
# Copyright Junipyr. All rights reserved.
# https://github.com/Junipyr | def pythag_triple(n):
for a in range(1, n // 2):
b = (n ** 2 / 2 - n * a) / (n - a)
if b.is_integer():
return int(a * b * (n - a - b))
return None
print(pythag_triple(1000)) |
mylitta = [1, 2, 3, 4, 5]
l2 = list([1, 2, 3, 4, 5])
l3 = list("casa de papel")
l4 = "alberto torres".split()
l5 = "alberto torres,carolina torres,mauricio torres".split(",")
cadena = " - ".join(l5)
mylitta = mylitta + [12, 13]
mylitta += [15, 16]
mylitta.append(9)
mylitta.extend([10, 11])
print(mylitta)
print(... | mylitta = [1, 2, 3, 4, 5]
l2 = list([1, 2, 3, 4, 5])
l3 = list('casa de papel')
l4 = 'alberto torres'.split()
l5 = 'alberto torres,carolina torres,mauricio torres'.split(',')
cadena = ' - '.join(l5)
mylitta = mylitta + [12, 13]
mylitta += [15, 16]
mylitta.append(9)
mylitta.extend([10, 11])
print(mylitta)
print(l2)
prin... |
# open the fil2.txt in read mode. causes error if no such file exists.
fileptr = open("file2.txt", "r")
# stores all the data of the file into the variable content
content = fileptr.readlines()
# prints the content of the file
print(content)
# closes the opened file
fileptr.close() | fileptr = open('file2.txt', 'r')
content = fileptr.readlines()
print(content)
fileptr.close() |
# Advent of Code 2017
#
# From https://adventofcode.com/2017/day/4
#
passwords = [row.strip().split() for row in open('../inputs/Advent2017_04.txt', 'r')]
print(sum(len(row) == len(set(row)) for row in passwords))
print(sum(len(row) == len(set("".join(sorted(x)) for x in row)) for row in passwords))
| passwords = [row.strip().split() for row in open('../inputs/Advent2017_04.txt', 'r')]
print(sum((len(row) == len(set(row)) for row in passwords)))
print(sum((len(row) == len(set((''.join(sorted(x)) for x in row))) for row in passwords))) |
'''
Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
Clarification:
Confused why the returned value is an integer... | """
Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
Clarification:
Confused why the returned value is an integer... |
def findLargest(l):
lo , hi = 0 , len(l)
left , right = l[0] , l[-1]
while(lo<hi):
mid = (lo + hi)//2
if(left > l[mid]):
hi = mid
else:
lo = mid +1
return l[lo-1]
| def find_largest(l):
(lo, hi) = (0, len(l))
(left, right) = (l[0], l[-1])
while lo < hi:
mid = (lo + hi) // 2
if left > l[mid]:
hi = mid
else:
lo = mid + 1
return l[lo - 1] |
def rule(event):
# Only check actions creating a new Network ACL entry
if event['eventName'] != 'CreateNetworkAclEntry':
return False
# Check if this new NACL entry is allowing traffic from anywhere
return (event['requestParameters']['cidrBlock'] == '0.0.0.0/0' and
event['requestPar... | def rule(event):
if event['eventName'] != 'CreateNetworkAclEntry':
return False
return event['requestParameters']['cidrBlock'] == '0.0.0.0/0' and event['requestParameters']['ruleAction'] == 'allow' and (event['requestParameters']['egress'] is False) |
_base_ = [
'./coco_data_pipeline.py'
]
model = dict(
type='MaskRCNN',
backbone=dict(
type='efficientnet_b2b',
out_indices=(2, 3, 4, 5),
frozen_stages=-1,
pretrained=True,
activation_cfg=dict(type='torch_swish'),
norm_cfg=dict(type='BN', requires_grad=True)),
... | _base_ = ['./coco_data_pipeline.py']
model = dict(type='MaskRCNN', backbone=dict(type='efficientnet_b2b', out_indices=(2, 3, 4, 5), frozen_stages=-1, pretrained=True, activation_cfg=dict(type='torch_swish'), norm_cfg=dict(type='BN', requires_grad=True)), neck=dict(type='FPN', in_channels=[24, 48, 120, 352], out_channel... |
def main() -> None:
x0, y0 = map(int, input().split())
x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
def calc(x0, y0, x1, y1, x2, y2):
if y2 == y0:
print(x2, y1)
else:
print(x2, y0)
if x0 == x1:
calc(x0, y0, x1, y1... | def main() -> None:
(x0, y0) = map(int, input().split())
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
def calc(x0, y0, x1, y1, x2, y2):
if y2 == y0:
print(x2, y1)
else:
print(x2, y0)
if x0 == x1:
calc(x0, y0, x1, y1, x2, y... |
class FreqStack:
def __init__(self):
self.fmap = Counter()
self.stack = [0]
def push(self, x: int) -> None:
self.fmap[x] += 1
freq = self.fmap[x]
if (freq == len(self.stack)): self.stack.append([x])
else: self.stack[freq].append(x)
def pop(self) -> int:
... | class Freqstack:
def __init__(self):
self.fmap = counter()
self.stack = [0]
def push(self, x: int) -> None:
self.fmap[x] += 1
freq = self.fmap[x]
if freq == len(self.stack):
self.stack.append([x])
else:
self.stack[freq].append(x)
def... |
input_1 = int(input('Ingrese numero 1 = '))
input_2 = int(input('Ingrese numero 2 = '))
for x in range(input_1, input_2):
print(x)
| input_1 = int(input('Ingrese numero 1 = '))
input_2 = int(input('Ingrese numero 2 = '))
for x in range(input_1, input_2):
print(x) |
CERTIFICATE = {
"type": "service_account",
"project_id": "fir-orm-python",
"private_key_id": "47246fe582a99774f4daf19fad21b97a09df8c70",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDMp79d08KEZPrn\nN0xZGULfM/eZwAJ+MytsPQhs+LVSqtx1c/oGHpQC5GiW9xwgnMpEh7xfX5NNjp6x... | certificate = {'type': 'service_account', 'project_id': 'fir-orm-python', 'private_key_id': '47246fe582a99774f4daf19fad21b97a09df8c70', 'private_key': '-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDMp79d08KEZPrn\nN0xZGULfM/eZwAJ+MytsPQhs+LVSqtx1c/oGHpQC5GiW9xwgnMpEh7xfX5NNjp6x\n0BVP9e7... |
MODEL_PATH = {
"glove": "phrase-emb-storage/saved_models/glove/",
"bert": "bert-base-uncased",
"spanbert": "phrase-emb-storage/saved_models/span-bert-model/",
"sentbert": "bert-base-nli-stsb-mean-tokens",
"phrase-bert": "phrase-emb-storage/saved_models/phrase-bert-model/"
}
GLOVE_FILE_PATH = 'phra... | model_path = {'glove': 'phrase-emb-storage/saved_models/glove/', 'bert': 'bert-base-uncased', 'spanbert': 'phrase-emb-storage/saved_models/span-bert-model/', 'sentbert': 'bert-base-nli-stsb-mean-tokens', 'phrase-bert': 'phrase-emb-storage/saved_models/phrase-bert-model/'}
glove_file_path = 'phrase-emb-storage/cc_glove/... |
if __name__ == '__main__':
mark = []
for _ in range(int(input())):
name = input()
score = float(input())
mark.append([name, score])
second_highest = sorted(set([score for name, score in mark]))[1]
print('\n'.join(sorted([name for name, score in mark if score == second_highes... | if __name__ == '__main__':
mark = []
for _ in range(int(input())):
name = input()
score = float(input())
mark.append([name, score])
second_highest = sorted(set([score for (name, score) in mark]))[1]
print('\n'.join(sorted([name for (name, score) in mark if score == second_highest... |
# optimizer
optimizer = dict(type='Lamb', lr=0.005, weight_decay=0.02)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='CosineAnnealing',
min_lr=1.0e-6,
warmup='linear',
# For ImageNet-1k, 626 iters per epoch, warmup 5 epochs.
warmup_iters=5 * 626,
warmup_ratio... | optimizer = dict(type='Lamb', lr=0.005, weight_decay=0.02)
optimizer_config = dict(grad_clip=None)
lr_config = dict(policy='CosineAnnealing', min_lr=1e-06, warmup='linear', warmup_iters=5 * 626, warmup_ratio=0.0001)
runner = dict(type='EpochBasedRunner', max_epochs=100) |
{
"targets": [
{
"target_name": "ultradb",
"sources": [ "src/ultradb.cc" ],
"conditions": [
["OS==\"linux\"", {
"cflags_cc": [ "-fpermissive", "-Os" ]
}]
]
}
]
}
| {'targets': [{'target_name': 'ultradb', 'sources': ['src/ultradb.cc'], 'conditions': [['OS=="linux"', {'cflags_cc': ['-fpermissive', '-Os']}]]}]} |
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'postgresql:///logging'
PORT = 5555
SERVER = 'production'
#SSL_KEY = "/path/to/keyfile.key"
#SSL_CRT = "/path/to/certfile.crt"
| debug = False
sqlalchemy_database_uri = 'postgresql:///logging'
port = 5555
server = 'production' |
# Event: LCCS Python Fundamental Skills Workshop
# Date: Dec 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Breakout 6.4 Check digits
# Solution to Exercise 1 - extract the ith digit from n
# A function to extract digit i from number n
def extractDigit(i, n):
i = len(n) - i
if i ... | def extract_digit(i, n):
i = len(n) - i
if i < 0:
return -1
n = int(n)
return n // pow(10, i) % 10
x = input('Enter a number: ')
pos = int(input('Enter position of digit to extract: '))
print(extract_digit(pos, x))
'\nn = int(input("Enter a 2 digit number: "))\nd2 = n%10 # %10 extracts the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.