content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
_a = request.application
response.logo = A(B('KVASIR'), _class="brand")
response.title = settings.title
response.subtitle = settings.subtitle
response.meta.author = '%s <%s>' % (settings.author, settings.author_email)
response.meta.keywords = settings.keywords
response.meta.description = settings.description
response... | _a = request.application
response.logo = a(b('KVASIR'), _class='brand')
response.title = settings.title
response.subtitle = settings.subtitle
response.meta.author = '%s <%s>' % (settings.author, settings.author_email)
response.meta.keywords = settings.keywords
response.meta.description = settings.description
response.m... |
# -*- coding: utf_8 -*-
__author__ = 'Yagg'
class Bombing:
def __init__(self, attackerName, defenderName, planetNum, planetName, population, industry, production, capitals,
materials, colonists, attackStrength, status):
self.attackerName = attackerName
self.defenderName = defenderN... | __author__ = 'Yagg'
class Bombing:
def __init__(self, attackerName, defenderName, planetNum, planetName, population, industry, production, capitals, materials, colonists, attackStrength, status):
self.attackerName = attackerName
self.defenderName = defenderName
self.planetNum = planetNum
... |
def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
for _ in range(int(input())):
a, b = map(int, input().split())
print(gcd(a, b)) | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
for _ in range(int(input())):
(a, b) = map(int, input().split())
print(gcd(a, b)) |
'''
Fixed arguments
'''
def print_fib(a, b, c):
print(a, b, c)
print_fib(1, 1, 2)
print_fib(1, 1, 2, 3)
'''
Using *args
'''
def print_fib(a, *args):
print(a)
print(args)
print_fib(1, 1, 2, 3)
print_fib(1)
'''
Using **kwargs
'''
def print_fib(a, **kwargs):
print(a)
print(kwargs)
print_fib(1, s... | """
Fixed arguments
"""
def print_fib(a, b, c):
print(a, b, c)
print_fib(1, 1, 2)
print_fib(1, 1, 2, 3)
'\nUsing *args\n'
def print_fib(a, *args):
print(a)
print(args)
print_fib(1, 1, 2, 3)
print_fib(1)
'\nUsing **kwargs\n'
def print_fib(a, **kwargs):
print(a)
print(kwargs)
print_fib(1, se=1, th=... |
s, t, n = map(int, input().split())
dList = input().split()
bList = input().split()
cList = input().split()
Time = 0
for i in range(len(dList) - 1):
Time += int(dList[i])
if Time % int(cList[i]) == 0:
wait = abs(Time - int(cList[i])) - int(cList[i])
else:
wait = abs(Time - int(cList[i]))
... | (s, t, n) = map(int, input().split())
d_list = input().split()
b_list = input().split()
c_list = input().split()
time = 0
for i in range(len(dList) - 1):
time += int(dList[i])
if Time % int(cList[i]) == 0:
wait = abs(Time - int(cList[i])) - int(cList[i])
else:
wait = abs(Time - int(cList[i])... |
n = int(input())
string = []
string = input().split(" ")
string.sort()
for i in range (0,n):
print (string[i], end = " ")
| n = int(input())
string = []
string = input().split(' ')
string.sort()
for i in range(0, n):
print(string[i], end=' ') |
class GlobalInfo:
gui_thread = None
main_window = None
daemon_inst = None
daemon_conn = None
headless_plugin_manager = None
| class Globalinfo:
gui_thread = None
main_window = None
daemon_inst = None
daemon_conn = None
headless_plugin_manager = None |
class MinimumBalanceAccount(BankAccount):
def __init__(self, minimum_balance):
BankAccount.__init__(self)
self.minimum_balance = minimum_balance
def withdraw(self, amount):
if self.balance - amount < self.minimum_balance:
print ('Sorry, minimum balance must be maintaine... | class Minimumbalanceaccount(BankAccount):
def __init__(self, minimum_balance):
BankAccount.__init__(self)
self.minimum_balance = minimum_balance
def withdraw(self, amount):
if self.balance - amount < self.minimum_balance:
print('Sorry, minimum balance must be maintained.')
... |
class Solution:
def divide(self, dividend: int, divisor: int) -> int:
if (dividend == -2147483648 and divisor == -1): return 2147483647
ans = 1
nORp = 1 if (dividend > 0) == (divisor > 0) else -1
a , b = abs(dividend) , abs(divisor)
if a < b : return 0
elif a == b: re... | class Solution:
def divide(self, dividend: int, divisor: int) -> int:
if dividend == -2147483648 and divisor == -1:
return 2147483647
ans = 1
n_o_rp = 1 if (dividend > 0) == (divisor > 0) else -1
(a, b) = (abs(dividend), abs(divisor))
if a < b:
return... |
colors = ["red", "yellow", "green", "blue"]
print(type(colors))
print(colors)
numbers = (1,2,3)
print(numbers)
numbers_list = list(numbers)
print(numbers_list)
print(list("Fabio"))
groceries = "eggs, milk, cheese"
grocery_list = groceries.split(", ")
print(grocery_list)
numbers = list(range(1,10))
print(numbers)
... | colors = ['red', 'yellow', 'green', 'blue']
print(type(colors))
print(colors)
numbers = (1, 2, 3)
print(numbers)
numbers_list = list(numbers)
print(numbers_list)
print(list('Fabio'))
groceries = 'eggs, milk, cheese'
grocery_list = groceries.split(', ')
print(grocery_list)
numbers = list(range(1, 10))
print(numbers)
pri... |
class Solution:
def maxArea(self, height: List[int]) -> int:
n = len(height)
start, end = 0, n-1
maxArea = 0
while start < end:
area = (end - start)*min(height[start], height[end])
if maxArea < area:
maxArea = area
if height[start] ... | class Solution:
def max_area(self, height: List[int]) -> int:
n = len(height)
(start, end) = (0, n - 1)
max_area = 0
while start < end:
area = (end - start) * min(height[start], height[end])
if maxArea < area:
max_area = area
if he... |
N = int(input())
A = int(input())
if N%500 <= A:
print('Yes')
else:
print('No')
| n = int(input())
a = int(input())
if N % 500 <= A:
print('Yes')
else:
print('No') |
# puzzle3b.py
def get_rating(input_data, rating_type, num_len):
def rating_type_compare(rating_type, count_0, count_1):
if rating_type.upper() in ["OXYGEN", "O2"]:
return (count_0 > count_1)
elif rating_type.upper() in ["CO2"]:
return (count_0 <= count_1)
# Strategy: Fo... | def get_rating(input_data, rating_type, num_len):
def rating_type_compare(rating_type, count_0, count_1):
if rating_type.upper() in ['OXYGEN', 'O2']:
return count_0 > count_1
elif rating_type.upper() in ['CO2']:
return count_0 <= count_1
input_values = input_data
for... |
class ParticipantIdentifierTypeName():
AS_PROGRESSION_ID = 'AS_PROGRESSION_ID'
BME_COVID_ID = 'BME_COVID_ID'
CARDIOMET_ID = 'CARDIOMET_ID'
CARMER_BREATH_ID = 'CARMER_BREATH_ID'
EASY_AS_ID = 'EASY_AS_ID'
EDEN_ID = 'EDEN_ID'
EDIFY_ID = 'EDIFY_ID'
ELASTIC_AS_ID = 'ELASTIC_AS_ID'
EPIGENE... | class Participantidentifiertypename:
as_progression_id = 'AS_PROGRESSION_ID'
bme_covid_id = 'BME_COVID_ID'
cardiomet_id = 'CARDIOMET_ID'
carmer_breath_id = 'CARMER_BREATH_ID'
easy_as_id = 'EASY_AS_ID'
eden_id = 'EDEN_ID'
edify_id = 'EDIFY_ID'
elastic_as_id = 'ELASTIC_AS_ID'
epigene1_... |
def D2old():
n = int(input())
bricks = input().split()
bricks = [int(x) for x in bricks]
m = min(bricks)
M = max(bricks)
while(m!=M):
for idx in range(n):
if(bricks[idx] != m): continue
m_count = 0
while( idx+m_count < n and bricks[idx+m_count]== m):
bricks[idx+m_count] +=1
m_count+=1
... | def d2old():
n = int(input())
bricks = input().split()
bricks = [int(x) for x in bricks]
m = min(bricks)
m = max(bricks)
while m != M:
for idx in range(n):
if bricks[idx] != m:
continue
m_count = 0
while idx + m_count < n and bricks[idx... |
list = []
def list_(times):
for x in range(times):
number = int(input('Ingrese numero(s) a incluir '))
list.append(number)
return list
times = int(input('Cantidad de elementos?: '))
list = list_(times)
print(list)
| list = []
def list_(times):
for x in range(times):
number = int(input('Ingrese numero(s) a incluir '))
list.append(number)
return list
times = int(input('Cantidad de elementos?: '))
list = list_(times)
print(list) |
#Patterns to detect accommodation related queries
pattern_details1 = {
"LABEL" : "PICKUP_REG",
"pattern" : [
{ "TEXT" : { "REGEX" : "\bpickup\b|\bpick-up\b|\bdeliver*\b|\bgrab*\b" } }
]
}
pattern_details2 = {
"LABEL" : "PICKUP_LEMM",
"pattern" : [
{ "TEXT" : { "REGEX" : "delive... | pattern_details1 = {'LABEL': 'PICKUP_REG', 'pattern': [{'TEXT': {'REGEX': '\x08pickup\x08|\x08pick-up\x08|\x08deliver*\x08|\x08grab*\x08'}}]}
pattern_details2 = {'LABEL': 'PICKUP_LEMM', 'pattern': [{'TEXT': {'REGEX': 'deliver|pickup|pick-up|grab|drop'}}, {'OP': '*'}, {'TEXT': {'REGEX': '\x08grocer*\x08|\x08medicin*\x08... |
#remove all the digits from given string
inp="test1254ab995drgdc10108done"
inp=inp.replace("0","")
inp=inp.replace("1","")
inp=inp.replace("2","")
inp=inp.replace("3","")
inp=inp.replace("4","")
inp=inp.replace("5","")
inp=inp.replace("6","")
inp=inp.replace("7","")
inp=inp.replace("8","")
inp=inp.replace("9... | inp = 'test1254ab995drgdc10108done'
inp = inp.replace('0', '')
inp = inp.replace('1', '')
inp = inp.replace('2', '')
inp = inp.replace('3', '')
inp = inp.replace('4', '')
inp = inp.replace('5', '')
inp = inp.replace('6', '')
inp = inp.replace('7', '')
inp = inp.replace('8', '')
inp = inp.replace('9', '')
print(inp) |
n = int(input())
if n%2!=0:
print("Weird")
else:
if (n>=2 and n<=5):
print("Not Weird")
elif (n>=6 and n<=20):
print("Weird")
elif(n>20):
print("Not Weird") | n = int(input())
if n % 2 != 0:
print('Weird')
elif n >= 2 and n <= 5:
print('Not Weird')
elif n >= 6 and n <= 20:
print('Weird')
elif n > 20:
print('Not Weird') |
def convert_and_sum_list_kwargs(usd_list, **kwargs):
total = 0
for amount in usd_list:
total += convert_usd_to_aud(amount, **kwargs)
return total
print(convert_and_sum_list_kwargs([1, 3], rate=0.8))
| def convert_and_sum_list_kwargs(usd_list, **kwargs):
total = 0
for amount in usd_list:
total += convert_usd_to_aud(amount, **kwargs)
return total
print(convert_and_sum_list_kwargs([1, 3], rate=0.8)) |
class SimpleGraph:
def __init__(self):
self.edges = {}
@property
def nodes(self):
return self.edges.keys()
def neighbors(self, id):
return self.edges[id]
class DFS(object):
'''
Implementation of recursive depth-first search algorithm
Note for status 0=not visited, ... | class Simplegraph:
def __init__(self):
self.edges = {}
@property
def nodes(self):
return self.edges.keys()
def neighbors(self, id):
return self.edges[id]
class Dfs(object):
"""
Implementation of recursive depth-first search algorithm
Note for status 0=not visited,... |
#check if it is a multiple subject
def is_multiple_subject_linked_to_subject(subject):
for child in subject.children:
if child.dep_ == "conj":
return True
return False
def is_multiple_subject_linked_to_predicate(predicate):
#this case is for personal pronoun, and not only, but much more nsubj
subjects = []
... | def is_multiple_subject_linked_to_subject(subject):
for child in subject.children:
if child.dep_ == 'conj':
return True
return False
def is_multiple_subject_linked_to_predicate(predicate):
subjects = []
for child in predicate.children:
if child.dep_ == 'nsubj':
s... |
#!/usr/bin/env python
NAME = 'Imperva SecureSphere'
def is_waf(self):
# thanks to Mathieu Dessus <mathieu.dessus(a)verizonbusiness.com> for this
# might lead to false positives so please report back to sandro@enablesecurity.com
for attack in self.attacks:
r = attack(self)
if r is None:
... | name = 'Imperva SecureSphere'
def is_waf(self):
for attack in self.attacks:
r = attack(self)
if r is None:
return
(response, responsebody) = r
if response.version == 10:
return True
return False |
class Node(object):
def __init__(self, val, parent=None):
self.val = val
self.leftChild = None
self.rightChild = None
self.parent = parent
def getLeftChild(self):
return self.leftChild
def getRightChild(self):
return self.rightChild
def getParent(self... | class Node(object):
def __init__(self, val, parent=None):
self.val = val
self.leftChild = None
self.rightChild = None
self.parent = parent
def get_left_child(self):
return self.leftChild
def get_right_child(self):
return self.rightChild
def get_parent(... |
class FundNameException(BaseException): pass
class FundOutFileNameException(BaseException): pass
class FundNotFoundException(BaseException): pass
class StockInformationMissingException(BaseException): pass
class StockCandleInformatinMissingException(StockInformationMissingException): pass | class Fundnameexception(BaseException):
pass
class Fundoutfilenameexception(BaseException):
pass
class Fundnotfoundexception(BaseException):
pass
class Stockinformationmissingexception(BaseException):
pass
class Stockcandleinformatinmissingexception(StockInformationMissingException):
pass |
dp = {0:0,1:1,2:2}
class Solution:
def minDays(self, n: int) -> int:
if n in dp: return dp[n]
ans = 1 + min(n%2 + self.minDays((n-n%2)//2), n%3 + self.minDays((n-n%3)//3))
dp[n] = ans
return ans
| dp = {0: 0, 1: 1, 2: 2}
class Solution:
def min_days(self, n: int) -> int:
if n in dp:
return dp[n]
ans = 1 + min(n % 2 + self.minDays((n - n % 2) // 2), n % 3 + self.minDays((n - n % 3) // 3))
dp[n] = ans
return ans |
class Template:
def __init__(self, bot, channel):
self.bot = bot
self.channel = channel
channel.set_command("!command", self.on_command, "!command description")
def on_command(self, message):
pass
# runs when a personal message is received
# message is a dictionary con... | class Template:
def __init__(self, bot, channel):
self.bot = bot
self.channel = channel
channel.set_command('!command', self.on_command, '!command description')
def on_command(self, message):
pass
def on_personal_message(self, message):
pass
def on_message(sel... |
# -*- coding: utf-8 -*-
DEBUG = True
TESTING = True
SECRET_KEY = 'SECRET_KEY'
DATABASE_URI = 'mysql+pymysql://root:root@127.0.0.1/git_webhook'
CELERY_BROKER_URL = 'redis://:@127.0.0.1:6379/0'
CELERY_RESULT_BACKEND = 'redis://:@127.0.0.1:6379/0'
SOCKET_MESSAGE_QUEUE = 'redis://:@127.0.0.1:6379/0'
GITHUB_CLIENT_ID = '... | debug = True
testing = True
secret_key = 'SECRET_KEY'
database_uri = 'mysql+pymysql://root:root@127.0.0.1/git_webhook'
celery_broker_url = 'redis://:@127.0.0.1:6379/0'
celery_result_backend = 'redis://:@127.0.0.1:6379/0'
socket_message_queue = 'redis://:@127.0.0.1:6379/0'
github_client_id = '123'
github_client_secret =... |
__title__ = 'django-activeurl'
__package_name__ = 'django_activeurl'
__version__ = '0.1.12'
__description__ = 'Easy-to-use active URL highlighting for Django'
__email__ = 'hellysmile@gmail.com'
__author__ = 'hellysmile'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright (c) hellysmile@gmail.com'
| __title__ = 'django-activeurl'
__package_name__ = 'django_activeurl'
__version__ = '0.1.12'
__description__ = 'Easy-to-use active URL highlighting for Django'
__email__ = 'hellysmile@gmail.com'
__author__ = 'hellysmile'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright (c) hellysmile@gmail.com' |
#
# PySNMP MIB module AT-ISDN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-ISDN-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:14:15 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, 0... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint) ... |
# Compound Interest
P = float(input('Enter principal amount: $'))
r = float(input('Enter annual interest rate %'))
n = float(input('Enter number of times per year interest has compounded: '))
t = float(
input('Enter number of years account will be left to earn interest: '))
r /= 100 # 50% = .50
A = P * ((1 + (r ... | p = float(input('Enter principal amount: $'))
r = float(input('Enter annual interest rate %'))
n = float(input('Enter number of times per year interest has compounded: '))
t = float(input('Enter number of years account will be left to earn interest: '))
r /= 100
a = P * (1 + r / n) ** (n * t)
print('After ', t, ' years... |
#coding: utf-8
# Copyright 2005-2010 Wesabe, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | class Routingnumber:
def __init__(self, number):
self.number = number
try:
self.digits = [int(digit) for digit in str(self.number).strip()]
self.region_code = int(str(self.digits[0]) + str(self.digits[1]))
self.converted = True
except ValueError:
... |
def pytest_addoption(parser):
parser.addoption("--project", action="store", default='None')
def pytest_generate_tests(metafunc):
# This is called for every test. Only get/set command line arguments
# if the argument is specified in the list of test "fixturenames".
option_value = metafunc.config.option... | def pytest_addoption(parser):
parser.addoption('--project', action='store', default='None')
def pytest_generate_tests(metafunc):
option_value = metafunc.config.option.project
if 'project' in metafunc.fixturenames and option_value is not None:
metafunc.parametrize('project', [option_value]) |
#!/usr/bin/env python3
class Solution:
def findCircleNum(self, M):
sz, num = len(M), 0
marked = [False] * sz
def dfs(p):
marked[p] = True
for q in range(sz):
if M[p][q] and (not marked[q]):
dfs(q)
for p in range(sz):
... | class Solution:
def find_circle_num(self, M):
(sz, num) = (len(M), 0)
marked = [False] * sz
def dfs(p):
marked[p] = True
for q in range(sz):
if M[p][q] and (not marked[q]):
dfs(q)
for p in range(sz):
if not mar... |
#prints all TRs in a table
table = soup.findAll('table')[3]
for row in table.findAll('tr'):
print(row)
#prints each TR and each child tag in TR
table = soup.findAll('table')[3]
for row in table.findAll('tr'):
for line in row.findAll():
print(line)
| table = soup.findAll('table')[3]
for row in table.findAll('tr'):
print(row)
table = soup.findAll('table')[3]
for row in table.findAll('tr'):
for line in row.findAll():
print(line) |
#1. Idea here is we want to return a list of strings which contains all of the root to leaf paths in the binary tree.
#2. So initialize a list (path_list) then we are going to make a recursive call function. In the function we will pass the root of the binary tree and a empty string which we will modify and add node v... | def binary_tree_paths(self, root):
path_list = []
def recurse(root, path):
if root:
path += str(root.val)
if not root.left and (not root.right):
path_list.append(path)
else:
recurse(root.left, path + '->')
recurse(root.... |
class NfDictionaryTryGetResults:
def __init__(
self):
self.__key_exists = \
False
self.__value = \
None
def __get_key_exists(
self) \
-> bool:
key_exists = \
self.__key_exists
return \
key_exis... | class Nfdictionarytrygetresults:
def __init__(self):
self.__key_exists = False
self.__value = None
def __get_key_exists(self) -> bool:
key_exists = self.__key_exists
return key_exists
def __set_key_exists(self, key_exists: bool):
self.__key_exists = key_exists
... |
# pylint: disable=missing-function-docstring, missing-module-docstring/
# coding: utf-8
x = 1
e1 = x + a
e3 = f(x) + 1
# TODO e4 not working yet. we must get 2 errors
#e4 = f(x,y) + 1
| x = 1
e1 = x + a
e3 = f(x) + 1 |
# -*- coding: utf-8 -*-
def command():
return "edit-instance-vmware"
def init_argument(parser):
parser.add_argument("--instance-no", required=True)
parser.add_argument("--instance-type", required=True)
parser.add_argument("--key-name", required=True)
parser.add_argument("--compute-resource", requi... | def command():
return 'edit-instance-vmware'
def init_argument(parser):
parser.add_argument('--instance-no', required=True)
parser.add_argument('--instance-type', required=True)
parser.add_argument('--key-name', required=True)
parser.add_argument('--compute-resource', required=True)
parser.add_... |
##############################################################################
# Documentation/conf.py
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The... | project = 'NuttX'
copyright = '2020, The Apache Software Foundation'
author = 'NuttX community'
version = release = 'latest'
extensions = ['sphinx_rtd_theme', 'm2r2', 'sphinx.ext.autosectionlabel', 'sphinx.ext.todo', 'sphinx_tabs.tabs']
source_suffix = ['.rst', '.md']
todo_include_todos = True
autosectionlabel_prefix_d... |
config = {
'Department_level_configs': {
'Department_Name': 'Data Analisys Department',
'Department_Short_Name': 'DATA'
}
}
| config = {'Department_level_configs': {'Department_Name': 'Data Analisys Department', 'Department_Short_Name': 'DATA'}} |
# coding: utf-8
class UtgError(Exception):
MSG = None
def __init__(self, **kwargs):
super(UtgError, self).__init__(self.MSG % kwargs)
self.arguments = kwargs
class WordsError(UtgError):
pass
class WrongFormsNumberError(WordsError):
MSG = 'constuctor of word receive wrong number of... | class Utgerror(Exception):
msg = None
def __init__(self, **kwargs):
super(UtgError, self).__init__(self.MSG % kwargs)
self.arguments = kwargs
class Wordserror(UtgError):
pass
class Wrongformsnumbererror(WordsError):
msg = 'constuctor of word receive wrong number of forms (%(wrong_numb... |
''' Abstract class of healthcheck. There is only one method to implement,
that determines state of Vm or its underlying services.
Initialization - consider following config:
::
healthcheck:
driver: SomeHC
param1: AAAA
param2: BBBB
some_x: CCC
All params will be passed as config dict to the dr... | """ Abstract class of healthcheck. There is only one method to implement,
that determines state of Vm or its underlying services.
Initialization - consider following config:
::
healthcheck:
driver: SomeHC
param1: AAAA
param2: BBBB
some_x: CCC
All params will be passed as config dict to the dr... |
lines = int(input("Please enter number of lines : \n"))
ln = 1
while ln <= lines:
col = 1
while col <= lines:
if ln == 1 or col == 1 or col == lines or ln == lines:
print('*', end='')
else:
print(' ', end = '')
col += 1
print()
ln += 1
| lines = int(input('Please enter number of lines : \n'))
ln = 1
while ln <= lines:
col = 1
while col <= lines:
if ln == 1 or col == 1 or col == lines or (ln == lines):
print('*', end='')
else:
print(' ', end='')
col += 1
print()
ln += 1 |
# Valid API version in URL path: YYYY-MM or unstable
VERSION_PATTERN = r"([0-9]{4}-[0-9]{2})|unstable"
# /oauth/authorize, /oauth/access_token do not require authentication
NOT_AUTHABLE_PATTERN = r"\/oauth\/(authorize|access_token)"
# /oauth/access_scopes does not require versioned API path
NOT_VERSIONABLE_PATTERN = r"... | version_pattern = '([0-9]{4}-[0-9]{2})|unstable'
not_authable_pattern = '\\/oauth\\/(authorize|access_token)'
not_versionable_pattern = '\\/(oauth\\/access_scopes)'
link_pattern = '<.*?page_info=([a-zA-Z0-9\\-_]+).*?>; rel=\\"(next|previous)\\"'
retry_header = 'retry-after'
link_header = 'link'
access_token_header = 'x... |
def iterate(pop):
p = pop.copy()
for i in range(8):
p[i] = pop[i + 1]
p[8] = pop[0]
p[6] += pop[0]
return p
pop = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0}
population = [int(n) for n in open('input.txt', 'r').readline().split(',')]
for fish in population:
pop[fish] += 1
f... | def iterate(pop):
p = pop.copy()
for i in range(8):
p[i] = pop[i + 1]
p[8] = pop[0]
p[6] += pop[0]
return p
pop = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0}
population = [int(n) for n in open('input.txt', 'r').readline().split(',')]
for fish in population:
pop[fish] += 1
for ... |
for c in range(6, 0,-1):
print(c)
n1 = int(input('Inicio: '))
n2 = int(input('Fim: '))
n3 = int(input('Passo: '))
for c in range(n1, n2 + 1, n3):
print(c) | for c in range(6, 0, -1):
print(c)
n1 = int(input('Inicio: '))
n2 = int(input('Fim: '))
n3 = int(input('Passo: '))
for c in range(n1, n2 + 1, n3):
print(c) |
#
# PySNMP MIB module SLAPM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SLAPM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:06:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ... |
# To format the names in title case
input_first_name=input("Enter the first name: ")
input_last_name= input("Enter the last name: ")
def format_name(first_name,last_name):
first_name = first_name.title()
last_name = last_name.title()
full_name = first_name + " "+last_name
return full_name
name = forma... | input_first_name = input('Enter the first name: ')
input_last_name = input('Enter the last name: ')
def format_name(first_name, last_name):
first_name = first_name.title()
last_name = last_name.title()
full_name = first_name + ' ' + last_name
return full_name
name = format_name(input_first_name, input_... |
def determine_dim_size(dim_modalities, pick_modalities):
if len(pick_modalities) < len(dim_modalities):
dim_modalities = [dim_modalities[mod_idx] for mod_idx in pick_modalities]
return dim_modalities
def prepare_batch(multidimensional_ts, split_modalities, pick_modalities, dim_modalities):
if split... | def determine_dim_size(dim_modalities, pick_modalities):
if len(pick_modalities) < len(dim_modalities):
dim_modalities = [dim_modalities[mod_idx] for mod_idx in pick_modalities]
return dim_modalities
def prepare_batch(multidimensional_ts, split_modalities, pick_modalities, dim_modalities):
if split... |
#################################################################
# #
# Program Code for Spot Micro MRL #
# Of the Cyber_One YouTube Channel #
# https://www.youtube.com/cyber_one ... | runing_folder = 'Spot'
execfile(RuningFolder + '/1_Configuration/1_Sys_Config.py')
if RunWebGUI == True:
plan = runtime.load('webgui', 'WebGui')
config = plan.get('webgui')
config.autoStartBrowser = False
runtime.start('webgui', 'WebGui')
execfile(RuningFolder + '/Common_Variables.py')
execfile(RuningFo... |
def printg(grid, name):
print( '%s: [' % name)
for row in grid:
print( row)
print( ']')
def dist(p, q):
dx = abs(p[0] - q[0])
dy = abs(p[1] - q[1])
return dx + dy;
def reconstruct_path(came_from, current):
total_path = [current]
while current in came_from.keys():
curren... | def printg(grid, name):
print('%s: [' % name)
for row in grid:
print(row)
print(']')
def dist(p, q):
dx = abs(p[0] - q[0])
dy = abs(p[1] - q[1])
return dx + dy
def reconstruct_path(came_from, current):
total_path = [current]
while current in came_from.keys():
current = ... |
msg_soc='BA:?'
msg_p='P:?'
msg_ppvt='PV:?'
msg_conso='CON:?'
soc=101
try:
tree = etree.parse(configGet('tmpFileDataXml'))
for datas in tree.xpath("/devices/device/datas/data"):
if datas.get("id") in configGet('lcd','dataPrint'):
for data in datas.getchildren():
if data.tag =... | msg_soc = 'BA:?'
msg_p = 'P:?'
msg_ppvt = 'PV:?'
msg_conso = 'CON:?'
soc = 101
try:
tree = etree.parse(config_get('tmpFileDataXml'))
for datas in tree.xpath('/devices/device/datas/data'):
if datas.get('id') in config_get('lcd', 'dataPrint'):
for data in datas.getchildren():
i... |
HP_SERIAL_FORMAT_DEFAULT = "auto"
HP_SERIAL_FORMAT_CHOICES = ["auto", "yaml", "pickle"]
HP_ACTION_PREFIX_DEFAULT = "hp"
| hp_serial_format_default = 'auto'
hp_serial_format_choices = ['auto', 'yaml', 'pickle']
hp_action_prefix_default = 'hp' |
class TranslatorExceptions(Exception):
def __init__(self, message):
super().__init__()
self.message = message
class LangDoesNotExists(TranslatorExceptions):
def __init__(self):
super().__init__(
'Requested language does not exists\nTry to run \'lang\' command to be familiar... | class Translatorexceptions(Exception):
def __init__(self, message):
super().__init__()
self.message = message
class Langdoesnotexists(TranslatorExceptions):
def __init__(self):
super().__init__("Requested language does not exists\nTry to run 'lang' command to be familiar with supporte... |
{
"targets": [
{
"target_name": "mtrace",
"sources": [ "mtrace.cc" ],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
]
}
]
}
| {'targets': [{'target_name': 'mtrace', 'sources': ['mtrace.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")']}]} |
class Node:
def __init__(self, data, parent=None):
self.parent = parent
self.data = data
self.left = None
self.right = None
def leftChild(self, left):
self.left = Node(left, self)
def rightChild... | class Node:
def __init__(self, data, parent=None):
self.parent = parent
self.data = data
self.left = None
self.right = None
def left_child(self, left):
self.left = node(left, self)
def right_child(self, right):
self.right = node(right, self)
def __str_... |
class Solution:
def isPalindrome(self, s: str) -> bool:
formattedString = ''.join([c.lower() for c in s if c.isalnum()])
if formattedString == formattedString[::-1]:
return True
return False | class Solution:
def is_palindrome(self, s: str) -> bool:
formatted_string = ''.join([c.lower() for c in s if c.isalnum()])
if formattedString == formattedString[::-1]:
return True
return False |
VERSION = (0, 0, 2, 3)
__version__ = '.'.join(map(str, VERSION))
default_app_config = 'django.chatbot.apps.DjangoChatBotConfig'
| version = (0, 0, 2, 3)
__version__ = '.'.join(map(str, VERSION))
default_app_config = 'django.chatbot.apps.DjangoChatBotConfig' |
# Use right join to merge the movie_to_genres and pop_movies tables
genres_movies = movie_to_genres.merge(pop_movies, how='right',
left_on='movie_id',
right_on='id')
# Count the number of genres
genre_count = genres_movies.groupby('genre... | genres_movies = movie_to_genres.merge(pop_movies, how='right', left_on='movie_id', right_on='id')
genre_count = genres_movies.groupby('genre').agg({'id': 'count'})
genre_count.plot(kind='bar')
plt.show() |
counter = 10
sums = 1
k = 2
currLast = 1
while counter > 0:
k += 1
while sums < (k + 1) ** 2:
currLast += 1
sums += currLast
if sums == (k + 1) ** 2:
counter -= 1
print (k + 1), currLast
| counter = 10
sums = 1
k = 2
curr_last = 1
while counter > 0:
k += 1
while sums < (k + 1) ** 2:
curr_last += 1
sums += currLast
if sums == (k + 1) ** 2:
counter -= 1
(print(k + 1), currLast) |
CONVERT_JSON_TO_YAML = {
"type": "post",
"endpoint": "/convertJSONtoYAML",
"call_message": "{type} {endpoint}",
"error_message": "{type} {endpoint} {response_code}"
}
CONVERT_RANGE_FROM_TO = {
"type": "get",
"endpoint": "/convertRangeFromTo",
"call_message": "{type} {endpoint}",
"error_message": "{type} {endpoi... | convert_json_to_yaml = {'type': 'post', 'endpoint': '/convertJSONtoYAML', 'call_message': '{type} {endpoint}', 'error_message': '{type} {endpoint} {response_code}'}
convert_range_from_to = {'type': 'get', 'endpoint': '/convertRangeFromTo', 'call_message': '{type} {endpoint}', 'error_message': '{type} {endpoint} {respon... |
number = 0
total = 0
while number != -1:
total += number
number = float(input("Please enter a positive number (-1 to stop):"))
print(total)
| number = 0
total = 0
while number != -1:
total += number
number = float(input('Please enter a positive number (-1 to stop):'))
print(total) |
#
# PySNMP MIB module ZHONE-CARD-DIAGNOSTICS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-CARD-DIAGNOSTICS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:46:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ... |
line = input()
party = {}
unlikes = 0
while line != "Stop":
act, guest, meal = line.split("-")
if act == "Like":
if guest in party.keys():
if meal in party[guest]:
line = input()
continue
party[guest].append(meal)
line = input()
... | line = input()
party = {}
unlikes = 0
while line != 'Stop':
(act, guest, meal) = line.split('-')
if act == 'Like':
if guest in party.keys():
if meal in party[guest]:
line = input()
continue
party[guest].append(meal)
line = input()
... |
L=raw_input("Please Enter the length of the layer (in m): ")
A=raw_input("Please Enter the area of the wall (in m2): ")
material=raw_input("Please Enter the material of the layer: ")
if material=="glass":
type_glas=raw_input("which type of glass do you mean:window=1, wool insulation=2 ")
if int(type_glas)==1:
... | l = raw_input('Please Enter the length of the layer (in m): ')
a = raw_input('Please Enter the area of the wall (in m2): ')
material = raw_input('Please Enter the material of the layer: ')
if material == 'glass':
type_glas = raw_input('which type of glass do you mean:window=1, wool insulation=2 ')
if int(type_g... |
#define a value holder function
# => True
def switch(value):
switch.value=value
return True
#define matching case function
# => True or False
def case(*args):
return any((arg == switch.value for arg in args))
# Switch example:
print("Describe a number from range:")
for n in range(0,10):
print(n, end=" "... | def switch(value):
switch.value = value
return True
def case(*args):
return any((arg == switch.value for arg in args))
print('Describe a number from range:')
for n in range(0, 10):
print(n, end=' ', flush=True)
print()
x = input('n:')
n = int(x)
while switch(n):
if case(0):
print('n is zero... |
#!/usr/bin/python3
# Guilhem Mizrahi 09/2019
def first():
var1=input("Enter the first number: ")
var2=input("Enter the second number: ")
print(var1/var2)
def second():
var1=int(input("Enter the first number: "))
var2=int(input("Enter the second number: "))
print(var1/var2)
def third():
... | def first():
var1 = input('Enter the first number: ')
var2 = input('Enter the second number: ')
print(var1 / var2)
def second():
var1 = int(input('Enter the first number: '))
var2 = int(input('Enter the second number: '))
print(var1 / var2)
def third():
retvalue1 = ''
while not retvalu... |
PROG = 'censor'
fin = open(PROG + '.in', 'r')
fout = open(PROG + '.out', 'w')
def main():
s = fin.readline()
s = s[:len(s) - 1]
t = fin.readline()
t = t[:len(t) - 1]
while True:
i = s.find(t)
if i == -1:
break
s = s[0:i] + s[i + len(t):]
fout.write(s + '\n')
main()
fin.close()
fout.close()
| prog = 'censor'
fin = open(PROG + '.in', 'r')
fout = open(PROG + '.out', 'w')
def main():
s = fin.readline()
s = s[:len(s) - 1]
t = fin.readline()
t = t[:len(t) - 1]
while True:
i = s.find(t)
if i == -1:
break
s = s[0:i] + s[i + len(t):]
fout.write(s + '\n')
... |
class IncorrectInputVectorLength(Exception):
pass
class NetIsNotInitialized(Exception):
pass
class IncorrectFactorValue(Exception):
pass
class NetIsNotCalculated(Exception):
pass
class IncorrectExpectedOutputVectorLength(Exception):
pass
class NetConfigIndefined(Exception):
pass
clas... | class Incorrectinputvectorlength(Exception):
pass
class Netisnotinitialized(Exception):
pass
class Incorrectfactorvalue(Exception):
pass
class Netisnotcalculated(Exception):
pass
class Incorrectexpectedoutputvectorlength(Exception):
pass
class Netconfigindefined(Exception):
pass
class Netc... |
class BingoBoard:
def __init__(self, numbers):
self.numbers = [int(n) for n in numbers.replace("\n", " ").split()]
self.marked = set()
def mark(self, n):
if n in self.numbers:
self.marked.add(n)
return self.check_win()
return False
def get_score(sel... | class Bingoboard:
def __init__(self, numbers):
self.numbers = [int(n) for n in numbers.replace('\n', ' ').split()]
self.marked = set()
def mark(self, n):
if n in self.numbers:
self.marked.add(n)
return self.check_win()
return False
def get_score(sel... |
#from http://rosettacode.org/wiki/Greatest_common_divisor#Python
#pythran export gcd_iter(int, int)
#pythran export gcd(int, int)
#pythran export gcd_bin(int, int)
#runas gcd_iter(40902, 24140)
#runas gcd(40902, 24140)
#runas gcd_bin(40902, 24140)
def gcd_iter(u, v):
while v:
u, v = v, u % v
return abs... | def gcd_iter(u, v):
while v:
(u, v) = (v, u % v)
return abs(u)
def gcd(u, v):
return gcd(v, u % v) if v else abs(u)
def gcd_bin(u, v):
(u, v) = (abs(u), abs(v))
if u < v:
(u, v) = (v, u)
if v == 0:
return u
k = 1
while u & 1 == 0 and v & 1 == 0:
u >>= 1
... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | class Jobmode:
collective = 'collective'
ps = 'ps'
heter = 'heter'
class Job(object):
def __init__(self, jid='default', mode=JobMode.COLLECTIVE, nnodes='1'):
self._mode = mode
self._id = jid
self._replicas = 0
self._replicas_min = self._replicas
self._replicas_m... |
def Menunggu(n,des):
#basis
if n == 0:
return 0
#rekuren
print(des)
return Menunggu(n-1,des)
def MySum(n):
#basis
if n == 0:
return 0
#rekuren
return n+MySum(n-1)
def main():
# solusi iteratif/pengulangan dengan teknik for loop
#n = 10
#for i in range(n... | def menunggu(n, des):
if n == 0:
return 0
print(des)
return menunggu(n - 1, des)
def my_sum(n):
if n == 0:
return 0
return n + my_sum(n - 1)
def main():
menunggu(10, 'Menunggu si dia.')
print(my_sum(10))
if __name__ == '__main__':
main() |
i = input().split()
N,Q = int(i[0]),int(i[1])
AI = input().split()
ai = []
for n in AI:
ai.append(int(n))
QI = input().split()
qi = []
for n in QI:
qi.append(int(n))
for q in qi:
ai_aux = ai.copy()
count = 0
p = 0
while(p<len(ai_aux)-1):
if q in ai_aux:
... | i = input().split()
(n, q) = (int(i[0]), int(i[1]))
ai = input().split()
ai = []
for n in AI:
ai.append(int(n))
qi = input().split()
qi = []
for n in QI:
qi.append(int(n))
for q in qi:
ai_aux = ai.copy()
count = 0
p = 0
while p < len(ai_aux) - 1:
if q in ai_aux:
count += 1
... |
class hparams:
train_or_test = 'train'
output_dir = 'logs/your_program_name'
aug = False
latest_checkpoint_file = 'checkpoint_latest.pt'
total_epochs = 100
epochs_per_checkpoint = 10
batch_size = 2
ckpt = None
init_lr = 0.0002
scheduer_step_size = 20
scheduer_gamma = 0.8
... | class Hparams:
train_or_test = 'train'
output_dir = 'logs/your_program_name'
aug = False
latest_checkpoint_file = 'checkpoint_latest.pt'
total_epochs = 100
epochs_per_checkpoint = 10
batch_size = 2
ckpt = None
init_lr = 0.0002
scheduer_step_size = 20
scheduer_gamma = 0.8
... |
'''
--- Day 1: The Tyranny of the Rocket Equation ---
-- Part 1 --
The Elves quickly load you into a spacecraft and prepare to launch.
At the first Go / No Go poll, every Elf is Go until the Fuel Counter-Upper.
They haven't determined the amount of fuel required yet.
Fuel required to launch a given module is based... | """
--- Day 1: The Tyranny of the Rocket Equation ---
-- Part 1 --
The Elves quickly load you into a spacecraft and prepare to launch.
At the first Go / No Go poll, every Elf is Go until the Fuel Counter-Upper.
They haven't determined the amount of fuel required yet.
Fuel required to launch a given module is based... |
#This is a simple inventory program for a small car dealership.
print('Automotive Inventory')
class Automobile:
def __init__(self):
self._make = ''
self._model = ''
self._year = 0
self._color = ''
self._mileage = 0
def addVehicle(self):
try:
... | print('Automotive Inventory')
class Automobile:
def __init__(self):
self._make = ''
self._model = ''
self._year = 0
self._color = ''
self._mileage = 0
def add_vehicle(self):
try:
self._make = input('Enter vehicle make: ')
self._model = i... |
__author__ = 'ian.collins'
currentcolor = True # true=day, false=night
lightthreshold = 50
lightchecktime = 10.0
gpsrefreshtime = 15.0
netrefreshtime = 30.0
crvincidentmain = None
# The actualt status bar
statusbar = None
# Where the statusbar fields are kept
statusbarbox = None
# An alternate statusbar ... | __author__ = 'ian.collins'
currentcolor = True
lightthreshold = 50
lightchecktime = 10.0
gpsrefreshtime = 15.0
netrefreshtime = 30.0
crvincidentmain = None
statusbar = None
statusbarbox = None
altstatusbarbox = None
alstatusbarclick = ''
alstatusbarparent = None
quickpopup = None
data = None
msgbox = None
mycurl = None... |
#########################################################################################################################################################################
# Author : Remi Monthiller, remi.monthiller@etu.enseeiht.fr
# Adapted from the code of Raphael Maurin, raphael.maurin@imft.fr
# 30/10/2018
#
# Inclin... | def length_vector3(vect):
return (vect[0] ** 2.0 + vect[1] ** 2.0 + vect[2] ** 2.0) ** (1.0 / 2.0) |
DRIVERS = {
"default": "cookie",
"cookie": {},
}
| drivers = {'default': 'cookie', 'cookie': {}} |
string = "resource"
if len(string) < 2:
print("--")
else:
print(string[0:2] + string[-2:])
| string = 'resource'
if len(string) < 2:
print('--')
else:
print(string[0:2] + string[-2:]) |
def increment_id(tag):
if tag == "error":
filename = "errorarena"
elif tag == "valid":
filename = "validarena"
elif tag == "gif":
filename = "gif"
file = open(f"./results/id/{filename}.txt","r")
id_line = file.readline()
file.close()
curr_id = int(id_line.strip())... | def increment_id(tag):
if tag == 'error':
filename = 'errorarena'
elif tag == 'valid':
filename = 'validarena'
elif tag == 'gif':
filename = 'gif'
file = open(f'./results/id/{filename}.txt', 'r')
id_line = file.readline()
file.close()
curr_id = int(id_line.strip())
... |
for char in 'One':
print (char)
'''
O
n
e
''' | for char in 'One':
print(char)
'\nO\nn \ne\n' |
# program to convert degrees f to degrees c
# need to use (degF - 32) * 5/9
user = input('Hello, what is your name? ')
print('Hello', user)
degF = int(input('Enter a temperature in degrees F: '))
degC = (degF -32) * 5/9
print('{} ,degrees F converts to , {} ,degrees C'.format(degF, (degC)))
| user = input('Hello, what is your name? ')
print('Hello', user)
deg_f = int(input('Enter a temperature in degrees F: '))
deg_c = (degF - 32) * 5 / 9
print('{} ,degrees F converts to , {} ,degrees C'.format(degF, degC)) |
num =10
num2= 20
num3=30
num4=40
| num = 10
num2 = 20
num3 = 30
num4 = 40 |
class A(object):
x:int = 1
class B(A):
def __init__(self: "B"):
pass
class C(B):
z:bool = True
a:A = None
b:B = None
c:C = None
a = A()
b = B()
c = C()
| class A(object):
x: int = 1
class B(A):
def __init__(self: 'B'):
pass
class C(B):
z: bool = True
a: A = None
b: B = None
c: C = None
a = a()
b = b()
c = c() |
class Solution:
def findKthPositive(self, arr: List[int], k: int) -> int:
'''
Number of missing element at index i =
= arr[0] - 1 + arr[idx] - arr[0] - idx =
= arr[idx] - idx - 1
For more description, see: 1060 Missing Element in Sorted Array
T: O(log n) a... | class Solution:
def find_kth_positive(self, arr: List[int], k: int) -> int:
"""
Number of missing element at index i =
= arr[0] - 1 + arr[idx] - arr[0] - idx =
= arr[idx] - idx - 1
For more description, see: 1060 Missing Element in Sorted Array
T: O(log n... |
z = "Tests were ran for service: matchService \n" \
"Passed: \n" \
"Failed: \n" \
"Error: \n" \
"Skipped: \n"
| z = 'Tests were ran for service: matchService \nPassed: \nFailed: \nError: \nSkipped: \n' |
ip_addr1="192.168.1.1"
ip_addr2="10.1.1.1"
ip_addr3="172.16.1.1"
print ("\n")
print ("-" * 80)
print ("{my_ip:^20}{ip:^20}{ip_alt:^20}".format(ip_alt=ip_addr1, ip=ip_addr2, my_ip=ip_addr3))
print ("-" * 80)
print ("\n")
octets = ip_addr1.split('.')
| ip_addr1 = '192.168.1.1'
ip_addr2 = '10.1.1.1'
ip_addr3 = '172.16.1.1'
print('\n')
print('-' * 80)
print('{my_ip:^20}{ip:^20}{ip_alt:^20}'.format(ip_alt=ip_addr1, ip=ip_addr2, my_ip=ip_addr3))
print('-' * 80)
print('\n')
octets = ip_addr1.split('.') |
class Registers(object):
def __eq__(self, other) :
return self.__dict__ == other.__dict__
def __init__(self):
self.accumulator = 0
self.x_index = 0
self.y_index = 0
self.sp = 0xFD
self.pc = 0
self.carry_flag = False
self.zero_flag = ... | class Registers(object):
def __eq__(self, other):
return self.__dict__ == other.__dict__
def __init__(self):
self.accumulator = 0
self.x_index = 0
self.y_index = 0
self.sp = 253
self.pc = 0
self.carry_flag = False
self.zero_flag = False
s... |
class Solution:
def anagrams(self, strs):
key = lambda s: ''.join(sorted(s))
strs = sorted(strs, key=key)
strs = itertools.groupby(strs, key=key)
result = []
for k, g in strs:
l = list(g)
if len(l) == 1:
continue
... | class Solution:
def anagrams(self, strs):
key = lambda s: ''.join(sorted(s))
strs = sorted(strs, key=key)
strs = itertools.groupby(strs, key=key)
result = []
for (k, g) in strs:
l = list(g)
if len(l) == 1:
continue
result.e... |
# Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | DA.data_factory.load()
print(f'source: {DA.paths.data_landing_location}')
print(f'Target: {DA.db_name}')
print(f'Storage Location: {DA.paths.storage_location}')
DA.generate_register_dlt_event_metrics_sql()
for command in generate_register_dlt_event_metrics_sql_string.split(';'):
if len(command) ... |
# Meta classes
class Meta(type):
def __new__(self, class_name, bases, attrs):
print(attrs)
a = {}
for name, val in attrs.items():
if name.startswith("__"):
a[name] = val
else:
a[name.upper()] = val
return type(class_name, bases... | class Meta(type):
def __new__(self, class_name, bases, attrs):
print(attrs)
a = {}
for (name, val) in attrs.items():
if name.startswith('__'):
a[name] = val
else:
a[name.upper()] = val
return type(class_name, bases, a)
class D... |
def listifyer(word):
listify = list(word)
return listify
def rearrPL(word):
seperator = ','
del word[-1]
del word[-1]
last_element = word[(len(word) - 1)]
word.insert(0, last_element)
del word[-1]
new_word = seperator.join(word)
return new_word
def rearrE(word):
first_let... | def listifyer(word):
listify = list(word)
return listify
def rearr_pl(word):
seperator = ','
del word[-1]
del word[-1]
last_element = word[len(word) - 1]
word.insert(0, last_element)
del word[-1]
new_word = seperator.join(word)
return new_word
def rearr_e(word):
first_lette... |
mortgage = 366323
agent_fee = .06
prorated_property_taxes = 400
prorated_mortgage_interest = 1500
other_fees = 2500
closing_costs = prorated_property_taxes + prorated_mortgage_interest + other_fees
sale_price = input('What is the sale price of your home? ')
agent_cost = agent_fee * float(sale_price)
price_per_sqft = (f... | mortgage = 366323
agent_fee = 0.06
prorated_property_taxes = 400
prorated_mortgage_interest = 1500
other_fees = 2500
closing_costs = prorated_property_taxes + prorated_mortgage_interest + other_fees
sale_price = input('What is the sale price of your home? ')
agent_cost = agent_fee * float(sale_price)
price_per_sqft = f... |
_base_ = './mask_rcnn_r50_fpn_gn_ws-all_2x_coco.py'
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://jhu/resnet101_gn_ws'))) | _base_ = './mask_rcnn_r50_fpn_gn_ws-all_2x_coco.py'
model = dict(backbone=dict(depth=101, init_cfg=dict(type='Pretrained', checkpoint='open-mmlab://jhu/resnet101_gn_ws'))) |
'''
Author : MiKueen
Level : Medium
Problem Statement : Find First and Last Position of Elements in Sorted Array
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target ... | """
Author : MiKueen
Level : Medium
Problem Statement : Find First and Last Position of Elements in Sorted Array
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target ... |
totidade = homens = mulheresmenores = 0
while True:
print('-'*20)
print('Cadastre uma pessoa')
print('-'*20)
idade = int(input('Idade: '))
sexo = ' '
while sexo not in 'MF':
sexo = str(input('Sexo: [M/F]')).strip().upper()[0]
cont = ' '
while cont not in 'SN':
cont = str... | totidade = homens = mulheresmenores = 0
while True:
print('-' * 20)
print('Cadastre uma pessoa')
print('-' * 20)
idade = int(input('Idade: '))
sexo = ' '
while sexo not in 'MF':
sexo = str(input('Sexo: [M/F]')).strip().upper()[0]
cont = ' '
while cont not in 'SN':
cont = ... |
def get_build_tool(name):
tools = {
"cmake": CMakeBuildTool,
"colcon": ColconBuildTool,
"catkin": CatkinBuildTool
}
if name not in tools:
raise Exception("Unknown build tool: {}".format(name))
return tools[name]
class BuildTool():
@staticmethod
def getCommands():... | def get_build_tool(name):
tools = {'cmake': CMakeBuildTool, 'colcon': ColconBuildTool, 'catkin': CatkinBuildTool}
if name not in tools:
raise exception('Unknown build tool: {}'.format(name))
return tools[name]
class Buildtool:
@staticmethod
def get_commands():
return [k for k in se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.