content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#20 se 100 takk vo print kro jo 2 se devied ho
num=20
while num<=100:
a=num-20
if num%2==0:
print(num)
num+=1 | num = 20
while num <= 100:
a = num - 20
if num % 2 == 0:
print(num)
num += 1 |
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "HW5_FFT.py",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyOW+hfid580c7DvA724SrbG",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": ... | {'nbformat': 4, 'nbformat_minor': 0, 'metadata': {'colab': {'name': 'HW5_FFT.py', 'provenance': [], 'collapsed_sections': [], 'authorship_tag': 'ABX9TyOW+hfid580c7DvA724SrbG', 'include_colab_link': true}, 'kernelspec': {'name': 'python3', 'display_name': 'Python 3'}}, 'cells': [{'cell_type': 'markdown', 'metadata': {'i... |
def area_of_rectangle(a,b):
return a * b
a = int(input())
b = int(input())
print(area_of_rectangle(a,b)) | def area_of_rectangle(a, b):
return a * b
a = int(input())
b = int(input())
print(area_of_rectangle(a, b)) |
t = int(input())
for _ in range(t):
a, b = map(int, input().split())
diff = abs(b-a)
if diff == 0:
print(0)
continue
if diff % 10 == 0:
print(diff//10)
else:
print(diff//10 + 1) | t = int(input())
for _ in range(t):
(a, b) = map(int, input().split())
diff = abs(b - a)
if diff == 0:
print(0)
continue
if diff % 10 == 0:
print(diff // 10)
else:
print(diff // 10 + 1) |
def sortMolKeys(my_molecules):
if ' and ' not in list(my_molecules.keys())[0]:
my_sort = ['' for i in range(len(my_molecules))]
nums = [int(i.split()[0]) for i in my_molecules]
nums_sorted = ['%i'%i for i in sorted(nums)]
for key in my_molecules:
index = nums_sorted.index... | def sort_mol_keys(my_molecules):
if ' and ' not in list(my_molecules.keys())[0]:
my_sort = ['' for i in range(len(my_molecules))]
nums = [int(i.split()[0]) for i in my_molecules]
nums_sorted = ['%i' % i for i in sorted(nums)]
for key in my_molecules:
index = nums_sorted.i... |
#!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
# No difference between single and double quotes
x = '''
seven
'''.capitalize()
print('x is {}'.format(x))
print(type(x))
| x = ' \n\nseven\n\n'.capitalize()
print('x is {}'.format(x))
print(type(x)) |
x = int(input())
y = int(input())
# the variables `x` and `y` are defined, so just print their sum
print(sum([x, y]))
| x = int(input())
y = int(input())
print(sum([x, y])) |
layers_single_good_simulated_response = """{"id": 1474, "url": "https://koordinates.com/services/api/v1/layers/1474/", "type": "layer", "name": "Wellington City Building Footprints", "first_published_at": "2010-06-21T05:05:05.953", "published_at": "2012-05-09T02:11:27.020Z", "description": "Polygons representing buildi... | layers_single_good_simulated_response = '{"id": 1474, "url": "https://koordinates.com/services/api/v1/layers/1474/", "type": "layer", "name": "Wellington City Building Footprints", "first_published_at": "2010-06-21T05:05:05.953", "published_at": "2012-05-09T02:11:27.020Z", "description": "Polygons representing building... |
hash_table = [0] * 8
def get_key(data):
return hash(data)
def get_address(key):
return key % 8
def save_data(data, value):
key = get_key(data)
addr = get_address(key)
if not hash_table[addr]:
hash_table[addr] = [[key, value]]
else:
for i in range(len(hash_table[addr])):
... | hash_table = [0] * 8
def get_key(data):
return hash(data)
def get_address(key):
return key % 8
def save_data(data, value):
key = get_key(data)
addr = get_address(key)
if not hash_table[addr]:
hash_table[addr] = [[key, value]]
else:
for i in range(len(hash_table[addr])):
... |
set_name(0x8012427C, "PresOnlyTestRoutine__Fv", SN_NOWARN)
set_name(0x801242A4, "FeInitBuffer__Fv", SN_NOWARN)
set_name(0x801242CC, "FeAddEntry__Fii8TXT_JUSTiP7FeTableP5CFont", SN_NOWARN)
set_name(0x8012433C, "FeAddTable__FP11FeMenuTablei", SN_NOWARN)
set_name(0x801243BC, "FeDrawBuffer__Fv", SN_NOWARN)
set_name(0x80124... | set_name(2148680316, 'PresOnlyTestRoutine__Fv', SN_NOWARN)
set_name(2148680356, 'FeInitBuffer__Fv', SN_NOWARN)
set_name(2148680396, 'FeAddEntry__Fii8TXT_JUSTiP7FeTableP5CFont', SN_NOWARN)
set_name(2148680508, 'FeAddTable__FP11FeMenuTablei', SN_NOWARN)
set_name(2148680636, 'FeDrawBuffer__Fv', SN_NOWARN)
set_name(2148681... |
src='2018-5540'
region='box[[181pix,79pix], [681pix,816pix]]'
directory='/Volumes/NARNIA/pilot_cutouts/leakage_corrected/2018-5540/'
imsubimage(imagename='FDF_peakRM_fitted_corrected.fits',outfile='pkrm_smol_temp',region=region,overwrite=True,dropdeg=True)
exportfits(imagename='pkrm_smol_temp',fitsimage='2018-5540_p... | src = '2018-5540'
region = 'box[[181pix,79pix], [681pix,816pix]]'
directory = '/Volumes/NARNIA/pilot_cutouts/leakage_corrected/2018-5540/'
imsubimage(imagename='FDF_peakRM_fitted_corrected.fits', outfile='pkrm_smol_temp', region=region, overwrite=True, dropdeg=True)
exportfits(imagename='pkrm_smol_temp', fitsimage='201... |
# coding=utf-8
BASE_ENDPOINT = "http://sskj.si/?s={}"
MAX_DEFINITIONS = 50
MAX_CACHE_AGE = 43200
class SpecialChars:
TERMINOLOGY = u"\u25CF"
SLANG = u"\u2666"
REPLACEMENTS = {
# no-break space replacement with normal space
"\xa0": " "
}
def remove_num(d):
for n in range(1, MAX_DEFINITIONS):
... | base_endpoint = 'http://sskj.si/?s={}'
max_definitions = 50
max_cache_age = 43200
class Specialchars:
terminology = u'●'
slang = u'♦'
replacements = {'\xa0': ' '}
def remove_num(d):
for n in range(1, MAX_DEFINITIONS):
if str(d).startswith(str(n) + '.'):
return str(d).strip(str(n) + '.'... |
#### Regulation Z
IGNORE_DEFINITIONS_IN_PART_1026 = [
'credit report',
'credit-report',
'Consumer Price Index',
'credit counseling',
'and credit the',
'credit reporting agencies',
'credit history',
'Credit the amount',
'credit to a deposit account',
'Consumer Price level',
'... | ignore_definitions_in_part_1026 = ['credit report', 'credit-report', 'Consumer Price Index', 'credit counseling', 'and credit the', 'credit reporting agencies', 'credit history', 'Credit the amount', 'credit to a deposit account', 'Consumer Price level', 'may state', 'and state that', 'could state', 'must state', 'shal... |
class Solution:
def bitwiseComplement(self, N: int) -> int:
X = 1
while N > X: X = X * 2 + 1
return X - N
| class Solution:
def bitwise_complement(self, N: int) -> int:
x = 1
while N > X:
x = X * 2 + 1
return X - N |
class Constants:
HEADERS = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:70.0) '
'Gecko/20100101 Firefox/70.0'
}
HEADERS = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:70.0) '
'Gecko/20100101 Firefox/70.0',
"Connection": ... | class Constants:
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0'}
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0', 'Connection': 'close'} |
# You are developing an online booking portal for a bus tour company. On the website, tourists can book in
# groups to come on your company's city bus tour. The company has various buses with different capacities.
# You want to determine, from the list of available bookings, if you can completely fill up a particular b... | class Fullbustour:
def __init__(self, group_sizes, full_cap):
self.group_sizes = group_sizes
self.full_cap = full_cap
def fits_exactly(self):
return False |
'''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any late... | """
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any late... |
#
# PySNMP MIB module SIEMENS-HP4KHIM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIEMENS-HP4KHIM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:04:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ... |
def _list_of_n(lst, n):
"""For assignment to (list, ...) - make this list the right size"""
if lst is None or (hasattr(lst, 'isHash') and lst.isHash) or not (isinstance(lst, collections.abc.Sequence) and not isinstance(lst, str)):
lst = [lst]
la = len(lst)
if la == n:
return lst
... | def _list_of_n(lst, n):
"""For assignment to (list, ...) - make this list the right size"""
if lst is None or (hasattr(lst, 'isHash') and lst.isHash) or (not (isinstance(lst, collections.abc.Sequence) and (not isinstance(lst, str)))):
lst = [lst]
la = len(lst)
if la == n:
return lst
... |
'''
/profissional-de-saude/{idprofissional}/gerar-consulta/{dateTime}{
blueprint:paciente
template:profissionalDesSaudeGerarConsulta.html
dados:{
consulta{
nomeProfissional,
especialidade,
dateTime,
valor
}
}
*******pagseguro
}
''' | """
/profissional-de-saude/{idprofissional}/gerar-consulta/{dateTime}{
blueprint:paciente
template:profissionalDesSaudeGerarConsulta.html
dados:{
consulta{
nomeProfissional,
especialidade,
dateTime,
valor
}
}
*******pagseguro
}
""" |
# -*- coding: utf-8 -*-
"""
Created on Sat May 2 17:07:59 2020
@author: teja
"""
# Stack
l = [1, 2, 3, 4]
l.append(10)
print(l.pop())
print(l)
#Queue
l = [1, 2, 3, 4]
l.append(20)
l.pop(0)
print(l) | """
Created on Sat May 2 17:07:59 2020
@author: teja
"""
l = [1, 2, 3, 4]
l.append(10)
print(l.pop())
print(l)
l = [1, 2, 3, 4]
l.append(20)
l.pop(0)
print(l) |
# https://easily-champion-frog.dataos.io:7432/depot/collection
connection_regex = r"^(http|https):\/\/([\w.-]+(?:\:\d+)?(?:,[\w.-]+(?:\:\d+)?)*)(\/\w+)?(\/\w+)?(\?[\w.-]+=[\w.-]+(?:&[\w.-]+=[\w.-]+)*)?$"
apikey_regex = "\\w+"
| connection_regex = '^(http|https):\\/\\/([\\w.-]+(?:\\:\\d+)?(?:,[\\w.-]+(?:\\:\\d+)?)*)(\\/\\w+)?(\\/\\w+)?(\\?[\\w.-]+=[\\w.-]+(?:&[\\w.-]+=[\\w.-]+)*)?$'
apikey_regex = '\\w+' |
"""A simple example for how to replace the provided artifact macro"""
load("@mabel//rules/maven_deps:mabel.bzl", "artifact")
def g_artifact(coordinate, type = "auto"):
return artifact(coordinate, repositories = ["https://maven.google.com/"], type = type)
| """A simple example for how to replace the provided artifact macro"""
load('@mabel//rules/maven_deps:mabel.bzl', 'artifact')
def g_artifact(coordinate, type='auto'):
return artifact(coordinate, repositories=['https://maven.google.com/'], type=type) |
'''
94. Binary Tree Inorder Traversal
Medium
1231
51
Favorite
Share
Given a binary tree, return the inorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [1,3,2]
Follow up: Recursive solution is trivial, could you do it iteratively?
'''
# Definition for a bi... | """
94. Binary Tree Inorder Traversal
Medium
1231
51
Favorite
Share
Given a binary tree, return the inorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
2
/
3
Output: [1,3,2]
Follow up: Recursive solution is trivial, could you do it iteratively?
"""
class Solution:
de... |
class Inventory:
def add(item, slot, stat, bag):
bag = {
"slot": str(slot),
"stat": int(stat)
}
return bag; | class Inventory:
def add(item, slot, stat, bag):
bag = {'slot': str(slot), 'stat': int(stat)}
return bag |
BASE_URL = "https://www.booking.com/"
HEADERS = [
"Hotel Name",
"Type",
"Location",
"Date Range",
"adults",
"rooms",
"Score",
"price",
]
| base_url = 'https://www.booking.com/'
headers = ['Hotel Name', 'Type', 'Location', 'Date Range', 'adults', 'rooms', 'Score', 'price'] |
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.
CONTEXT_KEYS = ['reset', 'error', 'badinfo',
'in_browser', 'in_statusbar', 'in_titlebar', 'in_console',
'in_pager', 'in_taskview',
'active_pane', 'inactive_pane',
'... | context_keys = ['reset', 'error', 'badinfo', 'in_browser', 'in_statusbar', 'in_titlebar', 'in_console', 'in_pager', 'in_taskview', 'active_pane', 'inactive_pane', 'directory', 'file', 'hostname', 'executable', 'media', 'link', 'fifo', 'socket', 'device', 'video', 'audio', 'image', 'media', 'document', 'container', 'sel... |
class UnauthorizedEvalError(ValueError):
pass
class UnauthorizedNameAccess(UnauthorizedEvalError, NameError):
pass
class UnauthorizedCall(UnauthorizedEvalError):
pass
class UnauthorizedAttributeAccess(UnauthorizedEvalError):
pass
class UnauthorizedSubscript(UnauthorizedEvalError):
pass
| class Unauthorizedevalerror(ValueError):
pass
class Unauthorizednameaccess(UnauthorizedEvalError, NameError):
pass
class Unauthorizedcall(UnauthorizedEvalError):
pass
class Unauthorizedattributeaccess(UnauthorizedEvalError):
pass
class Unauthorizedsubscript(UnauthorizedEvalError):
pass |
class Macro:
def __init__(self, actions, check_sticky):
self.actions = actions
self.check_sticky = check_sticky
def step(self, current_sticky_actions):
while len(self.actions) > 0:
action = self.actions.pop(0)
if self.check_sticky and action not in current_sticky... | class Macro:
def __init__(self, actions, check_sticky):
self.actions = actions
self.check_sticky = check_sticky
def step(self, current_sticky_actions):
while len(self.actions) > 0:
action = self.actions.pop(0)
if self.check_sticky and action not in current_stick... |
# this program caluclate the sum from 1 to a given number
target_number = int(input("Enter a number up to which you wan to calculate the sum from 1: "))
sum_of_numbers = target_number
for n in range(1,target_number):
sum_of_numbers += n
print(f"The total sum of 1 to {target_number} is {sum_of_numbers}")
| target_number = int(input('Enter a number up to which you wan to calculate the sum from 1: '))
sum_of_numbers = target_number
for n in range(1, target_number):
sum_of_numbers += n
print(f'The total sum of 1 to {target_number} is {sum_of_numbers}') |
class Solution:
def solve(self, s):
last_char = ""
cur_streak_length = 0
best_ans = 0
for i in range(len(s)):
cur_char = s[i]
if cur_char == last_char:
cur_streak_length += 1
else:
cur_streak_length = 1
last_char = c... | class Solution:
def solve(self, s):
last_char = ''
cur_streak_length = 0
best_ans = 0
for i in range(len(s)):
cur_char = s[i]
if cur_char == last_char:
cur_streak_length += 1
else:
cur_streak_length = 1
... |
"""
Compare two version numbers version1 and version2.
If version1 > version2 return 1, if version1 < version2 return -1, otherwise
return 0.
You may assume that the version strings are non-empty and contain only digits
and the . character.
The . character does not represent a decimal point and is used to separate
num... | """
Compare two version numbers version1 and version2.
If version1 > version2 return 1, if version1 < version2 return -1, otherwise
return 0.
You may assume that the version strings are non-empty and contain only digits
and the . character.
The . character does not represent a decimal point and is used to separate
num... |
#
# PySNMP MIB module STN-POLICY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-POLICY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:11:31 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, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, constraints_intersection, value_range_constraint) ... |
def main():
# input
N, M = map(int, input().split())
scs = [list(map(int, input().split())) for _ in range(M)]
# compute
if N == 1:
numbers = range(0, 10)
elif N == 2:
numbers = range(10, 100)
else:
numbers = range(100, 1000)
for i in numbers:
flag = True... | def main():
(n, m) = map(int, input().split())
scs = [list(map(int, input().split())) for _ in range(M)]
if N == 1:
numbers = range(0, 10)
elif N == 2:
numbers = range(10, 100)
else:
numbers = range(100, 1000)
for i in numbers:
flag = True
number = list(ma... |
#Crie um programa que diga 'Hello World'
msg = 'Hello World!'
print( msg )
| msg = 'Hello World!'
print(msg) |
class car:
def __init__(self):
self.__fuelling()
def drive(self):
print("Driving..!!")
def __fuelling(self):
print("Refilling Gas")
volvo=car()
volvo.drive()
volvo._car__fuelling() | class Car:
def __init__(self):
self.__fuelling()
def drive(self):
print('Driving..!!')
def __fuelling(self):
print('Refilling Gas')
volvo = car()
volvo.drive()
volvo._car__fuelling() |
def dump_vector(x):
return ",".join(map(str, x))
def dump_matrix(xs):
vs = map(dump_vector, xs)
return "{0}#{1}#{2}".format(xs.shape[0], xs.shape[1], "|".join(vs))
def dump_pca(pca):
return "{0}\n{1}".format(dump_matrix(pca.components_.T), dump_vector(pca.mean_))
def dump_mlp(mlp):
activation = m... | def dump_vector(x):
return ','.join(map(str, x))
def dump_matrix(xs):
vs = map(dump_vector, xs)
return '{0}#{1}#{2}'.format(xs.shape[0], xs.shape[1], '|'.join(vs))
def dump_pca(pca):
return '{0}\n{1}'.format(dump_matrix(pca.components_.T), dump_vector(pca.mean_))
def dump_mlp(mlp):
activation = m... |
def meets_criteria(number):
num_str = str(number)
# check to see if two number are the same next to each other
i = 1
previous = num_str[0]
while i < 6 :
if previous == num_str[i]:
break
previous = num_str[i]
i+=1
if i == 6:
return 0
# no more ... | def meets_criteria(number):
num_str = str(number)
i = 1
previous = num_str[0]
while i < 6:
if previous == num_str[i]:
break
previous = num_str[i]
i += 1
if i == 6:
return 0
i = 1
found_double = 0
same = 0
previous = num_str[0]
while i <... |
___assertEqual(+False, 0)
___assertIsNot(+False, False)
___assertEqual(-False, 0)
___assertIsNot(-False, False)
___assertEqual(abs(False), 0)
___assertIsNot(abs(False), False)
___assertEqual(+True, 1)
___assertIsNot(+True, True)
___assertEqual(-True, -1)
___assertEqual(abs(True), 1)
___assertIsNot(abs(True), True)
___a... | ___assert_equal(+False, 0)
___assert_is_not(+False, False)
___assert_equal(-False, 0)
___assert_is_not(-False, False)
___assert_equal(abs(False), 0)
___assert_is_not(abs(False), False)
___assert_equal(+True, 1)
___assert_is_not(+True, True)
___assert_equal(-True, -1)
___assert_equal(abs(True), 1)
___assert_is_not(abs(T... |
# Will keep track of all the variables and their values
class SymbolTable:
def __init__(self):
self.symbols = {}
def get(self, name):
value = self.symbols.get(name, None)
return value
def set(self, name, value):
self.symbols[name] = value
def remove(self, name):
... | class Symboltable:
def __init__(self):
self.symbols = {}
def get(self, name):
value = self.symbols.get(name, None)
return value
def set(self, name, value):
self.symbols[name] = value
def remove(self, name):
del self.symbols[name] |
class BoidRuleAvoid:
fear_factor = None
object = None
use_predict = None
| class Boidruleavoid:
fear_factor = None
object = None
use_predict = None |
#!/usr/bin/env python
# Whites/Pastels
snow = (255, 250, 250)
snow2 = (238, 233, 233)
snow3 = (205, 201, 201)
snow4 = (139, 137, 137)
ghost_white = (248, 248, 255)
white_smoke = (245, 245, 245)
gainsboro = (220, 220, 220)
white = (255, 255, 255)
# Grays
black = (0, 0, 0)
dark_slate_black = (49, 79, 79)
dim_gray = (105... | snow = (255, 250, 250)
snow2 = (238, 233, 233)
snow3 = (205, 201, 201)
snow4 = (139, 137, 137)
ghost_white = (248, 248, 255)
white_smoke = (245, 245, 245)
gainsboro = (220, 220, 220)
white = (255, 255, 255)
black = (0, 0, 0)
dark_slate_black = (49, 79, 79)
dim_gray = (105, 105, 105)
slate_gray = (112, 138, 144)
light_s... |
"""
This is the core of deep learning: (1) Take an input and desired output, (2) Search for their correlation
"""
def compute_error(b, m, coordinates):
"""
m is the coefficient and b is the constant for prediction
The goal is to find a combination of m and b where the error is as small as possible
coor... | """
This is the core of deep learning: (1) Take an input and desired output, (2) Search for their correlation
"""
def compute_error(b, m, coordinates):
"""
m is the coefficient and b is the constant for prediction
The goal is to find a combination of m and b where the error is as small as possible
coor... |
hashicorp_base_url = "https://releases.hashicorp.com"
def _terraform_download_impl(ctx):
platform = _detect_platform(ctx)
version = ctx.attr.version
# First get SHA256SUMS file so we can get all of the individual zip SHAs
ctx.report_progress("Downloading and extracting SHA256SUMS file")
sha256sums... | hashicorp_base_url = 'https://releases.hashicorp.com'
def _terraform_download_impl(ctx):
platform = _detect_platform(ctx)
version = ctx.attr.version
ctx.report_progress('Downloading and extracting SHA256SUMS file')
sha256sums_url = '{base}/terraform/{version}/terraform_{version}_SHA256SUMS'.format(base... |
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements; and to You under the Apache License, Version 2.0.
"""OpenWhisk "Hello world" in Python.
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
// license agreements; and to You under the A... | """OpenWhisk "Hello world" in Python.
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
// license agreements; and to You under the Apache License, Version 2.0.
"""
def main(dict):
"""Hello world."""
if 'name' in dict:
name = dict['name']
else:
name = 'stran... |
# OSEK Builder Global Variables (OB Globals)
# ------------------------------------------
# list of column titles in TASK tab of OSEX-Builder.xlsx
TaskParams = ["Task Name", "PRIORITY", "SCHEDULE", "ACTIVATION", "AUTOSTART",
"RESOURCE", "EVENT", "MESSAGE", "STACK_SIZE"]
TNMI = 0
PRII = 1
SCHI = 2
ACTI = 3
ATSI = 4... | task_params = ['Task Name', 'PRIORITY', 'SCHEDULE', 'ACTIVATION', 'AUTOSTART', 'RESOURCE', 'EVENT', 'MESSAGE', 'STACK_SIZE']
tnmi = 0
prii = 1
schi = 2
acti = 3
atsi = 4
resi = 5
evti = 6
msgi = 7
stsz = 8
cntr_params = ['Counter Name', 'MINCYCLE', 'MAXALLOWEDVALUE', 'TICKSPERBASE', 'TICKDURATION']
cnme = 0
alarm_param... |
# -*- coding: utf-8 -*-
{
'name': 'Chapter 14 code for the mail template recipe',
'depends': ['mail', 'report_py3o'],
'data': [
'views/library_book.xml',
'views/library_member.xml',
'data/py3o_server.xml',
'reports/book_loan_report.xml'
],
'demo': ['demo/demo.xml'],
}... | {'name': 'Chapter 14 code for the mail template recipe', 'depends': ['mail', 'report_py3o'], 'data': ['views/library_book.xml', 'views/library_member.xml', 'data/py3o_server.xml', 'reports/book_loan_report.xml'], 'demo': ['demo/demo.xml']} |
#Write a Python program to remove duplicates from a list.
sample_list = [10, 20, 30, 20, 10, 50, 60, 40, 80, 50, 40]
duplicate_items =set()
unique_list = []
for num in sample_list:
if num not in duplicate_items:
unique_list.append(num)
duplicate_items.add(num)
print(unique_list) | sample_list = [10, 20, 30, 20, 10, 50, 60, 40, 80, 50, 40]
duplicate_items = set()
unique_list = []
for num in sample_list:
if num not in duplicate_items:
unique_list.append(num)
duplicate_items.add(num)
print(unique_list) |
"""
Utils for URLs (to avoid circular imports)
"""
DASHBOARD_URL = '/dashboard/'
PROFILE_URL = '/profile/'
PROFILE_PERSONAL_URL = '{}personal/?'.format(PROFILE_URL)
PROFILE_EDUCATION_URL = '{}education/?'.format(PROFILE_URL)
PROFILE_EMPLOYMENT_URL = '{}professional/?'.format(PROFILE_URL)
SETTINGS_URL = "/settings/"
SE... | """
Utils for URLs (to avoid circular imports)
"""
dashboard_url = '/dashboard/'
profile_url = '/profile/'
profile_personal_url = '{}personal/?'.format(PROFILE_URL)
profile_education_url = '{}education/?'.format(PROFILE_URL)
profile_employment_url = '{}professional/?'.format(PROFILE_URL)
settings_url = '/settings/'
sea... |
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if not strs:
return ''
res=""
strs.sort()
for i in xrange(len(strs[0])):
if strs[0][i]==strs[-1][i]:
... | class Solution(object):
def longest_common_prefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if not strs:
return ''
res = ''
strs.sort()
for i in xrange(len(strs[0])):
if strs[0][i] == strs[-1][i]:
r... |
# coding: utf-8
class CartesianProduct:
def extract(self,val,row):
if isinstance(val, list):
for v in val:
row.append(v)
else:
row.append(val)
def combi(self,x, y, result):
#print("combi before",x,y,result)
row = []
for i in x:
... | class Cartesianproduct:
def extract(self, val, row):
if isinstance(val, list):
for v in val:
row.append(v)
else:
row.append(val)
def combi(self, x, y, result):
row = []
for i in x:
for j in y:
self.extract(i, r... |
def keywordMatching(amazonTitle,wallmartTitles,wallmartPrices,wallmartIds):
#whitelist of letters
whitelist = set('abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ')
amazonTitle = ''.join(filter(whitelist.__contains__, amazonTitle))
titles = []
commonalities = []
for i in wallmartTitles:... | def keyword_matching(amazonTitle, wallmartTitles, wallmartPrices, wallmartIds):
whitelist = set('abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ')
amazon_title = ''.join(filter(whitelist.__contains__, amazonTitle))
titles = []
commonalities = []
for i in wallmartTitles:
common_words = ... |
# -*- coding: utf-8 -*-
'''
File name: code\gozinta_chains\sol_548.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #548 :: Gozinta Chains
#
# For more information see:
# https://projecteuler.net/problem=548
# Problem Statement
'''
A goz... | """
File name: code\\gozinta_chains\\sol_548.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
"""
'\nA gozinta chain for n is a sequence {1,a,b,...,n} where each element properly divides the next.\nThere are eight gozinta chains for 12:\n{1,12} ,{1,2,12}, {1,2,4,12}, {1,2,6,12}, {1... |
class RandomVariable:
def __init__(self):
self._parametrization = None
def sample(self):
pass
def as_tensor(self):
pass
def make_parametrization(self):
pass
class Parametrization:
def __init__(self):
self._free_vars = []
self._trainable_params = [... | class Randomvariable:
def __init__(self):
self._parametrization = None
def sample(self):
pass
def as_tensor(self):
pass
def make_parametrization(self):
pass
class Parametrization:
def __init__(self):
self._free_vars = []
self._trainable_params = ... |
lines = [l.strip() for l in open('input.txt', 'r').readlines()]
p1, p2, first_player = [], [], True
for line in lines:
if 'Player 2' in line:
first_player = False
if not line or 'Player' in line:
continue
if first_player:
p1.append(int(line))
else:
p2.append(int(line))
def determine_winner(p1, p2):
memo... | lines = [l.strip() for l in open('input.txt', 'r').readlines()]
(p1, p2, first_player) = ([], [], True)
for line in lines:
if 'Player 2' in line:
first_player = False
if not line or 'Player' in line:
continue
if first_player:
p1.append(int(line))
else:
p2.append(int(line)... |
# fibonacci: int -> int
# calcula el n-esimo numero de la sucesion de fibonacci
# ejemplo: fibonacci(7) debe dar 13
def fibonacci(n):
assert type(n) == int and n>=0
if n<2:
# caso base
return n
else:
# caso recursivo
return fibonacci(n-1) + fibonacci(n-2)
# test:
assert fib... | def fibonacci(n):
assert type(n) == int and n >= 0
if n < 2:
return n
else:
return fibonacci(n - 1) + fibonacci(n - 2)
assert fibonacci(0) == 0
assert fibonacci(1) == 1
assert fibonacci(2) == 1
assert fibonacci(7) == 13 |
def get_gnn_config(parser):
parser.add_argument('--ggnn_keep_prob', type=float, default=0.8)
parser.add_argument('--t_step', type=int, default=3)
parser.add_argument('--embed_layer', type=int, default=1)
parser.add_argument('--embed_neuron', type=int, default=256)
parser.add_argument('--prop_lay... | def get_gnn_config(parser):
parser.add_argument('--ggnn_keep_prob', type=float, default=0.8)
parser.add_argument('--t_step', type=int, default=3)
parser.add_argument('--embed_layer', type=int, default=1)
parser.add_argument('--embed_neuron', type=int, default=256)
parser.add_argument('--prop_layer',... |
"""Package management"""
# Copy paste this at the top of a file to have it work with with both modulare
# imports and running as a direct script
# import os
# import sys
#
# sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../') | """Package management""" |
BLACK = 0x000000
WHITE = 0xFFFFFF
GRAY = 0x888888
DARKGRAY = 0x484848
ORANGE = 0xFF8800
DARKORANGE = 0xF18701
LIGHTBLUE = 0x5C92D1
BLUE = 0x0000C0
GREEN = 0x00FF00
PASTEL_GREEN = 0x19DF82
SMOKY_GREEN = 0x03876D
PINK = 0xD643BB
PURPLE = 0x952489
DEEP_PURPLE = 0x890C32
YELLOW = 0xF4ED06
# RED = 0xC80A24
RED = 0xDE0A07
BR... | black = 0
white = 16777215
gray = 8947848
darkgray = 4737096
orange = 16746496
darkorange = 15828737
lightblue = 6066897
blue = 192
green = 65280
pastel_green = 1695618
smoky_green = 231277
pink = 14042043
purple = 9774217
deep_purple = 8981554
yellow = 16051462
red = 14551559
brown = 10173989 |
# pytools/recursion/subsets.py
#
# Author: Daniel Clark, 2016
'''
This module contains functions to return all of the subsets of a given
set
'''
def subsets_reduce(input_set):
'''
Reduce function method for returning all subsets of a set
'''
return reduce(lambda z, x: z + [y + [x] for y in z],
... | """
This module contains functions to return all of the subsets of a given
set
"""
def subsets_reduce(input_set):
"""
Reduce function method for returning all subsets of a set
"""
return reduce(lambda z, x: z + [y + [x] for y in z], input_set, [[]])
def subsets(input_set):
"""
Return all subse... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
##f1(node) be the value of maximum money we can rob from the subtree with node as root ( we can rob node if necessary).
##f2(node) be the value of maximum m... | class Solution:
def rob(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def rob_dfs(node):
if node is None:
return (0, 0)
ll = rob_dfs(node.left)
rr = rob_dfs(node.right)
return (ll[1] + rr[1], max(ll[1] ... |
number_grid = [ [1, 2, 4],
[2, 5, 6],
[3, 4, 6] ]
print(number_grid[0][0])
print(number_grid[2][2])
| number_grid = [[1, 2, 4], [2, 5, 6], [3, 4, 6]]
print(number_grid[0][0])
print(number_grid[2][2]) |
def partition(lst, low, high):
# pick last element as pivot
pivot = lst[high]
# index of where pivot should be
index = low
for j in range(low, high):
if lst[j] < pivot:
lst[index], lst[j] = lst[j], lst[index]
index += 1
# place pivot at index
lst[index], lst[h... | def partition(lst, low, high):
pivot = lst[high]
index = low
for j in range(low, high):
if lst[j] < pivot:
(lst[index], lst[j]) = (lst[j], lst[index])
index += 1
(lst[index], lst[high]) = (lst[high], lst[index])
return index
def quick_sort(lst, low, high):
if low... |
USERNAME = None
PASSWORD = None
REQUESTS_URL = 'https://ebusiness.dpb.nhs.uk/claimsrequests.asp'
RESPONSE_URL = 'https://ebusiness.dpb.nhs.uk/claimsresponses.asp'
| username = None
password = None
requests_url = 'https://ebusiness.dpb.nhs.uk/claimsrequests.asp'
response_url = 'https://ebusiness.dpb.nhs.uk/claimsresponses.asp' |
# name_to_binary.py
def to_binary(name):
text = ''
for let in name:
code = ord(let)
text += bin(code).replace('0b', '')
return text
# __main__
string = input("Enter a name: ")
binary = to_binary(string)
print(binary)
| def to_binary(name):
text = ''
for let in name:
code = ord(let)
text += bin(code).replace('0b', '')
return text
string = input('Enter a name: ')
binary = to_binary(string)
print(binary) |
class Config(object):
_config = {}
@classmethod
def get_config(cls, name):
return cls._config.get(name, None)
@classmethod
def set_config(cls, name, config):
config_dict = {key: getattr(config, key) for key in dir(config) if
not key.startswith('__') and not c... | class Config(object):
_config = {}
@classmethod
def get_config(cls, name):
return cls._config.get(name, None)
@classmethod
def set_config(cls, name, config):
config_dict = {key: getattr(config, key) for key in dir(config) if not key.startswith('__') and (not callable(key))}
... |
#choose 4-9.py
cubes=[value**3 for value in range(1,11)]
print(cubes)
print("The first three items in the list are: "+str(cubes[:3]))
print("Three items from the middle of the list are: "+str(cubes[4:7]))
print("The last three items in the list are: "+str(cubes[-3:]))
| cubes = [value ** 3 for value in range(1, 11)]
print(cubes)
print('The first three items in the list are: ' + str(cubes[:3]))
print('Three items from the middle of the list are: ' + str(cubes[4:7]))
print('The last three items in the list are: ' + str(cubes[-3:])) |
def extract_shapekey(c):
d=c.split(",")
e=d[0]
f=d[1]
g=e.split("(")
h=f.split(")")
part_1=g[1]
part_2=h[0]
shapekey=(int(part_1),int(part_2))
return shapekey | def extract_shapekey(c):
d = c.split(',')
e = d[0]
f = d[1]
g = e.split('(')
h = f.split(')')
part_1 = g[1]
part_2 = h[0]
shapekey = (int(part_1), int(part_2))
return shapekey |
def find_full_matches(sequence, answer):
return find_sub_list(answer, sequence)
def find_matches(sequence, answer):
elements = set(answer)
return [index for index, value in enumerate(sequence) if value in elements]
def find_sub_list(sublist, list):
results = []
sll = len(sublist)
for ind in ... | def find_full_matches(sequence, answer):
return find_sub_list(answer, sequence)
def find_matches(sequence, answer):
elements = set(answer)
return [index for (index, value) in enumerate(sequence) if value in elements]
def find_sub_list(sublist, list):
results = []
sll = len(sublist)
for ind in ... |
def fact(n):
fact=1
for i in range(1,n+1):
fact=fact*i
return fact
num=int(input("enter a number: "))
factorial=fact(num)
print(factorial)
| def fact(n):
fact = 1
for i in range(1, n + 1):
fact = fact * i
return fact
num = int(input('enter a number: '))
factorial = fact(num)
print(factorial) |
class AddInId(object, IDisposable):
"""
Identifies an AddIn registered with Revit
AddInId(val: Guid)
"""
def Dispose(self):
""" Dispose(self: AddInId) """
pass
def GetAddInName(self):
"""
GetAddInName(self: AddInId) -> str
name of addin associate... | class Addinid(object, IDisposable):
"""
Identifies an AddIn registered with Revit
AddInId(val: Guid)
"""
def dispose(self):
""" Dispose(self: AddInId) """
pass
def get_add_in_name(self):
"""
GetAddInName(self: AddInId) -> str
name of addin associated with this AddI... |
_base_ = [
'../_base_/models/mask_rcnn_r50_fpn_22cls.py',
'../_base_/datasets/trashcan_instance.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
| _base_ = ['../_base_/models/mask_rcnn_r50_fpn_22cls.py', '../_base_/datasets/trashcan_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'] |
def compute_potential_drain(height_change, rover):
mars_grav_constant = 3.177
potential_change = height_change * rover.mass * mars_grav_constant / 10
return (0, potential_change)[potential_change > 0]
def compute_energy_drain(old_loc, new_loc, rover):
min_adjust = rover.battery_base_movement
min... | def compute_potential_drain(height_change, rover):
mars_grav_constant = 3.177
potential_change = height_change * rover.mass * mars_grav_constant / 10
return (0, potential_change)[potential_change > 0]
def compute_energy_drain(old_loc, new_loc, rover):
min_adjust = rover.battery_base_movement
min_ad... |
print("This is practice of everything in the first half of the book...Round 2 Review ")
print('You\'d need to know \'bout escapes with \\ that do: ')
print('\n newlines and \t tabs.')
poem = """
\t The lovely world
with logic so firmly planted
cannot discern \n the needs of love
nor comprehend passion from intuition
a... | print('This is practice of everything in the first half of the book...Round 2 Review ')
print("You'd need to know 'bout escapes with \\ that do: ")
print('\n newlines and \t tabs.')
poem = '\n\t The lovely world\nwith logic so firmly planted\ncannot discern \n the needs of love\nnor comprehend passion from intuition\na... |
# http://www.django-rest-framework.org/
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'ara.classes.pagination.PageNumberPagination',
'DEFAULT_FILTER_BACKENDS': (
'rest_framework_filters.backends.RestFrameworkFilterBackend',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions... | rest_framework = {'DEFAULT_PAGINATION_CLASS': 'ara.classes.pagination.PageNumberPagination', 'DEFAULT_FILTER_BACKENDS': ('rest_framework_filters.backends.RestFrameworkFilterBackend',), 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.AllowAny',), 'PAGE_SIZE': 15, 'SERIALIZER_EXTENSIONS': {'AUTO_OPTIMIZE': Tru... |
"""
"""
__author__ = 'Yukinari Tani'
__version__ = '0.1'
__licence__ = 'MIT'
| """
"""
__author__ = 'Yukinari Tani'
__version__ = '0.1'
__licence__ = 'MIT' |
def iq_test(numbers):
lst=numbers.split(" ")
odd=0
even = 0
for i in lst:
if float(i)%2==0:
even=even+1
else:
odd+=1
u="e" if even>odd else "o"
if u=="e":
for i in lst:
if float(i)%2!=0:
indexval=lst.index(i... | def iq_test(numbers):
lst = numbers.split(' ')
odd = 0
even = 0
for i in lst:
if float(i) % 2 == 0:
even = even + 1
else:
odd += 1
u = 'e' if even > odd else 'o'
if u == 'e':
for i in lst:
if float(i) % 2 != 0:
indexval ... |
# do not change this line manually
# this is managed by git tag and updated on every release
__version__ = '0.0.46'
# do not change this line manually
# this is managed by shell/make-proto.sh and updated on every execution
__proto_version__ = '0.0.10'
| __version__ = '0.0.46'
__proto_version__ = '0.0.10' |
class Solution:
def sortList(self, node: ListNode) -> ListNode:
"""O(nlogn) time"""
if not node or node.next is None: return node
slow = node
fast = node.next
while fast is not None:
if fast.next is None: break
slow = slow.next
... | class Solution:
def sort_list(self, node: ListNode) -> ListNode:
"""O(nlogn) time"""
if not node or node.next is None:
return node
slow = node
fast = node.next
while fast is not None:
if fast.next is None:
break
slow = slow... |
YES_NO = ["No", "Yes"]
FEATURES = [
("Name", None),
("Does it have fur?", YES_NO),
("Does it have feathers?", YES_NO),
("Does it lay eggs?", YES_NO),
("Does it produce milk?", YES_NO),
("Can it fly?", YES_NO),
("Can it swim?", YES_NO),
("Is it a predator?", YES_NO),
("Does it have t... | yes_no = ['No', 'Yes']
features = [('Name', None), ('Does it have fur?', YES_NO), ('Does it have feathers?', YES_NO), ('Does it lay eggs?', YES_NO), ('Does it produce milk?', YES_NO), ('Can it fly?', YES_NO), ('Can it swim?', YES_NO), ('Is it a predator?', YES_NO), ('Does it have teeth?', YES_NO), ('Does it have a back... |
'''
See:
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
'''
class HttpStatusCode(object):
# 1xx
CONTINUE = 100
SWITCHING_PROTOCOLS = 101
PROCESSING = 102
# 2xx
OK = 200
CREATED = 201
ACCEPTED = 202
NON_AUTHORITATIVE_INFORMATION = 203
NO_CONTENT = 204
RESET_CONTENT ... | """
See:
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
"""
class Httpstatuscode(object):
continue = 100
switching_protocols = 101
processing = 102
ok = 200
created = 201
accepted = 202
non_authoritative_information = 203
no_content = 204
reset_content = 205
partial_cont... |
class Mission:
def __init__(self, name, func):
self.name = name
self._func = func
def run(self):
self._func() | class Mission:
def __init__(self, name, func):
self.name = name
self._func = func
def run(self):
self._func() |
# -*- coding: utf-8 -*-
# Load appconfid
default_app_config = 'devilry.devilry_qualifiesforexam_plugin_points.apps.DevilryQualifiesForExamPointsAppConfig'
| default_app_config = 'devilry.devilry_qualifiesforexam_plugin_points.apps.DevilryQualifiesForExamPointsAppConfig' |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# vim: fenc=utf-8
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
#
"""
File name: list_misc.py
Author: dhilipsiva <dhilipsiva@gmail.com>
Date created: 2017-01-15
"""
DOMAINS = [
"006.free-counter.co.uk",
"006.freecounters.co.uk",
"0101011.com",
... | """
File name: list_misc.py
Author: dhilipsiva <dhilipsiva@gmail.com>
Date created: 2017-01-15
"""
domains = ['006.free-counter.co.uk', '006.freecounters.co.uk', '0101011.com', '0427d7.se', '05tz2e9.com', '06272002-dbase.hitcountz.net', '09killspyware.com', '0d79ed.r.axf8.net', '0pn.ru', '0qizz.super-promo.hoxo.info', ... |
def P_G(G, i, n):
t = (1 + i) ** n
return (G / i) * (((t - 1) / (i * t)) - (n / t))
def A_G(G, i, n):
t = (1 + i) ** n
return G * ((1/i) - (n / (t - 1)))
| def p_g(G, i, n):
t = (1 + i) ** n
return G / i * ((t - 1) / (i * t) - n / t)
def a_g(G, i, n):
t = (1 + i) ** n
return G * (1 / i - n / (t - 1)) |
def checkio(number: int) -> str:
res = str(number);
if(number % 5 == 0 and number % 3 == 0):
return "Fizz Buzz";
elif(number % 3 == 0):
return "Fizz";
elif(number % 5 == 0):
return "Buzz";
return res; | def checkio(number: int) -> str:
res = str(number)
if number % 5 == 0 and number % 3 == 0:
return 'Fizz Buzz'
elif number % 3 == 0:
return 'Fizz'
elif number % 5 == 0:
return 'Buzz'
return res |
# -*- coding: utf-8 -*-
# Scrapy settings; see https://doc.scrapy.org/en/latest/topics/settings.html#
BOT_NAME = 'jailscraper'
SPIDER_MODULES = ['jailscraper.spiders']
NEWSPIDER_MODULE = 'jailscraper.spiders'
RETRY_ENABLED = False
USER_AGENT = 'ProPublica Cook County Jail Scraper - contact david.eads@propublica.org... | bot_name = 'jailscraper'
spider_modules = ['jailscraper.spiders']
newspider_module = 'jailscraper.spiders'
retry_enabled = False
user_agent = 'ProPublica Cook County Jail Scraper - contact david.eads@propublica.org for details'
cookies_enabled = False
robotstxt_obey = True
concurrent_requests = 12
autothrottle_enabled ... |
"""Base driver module to inherit from."""
class BaseDriver(object):
"""Base driver that will be called from all pages and elements."""
# pylint: disable=too-few-public-methods
def __init__(self, driver):
"""Create the base driver object."""
self.driver = driver
| """Base driver module to inherit from."""
class Basedriver(object):
"""Base driver that will be called from all pages and elements."""
def __init__(self, driver):
"""Create the base driver object."""
self.driver = driver |
FEA_DIMENSION = 80
label_dict = {'alv': 0, 'fas': 1, 'prs': 2, 'pus': 3, 'urd': 4, 'mul': 5}
path_conf = {
"dev_data": '',
"dev_labels": '',
"train_list": '',
}
log_conf = {
"base_dir": '',
"file_name": '',
}
summary_conf = {
"checkpoint_dir": '',
"model_directory": '',
"model_name":... | fea_dimension = 80
label_dict = {'alv': 0, 'fas': 1, 'prs': 2, 'pus': 3, 'urd': 4, 'mul': 5}
path_conf = {'dev_data': '', 'dev_labels': '', 'train_list': ''}
log_conf = {'base_dir': '', 'file_name': ''}
summary_conf = {'checkpoint_dir': '', 'model_directory': '', 'model_name': ''}
model_conf = {'gru_layer1_units': 256,... |
#
# PySNMP MIB module IPOMANII-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPOMANII-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:45:07 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,... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) ... |
"""Software class"""
class Software:
def __init__(self, name):
self.name = name
self._images = []
def add_image(self, image):
self._images.append(image)
def images(self):
return sorted(self._images, key=lambda i: i.path)
def nb_images(self):
return len(self.... | """Software class"""
class Software:
def __init__(self, name):
self.name = name
self._images = []
def add_image(self, image):
self._images.append(image)
def images(self):
return sorted(self._images, key=lambda i: i.path)
def nb_images(self):
return len(self._... |
def test_signup_page(test_client):
"""
GIVEN a Flask application configured for testing
WHEN the '/signup' page is requested (GET)
THEN check that the response is valid
"""
response = test_client.get('/sign-up')
assert response.status_code == 200
assert b"Currency Exchange" in response.d... | def test_signup_page(test_client):
"""
GIVEN a Flask application configured for testing
WHEN the '/signup' page is requested (GET)
THEN check that the response is valid
"""
response = test_client.get('/sign-up')
assert response.status_code == 200
assert b'Currency Exchange' in response.d... |
class AioDiskDBException(Exception):
pass
class RunningException(AioDiskDBException):
pass
class NotRunningException(AioDiskDBException):
pass
class TimeoutException(AioDiskDBException):
pass
class ReadTimeoutException(AioDiskDBException):
pass
class DBNotInitializedException(AioDiskDBExce... | class Aiodiskdbexception(Exception):
pass
class Runningexception(AioDiskDBException):
pass
class Notrunningexception(AioDiskDBException):
pass
class Timeoutexception(AioDiskDBException):
pass
class Readtimeoutexception(AioDiskDBException):
pass
class Dbnotinitializedexception(AioDiskDBException... |
"""
houses support routines and the command-line dispatchers for carml
command.
"""
__all__ = []
__version__ = '20.0.0'
| """
houses support routines and the command-line dispatchers for carml
command.
"""
__all__ = []
__version__ = '20.0.0' |
''' Provides a set of normalizing functions
'''
FAKE_SCROLL_ID = 'fake-scroll-id'
def normalizeResponse(response):
'''
Take raw a raw Elasticsearch response and fix it for the Fake
implemenation
'''
# Remove these fields
remove = ['_shards', 'timed_out', 'took']
for field in remove:
... | """ Provides a set of normalizing functions
"""
fake_scroll_id = 'fake-scroll-id'
def normalize_response(response):
"""
Take raw a raw Elasticsearch response and fix it for the Fake
implemenation
"""
remove = ['_shards', 'timed_out', 'took']
for field in remove:
if field in response:
... |
# input
drink_type = input()
sugar = input()
drinks_count = int(input())
drink_price = 0
if drink_type == 'Espresso':
if sugar == 'Without':
drink_price = 0.90
elif sugar == 'Normal':
drink_price = 1
elif sugar == 'Extra':
drink_price = 1.20
elif drink_type == 'Cappuccino':
if ... | drink_type = input()
sugar = input()
drinks_count = int(input())
drink_price = 0
if drink_type == 'Espresso':
if sugar == 'Without':
drink_price = 0.9
elif sugar == 'Normal':
drink_price = 1
elif sugar == 'Extra':
drink_price = 1.2
elif drink_type == 'Cappuccino':
if sugar == 'Wi... |
a = [1, 2, 3, 4]
sumNum = 0
for i in a:
# In the for loop, "i" will sequentially read the values in list a.
sumNum += i
# sumNum = sumNum + i, means, 0 + 1 > (0+1) + 2 > (1+2) + 3 > (3+3) + 4
print(sumNum)
| a = [1, 2, 3, 4]
sum_num = 0
for i in a:
sum_num += i
print(sumNum) |
# Constant.py
# Color
BLUE = 'BLUE'
GREEN = 'GREEN'
# LISTENER
HTTPS_TUPLE = ('HTTPS', 443)
HTTP_TUPLE = ('HTTP', 80)
# Target group
TARGET_GROUP_COLOR_TAG_NAME = 'Color'
TARGET_GROUP_TYPE_TAG_NAME = 'Type'
# Default type means 'api gateway'
TARGET_GROUP_DEFAULT_TYPE = 'DEFAULT'
TARGET_GROUP_MAINTENANCE_TYPE = 'MAIN... | blue = 'BLUE'
green = 'GREEN'
https_tuple = ('HTTPS', 443)
http_tuple = ('HTTP', 80)
target_group_color_tag_name = 'Color'
target_group_type_tag_name = 'Type'
target_group_default_type = 'DEFAULT'
target_group_maintenance_type = 'MAINTENANCE'
ecr_service_prefix = 'lcdp-'
default_desired_count = 2
default_max_capacity =... |
class ConfigurationException(Exception):
pass
class InternalException(Exception):
pass
class InvalidMessage(Exception):
pass
class InvalidPartialUpdate(Exception):
pass
| class Configurationexception(Exception):
pass
class Internalexception(Exception):
pass
class Invalidmessage(Exception):
pass
class Invalidpartialupdate(Exception):
pass |
def f(x: int):
y = x
def g(i: int):
f(i + 2)
g(3)
| def f(x: int):
y = x
def g(i: int):
f(i + 2)
g(3) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.