content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
ngsi_data=\
{
"originator": "",
"subscriptionId": "d0c08d50-6296-4ef3-9b0f-ff48b3cd5528",
"contextResponses": [{
"contextElement": {
"attributes": [{
"value": 34,
"type": "float",
... | ngsi_data = {'originator': '', 'subscriptionId': 'd0c08d50-6296-4ef3-9b0f-ff48b3cd5528', 'contextResponses': [{'contextElement': {'attributes': [{'value': 34, 'type': 'float', 'name': 'tempo'}], 'entityId': {'type': 'Tempr', 'id': 'Temprature702'}, 'domainMetadata': [{'type': 'point', 'name': 'location', 'value': {'lat... |
def main(request, response):
response.writer.write_status(200)
response.writer.write_header("Content-Type", "text/plain")
response.writer.end_headers()
response.writer.write(str(request.raw_headers))
response.close_connection = True
| def main(request, response):
response.writer.write_status(200)
response.writer.write_header('Content-Type', 'text/plain')
response.writer.end_headers()
response.writer.write(str(request.raw_headers))
response.close_connection = True |
first_printing = [1, 1, 2, 11, 5, 8, 13, 2, 4]
second_printing = [2, 4, 5, 1, 6, 8, 9, 3, 10, 13]
eralps_sheets = []
recycle_bin = []
# Your code starts here
| first_printing = [1, 1, 2, 11, 5, 8, 13, 2, 4]
second_printing = [2, 4, 5, 1, 6, 8, 9, 3, 10, 13]
eralps_sheets = []
recycle_bin = [] |
# Ways to color a 3xN Board
# https://www.interviewbit.com/problems/ways-to-color-a-3xn-board/
#
# Given a 3Xn board, find the number of ways to color it using at most 4 colors such that no two adjacent boxes have same color. Diagonal neighbors are not treated as adjacent boxes.
# Output the ways%1000000007 as the answ... | class Solution:
def solve(self, A):
(color2, color3) = (12, 24)
for i in range(2, A + 1):
temp = color3
color3 = (11 * color3 + 10 * color2) % 1000000007
color2 = (5 * temp + 7 * color2) % 1000000007
return (color2 + color3) % 1000000007
if __name__ == '_... |
class TestGen:
def __init__(self, cnt):
self._cnt = cnt
def __call__(self, *args, **kwargs):
dat_ = 1
while True:
try:
dat_ = yield dat_
if dat_ == 20:
raise StopIteration
except StopIteration:
... | class Testgen:
def __init__(self, cnt):
self._cnt = cnt
def __call__(self, *args, **kwargs):
dat_ = 1
while True:
try:
dat_ = (yield dat_)
if dat_ == 20:
raise StopIteration
except StopIteration:
... |
EFFECTS = [
"motion",
"sharpening",
"contrast",
"jpeg",
"noise",
"saturation",
]
| effects = ['motion', 'sharpening', 'contrast', 'jpeg', 'noise', 'saturation'] |
speed()
radius = 100
def draw_circle():
color_choice = input("What color should this circle be?: ")
pendown()
color(color_choice)
begin_fill()
circle(radius)
penup()
end_fill()
left(90)
forward(25)
right(90)
penup()
setposition(0, -100)
for i in range(4):
... | speed()
radius = 100
def draw_circle():
color_choice = input('What color should this circle be?: ')
pendown()
color(color_choice)
begin_fill()
circle(radius)
penup()
end_fill()
left(90)
forward(25)
right(90)
penup()
setposition(0, -100)
for i in range(4):
draw_circle()
r... |
DB_USER = 'root'
DB_PASSWORD = ''
DB_HOST = ''
DB_DB = 'flask-pyjwt-auth'
DEBUG = True
PORT = 5000
HOST = "0.0.0.0"
SECRET_KEY = "my secert"
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_DATABASE_URI = 'mysql://' + DB_USER + ':' + DB_PASSWORD + '@' + DB_HOST + '/' + DB_DB
| db_user = 'root'
db_password = ''
db_host = ''
db_db = 'flask-pyjwt-auth'
debug = True
port = 5000
host = '0.0.0.0'
secret_key = 'my secert'
sqlalchemy_track_modifications = False
sqlalchemy_database_uri = 'mysql://' + DB_USER + ':' + DB_PASSWORD + '@' + DB_HOST + '/' + DB_DB |
#
# @lc app=leetcode id=28 lang=python3
#
# [28] Implement strStr()
#
# @lc code=start
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if needle == '':
return 0
needle_len = len(needle)
for i in range(len(haystack) - needle_len + 1):
string = h... | class Solution:
def str_str(self, haystack: str, needle: str) -> int:
if needle == '':
return 0
needle_len = len(needle)
for i in range(len(haystack) - needle_len + 1):
string = haystack[i:i + needle_len]
if string == needle:
return i
... |
#!/usr/bin/env python3
def is_decreasing(seq):
for element in range(0, len(seq) - 1):
if seq[element] < seq[element + 1]:
return False
return True
if __name__ == "__main__":
print (is_decreasing([6, 5, 4, 3, 1]))
| def is_decreasing(seq):
for element in range(0, len(seq) - 1):
if seq[element] < seq[element + 1]:
return False
return True
if __name__ == '__main__':
print(is_decreasing([6, 5, 4, 3, 1])) |
def my_complex(my_real, my_imag):
my_result = complex(my_real,my_imag)
return my_result
print(my_complex(my_real = 2,my_imag = 8)) # K1
print(my_complex(my_imag = 8, my_real = 2)) # K2
print(my_complex(2,my_imag = 8)) # K3
| def my_complex(my_real, my_imag):
my_result = complex(my_real, my_imag)
return my_result
print(my_complex(my_real=2, my_imag=8))
print(my_complex(my_imag=8, my_real=2))
print(my_complex(2, my_imag=8)) |
def produto(u,v):
if len(u)!=len(v):
return "Esses vetores tem tamanhos diferentes."
prod=0
for i in v:
prod+=i*u[i]
return prod
| def produto(u, v):
if len(u) != len(v):
return 'Esses vetores tem tamanhos diferentes.'
prod = 0
for i in v:
prod += i * u[i]
return prod |
class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
m = len(grid)
n = len(grid[0])
dq = deque()
islands = 0
for i in range(m):
for j in range(n):
if grid[i][j] == '1': # run bfs
islands += 1
... | class Solution:
def num_islands(self, grid: List[List[str]]) -> int:
m = len(grid)
n = len(grid[0])
dq = deque()
islands = 0
for i in range(m):
for j in range(n):
if grid[i][j] == '1':
islands += 1
dq.append... |
#!/usr/bin/env python3
__all__ = [
'msfconsole',
'msfrpc',
'utils'
]
| __all__ = ['msfconsole', 'msfrpc', 'utils'] |
# Store operation program
# Created By Abraham Baffoe CEO of WeGo GH and tutor of bestpointtutorials on youtube and instagram.
#Do not copy this code by you can edit the code. Thank you!
input('Enter your name dear Customer: ')
str(input('Enter your location to find: '))
print('You are welcome to WeGo gh Custome... | input('Enter your name dear Customer: ')
str(input('Enter your location to find: '))
print('You are welcome to WeGo gh Customer !')
days_of_operation = 'Monday'
user_choice_of_day = input('Enter any of the working day: ')
user_choice_of_time = int(input('Enter the time: '))
time_of_operation_morning = 10
time_of_operat... |
a_list = ["a", "", "c", "", "e"]
empty_strings = []
for string in a_list:
if (string != ""):
empty_strings.append(string)
print(empty_strings)
| a_list = ['a', '', 'c', '', 'e']
empty_strings = []
for string in a_list:
if string != '':
empty_strings.append(string)
print(empty_strings) |
galera = list()
info = list()
cadastro = 0
while True:
info.append(str(input('Nome: ')))
info.append(float(input('Peso: ')))
galera.append(info[:])
info.clear()
cadastro += 1
while True:
q = str(input('Quer continuar? [S/N] ')).upper()
if q in 'SN':
break
if q == ... | galera = list()
info = list()
cadastro = 0
while True:
info.append(str(input('Nome: ')))
info.append(float(input('Peso: ')))
galera.append(info[:])
info.clear()
cadastro += 1
while True:
q = str(input('Quer continuar? [S/N] ')).upper()
if q in 'SN':
break
if q == ... |
class Complex:
def __new__(cls,a,b):
if b==0:
return type(a).__new__(type(a),a)
else:
return super(Complex,cls).__new__(cls)
def __init__(self, Re, Im):
if Im:
self.re = Re
self.im = Im
else:
self.__class__=int
def ... | class Complex:
def __new__(cls, a, b):
if b == 0:
return type(a).__new__(type(a), a)
else:
return super(Complex, cls).__new__(cls)
def __init__(self, Re, Im):
if Im:
self.re = Re
self.im = Im
else:
self.__class__ = int... |
# James Quintin 03/02/18
# Using split() to separate string component
with open("datum/iris.csv") as f:
for line in f:
print(line.split(',')[4],end='') # removes new line
| with open('datum/iris.csv') as f:
for line in f:
print(line.split(',')[4], end='') |
# a minimal tracking script - this will start all peer
# services and attach everything appropriately
# change parameters depending on your pan tilt, pins and
# Arduino details
# all commented code is not necessary but allows custom
# options
port = "COM19" #change COM port to your own port
xServoPin = 13 #change ... | port = 'COM19'
x_servo_pin = 13
y_servo_pin = 12
tracker = Runtime.start('tracker', 'Tracking')
gui = Runtime.start('gui', 'SwingGui')
opencv = tracker.getOpenCV()
servo_x = tracker.getX()
servoX.setMinMax(30, 150)
servo_y = tracker.getY()
servoY.setMinMax(30, 150)
pid = tracker.getPID()
pid.setPID('x', 5.0, 5.0, 0.1)
... |
#
# PySNMP MIB module RLLAN1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RLLAN1-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:57:55 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:... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, single_value_constraint, value_range_constraint, constraints_intersection) ... |
# Python - 3.6.0
Test.it('Basic tests')
Test.assert_equals(capitalize('abcdef'), ['AbCdEf', 'aBcDeF'])
Test.assert_equals(capitalize('codewars'), ['CoDeWaRs', 'cOdEwArS'])
Test.assert_equals(capitalize('abracadabra'), ['AbRaCaDaBrA', 'aBrAcAdAbRa'])
Test.assert_equals(capitalize('codewarriors'), ['CoDeWaRrIoRs', 'cOdE... | Test.it('Basic tests')
Test.assert_equals(capitalize('abcdef'), ['AbCdEf', 'aBcDeF'])
Test.assert_equals(capitalize('codewars'), ['CoDeWaRs', 'cOdEwArS'])
Test.assert_equals(capitalize('abracadabra'), ['AbRaCaDaBrA', 'aBrAcAdAbRa'])
Test.assert_equals(capitalize('codewarriors'), ['CoDeWaRrIoRs', 'cOdEwArRiOrS']) |
aliens = []
for alienNumber in range(30):
alien = {'color': 'green', 'points': 5, 'speed': 'slow'}
aliens.append(alien)
for alien in aliens[:5]:
print(alien)
print('total number of aliens: ' + str(len(aliens)))
for alien in aliens[:3]:
if alien['color'] == 'green':
alien['color'] = 'yellow'
... | aliens = []
for alien_number in range(30):
alien = {'color': 'green', 'points': 5, 'speed': 'slow'}
aliens.append(alien)
for alien in aliens[:5]:
print(alien)
print('total number of aliens: ' + str(len(aliens)))
for alien in aliens[:3]:
if alien['color'] == 'green':
alien['color'] = 'yellow'
... |
# generated from catkin/cmake/template/cfg-extras.context.py.in
DEVELSPACE = 'TRUE' == 'TRUE'
INSTALLSPACE = 'FALSE' == 'TRUE'
CATKIN_DEVEL_PREFIX = '/xavier_ssd/TrekBot/TrekBot2_WS/devel/.private/catkin_simple'
CATKIN_GLOBAL_BIN_DESTINATION = 'bin'
CATKIN_GLOBAL_ETC_DESTINATION = 'etc'
CATKIN_GLOBAL_INCLUDE_DESTINAT... | develspace = 'TRUE' == 'TRUE'
installspace = 'FALSE' == 'TRUE'
catkin_devel_prefix = '/xavier_ssd/TrekBot/TrekBot2_WS/devel/.private/catkin_simple'
catkin_global_bin_destination = 'bin'
catkin_global_etc_destination = 'etc'
catkin_global_include_destination = 'include'
catkin_global_lib_destination = 'lib'
catkin_globa... |
def svg_contents(svg_link: str) -> str:
'''
A simple function to return the contents of an SVG file in a str format to
be inserted into an HTML template
Returns: str
'''
return ''.join([line for line in open(svg_link, 'r')])
| def svg_contents(svg_link: str) -> str:
"""
A simple function to return the contents of an SVG file in a str format to
be inserted into an HTML template
Returns: str
"""
return ''.join([line for line in open(svg_link, 'r')]) |
class A:
def __init__(self):
super().__init__()
self.foo = "foo"
self.name = "class a"
def func(self):
print('class a')
class B:
def __init__(self):
super().__init__()
self.bar = "bar"
self.name = "class b"
def func(self):
print('class b')
... | class A:
def __init__(self):
super().__init__()
self.foo = 'foo'
self.name = 'class a'
def func(self):
print('class a')
class B:
def __init__(self):
super().__init__()
self.bar = 'bar'
self.name = 'class b'
def func(self):
print('class... |
n= int(input("Enter the size of array\n"))
a=[]
print("Enter the array inputs")
for i in range(n):
a.append(int(input()))
a.sort()
one=0
two=0
for i in range(len(a)):
if i%2==0:
one=one*10+a[i]
else:
two=two*10+a[i]
print(one+two)
| n = int(input('Enter the size of array\n'))
a = []
print('Enter the array inputs')
for i in range(n):
a.append(int(input()))
a.sort()
one = 0
two = 0
for i in range(len(a)):
if i % 2 == 0:
one = one * 10 + a[i]
else:
two = two * 10 + a[i]
print(one + two) |
'''
https://www.hackerrank.com/challenges/diwali-lights/problem
'''
def lights(n):
m = 10 ** 5
return (( 2 ** n ) - 1 ) % m
t= int(input())
for i in range(t):
print(lights(int(input())))
| """
https://www.hackerrank.com/challenges/diwali-lights/problem
"""
def lights(n):
m = 10 ** 5
return (2 ** n - 1) % m
t = int(input())
for i in range(t):
print(lights(int(input()))) |
RotationConstants = [
[0, 1, 62, 28, 27, ],
[36, 44, 6, 55, 20, ],
[3, 10, 43, 25, 39, ],
[41, 45, 15, 21, 8, ],
[18, 2, 61, 56, 14, ]
]
RoundConstants = [
0x0000000000000001, 0x0000000000008082, 0x800000000000808A, 0x8000000080008000,
0x000000000000808B, 0x0000000080000001, 0x8000000080008... | rotation_constants = [[0, 1, 62, 28, 27], [36, 44, 6, 55, 20], [3, 10, 43, 25, 39], [41, 45, 15, 21, 8], [18, 2, 61, 56, 14]]
round_constants = [1, 32898, 9223372036854808714, 9223372039002292224, 32907, 2147483649, 9223372039002292353, 9223372036854808585, 138, 136, 2147516425, 2147483658, 2147516555, 9223372036854775... |
class Response(object):
def __init__(self):
self.__headers = self._Response__Headers()
@property
def Headers(self):
return self.__headers
class __Headers(object):
def __init__(self):
self.__content_type = self._Headers__ContentType()
@property
def Cont... | class Response(object):
def __init__(self):
self.__headers = self._Response__Headers()
@property
def headers(self):
return self.__headers
class __Headers(object):
def __init__(self):
self.__content_type = self._Headers__ContentType()
@property
def... |
expected_output = {
'interfaces': {
'GigabitEthernet0/0/0/0': {
'ipv4': {
'neighbors': {
'10.1.2.1': {
'age': '02:56:20',
... | expected_output = {'interfaces': {'GigabitEthernet0/0/0/0': {'ipv4': {'neighbors': {'10.1.2.1': {'age': '02:56:20', 'ip': '10.1.2.1', 'link_layer_address': 'fa16.3eff.06af', 'origin': 'dynamic', 'type': 'ARPA'}, '10.1.2.2': {'age': '-', 'ip': '10.1.2.2', 'link_layer_address': 'fa16.3eff.f847', 'origin': 'static', 'type... |
#test simple assignments
a = 1
b = "two"
c = a + b
| a = 1
b = 'two'
c = a + b |
#simple list
spam=['messi','ronaldo','costa','ibra']
print(spam[1:4])
print(spam[:4])
print(spam[:-1])
print(spam[-1:])
print(spam[3:])
#list within a list
spam2=[['cat','bat'],['hat','sat']]
print(spam2[1][1])
print(spam2[-1][0])
print(spam2[0][-1])
print(spam2[-1][-1])
#length of a list
print(len(spam2))
print(len(... | spam = ['messi', 'ronaldo', 'costa', 'ibra']
print(spam[1:4])
print(spam[:4])
print(spam[:-1])
print(spam[-1:])
print(spam[3:])
spam2 = [['cat', 'bat'], ['hat', 'sat']]
print(spam2[1][1])
print(spam2[-1][0])
print(spam2[0][-1])
print(spam2[-1][-1])
print(len(spam2))
print(len(spam)) |
# Calcular el sueldo mensual de un operario conociendo
# la cantidad de horas trabajadas y el valor por hora
hora_trabajada = int(input('ingresa cantidad de horas trabajadas: '))
dias_trabajados = int(input('ingresa cantidad de dias trabajados: '))
valor_hora = 2500
print('sueldo trabajador: ', (valor_hora... | hora_trabajada = int(input('ingresa cantidad de horas trabajadas: '))
dias_trabajados = int(input('ingresa cantidad de dias trabajados: '))
valor_hora = 2500
print('sueldo trabajador: ', valor_hora * hora_trabajada * dias_trabajados) |
class App(object):
def __init__(self, name, package_name):
self._name = name
self._package_name = package_name
def name(self):
return self._name
def package_name(self):
return "market://details?id=" + self._package_name | class App(object):
def __init__(self, name, package_name):
self._name = name
self._package_name = package_name
def name(self):
return self._name
def package_name(self):
return 'market://details?id=' + self._package_name |
class Matrix(object):
def __init__(self, row, col, val=None):
self._row = row
self._col = col
self._matrix = []
for i in range(row):
c = [val] * col
self._matrix.append(c)
def size(self):
return self._row, self._col
def get_cell(self, ro... | class Matrix(object):
def __init__(self, row, col, val=None):
self._row = row
self._col = col
self._matrix = []
for i in range(row):
c = [val] * col
self._matrix.append(c)
def size(self):
return (self._row, self._col)
def get_cell(self, row,... |
print("To invert numbers")
a=int(input("Enter the number which you want to invert, example 123 to 321\n\n"))
b=int(a)
x=0
c=0
while(b!=0):
c=c%10
x=x*10+b
b=b/10
print("The number is now: ",x)
| print('To invert numbers')
a = int(input('Enter the number which you want to invert, example 123 to 321\n\n'))
b = int(a)
x = 0
c = 0
while b != 0:
c = c % 10
x = x * 10 + b
b = b / 10
print('The number is now: ', x) |
def output(s, l):
if l == 0:
return
print(s[l-1], end="")
output(s, l-1)
s = input('Enter a string ')
output(s, len(s))
print(end="\n")
| def output(s, l):
if l == 0:
return
print(s[l - 1], end='')
output(s, l - 1)
s = input('Enter a string ')
output(s, len(s))
print(end='\n') |
class Command:
ARGUMENTS = []
def __init__(self, application):
self._application = application
def execute(self):
return NotImplemented
| class Command:
arguments = []
def __init__(self, application):
self._application = application
def execute(self):
return NotImplemented |
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
def get_rate(check, metric_name, modifiers):
rate_method = check.rate
def rate(value, *, tags=None):
rate_method(metric_name, value, tags=tags)
del check
del modifiers
retur... | def get_rate(check, metric_name, modifiers):
rate_method = check.rate
def rate(value, *, tags=None):
rate_method(metric_name, value, tags=tags)
del check
del modifiers
return rate |
class infinity():
def __init__(self, name):
self.value = name
def isConstant(x):
return type(x) == int or type(x) == float
positiveInfinity = infinity("positiveInfinity")
negativeInfinity = infinity("negativeInfinity")
undefined = infinity("undefined")
def isInfinity(x):
return (x in [positiveInf... | class Infinity:
def __init__(self, name):
self.value = name
def is_constant(x):
return type(x) == int or type(x) == float
positive_infinity = infinity('positiveInfinity')
negative_infinity = infinity('negativeInfinity')
undefined = infinity('undefined')
def is_infinity(x):
return x in [positiveIn... |
def gen_remote_logname(test_mode=False):
# TODO: Add possible variants to this
#
# I've been unable to find a good example of what
# this should look like, so for now we'll just
# return a '-'
return '-'
| def gen_remote_logname(test_mode=False):
return '-' |
# -*- coding: utf-8 -*-
# This version of substitutions.py corrects many instances of what appears to be
# extensive, deliberate corruption of TA links.
# substitutions.py is used by md_cleanup.py.
# An ordered list of tuples to be used for string substitutions.
#
subs = [
("http://ufw.io/[[rc://", "[[rc://"),
# H... | subs = [('http://ufw.io/[[rc://', '[[rc://'), (' ', ' '), ('"', '"'), (''', "'"), ('<o:p>', ''), ('</o:p>', ''), ('rc://en/', 'rc://*/'), ('rc://*/obe/', 'rc://*/tw/bible/'), ('figs-_idiom', 'figs-idiom'), ('figs-123pperson', 'figs-123person'), ('figs-abbstractnouns', 'figs-abstractnouns'), ('figs-abstactn... |
BASE_URL: str = 'http://www.aucklandsnchockey.com'
API_URL: str = 'https://snc-api.herokuapp.com/api/v0'
LEAGUES_URL: str = '{}/leagues'.format(BASE_URL)
SCHEDULES_URL: str = '{}/schedules.cfm?clientid=5788&leagueid=23341'.format(LEAGUES_URL)
PRINTABLE_SCHEDULE_URL: str = '{}/print_schedule.cfm?leagueID=23341&clientID... | base_url: str = 'http://www.aucklandsnchockey.com'
api_url: str = 'https://snc-api.herokuapp.com/api/v0'
leagues_url: str = '{}/leagues'.format(BASE_URL)
schedules_url: str = '{}/schedules.cfm?clientid=5788&leagueid=23341'.format(LEAGUES_URL)
printable_schedule_url: str = '{}/print_schedule.cfm?leagueID=23341&clientID=... |
def striding_windows(l, w_size):
curr_idx = 0
while curr_idx < len(l):
yield l[curr_idx : curr_idx + w_size]
curr_idx += w_size
| def striding_windows(l, w_size):
curr_idx = 0
while curr_idx < len(l):
yield l[curr_idx:curr_idx + w_size]
curr_idx += w_size |
class BinarySearchTree:
def __init__(self):
self.root = None
self.size = 0
def length(self):
return self.size
def __len__(self):
return self.size
def __iter__(self):
return self.root.__iter__()
def put(self, key, val):
if self.root is not None:
... | class Binarysearchtree:
def __init__(self):
self.root = None
self.size = 0
def length(self):
return self.size
def __len__(self):
return self.size
def __iter__(self):
return self.root.__iter__()
def put(self, key, val):
if self.root is not None:
... |
a={
"id": "10faf008-6e24-4c92-9e26-40dd1f43791e",
"timestamp": "2018-01-18T06:35:16.099Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "light on",
"action": "light",
"actionIncomplete": "false",
"parameters": {
"state": "on"
},
"contexts": [],
"metadata": ... | a = {'id': '10faf008-6e24-4c92-9e26-40dd1f43791e', 'timestamp': '2018-01-18T06:35:16.099Z', 'lang': 'en', 'result': {'source': 'agent', 'resolvedQuery': 'light on', 'action': 'light', 'actionIncomplete': 'false', 'parameters': {'state': 'on'}, 'contexts': [], 'metadata': {'intentId': 'd5ad1a23-8396-4283-a235-b7f98a48b2... |
class MailService:
def __init__(self, controller, settings, loop):
self.controller = controller
self.loop = loop
self.settings = settings
async def start(self):
pass
async def close(self):
pass
| class Mailservice:
def __init__(self, controller, settings, loop):
self.controller = controller
self.loop = loop
self.settings = settings
async def start(self):
pass
async def close(self):
pass |
# part 2
data = list(map(int, open("day01/a.in").read().split()))
prev_window = data[0] + data[1] + data[2]
result = 0
for i, n in enumerate(data):
if i < 3:
continue
new_window = prev_window - data[i - 3] + n
if new_window > prev_window:
result += 1
prev_window = new_window
print(re... | data = list(map(int, open('day01/a.in').read().split()))
prev_window = data[0] + data[1] + data[2]
result = 0
for (i, n) in enumerate(data):
if i < 3:
continue
new_window = prev_window - data[i - 3] + n
if new_window > prev_window:
result += 1
prev_window = new_window
print(result) |
# to do in a future version
class OneClassScatterChart(object):
def __init__(self,
term_doc_matrix):
self.term_doc_matrix = term_doc_matrix
| class Oneclassscatterchart(object):
def __init__(self, term_doc_matrix):
self.term_doc_matrix = term_doc_matrix |
# selection_sort
def selection_sort(arr):
for i in range(len(arr)-1):
current_min = arr[i]
min_idx = i
for j in range(i+1, len(arr)):
# find minimum
if arr[j] < current_min:
current_min = arr[j]
min_idx = j
# swap minimum ... | def selection_sort(arr):
for i in range(len(arr) - 1):
current_min = arr[i]
min_idx = i
for j in range(i + 1, len(arr)):
if arr[j] < current_min:
current_min = arr[j]
min_idx = j
(arr[i], arr[min_idx]) = (arr[min_idx], arr[i])
def main():
... |
# -*- coding: utf-8 -*-
'''
Implementa uma pilha que herda da lista predefinida do Python.
'''
class StackList(list):
def __init__(self, item=[]):
list.__init__([])
self.extend(item)
def isEmpty(self):
return (self == [])
| """
Implementa uma pilha que herda da lista predefinida do Python.
"""
class Stacklist(list):
def __init__(self, item=[]):
list.__init__([])
self.extend(item)
def is_empty(self):
return self == [] |
'''
Input and output format:
>>Enter the coordinates of the first point:
10 20
>>Enter the coordinates of the second point:
20 30
>>Manhattan Distance between the two points is : 20
Time complexity: O(1)
Space complexity: O(1)
'''
x1 , x2 = list(map(int,input("Enter the coordinates of the first point:")... | """
Input and output format:
>>Enter the coordinates of the first point:
10 20
>>Enter the coordinates of the second point:
20 30
>>Manhattan Distance between the two points is : 20
Time complexity: O(1)
Space complexity: O(1)
"""
(x1, x2) = list(map(int, input('Enter the coordinates of the first point:').strip().spl... |
for _ in range(int(input())):
a, b, c, d, e, f, g, h = map(int, input().split())
a += e
b += f
c += g
d += h
if a < 1:
a = 1
if b < 1:
b = 1
if c < 0:
c = 0
print(a + (5 * b) + (2 * c) + (2 * d))
| for _ in range(int(input())):
(a, b, c, d, e, f, g, h) = map(int, input().split())
a += e
b += f
c += g
d += h
if a < 1:
a = 1
if b < 1:
b = 1
if c < 0:
c = 0
print(a + 5 * b + 2 * c + 2 * d) |
WIFI_SSID = "iot"
WIFI_PASSPHRASE = "12345678"
MQTT_HOST = "192.168.1.2"
MQTT_PORT = 1883
DEVICE_NAME = "Big_Tank"
| wifi_ssid = 'iot'
wifi_passphrase = '12345678'
mqtt_host = '192.168.1.2'
mqtt_port = 1883
device_name = 'Big_Tank' |
def flatten_strings(names, sep):
if not isinstance(names, str):
names = map(str, names)
return sep.join(names)
| def flatten_strings(names, sep):
if not isinstance(names, str):
names = map(str, names)
return sep.join(names) |
USE_TZ = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django',
'USER': 'postgres',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
INSTALLED_APPS = (
'category',
'django.contrib.admin',
'django.contrib.auth... | use_tz = True
databases = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'django', 'USER': 'postgres', 'PASSWORD': '', 'HOST': '', 'PORT': ''}}
installed_apps = ('category', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sites')
site_id = 1
secret... |
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','\"','\'',';','.',',','-','(',')',':','!','?']
char_to_ix = { ch:i for i,ch in enumerate(alphabet) }
ix_to_char = { i:ch for i,ch in enumerate(alphabet) }
nrof_labels = len(alphabet)
nrof_classes ... | alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' ', '"', "'", ';', '.', ',', '-', '(', ')', ':', '!', '?']
char_to_ix = {ch: i for (i, ch) in enumerate(alphabet)}
ix_to_char = {i: ch for (i, ch) in enumerate(alphabet)}
nrof_l... |
class SimulationUnit(object):
def __init__(self, env, stats):
super(SimulationUnit, self).__init__()
self.env = env
self.stats = stats
self.action = None
def start(self):
self.action = self.env.process(self.run())
def run(self):
raise Exception("Bare simula... | class Simulationunit(object):
def __init__(self, env, stats):
super(SimulationUnit, self).__init__()
self.env = env
self.stats = stats
self.action = None
def start(self):
self.action = self.env.process(self.run())
def run(self):
raise exception('Bare simula... |
#step Arguments
String = "University"
#syntax variable_name[start argument: stop argumrnt -1 : Step Argument]
print("Beenash"[3:7])# string slicing
print("Beenash"[0::2])#step argument
print("Beenash"[6::-1])#backward (hsaneeB)
print("Beenash"[6::-2])#backward | string = 'University'
print('Beenash'[3:7])
print('Beenash'[0::2])
print('Beenash'[6::-1])
print('Beenash'[6::-2]) |
test = { 'name': 'q5c',
'points': 2,
'suites': [ { 'cases': [ { 'code': '>>> # This test checks the first example in question description.;\n'
'>>> np.all(np.isclose(sepia_filter(np.array([50, 100, 150])), np.array([124.9 , 111.25, 86.65])))\n'
... | test = {'name': 'q5c', 'points': 2, 'suites': [{'cases': [{'code': '>>> # This test checks the first example in question description.;\n>>> np.all(np.isclose(sepia_filter(np.array([50, 100, 150])), np.array([124.9 , 111.25, 86.65])))\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> # This test checks the secon... |
def part1():
values = [int(i) for i in open("input.txt","r").read().split("\n")]
return sum([1 if values[i] > values[i-1] else 0 for i in range(len(values))])
def part2():
values = [int(i) for i in open("input.txt","r").read().split("\n")]
return sum([1 if values[i+1]+values[i+2] > values[i-1]+values[i... | def part1():
values = [int(i) for i in open('input.txt', 'r').read().split('\n')]
return sum([1 if values[i] > values[i - 1] else 0 for i in range(len(values))])
def part2():
values = [int(i) for i in open('input.txt', 'r').read().split('\n')]
return sum([1 if values[i + 1] + values[i + 2] > values[i -... |
#source - https://www.hackerrank.com/challenges/30-review-loop/problem
for i in range(int(input())):
s=input();
print(*["".join(s[::2]),"".join(s[1::2])])
| for i in range(int(input())):
s = input()
print(*[''.join(s[::2]), ''.join(s[1::2])]) |
print("hello world");
num1 = input("The first number is:")
num2 = input("The second number is:")
avg_num = (float(num1) + float(num2)) / 2
print("The average number is %f" % avg_num)
| print('hello world')
num1 = input('The first number is:')
num2 = input('The second number is:')
avg_num = (float(num1) + float(num2)) / 2
print('The average number is %f' % avg_num) |
DEFAULT_BLOCK_SIZE=128
def main():
msg="String"
enc=encrypt(msg,key("pub.txt"))
print(msg)
print(enc)
print(decrypt(enc,key("prv.txt")))
def key(fn):
with open(fn,"r") as f:
sz,n,ed=f.read().split("g")
f.close()
return [int(sz,16),int(n,16),int(ed,16)]
def encrypt(seq,key):
try:
sz,n,e=key
bs=D... | default_block_size = 128
def main():
msg = 'String'
enc = encrypt(msg, key('pub.txt'))
print(msg)
print(enc)
print(decrypt(enc, key('prv.txt')))
def key(fn):
with open(fn, 'r') as f:
(sz, n, ed) = f.read().split('g')
f.close()
return [int(sz, 16), int(n, 16), int(ed, 16... |
@app.route(API_VISION_BASE_URL+'/detect', methods=['POST'])
@cross_origin()
def upload_base64_file_and_detect_in_image():
# <base64_image, image_name>
# log.debug("request: {}".format(request))
# log.debug("request.values: {}".format(request.values))
base64_image = request.values.get("image")
# log.debug("b... | @app.route(API_VISION_BASE_URL + '/detect', methods=['POST'])
@cross_origin()
def upload_base64_file_and_detect_in_image():
base64_image = request.values.get('image')
image_name = request.values.get('name')
log.debug('image_name: {}'.format(image_name))
query_q = request.values.get('q')
log.debug('q... |
if sm.hasQuest(20320):
sm.setSpeakerID(1101002)
if sm.sendAskYesNo("Are you ready to enter the Test area?"):
sm.warpInstanceIn(913070200)
sm.createClockForMultiple(300, 913070200)
sm.addEvent(sm.invokeAfterDelay(300 *1000, "warp", 130000000, 0))
elif sm.hasQuest(20411):
sm.setSpeaker... | if sm.hasQuest(20320):
sm.setSpeakerID(1101002)
if sm.sendAskYesNo('Are you ready to enter the Test area?'):
sm.warpInstanceIn(913070200)
sm.createClockForMultiple(300, 913070200)
sm.addEvent(sm.invokeAfterDelay(300 * 1000, 'warp', 130000000, 0))
elif sm.hasQuest(20411):
sm.setSpeake... |
#actions
actions_dict = {
"Name": {
"Type": "Type",
"Stat": "Stat",
"Skill": "Skill",
"Speed": "Speed",
"Range": "Range",
"Description": "Description",
"Dice_Roll": "Dice_Roll",
"Action_Type": "Action_Type",
... | actions_dict = {'Name': {'Type': 'Type', 'Stat': 'Stat', 'Skill': 'Skill', 'Speed': 'Speed', 'Range': 'Range', 'Description': 'Description', 'Dice_Roll': 'Dice_Roll', 'Action_Type': 'Action_Type', 'Reaction': 'Reaction', 'Payload': "print('It is the name action')"}, 'Move': {'Type': 'Movement', 'Description': "You know... |
s1 = set([1,2,3])
s2 = set([2 ,3, 4])
s3 = s1.difference(s2)
print(s3)
print(max(3,3)) | s1 = set([1, 2, 3])
s2 = set([2, 3, 4])
s3 = s1.difference(s2)
print(s3)
print(max(3, 3)) |
def url(email: str) -> str: return f'/api/v1/auth/check-email/{email}/'
def test_is_free(client, factory):
factory.user(email='test@test.com')
assert client.get(url('test-user@test.com')) == {}
def test_already_used(client, factory):
factory.user(email='test@test.com')
response = client.get(url('t... | def url(email: str) -> str:
return f'/api/v1/auth/check-email/{email}/'
def test_is_free(client, factory):
factory.user(email='test@test.com')
assert client.get(url('test-user@test.com')) == {}
def test_already_used(client, factory):
factory.user(email='test@test.com')
response = client.get(url('t... |
class Solution:
def maxCoins(self, piles: List[int]) -> int:
piles.sort(reverse = True)
coins, numberOfPiles = 0, len(piles)
for i in range(1, numberOfPiles - (numberOfPiles // 3), 2):
coins += piles[i]
return coins | class Solution:
def max_coins(self, piles: List[int]) -> int:
piles.sort(reverse=True)
(coins, number_of_piles) = (0, len(piles))
for i in range(1, numberOfPiles - numberOfPiles // 3, 2):
coins += piles[i]
return coins |
FIRST_THOUSAND_OR_SO_USER_AGENTS = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac... | first_thousand_or_so_user_agents = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6... |
'''
The function sum_positive_numbers should return the sum of all positive numbers between the number n received and 1. For example, when n is 3 it should
return 1+2+3=6, and when n is 5 it should return 1+2+3+4+5=15. Fill in the gaps to make this work:
'''
def sum_positive_numbers(n):
# The base case is n be... | """
The function sum_positive_numbers should return the sum of all positive numbers between the number n received and 1. For example, when n is 3 it should
return 1+2+3=6, and when n is 5 it should return 1+2+3+4+5=15. Fill in the gaps to make this work:
"""
def sum_positive_numbers(n):
if n < 1:
return 0
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
zahl = int(input("Geben Sie eine Zahl ein: "))
if zahl < 0:
print("Negative Zahlen sind nicht erlaubt")
continue
ergebnis = 1
for i in range(2, zahl+1):
ergebnis = ergebnis * i
print("Ergebnis: ", ergebnis)
| while True:
zahl = int(input('Geben Sie eine Zahl ein: '))
if zahl < 0:
print('Negative Zahlen sind nicht erlaubt')
continue
ergebnis = 1
for i in range(2, zahl + 1):
ergebnis = ergebnis * i
print('Ergebnis: ', ergebnis) |
#these are your recaptcha keys. DO NOT CHECK THESE INTO SOURCE CONTROL!
#please don't use these sample keys for doing anything other than running
#the demo project!
RECAPTCHA_PUBLIC_KEY = "6LfXqr4SAAAAAA-2d7JL6JugNoU5Sb-eRbYvu95W"
RECAPTCHA_PRIVATE_KEY = "6LfXqr4SAAAAAPYQ2cov1Gn3_caP_ST_pKmDXWQH"
| recaptcha_public_key = '6LfXqr4SAAAAAA-2d7JL6JugNoU5Sb-eRbYvu95W'
recaptcha_private_key = '6LfXqr4SAAAAAPYQ2cov1Gn3_caP_ST_pKmDXWQH' |
# Expects the array to be sorted
def binary_search(arr, target):
if len(arr) < 1:
return -1
middle = int(len(arr) / 2)
middle_value = arr[middle]
if middle_value > target:
return binary_search(arr[:middle], target)
elif middle_value < target:
v = binary_search(arr[middle + ... | def binary_search(arr, target):
if len(arr) < 1:
return -1
middle = int(len(arr) / 2)
middle_value = arr[middle]
if middle_value > target:
return binary_search(arr[:middle], target)
elif middle_value < target:
v = binary_search(arr[middle + 1:], target)
if v < 0:
... |
{
"targets": [
{
"target_name": "pixel_change",
"sources": [
"src/pixel_change.cc",
"src/ccl.cc",
"src/engine.cc",
"src/object.cc",
"src/results.cc",
"src/worker.cc"
],
"cflags": [ "-O2", "-Wendif-labels", "-Werror", "-Wpedantic", "-Wunused-parameter" ],# removed ... | {'targets': [{'target_name': 'pixel_change', 'sources': ['src/pixel_change.cc', 'src/ccl.cc', 'src/engine.cc', 'src/object.cc', 'src/results.cc', 'src/worker.cc'], 'cflags': ['-O2', '-Wendif-labels', '-Werror', '-Wpedantic', '-Wunused-parameter'], 'cflags!': ['-Wno-unused-parameter', '-O3'], 'cflags_cc': ['-std=gnu++11... |
n=int(input("Enter number of terms "))
for i in range (1,n+1):
for j in range (1,i+1):
print (j,end="")
print()
| n = int(input('Enter number of terms '))
for i in range(1, n + 1):
for j in range(1, i + 1):
print(j, end='')
print() |
while True:
n = int(input())
if n == 0: break
e = str(input()).replace(' ', '')
pos = 90
for c in e:
if c == 'D': pos -= 90
else: pos += 90
fin = pos % 360
if fin == 0: print('L')
elif fin == 90: print('N')
elif fin == 180: print('O')
else: print('S')
| while True:
n = int(input())
if n == 0:
break
e = str(input()).replace(' ', '')
pos = 90
for c in e:
if c == 'D':
pos -= 90
else:
pos += 90
fin = pos % 360
if fin == 0:
print('L')
elif fin == 90:
print('N')
elif fin == 1... |
def get_frames(signal,size=8,overlap=0.3):
print ('Step: ')
step = size * overlap
print (step)
for i in signal:
print (signal[i:i+size])
size = 4
signal = [i for i in range(0,1024)]
overlap = 0.5
get_frames(signal,size,overlap)
| def get_frames(signal, size=8, overlap=0.3):
print('Step: ')
step = size * overlap
print(step)
for i in signal:
print(signal[i:i + size])
size = 4
signal = [i for i in range(0, 1024)]
overlap = 0.5
get_frames(signal, size, overlap) |
class Solution:
def arrayPairSum(self, nums: List[int]) -> int:
num=sorted(nums)
s=0
for i in range(0,len(num),2):
s+=num[i]
return s
| class Solution:
def array_pair_sum(self, nums: List[int]) -> int:
num = sorted(nums)
s = 0
for i in range(0, len(num), 2):
s += num[i]
return s |
with open('input1.txt') as f:
numbers = [int(n) for n in f.read().split()]
numbers.sort()
def get_answer1(l):
i = 0
j = len(l) - 1
while i != j:
cur = l[i] + l[j]
if cur == 2020:
return l[i], l[j], l[i]*l[j]
elif cur < 2020:
i += 1
elif cur > 2020... | with open('input1.txt') as f:
numbers = [int(n) for n in f.read().split()]
numbers.sort()
def get_answer1(l):
i = 0
j = len(l) - 1
while i != j:
cur = l[i] + l[j]
if cur == 2020:
return (l[i], l[j], l[i] * l[j])
elif cur < 2020:
i += 1
elif cur > ... |
class HPBar:
def __init__(self, hp, hp_max):
self.hp = hp
self.hp_max = hp_max
def __str__(self):
return f"{self.hp}/{self.hp_max}"
| class Hpbar:
def __init__(self, hp, hp_max):
self.hp = hp
self.hp_max = hp_max
def __str__(self):
return f'{self.hp}/{self.hp_max}' |
data_science_students = {10, 20, 30}
front_end_students = {20, 40, 50}
print(data_science_students)
print(front_end_students)
print(data_science_students & front_end_students) # {20}
print(data_science_students | front_end_students) # {50, 20, 40, 10, 30}
print(data_science_students ^ front_end_students) # {40, 10, 5... | data_science_students = {10, 20, 30}
front_end_students = {20, 40, 50}
print(data_science_students)
print(front_end_students)
print(data_science_students & front_end_students)
print(data_science_students | front_end_students)
print(data_science_students ^ front_end_students) |
'''
Given two positive integers, compute their quotient,
using only the addition, subtraction, and shifting
operators.
'''
def divide(x, y): # Time: O(n)
result, power = 0, 32
y_power = y << power
while x >= y:
while y_power > x:
y_power >>= 1
power -= 1
result +=... | """
Given two positive integers, compute their quotient,
using only the addition, subtraction, and shifting
operators.
"""
def divide(x, y):
(result, power) = (0, 32)
y_power = y << power
while x >= y:
while y_power > x:
y_power >>= 1
power -= 1
result += 1 << power
... |
expected_output = {
"vtp": {
"device_id": "3820.56ff.c7a2",
"feature": {
"mst": {
"configuration_revision": 0,
"enabled": True,
"operating_mode": "server",
"primary_id": "0000.0000.0000",
},
"unknown"... | expected_output = {'vtp': {'device_id': '3820.56ff.c7a2', 'feature': {'mst': {'configuration_revision': 0, 'enabled': True, 'operating_mode': 'server', 'primary_id': '0000.0000.0000'}, 'unknown': {'enabled': False, 'operating_mode': 'transparent'}, 'vlan': {'configuration_revision': 2, 'enabled': True, 'existing_extend... |
'''
variables which can access inside a function defintion
'''
def calculation():
a=400
b=200
c=a*b
print(c)
return c
calculation()
def Student():
name="Ashwin"
regno=2005
def fees():
a=100
b=200
c=200+500
print("The name of student:",name)
pri... | """
variables which can access inside a function defintion
"""
def calculation():
a = 400
b = 200
c = a * b
print(c)
return c
calculation()
def student():
name = 'Ashwin'
regno = 2005
def fees():
a = 100
b = 200
c = 200 + 500
print('The name of student... |
output = []
matrix = []
push = matrix.append
a = int(input())
pos = int(input())
for _ in range(a):
push([int(x) for x in input().split()])
push = output.append
mid = a // 2
step = 1
x = y = mid
push(matrix[mid][mid])
Flag = True
while Flag:
pos %= 4
if pos == 0:
for i in range(int(step)):
... | output = []
matrix = []
push = matrix.append
a = int(input())
pos = int(input())
for _ in range(a):
push([int(x) for x in input().split()])
push = output.append
mid = a // 2
step = 1
x = y = mid
push(matrix[mid][mid])
flag = True
while Flag:
pos %= 4
if pos == 0:
for i in range(int(step)):
... |
url = 'url'
coli = 'coliform'
chem = 'chem'
copper_lead = 'copper_lead'
state_names = ["Alaska", "Alabama", "Arkansas", "Arizona", "California", "Colorado", "Connecticut",
"District of Columbia", "Delaware", "Florida", "Georgia", "Hawaii", "Iowa", "Idaho", "Illinois",
"Indiana", "Kansas",... | url = 'url'
coli = 'coliform'
chem = 'chem'
copper_lead = 'copper_lead'
state_names = ['Alaska', 'Alabama', 'Arkansas', 'Arizona', 'California', 'Colorado', 'Connecticut', 'District of Columbia', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Iowa', 'Idaho', 'Illinois', 'Indiana', 'Kansas', 'Kentucky', 'Louisiana', 'Mass... |
#python implementation of bubblesort algorithm
def bubbleSort(a):
n = len(a)
# A loop to traverse through all array elements
for i in range(n-1):
for j in range(0, n-i-1):
# Idea of bubblesort is to traverse list/array from 0 to n-i-1 and to swap elements if the e... | def bubble_sort(a):
n = len(a)
for i in range(n - 1):
for j in range(0, n - i - 1):
if a[j] > a[j + 1]:
(a[j], a[j + 1]) = (a[j + 1], a[j])
l = [1, 2, 6, 9, 82, 0]
bubble_sort(l)
print('Array in ascending order using bubblesort is:')
for i in range(len(l)):
print(l[i], ' ... |
def extras_fn(data, args):
extras = {}
if "idx2labels" in data:
extras["idx2labels"] = data["idx2labels"]
return extras | def extras_fn(data, args):
extras = {}
if 'idx2labels' in data:
extras['idx2labels'] = data['idx2labels']
return extras |
INSTANCE_ATTRIBUTE = 'INSTANCE_ATTRIBUTE'
''' Indicates an option that corresponds to a command object's instance attribute '''
METHOD_NAMED_ARG = 'METHOD_NAMED_ARG'
''' Indicates an option that corresponds to a method's named parameter '''
METHOD_NARGS = 'METHOD_NARGS'
''' Indicates an option that corresponds to the... | instance_attribute = 'INSTANCE_ATTRIBUTE'
" Indicates an option that corresponds to a command object's instance attribute "
method_named_arg = 'METHOD_NAMED_ARG'
" Indicates an option that corresponds to a method's named parameter "
method_nargs = 'METHOD_NARGS'
' Indicates an option that corresponds to the variadic ar... |
txt = "Thank you for the music\nWelcome to the jungle"
x = txt.splitlines(True)
print(x)
| txt = 'Thank you for the music\nWelcome to the jungle'
x = txt.splitlines(True)
print(x) |
DEFAULT_CROP_PCT = 0.875
IMAGENET_MEAN = (0.485, 0.456, 0.406)
IMAGENET_STD = (0.229, 0.224, 0.225)
INCEPTION_MEAN = (0.5, 0.5, 0.5)
INCEPTION_STD = (0.5, 0.5, 0.5)
BN_MOM_TF_DEFAULT = 0.99
BN_EPS_TF_DEFAULT = 1e-3
_BN_ARGS_TF = dict(momentum=BN_MOM_TF_DEFAULT, eps=BN_EPS_TF_DEFAULT)
BN_MOM_PT_DEFAULT = .9
BN_EPS_PT_... | default_crop_pct = 0.875
imagenet_mean = (0.485, 0.456, 0.406)
imagenet_std = (0.229, 0.224, 0.225)
inception_mean = (0.5, 0.5, 0.5)
inception_std = (0.5, 0.5, 0.5)
bn_mom_tf_default = 0.99
bn_eps_tf_default = 0.001
_bn_args_tf = dict(momentum=BN_MOM_TF_DEFAULT, eps=BN_EPS_TF_DEFAULT)
bn_mom_pt_default = 0.9
bn_eps_pt_... |
#Leia um valor de massa em libras e apresente-o convertido em quilogramas.
#A formula de conversao eh: K=L*0.45 ,
#Sendo K a massa em quilogramas e L a massa em libras.
l=float(input("Informe a massa em libras: "))
k=l*0.45
print(f"O peso convertido em KG eh {k}") | l = float(input('Informe a massa em libras: '))
k = l * 0.45
print(f'O peso convertido em KG eh {k}') |
class ReducedShape:
I = [['1','1'],
['11']]
O = [['11','11']]
ALL = [I, O]
COLORS = [(0, 255, 0), (255, 0, 0), (0, 255, 255), (255, 255, 0), (255, 165, 0), (0, 0, 255), (128, 0, 128)] | class Reducedshape:
i = [['1', '1'], ['11']]
o = [['11', '11']]
all = [I, O]
colors = [(0, 255, 0), (255, 0, 0), (0, 255, 255), (255, 255, 0), (255, 165, 0), (0, 0, 255), (128, 0, 128)] |
def can_attend_all_appointments(intervals):
if not intervals:
return True
intervals.sort(key = lambda x: x[0])
end = intervals[0][1]
for i in range(1, len(intervals)):
currStart = intervals[i][0]
if currStart <= end:
return False
end = intervals[i][1]
return True
def main():
print... | def can_attend_all_appointments(intervals):
if not intervals:
return True
intervals.sort(key=lambda x: x[0])
end = intervals[0][1]
for i in range(1, len(intervals)):
curr_start = intervals[i][0]
if currStart <= end:
return False
end = intervals[i][1]
retur... |
__all__ = [
'font', 'launch',
'property', 'widget',
'window', 'debug'
]
| __all__ = ['font', 'launch', 'property', 'widget', 'window', 'debug'] |
class Solution:
def countSmaller(self, nums: List[int]) -> List[int]:
if not nums:
return []
sorted_arr = [nums[-1]]
result = [0]
n = len(nums)
for i in range(n-2,-1,-1):
num = nums[i]
idx = bisect_left(sorted_arr, num)
result... | class Solution:
def count_smaller(self, nums: List[int]) -> List[int]:
if not nums:
return []
sorted_arr = [nums[-1]]
result = [0]
n = len(nums)
for i in range(n - 2, -1, -1):
num = nums[i]
idx = bisect_left(sorted_arr, num)
re... |
def combinations(arr):
res = set()
for i in range(1, 2**len(arr)):
j = 0
combo = []
while i:
if i & 1:
combo.append(arr[j])
i = i // 2
j += 1
res.add(tuple(combo))
return sorted(res, key = lambda c: (len(c), c))
if __name_... | def combinations(arr):
res = set()
for i in range(1, 2 ** len(arr)):
j = 0
combo = []
while i:
if i & 1:
combo.append(arr[j])
i = i // 2
j += 1
res.add(tuple(combo))
return sorted(res, key=lambda c: (len(c), c))
if __name__ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.