content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def isValid(self, s: str) -> bool:
stack = []
parentheses_dict = {
'(': ')',
'[': ']',
'{': '}'
}
for char in s:
if parentheses_dict.get(char) is not None:
stack.append(char)
else:
... | class Solution:
def is_valid(self, s: str) -> bool:
stack = []
parentheses_dict = {'(': ')', '[': ']', '{': '}'}
for char in s:
if parentheses_dict.get(char) is not None:
stack.append(char)
elif stack:
peek = stack[-1]
... |
class NicerPyMailException(Exception):
pass
class ClientException(NicerPyMailException):
pass
class EmailException(NicerPyMailException):
pass
class AuthenticationException(ClientException):
def __str__(self):
return "Authentication failed, check that your username and password are correct... | class Nicerpymailexception(Exception):
pass
class Clientexception(NicerPyMailException):
pass
class Emailexception(NicerPyMailException):
pass
class Authenticationexception(ClientException):
def __str__(self):
return 'Authentication failed, check that your username and password are correct, ... |
unicode_data_to_mirrored_start = {
0: 0,
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
6: 0,
7: 0,
8: 0,
9: 0,
10: 0,
11: 0,
12: 0,
13: 0,
14: 0,
15: 0,
16: 0,
17: 0,
18: 0,
19: 0,
20: 0,
21: 0,
22: 0,
23: 0,
24: 0,
25: 0,
26: 0... | unicode_data_to_mirrored_start = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0, 17: 0, 18: 0, 19: 0, 20: 0, 21: 0, 22: 0, 23: 0, 24: 0, 25: 0, 26: 0, 27: 0, 28: 0, 29: 0, 30: 0, 31: 0, 32: 0, 33: 0, 34: 0, 35: 0, 36: 0, 37: 0, 38: 0, 39: 0, 40: 1, 41: 1, 42... |
"""
Error handling.
"""
class ProgramError(Exception):
"""Base exception class for errors within the run package.
"""
pass
| """
Error handling.
"""
class Programerror(Exception):
"""Base exception class for errors within the run package.
"""
pass |
def get_product_list_headers():
return [
{
"key": "number",
"label": "Number",
"link": "",
},
{
"key" : "photo",
"label" : "Photo",
"link" : "",
},
{
"key": "name",
"label": "Produ... | def get_product_list_headers():
return [{'key': 'number', 'label': 'Number', 'link': ''}, {'key': 'photo', 'label': 'Photo', 'link': ''}, {'key': 'name', 'label': 'Product Name', 'link': ['get_edit_link']}, {'key': 'unit_price', 'label': 'Price (B$)', 'link': ''}, {'key': 'discount_price', 'label': 'Discount Price ... |
class Config:
# ==================================================================
# SERVER configuration
# ==================================================================
SERVER = ""
PORT = 4000, 10
ENCODING = "utf-8"
MSG_LENGTH = 1024
| class Config:
server = ''
port = (4000, 10)
encoding = 'utf-8'
msg_length = 1024 |
dia=input('Dia:')
mes=input('Mes:')
ano=input('Ano:')
print('vc nasceu em',dia,'de',mes,'de',ano)
| dia = input('Dia:')
mes = input('Mes:')
ano = input('Ano:')
print('vc nasceu em', dia, 'de', mes, 'de', ano) |
num_square = []
for value in range(1,11):
square = value ** 2
num_square.append(square)
print(num_square)
print(min(num_square))
print(max(num_square))
print(sum(num_square)) | num_square = []
for value in range(1, 11):
square = value ** 2
num_square.append(square)
print(num_square)
print(min(num_square))
print(max(num_square))
print(sum(num_square)) |
data_points = []
with mp_hands.Hands(static_image_mode=True, max_num_hands=2, min_detection_confidence=0.5) as hands:
for fld_name in sub_folders:
input_dir = Path.cwd()/f"dataset/{fld_name}"
IMAGE_FILES = list(input_dir.rglob("*.jpg"))
for idx, file in enumerate(IMAGE_FILES):
file ... | data_points = []
with mp_hands.Hands(static_image_mode=True, max_num_hands=2, min_detection_confidence=0.5) as hands:
for fld_name in sub_folders:
input_dir = Path.cwd() / f'dataset/{fld_name}'
image_files = list(input_dir.rglob('*.jpg'))
for (idx, file) in enumerate(IMAGE_FILES):
... |
# test seqs
SEQ_NAMES = ['MOT17-01', 'MOT17-03', 'MOT17-06', 'MOT17-07',
'MOT17-08', 'MOT17-12', 'MOT17-14']
# Please set your own path here
DATASET_DIR = 'YOUR_PATH/MOT17/test'
# # train seqs
# SEQ_NAMES = ['MOT17-02', 'MOT17-04', 'MOT17-05', 'MOT17-09',
# 'MOT17-10', 'MOT17-11', 'MOT17-13... | seq_names = ['MOT17-01', 'MOT17-03', 'MOT17-06', 'MOT17-07', 'MOT17-08', 'MOT17-12', 'MOT17-14']
dataset_dir = 'YOUR_PATH/MOT17/test'
is_naive_gating_on = True
is_tracktor = True
is_vis = False
image_height = 128
image_width = 64
overlap = 0.5
track_length = 5
det_score_avg = [-100, -100, -100, -100, -100, -100, -100]
... |
"""Used to determine which optional packages belong to which 'pack' per release."""
# pylint: disable=too-many-locals
class OptionPack(object):
"""Attributes for the 'collection packs' of packages in an Application."""
def __init__(self, source, release):
self._source = source
self._release = ... | """Used to determine which optional packages belong to which 'pack' per release."""
class Optionpack(object):
"""Attributes for the 'collection packs' of packages in an Application."""
def __init__(self, source, release):
self._source = source
self._release = release.replace('.plist', '')
... |
"""
@generated
cargo-raze generated Bazel file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") # buildifier: disable=load
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # buildifier: disable=load
load("@bazel_tools//too... | """
@generated
cargo-raze generated Bazel file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""
load('@bazel_tools//tools/build_defs/repo:git.bzl', 'new_git_repository')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
def raze_fetch_r... |
"""Infrastructure module
=============================
Infrastructure details for the implementation of tables.
"""
| """Infrastructure module
=============================
Infrastructure details for the implementation of tables.
""" |
"""
Leia uma matriz 4x4, conte e escreva quantos valores maiores que 10 ela possui
print(len(matriz[0]))
print(len(matriz[1]))
print(len(matriz[2]))
print(len(matriz[2]))
"""
matriz = [[1, 2, 3, 4], [5, 6, 7, 9], [10, 11, 12, 13], [14, 15, 16, 17]]
#print(matriz)
maiores = [[x for x in lista if x > 10] for lista in ... | """
Leia uma matriz 4x4, conte e escreva quantos valores maiores que 10 ela possui
print(len(matriz[0]))
print(len(matriz[1]))
print(len(matriz[2]))
print(len(matriz[2]))
"""
matriz = [[1, 2, 3, 4], [5, 6, 7, 9], [10, 11, 12, 13], [14, 15, 16, 17]]
maiores = [[x for x in lista if x > 10] for lista in matriz]
print(len... |
#!/usr/bin/env python3.7
class Responses:
"""
Agent Responses
"""
ANGRY = ["Stay back!!!", "I will kill the hostage, I swear!", "Back off, now!!", "Do you think this is a game???"]
IRRITATED = ["Where are my demands?!", "What?!", "How about you start making sense?", "I am losing my patience!"]
... | class Responses:
"""
Agent Responses
"""
angry = ['Stay back!!!', 'I will kill the hostage, I swear!', 'Back off, now!!', 'Do you think this is a game???']
irritated = ['Where are my demands?!', 'What?!', 'How about you start making sense?', 'I am losing my patience!']
calm = ['Ok.', "It's usele... |
g = 2402352677501852209227687703532399932712287657378364916510075318787663274146353219320285676155269678799694668298749389095083896573425601900601068477164491735474137283104610458681314511781646755400527402889846139864532661215055797097162016168270312886432456663834863635782106154918419982534315189740658186868651151358... | g = 2402352677501852209227687703532399932712287657378364916510075318787663274146353219320285676155269678799694668298749389095083896573425601900601068477164491735474137283104610458681314511781646755400527402889846139864532661215055797097162016168270312886432456663834863635782106154918419982534315189740658186868651151358... |
"""
Modules for classes that are used as containers for global variables.
Any function can import and modify/read the values stored in these classes.
"""
class HopliteServerSettings():
"""
Holds global hoplite settings for the server.
"""
# Debug mode increases the amount of logging performed by certa... | """
Modules for classes that are used as containers for global variables.
Any function can import and modify/read the values stored in these classes.
"""
class Hopliteserversettings:
"""
Holds global hoplite settings for the server.
"""
debug = False
class Hopliteclientsettings:
"""
Holds glob... |
def apply_slicing(data, slicing_string: str):
"""
Function to apply slicing without evaluating argument passed by user
Parameters
----------
data : numpy.typing.ArrayLike
slicing_string : str
Returns
-------
sliced_data : numpy.typing.ArrayLike
"""
if slicing_string == "":... | def apply_slicing(data, slicing_string: str):
"""
Function to apply slicing without evaluating argument passed by user
Parameters
----------
data : numpy.typing.ArrayLike
slicing_string : str
Returns
-------
sliced_data : numpy.typing.ArrayLike
"""
if slicing_string == '':... |
#
# @lc app=leetcode id=108 lang=python3
#
# [108] Convert Sorted Array to Binary Search Tree
#
# https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/description/
#
# algorithms
# Easy (60.07%)
# Likes: 3685
# Dislikes: 269
# Total Accepted: 518.1K
# Total Submissions: 851.2K
# Testcase Examp... | class Solution_Withhelper:
def sorted_array_to_bst(self, nums: List[int]) -> TreeNode:
return self.create_bst(nums)
def create_bst(self, nums):
if not nums or len(nums) == 0:
return None
mid = len(nums) // 2
root = tree_node(nums[mid])
left = self.create_bst... |
"""
This module demonstrates what happens with an invalid .py file
"""
def run(*args):
echo("foo")
| """
This module demonstrates what happens with an invalid .py file
"""
def run(*args):
echo('foo') |
# Copyright (c) 2010 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.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'app_base.gypi',
],
'targets': [
{
'target_name': 'app_unittests',
... | {'variables': {'chromium_code': 1}, 'includes': ['app_base.gypi'], 'targets': [{'target_name': 'app_unittests', 'type': 'executable', 'msvs_guid': 'B4D59AE8-8D2F-97E1-A8E9-6D2826729530', 'dependencies': ['app_base', 'app_resources', '../base/base.gyp:test_support_base', '../net/net.gyp:net_test_support', '../skia/skia.... |
DATA_PATH = "data/day01-full.txt"
def part1(data_path=DATA_PATH):
with open(data_path) as f:
lines = [line.strip() for line in f]
return sum(int(b) > int(a) for a, b in zip(lines[:-1], lines[1:]))
def part2(data_path=DATA_PATH):
with open(data_path) as f:
lines = [line.strip() for line ... | data_path = 'data/day01-full.txt'
def part1(data_path=DATA_PATH):
with open(data_path) as f:
lines = [line.strip() for line in f]
return sum((int(b) > int(a) for (a, b) in zip(lines[:-1], lines[1:])))
def part2(data_path=DATA_PATH):
with open(data_path) as f:
lines = [line.strip() for line... |
# Content layer where will pull our feature maps
content_layers = ['block5_conv2']
# Style layer we are interested in
style_layers = ['block1_conv1',
'block2_conv1',
'block3_conv1',
'block4_conv1',
'block5_conv1'
]
num_content_layers = len(content_... | content_layers = ['block5_conv2']
style_layers = ['block1_conv1', 'block2_conv1', 'block3_conv1', 'block4_conv1', 'block5_conv1']
num_content_layers = len(content_layers)
num_style_layers = len(style_layers) |
class TemplateFilter():
"Plugins that define jinja2 filters to be used in templates"
@staticmethod
def myfilter(filter_input, filter_arg):
"""Act as a jinja2 template
Args:
filter_input (str): the input passed to the filter
filter_arg(str): optional arg to the filte... | class Templatefilter:
"""Plugins that define jinja2 filters to be used in templates"""
@staticmethod
def myfilter(filter_input, filter_arg):
"""Act as a jinja2 template
Args:
filter_input (str): the input passed to the filter
filter_arg(str): optional arg to the fil... |
num = int(input("Enter a number\n"))
for i in range(2,num):
if (num%i==0):
print("Not prime")
break
else:
print("Prime") | num = int(input('Enter a number\n'))
for i in range(2, num):
if num % i == 0:
print('Not prime')
break
else:
print('Prime') |
def peng(x):
rest = x % 3
eat = x - (rest)
service = eat / 3
if service + rest < 3:
return service + rest
else:
eat += peng(service + rest)
return eat
print(peng(20))
| def peng(x):
rest = x % 3
eat = x - rest
service = eat / 3
if service + rest < 3:
return service + rest
else:
eat += peng(service + rest)
return eat
print(peng(20)) |
#!/usr/bin/env python3
def selectionSort(input_list):
for i in range(len(input_list)-1):
minn = i
for j in range(i,len(input_list)):
if input_list[j]<input_list[minn]:
minn = j
input_list[i],input_list[minn] = input_list[minn],input_list[i]
return input_list
... | def selection_sort(input_list):
for i in range(len(input_list) - 1):
minn = i
for j in range(i, len(input_list)):
if input_list[j] < input_list[minn]:
minn = j
(input_list[i], input_list[minn]) = (input_list[minn], input_list[i])
return input_list
new_list = [... |
# Public Domain (-) 2018-present, The Elko Website Authors.
# See the Elko Website UNLICENSE file for details.
ALTERNATIVE_HOSTS = frozenset(['www.elko.io'])
CANONICAL_HOST = 'elko.io'
DEBUG = False
SECURE_COOKIE_DURATION = 30 * 86400
SECURE_COOKIE_KEY = 'secret key for authenticating cookies'
STATIC_HANDLER = 'sta... | alternative_hosts = frozenset(['www.elko.io'])
canonical_host = 'elko.io'
debug = False
secure_cookie_duration = 30 * 86400
secure_cookie_key = 'secret key for authenticating cookies'
static_handler = 'static'
task_auth = 'secret auth token' |
with open("dane/liczby.txt") as f:
nums = [int(l.strip(), 2) for l in f.readlines()]
wynik43 = open("wynik43.txt", "w")
smallest = nums.index(min(nums)) + 1
biggest = nums.index(max(nums)) + 1
wynik43.write(f"wiersz z najmniejsza liczba: {smallest}, najwieksza liczba: {biggest}")
wynik43.close()
| with open('dane/liczby.txt') as f:
nums = [int(l.strip(), 2) for l in f.readlines()]
wynik43 = open('wynik43.txt', 'w')
smallest = nums.index(min(nums)) + 1
biggest = nums.index(max(nums)) + 1
wynik43.write(f'wiersz z najmniejsza liczba: {smallest}, najwieksza liczba: {biggest}')
wynik43.close() |
class Solution(object):
def minimumTotal(self, triangle):
"""
:type triangle: List[List[int]]
:rtype: int
"""
n = len(triangle)
dp = [[0 for col in range(row+1)] for row in range(n)]
for i in range(n):
dp[n-1][i] = triangle[n-1][i]
for i in... | class Solution(object):
def minimum_total(self, triangle):
"""
:type triangle: List[List[int]]
:rtype: int
"""
n = len(triangle)
dp = [[0 for col in range(row + 1)] for row in range(n)]
for i in range(n):
dp[n - 1][i] = triangle[n - 1][i]
... |
n_pts = 500
np.random.seed(0)
Xa = np.array([np.random.normal(13, 2, n_pts),
np.random.normal(12, 2, n_pts)]).T
Xb = np.array([np.random.normal(8, 2, n_pts),
np.random.normal(6, 2, n_pts)]).T
X = np.vstack((Xa, Xb))
y = np.matrix(np.append(np.zeros(n_pts), np.ones(n_pts))).T
plt.scatter(... | n_pts = 500
np.random.seed(0)
xa = np.array([np.random.normal(13, 2, n_pts), np.random.normal(12, 2, n_pts)]).T
xb = np.array([np.random.normal(8, 2, n_pts), np.random.normal(6, 2, n_pts)]).T
x = np.vstack((Xa, Xb))
y = np.matrix(np.append(np.zeros(n_pts), np.ones(n_pts))).T
plt.scatter(X[:n_pts, 0], X[:n_pts, 1])
plt.... |
'''
Prompt:
Write a function that, fiven a string, returns the length of the longest palindromic
subsequence.
Ex:
input: "abaxyaba", output: 7. Because "abaxaba", or "abayaba"
are the longest palindromic subsequence.
'''
# Solution with no memoization. Time: O(2^n), Space: O(n)
# We could use memoization and cache t... | """
Prompt:
Write a function that, fiven a string, returns the length of the longest palindromic
subsequence.
Ex:
input: "abaxyaba", output: 7. Because "abaxaba", or "abayaba"
are the longest palindromic subsequence.
"""
def longest_palindromic_subsequence(string, left=0, right=None):
if right is None:
r... |
def factorial_iterative(n: int) -> int:
if n < 0:
raise ValueError("factorial() not defined for negative values")
value = 1
for i in range(1, n + 1):
value *= i
return value
def factorial_recursive(n: int) -> int:
if n < 0:
raise ValueError("factorial() not defined for nega... | def factorial_iterative(n: int) -> int:
if n < 0:
raise value_error('factorial() not defined for negative values')
value = 1
for i in range(1, n + 1):
value *= i
return value
def factorial_recursive(n: int) -> int:
if n < 0:
raise value_error('factorial() not defined for neg... |
def solution(a):
stack = []
valid = True
for c in a:
if c == "[" or c == "{" or c=="(":
stack.append(c)
print(stack)
elif c == ")":
valid = False if not stack or stack.pop() != "(" else valid
#age stack khali bashe ya pop mokhalef ... | def solution(a):
stack = []
valid = True
for c in a:
if c == '[' or c == '{' or c == '(':
stack.append(c)
print(stack)
elif c == ')':
valid = False if not stack or stack.pop() != '(' else valid
print(stack)
elif c == '}':
va... |
class Solution:
def twoSum(self, nums, target):
"""
Approach #2 (Two-pass Hash Table)
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
lookup = {}
for i, num in enumerate(nums):
#print(i,num)
#print(lookup)
... | class Solution:
def two_sum(self, nums, target):
"""
Approach #2 (Two-pass Hash Table)
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
lookup = {}
for (i, num) in enumerate(nums):
lookup[num] = i
for (i, num) in enume... |
{
"targets" :[
{
"target_name": "cryptopp",
"sources": [
"main.cpp",
"cryptopp/misc.cpp",
"cryptopp/cryptlib.cpp",
"cryptopp/modes.cpp",
"cryptopp/rijndael.cpp",
"cryptopp/filters.cpp",
"cryptopp/strciphr.cpp",
"cryptopp/fips140.cpp",
"cryptopp/3way.cpp",
"cryptopp/adler32.cpp",
"cry... | {'targets': [{'target_name': 'cryptopp', 'sources': ['main.cpp', 'cryptopp/misc.cpp', 'cryptopp/cryptlib.cpp', 'cryptopp/modes.cpp', 'cryptopp/rijndael.cpp', 'cryptopp/filters.cpp', 'cryptopp/strciphr.cpp', 'cryptopp/fips140.cpp', 'cryptopp/3way.cpp', 'cryptopp/adler32.cpp', 'cryptopp/algebra.cpp', 'cryptopp/algparam.c... |
file_in = open("DomainMuteLists_V1.txt", "r")
file_out = open("PowerActions.js", "w")
line = file_in.readline()
file_out.write("var defaultFilters = [\n")
first = True
while(line):
if("[" not in line):
if not first:
file_out.write(",\n")
first = False
line = (line.... | file_in = open('DomainMuteLists_V1.txt', 'r')
file_out = open('PowerActions.js', 'w')
line = file_in.readline()
file_out.write('var defaultFilters = [\n')
first = True
while line:
if '[' not in line:
if not first:
file_out.write(',\n')
first = False
line = line.lstrip('||').rstri... |
class MiddlewareInvalidArgumentError(Exception):
"""When middleware receives non keyword=arguments"""
pass
| class Middlewareinvalidargumenterror(Exception):
"""When middleware receives non keyword=arguments"""
pass |
def sitecode_pick(txt):
stcnt = 0
numcnt = 0
lp = 1
prelp = 0
indx = 0
for i in txt:
try:
ix = int(i)
except:
ix = i
if isinstance(ix,str):
stcnt = stcnt + 1
elif isinstance(ix,int):
numcnt = numcnt + 1
... | def sitecode_pick(txt):
stcnt = 0
numcnt = 0
lp = 1
prelp = 0
indx = 0
for i in txt:
try:
ix = int(i)
except:
ix = i
if isinstance(ix, str):
stcnt = stcnt + 1
elif isinstance(ix, int):
numcnt = numcnt + 1
... |
default_app_config = "memberaudit.apps.MemberAuditConfig"
__version__ = "1.4.0"
__title__ = "Member Audit"
| default_app_config = 'memberaudit.apps.MemberAuditConfig'
__version__ = '1.4.0'
__title__ = 'Member Audit' |
# minke.utils.statistics
# Helper functions for statistical computations.
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Sat Aug 06 17:04:24 2016 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: statistics.py [3d75c52] benjamin@bengfort.com... | """
Helper functions for statistical computations.
"""
def mean(data):
"""
TODO: if Numpy becomes a dependency, change this to a Numpy computation.
"""
data = list(map(float, data))
if data:
return sum(data) / len(data)
def median(data, sort=True):
"""
Finds the median in a list of... |
def gcd_two_num(a, b):
if a == 0:
return b
return gcd_two_num(b % a, a)
def gcd_list(arr):
if len(arr) == 0:
return 0
if (len(arr) == 1):
return arr[0]
t = arr[0]
for i in range(len(arr)):
t = gcd_two_num(t, arr[i])
return t
| def gcd_two_num(a, b):
if a == 0:
return b
return gcd_two_num(b % a, a)
def gcd_list(arr):
if len(arr) == 0:
return 0
if len(arr) == 1:
return arr[0]
t = arr[0]
for i in range(len(arr)):
t = gcd_two_num(t, arr[i])
return t |
# need strings[i] = strings[j] for all patterns[i] = patterns[j] to be true -
# give false if strings[i] != strings[j] and patterns[i] = patterns[j] or
# strings[i] = strings[j] and patterns[j] != patterns[j] - this last condition
# threw me for a bit as an edge case! Need to ensure that each string is unique
# to each... | def are_following_patterns(strings, patterns):
pattern_to_string = {}
string_to_pattern = {}
for i in range(len(patterns)):
this_pattern = patterns[i]
if patterns[i] in pattern_to_string:
if strings[i] != pattern_to_string[this_pattern]:
return False
else:... |
class FundRequestTransactionDAO:
def __init__(self, repo):
self.repo = repo
def persist_transaction(self, stake_member, transaction_hash, created_at):
query_response = self.repo.execute(
"INSERT INTO fund_request_transaction (stake_member, transaction_hash, created_at, row_created, ... | class Fundrequesttransactiondao:
def __init__(self, repo):
self.repo = repo
def persist_transaction(self, stake_member, transaction_hash, created_at):
query_response = self.repo.execute('INSERT INTO fund_request_transaction (stake_member, transaction_hash, created_at, row_created, row_updated)... |
"""__getitem__"""
def f():
pass
class G(object):
def __init__(self):
"""XXX: Without __init__ the translation with javascript fail"""
pass
def main():
g = G()
a = {'2': 22, 3:33}
a[f] = 44
a[g] = 66
a[G] = 55
TestError(a['2'] == 22)
TestError(a[3] == 33)
TestError(a[f] == 44)
TestError(... | """__getitem__"""
def f():
pass
class G(object):
def __init__(self):
"""XXX: Without __init__ the translation with javascript fail"""
pass
def main():
g = g()
a = {'2': 22, 3: 33}
a[f] = 44
a[g] = 66
a[G] = 55
test_error(a['2'] == 22)
test_error(a[3] == 33)
te... |
def get_color_matrix(color):
r = (color >> 16 & 255) / 255
g = (color >> 8 & 255) / 255
b = (color & 255) / 255
return "1 0 0 0 {} \
0 1 0 0 {} \
0 0 1 0 {} \
0 0 0 1 0".format(r - 0.5, g - 0.5, b - 0.5)
def get_color_filter(_id, color):
return '<filter id="color_{}" \
x="-20%" y="-20%" width="140%... | def get_color_matrix(color):
r = (color >> 16 & 255) / 255
g = (color >> 8 & 255) / 255
b = (color & 255) / 255
return '1 0 0 0 {} \t\t\t0 1 0 0 {} \t\t\t0 0 1 0 {} \t\t\t0 0 0 1 0'.format(r - 0.5, g - 0.5, b - 0.5)
def get_color_filter(_id, color):
return '<filter id="color_{}" \t\t\t\tx="-20%" y=... |
class CamHolder:
def __init__(self):
self._cam1 = None
self._cam2 = None
def update_frame(self, frame, target_cam):
if target_cam == 1:
self._cam1 = frame
else:
self._cam2 = frame
def get_frame(self, target_cam):
if target_cam == 1:
... | class Camholder:
def __init__(self):
self._cam1 = None
self._cam2 = None
def update_frame(self, frame, target_cam):
if target_cam == 1:
self._cam1 = frame
else:
self._cam2 = frame
def get_frame(self, target_cam):
if target_cam == 1:
... |
class Solution:
def minCameraCover(self, root: TreeNode) -> int:
self.res = 0
def dfs(root):
if not root: return 2
l, r = dfs(root.left), dfs(root.right)
if l == 0 or r == 0:
self.res += 1
return 1
return 2 if l == 1 or ... | class Solution:
def min_camera_cover(self, root: TreeNode) -> int:
self.res = 0
def dfs(root):
if not root:
return 2
(l, r) = (dfs(root.left), dfs(root.right))
if l == 0 or r == 0:
self.res += 1
return 1
... |
def suma (n):
s=0
for i in range (1,n+1):
s+=i*(i+1)
return s
n=int(input("n="))
print(suma(n))
| def suma(n):
s = 0
for i in range(1, n + 1):
s += i * (i + 1)
return s
n = int(input('n='))
print(suma(n)) |
name0_1_1_0_0_3_0 = None
name0_1_1_0_0_3_1 = None
name0_1_1_0_0_3_2 = None
name0_1_1_0_0_3_3 = None
name0_1_1_0_0_3_4 = None | name0_1_1_0_0_3_0 = None
name0_1_1_0_0_3_1 = None
name0_1_1_0_0_3_2 = None
name0_1_1_0_0_3_3 = None
name0_1_1_0_0_3_4 = None |
class Solution:
def partitionLabels(self, S: str) -> List[int]:
ans = []
indmap = {}
leng = len(S)
for i, l in enumerate(S):
indmap[l] = i
start, end = 0, 0
for idx in range(leng):
end = max(end, indmap[S[idx]])
... | class Solution:
def partition_labels(self, S: str) -> List[int]:
ans = []
indmap = {}
leng = len(S)
for (i, l) in enumerate(S):
indmap[l] = i
(start, end) = (0, 0)
for idx in range(leng):
end = max(end, indmap[S[idx]])
if idx == en... |
def quicksort(L):
"""
Developed in 1959 by Tony Hoare, quicksort is still a commonly used
algorithm.
Performance
===========
Worst: O(n^2)
Average: O(n log n)
Best: O(n log n)
Space
=====
Worst: O(n)
Average: O(n log n)
"""
if len(L) <= 1:... | def quicksort(L):
"""
Developed in 1959 by Tony Hoare, quicksort is still a commonly used
algorithm.
Performance
===========
Worst: O(n^2)
Average: O(n log n)
Best: O(n log n)
Space
=====
Worst: O(n)
Average: O(n log n)
"""
if len(L) <= 1:
... |
class OK:
def __eq__(self, other):
return False
class NotOK2:
def __ne__(self, other):
return True
| class Ok:
def __eq__(self, other):
return False
class Notok2:
def __ne__(self, other):
return True |
DOC_HEADER = """
| Parameter | Value |
| --------- | ----------- |
| Author | TestEngine |
| Version | %(version)s |
| Status | Implemented |
"""
DOC_LEGEND = """
#### Legend
##### Paging
| Param | Meaning |
| ------ | ------------------ |
| take | Rows per page |
| skip | ... | doc_header = '\n\n| Parameter | Value |\n| --------- | ----------- |\n| Author | TestEngine |\n| Version | %(version)s |\n| Status | Implemented |\n\n'
doc_legend = '\n\n#### Legend\n\n\n##### Paging\n\n| Param | Meaning |\n| ------ | ------------------ |\n| take | Rows per page |\n| s... |
HEADER_PROTEIN = 'Protein ID'
HEADER_PROTEINS = 'Protein ID(s)'
HEADER_GENEID = 'Gene ID'
HEADER_GENENAME = 'Gene Name'
HEADER_DESCRIPTION = 'Description'
HEADER_COVERAGE = 'Coverage'
HEADER_NO_PROTEIN = '# Proteins'
HEADER_CONTENTPROT = 'Proteins in group'
HEADER_NO_UNIPEP = '# Unique peptides'
HEADER_NO_PEPTIDE = '# ... | header_protein = 'Protein ID'
header_proteins = 'Protein ID(s)'
header_geneid = 'Gene ID'
header_genename = 'Gene Name'
header_description = 'Description'
header_coverage = 'Coverage'
header_no_protein = '# Proteins'
header_contentprot = 'Proteins in group'
header_no_unipep = '# Unique peptides'
header_no_peptide = '# ... |
lista=[]
dado=[]
maisdecem=[]
menosdecem=[]
cont=0
while True:
dado.append(input('Nome: '))
dado.append(float(input('Peso: ')))
lista.append(dado[:])
dado.clear()
cont=cont+1
e=' '
while e not in 'SN':
e=input('Deseja cadastrar mais pessoas? [S/N]: ').strip().upper()[0]
if e == '... | lista = []
dado = []
maisdecem = []
menosdecem = []
cont = 0
while True:
dado.append(input('Nome: '))
dado.append(float(input('Peso: ')))
lista.append(dado[:])
dado.clear()
cont = cont + 1
e = ' '
while e not in 'SN':
e = input('Deseja cadastrar mais pessoas? [S/N]: ').strip().upper(... |
def main() -> None:
N = int(input())
S = input()
T = input()
assert 2 <= N <= 100
assert len(S) == len(T) == N
assert all(S_i in ('0', '1') for S_i in S)
assert all(T_i in ('0', '1') for T_i in T)
if __name__ == '__main__':
main()
| def main() -> None:
n = int(input())
s = input()
t = input()
assert 2 <= N <= 100
assert len(S) == len(T) == N
assert all((S_i in ('0', '1') for s_i in S))
assert all((T_i in ('0', '1') for t_i in T))
if __name__ == '__main__':
main() |
def execute_resolveit_as_context_manager() -> None:
a = "str"
b = ["str"]
a + b
| def execute_resolveit_as_context_manager() -> None:
a = 'str'
b = ['str']
a + b |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
class BitFlag(object):
def __init__(self, *args):
if len(args)==0:
self.value = 0
else:
self.value = 0
for val in args:
SetFlag(self, val)
def IsSet(self, flag):
return (self.value & flag) != 0
def SetFlag(self, flag):
self.value = self.value |... | class Bitflag(object):
def __init__(self, *args):
if len(args) == 0:
self.value = 0
else:
self.value = 0
for val in args:
set_flag(self, val)
def is_set(self, flag):
return self.value & flag != 0
def set_flag(self, flag):
... |
a = [4,2,1,-3,5]
b = [1,2,3,4,5]
print(len(a))
sorted(a)
print(a)
for x in reversed(a):
print(x,end=' ')
print('\n====================')
for x in range(1,5):
print(x,end=' ')
print('\n====================')
print(list(zip(a,b))) | a = [4, 2, 1, -3, 5]
b = [1, 2, 3, 4, 5]
print(len(a))
sorted(a)
print(a)
for x in reversed(a):
print(x, end=' ')
print('\n====================')
for x in range(1, 5):
print(x, end=' ')
print('\n====================')
print(list(zip(a, b))) |
# Nguyen ly ke thua, reuse method, overriding method,... giong Java
class Parent():
def __init__(self, last_name, eye_color):
print("Parent constructor called")
self.last_name = last_name
self.eye_color = eye_color
def show_info(self):
print("Last name: " + self.last_name)
print("Eye color: " + self.eye... | class Parent:
def __init__(self, last_name, eye_color):
print('Parent constructor called')
self.last_name = last_name
self.eye_color = eye_color
def show_info(self):
print('Last name: ' + self.last_name)
print('Eye color: ' + self.eye_color)
class Child(Parent):
d... |
class Solution:
def largestPalindrome(self, n):
"""
:type n: int
:rtype: int
"""
upper = pow(10, n) - 1
for i in range(upper):
i = upper - i
if i <= upper / 10:
break
palindrome = int(str(i) + str(i)[::-1])
... | class Solution:
def largest_palindrome(self, n):
"""
:type n: int
:rtype: int
"""
upper = pow(10, n) - 1
for i in range(upper):
i = upper - i
if i <= upper / 10:
break
palindrome = int(str(i) + str(i)[::-1])
... |
for x in range(16):
with open(f'..\\data\\cpu\\functions\\opcode_switch\\opcode_cxxx\\opcode_cxxx_{x}.mcfunction', 'w') as f:
f.write(f'function cpu:bitwise_ops/and\n'
f'scoreboard players operation Global result *= c16 Constant\n'
f'scoreboard players operation G... | for x in range(16):
with open(f'..\\data\\cpu\\functions\\opcode_switch\\opcode_cxxx\\opcode_cxxx_{x}.mcfunction', 'w') as f:
f.write(f'function cpu:bitwise_ops/and\nscoreboard players operation Global result *= c16 Constant\nscoreboard players operation Global V{hex(x)[2:].upper()} = Global result\nscorebo... |
teste = []
teste.append('Gabriel')
teste.append(19)
print(teste)
galera = []
galera.append(teste[:]) # para copiar os dados de uma lista precisa do [:] se nao vai criar uma ligacao e quando mudar a lista original
print(galera) # tambem vai mudar a lista composta q pegou o link
teste[0] = 'Pedro'
teste[1] = '21'
gal... | teste = []
teste.append('Gabriel')
teste.append(19)
print(teste)
galera = []
galera.append(teste[:])
print(galera)
teste[0] = 'Pedro'
teste[1] = '21'
galera.append(teste[:])
print(galera)
print(galera[0])
print(galera[1])
print(galera[0][0])
print(galera[1][0])
print(galera[0][0][0])
print(galera[1][0][0]) |
def perm(list):
if len(list) != 1:
pWord = perm(list[1:])
res = []
for i in pWord:
for j in range(len(i) + 1):
res.append(i[:j] + list[0] + i[j:])
return res
elif(len(list) == 1):
return [list]
print(perm('abc')) | def perm(list):
if len(list) != 1:
p_word = perm(list[1:])
res = []
for i in pWord:
for j in range(len(i) + 1):
res.append(i[:j] + list[0] + i[j:])
return res
elif len(list) == 1:
return [list]
print(perm('abc')) |
OUT = 'Out'
CLOSE_DOOR = 'CloseDoor'
OPEN_DOOR = 'OpenDoor'
STAIRS = 'Stairs'
MY_ROOM = 'MyRoom'
E_TURNED_KNOB = 'turned_knob'
E_PULLED_KNOB = 'pulled_knob'
E_ENTER = 'enter'
E_UP = 'up'
E_SITTING_DOWN = 'sitting_down'
E_FAILED = 'failed'
MSG_TURN_KNOB = 'Turn knob'
MSG_PULL_KNOB = 'Pull knob'
MSG_ENTER = 'Enter'
MSG_U... | out = 'Out'
close_door = 'CloseDoor'
open_door = 'OpenDoor'
stairs = 'Stairs'
my_room = 'MyRoom'
e_turned_knob = 'turned_knob'
e_pulled_knob = 'pulled_knob'
e_enter = 'enter'
e_up = 'up'
e_sitting_down = 'sitting_down'
e_failed = 'failed'
msg_turn_knob = 'Turn knob'
msg_pull_knob = 'Pull knob'
msg_enter = 'Enter'
msg_u... |
menu = [
["egg", "spam", "bacon"],
["egg", "sausage", "bacon"],
["egg", "spam"],
["egg", "bacon", "spam"],
["egg", "bacon", "sausage", "spam"],
["spam", "bacon", "sausage", "spam"],
["spam", "egg", "spam", "spam", "bacon", "spam"],
["spam", "egg", "sausage", "spam"],
["chicken", "chi... | menu = [['egg', 'spam', 'bacon'], ['egg', 'sausage', 'bacon'], ['egg', 'spam'], ['egg', 'bacon', 'spam'], ['egg', 'bacon', 'sausage', 'spam'], ['spam', 'bacon', 'sausage', 'spam'], ['spam', 'egg', 'spam', 'spam', 'bacon', 'spam'], ['spam', 'egg', 'sausage', 'spam'], ['chicken', 'chips']]
for meal in menu:
print(mea... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Utility methods"""
def print_error(error_msg):
"""Prints an error"""
print('ERROR: {}'.format(error_msg))
def print_object(lobj):
""" Print a message object """
if 'deleted' in lobj.keys() and lobj['deleted'] == '1':
print('[deleted]')
... | """Utility methods"""
def print_error(error_msg):
"""Prints an error"""
print('ERROR: {}'.format(error_msg))
def print_object(lobj):
""" Print a message object """
if 'deleted' in lobj.keys() and lobj['deleted'] == '1':
print('[deleted]')
return
outputline = '[{}] {}{}: '.format(lo... |
shengmu = ['b' ,'p' ,'m' ,'f' ,'d' ,'t' ,'n' ,'l' ,'g' ,'k' ,'h' ,'j' ,'q' ,'x' ,'zh' ,'ch' ,'sh' ,'z' ,'c' ,'s' ,'y'
,'w' ,'r']
yunmu = ['a' ,'o' ,'e' ,'i' ,'u' ,'v' ,'ai' ,'ei' ,'ui' ,'ao' ,'ou' ,'iu' ,'ie' ,'ve' ,'er' ,'an' ,'en' ,'in' ,'un'
,'vn' ,'ang' ,'eng' ,'ing' ,'ong']
shengmu_metrix = {
... | shengmu = ['b', 'p', 'm', 'f', 'd', 't', 'n', 'l', 'g', 'k', 'h', 'j', 'q', 'x', 'zh', 'ch', 'sh', 'z', 'c', 's', 'y', 'w', 'r']
yunmu = ['a', 'o', 'e', 'i', 'u', 'v', 'ai', 'ei', 'ui', 'ao', 'ou', 'iu', 'ie', 've', 'er', 'an', 'en', 'in', 'un', 'vn', 'ang', 'eng', 'ing', 'ong']
shengmu_metrix = {'b': ['p'], 'p': ['b']... |
### Solution 1 (The only solution I could think of)
def find_sum(arr):
if (len(arr) == 0):
return 0
prevSum = arr[0]
currSum = arr[0]
for n in arr[1:]:
prevSum = max(prevSum+n, n)
currSum = max(prevSum, currSum)
return currSum
# arr1 = [1,2,3,4,5,6,-10] # Sum = 21
# arr1... | def find_sum(arr):
if len(arr) == 0:
return 0
prev_sum = arr[0]
curr_sum = arr[0]
for n in arr[1:]:
prev_sum = max(prevSum + n, n)
curr_sum = max(prevSum, currSum)
return currSum |
_FIELDS = ('spec', 'file', 'mntopts', 'freq', 'passno')
class Fstab:
def __init__(self, host):
self._host = host
def list(self, filepath='/etc/fstab'):
with self.open(filepath) as fhandler:
return [zip(_FIELDS, elts)
for line in fhandler.read().splitlines()
... | _fields = ('spec', 'file', 'mntopts', 'freq', 'passno')
class Fstab:
def __init__(self, host):
self._host = host
def list(self, filepath='/etc/fstab'):
with self.open(filepath) as fhandler:
return [zip(_FIELDS, elts) for line in fhandler.read().splitlines() if line and (not line.d... |
# https://leetcode.com/problems/invalid-transactions/
# Easy (22.83%)
# Total Accepted: 2,216
# Total Submissions: 9,708
# beats 100.0% of python submissions
class Solution(object):
def invalidTransactions(self, transactions):
"""
:type transactions: List[str]
:rtype: List[str]
... | class Solution(object):
def invalid_transactions(self, transactions):
"""
:type transactions: List[str]
:rtype: List[str]
"""
length = len(transactions)
if length == 0:
return []
tmp = []
s = set()
for (idx, t) in enumerate(transac... |
"""MySQL FIELD_TYPE Constants
These constants represent the various column (field) types that are
supported by MySQL.
"""
DECIMAL = 0
TINY = 1
SHORT = 2
LONG = 3
FLOAT = 4
DOUBLE = 5
NULL = 6
TIMESTAMP = 7
LONGLONG = 8
INT24 = 9
DATE = 10
TIME = 11
DATETIME = 12
YEAR = 13
NEWDATE = 14
VARCHAR =... | """MySQL FIELD_TYPE Constants
These constants represent the various column (field) types that are
supported by MySQL.
"""
decimal = 0
tiny = 1
short = 2
long = 3
float = 4
double = 5
null = 6
timestamp = 7
longlong = 8
int24 = 9
date = 10
time = 11
datetime = 12
year = 13
newdate = 14
varchar = 15
bit = 16
newdecimal... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "GumGum Inc."
__email__ = "machine-learning-engineering@gumgum.com"
__version__ = "0.0.3"
| __author__ = 'GumGum Inc.'
__email__ = 'machine-learning-engineering@gumgum.com'
__version__ = '0.0.3' |
#!/usr/bin/env python3
'''
This file is to learn about set type more detail.
'''
# declare a set
set1 = set([1,2,3])
print(set1) | """
This file is to learn about set type more detail.
"""
set1 = set([1, 2, 3])
print(set1) |
{
'targets': [{
'target_name': 'faster-serial-port',
'win_delay_load_hook': 'true',
'sources': [
'src/Drain.cpp',
'src/Flush.cpp',
'src/WriteBaton.cpp',
'src/UpdateBaton.cpp',
'src/ListBaton.cpp',
'src/BatonBase.cpp',
'src/V8ArgDecoder.cpp',
... | {'targets': [{'target_name': 'faster-serial-port', 'win_delay_load_hook': 'true', 'sources': ['src/Drain.cpp', 'src/Flush.cpp', 'src/WriteBaton.cpp', 'src/UpdateBaton.cpp', 'src/ListBaton.cpp', 'src/BatonBase.cpp', 'src/V8ArgDecoder.cpp', 'src/Util.cpp', 'src/GetBaudRate.cpp', 'src/SetBaton.cpp', 'src/Get.cpp', 'src/Op... |
def sumTriangle(triangle):
with open(triangle, 'r') as triangle:
for triangleRow in triangle.readlines():
outRow = triangleRow.strip().split()
yield [int(x) for x in outRow]
# yield list(map(lambda x: int(x), outRow))
def triangleReduce(topRow,bottomRow):
pas... | def sum_triangle(triangle):
with open(triangle, 'r') as triangle:
for triangle_row in triangle.readlines():
out_row = triangleRow.strip().split()
yield [int(x) for x in outRow]
def triangle_reduce(topRow, bottomRow):
pass
if __name__ == '__main__':
array_t = sum_triangle('/U... |
""" Collision handling using Chaining: Implementation of chaining using LinkedList and chain creation"""
def display_hash(hash_table): # Function to display hashtable
for i in range(len(hash_table)):
print(i, end=" ")
for j in hash_table[i]:
print("-->", end=" ")
print(j... | """ Collision handling using Chaining: Implementation of chaining using LinkedList and chain creation"""
def display_hash(hash_table):
for i in range(len(hash_table)):
print(i, end=' ')
for j in hash_table[i]:
print('-->', end=' ')
print(j, end=' ')
print()
def hash... |
def func(kek: str):
return "kek"
# FIXME otherwise ebonite collects all the dependencies in file with `func` declaration
| def func(kek: str):
return 'kek' |
IP = 'localhost'
PORT = 50500
SALT = 'SaltySaltySalt' # ur salt
# leave blank for WS protocol
SSL_CHAIN = ""
SSL_KEY = ""
| ip = 'localhost'
port = 50500
salt = 'SaltySaltySalt'
ssl_chain = ''
ssl_key = '' |
class EsperantoNumbers:
def nameThisNumber(self, x):
o, s = ["unu", "du", "tri", "kvar", "kvin", "ses", "sep", "ok", "nau", "dek"], ''
if x/10 >= 2:
s += o[x/10-1]
if x >= 10:
s += 'dek'
if x%10:
if s:
s += ' '
s += o[x%... | class Esperantonumbers:
def name_this_number(self, x):
(o, s) = (['unu', 'du', 'tri', 'kvar', 'kvin', 'ses', 'sep', 'ok', 'nau', 'dek'], '')
if x / 10 >= 2:
s += o[x / 10 - 1]
if x >= 10:
s += 'dek'
if x % 10:
if s:
s += ' '
... |
"""
############### Pseudocode ##############
split word on " "
sort list
return " ".join(list)
"""
def sort_string(words):
list_word = words.split(" ")
list_word.sort(key=lambda word: word.lower())
return " ".join(list_word)
print(sort_string(input("Words: "))) | """
############### Pseudocode ##############
split word on " "
sort list
return " ".join(list)
"""
def sort_string(words):
list_word = words.split(' ')
list_word.sort(key=lambda word: word.lower())
return ' '.join(list_word)
print(sort_string(input('Words: '))) |
load(
"@com_vistarmedia_rules_js//js/private:rules.bzl",
"js_binary",
"node_attr",
)
def _browserify_impl(ctx):
entry = ctx.attr.entrypoint.main.short_path.replace(".js", "")
arguments = [
"--ignore-transform",
"envify",
"--outfile",
ctx.outputs.js.path,
"--... | load('@com_vistarmedia_rules_js//js/private:rules.bzl', 'js_binary', 'node_attr')
def _browserify_impl(ctx):
entry = ctx.attr.entrypoint.main.short_path.replace('.js', '')
arguments = ['--ignore-transform', 'envify', '--outfile', ctx.outputs.js.path, '--entry', './node_modules/' + entry]
for t in ctx.attr.... |
n = int(input())
def cal( arr):
sum1 = 0
n= len(arr)
for k in range(n):
sum1 += arr[k]*((4/5)**k)
return sum1/5
arr=[]
arr2=[]
for i in range(n):
x = int(input())
arr.append(x)
arr2.append(x)
sum1 = 0
for k in range(n):
sum1 += arr[k]*((4/5)**k)
s2=0
ans=[]
for k1 in range(n):
arr... | n = int(input())
def cal(arr):
sum1 = 0
n = len(arr)
for k in range(n):
sum1 += arr[k] * (4 / 5) ** k
return sum1 / 5
arr = []
arr2 = []
for i in range(n):
x = int(input())
arr.append(x)
arr2.append(x)
sum1 = 0
for k in range(n):
sum1 += arr[k] * (4 / 5) ** k
s2 = 0
ans = []
for... |
def load(h):
return ({'abbr': 'pres', 'code': 1, 'title': 'PRES Pressure Pa'},
{'abbr': 'msl', 'code': 2, 'title': 'MSL Pressure reduced to MSL Pa'},
{'abbr': 'ptend', 'code': 3, 'title': 'PTEND Pressure tendency Pa/s'},
{'abbr': 'pv', 'code': 4, 'title': 'PV Potential vorticity ... | def load(h):
return ({'abbr': 'pres', 'code': 1, 'title': 'PRES Pressure Pa'}, {'abbr': 'msl', 'code': 2, 'title': 'MSL Pressure reduced to MSL Pa'}, {'abbr': 'ptend', 'code': 3, 'title': 'PTEND Pressure tendency Pa/s'}, {'abbr': 'pv', 'code': 4, 'title': 'PV Potential vorticity K*m2 / kg / s'}, {'abbr': 'icaht', '... |
class Cell:
def __init__(self):
self._status = False
def set_alive(self):
self._status = True
def set_dead(self):
self._status = False
def check_status(self):
return self._status
def print_status(self):
if self.check_status():
return "*"
... | class Cell:
def __init__(self):
self._status = False
def set_alive(self):
self._status = True
def set_dead(self):
self._status = False
def check_status(self):
return self._status
def print_status(self):
if self.check_status():
return '*'
... |
#
# Helper function to unpack a symbol
#
class SymbolUnpacker(object):
"""
Helper class to unpack a (set of) symbol(s) to find all instances of a class.
Uses caching to speed up the process.
Parameters
----------
classes_to_find : list of pybamm classes
Classes to identify in the equa... | class Symbolunpacker(object):
"""
Helper class to unpack a (set of) symbol(s) to find all instances of a class.
Uses caching to speed up the process.
Parameters
----------
classes_to_find : list of pybamm classes
Classes to identify in the equations
unpacked_symbols: dict {variable ... |
def ca(d):
a = b = c = 0
e = f = d
print(a)
print(e)
| def ca(d):
a = b = c = 0
e = f = d
print(a)
print(e) |
print("hello world")
d = {"a": 0, "b": 1, "c": 2}
for i in d.values():
print(i) | print('hello world')
d = {'a': 0, 'b': 1, 'c': 2}
for i in d.values():
print(i) |
#
# PySNMP MIB module NETSCREEN-VR-RIPv2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-VR-RIPv2-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:20:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ... |
# BASE = "https://lingon.ladok.umu.se"
BASEURL = "https://90.147.19.66"
# If BASE is https these has to be specified
SERVER_CERT = "certs/cert.pem"
SERVER_KEY = "certs/key.pem"
CA_BUNDLE = None
VERIFY_SSL = False
KEYDEFS = [
{"type": "RSA", "key": '', "use": ["sig"]},
{"type": "EC", "crv": "P-256", "use": ["... | baseurl = 'https://90.147.19.66'
server_cert = 'certs/cert.pem'
server_key = 'certs/key.pem'
ca_bundle = None
verify_ssl = False
keydefs = [{'type': 'RSA', 'key': '', 'use': ['sig']}, {'type': 'EC', 'crv': 'P-256', 'use': ['sig']}]
private_jwks_path = 'jwks_dir/jwks.json'
public_jwks_path = 'static/jwks.json'
client_pr... |
class Solution(object):
def findLUSlength(self, strs):
"""
:type strs: List[str]
:rtype: int
"""
def findLUSlength(a, b):
return max(len(a), len(b)) if a != b else -1
def isSubsequence(s, t):
d = collections.defaultdict(l... | class Solution(object):
def find_lu_slength(self, strs):
"""
:type strs: List[str]
:rtype: int
"""
def find_lu_slength(a, b):
return max(len(a), len(b)) if a != b else -1
def is_subsequence(s, t):
d = collections.defaultdict(list)
... |
def load():
with open("inputs/17.txt") as f:
xr, yr = f.read().split(", ")
xl, xu = xr.split("=")[-1].split("..")
yl, yu = yr.split("=")[-1].split("..")
return (
(int(xl), int(xu)),
(int(yl), int(yu)),
)
def inside(
me: tuple[int, int],
target: tuple[tuple[int, int]... | def load():
with open('inputs/17.txt') as f:
(xr, yr) = f.read().split(', ')
(xl, xu) = xr.split('=')[-1].split('..')
(yl, yu) = yr.split('=')[-1].split('..')
return ((int(xl), int(xu)), (int(yl), int(yu)))
def inside(me: tuple[int, int], target: tuple[tuple[int, int], tuple[int, int]]):
(m... |
# buildifier: disable=module-docstring
load("//foreign_cc/private/shell_toolchain/toolchains:commands.bzl", "PLATFORM_COMMANDS")
load(":function_and_call.bzl", "FunctionAndCall")
_function_and_call_type = type(FunctionAndCall(text = ""))
def create_context(ctx):
return struct(
shell = ctx.toolchains["@rul... | load('//foreign_cc/private/shell_toolchain/toolchains:commands.bzl', 'PLATFORM_COMMANDS')
load(':function_and_call.bzl', 'FunctionAndCall')
_function_and_call_type = type(function_and_call(text=''))
def create_context(ctx):
return struct(shell=ctx.toolchains['@rules_foreign_cc//foreign_cc/private/shell_toolchain/t... |
'''THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OT... | """THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OT... |
"""
Entradas
examen matematicas-->float-->em
calificacion 3 trabajos-->float-->c1, c2, c3
calificacion fisica--> float-->cf
Salidas
promedio matematicas-->rpromedio1= (em* 0.90)+(tarea* 0.10)
promedio fisica-->promedio2= (cf*0.80)+(tarea1*0.20)
promedio quimica-->promedio3= (cq*0.85)+(tarea2*0.15)
promedio general-->pr... | """
Entradas
examen matematicas-->float-->em
calificacion 3 trabajos-->float-->c1, c2, c3
calificacion fisica--> float-->cf
Salidas
promedio matematicas-->rpromedio1= (em* 0.90)+(tarea* 0.10)
promedio fisica-->promedio2= (cf*0.80)+(tarea1*0.20)
promedio quimica-->promedio3= (cq*0.85)+(tarea2*0.15)
promedio general-->pr... |
# Local Scope
# def my_func() -> None:
# y: int = 5
# print(y)
# Global Scope
# y: int = 5
# def my_function() -> None:
# print(y)
# def my_another_functions() -> None:
# print(y)
# my_function()
# my_another_functions()
y: int = 5
def my_function() -> None:
y: int = 3
def my_anoth... | y: int = 5
def my_function() -> None:
y: int = 3
def my_another_functions() -> None:
y: int = 2
print(y)
my_another_functions()
print(y)
my_function()
print(y) |
FLAG_ALPHA_FEATURES_NAME = "alpha_features"
FLAG_ON_DEMAND_TRANSFORM_NAME = "on_demand_transforms"
FLAG_PYTHON_FEATURE_SERVER_NAME = "python_feature_server"
ENV_FLAG_IS_TEST = "IS_TEST"
FLAG_NAMES = {
FLAG_ALPHA_FEATURES_NAME,
FLAG_ON_DEMAND_TRANSFORM_NAME,
FLAG_PYTHON_FEATURE_SERVER_NAME,
}
| flag_alpha_features_name = 'alpha_features'
flag_on_demand_transform_name = 'on_demand_transforms'
flag_python_feature_server_name = 'python_feature_server'
env_flag_is_test = 'IS_TEST'
flag_names = {FLAG_ALPHA_FEATURES_NAME, FLAG_ON_DEMAND_TRANSFORM_NAME, FLAG_PYTHON_FEATURE_SERVER_NAME} |
PROXY = '' # 127.0.0.1:8123 for example
FEEDS = [
'http://www.heise.de/newsticker/heise-atom.xml',
'http://golem.de.dynamic.feedsportal.com/pf/578068/http://rss.golem.de/rss.php?feed=RSS2.0',
'https://news.ycombinator.com/rss',
]
| proxy = ''
feeds = ['http://www.heise.de/newsticker/heise-atom.xml', 'http://golem.de.dynamic.feedsportal.com/pf/578068/http://rss.golem.de/rss.php?feed=RSS2.0', 'https://news.ycombinator.com/rss'] |
entries = [
{
"env-title": "atari-alien",
"env-variant": "No-op start",
"score": 15962.10,
},
{
"env-title": "atari-amidar",
"env-variant": "No-op start",
"score": 1554.79,
},
{
"env-title": "atari-assault",
"env-variant": "No-op start"... | entries = [{'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 15962.1}, {'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 1554.79}, {'env-title': 'atari-assault', 'env-variant': 'No-op start', 'score': 19148.47}, {'env-title': 'atari-asterix', 'env-variant': 'No-op start', 'score': 3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.