content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class RotationMatrix(object):
def __init__(self, M, N, entries):
self.M, self.N = M, N
self.entries = dict(entries)
self.tier_index = self._create_tier_index()
def __str__(self):
string = ""
for i in range(self.M):
for j in range(self.N):
... | class Rotationmatrix(object):
def __init__(self, M, N, entries):
(self.M, self.N) = (M, N)
self.entries = dict(entries)
self.tier_index = self._create_tier_index()
def __str__(self):
string = ''
for i in range(self.M):
for j in range(self.N):
... |
__version__ = "0.0.10"
__description__ = "Python client for interfacing with NTCore"
__license__ = "Apache 2.0"
__maintainer__ = "NTCore"
__maintainer_email__ = "info@nantutech.com"
__title__ = "ntcore"
__url__ = "https://www.nantu.io/" | __version__ = '0.0.10'
__description__ = 'Python client for interfacing with NTCore'
__license__ = 'Apache 2.0'
__maintainer__ = 'NTCore'
__maintainer_email__ = 'info@nantutech.com'
__title__ = 'ntcore'
__url__ = 'https://www.nantu.io/' |
def get_the_2nd_lower( stu_list ):
min_grade = min( stu_list, key = lambda x: x[1])[1]
#print( min_grade )
stu_list_without_lowest = [ s for s in stu_list if s[1] != min_grade]
# sort with student's name of ascending order
stu_list_without_lowest.sort( key = lambda x:x[0])
# get second lowe... | def get_the_2nd_lower(stu_list):
min_grade = min(stu_list, key=lambda x: x[1])[1]
stu_list_without_lowest = [s for s in stu_list if s[1] != min_grade]
stu_list_without_lowest.sort(key=lambda x: x[0])
second_lower = min(stu_list_without_lowest, key=lambda x: x[1])[1]
for s in stu_list_without_lowest:... |
def padovan(n):
res=[1,1,1]
for i in range(n-2):
res.append(res[-2]+res[-3])
return res[n] | def padovan(n):
res = [1, 1, 1]
for i in range(n - 2):
res.append(res[-2] + res[-3])
return res[n] |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# Recursive DFS
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if root == None:
return 0
else:
left_height = se... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def max_depth(self, root: TreeNode) -> int:
if root == None:
return 0
else:
left_height = self.maxDepth(root.left)
right_height = ... |
# Copyright (c) 2020, Vercer Ltd. Rights set out in LICENCE.txt
class StatementAlreadyPreparedException(Exception):
pass
class StatementNotPreparedException(Exception):
pass
class PreparedQueryNotSupported(Exception):
pass
class CannotAlterPreparedStatementQuerySet(Exception):
pass
class Prepa... | class Statementalreadypreparedexception(Exception):
pass
class Statementnotpreparedexception(Exception):
pass
class Preparedquerynotsupported(Exception):
pass
class Cannotalterpreparedstatementqueryset(Exception):
pass
class Preparedstatementnotyetexecuted(Exception):
pass
class Statementnotreg... |
__version__ = (
'1.2'
".3"
)
__custom__ = 42
| __version__ = '1.2.3'
__custom__ = 42 |
TITLE = "Jumpy Boi"
# screen dims
WIDTH = 1280
HEIGHT = 760
# frames per second
FPS = 60
# colors
WHITE = (255, 255, 255)
BLACK = (0,0,0)
REDDISH = (240,55,66)
SKY_BLUE = (143, 185, 252)
BROWN = (153, 140, 113)
GRAY = (110, 160, 149)
DARK_BLUE = (0, 23, 176)
FONT_NAME = 'arial'
SPRITESHEET = "spritesheet_jumper.png"
# ... | title = 'Jumpy Boi'
width = 1280
height = 760
fps = 60
white = (255, 255, 255)
black = (0, 0, 0)
reddish = (240, 55, 66)
sky_blue = (143, 185, 252)
brown = (153, 140, 113)
gray = (110, 160, 149)
dark_blue = (0, 23, 176)
font_name = 'arial'
spritesheet = 'spritesheet_jumper.png'
hs_file = 'highscore.txt'
player_acc = 0.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021-2022 F4PGA Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
# -- General configuration ---------------------... | extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'fpga-interchange-tests'
copyright = '2020, Various'
author = 'Various'
version = '0.1'
release = '0.1'
language = None
exclude_patterns = []
pygments_style = 'default'
todo_include_todos = False
html_show_sourcelink =... |
mail = "To Tax authortiy, Last year earnings of our consultants are given as below (in GBP)\n \
Sirish Dhulipala: 4000 for Jan, 4100 for Feb, 4200 For March, 3900 for April, 4000 May, 4100 June, 4000 July, 4000 August, 4000 September, 4000 October, 4000 November, 4000 December \n \
Anand Reddy: 18000 for first half an... | mail = 'To Tax authortiy, Last year earnings of our consultants are given as below (in GBP)\n Sirish Dhulipala: 4000 for Jan, 4100 for Feb, 4200 For March, 3900 for April, 4000 May, 4100 June, 4000 July, 4000 August, 4000 September, 4000 October, 4000 November, 4000 December \n Anand Reddy: 18000 for first half and 200... |
'''
2^(15) = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^(1000)?
'''
n = 0
for _ in list(map(int, list(str(2**1000)))):
n += _
print(n)
| """
2^(15) = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^(1000)?
"""
n = 0
for _ in list(map(int, list(str(2 ** 1000)))):
n += _
print(n) |
SAMTRYGG_JSON_API_URL = 'https://www.samtrygg.se/RentalObject/SearchResult'
SAMTRYGG_DATASTORE_FILEPATH = '/datastore/samtrygg_data.json'
SAMTRYGG_PROCESSED_DATASTORE_FILEPATH = '/datastore/processed_samtrygg_data.json'
SAMTRYGG_PROCESSED_UNSEEN_DATASTORE_FILEPATH = '/datastore/processed_unseen_samtrygg_data.json'
| samtrygg_json_api_url = 'https://www.samtrygg.se/RentalObject/SearchResult'
samtrygg_datastore_filepath = '/datastore/samtrygg_data.json'
samtrygg_processed_datastore_filepath = '/datastore/processed_samtrygg_data.json'
samtrygg_processed_unseen_datastore_filepath = '/datastore/processed_unseen_samtrygg_data.json' |
colors = {
"Light": {
"BackgroundColor": [1, 0, 1, .2],
"TabColor": [1, 0, 1, .3],
"ThemeColor": [1, 0, 1, 1],
"BottomStatusColor": [.9, 0.9, 1, .8],
"PrimaryTextColor": [0, 0, 0, 1],
"SecondaryTextColor": [0, 0, 0, .5],
"SelectorHoverColor": [.7, .7, .7, .5],... | colors = {'Light': {'BackgroundColor': [1, 0, 1, 0.2], 'TabColor': [1, 0, 1, 0.3], 'ThemeColor': [1, 0, 1, 1], 'BottomStatusColor': [0.9, 0.9, 1, 0.8], 'PrimaryTextColor': [0, 0, 0, 1], 'SecondaryTextColor': [0, 0, 0, 0.5], 'SelectorHoverColor': [0.7, 0.7, 0.7, 0.5], 'SelectorActiveColor': [1, 0, 1, 1], 'SelectorNormal... |
while True:
line = input().split(' ')
n = int(line[0])
n2 = int(line[1])
if n == n2 and n == 0:
break
num = line[1].replace(line[0], '')
print(int(num) if num != '' else 0)
| while True:
line = input().split(' ')
n = int(line[0])
n2 = int(line[1])
if n == n2 and n == 0:
break
num = line[1].replace(line[0], '')
print(int(num) if num != '' else 0) |
def sort_twisted37(arr):
return sorted(arr, key=lambda x: convert(x))
def convert(n):
if "3" not in str(n) and "7" not in str(n):
return n
neg_flag=True if n<0 else False
n=abs(n)
total=0
for i in str(n):
if i=="3":
total=total*10+7
elif i=="7":
to... | def sort_twisted37(arr):
return sorted(arr, key=lambda x: convert(x))
def convert(n):
if '3' not in str(n) and '7' not in str(n):
return n
neg_flag = True if n < 0 else False
n = abs(n)
total = 0
for i in str(n):
if i == '3':
total = total * 10 + 7
elif i == ... |
##
# DATA_ENCODING:
#
# In order to transmit data in a serialized format, string objects need to be encoded. Otherwise,
# it is unclear how the characters are translated into raw bytes on the wire. This value should be
# consistent with the encoding used on the flight software that is being communicated with.
#
# Tradi... | data_encoding = 'ascii' |
#bear in mind, this is log(n)
def binary_search(arr, target):
return binary_search_func(arr, 0, len(arr) - 1, target)
def binary_search_func(arr, start_index, end_index, target):
if start_index > end_index:
return -1
mid_index = (start_index + end_index) // 2
if arr[mid_index] == target:
... | def binary_search(arr, target):
return binary_search_func(arr, 0, len(arr) - 1, target)
def binary_search_func(arr, start_index, end_index, target):
if start_index > end_index:
return -1
mid_index = (start_index + end_index) // 2
if arr[mid_index] == target:
return mid_index
elif ar... |
try:
age = int(input("Enter age:"))
if age >= 18:
print("You can vote")
elif age > 0 and age <= 17:
print("Too young to vote")
else:
print("You are a time traveller")
except:
print("Please enter age as integer") | try:
age = int(input('Enter age:'))
if age >= 18:
print('You can vote')
elif age > 0 and age <= 17:
print('Too young to vote')
else:
print('You are a time traveller')
except:
print('Please enter age as integer') |
class Solution:
def equalPartition(self, N, arr):
# Find the sum of the array
summ = sum(arr)
# If the sum is odd, then return false
if summ % 2 != 0 :
return 0
# This is the number we need to obtain during the computation
required = summ // 2
... | class Solution:
def equal_partition(self, N, arr):
summ = sum(arr)
if summ % 2 != 0:
return 0
required = summ // 2
table = [[False for _ in range(N + 1)] for _ in range(required + 1)]
for i in range(N + 1):
table[0][i] = True
for i in range(1,... |
class SignatureNoeud:
def __init__(self,attributs, degre, degres_noeuds_adjacents,attributs_arretes):
self.attributs = attributs
self.degre = degre
self.degres_noeuds_adjacents = degres_noeuds_adjacents
self.attributs_arretes = attributs_arretes
| class Signaturenoeud:
def __init__(self, attributs, degre, degres_noeuds_adjacents, attributs_arretes):
self.attributs = attributs
self.degre = degre
self.degres_noeuds_adjacents = degres_noeuds_adjacents
self.attributs_arretes = attributs_arretes |
class QueueException(Exception):
pass
class Empty(QueueException):
pass
class Full(QueueException):
pass | class Queueexception(Exception):
pass
class Empty(QueueException):
pass
class Full(QueueException):
pass |
GITHUB_IPS_ONLY = False
ENFORCE_SECRET = ""
RETURN_SCRIPTS_INFO = True
PORT = 8000
| github_ips_only = False
enforce_secret = ''
return_scripts_info = True
port = 8000 |
def number():
while True:
try:
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
break
except ValueError:
print("One of the values entered is not an integer, try again")
while num1 < 1 or num2 < 1:
print("One of the numbers isnt a positive int... | def number():
while True:
try:
num1 = int(input('Enter a number: '))
num2 = int(input('Enter a number: '))
break
except ValueError:
print('One of the values entered is not an integer, try again')
while num1 < 1 or num2 < 1:
print('One of th... |
class IDError(Exception):
pass
class Service:
def __init__(self, google_service_object, id = None):
self.service = google_service_object
self.id = id
@property
def id(self):
if self.__id is None:
raise IDError("Service id is uninitialized, use .initialize_env(...)")... | class Iderror(Exception):
pass
class Service:
def __init__(self, google_service_object, id=None):
self.service = google_service_object
self.id = id
@property
def id(self):
if self.__id is None:
raise id_error('Service id is uninitialized, use .initialize_env(...)')... |
while True:
D,N = input().split()
if D == N == '0': break
N = N.replace(D,'')
print(0) if N == '' else print(int(N))
| while True:
(d, n) = input().split()
if D == N == '0':
break
n = N.replace(D, '')
print(0) if N == '' else print(int(N)) |
def factorial(n):
if n == 0: # base case
return 1
else: # divide and conquer
return n * factorial(n - 1) # call the same function passing in an argument that leads down to the base case
for n in range(0, 12):
print(factorial(n))
| def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
for n in range(0, 12):
print(factorial(n)) |
class RevStr(str):
def __iter__(self):
return ItRevStr(self)
class ItRevStr:
def __init__(self, chaine_a_parcourir):
self.chaine_a_parcourir=chaine_a_parcourir
self.position=len(self.chaine_a_parcourir)
def __next__(self):
if self.position==0:
raise StopIteration
self.position-=1
return self.chaine... | class Revstr(str):
def __iter__(self):
return it_rev_str(self)
class Itrevstr:
def __init__(self, chaine_a_parcourir):
self.chaine_a_parcourir = chaine_a_parcourir
self.position = len(self.chaine_a_parcourir)
def __next__(self):
if self.position == 0:
raise St... |
img_properties = 'width="14" height="12" alt=""'
valid_letters = 'YNLUKGFPBDTCIHS8EM'
emoticons = {
"(:-)" : "emoticon-smile.gif",
"(;-)" : "emoticon-wink.gif",
"(:-()" : "emoticon-sad.gif",
"(:-|)" : "emoticon-ambivalent.gif",
"(:-D)" : "emoticon-laugh.gif",
"(:-O)" : "emoticon-surprised.gif",
... | img_properties = 'width="14" height="12" alt=""'
valid_letters = 'YNLUKGFPBDTCIHS8EM'
emoticons = {'(:-)': 'emoticon-smile.gif', '(;-)': 'emoticon-wink.gif', '(:-()': 'emoticon-sad.gif', '(:-|)': 'emoticon-ambivalent.gif', '(:-D)': 'emoticon-laugh.gif', '(:-O)': 'emoticon-surprised.gif', '(:-P)': 'emoticon-tongue-in-ch... |
gamestr = "Icewind Dale EE 2.6.5.0 + BetterHOF + CDTWEAKS"
headers = ["Area", "NPC", "XP", "Gold Carried", "Pickpocket Skill", "Item Price (base)", "Item Type", "Item"]
areas = [
"animtest (Spawned)",
"ar1001 - Easthaven (prologue) - Temple of Tempus",
"ar1008 - Easthaven (prologue) - Snowdrift Inn",
"ar1100 - Eas... | gamestr = 'Icewind Dale EE 2.6.5.0 + BetterHOF + CDTWEAKS'
headers = ['Area', 'NPC', 'XP', 'Gold Carried', 'Pickpocket Skill', 'Item Price (base)', 'Item Type', 'Item']
areas = ['animtest (Spawned)', 'ar1001 - Easthaven (prologue) - Temple of Tempus', 'ar1008 - Easthaven (prologue) - Snowdrift Inn', 'ar1100 - Easthaven... |
'''
a = 'iasdsdasda'
b= 0
c = len(a)
while b<c:
print(a[b])
b+=1
import random
a = random.randrange(1,3)
s = eval(raw_input(">>"))
while a-s!=0:
if a>s:
print("you are low")
elif a<s:
print("you are high")
s = eval(raw_input(">>"))
while a-s==0:
print("you are right")
break
'''... | """
a = 'iasdsdasda'
b= 0
c = len(a)
while b<c:
print(a[b])
b+=1
import random
a = random.randrange(1,3)
s = eval(raw_input(">>"))
while a-s!=0:
if a>s:
print("you are low")
elif a<s:
print("you are high")
s = eval(raw_input(">>"))
while a-s==0:
print("you are right")
break
"""... |
# I got to use a map dictionary (identical values) in one place as it is
# but in another I should convert keys as values and values as keys!
# Note
'''
+ This is only for dictionary which has identical values and when considered as hashmap.
- If dictionary which has duplicate values may not work well.
- If dictionar... | """
+ This is only for dictionary which has identical values and when considered as hashmap.
- If dictionary which has duplicate values may not work well.
- If dictionary which has collection as values may also not work.
"""
hashmap = {'BlankValidationError': 'BVE01', 'InvalidFormatError': 'IFE01', 'InvalidTypeError': ... |
#Internal framework imports
#Typing imports
class ResizeMethod:
NONE = 1
CROP = 2
STRETCH = 3
LETTERBOX = 4
@classmethod
def str2enum(cls, resize_method_string, error_if_none = False):
resize_method_string = resize_method_string.lower()
if resize_method_string == "crop":
... | class Resizemethod:
none = 1
crop = 2
stretch = 3
letterbox = 4
@classmethod
def str2enum(cls, resize_method_string, error_if_none=False):
resize_method_string = resize_method_string.lower()
if resize_method_string == 'crop':
return cls.CROP
elif resize_metho... |
def add(*args):
return list(list(sum(j) for j in zip(*rows)) for rows in zip(*args))
matrix1 = [[1, -2], [-3, 4]]
matrix2 = [[2, -1], [0, -1]]
result = add(matrix1, matrix2)
print(result) | def add(*args):
return list((list((sum(j) for j in zip(*rows))) for rows in zip(*args)))
matrix1 = [[1, -2], [-3, 4]]
matrix2 = [[2, -1], [0, -1]]
result = add(matrix1, matrix2)
print(result) |
class ConfigNotFoundException(Exception):
def __init__(self, message):
super().__init__(message)
class WorkingDirectoryDoesNotExistException(Exception):
def __init__(self, message):
super().__init__(message)
class ImageUploaderException(Exception):
def __init__(self, message):
su... | class Confignotfoundexception(Exception):
def __init__(self, message):
super().__init__(message)
class Workingdirectorydoesnotexistexception(Exception):
def __init__(self, message):
super().__init__(message)
class Imageuploaderexception(Exception):
def __init__(self, message):
s... |
text = '''<?xml version="1.0" encoding="utf-8" ?>
<body copyright="All data copyright San Francisco Muni 2015.">
<predictions agencyTitle="San Francisco Muni" routeTitle="38-Geary" routeTag="38" stopTitle="43rd Ave & Point Lobos Ave" stopTag="13568">
<direction title="Inbound to Downtown">
<prediction epochTim... | text = '<?xml version="1.0" encoding="utf-8" ?> \n<body copyright="All data copyright San Francisco Muni 2015.">\n<predictions agencyTitle="San Francisco Muni" routeTitle="38-Geary" routeTag="38" stopTitle="43rd Ave & Point Lobos Ave" stopTag="13568">\n <direction title="Inbound to Downtown">\n <prediction epochT... |
colour = {'r': '\033[31m', 'g': '\033[32m', 'w': '\033[33m', 'b': '\033[34m', 'p': '\033[35m',
'c': '\033[36m', 'limit': '\033[m'}
def line(n=37):
print('-' * n)
def title(txt, x=37):
print('-' * x)
print(f'{colour["c"]}{txt.center(x)}{colour["limit"]}')
print('-' * x) | colour = {'r': '\x1b[31m', 'g': '\x1b[32m', 'w': '\x1b[33m', 'b': '\x1b[34m', 'p': '\x1b[35m', 'c': '\x1b[36m', 'limit': '\x1b[m'}
def line(n=37):
print('-' * n)
def title(txt, x=37):
print('-' * x)
print(f"{colour['c']}{txt.center(x)}{colour['limit']}")
print('-' * x) |
class widget_type(object):
stage = 0
button = 1
toggle = 2
slider = 3
dropdown = 4
text = 5
input_field = 6
joystick = 7
class widget_date_type(object):
bool = 0
int32 = 1
float = 2
string = 3
class widget_public_function(object):
create = 0
destory = 1
ac... | class Widget_Type(object):
stage = 0
button = 1
toggle = 2
slider = 3
dropdown = 4
text = 5
input_field = 6
joystick = 7
class Widget_Date_Type(object):
bool = 0
int32 = 1
float = 2
string = 3
class Widget_Public_Function(object):
create = 0
destory = 1
acti... |
f = open('task1-test-input.txt')
o = open('o1.txt', 'w')
t = int(f.readline().strip())
for i in xrange(1, t + 1):
o.write("Case #{}:".format(i))
n = f.readline()
n = int(f.readline().strip())
x = [int(j) for j in f.readline().strip().split()]
mean = 0
for j in xrange(0, n):
mean += x[j]
... | f = open('task1-test-input.txt')
o = open('o1.txt', 'w')
t = int(f.readline().strip())
for i in xrange(1, t + 1):
o.write('Case #{}:'.format(i))
n = f.readline()
n = int(f.readline().strip())
x = [int(j) for j in f.readline().strip().split()]
mean = 0
for j in xrange(0, n):
mean += x[j]
... |
# Write a program that compares two lists and prints a message depending on if the inputs are identical or not.
# Your program should be able to accept and compare two lists: list_one and list_two. If both lists are identical print "The lists are the same". If they are not identical print "The lists are not the same." ... | def compare_lists(list_one, list_two):
if list_one == list_two:
print('The lists are the same')
else:
print('The lists are not the same')
list_one = [1, 2, 5, 6, 2]
list_two = [1, 2, 5, 6, 2]
compare_lists(list_one, list_two)
list_one = [1, 2, 5, 6, 5]
list_two = [1, 2, 5, 6, 5, 3]
compare_lists... |
# spec.py
# Problem 1: Implement this function.
def Newtons_method(f, x0, Df, iters=15, tol=.1e-5):
'''
Use Newton's method to approximate a zero of a function.
Inputs:
f (function): A function handle. Should represent a function
from R to R.
x0 (float): Initial guess.
... | def newtons_method(f, x0, Df, iters=15, tol=1e-06):
"""
Use Newton's method to approximate a zero of a function.
Inputs:
f (function): A function handle. Should represent a function
from R to R.
x0 (float): Initial guess.
Df (function): A function handle. Should represen... |
#
# PySNMP MIB module IEEE8021-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IEEE8021-TC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:13:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_size_constraint, value_range_constraint) ... |
entries = [
{
"env-title": "atari-alien",
"env-variant": "No-op start",
"score": 1536.05,
},
{
"env-title": "atari-amidar",
"env-variant": "No-op start",
"score": 497.62,
},
{
"env-title": "atari-assault",
"env-variant": "No-op start",
... | entries = [{'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 1536.05}, {'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 497.62}, {'env-title': 'atari-assault', 'env-variant': 'No-op start', 'score': 12086.86}, {'env-title': 'atari-asterix', 'env-variant': 'No-op start', 'score': 29... |
TS = "timestep"
H = "hourly"
D = "daily"
M = "monthly"
A = "annual"
RP = "runperiod"
FREQUENCY = "frequency"
VARIABLE = "variable"
KEY = "key"
TYPE = "type"
UNITS = "units"
| ts = 'timestep'
h = 'hourly'
d = 'daily'
m = 'monthly'
a = 'annual'
rp = 'runperiod'
frequency = 'frequency'
variable = 'variable'
key = 'key'
type = 'type'
units = 'units' |
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def mergeTwoLists(l1, l2):
# edge case
if l1 is None:
return l2
if l2 is None:
return l1
# general case
cur1 = l1
cur2 = l2
ans = ListNode()
cur = ans
while cur... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def merge_two_lists(l1, l2):
if l1 is None:
return l2
if l2 is None:
return l1
cur1 = l1
cur2 = l2
ans = list_node()
cur = ans
while cur1 or cur2:
if not cur2 o... |
class ArgumentError(ValueError):
...
class PathOpError(ValueError):
...
| class Argumenterror(ValueError):
...
class Pathoperror(ValueError):
... |
# Q20
print("======= a =======")
for x in range(1,200):
if x % 4 == 0:
print('{0:.2f}'.format(x))
print("======= b =======")
#while x < 200:
# if (x % 4 == 0):
# x = x + 1
# print('{0:d}'.format(x))
# x = x + 2
print("======= c =======")
for x in range(1,200):
if x % 2 == 0:
... | print('======= a =======')
for x in range(1, 200):
if x % 4 == 0:
print('{0:.2f}'.format(x))
print('======= b =======')
print('======= c =======')
for x in range(1, 200):
if x % 2 == 0:
print('{0:d}'.format(x))
print('======= d =======')
for x in range(1, 200):
if x % 4 == 0:
print('... |
num = ''
for i in range(10):
num = str(i)
for j in range(10):
num += str(j)
for k in range(10):
num += str(k)
print(num)
num = str(i) + str(j)
num = str(i) | num = ''
for i in range(10):
num = str(i)
for j in range(10):
num += str(j)
for k in range(10):
num += str(k)
print(num)
num = str(i) + str(j)
num = str(i) |
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
item2 = {'a': 0}
item3 = True
item4 = 'test'
item_cfg = {'b': 1}
item5 = {'cfg': item_cfg}
item6 = {'cfg': item_cfg}
| item1 = [1, 2]
item2 = {'a': 0}
item3 = True
item4 = 'test'
item_cfg = {'b': 1}
item5 = {'cfg': item_cfg}
item6 = {'cfg': item_cfg} |
DB_DATA = {
"users": [],
"protected_data": "Lorem ipsum dolor sit amet..."
}
| db_data = {'users': [], 'protected_data': 'Lorem ipsum dolor sit amet...'} |
name = 'Webware for Python'
version = (3, 0, 4)
status = 'stable'
requiredPyVersion = (3, 6)
synopsis = (
"Webware for Python is a time-tested"
" modular, object-oriented web framework.")
webwareConfig = {
'examplePages': [
'Welcome',
'ShowTime',
'CountVisits',
'Error',
... | name = 'Webware for Python'
version = (3, 0, 4)
status = 'stable'
required_py_version = (3, 6)
synopsis = 'Webware for Python is a time-tested modular, object-oriented web framework.'
webware_config = {'examplePages': ['Welcome', 'ShowTime', 'CountVisits', 'Error', 'View', 'Introspect', 'Colors', 'ListBox', 'Forward', ... |
__all__ = ["VERSION"]
# Do not use pkg_resources to find the version but set it here directly!
VERSION = '0.0.1'
| __all__ = ['VERSION']
version = '0.0.1' |
#
# PySNMP MIB module A3COM-HUAWEI-SSH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-SSH-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:07:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (h3c_common,) = mibBuilder.importSymbols('A3COM-HUAWEI-OID-MIB', 'h3cCommon')
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_co... |
class SesDevException(Exception):
pass
class AddRepoNoUpdateWithExplicitRepo(SesDevException):
def __init__(self):
super().__init__(
"The --update option does not work with an explicit custom repo."
)
class BadMakeCheckRolesNodes(SesDevException):
def __init__(self):
... | class Sesdevexception(Exception):
pass
class Addreponoupdatewithexplicitrepo(SesDevException):
def __init__(self):
super().__init__('The --update option does not work with an explicit custom repo.')
class Badmakecheckrolesnodes(SesDevException):
def __init__(self):
super().__init__('"mak... |
l = int(input("enter the lower interval"))
u = int(input("enter the upper interval"))
for num in range(l,u+1):
if num>1:
for i in range(2,num):
if(num%i)==0:
break
else:
print(num)
| l = int(input('enter the lower interval'))
u = int(input('enter the upper interval'))
for num in range(l, u + 1):
if num > 1:
for i in range(2, num):
if num % i == 0:
break
else:
print(num) |
class Vocabs():
def __init__(self):
reuters = None
aapd = None
VOCABS = Vocabs()
| class Vocabs:
def __init__(self):
reuters = None
aapd = None
vocabs = vocabs() |
def respond(start_response, code, headers=[('Content-type', 'text/plain')], body=b''):
start_response(code, headers)
return [body]
def key2path(key):
b = key.encode('utf-8')
return hashlib.md5(b).digest()
| def respond(start_response, code, headers=[('Content-type', 'text/plain')], body=b''):
start_response(code, headers)
return [body]
def key2path(key):
b = key.encode('utf-8')
return hashlib.md5(b).digest() |
def part1():
pass
if __name__ == '__main__':
with open('input.txt') as f:
lines = f.read().splitlines() | def part1():
pass
if __name__ == '__main__':
with open('input.txt') as f:
lines = f.read().splitlines() |
class A:
def __init__(self):
print("1")
def __init__(self):
print("2")
a= A() | class A:
def __init__(self):
print('1')
def __init__(self):
print('2')
a = a() |
load("@bazel_gazelle//:deps.bzl", "go_repository")
# bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories
def go_repositories():
go_repository(
name = "com_github_fsnotify_fsnotify",
importpath = "github.com/fsnotify/fsnotify",
sum = "h1:hsms1Qy... | load('@bazel_gazelle//:deps.bzl', 'go_repository')
def go_repositories():
go_repository(name='com_github_fsnotify_fsnotify', importpath='github.com/fsnotify/fsnotify', sum='h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=', version='v1.4.9')
go_repository(name='com_github_golang_protobuf', importpath='github.co... |
# Python Program to demonstrate the LIFO principle using stack
print("Stack utilizes the LIFO (Last In First Out) Principle")
print()
stack = [] # Initializating Empty Stack
print("Initializing empty stack :", stack) # Printing empty Stack
# Adding items to the Stack
stack.append("Hey")
stack.append("there!")
stack... | print('Stack utilizes the LIFO (Last In First Out) Principle')
print()
stack = []
print('Initializing empty stack :', stack)
stack.append('Hey')
stack.append('there!')
stack.append('This')
stack.append('is')
stack.append('a')
stack.append('Stack!')
print('After adding items into the stack:', stack)
stack.pop()
print('A... |
class Plugin_OBJ():
def __init__(self, fhdhr, plugin_utils, broadcast_ip, max_age):
self.fhdhr = fhdhr
self.broadcast_ip = broadcast_ip
self.device_xml_path = '/hdhr/device.xml'
self.cable_schema = "urn:schemas-opencable-com:service:Security:1"
self.ota_schema = "urn:sch... | class Plugin_Obj:
def __init__(self, fhdhr, plugin_utils, broadcast_ip, max_age):
self.fhdhr = fhdhr
self.broadcast_ip = broadcast_ip
self.device_xml_path = '/hdhr/device.xml'
self.cable_schema = 'urn:schemas-opencable-com:service:Security:1'
self.ota_schema = 'urn:schemas-u... |
def _remove_extensions(file_list):
rv = {}
for f in file_list:
if (f.extension == "c" or f.extension == "s" or f.extension == "S"):
rv[f.path[:-2]] = f
else:
rv[f.path] = f
return rv
def _remove_arch(file_dict, arch):
rv = {}
for f in file_dict:
idx =... | def _remove_extensions(file_list):
rv = {}
for f in file_list:
if f.extension == 'c' or f.extension == 's' or f.extension == 'S':
rv[f.path[:-2]] = f
else:
rv[f.path] = f
return rv
def _remove_arch(file_dict, arch):
rv = {}
for f in file_dict:
idx = f... |
v = ["a", "i", "u", "e", "o"]
c = input()
if c in v:
print("vowel")
else:
print("consonant") | v = ['a', 'i', 'u', 'e', 'o']
c = input()
if c in v:
print('vowel')
else:
print('consonant') |
HXLM_PLUGIN_META = {
'code': "xa_amnesty",
'code_if_approved': "xz_amnesty"
}
| hxlm_plugin_meta = {'code': 'xa_amnesty', 'code_if_approved': 'xz_amnesty'} |
horpos = list(map(int, open('Day 07.input').readline().split(',')))
mean = sum(horpos) / len(horpos)
target1 = mean - (mean % 1)
target2 = mean + (1 - mean % 1)
print(min(round(sum((abs(x - target1) * (abs(x - target1) + 1)) / 2 for x in horpos)),
round(sum((abs(x - target2) * (abs(x - target2) + 1)) / 2 for ... | horpos = list(map(int, open('Day 07.input').readline().split(',')))
mean = sum(horpos) / len(horpos)
target1 = mean - mean % 1
target2 = mean + (1 - mean % 1)
print(min(round(sum((abs(x - target1) * (abs(x - target1) + 1) / 2 for x in horpos))), round(sum((abs(x - target2) * (abs(x - target2) + 1) / 2 for x in horpos))... |
n = int(input())
positives = []
negatives = []
for _ in range(n):
num = int(input())
if num >= 0:
positives.append(num)
else:
negatives.append(num)
count_of_positives = len(positives)
sum_of_negatives = sum(negatives)
print(positives)
print(negatives)
print(f'Count of po... | n = int(input())
positives = []
negatives = []
for _ in range(n):
num = int(input())
if num >= 0:
positives.append(num)
else:
negatives.append(num)
count_of_positives = len(positives)
sum_of_negatives = sum(negatives)
print(positives)
print(negatives)
print(f'Count of positives: {count_of_po... |
s = "abcdefgh"
for index in range(len(s)):
if s[index] == "i" or s[index] == "u":
print("There is an i or u")
# Code can be rewrited as
for char in s:
if char == "i" or char == "u":
print("There is an i or u") | s = 'abcdefgh'
for index in range(len(s)):
if s[index] == 'i' or s[index] == 'u':
print('There is an i or u')
for char in s:
if char == 'i' or char == 'u':
print('There is an i or u') |
banned_words = input().split()
text = input()
replaced_text = text
for word in banned_words:
replaced_text = replaced_text.replace(word, "*" * len(word))
print(replaced_text)
| banned_words = input().split()
text = input()
replaced_text = text
for word in banned_words:
replaced_text = replaced_text.replace(word, '*' * len(word))
print(replaced_text) |
vocab_sizes_dict = {'BabyAI-BossLevel-v0': 31,
'BabyAI-BossLevelNoUnlock-v0': 31,
'BabyAI-GoTo-v0': 13,
'BabyAI-GoToImpUnlock-v0': 13,
'BabyAI-GoToLocal-v0': 13,
'BabyAI-GoToLocalS5N2-v0': 13,
'BabyAI... | vocab_sizes_dict = {'BabyAI-BossLevel-v0': 31, 'BabyAI-BossLevelNoUnlock-v0': 31, 'BabyAI-GoTo-v0': 13, 'BabyAI-GoToImpUnlock-v0': 13, 'BabyAI-GoToLocal-v0': 13, 'BabyAI-GoToLocalS5N2-v0': 13, 'BabyAI-GoToLocalS6N2-v0': 13, 'BabyAI-GoToLocalS6N3-v0': 13, 'BabyAI-GoToLocalS6N4-v0': 13, 'BabyAI-GoToLocalS7N4-v0': 13, 'Ba... |
str=input("Enter string:")
str_list=list(str)
rev_list=[]
rev_str=""
length=len(str_list)
for i in range(-1,-(length+1),-1):
rev_list.append(str_list[i])
rev=rev_str.join(rev_list)
print(rev)
print("Character in even index:")
for i in range(0,len(str),2):
print(str[i])
| str = input('Enter string:')
str_list = list(str)
rev_list = []
rev_str = ''
length = len(str_list)
for i in range(-1, -(length + 1), -1):
rev_list.append(str_list[i])
rev = rev_str.join(rev_list)
print(rev)
print('Character in even index:')
for i in range(0, len(str), 2):
print(str[i]) |
test_ads_info = [
{'ad_id': 787, 'status': True, 'bidding_cpc': 1, 'advertiser': 'DO', 'banner_style': 'XII', 'category': 'Pullover', 'layout_style': 'JV', 'item_price': 812.32},
{'ad_id': 476, 'status': True, 'bidding_cpc': 1, 'advertiser': 'DO', 'banner_style': 'XII', 'category': 'Pullover', 'layout_style': '... | test_ads_info = [{'ad_id': 787, 'status': True, 'bidding_cpc': 1, 'advertiser': 'DO', 'banner_style': 'XII', 'category': 'Pullover', 'layout_style': 'JV', 'item_price': 812.32}, {'ad_id': 476, 'status': True, 'bidding_cpc': 1, 'advertiser': 'DO', 'banner_style': 'XII', 'category': 'Pullover', 'layout_style': 'JV', 'ite... |
#
# PySNMP MIB module TELESYN-ATI-TC (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TELESYN-ATI-TC
# Produced by pysmi-0.3.4 at Mon Apr 29 18:22:21 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')
(value_range_constraint, constraints_union, constraints_intersection, single_value_constraint, value_size_constraint) ... |
#
# PySNMP MIB module FOUNDRY-SN-SWITCH-GROUP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FOUNDRY-SN-SWITCH-GROUP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:23:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint) ... |
class Employee:
def __init__(self, surname, name, contact):
self.surname = surname
self.name = name
self.contact = contact
def __eq__(self, other):
return self.name == other.name \
and self.surname == other.surname \
and self.contact == other.contac... | class Employee:
def __init__(self, surname, name, contact):
self.surname = surname
self.name = name
self.contact = contact
def __eq__(self, other):
return self.name == other.name and self.surname == other.surname and (self.contact == other.contact)
class Contact:
def __in... |
# Assume you have a file system named quotaFs
file_system_name = "quotaFs"
# Delete the quotas of groups on the file system with ids 998 and 999
client.delete_quotas_groups(file_system_names=[file_system_name], gids=[998, 999])
# Delete the quotas of groups on the file system with names group1 and group2
client.delet... | file_system_name = 'quotaFs'
client.delete_quotas_groups(file_system_names=[file_system_name], gids=[998, 999])
client.delete_quotas_groups(file_system_names=[file_system_name], group_names=['group1', 'group2']) |
class Atom:
def __init__(self, id_, position, chain_id, name, element, residue=None, altloc=None, occupancy=None):
self.id = id_
self.name = name
self.element = element
self.chain_id = chain_id
self.position = position
self.residue = residue
self.altloc = al... | class Atom:
def __init__(self, id_, position, chain_id, name, element, residue=None, altloc=None, occupancy=None):
self.id = id_
self.name = name
self.element = element
self.chain_id = chain_id
self.position = position
self.residue = residue
self.altloc = alt... |
while True:
a,b = map(int,input().split())
if a== b == 0:
break
k = 1
if b >= a-b:
k1 = b
k2 = a-b
else:
k1 = a-b
k2 = b
for i in range(k1+1,a+1):
k*=i
for i in range(2,k2+1):
k//=i
print(k) | while True:
(a, b) = map(int, input().split())
if a == b == 0:
break
k = 1
if b >= a - b:
k1 = b
k2 = a - b
else:
k1 = a - b
k2 = b
for i in range(k1 + 1, a + 1):
k *= i
for i in range(2, k2 + 1):
k //= i
print(k) |
#
# PySNMP MIB module HP-ICF-CHASSIS (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-CHASSIS
# Produced by pysmi-0.3.4 at Wed May 1 13:33:35 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... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint, constraints_union) ... |
class C(Exception):
pass
try:
raise C
except C:
print("caught exception")
| class C(Exception):
pass
try:
raise C
except C:
print('caught exception') |
for i in range(2,21):
with open(f"Tables/ Table of {i}","w") as f:
for j in range(1,11):
f.write(f"{i} X {j} ={i*j}")
if j!=10:
f.write("\n")
| for i in range(2, 21):
with open(f'Tables/ Table of {i}', 'w') as f:
for j in range(1, 11):
f.write(f'{i} X {j} ={i * j}')
if j != 10:
f.write('\n') |
b = False
e = "Hello world"
while b:
print(b)
d = True
while d:
print(d and False)
print(d and True)
print("hello")
| b = False
e = 'Hello world'
while b:
print(b)
d = True
while d:
print(d and False)
print(d and True)
print('hello') |
# Please do not any airflow imports in this file
# We want to allow importing constants from this file without any side effects
# Do not change this name unless you change the same constant in monitor_as_dag.py in dbnd-airflow-monitor
MONITOR_DAG_NAME = "databand_airflow_monitor"
| monitor_dag_name = 'databand_airflow_monitor' |
data = input().split()
x = int(data[0])
y = int(data[1])
limit = int(data[2])
for value in range(1,limit+1):
output = ""
if value % x == 0:
output += "Fizz"
if value % y == 0:
output += "Buzz"
if output == "":
print(value)
else:
print(output) | data = input().split()
x = int(data[0])
y = int(data[1])
limit = int(data[2])
for value in range(1, limit + 1):
output = ''
if value % x == 0:
output += 'Fizz'
if value % y == 0:
output += 'Buzz'
if output == '':
print(value)
else:
print(output) |
limit=int(input("enter the limit"))
sum=0
for i in range(1,limit+1,1) :
if(i % 2== 0 ):
print("even no is",i)
sum=sum+i
print(sum)
| limit = int(input('enter the limit'))
sum = 0
for i in range(1, limit + 1, 1):
if i % 2 == 0:
print('even no is', i)
sum = sum + i
print(sum) |
# -*- coding: utf-8 -*-
# the __all__ is generated
__all__ = []
# __init__.py structure:
# common code of the package
# export interface in __all__ which contains __all__ of its sub modules
# import all from submodule quote
# from .quote import *
# from .quote import __all__ as _quote_all
# __all__ += _quote_all
# ... | __all__ = [] |
def war(Naomi_w, Ken_w):
Naomi_wins = 0
while len(Naomi_w) > 0:
for X in Naomi_w:
temp = []
done = 0
Chosen_Naomi = X
Told_Naomi = X
for i in Ken_w:
if i > X:
temp.append((i, i - X))
... | def war(Naomi_w, Ken_w):
naomi_wins = 0
while len(Naomi_w) > 0:
for x in Naomi_w:
temp = []
done = 0
chosen__naomi = X
told__naomi = X
for i in Ken_w:
if i > X:
temp.append((i, i - X))
don... |
class TumorSampleProfileList(object):
def __init__(self):
self.tumor_profiles = []
self._name = ''
self._num_read_counts = 0
def __iter__(self):
return iter(self.tumor_profiles)
@property
def name(self):
return self._name
@name.setter
... | class Tumorsampleprofilelist(object):
def __init__(self):
self.tumor_profiles = []
self._name = ''
self._num_read_counts = 0
def __iter__(self):
return iter(self.tumor_profiles)
@property
def name(self):
return self._name
@name.setter
def name(self, va... |
with open('texto1.txt', 'r') as arquivo:
conteudo = arquivo.read().split(',')
with open('resultado1.txt', 'w') as resultado:
for item in conteudo:
texto = f'novo conteudo Antonella te amo {item.strip()}\n'
resultado.write(texto)
| with open('texto1.txt', 'r') as arquivo:
conteudo = arquivo.read().split(',')
with open('resultado1.txt', 'w') as resultado:
for item in conteudo:
texto = f'novo conteudo Antonella te amo {item.strip()}\n'
resultado.write(texto) |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def minDepth(self, root):
# DFS
def solve(node, level):
if not node: return level - 1
elif node.left and n... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def min_depth(self, root):
def solve(node, level):
if not node:
return level - 1
elif node.left and node.right:
retur... |
list1, list2 = [123, 567, 343, 611], [456, 700, 200]
print("Max value element : ", max(list1))
print("Max value element : ", max(list2))
print("min value element : ", min(list1))
print("min value element : ", min(list2))
| (list1, list2) = ([123, 567, 343, 611], [456, 700, 200])
print('Max value element : ', max(list1))
print('Max value element : ', max(list2))
print('min value element : ', min(list1))
print('min value element : ', min(list2)) |
def seq(hub, low, running):
'''
Return the sequence map that should be used to execute the lowstate
The sequence needs to identify:
1. recursive requisites
2. what chunks are free to run
3. Bahavior augments for the next chunk to run
'''
ret = {}
for ind, chunk in enumerate(low):
... | def seq(hub, low, running):
"""
Return the sequence map that should be used to execute the lowstate
The sequence needs to identify:
1. recursive requisites
2. what chunks are free to run
3. Bahavior augments for the next chunk to run
"""
ret = {}
for (ind, chunk) in enumerate(low):
... |
#!/usr/bin/env python3
# Day 6: Queue Reconstruction by Height
#
# Suppose you have a random list of people standing in a queue. Each person is
# described by a pair of integers (h, k), where h is the height of the person
# and k is the number of people in front of this person who have a height
# greater than or equal... | class Solution:
def reconstruct_queue(self, people: [[int]]) -> [[int]]:
height = lambda person: person[0]
taller_in_front = lambda person: person[1]
sorted_people = sorted(people, key=lambda person: (-height(person), taller_in_front(person)))
queue = []
for person in sorted... |
class Tool: pass
class Documentation(Tool): pass
class Frustration(Tool): pass
class Dwf(Documentation, Frustration, Tool): pass
| class Tool:
pass
class Documentation(Tool):
pass
class Frustration(Tool):
pass
class Dwf(Documentation, Frustration, Tool):
pass |
class roiData:
def __init__(self, roistates, numberOfROIs, dicomsPath=None):
self.layers = []
self.roistates = []
self.dicomsPath=dicomsPath
self.originalLenght = len(roistates)
self.numberOfROIs = numberOfROIs
for i, roistate in enumerate(roistates):
... | class Roidata:
def __init__(self, roistates, numberOfROIs, dicomsPath=None):
self.layers = []
self.roistates = []
self.dicomsPath = dicomsPath
self.originalLenght = len(roistates)
self.numberOfROIs = numberOfROIs
for (i, roistate) in enumerate(roistates):
... |
def stringify(token):
if token.orth_ == 'I':
return token.orth_
elif token.is_quote and token.i != 0 and token.nbor(-1).is_space:
return ' ' + token.orth_
elif token.ent_type_ == '':
return token.lower_
else:
return token.orth_
def parse_stack(token):
stack = []
... | def stringify(token):
if token.orth_ == 'I':
return token.orth_
elif token.is_quote and token.i != 0 and token.nbor(-1).is_space:
return ' ' + token.orth_
elif token.ent_type_ == '':
return token.lower_
else:
return token.orth_
def parse_stack(token):
stack = []
... |
def configure(name):
if name == 'compute_mfcc':
return {"--allow-downsample":["false",str],
"--allow-upsample":["false",str],
"--blackman-coeff":[0.42,float],
"--cepstral-lifter":[22,int],
"--channel":[-1,int],
"--debug-mel":["false",str],
"--dither":[1,int],
"--energy-floor":[0,int],
... | def configure(name):
if name == 'compute_mfcc':
return {'--allow-downsample': ['false', str], '--allow-upsample': ['false', str], '--blackman-coeff': [0.42, float], '--cepstral-lifter': [22, int], '--channel': [-1, int], '--debug-mel': ['false', str], '--dither': [1, int], '--energy-floor': [0, int], '--fra... |
def sorter(item):
return item['name']
presenters=[
{'name': 'Arthur', 'age': 9},
{'name': 'Nathaniel', 'age': 11}
]
presenters.sort(key=sorter)
print(presenters) | def sorter(item):
return item['name']
presenters = [{'name': 'Arthur', 'age': 9}, {'name': 'Nathaniel', 'age': 11}]
presenters.sort(key=sorter)
print(presenters) |
class FakeCUDAContext(object):
'''
This stub implements functionality only for simulating a single GPU
at the moment.
'''
def __init__(self, device):
self._device = device
def __enter__(self):
pass
def __exit__(self, exc_type, exc_val, exc_tb):
pass
def __str__(... | class Fakecudacontext(object):
"""
This stub implements functionality only for simulating a single GPU
at the moment.
"""
def __init__(self, device):
self._device = device
def __enter__(self):
pass
def __exit__(self, exc_type, exc_val, exc_tb):
pass
def __str_... |
#
# PySNMP MIB module WWP-EXT-BRIDGE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-EXT-BRIDGE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:37:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) ... |
n, q = map(int, input().split())
d = {}
init = input().split()
for i in range(1, n+1):
d[i] = init[i-1]
for j in range(q):
line = input().split()
req = line[0]
if req == '1':
d[int(line[1])] = line[2]
else:
print(abs(int(d[int(line[1])]) - int(d[int(line[2])]))) | (n, q) = map(int, input().split())
d = {}
init = input().split()
for i in range(1, n + 1):
d[i] = init[i - 1]
for j in range(q):
line = input().split()
req = line[0]
if req == '1':
d[int(line[1])] = line[2]
else:
print(abs(int(d[int(line[1])]) - int(d[int(line[2])]))) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.