content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
## https://leetcode.com/problems/merge-two-sorted-lists/
## merge two sorted linked lists. pretty simple solution here,
## but about as fast as you can get. initiate the list by checking
## for the smaller of the two heads (or, if one is None, just use the
## other), then we iterate as long as we have either value ... | class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
if l1 is None and l2 is None:
return None
if l1 is None:
out_head = l2
l2 = l2.next
elif l2 is None:
out_head = l1
l1 = l1.next
elif l1.val ... |
AUTH_HEADER_NAME = "X-RH-IDENTITY"
VALID_HTTP_VERBS = ["get", "options", "head", "post", "put", "patch", "delete"]
FACT_NAMESPACE = "system_profile"
INVENTORY_SVC_SYSTEMS_ENDPOINT = "/api/inventory/v1/hosts/%s"
INVENTORY_SVC_SYSTEM_PROFILES_ENDPOINT = "/api/inventory/v1/hosts/%s/system_profile"
INVENTORY_SVC_SYSTEM_TAG... | auth_header_name = 'X-RH-IDENTITY'
valid_http_verbs = ['get', 'options', 'head', 'post', 'put', 'patch', 'delete']
fact_namespace = 'system_profile'
inventory_svc_systems_endpoint = '/api/inventory/v1/hosts/%s'
inventory_svc_system_profiles_endpoint = '/api/inventory/v1/hosts/%s/system_profile'
inventory_svc_system_tag... |
# constants for combine.py
OUTPUT_FILE_MAJOR = 'notesMajor.txt'
OUTPUT_FILE_MINOR = 'notesMinor.txt'
# Constants for process.py
START_CODE = 'S'
END_CODE = 'E'
ENDFILE_CODE = 'X'
LOWEST_NOTE_OFFSET = 24
NOTE_RANGE = 72 # number of distinct notes defined
OCTAVE_RANGE = 12 # number of half-steps in an octave
HIGHEST_C... | output_file_major = 'notesMajor.txt'
output_file_minor = 'notesMinor.txt'
start_code = 'S'
end_code = 'E'
endfile_code = 'X'
lowest_note_offset = 24
note_range = 72
octave_range = 12
highest_c_raw = 84
highest_c = HIGHEST_C_RAW - LOWEST_NOTE_OFFSET
soprano_mark = 'H'
bass_mark = 'L'
chord_offset = 101
rest_num = 72
not... |
def odd_or_even(*args):
command = args[0]
numbers = args[1]
if command == 'Odd':
odd = list(filter(lambda x: x % 2 != 0, numbers))
print(sum(odd) * len(numbers))
else:
even = list(filter(lambda x: x % 2 == 0, numbers))
print(sum(even) * len(numbers))
odd_or_even(input()... | def odd_or_even(*args):
command = args[0]
numbers = args[1]
if command == 'Odd':
odd = list(filter(lambda x: x % 2 != 0, numbers))
print(sum(odd) * len(numbers))
else:
even = list(filter(lambda x: x % 2 == 0, numbers))
print(sum(even) * len(numbers))
odd_or_even(input(), ... |
def find_inversion_count(arr: list) -> int:
def modified_merge(l_inv, r_inv, l, r) -> (int, list):
i, j = 0, 0
sum_inv = 0
result = []
n = len(l)
m = len(r)
while i < n or j < m:
if j >= m or (i < n and l[i] < r[j]):
result.append(l[i])
... | def find_inversion_count(arr: list) -> int:
def modified_merge(l_inv, r_inv, l, r) -> (int, list):
(i, j) = (0, 0)
sum_inv = 0
result = []
n = len(l)
m = len(r)
while i < n or j < m:
if j >= m or (i < n and l[i] < r[j]):
result.append(l[i]... |
name = "Kalob"
# welcome_message = "Hello {} welcome to Python 101".format(name)
welcome_message = f"Hello {name} welcome to Python 101"
print(welcome_message)
| name = 'Kalob'
welcome_message = f'Hello {name} welcome to Python 101'
print(welcome_message) |
class Sudoku:
def __init__(self):
self.list = [[-1]*9,[-1]*9,[-1]*9,[-1]*9,[-1]*9,[-1]*9,[-1]*9,[-1]*9,[-1]*9]
self.const1 = {0:0,1:0,2:0,3:1,4:1,5:1,6:2,7:2,8:2}
self.const2 = {0:0,1:3,2:6}
'''
Print the sudoku
'''
def toString(self):
res = ""
for row in ra... | class Sudoku:
def __init__(self):
self.list = [[-1] * 9, [-1] * 9, [-1] * 9, [-1] * 9, [-1] * 9, [-1] * 9, [-1] * 9, [-1] * 9, [-1] * 9]
self.const1 = {0: 0, 1: 0, 2: 0, 3: 1, 4: 1, 5: 1, 6: 2, 7: 2, 8: 2}
self.const2 = {0: 0, 1: 3, 2: 6}
'\n Print the sudoku\n '
def to_strin... |
'''for c in range(1, 10):
print(c)'''
c = 1
while c < 10:
print(c)
c += 1
print('Fim')
print('-' * 60)
n = 1
while n != 0:
n = int(input('para parar digite 0 ou digite um novo valor: '))
print('-' * 15)
print(n)
print('-' * 15)
print('Fim')
| """for c in range(1, 10):
print(c)"""
c = 1
while c < 10:
print(c)
c += 1
print('Fim')
print('-' * 60)
n = 1
while n != 0:
n = int(input('para parar digite 0 ou digite um novo valor: '))
print('-' * 15)
print(n)
print('-' * 15)
print('Fim') |
# This is my demo file
print("Hello, Python!")
print("I can add as many lines as I want")
| print('Hello, Python!')
print('I can add as many lines as I want') |
_base_ = [
'../_base_/models/upernet_swin.py'
]
model = dict(
backbone=dict(
embed_dim=128,
depths=[2, 2, 18, 2],
num_heads=[4, 8, 16, 32],
window_size=7,
ape=False,
drop_path_rate=0.3,
patch_norm=True,
use_checkpoint=False
),
decode_head=... | _base_ = ['../_base_/models/upernet_swin.py']
model = dict(backbone=dict(embed_dim=128, depths=[2, 2, 18, 2], num_heads=[4, 8, 16, 32], window_size=7, ape=False, drop_path_rate=0.3, patch_norm=True, use_checkpoint=False), decode_head=dict(in_channels=[128, 256, 512, 1024], num_classes=1), auxiliary_head=dict(in_channel... |
# -*- coding: utf-8 -*-
def get_user_hash(usr_name):
return
| def get_user_hash(usr_name):
return |
class HeifError(BaseException):
def __init__(self, *,
code, subcode, message):
self.code=code
self.subcode=subcode
self.message=message
def __str__(self):
return f'Code: {self.code}, Subcode: {self.subcode}, Message: "{self.message}"'
def __repr__(self):
... | class Heiferror(BaseException):
def __init__(self, *, code, subcode, message):
self.code = code
self.subcode = subcode
self.message = message
def __str__(self):
return f'Code: {self.code}, Subcode: {self.subcode}, Message: "{self.message}"'
def __repr__(self):
retu... |
stop = False
def counter(start=0):
n = start
while not stop:
yield n
n += 1
c = counter()
print(next(c)) # prints: 0
print(next(c)) # prints: 1
stop = True
print(next(c)) # raises StopIteration
| stop = False
def counter(start=0):
n = start
while not stop:
yield n
n += 1
c = counter()
print(next(c))
print(next(c))
stop = True
print(next(c)) |
pkgname = "bsdutils"
_commit="d7050267fbc655a8b1a01bae58f23b304e0daf32"
pkgver = "0.0.1"
pkgrel = 0
build_style = "meson"
hostmakedepends = ["flex", "byacc", "meson", "pkgconf"]
makedepends = [
"acl-devel", "ncurses-devel", "libedit-devel", "openssl-devel",
"musl-fts-devel", "musl-rpmatch-devel", "libxo-devel"
... | pkgname = 'bsdutils'
_commit = 'd7050267fbc655a8b1a01bae58f23b304e0daf32'
pkgver = '0.0.1'
pkgrel = 0
build_style = 'meson'
hostmakedepends = ['flex', 'byacc', 'meson', 'pkgconf']
makedepends = ['acl-devel', 'ncurses-devel', 'libedit-devel', 'openssl-devel', 'musl-fts-devel', 'musl-rpmatch-devel', 'libxo-devel']
pkgdes... |
# optimizer
optimizer = dict(type='AdamW', lr=0.0002, weight_decay=0.0001)
optimizer_config = dict()
# learning policy
lr_config = dict(policy='poly', power=0.9, min_lr=0.0, by_epoch=False)
# runtime settings
runner = dict(type='IterBasedRunner', max_iters=160000)
checkpoint_config = dict(by_epoch=False, interval=4000)... | optimizer = dict(type='AdamW', lr=0.0002, weight_decay=0.0001)
optimizer_config = dict()
lr_config = dict(policy='poly', power=0.9, min_lr=0.0, by_epoch=False)
runner = dict(type='IterBasedRunner', max_iters=160000)
checkpoint_config = dict(by_epoch=False, interval=4000)
evaluation = dict(interval=4000, metric='mIoU') |
class Contact:
def __init__(self, name, email):
self.name = name
if self._validate_mail(email):
self.email = email
else:
self.email = '(missing email)'
def who_I_am(self):
return self.name + ' ' + self.email
@staticmethod
def _validate_mail(emai... | class Contact:
def __init__(self, name, email):
self.name = name
if self._validate_mail(email):
self.email = email
else:
self.email = '(missing email)'
def who_i_am(self):
return self.name + ' ' + self.email
@staticmethod
def _validate_mail(emai... |
n = int(input())
a = list(map(int, input().split(" ")))
result, cnt = 1, 1
for i in range(1, n):
if a[i] > a[i-1]:
cnt += 1
else:
cnt = 1
result = max(result, cnt)
print(result)
| n = int(input())
a = list(map(int, input().split(' ')))
(result, cnt) = (1, 1)
for i in range(1, n):
if a[i] > a[i - 1]:
cnt += 1
else:
cnt = 1
result = max(result, cnt)
print(result) |
'''
Used by testlib.test_cache.TestReloadModule.
This module features a single global array: val. When loaded, it is set to [0].
test_cache/mymodule.py is dynamically created and increments this variable. The
incremented value acts like a global counter, and we can test how often the
module is reloaded.
'''
val = [0]... | """
Used by testlib.test_cache.TestReloadModule.
This module features a single global array: val. When loaded, it is set to [0].
test_cache/mymodule.py is dynamically created and increments this variable. The
incremented value acts like a global counter, and we can test how often the
module is reloaded.
"""
val = [0] |
def outer():
x = "local"
def inner():
nonlocal x
x = "nonlocal"
print("inner:", x)
inner()
print("outer:", x)
outer() | def outer():
x = 'local'
def inner():
nonlocal x
x = 'nonlocal'
print('inner:', x)
inner()
print('outer:', x)
outer() |
adresstable = [(i // 9, i % 9) for i in range(9*9)]
print(adresstable)
| adresstable = [(i // 9, i % 9) for i in range(9 * 9)]
print(adresstable) |
class StatusRequest(object):
def __init__(self):
pass
| class Statusrequest(object):
def __init__(self):
pass |
__all__ = ['node', 'topology']
def __dir__():
return sorted(__all__)
| __all__ = ['node', 'topology']
def __dir__():
return sorted(__all__) |
def soften(deweys):
lbc = 1E-8*deweys
return 1.0 + 0.1*lbc**0.5
| def soften(deweys):
lbc = 1e-08 * deweys
return 1.0 + 0.1 * lbc ** 0.5 |
def check_substr(ch, str):
print(str)
d = {"x": [], "y": []}
c = 1
for i in range(1, len(str)):
if str[i-1] == str[i]:
c += 1
else:
d[str[i-1]].append(c)
c = 1
d[str[i]].append(c)
print(d[ch])
return max(d[ch])
def Perfect_String(str, a)... | def check_substr(ch, str):
print(str)
d = {'x': [], 'y': []}
c = 1
for i in range(1, len(str)):
if str[i - 1] == str[i]:
c += 1
else:
d[str[i - 1]].append(c)
c = 1
d[str[i]].append(c)
print(d[ch])
return max(d[ch])
def perfect__string(str,... |
# program to check if a set is a subset of another set.
print("Check if a set is a subset of another set, using comparison operators and issubset():\n")
setx = set(["apple", "mango"])
sety = set(["mango", "orange"])
setz = set(["mango"])
print("x: ",setx)
print("y: ",sety)
print("z: ",setz,"\n")
print("If x is subset o... | print('Check if a set is a subset of another set, using comparison operators and issubset():\n')
setx = set(['apple', 'mango'])
sety = set(['mango', 'orange'])
setz = set(['mango'])
print('x: ', setx)
print('y: ', sety)
print('z: ', setz, '\n')
print('If x is subset of y')
print(setx <= sety)
print(setx.issubset(sety))... |
n = int(input())
for idx in range(1, n):
print(" " * (n - idx) + "*" * idx)
print("*"*n)
for idx in range(n + 1, 2 * n):
print(" " * (idx - n) + "*" * (2 * n - idx))
| n = int(input())
for idx in range(1, n):
print(' ' * (n - idx) + '*' * idx)
print('*' * n)
for idx in range(n + 1, 2 * n):
print(' ' * (idx - n) + '*' * (2 * n - idx)) |
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: volumePlot.py
#
# Tests: mesh - 3D rectilinear, one domain
# plots - volume
# operators - none
# selection - no
#
# Programmer: Kathleen Bonnell
#... | def init_annotations():
turn_off_all_annotations()
def init_annotations_legend_on():
a = annotation_attributes()
turn_off_all_annotations(a)
a.legendInfoFlag = 1
set_annotation_attributes(a)
def test_volume_scaling():
open_database(silo_data_path('rect3d.silo'))
add_plot('Volume', 't')
... |
class Queue:
def __init__(self):
self.queue = list()
def queue_item(self, dataval):
if dataval not in self.queue:
self.queue.insert(0, dataval)
return True
return False
def size(self):
return len(self.queue)
def remove_item(self):
if... | class Queue:
def __init__(self):
self.queue = list()
def queue_item(self, dataval):
if dataval not in self.queue:
self.queue.insert(0, dataval)
return True
return False
def size(self):
return len(self.queue)
def remove_item(self):
if le... |
class Neural():
def __init__(self):
pass
class My_train(object):
def __init__(self, data, labels, toler, step_w, step_b):
pass
| class Neural:
def __init__(self):
pass
class My_Train(object):
def __init__(self, data, labels, toler, step_w, step_b):
pass |
class PyObj(BaseObj):
def importClass(className: str, fp: str):
pass
def newObj(objName: str, className: str, fp: str):
pass
def makeInlcude(fp: str):
pass
def makeNewObj(fp: str):
pass
def getInclude() -> str:
pass
class PyMethod (SysObj):
def make... | class Pyobj(BaseObj):
def import_class(className: str, fp: str):
pass
def new_obj(objName: str, className: str, fp: str):
pass
def make_inlcude(fp: str):
pass
def make_new_obj(fp: str):
pass
def get_include() -> str:
pass
class Pymethod(SysObj):
def... |
#exercise: try to print out multiple maps using the quick_display function
#disable warnings
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
zebra_img = zebra_imgs[0]
horse_img = horse_imgs[0]
#expand the dimensions of the images of zebra_img and horse_img (can also be done with reshape)
zebra_img_4d ... | tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
zebra_img = zebra_imgs[0]
horse_img = horse_imgs[0]
zebra_img_4d = np.expand_dims(..., axis=...)
horse_img_4d = np.expand_dims(..., axis=...)
n_layers = 3
for i in range(n_layers):
input_layer = ...
output_layer = ...
model_ = model(inputs=[inpu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
x = [1,3,5,7,9]
sum_squared = sum([y**2 for y in x])
print(sum_squared)
x = [1,2,3,4,5,6,7,8,9]
even_squared = [y**2 for y in x if y%2==0]
print(even_squared)
x = [1,2,3,4,5,6,7,8,9]
squared_cubed = [y**2 if y%2==0 else y**3 for y in x]
print(squared_cubed)
x = [1,2,3,4... | x = [1, 3, 5, 7, 9]
sum_squared = sum([y ** 2 for y in x])
print(sum_squared)
x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
even_squared = [y ** 2 for y in x if y % 2 == 0]
print(even_squared)
x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
squared_cubed = [y ** 2 if y % 2 == 0 else y ** 3 for y in x]
print(squared_cubed)
x = [1, 2, 3, 4, 5, 6, 7, ... |
state_capitals ={"Washington":"Olympia", "Oregon":"Salem", "California":"Sacramento"}
#Length of dictionary
# print(len(state_capitals))
#Look up by key
# print(state_capitals["Washington"])
state_capitals["Washington"] = "Aberdeen"
state_capitals["Texas"] = "Austin"
print(state_capitals)
del state_capitals[... | state_capitals = {'Washington': 'Olympia', 'Oregon': 'Salem', 'California': 'Sacramento'}
state_capitals['Washington'] = 'Aberdeen'
state_capitals['Texas'] = 'Austin'
print(state_capitals)
del state_capitals['California']
print(state_capitals)
removed_capital = state_capitals.pop('Oregon')
print(state_capitals)
print(r... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
if not inorder:
... | class Solution:
def build_tree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
if not inorder:
return None
curr = postorder.pop()
idx = inorder.index(curr)
right = self.buildTree(inorder[idx + 1:], postorder)
left = self.buildTree(inorder[:idx], post... |
q = int(input())
s = ''
stack = []
for _ in range(q):
operation = input().strip().split()
t = operation[0]
if t == '1':
stack.append(s)
s = s + operation[1]
elif t == '2':
stack.append(s)
k = int(operation[1])
s = s[0:-k]
elif t == '3':
k = int(operati... | q = int(input())
s = ''
stack = []
for _ in range(q):
operation = input().strip().split()
t = operation[0]
if t == '1':
stack.append(s)
s = s + operation[1]
elif t == '2':
stack.append(s)
k = int(operation[1])
s = s[0:-k]
elif t == '3':
k = int(operati... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
check_instruction = {
('connect_num', 'mysql'): '''
select count(*) from information_schema.processlist
union
select @@global.max_connections
''',
('connect_num', 'oracle'): '''
select count(*) from v$process
union
select to_number(display_value) from v$... | check_instruction = {('connect_num', 'mysql'): '\n select count(*) from information_schema.processlist\n union\n select @@global.max_connections\n ', ('connect_num', 'oracle'): "\n select count(*) from v$process\n union\n select to_number(display_value) from v$paramete... |
# -*- coding: utf-8 -*-
class AutoApiMissingAdminConfig(Exception):
pass
class Message(Exception):
def __init__(self, message):
super(Message, self).__init__()
self.message = message
| class Autoapimissingadminconfig(Exception):
pass
class Message(Exception):
def __init__(self, message):
super(Message, self).__init__()
self.message = message |
# python3
class Solution:
def jump(self, nums: 'List[int]') -> 'int':
lennums = len(nums)
step, end, start, maxend = 0, 0, 0, 0
while end < lennums - 1 :
step += 1
maxend = end + 1
for i in range(start, end+1):
... | class Solution:
def jump(self, nums: 'List[int]') -> 'int':
lennums = len(nums)
(step, end, start, maxend) = (0, 0, 0, 0)
while end < lennums - 1:
step += 1
maxend = end + 1
for i in range(start, end + 1):
maxend = max(maxend, i + nums[i])... |
#For 35 points, answer the following questions.
#Be careful to run each program separately!
'''1. What does this program print? Open data.txt to see if that's what you
would have expected.'''
#Open for reading. The 'r' stands for reading. We could alternatively use
#'w' for writing, but let's save that for later.
fil... | """1. What does this program print? Open data.txt to see if that's what you
would have expected."""
file_handle = open('data.txt', 'r')
line = file_handle.readline()
print(line)
file_handle.close()
"2. What's different if we call readline() again?"
file_handle = open('data.txt', 'r')
line = file_handle.readline()
line ... |
#
# PySNMP MIB module DTRConcentratorMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DTRConcentratorMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:40:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) ... |
#
# PySNMP MIB module CITRIX-COMMON-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CITRIX-COMMON-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:23:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
try:
file = open("/home/icaksh/Coolyeah/Python-Projects-Protek/Chapter 07/Praktikum-3/data.txt","r")
sum = 0
for data in file:
try:
sum = sum + int(data)
print(sum)
except ValueError:
print("Tipe data tidak valid")
except FileNotFoundError:
print("File... | try:
file = open('/home/icaksh/Coolyeah/Python-Projects-Protek/Chapter 07/Praktikum-3/data.txt', 'r')
sum = 0
for data in file:
try:
sum = sum + int(data)
print(sum)
except ValueError:
print('Tipe data tidak valid')
except FileNotFoundError:
print('Fil... |
def int_identity(a: int) -> int:
return a
def main():
print(int_identity(5))
def what_even(a: int, b: str, c = 5) -> str:
def heh(a):
pass
pass
| def int_identity(a: int) -> int:
return a
def main():
print(int_identity(5))
def what_even(a: int, b: str, c=5) -> str:
def heh(a):
pass
pass |
resposta = ''
while resposta != 'm' and resposta != 'f':
resposta = str(input('Informe o seu sexo [M/F]: ').lower())
if resposta != 'm' and resposta != 'f':
print('Caracter Invalido!')
print(resposta) | resposta = ''
while resposta != 'm' and resposta != 'f':
resposta = str(input('Informe o seu sexo [M/F]: ').lower())
if resposta != 'm' and resposta != 'f':
print('Caracter Invalido!')
print(resposta) |
if 0: # DEV
image_id = df_by_image.index[2] # Select an image with 15 ships
image_id = df_by_image.index[-2]
selfimage = Image(image_id)
selfimage.records
selfimage.load(img_zip, df)
selfimage.load_ships()
df_summary = selfimage.ship_summary_table()
df_summary
# for idx, in selfim... | if 0:
image_id = df_by_image.index[2]
image_id = df_by_image.index[-2]
selfimage = image(image_id)
selfimage.records
selfimage.load(img_zip, df)
selfimage.load_ships()
df_summary = selfimage.ship_summary_table()
df_summary
canvas2 = selfimage.draw_ellipses_img() |
nome = input('Qual seu nome?')
idade = input('Qual sua idade?')
peso = input('Qual seu peso?')
print(nome, idade, peso) | nome = input('Qual seu nome?')
idade = input('Qual sua idade?')
peso = input('Qual seu peso?')
print(nome, idade, peso) |
# 4.5 Validate BST
# Implement a function to check if a binary tree is a binary search tree.
class BinarySearchTree:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
# Insert the given value into the tree
def insert(self, value):
# if valu... | class Binarysearchtree:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def insert(self, value):
if value < self.value:
if not self.left:
self.left = binary_search_tree(value)
else:
self.le... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isCousins(self, root, x, y):
stack, res = [(root, 0, None)], []
while stack:
node, dep, p = stack... | class Solution(object):
def is_cousins(self, root, x, y):
(stack, res) = ([(root, 0, None)], [])
while stack:
(node, dep, p) = stack.pop()
if node.val == x or node.val == y:
res.append((dep, p))
if node.left:
stack.append((node.lef... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
n=int(input())
# print (n)
new=[]
for i in range(n):
stamp=input()
new.append(stamp)
var=set(new)
# print(var," v")
jup=var.add(stamp)
print(len(var))
| n = int(input())
new = []
for i in range(n):
stamp = input()
new.append(stamp)
var = set(new)
jup = var.add(stamp)
print(len(var)) |
def solution(xs):
positives = list(filter(lambda n: n > 0 and abs(n) <= 1000, xs))
negatives = list(filter(lambda n: n < 0 and abs(n) <= 1000, xs))
power = 1
if not positives and not negatives:
return "0"
if not positives and 0 not in xs and len(negatives) == 1:
return str(negatives[... | def solution(xs):
positives = list(filter(lambda n: n > 0 and abs(n) <= 1000, xs))
negatives = list(filter(lambda n: n < 0 and abs(n) <= 1000, xs))
power = 1
if not positives and (not negatives):
return '0'
if not positives and 0 not in xs and (len(negatives) == 1):
return str(negati... |
TRAINING_FILE_LST_PATH = "data/urmp/INSTR_NAME/train.lst"
SEEN_INSTRUMENTS=["Violin",
"Cello",
"Viola",
"Flute",
"Clarinet",
"Saxophone",
"Trumpet",
"Trombone"]
SEEN_INSTRUMENTS_NUM = len(SEEN_INSTRUMENTS)
| training_file_lst_path = 'data/urmp/INSTR_NAME/train.lst'
seen_instruments = ['Violin', 'Cello', 'Viola', 'Flute', 'Clarinet', 'Saxophone', 'Trumpet', 'Trombone']
seen_instruments_num = len(SEEN_INSTRUMENTS) |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Education, obj[4]: Occupation, obj[5]: Bar, obj[6]: Coffeehouse, obj[7]: Restaurant20to50, obj[8]: Direction_same, obj[9]: Distance
# {"feature": "Education", "instances": 85, "metric_value": 0.9951, "depth": 1}
if obj[3]<=3:
# {"featu... | def find_decision(obj):
if obj[3] <= 3:
if obj[6] <= 1.0:
if obj[1] <= 2:
if obj[7] > -1.0:
if obj[5] <= 1.0:
if obj[2] > 1:
if obj[4] <= 6:
if obj[0] > 0:
... |
# dataset settings
img_norm_cfg = dict(
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
train_multi_pipelines = dict(
query=[
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='Resize', img_scale=(1000, 600), keep_ratio=True),
... | img_norm_cfg = dict(mean=[103.53, 116.28, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
train_multi_pipelines = dict(query=[dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', img_scale=(1000, 600), keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Normal... |
frase = 'Curso em Video Python'
print(frase[:13])
| frase = 'Curso em Video Python'
print(frase[:13]) |
# Question: https://projecteuler.net/problem=265
# Construct a graph where nodes are numbers from 0 to 2**N.
# There're edges from i to j if, the last (N-1) digits of i is the same as the first (N-1) digits of j.
# From the graph, the the sum of Hamiltonian paths starting from 0.
N = 5
def construct_graph(n):
ma... | n = 5
def construct_graph(n):
mask = 2 ** n - 1
g = {}
for i in range(2 ** n):
G[i] = {}
j = i << 1 & mask
G[i][j] = 1
G[i][j + 1] = 1
return G
def path_to_num(path, N):
n = path[0]
for e in path[1:-N + 1]:
n = n * 2 + e % 2
return n
def dfs(G, path... |
class Config:
BOT_USE = False
BOT_TOKEN = '2041135766:AAHYOOE7a8R0EoGN3ACoqZ_wnwJ4adqyiWg' # from @botfather
APP_ID = 8901416 # from https://my.telegram.org/apps
API_HASH = 'ff05861c1bf07edcb2644f7f308584df' # from https://my.... | class Config:
bot_use = False
bot_token = '2041135766:AAHYOOE7a8R0EoGN3ACoqZ_wnwJ4adqyiWg'
app_id = 8901416
api_hash = 'ff05861c1bf07edcb2644f7f308584df'
auth_users = [1998893767] |
model = dict(
type='BasicGaussianDiffusion',
num_timesteps=4000,
betas_cfg=dict(type='cosine'),
denoising=dict(
type='DenoisingUnet',
image_size=32,
in_channels=3,
base_channels=128,
resblocks_per_downsample=3,
attention_res=[16, 8],
use_scale_shif... | model = dict(type='BasicGaussianDiffusion', num_timesteps=4000, betas_cfg=dict(type='cosine'), denoising=dict(type='DenoisingUnet', image_size=32, in_channels=3, base_channels=128, resblocks_per_downsample=3, attention_res=[16, 8], use_scale_shift_norm=True, dropout=0.3, num_heads=4, use_rescale_timesteps=True, output_... |
class RestaurantController(object):
def __init__(self, RestaurantService):
self.restaurant_service = RestaurantService
def addRestaurant(self):
return self.restaurant_service.addRestaurant()
def getFoodDeliveryTime(self, orders):
#At first, we import all the constraints we have
rest... | class Restaurantcontroller(object):
def __init__(self, RestaurantService):
self.restaurant_service = RestaurantService
def add_restaurant(self):
return self.restaurant_service.addRestaurant()
def get_food_delivery_time(self, orders):
restaurant = self.restaurant_service.addRestaur... |
if __name__ == '__main__':
a = [1, 3, 2]
b = [3, 4, 5]
a.sort()
print(a)
print(a+b)
a.extend(b)
print(a)
| if __name__ == '__main__':
a = [1, 3, 2]
b = [3, 4, 5]
a.sort()
print(a)
print(a + b)
a.extend(b)
print(a) |
class Solution:
# @param A, a list of integer
# @return an integer
def singleNumber(self, A):
one = two = 0
for a in A:
two |= (one & a)
one ^= a
not_three = ~(one & two)
one &= not_three
two &= not_three
return one
| class Solution:
def single_number(self, A):
one = two = 0
for a in A:
two |= one & a
one ^= a
not_three = ~(one & two)
one &= not_three
two &= not_three
return one |
global __version__
__version__ = "0.0.1"
def version():
return __version__
| global __version__
__version__ = '0.0.1'
def version():
return __version__ |
class Poslist:
def __init__(self, suffix, prefix=None, first_row=False, dataset=None):
positions = {}
if first_row:
for i in range(len(dataset)):
sequence = dataset[i]
line = []
while True:
j = 0
try:... | class Poslist:
def __init__(self, suffix, prefix=None, first_row=False, dataset=None):
positions = {}
if first_row:
for i in range(len(dataset)):
sequence = dataset[i]
line = []
while True:
j = 0
try... |
#
# PySNMP MIB module A3COM0028-ALARM-PEAK (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM0028-ALARM-PEAK
# Produced by pysmi-0.3.4 at Mon Apr 29 16:54:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (alarm_extensions,) = mibBuilder.importSymbols('A3COM0027-RMON-EXTENSIONS', 'alarmExtensions')
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint... |
class Solution:
def isPerfectSquare(self, num: int) -> bool:
s=str(num**.5)
return not int(s[s.index('.')+1:])
| class Solution:
def is_perfect_square(self, num: int) -> bool:
s = str(num ** 0.5)
return not int(s[s.index('.') + 1:]) |
class Transform:
def __init__(self):
self._transforms = []
pass;
# Add a new transform the list
def push(self, case, delimiter):
transform = (case, delimiter)
self._transforms.append(transform)
# Apply transforms in order to the input replace tokens
def apply(self, replace_tokens):
#pr... | class Transform:
def __init__(self):
self._transforms = []
pass
def push(self, case, delimiter):
transform = (case, delimiter)
self._transforms.append(transform)
def apply(self, replace_tokens):
replacement_text = ''
for i in range(min(len(self._transforms)... |
n = int(input())
lista = [int(x) for x in input().split()]
total = 1
for x in range(2, n):
if lista[x] - lista[x-1] != lista[x-1] - lista[x-2]:
total += 1
print(total) | n = int(input())
lista = [int(x) for x in input().split()]
total = 1
for x in range(2, n):
if lista[x] - lista[x - 1] != lista[x - 1] - lista[x - 2]:
total += 1
print(total) |
''' Configuration file for the program '''
REGION = 'EUW'
LOCALE = 'en_GB'
RIOT_CLIENT_SERVICES_PATH = 'E:/Riot Games/Riot Client/RiotClientServices.exe'
LEAGUE_CLIENT_PATH = 'E:/Riot Games/League of Legends/LeagueClient.exe'
LEAGUE_CLIENT_PROCESS = 'LeagueClient.exe'
RIOT_CLIENT_PROCESS = 'RiotClientServices.exe'
RI... | """ Configuration file for the program """
region = 'EUW'
locale = 'en_GB'
riot_client_services_path = 'E:/Riot Games/Riot Client/RiotClientServices.exe'
league_client_path = 'E:/Riot Games/League of Legends/LeagueClient.exe'
league_client_process = 'LeagueClient.exe'
riot_client_process = 'RiotClientServices.exe'
riot... |
TXTRADER_MODE = 'rtx'
TXTRADER_PROTOCOL = 'http'
TXTRADER_HOST = 'localhost'
TXTRADER_HTTP_PORT = '50080'
TXTRADER_USERNAME = 'txtrader_user'
TXTRADER_PASSWORD = 'change_this_password'
TXTRADER_API_ACCOUNT = 'SET.YOUR.TEST.ACCOUNT'
TXTRADER_ROUTE = 'DEMO'
| txtrader_mode = 'rtx'
txtrader_protocol = 'http'
txtrader_host = 'localhost'
txtrader_http_port = '50080'
txtrader_username = 'txtrader_user'
txtrader_password = 'change_this_password'
txtrader_api_account = 'SET.YOUR.TEST.ACCOUNT'
txtrader_route = 'DEMO' |
stL = "^lock"
stU = "^unlock"
stC = "^un"
stAd = "enable "
stUd = "disable "
startlock = "^lock (.*)$|^unlock (.*)$|enable (.*)$|^disable (.*)$"
Lurl = "lock links"
Uurl = "unlock links"
Lphoto = "lock photo"
Uphoto = "unlock photo"
Lvoice = "lock voice"
Uvoice = "unlock voice"
Lvideo = "lock video"
Uvideo = "unlock vi... | st_l = '^lock'
st_u = '^unlock'
st_c = '^un'
st_ad = 'enable '
st_ud = 'disable '
startlock = '^lock (.*)$|^unlock (.*)$|enable (.*)$|^disable (.*)$'
lurl = 'lock links'
uurl = 'unlock links'
lphoto = 'lock photo'
uphoto = 'unlock photo'
lvoice = 'lock voice'
uvoice = 'unlock voice'
lvideo = 'lock video'
uvideo = 'unlo... |
if __name__ == '__main__':
stock = {
'Apple': 655.95, 'IBM': 202.13, 'HP': 45.51, 'Facebook': 12.11,
'Intel': 40.51, 'Atmel': 10.23, 'Amazon': 305.35, 'Google': 535.81
}
s_100 = {k: v for k, v in stock.items() if v > 100}
print("s_100 = {}".format(s_100))
'''
s_100 = {'Apple': 655.9... | if __name__ == '__main__':
stock = {'Apple': 655.95, 'IBM': 202.13, 'HP': 45.51, 'Facebook': 12.11, 'Intel': 40.51, 'Atmel': 10.23, 'Amazon': 305.35, 'Google': 535.81}
s_100 = {k: v for (k, v) in stock.items() if v > 100}
print('s_100 = {}'.format(s_100))
"\n\ns_100 = {'Apple': 655.95, 'IBM': 202.13, 'Amazo... |
# Node Object
class Node:
def __init__(self, data):
self.data = data
self.source = None # Parent node.
self.links = [] # Linked child node.
def __repr__(self):
return self.data
def add(self, node):
self.links.append(node)
# Tree Objec... | class Node:
def __init__(self, data):
self.data = data
self.source = None
self.links = []
def __repr__(self):
return self.data
def add(self, node):
self.links.append(node)
class Tree:
def __init__(self, root):
self.root = root
self.nodes = [ro... |
def max(A,size):
s=0
maxi=A[0]
for i in range(size):
s+= A[i]
if s>maxi:
maxi=s
elif s<0:
s=0
return maxi
#Drivers code
A=[-2,1,-3,4,-1,2,1,-5,4]
size=len(A)
print(max(A,size))
| def max(A, size):
s = 0
maxi = A[0]
for i in range(size):
s += A[i]
if s > maxi:
maxi = s
elif s < 0:
s = 0
return maxi
a = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
size = len(A)
print(max(A, size)) |
class SegmentTree:
def __init__(self, arr, function):
self.tree = [None for _ in range(len(arr))] + arr
self.size = len(arr)
self.fn = function
self.build_tree()
def build_tree(self):
for i in range(self.size - 1, 0, -1):
self.tree[i] = self.fn(self.tree[i * ... | class Segmenttree:
def __init__(self, arr, function):
self.tree = [None for _ in range(len(arr))] + arr
self.size = len(arr)
self.fn = function
self.build_tree()
def build_tree(self):
for i in range(self.size - 1, 0, -1):
self.tree[i] = self.fn(self.tree[i *... |
DEBUG = True
#HOST = '127.0.0.1'
#PORT = 8000
SECRET_KEY = 'GWK~M$F2"|[|i|,KEJWxvA5~JQN!}fUz>|&h`>g.K2/p)%t3%4P:tuR6G6A'
DEFAULT_RATE = "100/hour"
| debug = True
secret_key = 'GWK~M$F2"|[|i|,KEJWxvA5~JQN!}fUz>|&h`>g.K2/p)%t3%4P:tuR6G6A'
default_rate = '100/hour' |
# Verifica a simetria da matriz
def verifica_simetria(matriz, ordem):
for i in range(ordem):
for j in range(ordem):
if not (matriz[i][j] == matriz[j][i]):
return False
return True
# Programa principal
def main():
# Leitura dos dados
ordem = int(input())
matriz = ... | def verifica_simetria(matriz, ordem):
for i in range(ordem):
for j in range(ordem):
if not matriz[i][j] == matriz[j][i]:
return False
return True
def main():
ordem = int(input())
matriz = []
for i in range(ordem):
linha_lida = input()
linha_string... |
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Decision_Tree_Classifier.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyOqPdVAAXzl4lXr4JfWfMvw",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
... | {'nbformat': 4, 'nbformat_minor': 0, 'metadata': {'colab': {'name': 'Decision_Tree_Classifier.ipynb', 'provenance': [], 'authorship_tag': 'ABX9TyOqPdVAAXzl4lXr4JfWfMvw', 'include_colab_link': true}, 'kernelspec': {'name': 'python3', 'display_name': 'Python 3'}}, 'cells': [{'cell_type': 'markdown', 'metadata': {'id': 'v... |
def makeArrayConsecutive2(statues):
noStatuesNeeded = 0
statues.sort()
for x in range(0, len(statues) - 1):
num = statues[x + 1] - statues[x]
noStatuesNeeded += num - 1
return noStatuesNeeded
#
#def makeArrayConsecutive2(statues):
# return sum([1 for i in range(min(statues... | def make_array_consecutive2(statues):
no_statues_needed = 0
statues.sort()
for x in range(0, len(statues) - 1):
num = statues[x + 1] - statues[x]
no_statues_needed += num - 1
return noStatuesNeeded |
# Given a phone keypad as shown below:
# 1 2 3
# 4 5 6
# 7 8 9
# 0
# How many different 10-digit numbers can be formed starting from 1?
# The constraint is that the movement from 1 digit to the next is similar
# to the movement of the Knight in a chess game.
# For eg. if we are at 1 then the next digit can be either... | knight_move = {1: [8, 6], 2: [7, 9], 3: [4, 8], 4: [0, 9], 5: None, 6: [0, 7], 7: [2, 6], 8: [1, 3], 9: [2, 4], 0: [4, 6]}
def find_10_digit_num_count(start_num, count):
if count == 1:
return 1
if start_num == 5:
return 0
next_move = knight_move[start_num]
return find_10_digit_num_count... |
# This file is part of the Jsonify.
#
# Copyright (C) 2021 Serghei Iakovlev <egrep@protonmail.ch>
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
class BaseResource:
TYPE = 'slate-addon-variants'
def __init__(self, resource_id=None... | class Baseresource:
type = 'slate-addon-variants'
def __init__(self, resource_id=None, name=None):
self._resource_id = resource_id
self._name = name
@property
def id(self):
return self._resource_id
@property
def name(self):
return self._name
class Document(Bas... |
# Quick Union (Lazy approach)
# Created by: Mohammed Mounir, Bouhamed
# Date: July 17, 2021
class QuickUnionQU:
def __init__(self, n):
self.id = list(range(n))
def root(self, i):
while self.id[i] != i:
i = self.id[i]
return i
def connected(self, p, q):
return... | class Quickunionqu:
def __init__(self, n):
self.id = list(range(n))
def root(self, i):
while self.id[i] != i:
i = self.id[i]
return i
def connected(self, p, q):
return self.root(p) == self.root(q)
def union(self, p, q):
p_root = self.root(p)
... |
# 1. Unique Usernames
# Write a program that reads from the console a sequence of N usernames and keeps a collection only of the unique ones.
# On the first line, you will receive an integer N. On the next N lines, you will receive a username.
# Print the collection on the console (the order does not matter):
N = int(... | n = int(input())
usernames = set()
for _ in range(N):
usernames.add(input())
[print(username) for username in usernames] |
vbox_left_layout = widgets.Layout(align_items='flex-start')
label = widgets.Label('Choose special characters to include')
toggles = widgets.ToggleButtons(description='',
options=[',./;[', '!@#~%', '^&*()'],
style={'description_width': 'initial'})
# Set t... | vbox_left_layout = widgets.Layout(align_items='flex-start')
label = widgets.Label('Choose special characters to include')
toggles = widgets.ToggleButtons(description='', options=[',./;[', '!@#~%', '^&*()'], style={'description_width': 'initial'})
toggles.layout.margin = '0 0 0 20px'
better_toggles = widgets.VBox([label... |
#!/usr/bin/python
def histogram(list_of_integers):
'''
Prints a histogram based on the list of integers
'''
for integer in list_of_integers:
print(integer * '*')
| def histogram(list_of_integers):
"""
Prints a histogram based on the list of integers
"""
for integer in list_of_integers:
print(integer * '*') |
AVAILABLE_MSI_KEYMAPS = [
(['GE63', 'GE73', 'GE75', 'GS63', 'GS73', 'GS75', 'GX63', 'GT63', 'GL63', 'GL73'],
{9: 41,
10: 30,
11: 31,
12: 32,
13: 33,
14: 34,
15: 35,
16: 36,
17: 37,
18: 38,
19: 39,
20: 45,
21: 46,
22: 42,
23: 4... | available_msi_keymaps = [(['GE63', 'GE73', 'GE75', 'GS63', 'GS73', 'GS75', 'GX63', 'GT63', 'GL63', 'GL73'], {9: 41, 10: 30, 11: 31, 12: 32, 13: 33, 14: 34, 15: 35, 16: 36, 17: 37, 18: 38, 19: 39, 20: 45, 21: 46, 22: 42, 23: 43, 24: 20, 25: 26, 26: 8, 27: 21, 28: 23, 29: 28, 30: 24, 31: 12, 32: 18, 33: 19, 34: 47, 35: 4... |
def reverse(s1,s2):
if len(s1) ==1:
return
while len(s1) != 1:
data=s1.pop()
s2.append(data)
ele=s1[len(s1)-1]
s1.pop()
while len(s2) != 0:
data=s2.pop()
s1.append(data)
reverse(s1,s2)
s1.append(ele)
s1=list()
s2=list()
s1.append(1)
s1.append(2)
s1.app... | def reverse(s1, s2):
if len(s1) == 1:
return
while len(s1) != 1:
data = s1.pop()
s2.append(data)
ele = s1[len(s1) - 1]
s1.pop()
while len(s2) != 0:
data = s2.pop()
s1.append(data)
reverse(s1, s2)
s1.append(ele)
s1 = list()
s2 = list()
s1.append(1)
s1.a... |
#Mass = pounds / 2.2
def mass_solver():
pounds = float(input("What is your weight (lbs)?\n"))
mass = pounds / 2.2
print(f"Your weight in kg is {mass}kg.")
#Force = mass * acceleration
def force_solver():
mass = float(input("What is your mass (kg)?\n"))
acceleration = float(input("What is the acceleration... | def mass_solver():
pounds = float(input('What is your weight (lbs)?\n'))
mass = pounds / 2.2
print(f'Your weight in kg is {mass}kg.')
def force_solver():
mass = float(input('What is your mass (kg)?\n'))
acceleration = float(input('What is the acceleration?\n'))
force = mass * acceleration
p... |
# mistertribs - experiment 4
# https://youtu.be/bHvZQIrdThE
Scale.default.set([i*12/19 for i in [0,1,4,7,8,11,12,15,16]])
Root.default = 0
Clock.bpm = 120
~b1 >> klank(P[0,4,7])
~b1 >> klank(P[0,4,7], formant=linvar([0,2],8))
~p1 >> blip([0,3,5,4,7,2], dur=.5)
~p1 >> blip([0,3,5,4,7,2], dur=.5, room=.5, mix=.5)
~d1... | Scale.default.set([i * 12 / 19 for i in [0, 1, 4, 7, 8, 11, 12, 15, 16]])
Root.default = 0
Clock.bpm = 120
~b1 >> klank(P[0, 4, 7])
~b1 >> klank(P[0, 4, 7], formant=linvar([0, 2], 8))
~p1 >> blip([0, 3, 5, 4, 7, 2], dur=0.5)
~p1 >> blip([0, 3, 5, 4, 7, 2], dur=0.5, room=0.5, mix=0.5)
~d1 >> play('{p[pp][ppp]}', rate=p_... |
{
"folders":
[
{
"follow_symlinks": true,
"path": "../phue"
}
]
} | {'folders': [{'follow_symlinks': true, 'path': '../phue'}]} |
def dict_in(value):
'''
Checks for the existence of a dictionary in a list
Arguments:
value -- A list
Returns:
A Boolean
'''
return any(isinstance(item, dict) for item in value)
| def dict_in(value):
"""
Checks for the existence of a dictionary in a list
Arguments:
value -- A list
Returns:
A Boolean
"""
return any((isinstance(item, dict) for item in value)) |
class Reglas:
regla2 = False
regla3 = False
regla4 = False
regla5 = False
pendiente = ''
optimizado = ''
reglas = []
rela_negada = ''
condicional_negada = ''
| class Reglas:
regla2 = False
regla3 = False
regla4 = False
regla5 = False
pendiente = ''
optimizado = ''
reglas = []
rela_negada = ''
condicional_negada = '' |
class ExpressedValue(object):
def __init__(self, val):
if not val:
raise ValueError("Cannot create NULL value.")
def extract(self):
raise NotImplementedError
def __str__(self):
return "{0}".format(self.extract()) | class Expressedvalue(object):
def __init__(self, val):
if not val:
raise value_error('Cannot create NULL value.')
def extract(self):
raise NotImplementedError
def __str__(self):
return '{0}'.format(self.extract()) |
XTPOrderInsertInfo = {
"order_xtp_id": "uint64_t",
"order_client_id": "uint32_t",
"ticker": "char",
"market": "enum",
"price": "double",
"stop_price": "double",
"quantity": "int64_t",
"price_type": "enum",
"u32": "uint32_t",
"side": "uint8_t",
"position_effect": "uint8_t",
"reserved1": "uint8_t",
"reserved... | xtp_order_insert_info = {'order_xtp_id': 'uint64_t', 'order_client_id': 'uint32_t', 'ticker': 'char', 'market': 'enum', 'price': 'double', 'stop_price': 'double', 'quantity': 'int64_t', 'price_type': 'enum', 'u32': 'uint32_t', 'side': 'uint8_t', 'position_effect': 'uint8_t', 'reserved1': 'uint8_t', 'reserved2': 'uint8_... |
version = (3, 3, 0)
version_string = "3.3.0"
release_date = "2014.06.27"
| version = (3, 3, 0)
version_string = '3.3.0'
release_date = '2014.06.27' |
def stream_executor_friends():
return ["//tensorflow/..."]
def tf_additional_cuda_platform_deps():
return []
# Use dynamic loading, therefore should be empty.
def tf_additional_cuda_driver_deps():
return []
def tf_additional_cudnn_plugin_deps():
return []
| def stream_executor_friends():
return ['//tensorflow/...']
def tf_additional_cuda_platform_deps():
return []
def tf_additional_cuda_driver_deps():
return []
def tf_additional_cudnn_plugin_deps():
return [] |
#!/usr/bin/env python
class MyValues(object):
def __init__(self, pcap_sequence_number, timestamp):
self.pcap_sequence_number = pcap_sequence_number
self.timestamp = timestamp
def main():
input_file = 'duplicate_packets_check.out'
packets_database = dict()
with open(input_file, 'r') a... | class Myvalues(object):
def __init__(self, pcap_sequence_number, timestamp):
self.pcap_sequence_number = pcap_sequence_number
self.timestamp = timestamp
def main():
input_file = 'duplicate_packets_check.out'
packets_database = dict()
with open(input_file, 'r') as packets_file:
... |
#
# @lc app=leetcode id=729 lang=python3
#
# [729] My Calendar I
#
# https://leetcode.com/problems/my-calendar-i/description/
#
# algorithms
# Medium (54.10%)
# Likes: 1389
# Dislikes: 50
# Total Accepted: 113.2K
# Total Submissions: 209.2K
# Testcase Example: '["MyCalendar","book","book","book"]\n[[],[10,20],[1... | class Mycalendar:
def __init__(self):
self.time_ranges = []
def book(self, start: int, end: int) -> bool:
is_overlapped = self.bianry_search(start, end)
if not is_overlapped:
return False
self.time_ranges.append([start, end])
return True
def bianry_sear... |
def test():
x = -y
x = y + z
x = y - z
x = y * z
x = y / z
x = y % z
x = ~y
x = y & z
x = y | z
| def test():
x = -y
x = y + z
x = y - z
x = y * z
x = y / z
x = y % z
x = ~y
x = y & z
x = y | z |
def func(array, x , y):
if((x != None) & (y != None)):
for e in array:
if e == (x+y):
return True
return False
| def func(array, x, y):
if (x != None) & (y != None):
for e in array:
if e == x + y:
return True
return False |
class Solution:
def testStringUnique(self, s: str):
l = len(s)
for i in range(0, l):
for j in range(i+1, l):
if s[i] == s[j]:
return False
return True
def lengthOfLongestSubstring(self, s: str) -> int:
result = 0
hop = 1
... | class Solution:
def test_string_unique(self, s: str):
l = len(s)
for i in range(0, l):
for j in range(i + 1, l):
if s[i] == s[j]:
return False
return True
def length_of_longest_substring(self, s: str) -> int:
result = 0
ho... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.