content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""539. Move Zeroes"""
class Solution:
"""
@param nums: an integer array
@return: nothing
"""
def moveZeroes(self, nums):
# write your code here
## Practice:
l = 0
r = 0
n = len(nums)
while r < n:
if r < n and nums[r] != 0:
... | """539. Move Zeroes"""
class Solution:
"""
@param nums: an integer array
@return: nothing
"""
def move_zeroes(self, nums):
l = 0
r = 0
n = len(nums)
while r < n:
if r < n and nums[r] != 0:
(nums[l], nums[r]) = (nums[r], nums[l])
... |
def nonstring_iterable(obj):
try: iter(obj)
except TypeError: return False
else: return not isinstance(obj, basestring)
| def nonstring_iterable(obj):
try:
iter(obj)
except TypeError:
return False
else:
return not isinstance(obj, basestring) |
# If the list grows large, it might be worth using a dictionary
isps = ('gmail.', 'yahoo.', 'earthlink.', 'comcast.', 'att.', 'movistar.', 'hotmail.', 'mail.', 'googlemail.',
'msn.', 'bellsouth.', 'telus.', 'optusnet.', 'qq.', 'sky.', 'icloud.', 'mac.', 'sympatico.',
'xtra.', 'web.', 'cox.', 'ymail.', '... | isps = ('gmail.', 'yahoo.', 'earthlink.', 'comcast.', 'att.', 'movistar.', 'hotmail.', 'mail.', 'googlemail.', 'msn.', 'bellsouth.', 'telus.', 'optusnet.', 'qq.', 'sky.', 'icloud.', 'mac.', 'sympatico.', 'xtra.', 'web.', 'cox.', 'ymail.', 'aim.', 'rogers.', 'verizon.', 'rocketmail.', 'google.', 'optonline.', 'sbcglobal... |
class Solution:
def isPalindrome(self, s: str) -> bool:
l1 = ord('a')
r1 = ord('z')
l2 = ord('A')
r2 = ord('Z')
l3 = ord('0')
r3 = ord('9')
diff = ord('a') - ord('A')
seq = [
chr(ord(ch) - diff) if l1 <= ord(ch)... | class Solution:
def is_palindrome(self, s: str) -> bool:
l1 = ord('a')
r1 = ord('z')
l2 = ord('A')
r2 = ord('Z')
l3 = ord('0')
r3 = ord('9')
diff = ord('a') - ord('A')
seq = [chr(ord(ch) - diff) if l1 <= ord(ch) <= r1 else ch for ch in s if l1 <= ord(... |
# -*- coding: utf-8 -*-
class ConfigFetchError(Exception):
"""Raised when we were unable to fetch the config from the server
"""
def __init__(self, msg, response):
self.msg = msg
self.response = response
super(Exception, self)
class InvalidAPICallError(Exception):
pass
class... | class Configfetcherror(Exception):
"""Raised when we were unable to fetch the config from the server
"""
def __init__(self, msg, response):
self.msg = msg
self.response = response
super(Exception, self)
class Invalidapicallerror(Exception):
pass
class Unknownartifactoryresterr... |
# -*- coding: utf-8 -*-
__author__ = 'Audrey Roy Greenfeld'
__email__ = 'aroy@alum.mit.edu'
__version__ = '0.1.0'
| __author__ = 'Audrey Roy Greenfeld'
__email__ = 'aroy@alum.mit.edu'
__version__ = '0.1.0' |
def number_of_divisors(divisor: int) -> int:
global requests
global divisors
if divisor in divisors:
return divisors[divisor]
requests.add(divisor)
count = 2
for i in range(2, int(divisor**0.5) + 1):
if not (divisor % i):
count += 2
divisors[divisor] ... | def number_of_divisors(divisor: int) -> int:
global requests
global divisors
if divisor in divisors:
return divisors[divisor]
requests.add(divisor)
count = 2
for i in range(2, int(divisor ** 0.5) + 1):
if not divisor % i:
count += 2
divisors[divisor] = count
r... |
class Solution:
def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:
totalRemain = 0
remainFromStart = 0
start = None
for i in range(len(gas)):
remain = gas[i] - cost[i] # remain when cross the station
remainFromStart += remain
if ... | class Solution:
def can_complete_circuit(self, gas: List[int], cost: List[int]) -> int:
total_remain = 0
remain_from_start = 0
start = None
for i in range(len(gas)):
remain = gas[i] - cost[i]
remain_from_start += remain
if remainFromStart < 0:
... |
"""
DESCRIPTORS: local ang global descriptors for a rectangular (part of an) image.
"""
__autor__ = 'Vlad Popovici'
| """
DESCRIPTORS: local ang global descriptors for a rectangular (part of an) image.
"""
__autor__ = 'Vlad Popovici' |
# -*- coding: utf-8 -*- #
# Copyright 2015 Google Inc. All Rights Reserved.
"""Package marker file."""
| """Package marker file.""" |
# Membaca file hello.txt dengan fungsi readlines()
print(">>> Membaca file hello.txt dengan fungsi readlines()")
file = open("hello.txt", "r")
all_lines = file.readlines()
file.close()
print(all_lines)
# Membaca file hello.txt dengan menerapkan looping
print(">>> Membaca file hello.txt dengan menerapkan looping")
file ... | print('>>> Membaca file hello.txt dengan fungsi readlines()')
file = open('hello.txt', 'r')
all_lines = file.readlines()
file.close()
print(all_lines)
print('>>> Membaca file hello.txt dengan menerapkan looping')
file = open('hello.txt', 'r')
for line in file:
print(line)
file.close() |
class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
def get_person(self):
return '<Person ({0}, {1})'.format(self.name, self.age)
p = Person('Manuel', 21)
print('Type of Object: {0}, Memory Address: {1}'.format(type(p), id(p))) | class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
def get_person(self):
return '<Person ({0}, {1})'.format(self.name, self.age)
p = person('Manuel', 21)
print('Type of Object: {0}, Memory Address: {1}'.format(type(p), id(p))) |
class Solution:
def countAndSay(self, n: int) -> str:
say = '1'
while n > 1 :
n -= 1
temp = say
tag = temp[0]
count = 1
say = ''
for j in range(1, len(temp)):
if temp[j] == tag:
count += 1
... | class Solution:
def count_and_say(self, n: int) -> str:
say = '1'
while n > 1:
n -= 1
temp = say
tag = temp[0]
count = 1
say = ''
for j in range(1, len(temp)):
if temp[j] == tag:
count += 1
... |
# v1
# can only buy then sell once
def max_profit_1(prices):
if not prices: return 0
low = prices[0] # lowest price so far
profit = 0
for price in prices:
if low >= price:
low = price
else:
profit = max(profit, price - low)
return profit
# O(n) time and spac... | def max_profit_1(prices):
if not prices:
return 0
low = prices[0]
profit = 0
for price in prices:
if low >= price:
low = price
else:
profit = max(profit, price - low)
return profit
def max_profit_3(prices):
if not prices:
return 0
prof... |
""" Python Playlist Parser (plparser)
Copyright (C) 2012 Hugo Caille
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditi... | """ Python Playlist Parser (plparser)
Copyright (C) 2012 Hugo Caille
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditi... |
def preorderTraversal(root):
if root is None:
return []
nodes = []
def visit(node, nodes):
if node is None:
return
nodes.append(node.val)
visit(node.left, nodes)
visit(node.right, nodes)
visit(root, nodes)
return nodes
| def preorder_traversal(root):
if root is None:
return []
nodes = []
def visit(node, nodes):
if node is None:
return
nodes.append(node.val)
visit(node.left, nodes)
visit(node.right, nodes)
visit(root, nodes)
return nodes |
def encrypt(input, key):
encrypted = []
for i in range(0, len(input)):
a = ord(input[i])
for j in range (0, key):
a = a + 1
if (a>122):
a = 97
encrypted.append(chr(a))
return "".join(encrypted)
def decrypt(input, key):
de... | def encrypt(input, key):
encrypted = []
for i in range(0, len(input)):
a = ord(input[i])
for j in range(0, key):
a = a + 1
if a > 122:
a = 97
encrypted.append(chr(a))
return ''.join(encrypted)
def decrypt(input, key):
decrypted = []
fo... |
number_of_input_bits = 1
mux_x = 0.002 # in m
mux_y = 0.0012 # in m
for i in range(number_of_input_bits):
positionx = 0.0 + mux_x * i
line = "Mux1" + str(i) + "\t" + str(mux_x) + "\t" + str(mux_y) + "\t"
line += str(round(positionx, 8)) + "\t"
positiony = 0.0
line += str(round(positiony, 8))
... | number_of_input_bits = 1
mux_x = 0.002
mux_y = 0.0012
for i in range(number_of_input_bits):
positionx = 0.0 + mux_x * i
line = 'Mux1' + str(i) + '\t' + str(mux_x) + '\t' + str(mux_y) + '\t'
line += str(round(positionx, 8)) + '\t'
positiony = 0.0
line += str(round(positiony, 8))
print(line)
l... |
k,s=map(int,input().split())
x=list(input())
for i in range(s):
if x[i].isalpha() and x[i].isupper():
print(chr(ord('A')+(ord(x[i])-ord('A')+k)%26),end='')
elif x[i].isalpha():
print(chr(ord('a')+(ord(x[i])-ord('a')+k)%26),end='')
else:
print(x[i],end='') | (k, s) = map(int, input().split())
x = list(input())
for i in range(s):
if x[i].isalpha() and x[i].isupper():
print(chr(ord('A') + (ord(x[i]) - ord('A') + k) % 26), end='')
elif x[i].isalpha():
print(chr(ord('a') + (ord(x[i]) - ord('a') + k) % 26), end='')
else:
print(x[i], end='') |
def reverse(string):
string = "".join(reversed(string)) #used reversed function for reversing the String
return string
str = input("Enter A String:")
print ("The Entered String is : ",end="") #end is used here so that output will be in same line.
print (str)
print ("The Reversed String is : ",end... | def reverse(string):
string = ''.join(reversed(string))
return string
str = input('Enter A String:')
print('The Entered String is : ', end='')
print(str)
print('The Reversed String is : ', end='')
print(reverse(str)) |
# Copyright 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Makes sure that injected JavaScript is clang-format clean."""
def CheckChangeOnUpload(input_api, output_api):
"""Special Top level function called by g... | """Makes sure that injected JavaScript is clang-format clean."""
def check_change_on_upload(input_api, output_api):
"""Special Top level function called by git_cl."""
return input_api.canned_checks.CheckPatchFormatted(input_api, output_api, check_js=True) |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
hashMap = {}
for idx in range(len(nums)):
currentNum = nums[idx]
difference = target-currentNum
if difference not in hashMap and currentNum not in hashMap:
hashMap[differe... | class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
hash_map = {}
for idx in range(len(nums)):
current_num = nums[idx]
difference = target - currentNum
if difference not in hashMap and currentNum not in hashMap:
hashMap[d... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'My Farm',
'version' : '1.1',
'category': 'Services',
'installable': True,
'application': True,
'depends': ['project'],
'data': [
'data/res.country.state.csv',
'data/s... | {'name': 'My Farm', 'version': '1.1', 'category': 'Services', 'installable': True, 'application': True, 'depends': ['project'], 'data': ['data/res.country.state.csv', 'data/seq.xml', 'security/ir.model.access.csv', 'views/farm_configuration_farm_locations.xml', 'views/farm_configuration_fleets.xml', 'views/farm_configu... |
i = 2
S = 1
while i <= 100:
S = S + (1 / i)
i += 1
print('{:.2f}'.format(S)) | i = 2
s = 1
while i <= 100:
s = S + 1 / i
i += 1
print('{:.2f}'.format(S)) |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# This is a dummy grpcio==1.35.0 package used for E2E
# testing in Azure Functions Python Worker.
__version__ = '1.35.0'
| __version__ = '1.35.0' |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Pieter Huycke
email: pieter.huycke@ugent.be
GitHub: phuycke
"""
#%%
my_dict = {'a':15 , 'c':35, 'b':20}
[print("Dictionary key: ", key) for key in my_dict.keys()]
print("- - - -")
[print("Dictionary value: ", val) for val in my_dict.values()]
print("-... | """
@author: Pieter Huycke
email: pieter.huycke@ugent.be
GitHub: phuycke
"""
my_dict = {'a': 15, 'c': 35, 'b': 20}
[print('Dictionary key: ', key) for key in my_dict.keys()]
print('- - - -')
[print('Dictionary value: ', val) for val in my_dict.values()]
print('- - - -')
[print('Key: {} --> value: {}'.format(k, v)) f... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , n ) :
count = 0
arr.sort ( )
for i in range ( 0 , n - 1 ) :
if ( arr [ i ] != arr [ i + 1... | def f_gold(arr, n):
count = 0
arr.sort()
for i in range(0, n - 1):
if arr[i] != arr[i + 1] and arr[i] != arr[i + 1] - 1:
count += arr[i + 1] - arr[i] - 1
return count
if __name__ == '__main__':
param = [([4, 4, 5, 7, 7, 9, 13, 15, 18, 19, 25, 27, 27, 29, 32, 36, 48, 51, 53, 53, 5... |
"""since the cPickle module as of py2.4 uses erroneous relative imports, define the various
picklable classes here so we can test PickleType stuff without issue."""
class Foo(object):
def __init__(self, moredata):
self.data = 'im data'
self.stuff = 'im stuff'
self.moredata = moredata
d... | """since the cPickle module as of py2.4 uses erroneous relative imports, define the various
picklable classes here so we can test PickleType stuff without issue."""
class Foo(object):
def __init__(self, moredata):
self.data = 'im data'
self.stuff = 'im stuff'
self.moredata = moredata
... |
board = ["-","-","-","-","-","-","-","-","-"]
gamegoing = True
winner = None
current_player = "X"
def disp_board():
print(board[0]+ "|" + board[1] + "|" + board[2])
print(board[3]+ "|" + board[4] + "|" + board[5])
print(board[6]+ "|" + board[7] + "|" + board[8])
def play_game():
disp_board()
while gamegoing... | board = ['-', '-', '-', '-', '-', '-', '-', '-', '-']
gamegoing = True
winner = None
current_player = 'X'
def disp_board():
print(board[0] + '|' + board[1] + '|' + board[2])
print(board[3] + '|' + board[4] + '|' + board[5])
print(board[6] + '|' + board[7] + '|' + board[8])
def play_game():
disp_board(... |
'''
Created on Feb 9, 2018
@author: gongyo
'''
colors = ["red", 'yellow']
colors.append("black")
def compare(c1="str", c2="str"):
return c1 < c2
compare2 = lambda c1, c2: (c1 < c2);
colors.sort(cmp=compare2, key=None, reverse=False)
| """
Created on Feb 9, 2018
@author: gongyo
"""
colors = ['red', 'yellow']
colors.append('black')
def compare(c1='str', c2='str'):
return c1 < c2
compare2 = lambda c1, c2: c1 < c2
colors.sort(cmp=compare2, key=None, reverse=False) |
"""
Author: Kagaya john
Tutorial 8 : Tuples
"""
"""
The tuple() Constructor
It is also possible to use the tuple() constructor to make a tuple. The len() function returns the length of the tuple."""
#Using the tuple() method to make a tuple:
thistuple = tuple(("apple", "banana", "cherry")) # note the double rou... | """
Author: Kagaya john
Tutorial 8 : Tuples
"""
'\nThe tuple() Constructor\nIt is also possible to use the tuple() constructor to make a tuple. The len() function returns the length of the tuple.'
thistuple = tuple(('apple', 'banana', 'cherry'))
print(thistuple)
thistuple = tuple(('apple', 'banana', 'cherry'))
print... |
def extractCwastranslationsWordpressCom(item):
'''
Parser for 'cwastranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('tsifb', ... | def extract_cwastranslations_wordpress_com(item):
"""
Parser for 'cwastranslations.wordpress.com'
"""
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [('tsifb', 'Transmigrated into a... |
# version scheme: (major, minor, micro, release_level)
#
# major:
# 0 .. not all planned features done
# 1 .. all features available
# 2 .. if significant API change (2, 3, ...)
#
# minor:
# changes with new features or minor API changes
#
# micro:
# changes with bug fixes, maybe also minor API changes
#
# re... | version = (0, 15, 2, 'b0')
__version__ = '0.15.2b0' |
class UVMDefaultServer:
def __init__(self):
self.m_quit_count = 0
self.m_max_quit_count = 0
self.max_quit_overridable = True
self.m_severity_count = {}
self.m_id_count = {}
## uvm_tr_database m_message_db;
## uvm_tr_stream m_streams[string][string]; // ro.na... | class Uvmdefaultserver:
def __init__(self):
self.m_quit_count = 0
self.m_max_quit_count = 0
self.max_quit_overridable = True
self.m_severity_count = {}
self.m_id_count = {} |
#Factorial of number
n = int(input("enter a number "))
f = 1
if (n < 0):
print("number is negative")
elif (n == 0):
print("factorial=",1)
else:
for i in range(1,n+1):
f = f * i
print("factorial =",f) | n = int(input('enter a number '))
f = 1
if n < 0:
print('number is negative')
elif n == 0:
print('factorial=', 1)
else:
for i in range(1, n + 1):
f = f * i
print('factorial =', f) |
# dimensions of our images.
img_width, img_height = 150, 150
train_data_dir = 'data/train'
validation_data_dir = 'data/validation'
nb_train_samples = 5005
nb_validation_samples = 218
epochs = 1
batch_size = 16
| (img_width, img_height) = (150, 150)
train_data_dir = 'data/train'
validation_data_dir = 'data/validation'
nb_train_samples = 5005
nb_validation_samples = 218
epochs = 1
batch_size = 16 |
# -*- coding: utf-8 -*-
# $Id: diff.py $
"""
Diff two test sets.
"""
__copyright__ = \
"""
Copyright (C) 2010-2015 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and/or modify it under the ... | """
Diff two test sets.
"""
__copyright__ = '\nCopyright (C) 2010-2015 Oracle Corporation\n\nThis file is part of VirtualBox Open Source Edition (OSE), as\navailable from http://www.virtualbox.org. This file is free software;\nyou can redistribute it and/or modify it under the terms of the GNU\nGeneral Public License (... |
# -*- coding: utf-8 -
__VERSION__ = (0, 4, 7)
__SERVER_NAME__ = 'lin/{}.{}.{}'.format(*__VERSION__)
| __version__ = (0, 4, 7)
__server_name__ = 'lin/{}.{}.{}'.format(*__VERSION__) |
# coding=utf-8
UBUNTUS = ['utopic', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty', 'artful', 'bionic', 'cosmic', 'eoan', 'focal']
VERSION = "99.0"
NETS = ['default']
POOL = 'default'
IMAGE = None
CPUMODEL = 'host-model'
NUMCPUS = 2
CPUHOTPLUG = False
CPUFLAGS = []
MEMORY = 512
MEMORYHOTPLUG = False
DISKINTERFACE = 'vir... | ubuntus = ['utopic', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty', 'artful', 'bionic', 'cosmic', 'eoan', 'focal']
version = '99.0'
nets = ['default']
pool = 'default'
image = None
cpumodel = 'host-model'
numcpus = 2
cpuhotplug = False
cpuflags = []
memory = 512
memoryhotplug = False
diskinterface = 'virtio'
diskthin =... |
f=open("./matrix.txt","r") #create the dictionary for the score
diz={}
matrix=[]
for line in f:
line=line.rstrip()
line=line.split()
matrix.append(line)
for i in range(len(matrix[0])):
for j in range(1,len(matrix)):
diz[matrix[0][i]+matrix[j][0]]=int(matrix[i+1][j])
mat=diz
seq1="ACACT"
seq2=... | f = open('./matrix.txt', 'r')
diz = {}
matrix = []
for line in f:
line = line.rstrip()
line = line.split()
matrix.append(line)
for i in range(len(matrix[0])):
for j in range(1, len(matrix)):
diz[matrix[0][i] + matrix[j][0]] = int(matrix[i + 1][j])
mat = diz
seq1 = 'ACACT'
seq2 = 'AAT'
def score... |
# Set this to your GitHub auth token
GitHubAuthToken = 'add_here_your_token'
# Set this to the path of the git executable
gitExecutablePath = 'git'
# Set this to true to download also private repos if the token has private repo rights
include_private_repos = False
# Set this to False to skip existing repos
... | git_hub_auth_token = 'add_here_your_token'
git_executable_path = 'git'
include_private_repos = False
update_existing_repos = True
verbose = 1
always_write_to_disk = True
use_database = 'disk'
data_folder_path = 'data'
database_host_and_port = 'mongodb://localhost:27017/'
num_bulk_operations = 1000
download_issues = Tru... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'../../../build/common.gypi',
],
'variables': {
'irt_sources': [
# irt_support_sources
'irt_entry.c',
'irt_inte... | {'includes': ['../../../build/common.gypi'], 'variables': {'irt_sources': ['irt_entry.c', 'irt_interfaces.c', 'irt_malloc.c', 'irt_private_pthread.c', 'irt_private_tls.c', 'irt_query_list.c', 'irt_basic.c', 'irt_code_data_alloc.c', 'irt_fdio.c', 'irt_filename.c', 'irt_memory.c', 'irt_dyncode.c', 'irt_thread.c', 'irt_fu... |
'''
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example:
Given num = 16, return true. Given num = 5, return false.
Follow up: Could you solve it without loops/recursion?
Credits:
Special thanks to @yukuairoy for adding this problem and creating all test cases.
'''
class... | """
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example:
Given num = 16, return true. Given num = 5, return false.
Follow up: Could you solve it without loops/recursion?
Credits:
Special thanks to @yukuairoy for adding this problem and creating all test cases.
"""
class... |
# b1 - bought stock once
# s1 - bought stock and then sold once
# b2 - bought stock the second time
# s2 - bought and sold twice
class Solution:
def maxProfit(self, prices: List[int]) -> int:
b1 = s1 = b2 = s2 = float('-inf')
for p in prices:
b1, s1, b2, s2 = max(b1, - p), max(s1, b1 +... | class Solution:
def max_profit(self, prices: List[int]) -> int:
b1 = s1 = b2 = s2 = float('-inf')
for p in prices:
(b1, s1, b2, s2) = (max(b1, -p), max(s1, b1 + p), max(b2, s1 - p), max(s2, b2 + p))
return max(0, s1, s2) |
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "org_apache_kafka_kafka_2_12",
artifact = "org.apache.kafka:kafka_2.12:1.1.1",
artifact_sha256 = "d7b77e3b150519724d542dfb5da1584b9cba08fb1272ff1e3b3d735937e22632",
... | load('//:import_external.bzl', import_external='safe_wix_scala_maven_import_external')
def dependencies():
import_external(name='org_apache_kafka_kafka_2_12', artifact='org.apache.kafka:kafka_2.12:1.1.1', artifact_sha256='d7b77e3b150519724d542dfb5da1584b9cba08fb1272ff1e3b3d735937e22632', srcjar_sha256='2a1a9ed91ad... |
input = """AlphaCentauri to Snowdin = 66
AlphaCentauri to Tambi = 28
AlphaCentauri to Faerun = 60
AlphaCentauri to Norrath = 34
AlphaCentauri to Straylight = 34
AlphaCentauri to Tristram = 3
AlphaCentauri to Arbre = 108
Snowdin to Tambi = 22
Snowdin to Faerun = 12
Snowdin to Norrath = 91
Snowdin to Straylight = 121
Sno... | input = 'AlphaCentauri to Snowdin = 66\nAlphaCentauri to Tambi = 28\nAlphaCentauri to Faerun = 60\nAlphaCentauri to Norrath = 34\nAlphaCentauri to Straylight = 34\nAlphaCentauri to Tristram = 3\nAlphaCentauri to Arbre = 108\nSnowdin to Tambi = 22\nSnowdin to Faerun = 12\nSnowdin to Norrath = 91\nSnowdin to Straylight =... |
(_, d) = tuple(map(int, input().strip().split(' ')))
arr = list(map(int, input().strip().split(' ')))
new_arr = arr[d:] + arr[:d]
print(' '.join(map(str, new_arr)))
| (_, d) = tuple(map(int, input().strip().split(' ')))
arr = list(map(int, input().strip().split(' ')))
new_arr = arr[d:] + arr[:d]
print(' '.join(map(str, new_arr))) |
class DebugConfig:
# base
SECRET_KEY = b'IL_PROGRAMMATORE_RESPONSABILE_MI_CAMBIERA! OVVIO AMO!'
SERVER_NAME = 'localhost:5000'
# database
MYSQL_DATABASE_HOST = 'localhost'
MYSQL_DATABASE_PORT = 3306
MYSQL_DATABASE_USER = 'root'
MYSQL_DATABASE_PASSWORD = ''
MYSQL_DATABASE_DB = 'inge... | class Debugconfig:
secret_key = b'IL_PROGRAMMATORE_RESPONSABILE_MI_CAMBIERA! OVVIO AMO!'
server_name = 'localhost:5000'
mysql_database_host = 'localhost'
mysql_database_port = 3306
mysql_database_user = 'root'
mysql_database_password = ''
mysql_database_db = 'ingegneria'
bcrypt_handle_lo... |
# Exercise 1: Squaring Numbers
numbers = [1,1,2,3,5,8,13,21,34,55]
squared_numbers = [number**2 for number in numbers]
print(squared_numbers) | numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
squared_numbers = [number ** 2 for number in numbers]
print(squared_numbers) |
LIST_ALGORITHMS_TOPIC = 'list_algorithms'
SET_ALGORITHM_TOPIC = 'set_algorithm'
GET_SAMPLE_LIST_TOPIC = 'get_sample_list'
TAKE_SAMPLE_TOPIC = 'take_sample'
REMOVE_SAMPLE_TOPIC = 'remove_sample'
COMPUTE_CALIBRATION_TOPIC = 'compute_calibration'
SAVE_CALIBRATION_TOPIC = 'save_calibration'
CHECK_STARTING_POSE_TOPIC = 'c... | list_algorithms_topic = 'list_algorithms'
set_algorithm_topic = 'set_algorithm'
get_sample_list_topic = 'get_sample_list'
take_sample_topic = 'take_sample'
remove_sample_topic = 'remove_sample'
compute_calibration_topic = 'compute_calibration'
save_calibration_topic = 'save_calibration'
check_starting_pose_topic = 'che... |
# Time: O(n)
# Space: O(n)
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def nextLargerNodes(self, head):
"""
:type head: ListNode
:rtype: List[int]
"""
... | class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def next_larger_nodes(self, head):
"""
:type head: ListNode
:rtype: List[int]
"""
(result, stk) = ([], [])
while head:
while stk and... |
"""
Here: https://leetcode.com/problems/3sum/
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution set must not contain duplicate triplets.
"""
def threeSum(nums):
result = set()
... | """
Here: https://leetcode.com/problems/3sum/
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution set must not contain duplicate triplets.
"""
def three_sum(nums):
result = set()
... |
items = [{'id': 1, 'name': 'laptop', 'value': 1000},
{'id': 2, 'name': 'chair', 'value': 300},
{'id': 3, 'name': 'book', 'value': 20}]
def duplicate_items(items):
return [{key: value for key, value in x.items()} for x in items]
| items = [{'id': 1, 'name': 'laptop', 'value': 1000}, {'id': 2, 'name': 'chair', 'value': 300}, {'id': 3, 'name': 'book', 'value': 20}]
def duplicate_items(items):
return [{key: value for (key, value) in x.items()} for x in items] |
DEPS = [
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/step',
]
# TODO(phajdan.jr): provide coverage (http://crbug.com/693058).
DISABLE_STRICT_COVERAGE = True
| deps = ['recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/python', 'recipe_engine/step']
disable_strict_coverage = True |
{
'name': 'eCommerce',
'category': 'Website/Website',
'sequence': 55,
'summary': 'Sell your products online',
'website': 'https://www.odoo.com/page/e-commerce',
'version': '1.0',
'description': "",
'depends': ['website', 'sale', 'website_payment', 'website_mail', 'website_form', 'website... | {'name': 'eCommerce', 'category': 'Website/Website', 'sequence': 55, 'summary': 'Sell your products online', 'website': 'https://www.odoo.com/page/e-commerce', 'version': '1.0', 'description': '', 'depends': ['website', 'sale', 'website_payment', 'website_mail', 'website_form', 'website_rating', 'digest'], 'data': ['se... |
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-03-09 22:56:44
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-03-09 22:56:54
class Solution(object):
def minPatches(self, nums, n):
"""
:type nums: List[int]
:type n: int
:rtype: int
"""
... | class Solution(object):
def min_patches(self, nums, n):
"""
:type nums: List[int]
:type n: int
:rtype: int
"""
(index, right, ans) = (0, 1, 0)
size = len(nums)
sorted_nums = sorted(nums)
while right <= n:
if index < size and sorted... |
class Bola:
def __init__(self, cor, circunferencia, material):
self.cor = cor
self.circunferencia = circunferencia
self.material = material
def troca_cor(self, n_cor):
self.cor = n_cor
def mostrar_cor(self):
return self.cor
bola = Bola('preta', 25,'couro')
print(b... | class Bola:
def __init__(self, cor, circunferencia, material):
self.cor = cor
self.circunferencia = circunferencia
self.material = material
def troca_cor(self, n_cor):
self.cor = n_cor
def mostrar_cor(self):
return self.cor
bola = bola('preta', 25, 'couro')
print(b... |
soma = 0
for i in range(100):
num = i + 1
print(num)
soma += num ** 2
print(soma)
| soma = 0
for i in range(100):
num = i + 1
print(num)
soma += num ** 2
print(soma) |
# Created by MechAviv
# Dice Master Damage Skin | (2437274)
if sm.addDamageSkin(2437274):
sm.chat("'Dice Master Damage Skin' Damage Skin has been added to your account's damage skin collection.")
sm.consumeItem() | if sm.addDamageSkin(2437274):
sm.chat("'Dice Master Damage Skin' Damage Skin has been added to your account's damage skin collection.")
sm.consumeItem() |
BUF_SIZE = 1024
ENABLE_DEBUG = True
IP_ADDR = '127.0.0.1'
REQ_NET_NAME = '/api/netname/'
REQ_IXP_NETS = '/api/ixnets/'
REQ_IXPS = '/api/ix/'
def printDebug(dbgMsg):
'''
Funcao auxiliar para depuracao.
'''
if ENABLE_DEBUG:
print('[dbg]', dbgMsg)
| buf_size = 1024
enable_debug = True
ip_addr = '127.0.0.1'
req_net_name = '/api/netname/'
req_ixp_nets = '/api/ixnets/'
req_ixps = '/api/ix/'
def print_debug(dbgMsg):
"""
Funcao auxiliar para depuracao.
"""
if ENABLE_DEBUG:
print('[dbg]', dbgMsg) |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( s , c ) :
oneSeen = False
i = 0
n = len ( s )
while ( i < n ) :
if ( s [ i ] == c ) :
... | def f_gold(s, c):
one_seen = False
i = 0
n = len(s)
while i < n:
if s[i] == c:
if oneSeen == True:
return False
while i < n and s[i] == c:
i = i + 1
one_seen = True
else:
i = i + 1
return True
if __name__... |
"""
The rust_toolchain rule definition and implementation.
"""
def _rust_toolchain_impl(ctx):
compilation_mode_opts = {}
for k, v in ctx.attr.opt_level.items():
if not k in ctx.attr.debug_info:
fail("Compilation mode {} is not defined in debug_info but is defined opt_level".format(k))
... | """
The rust_toolchain rule definition and implementation.
"""
def _rust_toolchain_impl(ctx):
compilation_mode_opts = {}
for (k, v) in ctx.attr.opt_level.items():
if not k in ctx.attr.debug_info:
fail('Compilation mode {} is not defined in debug_info but is defined opt_level'.format(k))
... |
#!/usr/bin/env python3
"""Infoset setup.
Manages parameters required by all classes in the module.
"""
# Main python libraries
def main():
"""Process data.
Args:
None
Returns:
None
"""
# Check the environment
pass
if __name__ == 'infoset':
main()
| """Infoset setup.
Manages parameters required by all classes in the module.
"""
def main():
"""Process data.
Args:
None
Returns:
None
"""
pass
if __name__ == 'infoset':
main() |
del_items(0x80082E48)
SetType(0x80082E48, "int GetTpY__FUs(unsigned short tpage)")
del_items(0x80082E64)
SetType(0x80082E64, "int GetTpX__FUs(unsigned short tpage)")
del_items(0x80082E70)
SetType(0x80082E70, "void Remove96__Fv()")
del_items(0x80082EA8)
SetType(0x80082EA8, "void AppMain()")
del_items(0x80082F6C)
SetType... | del_items(2148019784)
set_type(2148019784, 'int GetTpY__FUs(unsigned short tpage)')
del_items(2148019812)
set_type(2148019812, 'int GetTpX__FUs(unsigned short tpage)')
del_items(2148019824)
set_type(2148019824, 'void Remove96__Fv()')
del_items(2148019880)
set_type(2148019880, 'void AppMain()')
del_items(2148020076)
set... |
#!/usr/bin/python3.8
#LEBG- Local, Enclosing, Global, Built-in
x = "Global x"
def outer():
# global x
x = "Local x"
def inner():
nonlocal x #cant use global variables as nonlocal in nested function
x = "Nonlocal x"
print(x)
print(x)
inner()
print(x)
print(x)
outer(... | x = 'Global x'
def outer():
x = 'Local x'
def inner():
nonlocal x
x = 'Nonlocal x'
print(x)
print(x)
inner()
print(x)
print(x)
outer()
print(x) |
# Day 2: http://adventofcode.com/2016/day/2
# Problem:
# Given the following directions (on lines), start at the number 5 on a normal
# 9-key pad and move, when possible, one space in the desired direction until
# the line ends. That is the number for that line. For the next line, start
# at the previous line's endpoin... | directions = 'RDLULDLDDRLLLRLRULDRLDDRRRRURLRLDLULDLDLDRULDDLLDRDRUDLLDDRDULLLULLDULRRLDURULDRUULLLUUDURURRDDLDLDRRDDLRURLLDRRRDULDRULURURURURLLRRLUDULDRULLDURRRLLDURDRRUUURDRLLDRURULRUDULRRRRRDLRLLDRRRDLDUUDDDUDLDRUURRLLUDUDDRRLRRDRUUDUUULDUUDLRDLDLLDLLLLRRURDLDUURRLLDLDLLRLLRULDDRLDLUDLDDLRDRRDLULRLLLRUDDURLDLLULRDUU... |
'''
Problem statement: We need to find the area difference between the squares where for one square circle is a circumcircle and the other one is incircle
Problem Link: https://edabit.com/challenge/NNhkGocuPMcryW7GP
'''
def square_areas_difference(r):
return 2*r*r
| """
Problem statement: We need to find the area difference between the squares where for one square circle is a circumcircle and the other one is incircle
Problem Link: https://edabit.com/challenge/NNhkGocuPMcryW7GP
"""
def square_areas_difference(r):
return 2 * r * r |
load(
"//kotlin/internal:defs.bzl",
_TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE",
)
def _restore_label(l):
"""Restore a label struct to a canonical label string."""
lbl = l.workspace_root
if lbl.startswith("external/"):
lbl = lbl.replace("external/", "@")
return lbl + "//" + l.package + ":" + l.n... | load('//kotlin/internal:defs.bzl', _TOOLCHAIN_TYPE='TOOLCHAIN_TYPE')
def _restore_label(l):
"""Restore a label struct to a canonical label string."""
lbl = l.workspace_root
if lbl.startswith('external/'):
lbl = lbl.replace('external/', '@')
return lbl + '//' + l.package + ':' + l.name
def _der... |
class LockboxError(Exception):
pass
class LockboxDefinitionError(LockboxError):
'''Base exception for problems related to the actual definition of a
new lockbox record.
'''
pass
class LockboxParseError(LockboxError):
'''Base exception for problems related to reading a BAI Lockbox
record.... | class Lockboxerror(Exception):
pass
class Lockboxdefinitionerror(LockboxError):
"""Base exception for problems related to the actual definition of a
new lockbox record.
"""
pass
class Lockboxparseerror(LockboxError):
"""Base exception for problems related to reading a BAI Lockbox
record.
... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
""" Describes Production cellular model. """
__author__ = 'Ari Saha (arisaha@icloud.com)'
__date__ = 'Tuesday, March 6th 2018, 10:08:50 am'
| """ Describes Production cellular model. """
__author__ = 'Ari Saha (arisaha@icloud.com)'
__date__ = 'Tuesday, March 6th 2018, 10:08:50 am' |
########################## DIRECTORIES ##########################
save_folder = "saved_data"
export_folder = "export_data" | save_folder = 'saved_data'
export_folder = 'export_data' |
def reverse_and_mirror(s1, s2):
swap = s1.swapcase()
return '{}@@@{}{}'.format(s2[::-1].swapcase(), swap[::-1], swap)
# PEP8: function name should use snake_case
reverseAndMirror = reverse_and_mirror
| def reverse_and_mirror(s1, s2):
swap = s1.swapcase()
return '{}@@@{}{}'.format(s2[::-1].swapcase(), swap[::-1], swap)
reverse_and_mirror = reverse_and_mirror |
'''
Brightness
==========
This API helps you to control the brightness of your primary display screen.
The :class:`Brightness` provides access to public methods to control the
brightness of screen.
NOTE:: For Android, make sure to add permission, WRITE_SETTINGS
Simple Examples
---------------
To know the current br... | """
Brightness
==========
This API helps you to control the brightness of your primary display screen.
The :class:`Brightness` provides access to public methods to control the
brightness of screen.
NOTE:: For Android, make sure to add permission, WRITE_SETTINGS
Simple Examples
---------------
To know the current br... |
"""
bbofuser
FILE: __init__.py
Created: 8/4/15 11:35 PM
"""
__author__ = 'Mark Scrimshire:@ekivemark'
| """
bbofuser
FILE: __init__.py
Created: 8/4/15 11:35 PM
"""
__author__ = 'Mark Scrimshire:@ekivemark' |
__all__ = ['baidusearch',
'bingsearch',
'bufferoverun',
'crtsh',
'certspottersearch',
'dnssearch',
'dogpilesearch',
'duckduckgosearch',
'exaleadsearch',
'githubcode',
'googlesearch',
'huntersearch',
... | __all__ = ['baidusearch', 'bingsearch', 'bufferoverun', 'crtsh', 'certspottersearch', 'dnssearch', 'dogpilesearch', 'duckduckgosearch', 'exaleadsearch', 'githubcode', 'googlesearch', 'huntersearch', 'intelxsearch', 'linkedinsearch', 'netcraft', 'otxsearch', 'securitytrailssearch', 'shodansearch', 'spyse', 'takeover', '... |
def min_fine(N: int, times: list[int], fines: list[int]):
weights: list[tuple[float, int]] = []
for i in range(N):
weight = fines[i]/times[i]
weights.append((weight, i))
weights = sorted(weights, reverse=True)
time = 0
delay = 0
fine = 0
for weight in weights:
time... | def min_fine(N: int, times: list[int], fines: list[int]):
weights: list[tuple[float, int]] = []
for i in range(N):
weight = fines[i] / times[i]
weights.append((weight, i))
weights = sorted(weights, reverse=True)
time = 0
delay = 0
fine = 0
for weight in weights:
time ... |
# @author Huaze Shen
# @date 2019-11-06
def is_interleave(s1, s2, s3):
if len(s1) + len(s2) != len(s3):
return False
n1 = len(s1)
n2 = len(s2)
dp = [[False for i in range(n2 + 1)] for j in range(n1 + 1)]
dp[0][0] = True
for i in range(1, n1 + 1):
if dp[i - 1][0] and s1[i - 1] =... | def is_interleave(s1, s2, s3):
if len(s1) + len(s2) != len(s3):
return False
n1 = len(s1)
n2 = len(s2)
dp = [[False for i in range(n2 + 1)] for j in range(n1 + 1)]
dp[0][0] = True
for i in range(1, n1 + 1):
if dp[i - 1][0] and s1[i - 1] == s3[i - 1]:
dp[i][0] = True
... |
# SPDX-License-Identifier: Apache-2.0
"""
An example console application that uses the subarulink package.
For more details about this api, please refer to the documentation at
https://github.com/G-Two/subarulink
"""
| """
An example console application that uses the subarulink package.
For more details about this api, please refer to the documentation at
https://github.com/G-Two/subarulink
""" |
#
# PySNMP MIB module CADANT-CMTS-DNSCLIENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CADANT-CMTS-DNSCLIENT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:27:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint, constraints_union) ... |
def can_build(env, platform):
return env["tools"]
def configure(env):
pass
| def can_build(env, platform):
return env['tools']
def configure(env):
pass |
# -*- coding: utf-8 -*-
LOGGING = {
'version': 1,
#'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(asctime)s [%(process)d][%(levelname)s] %(module)s,%(funcName)s,%(lineno)s:%(message)s'
}, #, %(thread)d, %(name)s,
... | logging = {'version': 1, 'formatters': {'verbose': {'format': '%(asctime)s [%(process)d][%(levelname)s] %(module)s,%(funcName)s,%(lineno)s:%(message)s'}, 'performance': {'format': '%(asctime)s [%(process)d] [%(levelname)s] %(message)s'}, 'simple': {'format': '%(levelname)s %(message)s'}}, 'handlers': {'console': {'leve... |
# clp/cp/__init__.py
""" Tools for computer language processing. """
__version__ = '0.1.14'
__version_date__ = '2018-03-21'
__all__ = ['CLPError',
'serialize_str_list']
class CLPError(RuntimeError):
""" Errors encountered in processing computer language. """
pass
def serialize_str_list(name, in... | """ Tools for computer language processing. """
__version__ = '0.1.14'
__version_date__ = '2018-03-21'
__all__ = ['CLPError', 'serialize_str_list']
class Clperror(RuntimeError):
""" Errors encountered in processing computer language. """
pass
def serialize_str_list(name, indent, elements, line_len=78):
""... |
"""
Import as 'oscccan'
"""
__all__ = [
'canbus',
]
class OsccModule(object):
"""
Wrapper to CAN data specific to an OSCC module. Used with CanBus class to
communicate on the OSCC CAN bus.
"""
def __init__(self, base_arbitration_id, module_name=None):
"""
Initialize CAN data ... | """
Import as 'oscccan'
"""
__all__ = ['canbus']
class Osccmodule(object):
"""
Wrapper to CAN data specific to an OSCC module. Used with CanBus class to
communicate on the OSCC CAN bus.
"""
def __init__(self, base_arbitration_id, module_name=None):
"""
Initialize CAN data specific ... |
N = int(input())
ARRAY = []
while N != 0:
A = input().split()
if len(A) == 3:
B = int(A[1])
C = int(A[2])
elif len(A) == 2:
B = int(A[1])
if A[0] == "insert":
ARRAY.insert(B, C)
elif A[0] == "print":
print(ARRAY)
elif A[0] == "remove":
ARRAY.re... | n = int(input())
array = []
while N != 0:
a = input().split()
if len(A) == 3:
b = int(A[1])
c = int(A[2])
elif len(A) == 2:
b = int(A[1])
if A[0] == 'insert':
ARRAY.insert(B, C)
elif A[0] == 'print':
print(ARRAY)
elif A[0] == 'remove':
ARRAY.remove... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def splitListToParts(self, head: Optional[ListNode], k: int) -> List[Optional[ListNode]]:
output = []
node, length = head, 0... | class Solution:
def split_list_to_parts(self, head: Optional[ListNode], k: int) -> List[Optional[ListNode]]:
output = []
(node, length) = (head, 0)
while node:
length = length + 1
node = node.next
(parts, remaining) = (length // k, length % k)
(prev, ... |
SERVER = "__SERVER__"
HELLO_INTERVAL = __HELLO_INTERVAL__
IDLE_TIME = __IDLE_TIME__
MAX_FAILED_CONNECTIONS = __MAX_FAILED_CONNECTIONS__
PERSIST = __PERSIST__
HELP = """
<any shell command>
Executes the command in a shell and return its output.
upload <local_file>
Uploads <local_file> to server.
download <url> <destin... | server = '__SERVER__'
hello_interval = __HELLO_INTERVAL__
idle_time = __IDLE_TIME__
max_failed_connections = __MAX_FAILED_CONNECTIONS__
persist = __PERSIST__
help = '\n<any shell command>\nExecutes the command in a shell and return its output.\n\nupload <local_file>\nUploads <local_file> to server.\n\ndownload <url> <d... |
def test():
__msg__.good(
"Nice work! Check the solution."
)
| def test():
__msg__.good('Nice work! Check the solution.') |
#!/usr/bin/env python
for _ in range(5):
print("Hello, World!")
| for _ in range(5):
print('Hello, World!') |
def palindrome(text):
list_letters = list(text)
list_letters = list_letters[::-1]
new_text = ''.join(list_letters)
return new_text == text | def palindrome(text):
list_letters = list(text)
list_letters = list_letters[::-1]
new_text = ''.join(list_letters)
return new_text == text |
##Collect data:
#SMI: 2021/10/29
# create proposal: proposal_id('2021_3', '30000_YZhang_XZ') #create the proposal id and folder
# create proposal: proposal_id('2021_3', '30000_YZhang_Nov') #create the proposal id and folder
# create proposal: proposal_id('2021_3', '307961_Dinca') #create the proposal id ... | sample_dict = {1: 'XZ_S1_1_Chitosan_Cu_Fiber_Wet', 2: 'XZ_S2_2_NaCellulose', 3: 'XZ_S2_7_Crab_Chitasan', 4: 'XZ_S2_9_CuNa_CellusloseNaOH', 5: 'XZ_S2_9_CuNa_Celluslose'}
pxy_dict = {1: (-32800, -1000), 2: (-27300, -700), 3: (-16000, -1000), 4: (-2600, -1000), 5: (20400, -6000)}
sample_dict = {1: 'XZ_S2_1_Wood', 2: 'XZ_S... |
"""
Defined Washington State Leaf Data Systems dataset fields.
Cannabis Data Science Meetup Group
Copyright (c) 2022 Cannlytics
Authors: Keegan Skeate <keegan@cannlytics.com>
Created: 1/18/2022
Updated: 1/19/2022
License: MIT License <https://opensource.org/licenses/MIT>
"""
#-----------------------------------------... | """
Defined Washington State Leaf Data Systems dataset fields.
Cannabis Data Science Meetup Group
Copyright (c) 2022 Cannlytics
Authors: Keegan Skeate <keegan@cannlytics.com>
Created: 1/18/2022
Updated: 1/19/2022
License: MIT License <https://opensource.org/licenses/MIT>
"""
lab_result_fields = {'global_id': 'string',... |
# coding=utf-8
# Marcelo Ambrosio de Goes
# marcelogoes@gmail.com
# 2022-03-25
# 100 Days of Code: The Complete Python Pro Bootcamp for 2022
# Day 39 - Flight Deal Finder
class FlightData:
def __init__(self, price, origin_city, origin_airport, destination_city, destination_airport, out_date, return_date):
... | class Flightdata:
def __init__(self, price, origin_city, origin_airport, destination_city, destination_airport, out_date, return_date):
self.price = price
self.origin_city = origin_city
self.origin_airport = origin_airport
self.destination_city = destination_city
self.destin... |
def publish_release(source, config, target):
"""
Publish a new release as a Docker image
This is a mock implementation used for unit tests
"""
return None
| def publish_release(source, config, target):
"""
Publish a new release as a Docker image
This is a mock implementation used for unit tests
"""
return None |
def check_prime(number):
# remove pass and write your logic here. if the number is prime return true, else return false
if(number > 1):
for each in range(2, number):
if(number % each) == 0:
return False
return True
return False
def rotations(num):
# remove p... | def check_prime(number):
if number > 1:
for each in range(2, number):
if number % each == 0:
return False
return True
return False
def rotations(num):
list_permutation = []
x = len(str(num))
pow_ten = pow(10, x - 1)
for _ in range(x - 1):
firs... |
class TestResult:
def __init__(self):
self.runCount = 0
self.errorCount = 0
def testStarted(self):
self.runCount = self.runCount + 1
def testFailed(self):
self.errorCount = self.errorCount + 1
def summary(self):
return '%d run, %d failed' % (self.runCount, sel... | class Testresult:
def __init__(self):
self.runCount = 0
self.errorCount = 0
def test_started(self):
self.runCount = self.runCount + 1
def test_failed(self):
self.errorCount = self.errorCount + 1
def summary(self):
return '%d run, %d failed' % (self.runCount, s... |
class Solution(object):
def __init__(self):
self.ans = ""
def DFS(self, node, visited, k):
for num in map(str, range(k)):
nodeCur = node + num
if nodeCur not in visited:
visited.add(nodeCur)
self.DFS(nodeCur[1:], visited, k)
... | class Solution(object):
def __init__(self):
self.ans = ''
def dfs(self, node, visited, k):
for num in map(str, range(k)):
node_cur = node + num
if nodeCur not in visited:
visited.add(nodeCur)
self.DFS(nodeCur[1:], visited, k)
... |
def isPalindrome(s):
return s == s[::-1]
def test_answer():
assert isPalindrome("software engineering gnireenigne erawtfos") == True
assert isPalindrome("HomeWork 2 Github Homework") == False
assert isPalindrome("reviver") == True
assert isPalindrome("Group12orG") == False
assert isPalindrome("wasitacatisaw"... | def is_palindrome(s):
return s == s[::-1]
def test_answer():
assert is_palindrome('software engineering gnireenigne erawtfos') == True
assert is_palindrome('HomeWork 2 Github Homework') == False
assert is_palindrome('reviver') == True
assert is_palindrome('Group12orG') == False
assert is_palind... |
class Serializable:
@classmethod
def from_json(cls, obj):
return cls(**obj)
def __str__(self):
s = F'{type(self).__name__} @ {id(self)}\n'
for k, v in self.__dict__.items():
s += F'{k} -> {v}\n'
return s
def print_tree(obj, indent=2):
if type(obj) in (b... | class Serializable:
@classmethod
def from_json(cls, obj):
return cls(**obj)
def __str__(self):
s = f'{type(self).__name__} @ {id(self)}\n'
for (k, v) in self.__dict__.items():
s += f'{k} -> {v}\n'
return s
def print_tree(obj, indent=2):
if type(obj) in (boo... |
getting_started = {
'title': 'Getting Started',
'questions': [
{
'q': 'How does HDX define humanitarian data?',
'a': 'We define humanitarian data as: '
'<ol>'
'<li> data about the context in which a humanitarian crisis is occurring (e.g., baselin... | getting_started = {'title': 'Getting Started', 'questions': [{'q': 'How does HDX define humanitarian data?', 'a': 'We define humanitarian data as: <ol><li> data about the context in which a humanitarian crisis is occurring (e.g., baseline/development data, damage assessments, geospatial data)</li><li> data about the pe... |
# Space: O(n)
# Time: O(n)
class Solution:
def sequentialDigits(self, low, high):
sequence = '123456789'
res = []
start_length = len(str(low))
end_length = len(str(high))
for length in range(start_length, end_length + 1):
for i in range(len(sequence)):
... | class Solution:
def sequential_digits(self, low, high):
sequence = '123456789'
res = []
start_length = len(str(low))
end_length = len(str(high))
for length in range(start_length, end_length + 1):
for i in range(len(sequence)):
end_index = i + leng... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.