content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""
pytest config for sphinxcontrib/video/tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2017 by Raphael Massabot <rmassabot@gmail.com>
:license: BSD, see LICENSE for details.
"""
pytest_plugins = 'sphinx.testing.fixtures'
| """
pytest config for sphinxcontrib/video/tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2017 by Raphael Massabot <rmassabot@gmail.com>
:license: BSD, see LICENSE for details.
"""
pytest_plugins = 'sphinx.testing.fixtures' |
#
# PySNMP MIB module ROHC-UNCOMPRESSED-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/ROHC-UNCOMPRESSED-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:27:12 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016,... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_range_constraint, constraints_union, value_size_constraint) ... |
def create_lattice(max_gen):
current = [tuple(len(max_gen)*[0])]
tree = []
while current != []:
tree.append(current)
copy = current
next_lvl = []
for elem in range(len(copy)):
l = list(copy[elem])
for i in range(len(l)):
new_l = l.copy... | def create_lattice(max_gen):
current = [tuple(len(max_gen) * [0])]
tree = []
while current != []:
tree.append(current)
copy = current
next_lvl = []
for elem in range(len(copy)):
l = list(copy[elem])
for i in range(len(l)):
new_l = l.cop... |
def main( array, value ):
for i in range( array.size ):
array[i] = array[i] + value
return array
| def main(array, value):
for i in range(array.size):
array[i] = array[i] + value
return array |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 29 16:26:54 2019
@author: hp
"""
string ="g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
string = "map"... | """
Created on Tue Jan 29 16:26:54 2019
@author: hp
"""
string = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
string = 'map'
offset = 2
for c in string:
i... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def rob(self, root: TreeNode) -> int:
@lru_cache(maxsize=None)
def dfs(node, can_ro... | class Solution:
def rob(self, root: TreeNode) -> int:
@lru_cache(maxsize=None)
def dfs(node, can_rob, acc_sum):
if not node:
return acc_sum
max_sum = acc_sum
if can_rob:
left_sum = dfs(node.left, False, 0)
right_su... |
CONFIRM = '\N{WHITE HEAVY CHECK MARK}'
CANCEL = '\N{NO ENTRY SIGN}'
SUCCESS = '\N{THUMBS UP SIGN}'
FAILURE = '\N{THUMBS DOWN SIGN}'
| confirm = '✅'
cancel = '🚫'
success = '👍'
failure = '👎' |
'''
Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X.
Return the number of good nodes in the binary tree.
Input: root = [3,1,4,3,null,1,5]
Output: 4
Explanation: Nodes in blue are good.
Root Node (3) is always a good node.
Node 4... | """
Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X.
Return the number of good nodes in the binary tree.
Input: root = [3,1,4,3,null,1,5]
Output: 4
Explanation: Nodes in blue are good.
Root Node (3) is always a good node.
Node 4... |
class Edge:
def __init__(self, node, weight):
self.node = node
self.weight = weight
class Node:
def __init__(self, index):
self.index = index
self._distance = float('inf')
self._parent = None
self._neighbors = []
@property
def distance(self):
... | class Edge:
def __init__(self, node, weight):
self.node = node
self.weight = weight
class Node:
def __init__(self, index):
self.index = index
self._distance = float('inf')
self._parent = None
self._neighbors = []
@property
def distance(self):
r... |
#background color
black = 0,0,0
#colors in order of intuitively determined distinctness. Assuming a black background
white = 255,255,255
blue = 0, 0, 255
red = 255, 0, 0
green = 0, 255, 0
gray = 127,127,127
lightblue = 0, 255, 255
purple = 255, 0, 255 #bluered
yellow = 255, 255, 0 #redgreen
seagreen = 127, 255, 127... | black = (0, 0, 0)
white = (255, 255, 255)
blue = (0, 0, 255)
red = (255, 0, 0)
green = (0, 255, 0)
gray = (127, 127, 127)
lightblue = (0, 255, 255)
purple = (255, 0, 255)
yellow = (255, 255, 0)
seagreen = (127, 255, 127)
mauve = (255, 127, 127)
violet = (127, 127, 255)
lightgray = (190, 190, 190)
bluegreen = (0, 127, 1... |
# Copyright 2018 Arkady Shtempler.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | grep_string = ' ERROR '
result_dir = 'LogTool_Result_Files'
overcloud_logs_dir = '/var/log/containers'
undercloud_logs_dir = ['/var/log/containers', '/home/stack']
overcloud_ssh_user = 'heat-admin'
overcloud_ssh_key = '/home/stack/.ssh/id_rsa'
overcloud_home_dir = '/home/' + overcloud_ssh_user + '/'
source_rc_file_path... |
ix.enable_command_history()
ix.application.select_next_instances(False)
ix.disable_command_history() | ix.enable_command_history()
ix.application.select_next_instances(False)
ix.disable_command_history() |
class PointOnCurveMeasurementType(Enum,IComparable,IFormattable,IConvertible):
"""
Point on curve measurement type
Defines the types of measurements that may be used when placing a point at a designated distance along a curve.
enum PointOnCurveMeasurementType,values: Angle (6),ChordLength (5),NonNor... | class Pointoncurvemeasurementtype(Enum, IComparable, IFormattable, IConvertible):
"""
Point on curve measurement type
Defines the types of measurements that may be used when placing a point at a designated distance along a curve.
enum PointOnCurveMeasurementType,values: Angle (6),ChordLength (5),NonNorma... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def skywalking_data_collect_protocol_dependencies():
rules_proto()
com_github_grpc_grpc()
def com_github_grpc_grpc():
http_archive(name='com_github_grpc_grpc', sha256='3ccc4e5ae8c1ce844456e39cc11f1c991a7da74396faabe83d779836ef449bce', ur... |
class Solution:
# @param A: An integers list.
# @return: return any of peek positions.
def findPeak(self, A):
# write your code here
l, r = 1, len(A) - 2
while l <= r:
m = (l + r) / 2
if A[m - 1] >= A[m]:
r = m - 1
elif A[m] <= A[m ... | class Solution:
def find_peak(self, A):
(l, r) = (1, len(A) - 2)
while l <= r:
m = (l + r) / 2
if A[m - 1] >= A[m]:
r = m - 1
elif A[m] <= A[m + 1]:
l = m + 1
else:
return m |
# We are given an array a of length n consisting of integers. We can apply the following operation,
# consisting of several steps, on the array a zero or more times:
# - we select two different numbers in the array a[i] and a[j],
# - we remove i-th and j-th elements from the array.
# For example, if n=6 and a=[1, 6, 1,... | def epic_transformation(T, n):
count = []
for j in range(len(T)):
if T[j] not in count:
count.append([T[j], 0])
for j in range(len(T)):
for k in range(len(count)):
if T[j] == count[k][0]:
count[k][1] += 1
max_amount = 0
for j in range(len(count... |
# Turn on debugging
DEBUG = True
USE_X_SENDFILE = False
| debug = True
use_x_sendfile = False |
# Licensed under MIT license - see LICENSE.rst
"""
This packages contains affiliated package tests.
"""
| """
This packages contains affiliated package tests.
""" |
y=123
y="hola mundo"
#esto es python3
def sumar(a,b):
z=a+b
return z
def restar(a,b):
z=a-b
return z
| y = 123
y = 'hola mundo'
def sumar(a, b):
z = a + b
return z
def restar(a, b):
z = a - b
return z |
{
"includes": [
"../../common.gypi"
],
"variables": {
# This is what happens when you still keep the support for VAX VMS, Xenix, Windows CE and OS/2 in 2021
# Cmon, seriously, the last version of Xenix was in 1989
"UNIX_defines%": [
"CURL_SA_FAMILY_T=sa_family_t",
"GETHOSTNAME_TYPE_ARG2=size_t",
... | {'includes': ['../../common.gypi'], 'variables': {'UNIX_defines%': ['CURL_SA_FAMILY_T=sa_family_t', 'GETHOSTNAME_TYPE_ARG2=size_t', 'HAVE_ALARM=1', 'HAVE_ALLOCA_H=1', 'HAVE_ARPA_INET_H=1', 'HAVE_ARPA_TFTP_H=1', 'HAVE_ASSERT_H=1', 'HAVE_BASENAME=1', 'HAVE_BOOL_T=1', 'HAVE_CONNECT=1', 'HAVE_DECL_GETPWUID_R=1', 'HAVE_DLFC... |
#
# PySNMP MIB module TPLINK-LLDP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-LLDP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:17:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint, constraints_union) ... |
class ModelException(StandardError):
def __init__(self, msg, result=None, **kwargs):
super(self.__class__, self).__init__(msg)
self.msg = msg
self.result = result
self.kwargs = kwargs
def attributes(self):
return dict(self.kwargs)
def as_dict(self):
d = di... | class Modelexception(StandardError):
def __init__(self, msg, result=None, **kwargs):
super(self.__class__, self).__init__(msg)
self.msg = msg
self.result = result
self.kwargs = kwargs
def attributes(self):
return dict(self.kwargs)
def as_dict(self):
d = dic... |
# Write a function
# Problem Link: https://www.hackerrank.com/challenges/write-a-function/problem
def is_leap(year):
leap = False
# Write your logic here
if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
leap = True
return leap
year = int(input())
print(is_leap(year))
| def is_leap(year):
leap = False
if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
leap = True
return leap
year = int(input())
print(is_leap(year)) |
# function that receives two string arguments and checks whether they are same-length strings
# (returns True in this case otherwise false).
def lengthEqual(line1,line2):
return len(line1) == len(line2)
print("Enter the strings for comparison: ")
text1 = input("First string arguement: ")
text2 = input("Second ... | def length_equal(line1, line2):
return len(line1) == len(line2)
print('Enter the strings for comparison: ')
text1 = input('First string arguement: ')
text2 = input('Second string arguement: ')
print(length_equal(text1, text2)) |
# -*- coding: utf-8 -*-
class Bubble:
def __init__(self, x, y, v, c, s):
self.bub_x = x
self.bub_y = y
self.bub_v = v
self.bub_c = c
self.bub_s = s
def update(self):
self.bub_y -= self.bub_s
| class Bubble:
def __init__(self, x, y, v, c, s):
self.bub_x = x
self.bub_y = y
self.bub_v = v
self.bub_c = c
self.bub_s = s
def update(self):
self.bub_y -= self.bub_s |
def validByteHexString(theString):
if isinstance(theString, str) and len(theString) == 4 and theString[0:2] == "0x":
return True
else:
return False
commandType = " "
while not validByteHexString(commandType):
commandType = input("""Enter a command type\n 0x01 : No-Op\n 0x02 : Reset\n 0x03 ... | def valid_byte_hex_string(theString):
if isinstance(theString, str) and len(theString) == 4 and (theString[0:2] == '0x'):
return True
else:
return False
command_type = ' '
while not valid_byte_hex_string(commandType):
command_type = input('Enter a command type\n 0x01 : No-Op\n 0x02 : Reset\n... |
# -*- coding:utf-8 -*-
class Solution:
def Permutation(self, ss):
# write code here
if len(ss) == 0:
return []
ss = sorted(list(ss))
used = [False] * len(ss)
self.ans = []
def dfs(temp,used):
if len(temp) == len(ss):
self.ans.ap... | class Solution:
def permutation(self, ss):
if len(ss) == 0:
return []
ss = sorted(list(ss))
used = [False] * len(ss)
self.ans = []
def dfs(temp, used):
if len(temp) == len(ss):
self.ans.append(''.join(temp))
return
... |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def assert_sudoku_by_column(board: list) -> bool:
row_length = len(board[0])
for i in range(0, row_length):
col = set()
for row in board:
col.add(row[i])
i... | def assert_sudoku_by_column(board: list) -> bool:
row_length = len(board[0])
for i in range(0, row_length):
col = set()
for row in board:
col.add(row[i])
if len(col) != row_length:
print('assert_sudoku_by_column')
return False
return True |
# coding: utf8
REPO_URL = 'https://github.com/baijiangliang/year2018'
GIT_EMAIL_CMD = 'git config --get user.email'
CHECK_GIT_DIR_CMD = 'git rev-parse --is-inside-work-tree'
GIT_COMMIT_SEPARATOR = 'git-commit-separator'
GIT_LOG_FORMAT = GIT_COMMIT_SEPARATOR + '%H%n%P%n%an%n%ae%n%at%n%s%n'
GIT_REMOTE_URL_CMD = 'git co... | repo_url = 'https://github.com/baijiangliang/year2018'
git_email_cmd = 'git config --get user.email'
check_git_dir_cmd = 'git rev-parse --is-inside-work-tree'
git_commit_separator = 'git-commit-separator'
git_log_format = GIT_COMMIT_SEPARATOR + '%H%n%P%n%an%n%ae%n%at%n%s%n'
git_remote_url_cmd = 'git config --get remote... |
n, q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n - 1)]
cd = [list(map(int, input().split())) for _ in range(q)]
r = [[] for _ in range(n)]
for i, j in ab:
r[i - 1].append(j - 1)
r[j - 1].append(i - 1)
a = [0] * n
b = [(0, 0)]
c = [False] * n
c[0] = True
while b:
i, j =... | (n, q) = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n - 1)]
cd = [list(map(int, input().split())) for _ in range(q)]
r = [[] for _ in range(n)]
for (i, j) in ab:
r[i - 1].append(j - 1)
r[j - 1].append(i - 1)
a = [0] * n
b = [(0, 0)]
c = [False] * n
c[0] = True
while b:
(i... |
def Function(x, y, q):
q = ''
print('Enter coordinate x')
x = int(input(''))
print('Enter coordinate y')
y = int(input(''))
if (x>0) and (y>0):
q = 'Point is located in the first quarter'
return q
elif (x<0) and (y>0):
q = 'Point is located in the second quarter'
... | def function(x, y, q):
q = ''
print('Enter coordinate x')
x = int(input(''))
print('Enter coordinate y')
y = int(input(''))
if x > 0 and y > 0:
q = 'Point is located in the first quarter'
return q
elif x < 0 and y > 0:
q = 'Point is located in the second quarter'
... |
def getInput():
test_cases = int(input())
counter = 0
input_numbers = []
while counter < test_cases:
input_numbers.append(input())
counter += 1
return input_numbers
def checkIfOddDigitPresent(number):
for digit in str(number):
if int(digit) % 2 != 0:
retur... | def get_input():
test_cases = int(input())
counter = 0
input_numbers = []
while counter < test_cases:
input_numbers.append(input())
counter += 1
return input_numbers
def check_if_odd_digit_present(number):
for digit in str(number):
if int(digit) % 2 != 0:
ret... |
"""
CSC131 - Computational Thinking
Missouri State University, Spring 2018
Lab 6 - BMI Calculator
@author: # TODO: Replace this comment with your contact information in Your Name <email@live.missouristate.edu> format.
"""
class Calculator(object):
"""
Base class of a calculator hierarchy.
NOTE: DO NOT mo... | """
CSC131 - Computational Thinking
Missouri State University, Spring 2018
Lab 6 - BMI Calculator
@author: # TODO: Replace this comment with your contact information in Your Name <email@live.missouristate.edu> format.
"""
class Calculator(object):
"""
Base class of a calculator hierarchy.
NOTE: DO NOT mod... |
# A - B
# B - A
# C - @
# D
# E
# F
with open('flag.enc', 'rb') as f:
data = f.read()[1::2]
with open('flag.dec', 'wb') as f:
f.write(data)
| with open('flag.enc', 'rb') as f:
data = f.read()[1::2]
with open('flag.dec', 'wb') as f:
f.write(data) |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | pack_virtualenv_doesnt_exist = '\nVirtual environment for pack "%s" doesn\'t exist. If you haven\'t installed a pack using\n"packs.install" command, you can create a new virtual environment using\n"st2 run packs.setup_virtualenv packs=%s" command\'\n' |
"""Read the Docs."""
__version__ = "8.1.0"
| """Read the Docs."""
__version__ = '8.1.0' |
# --------------------------------------------------------------- Imports ---------------------------------------------------------------- #
# System
# Pip
# Local
# ---------------------------------------------------------------------------------------------------------------------------------------- #
# ---... | class Coingecko:
def __init__(self):
return |
ACCESS_TOKEN=""#enter your ACCESS TOKEn
ACCESS_TOKEN_SECRET=""#Enter your access token secret
CONSUMER_KEY=""#enter your consumer or api key
CONSUMER_SECERT=""#enter you consumer secret or api secret
| access_token = ''
access_token_secret = ''
consumer_key = ''
consumer_secert = '' |
class Document:
def __init__(self, path):
self.path = path
#self.word_list = []
#self.parse_words()
self.append_lines()
self.token_list = []
self.term_list = []
"""def parse_words(self):
with open(self.path, "r") as f:
for line in f.readlines():
self.word_list.extend(line.strip().split())"""
... | class Document:
def __init__(self, path):
self.path = path
self.append_lines()
self.token_list = []
self.term_list = []
'def parse_words(self):\n\t\twith open(self.path, "r") as f:\n\t\t\tfor line in f.readlines():\n\t\t\t\tself.word_list.extend(line.strip().split())'
def a... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 10 14:34:10 2021
@author: Korean_Crimson
"""
PORT = 5555
CHUNKSIZE = 2048
MAX_CLIENTS = 2
MAX_CHAT_RESP = 5
TIMEOUT = 5 #seconds
| """
Created on Mon May 10 14:34:10 2021
@author: Korean_Crimson
"""
port = 5555
chunksize = 2048
max_clients = 2
max_chat_resp = 5
timeout = 5 |
def reverse(text):
output = list(text)
output.reverse()
return "".join(output)
| def reverse(text):
output = list(text)
output.reverse()
return ''.join(output) |
try: common.weather_location
except:
weatherLocation = settings.settings.value("data/WeatherLocation")
if not weatherLocation:
location = QInputDialog.getText(self, "Location", "Enter your current location here:")
if location[1]:
common.weather_location = location[0]
sett... | try:
common.weather_location
except:
weather_location = settings.settings.value('data/WeatherLocation')
if not weatherLocation:
location = QInputDialog.getText(self, 'Location', 'Enter your current location here:')
if location[1]:
common.weather_location = location[0]
... |
# Copyright 2020 The Monogon Project Authors.
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | def _build_pure_transition_impl(settings, attr):
"""
Transition that enables pure, static build of Go binaries.
"""
return {'@io_bazel_rules_go//go/config:pure': True, '@io_bazel_rules_go//go/config:static': True}
build_pure_transition = transition(implementation=_build_pure_transition_impl, inputs=[], ... |
def gen_fibonacci():
a, b = 0, 1
while True:
yield a
a, b = b, a + b
fi = gen_fibonacci()
for i in range(20):
print(fi.next())
| def gen_fibonacci():
(a, b) = (0, 1)
while True:
yield a
(a, b) = (b, a + b)
fi = gen_fibonacci()
for i in range(20):
print(fi.next()) |
#!/usr/bin/python
# -*- coding: utf-8 -*-
lib_file = open('/srv/http/.config/cmus/lib.pl', encoding='UTF-8') # errors can occurs if there is no encoding parameter
tracks = lib_file.readlines()
library = []
for x in tracks:
library.append(x)
for x in library: # DEBUG MODE
print('<li>' + x.split('/home/arle... | lib_file = open('/srv/http/.config/cmus/lib.pl', encoding='UTF-8')
tracks = lib_file.readlines()
library = []
for x in tracks:
library.append(x)
for x in library:
print('<li>' + x.split('/home/arlen/Music/Rock_Metal/')[1] + '</li>') |
n1 = float(input('Digite uma distancia em metros: '))
print('adistancia {}m corresponde ha:'.format(n1))
print('{:.3f}km'.format(n1/1000))
print('{}Cm'.format(n1*100))
print('{}Mm'.format(n1*1000))
| n1 = float(input('Digite uma distancia em metros: '))
print('adistancia {}m corresponde ha:'.format(n1))
print('{:.3f}km'.format(n1 / 1000))
print('{}Cm'.format(n1 * 100))
print('{}Mm'.format(n1 * 1000)) |
name = "ffmpeg"
version = "3.2.4"
authors = [
"FFMPEG"
]
description = \
"""
FFMPEG.
"""
build_requires = [
]
variants = [
["platform-linux", "arch-x86_64", "os-CentOS-7"]
]
tools = [
"ffmpeg",
"ffmpeg-10bit",
"ffserver",
"qt-quickstart"
"ffprobe",
]
uuid = "ffmpeg"
def c... | name = 'ffmpeg'
version = '3.2.4'
authors = ['FFMPEG']
description = '\n FFMPEG.\n '
build_requires = []
variants = [['platform-linux', 'arch-x86_64', 'os-CentOS-7']]
tools = ['ffmpeg', 'ffmpeg-10bit', 'ffserver', 'qt-quickstartffprobe']
uuid = 'ffmpeg'
def commands():
env.PATH.append('{root}/bin') |
def test_component_in_pipeline(base_parser):
assert "conll_formatter" in base_parser.pipe_names, (
f"{'conll_formatter'} is not a component in the parser's pipeline."
" This indicates that something went wrong while registering the component in the utils.init_nlp function."
" This does not n... | def test_component_in_pipeline(base_parser):
assert 'conll_formatter' in base_parser.pipe_names, f"{'conll_formatter'} is not a component in the parser's pipeline. This indicates that something went wrong while registering the component in the utils.init_nlp function. This does not necessarily mean that the compone... |
class Solution:
def wallsAndGates(self, rooms):
"""
:type rooms: List[List[int]]
:rtype: void Do not return anything, modify rooms in-place instead.
"""
if not any(rooms): return
queue = collections.deque()
for i, row in enumerate(rooms):
for j, va... | class Solution:
def walls_and_gates(self, rooms):
"""
:type rooms: List[List[int]]
:rtype: void Do not return anything, modify rooms in-place instead.
"""
if not any(rooms):
return
queue = collections.deque()
for (i, row) in enumerate(rooms):
... |
# -*- test-case-name: calculus.test.test_base_2 -*-
class Calculation(object):
def add(self, a, b):
return a + b
def subtract(self, a, b):
return a - b
def multiply(self, a, b):
return a * b
def divide(self, a, b):
return a / b
| class Calculation(object):
def add(self, a, b):
return a + b
def subtract(self, a, b):
return a - b
def multiply(self, a, b):
return a * b
def divide(self, a, b):
return a / b |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 4 19:51:18 2016
@author: ericgrimson
"""
class fraction(object):
def __init__(self, numer, denom):
self.numer = numer
self.denom = denom
def __str__(self):
return str(self.numer) + ' / ' + str(self.denom)
def getNumer(self):
r... | """
Created on Sat Jun 4 19:51:18 2016
@author: ericgrimson
"""
class Fraction(object):
def __init__(self, numer, denom):
self.numer = numer
self.denom = denom
def __str__(self):
return str(self.numer) + ' / ' + str(self.denom)
def get_numer(self):
return self.numer
... |
# Created by MechAviv
# Map ID :: 931050910
# Peacetime Edelstein : Edelstein Outskirts 2
sm.hideUser(True)
sm.forcedInput(0)
sm.forcedInput(2)
sm.sendDelay(30)
sm.forcedInput(0)
OBJECT_1 = sm.sendNpcController(2159369, -1050, -30)
sm.showNpcSpecialActionByObjectId(OBJECT_1, "summon", 0)
OBJECT_2 = sm.sendNpcControl... | sm.hideUser(True)
sm.forcedInput(0)
sm.forcedInput(2)
sm.sendDelay(30)
sm.forcedInput(0)
object_1 = sm.sendNpcController(2159369, -1050, -30)
sm.showNpcSpecialActionByObjectId(OBJECT_1, 'summon', 0)
object_2 = sm.sendNpcController(2159376, -1800, -30)
sm.showNpcSpecialActionByObjectId(OBJECT_2, 'summon', 0)
sm.moveNpcB... |
{
"targets": [
{
"target_name": "compress",
"sources": [ "compress.cc" ],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
"cflags": ["-g"]
}
]
}
| {'targets': [{'target_name': 'compress', 'sources': ['compress.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'cflags': ['-g']}]} |
# -*- coding: utf-8 -*-
"""
example.config.py
"""
# --------------------------------------------------------------------
# Config
# --------------------------------------------------------------------
config = {}
config['webapp2_extras.jinja2'] = {
'template_path': 'example/templates',
'compiled_path': None... | """
example.config.py
"""
config = {}
config['webapp2_extras.jinja2'] = {'template_path': 'example/templates', 'compiled_path': None, 'force_compiled': False, 'environment_args': {'auto_reload': True, 'autoescape': True, 'extensions': ['jinja2.ext.autoescape', 'jinja2.ext.with_', 'babushka.cache']}, 'globals': {'uri_f... |
class GumballMachine:
def __init__(self, number_gumballs) -> None:
self.no_quarter_state = NoQuarterState(self)
self.sold_out_state = SoldOutState(self)
self.has_quarter_state = HasQuarterState(self)
self.sold_state = SoldState(self)
self.count = number_gumballs
if nu... | class Gumballmachine:
def __init__(self, number_gumballs) -> None:
self.no_quarter_state = no_quarter_state(self)
self.sold_out_state = sold_out_state(self)
self.has_quarter_state = has_quarter_state(self)
self.sold_state = sold_state(self)
self.count = number_gumballs
... |
class Solution(object):
def findTargetSumWays(self, nums, S):
"""
:type nums: List[int]
:type S: int
:rtype: int
"""
# works but slow
# sum of elements and num_zeros after the current index
# sumarr, nz = self.sum_arr(nums)
# ans = self.recur(n... | class Solution(object):
def find_target_sum_ways(self, nums, S):
"""
:type nums: List[int]
:type S: int
:rtype: int
"""
ans = self.dp(nums, S)
return ans
def dp(self, nums, target):
dp = {nums[0]: 1}
self.add_to_dict(dp, -nums[0], 1)
... |
"""Chess Knight
"""
def chessKnight(cell):
valid_count = 0
# All possible moves for knight
dirs = [(-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (1, 2), (2, -1), (2, 1)]
# For each move of knight, check if it's valid
for x, y in dirs:
if (97 <= ord(cell[0]) + x <= 104) and (1 <= int(cel... | """Chess Knight
"""
def chess_knight(cell):
valid_count = 0
dirs = [(-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (1, 2), (2, -1), (2, 1)]
for (x, y) in dirs:
if 97 <= ord(cell[0]) + x <= 104 and 1 <= int(cell[1]) + y <= 8:
valid_count += 1
return valid_count |
def as_int(val):
"""
Tries to convert a string to an int.
Returns None if string is empty
"""
try:
return(int(val))
except ValueError:
return(None)
def as_float(val):
"""
Tries to convert a string to an float.
Returns None if string is empty
"""
try:
return(float(val))
except ValueEr... | def as_int(val):
"""
Tries to convert a string to an int.
Returns None if string is empty
"""
try:
return int(val)
except ValueError:
return None
def as_float(val):
"""
Tries to convert a string to an float.
Returns None if string is empty
"""
try:
return float(val)
... |
EXPECTED = {'X683': {'extensibility-implied': False,
'imports': {},
'object-classes': {},
'object-sets': {},
'types': {'IntegerList1': {'members': [{'name': 'elem',
'type': 'INTEGER'},
... | expected = {'X683': {'extensibility-implied': False, 'imports': {}, 'object-classes': {}, 'object-sets': {}, 'types': {'IntegerList1': {'members': [{'name': 'elem', 'type': 'INTEGER'}, {'name': 'next', 'optional': True, 'type': 'IntegerList1'}], 'type': 'SEQUENCE'}, 'OptionallySignedUTF8String': {'members': [{'name': '... |
def _merge(list_1, list_2):
merged = []
ix_1, ix_2 = 0, 0
while all([list_1[ix_1:], list_2[ix_2:]]):
val_1, val_2 = list_1[ix_1], list_2[ix_2]
if val_2 < val_1:
merged.append(val_2)
ix_2 += 1
continue
merged.append(val_1)
ix_1 += 1
... | def _merge(list_1, list_2):
merged = []
(ix_1, ix_2) = (0, 0)
while all([list_1[ix_1:], list_2[ix_2:]]):
(val_1, val_2) = (list_1[ix_1], list_2[ix_2])
if val_2 < val_1:
merged.append(val_2)
ix_2 += 1
continue
merged.append(val_1)
ix_1 += 1
... |
#
# PySNMP MIB module ASCEND-MIBTRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBTRAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:12:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration')
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint... |
"""
Module:
table_class.py
This is the Table class implementation.
A Table object:
1. Will have two players playing upon and a dictionary tracking player names
and cards they drop on the table during the War rounds.
2. __str__() dunder: returns players and their last card on the table.
3. get_cards(...) method: take c... | """
Module:
table_class.py
This is the Table class implementation.
A Table object:
1. Will have two players playing upon and a dictionary tracking player names
and cards they drop on the table during the War rounds.
2. __str__() dunder: returns players and their last card on the table.
3. get_cards(...) method: take c... |
div = 0
res = 0
for x in reversed(range(2, 39)):
div += 1
res += ((x - 1) + (x)) / div
print(((" +") if (div != 1) else ""), f" ({x - 1} * {x}/ {div})", end="")
print("\nResultado = " + str(res)) | div = 0
res = 0
for x in reversed(range(2, 39)):
div += 1
res += (x - 1 + x) / div
print(' +' if div != 1 else '', f' ({x - 1} * {x}/ {div})', end='')
print('\nResultado = ' + str(res)) |
DatabaseABI = [
{
"inputs": [
{
"internalType": "address",
"name": "factoryAddress",
"type": "address"
},
{
"internalType": "address",
"name": "creatorAddress",
"type": "address"
}
],
"stateMutability": "n... | database_abi = [{'inputs': [{'internalType': 'address', 'name': 'factoryAddress', 'type': 'address'}, {'internalType': 'address', 'name': 'creatorAddress', 'type': 'address'}], 'stateMutability': 'nonpayable', 'type': 'constructor'}, {'anonymous': False, 'inputs': [{'indexed': True, 'internalType': 'address', 'name': '... |
def FitModel(X, Y, algorithm, gridSearchParams, cv):
"""Split, take a dict of gridsearch params,"""
np.random.seed(10)
x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size = 0.2)
grid = GridSearchCV(
estimator=algorithm,
param_grid=gridSearchParams,
cv=cv,
... | def fit_model(X, Y, algorithm, gridSearchParams, cv):
"""Split, take a dict of gridsearch params,"""
np.random.seed(10)
(x_train, x_test, y_train, y_test) = train_test_split(X, Y, test_size=0.2)
grid = grid_search_cv(estimator=algorithm, param_grid=gridSearchParams, cv=cv, scoring='accuracy', verbose=1,... |
def main():
addition = 0
addition = compute_sum()
print("The sum is:", addition)
def prompt_number():
number = -1
while(number < 0):
number = int(input("Enter a positive number: "))
if number < 0:
print("Invalid entry. The number must be positive.")
retur... | def main():
addition = 0
addition = compute_sum()
print('The sum is:', addition)
def prompt_number():
number = -1
while number < 0:
number = int(input('Enter a positive number: '))
if number < 0:
print('Invalid entry. The number must be positive.')
return pro... |
heritage_url = None
backend_url = 'https://www.yeastgenome.org/webservice'
secret_key = 'secret key here'
sender = 'email address here'
author_response_file = 'file with full path here'
compute_url = ''
# elasticsearch_address = 'http://localhost:9200'
elasticsearch_address = 'http://ec2-34-221-214-103.us-west-2.comput... | heritage_url = None
backend_url = 'https://www.yeastgenome.org/webservice'
secret_key = 'secret key here'
sender = 'email address here'
author_response_file = 'file with full path here'
compute_url = ''
elasticsearch_address = 'http://ec2-34-221-214-103.us-west-2.compute.amazonaws.com:9200'
log_directory = None |
class Solution(object):
def canFormArray(self, arr, pieces):
"""leet_arrayformationcheck.py
:type arr: List[int]
:type pieces: List[List[int]]
:rtype: bool
"""
i = 0
length = len(arr)
pieces_ = sorted(pieces, key=len, reverse=True)
used = {tupl... | class Solution(object):
def can_form_array(self, arr, pieces):
"""leet_arrayformationcheck.py
:type arr: List[int]
:type pieces: List[List[int]]
:rtype: bool
"""
i = 0
length = len(arr)
pieces_ = sorted(pieces, key=len, reverse=True)
used = {t... |
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
shortnames = [ "Aql","And","Scl","Ara","Lib","Cet","Ari","Sct","Pyx","Boo","Cae","Cha","Cnc","Cap","Car","Cas","Cen","Cep","Com","Cvn","Aur","Col","Cir","Crt","CrA","CrB","Crv","Cru","Cyg","Del","Dor","Dra","N... | shortnames = ['Aql', 'And', 'Scl', 'Ara', 'Lib', 'Cet', 'Ari', 'Sct', 'Pyx', 'Boo', 'Cae', 'Cha', 'Cnc', 'Cap', 'Car', 'Cas', 'Cen', 'Cep', 'Com', 'Cvn', 'Aur', 'Col', 'Cir', 'Crt', 'CrA', 'CrB', 'Crv', 'Cru', 'Cyg', 'Del', 'Dor', 'Dra', 'Nor', 'Eri', 'Sge', 'For', 'Gem', 'Cam', 'CMa', 'UMa', 'Gru', 'Her', 'Hor', 'Hya'... |
User.objects.create(email='instructor1@bogus.com', password='boguspwd')
User.objects.create(email='instructor2@bogus.com', password='boguspwd')
User.objects.create(email='instructor3@bogus.com', password='boguspwd')
User.objects.create(email='student1@bogus.com', password='boguspwd')
User.objects.create(email='student2... | User.objects.create(email='instructor1@bogus.com', password='boguspwd')
User.objects.create(email='instructor2@bogus.com', password='boguspwd')
User.objects.create(email='instructor3@bogus.com', password='boguspwd')
User.objects.create(email='student1@bogus.com', password='boguspwd')
User.objects.create(email='student2... |
# bitoperations are fun, not that efficiency would be significant
def encode(number):
if number < 0:
return None
if number == 0:
return b'\x00'
varint_bytes = []
while number > 0:
varint_bytes.append((number & 0x7f) | 0x80)
number >>= 7
varint_bytes[-1] &= 0x7f
... | def encode(number):
if number < 0:
return None
if number == 0:
return b'\x00'
varint_bytes = []
while number > 0:
varint_bytes.append(number & 127 | 128)
number >>= 7
varint_bytes[-1] &= 127
return bytes(varint_bytes)
def decode(varint):
if check_encoded(vari... |
# -*- coding: utf-8 -*-
int_types = (int, type(1<<128))
katex_function = []
class Expr(object):
def __new__(self, arg=None, symbol_name=None):
if isinstance(arg, Expr):
return arg
self = object.__new__(Expr)
self._symbol = None
self._integer = None
self._text ... | int_types = (int, type(1 << 128))
katex_function = []
class Expr(object):
def __new__(self, arg=None, symbol_name=None):
if isinstance(arg, Expr):
return arg
self = object.__new__(Expr)
self._symbol = None
self._integer = None
self._text = None
self._arg... |
def tmx(tileset_images, tiles):
return '''<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="94" height="79" tilewidth="256" tileheight="256" nextobjectid="1">
<tileset firstgid="1" name="all" tilewidth="256" tileheight="256" tilecount="7426" columns... | def tmx(tileset_images, tiles):
return '<?xml version="1.0" encoding="UTF-8"?>\n<map version="1.0" orientation="orthogonal" renderorder="right-down" width="94" height="79" tilewidth="256" tileheight="256" nextobjectid="1">\n <tileset firstgid="1" name="all" tilewidth="256" tileheight="256" tilecount="7426" columns... |
def rule30(list_, n):
res=[0]+list_+[0]
for i in range(n):
temp=res[:]
for j,k in enumerate(res):
if j==0:
res[j]=(k or temp[j+1])
elif j==len(temp)-1:
res[j]=temp[j-1]^(k)
else:
res[j]=temp[j-1]^(k or temp[j+1])... | def rule30(list_, n):
res = [0] + list_ + [0]
for i in range(n):
temp = res[:]
for (j, k) in enumerate(res):
if j == 0:
res[j] = k or temp[j + 1]
elif j == len(temp) - 1:
res[j] = temp[j - 1] ^ k
else:
res[j] = t... |
def resolve():
'''
code here
'''
N = int(input())
A_list = [int(item) for item in input().split()]
Q = int(input())
queries = [[int(item) for item in input().split()] for _ in range(Q)]
memo = [0 for _ in range(10**5+1)]
for item in A_list:
memo[item] += 1
bas... | def resolve():
"""
code here
"""
n = int(input())
a_list = [int(item) for item in input().split()]
q = int(input())
queries = [[int(item) for item in input().split()] for _ in range(Q)]
memo = [0 for _ in range(10 ** 5 + 1)]
for item in A_list:
memo[item] += 1
base = sum(... |
class SinanError(Exception):
""" A very simple exception class to use as a base
exception class for the sinan client """
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class ParseError(SinanError):
""" A very simple exception class to use... | class Sinanerror(Exception):
""" A very simple exception class to use as a base
exception class for the sinan client """
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Parseerror(SinanError):
""" A very simple exception class to use ... |
"""
Merge Intervals
You are given an array of intervals.
Each interval is defined as: (start, end). e.g. (2, 5)
It represents all the integer numbers in the interval, including start and end. (in the example 2, 3, 4 and 5).
Given the array of intervals find the smallest set of unique intervals that contain the same in... | """
Merge Intervals
You are given an array of intervals.
Each interval is defined as: (start, end). e.g. (2, 5)
It represents all the integer numbers in the interval, including start and end. (in the example 2, 3, 4 and 5).
Given the array of intervals find the smallest set of unique intervals that contain the same in... |
# level design by Michael Abel
# .................................................................................................................
def func_sand():
sys.stdout = KConsole
sys.stderr = KConsole
def switched():
unoccupied=False
for (i,j) in [ (i,j) for i in range(3,6) for j in range(3,6) ]:
if... | def func_sand():
sys.stdout = KConsole
sys.stderr = KConsole
def switched():
unoccupied = False
for (i, j) in [(i, j) for i in range(3, 6) for j in range(3, 6)]:
if world.isUnoccupiedPos(kiki_pos(i, j, 0)):
unoccupied = True
if not unoccupied:
... |
with open("input.txt") as file:
lines = file.read().split("\n")
nums = [int(n) for n in lines[0].split(",")]
numbers = {}
for i,number in enumerate(nums):
numbers[number] = [i]
last_number = number
i = len(numbers)
while True:
if last_number not in numbers:
next_number = 0
if nex... | with open('input.txt') as file:
lines = file.read().split('\n')
nums = [int(n) for n in lines[0].split(',')]
numbers = {}
for (i, number) in enumerate(nums):
numbers[number] = [i]
last_number = number
i = len(numbers)
while True:
if last_number not in numbers:
next_number = 0
if next... |
"""
This code generates a unix bash script
for running the C++ generated program
with the selected set of parameters for
p: patterns (integer)
K: connectivity (integer)
nns: number of modules (list of integers)
topos: topologies (list from ['r', 'c', 'x'])
r: Ring, c: Cross, 'x': X topologies
ws... | """
This code generates a unix bash script
for running the C++ generated program
with the selected set of parameters for
p: patterns (integer)
K: connectivity (integer)
nns: number of modules (list of integers)
topos: topologies (list from ['r', 'c', 'x'])
r: Ring, c: Cross, 'x': X topologies
ws... |
_base_ = [
'../_test_/models/resnet18_simsiam_dimcollapse_lpips.py',
'../_test_/datasets/imagenet1p5r_mocov2_wori_b64_cluster.py',
'../_test_/schedules/sgd_coslr-200e_in30p_kd.py',
'../_test_/default_runtime.py',
]
# set base learning rate
optimizer_config = dict() # grad_clip, coalesce, bucket_size_m... | _base_ = ['../_test_/models/resnet18_simsiam_dimcollapse_lpips.py', '../_test_/datasets/imagenet1p5r_mocov2_wori_b64_cluster.py', '../_test_/schedules/sgd_coslr-200e_in30p_kd.py', '../_test_/default_runtime.py']
optimizer_config = dict()
lr = 0.003
custom_hooks = [dict(type='SimSiamHook', priority='HIGH', fix_pred_lr=T... |
a = 1
while a:
a = int(input())
ans = a * (a + 1) * (2 * a + 1) // 6
print(ans)
| a = 1
while a:
a = int(input())
ans = a * (a + 1) * (2 * a + 1) // 6
print(ans) |
# OPTIMISED BUBBLE SORT.
def BubbleSort(A):
swapped = 1
for i in range(len(A)):
if (swapped == 0):
return
for k in range(len(A) - 1, i, -1):
if (A[k] < A[k - 1]):
swap(A, k, k - 1)
swapped = 1
def swap(A, x, y):
temp = A[x]
A[x]... | def bubble_sort(A):
swapped = 1
for i in range(len(A)):
if swapped == 0:
return
for k in range(len(A) - 1, i, -1):
if A[k] < A[k - 1]:
swap(A, k, k - 1)
swapped = 1
def swap(A, x, y):
temp = A[x]
A[x] = A[y]
A[y] = temp
a = [12... |
#
# PySNMP MIB module INTEL-LOG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INTEL-LOG-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:43:19 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ... |
def display_message():
print("I learn how to use function in this chapter.")
display_message()
| def display_message():
print('I learn how to use function in this chapter.')
display_message() |
# Created by http:#oleddisplay.squix.ch/ Consider a donation
# In case of problems make sure that you are using the font file with the correct version!
SansSerif_plain_11Bitmaps = [
# Bitmap Data:
0x00, # ' '
0xAA,0xA2, # '!'
0xAA,0xA0, # '"'
0x12,0x0A,0x1F,0xC4,0x82,0x47,0xF0,0xA0,0x90, # '#'
0x21,0xEA,0x28,0x70... | sans_serif_plain_11_bitmaps = [0, 170, 162, 170, 160, 18, 10, 31, 196, 130, 71, 240, 160, 144, 33, 234, 40, 112, 162, 188, 32, 128, 98, 37, 9, 65, 160, 11, 5, 33, 72, 140, 48, 36, 16, 12, 9, 20, 83, 16, 246, 168, 82, 73, 36, 136, 145, 36, 146, 144, 34, 167, 28, 168, 128, 16, 16, 16, 254, 16, 16, 16, 160, 224, 128, 17, ... |
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | def argn(*args):
"""Returs the last argument. Helpful in making lambdas do more than one thing."""
return args[-1]
def arg1(*args):
"""Returs args[0]. Helpful in making lambdas do more than one thing."""
return args[0]
def argif(cond, if_true_value, else_value):
"""
If cond is true, returns the ... |
def test_proc_req():
""" Test cases
1. Empty url -> requests error
2. Invalid url -> requests error
3. No tags -> error
4. Empty tag -> return empty dict
5. Invalid tag -> return empty dict
6. No internet connection -> requests error
7. Malformed html/xml ->
"""
test_ok = 0
... | def test_proc_req():
""" Test cases
1. Empty url -> requests error
2. Invalid url -> requests error
3. No tags -> error
4. Empty tag -> return empty dict
5. Invalid tag -> return empty dict
6. No internet connection -> requests error
7. Malformed html/xml ->
"""
test_ok = 0
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Website Portal for Sales',
'category': 'Website',
'summary': 'Add your sales document in the frontend portal (sales order, quotations, invoices)',
'version': '1.0',
'description': """
Add y... | {'name': 'Website Portal for Sales', 'category': 'Website', 'summary': 'Add your sales document in the frontend portal (sales order, quotations, invoices)', 'version': '1.0', 'description': '\nAdd your sales document in the frontend portal. Your customers will be able to connect to their portal to see the list (and the... |
#! /usr/bin/env python3
# counts the number of regions in a matrix
# vertically and horizontally connected
# e.g.
# [1, 0, 1, 1]
# [0, 1, 0, 0]
# [1, 1, 0, 1]
# has 4 regions
class Patch(object):
def __init__(self, visited, value):
self.visited = visited
self.value = value
def __repr__(self)... | class Patch(object):
def __init__(self, visited, value):
self.visited = visited
self.value = value
def __repr__(self):
return 'visited = %s, value = %s' % (self.visited, self.value)
def initialize(region):
for row in region:
yield [patch(visited=False, value=field) for fie... |
def mermaid(doc, name, content, width=1024):
j = doc.docsite._j
# TODO: *4 needs to be redone to use mermaid pure in javascript
return "TODO: *4 mermaid macro not implemented yet"
| def mermaid(doc, name, content, width=1024):
j = doc.docsite._j
return 'TODO: *4 mermaid macro not implemented yet' |
editionMap = {
"Greece": "el_gr",
"Indonesia": "id_id",
"Romania": "ro_ro",
"Philippines": "en_ph",
"Zimbabwe": "en_zw",
"Sweden": "sv_se",
"Saudi Arabia": "ar_sa",
"Australia": "au",
"Belgium (Dutch)": "nl_be",
"Hungary": "hu_hu",
"Chile": "es_cl",
"Belgium (French)": "f... | edition_map = {'Greece': 'el_gr', 'Indonesia': 'id_id', 'Romania': 'ro_ro', 'Philippines': 'en_ph', 'Zimbabwe': 'en_zw', 'Sweden': 'sv_se', 'Saudi Arabia': 'ar_sa', 'Australia': 'au', 'Belgium (Dutch)': 'nl_be', 'Hungary': 'hu_hu', 'Chile': 'es_cl', 'Belgium (French)': 'fr_be', 'Mexico': 'es_mx', 'Hong Kong': 'hk', 'Tu... |
''' Handling Exceptions (Errors)
'''
# print(x) # Traceback (most recent call last):
# File "/home/rich/Desktop/CarlsHub/Comprehensive-Python/ClassFiles/ErrorsExceptionsHandling/Errors.py", line 11, in <module>
# print(x)
# NameError: name 'x' is not defined
... | """ Handling Exceptions (Errors)
"""
x = 20
try:
print(x)
except:
print('Variable is not defined.')
else:
print('Hello')
finally:
print('You may get an error if no variable is specified') |
def solve(a, b):
m, n = len(a), len(b)
cache = [[0 for __ in range(m + 1)] for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if a[j - 1] == b[i - 1]:
cache[i][j] = cache[i - 1][j - 1] + 1
else:
cache[i][j] = max(cache... | def solve(a, b):
(m, n) = (len(a), len(b))
cache = [[0 for __ in range(m + 1)] for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if a[j - 1] == b[i - 1]:
cache[i][j] = cache[i - 1][j - 1] + 1
else:
cache[i][j] = max(cac... |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
if len(A) < 3:
return 0
A = sorted(A)
product_A = A[0] * A[1] * A[-1]
product_B = A[-1] * A[-2] * A[-3]
max_product = max(product_A, product_B... | def solution(A):
if len(A) < 3:
return 0
a = sorted(A)
product_a = A[0] * A[1] * A[-1]
product_b = A[-1] * A[-2] * A[-3]
max_product = max(product_A, product_B)
return max_product |
# The MIT License (MIT)
#
# Copyright (c) 2017 Michael McWethy for Adafruit Inc
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | """
`colorutility`
====================================================
Helper functions for color calculations
* Author(s): Michael McWethy
"""
__version__ = '0.0.0-auto.0'
__repo__ = 'https://github.com/adafruit/Adafruit_CircuitPython_APDS9960.git'
def calculate_color_temperature(r, g, b):
"""Converts the raw ... |
'''
Problem 017
If the numbers 1 to 5 are written out in words: one, two, three, four, five,
then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in
words, how many letters would be used?
NOTE: Do not count spaces or hyphens. ... | """
Problem 017
If the numbers 1 to 5 are written out in words: one, two, three, four, five,
then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in
words, how many letters would be used?
NOTE: Do not count spaces or hyphens. ... |
class Config(object):
def __init__(self):
self.servers = [
"127.0.0.1"
]
self.keyspace = 'at_inappscoring'
| class Config(object):
def __init__(self):
self.servers = ['127.0.0.1']
self.keyspace = 'at_inappscoring' |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"request_headers": "00_core.ipynb",
"get_as_raw_json": "00_core.ipynb",
"get_next_as_raw_json": "00_core.ipynb",
"timestamp_now": "00_core.ipynb",
"new_bundle": "00_core.ip... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'request_headers': '00_core.ipynb', 'get_as_raw_json': '00_core.ipynb', 'get_next_as_raw_json': '00_core.ipynb', 'timestamp_now': '00_core.ipynb', 'new_bundle': '00_core.ipynb', 'new_list': '00_core.ipynb', 'extract_references_from_resource': '00_co... |
palavras = ('aprender', 'programar', 'Linguagem', 'python',
'cruso', 'gratis', 'estudar', 'praticar',
'trabalhar', 'mercado', 'programador', 'futuro')
for p in palavras: # para cada palavra dentro do array de palavra
print(f'\nNa palavra {p.upper()} temos', end='')
for letra in p: # para... | palavras = ('aprender', 'programar', 'Linguagem', 'python', 'cruso', 'gratis', 'estudar', 'praticar', 'trabalhar', 'mercado', 'programador', 'futuro')
for p in palavras:
print(f'\nNa palavra {p.upper()} temos', end='')
for letra in p:
if letra.lower() in 'aeiou':
print(letra, end=' ') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.