content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def max(data):
maxVal = 0
for i in data:
if maxVal < i:
maxVal = i
return maxVal
def min(data):
minVal = -1
for i in data:
if minVal == -1 or minVal > i:
minVal = i
return minVal
def mean(data):
sum = 0
for i in data:
sum += i
return ... | def max(data):
max_val = 0
for i in data:
if maxVal < i:
max_val = i
return maxVal
def min(data):
min_val = -1
for i in data:
if minVal == -1 or minVal > i:
min_val = i
return minVal
def mean(data):
sum = 0
for i in data:
sum += i
ret... |
"""
A thin logger. Will be replaced by logging module
"""
class Logger(object):
def __init__(self, name):
self.name = name
def info(self, msg):
print('I - {name} - {msg}'.format(
name=self.name,
msg=msg))
def warning(self, msg):
print('W - {name} - {msg}'.... | """
A thin logger. Will be replaced by logging module
"""
class Logger(object):
def __init__(self, name):
self.name = name
def info(self, msg):
print('I - {name} - {msg}'.format(name=self.name, msg=msg))
def warning(self, msg):
print('W - {name} - {msg}'.format(name=self.name, ms... |
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_BUILD = 0
VERSION_INFO = (VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD)
VERSION_STRING = "%d.%d.%d" % VERSION_INFO
AUTHOR_NAME = "Eric Plaster"
DESCRIPTION = "Adds Flywheel support to Flask-AppBuilder"
AUTHOR_EMAIL = "plaster@gmail.com"
__version__ = VERSION_INFO
| version_major = 0
version_minor = 1
version_build = 0
version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD)
version_string = '%d.%d.%d' % VERSION_INFO
author_name = 'Eric Plaster'
description = 'Adds Flywheel support to Flask-AppBuilder'
author_email = 'plaster@gmail.com'
__version__ = VERSION_INFO |
ASIO_BASE = 'http://purl.org/hercules/asio/core#'
RDFS_BASE = 'http://www.w3.org/2000/01/rdf-schema#'
RDFS_LABEL = f'{RDFS_BASE}label'
RDFS_COMMENT = f'{RDFS_BASE}comment'
RDFS_SUBCLASSOF = f'{RDFS_BASE}subClassOf'
RDF_BASE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
RDF_TYPE = f'{RDF_BASE}type'
OWL_BASE = 'http... | asio_base = 'http://purl.org/hercules/asio/core#'
rdfs_base = 'http://www.w3.org/2000/01/rdf-schema#'
rdfs_label = f'{RDFS_BASE}label'
rdfs_comment = f'{RDFS_BASE}comment'
rdfs_subclassof = f'{RDFS_BASE}subClassOf'
rdf_base = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
rdf_type = f'{RDF_BASE}type'
owl_base = 'http://... |
a = 200
b = 33
if a > b:
print("a is greater than b")
| a = 200
b = 33
if a > b:
print('a is greater than b') |
class Solution:
def fizzBuzz(self, n: int) -> 'List[str]':
result = []
for i in range(1, n + 1):
if i % 15 == 0:
ele = "FizzBuzz"
elif i % 3 == 0:
ele = "Fizz"
elif i % 5 == 0:
ele = "Buzz"
else:
... | class Solution:
def fizz_buzz(self, n: int) -> 'List[str]':
result = []
for i in range(1, n + 1):
if i % 15 == 0:
ele = 'FizzBuzz'
elif i % 3 == 0:
ele = 'Fizz'
elif i % 5 == 0:
ele = 'Buzz'
else:
... |
# DAY 5 - ACTIVITY 1
# Program Description: This is a program that uses a function ( studentAverage ) to process the student's grade.
# This is the function that will take in the user's inputted information.
# Then it will calculate the student's average.
# lastly, it will add the information into the studentGrad... | def student_average(name, mathGrade, englishGrade, scienceGrade):
average_grade = (mathGrade + englishGrade + scienceGrade) / 3
studentGrades[name] = [averageGrade, mathGrade, englishGrade, scienceGrade]
return
continue_running = True
while continueRunning:
student_grades = {}
try:
print('\n... |
"""Constants for eskom loadshedding interface"""
# Base component constants
NAME = "Eskom Loadshedding Interface"
DOMAIN = "eskom_loadshedding"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "1.0.5"
ISSUE_URL = "https://github.com/swartjean/ha-eskom-loadshedding/issues"
# Icons
ICON = "mdi:lightning-bolt"
# Platforms
SENS... | """Constants for eskom loadshedding interface"""
name = 'Eskom Loadshedding Interface'
domain = 'eskom_loadshedding'
domain_data = f'{DOMAIN}_data'
version = '1.0.5'
issue_url = 'https://github.com/swartjean/ha-eskom-loadshedding/issues'
icon = 'mdi:lightning-bolt'
sensor = 'sensor'
platforms = [SENSOR]
conf_enabled = ... |
# Copyright (c) 2013-2017 CodeReclaimers, LLC
class TraderBase(object):
def __init__(self, pairs):
self.pairs = pairs
def onNewDepth(self, t, pair, asks, bids):
pass
def onNewTradeHistory(self, t, pair, trades):
pass
def onLoopEnd(self, t):
pass
d... | class Traderbase(object):
def __init__(self, pairs):
self.pairs = pairs
def on_new_depth(self, t, pair, asks, bids):
pass
def on_new_trade_history(self, t, pair, trades):
pass
def on_loop_end(self, t):
pass
def on_exit(self):
pass |
class Solution:
def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool:
dictionary = {}
for num_index in range(len(nums)):
num = nums[num_index]
if num in dictionary and num_index - dictionary[num] <= k:
return True
# else:
... | class Solution:
def contains_nearby_duplicate(self, nums: List[int], k: int) -> bool:
dictionary = {}
for num_index in range(len(nums)):
num = nums[num_index]
if num in dictionary and num_index - dictionary[num] <= k:
return True
dictionary[num] =... |
#!/usr/bin/env python
with open("Register.cmp") as fh:
for num, l in enumerate(fh.readlines()):
if num == 0:
continue
parts = [p.strip() for p in l.split('|')][2:]
parts = [p for p in parts if len(p)]
outparts = []
# last element is always empty
cols = ['in', 'load', 'out']
for id... | with open('Register.cmp') as fh:
for (num, l) in enumerate(fh.readlines()):
if num == 0:
continue
parts = [p.strip() for p in l.split('|')][2:]
parts = [p for p in parts if len(p)]
outparts = []
cols = ['in', 'load', 'out']
for (idx, p) in enumerate(parts)... |
class Rectangle:
def __init__(self, width, height):
print("I'm initializing a new Rectangle instance.")
self.width = width
self.height = height
def __del__(self):
print('A Rectangle instance is being destroyed.')
def calculate_area(self):
return self.width * self.he... | class Rectangle:
def __init__(self, width, height):
print("I'm initializing a new Rectangle instance.")
self.width = width
self.height = height
def __del__(self):
print('A Rectangle instance is being destroyed.')
def calculate_area(self):
return self.width * self.h... |
class GeoWeatherServiceFailedToLocateException(Exception):
pass
class GeoWeatherServiceFailedToRetrieveException(Exception):
pass
| class Geoweatherservicefailedtolocateexception(Exception):
pass
class Geoweatherservicefailedtoretrieveexception(Exception):
pass |
class FilesDontMatchException(Exception):
def __init__(self):
pass
def __str__(self):
print ("The program has stopped because the files do not match the requirements.")
return "The files do not match the requirements"
class FastaRaroException(Exception):
def __init__(self):
pass
... | class Filesdontmatchexception(Exception):
def __init__(self):
pass
def __str__(self):
print('The program has stopped because the files do not match the requirements.')
return 'The files do not match the requirements'
class Fastararoexception(Exception):
def __init__(self):
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 27 12:19:49 2019
@author: thisisbex
"""
| """
Created on Fri Dec 27 12:19:49 2019
@author: thisisbex
""" |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 25 21:00:24 2017
@author: James Jiang
"""
all_lines = [line.rstrip('\n') for line in open('Data.txt')]
def has_bab(string, b, a):
chars = [i for i in string]
for i in range(1, len(chars) - 1):
if chars[i] == a:
if (chars[i - 1] == b) and (cha... | """
Created on Mon Dec 25 21:00:24 2017
@author: James Jiang
"""
all_lines = [line.rstrip('\n') for line in open('Data.txt')]
def has_bab(string, b, a):
chars = [i for i in string]
for i in range(1, len(chars) - 1):
if chars[i] == a:
if chars[i - 1] == b and chars[i + 1] == b:
... |
qLst=[]
def isEmpty(qLst):
if len(qLst) == 0:
return 1
else:
return 0
# Function to add elements in Queue
def Enqueue(qLst, val):
qLst.append(val)
if len(qLst) == 1:
front = rear = 0
else:
rear = len(qLst) - 1
# Function to Delete elements in Que... | q_lst = []
def is_empty(qLst):
if len(qLst) == 0:
return 1
else:
return 0
def enqueue(qLst, val):
qLst.append(val)
if len(qLst) == 1:
front = rear = 0
else:
rear = len(qLst) - 1
def dqueue(qLst):
if is_empty(qLst):
return 'UnderFlow'
else:
v... |
N = int(input())
N2 = input()
answer = 0
for i in N2:
answer += int(i)
print(answer) | n = int(input())
n2 = input()
answer = 0
for i in N2:
answer += int(i)
print(answer) |
def intervalIntersection(self, firstList: List[List[int]], secondList: List[List[int]]) -> List[List[int]]:
''' basically change the min of the right hand side of the
intervals
'''
# edge case
if firstList == [] or secondList == []:
return []
... | def interval_intersection(self, firstList: List[List[int]], secondList: List[List[int]]) -> List[List[int]]:
""" basically change the min of the right hand side of the
intervals
"""
if firstList == [] or secondList == []:
return []
matching = []
l1 = len(firstList)
l2 = l... |
# DROP TABLES
songplay_table_drop = "DROP TABLE IF EXISTS songplays"
user_table_drop = "DROP TABLE IF EXISTS users"
song_table_drop = "DROP TABLE IF EXISTS songs"
artist_table_drop = "DROP TABLE IF EXISTS artists"
time_table_drop = "DROP TABLE IF EXISTS time"
# CREATE TABLES
songplay_table_create = ("""
CREATE TABLE... | songplay_table_drop = 'DROP TABLE IF EXISTS songplays'
user_table_drop = 'DROP TABLE IF EXISTS users'
song_table_drop = 'DROP TABLE IF EXISTS songs'
artist_table_drop = 'DROP TABLE IF EXISTS artists'
time_table_drop = 'DROP TABLE IF EXISTS time'
songplay_table_create = '\nCREATE TABLE IF NOT EXISTS songplays (\n son... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
# coding: utf-8
class ContextManager(object):
def __init__(self, statement, task, **kwargs):
self.statement = statement
self.task = task
def process_task(self):
raise NotImplementedError()
| class Contextmanager(object):
def __init__(self, statement, task, **kwargs):
self.statement = statement
self.task = task
def process_task(self):
raise not_implemented_error() |
def quick_sort(arr, left, right):
if left < right:
# Partition the array by setting the position of the pivot value
position = Partition(arr, left, right)
# Sort the left
quick_sort(arr, left, position - 1)
# Sort the right
quick_sort(arr, position + 1, right)
re... | def quick_sort(arr, left, right):
if left < right:
position = partition(arr, left, right)
quick_sort(arr, left, position - 1)
quick_sort(arr, position + 1, right)
return arr
def partition(arr, left, right):
pivot = arr[right]
low = left - 1
for i in range(left, right):
... |
def verify_response(expected_response, response):
if isinstance(expected_response, dict):
assert isinstance(response, dict)
iterator = expected_response.items()
elif isinstance(expected_response, list):
assert isinstance(response, list)
assert len(expected_response) == len(respon... | def verify_response(expected_response, response):
if isinstance(expected_response, dict):
assert isinstance(response, dict)
iterator = expected_response.items()
elif isinstance(expected_response, list):
assert isinstance(response, list)
assert len(expected_response) == len(respon... |
#HUGHXIE
#factorial.py
cache = dict()
def factorial(x):
if x < 2:
return x
else:
x *= factorial(x-1)
return x
def cachedfactorial(x):
global cache
if x < 2:
cache[x] = 1
if x > len(cache):
cache[x] = x*cachedfactorial(x-1)
return(cache.get(x))
| cache = dict()
def factorial(x):
if x < 2:
return x
else:
x *= factorial(x - 1)
return x
def cachedfactorial(x):
global cache
if x < 2:
cache[x] = 1
if x > len(cache):
cache[x] = x * cachedfactorial(x - 1)
return cache.get(x) |
x_coord = [23, 53, 2, -12, 95, 103, 14, -5]
y_coord = [677, 233, 405, 433, 905, 376, 432, 445]
z_coord = [4, 16, -6, -42, 3, -6, 23, -1]
labels = ["F", "J", "A", "Q", "Y", "B", "W", "X"]
points = []
# write your for loop here
for l, x, y, z in zip(labels,x_coord,y_coord,z_coord):
point = l + ': ' + ', '.join([str(... | x_coord = [23, 53, 2, -12, 95, 103, 14, -5]
y_coord = [677, 233, 405, 433, 905, 376, 432, 445]
z_coord = [4, 16, -6, -42, 3, -6, 23, -1]
labels = ['F', 'J', 'A', 'Q', 'Y', 'B', 'W', 'X']
points = []
for (l, x, y, z) in zip(labels, x_coord, y_coord, z_coord):
point = l + ': ' + ', '.join([str(n) for n in [x, y, z]])... |
class Cluster(object):
"""
Cluster contains groups of values by their specified key
"""
def __init__(self, cluster):
self.__cluster = cluster
def __contains__(self, item):
return self.__cluster.containsValue(item)
def size(self):
return self.__cluster.size()
def ge... | class Cluster(object):
"""
Cluster contains groups of values by their specified key
"""
def __init__(self, cluster):
self.__cluster = cluster
def __contains__(self, item):
return self.__cluster.containsValue(item)
def size(self):
return self.__cluster.size()
def g... |
ABORTED = 'Aborted'
FAILED = 'Failed'
NOT_PROCESSED = 'Not Processed'
COMPLETED = 'Completed'
ERROR_STATES = (
ABORTED,
FAILED,
NOT_PROCESSED,
)
| aborted = 'Aborted'
failed = 'Failed'
not_processed = 'Not Processed'
completed = 'Completed'
error_states = (ABORTED, FAILED, NOT_PROCESSED) |
def generator_example():
yield 1
def non_builtin_example(a):
return a
def mock_example(a):
return a
def list_example(a):
return a
def multi_line_docstring_example():
"""
La \ndi dee
One
Two
Three
"""
return 'Eric the half a bee'
def two_line_docstring():
"""a b ... | def generator_example():
yield 1
def non_builtin_example(a):
return a
def mock_example(a):
return a
def list_example(a):
return a
def multi_line_docstring_example():
"""
La
di dee
One
Two
Three
"""
return 'Eric the half a bee'
def two_line_docstring():
"""a b c d e ... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
tail = head
length = 1
while tail.next:
length += 1
... | class Solution:
def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode:
tail = head
length = 1
while tail.next:
length += 1
tail = tail.next
if length == 1:
return None
if length == n:
return head.next
tempno... |
'''
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
'''
# Write your code here
t = int(input())
g = {}
m = {}
for i in ran... | """
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
t = int(input())
g = {}
m = {}
for i in range(1, t + 1):
n = in... |
class ShaderNodeOutput:
is_active_output = None
| class Shadernodeoutput:
is_active_output = None |
class ComplexNumber:
def __init__(self, real, imaginary):
pass
def __eq__(self, other):
pass
def __add__(self, other):
pass
def __mul__(self, other):
pass
def __sub__(self, other):
pass
def __truediv__(self, other):
pass
def __abs__(self)... | class Complexnumber:
def __init__(self, real, imaginary):
pass
def __eq__(self, other):
pass
def __add__(self, other):
pass
def __mul__(self, other):
pass
def __sub__(self, other):
pass
def __truediv__(self, other):
pass
def __abs__(self... |
a = int(input(""))
b = int(input(""))
x = (a*b)
print("PROD = " + str(x))
| a = int(input(''))
b = int(input(''))
x = a * b
print('PROD = ' + str(x)) |
def even_and_odd_sum(num):
even = 0
odd = 0
for element in range(0, len(num)):
if int(num[element]) % 2 == 0:
even += int(num[element])
else:
odd += int(num[element])
return f"Odd sum = {odd}, Even sum = {even}"
print(even_and_odd_sum(input()))
| def even_and_odd_sum(num):
even = 0
odd = 0
for element in range(0, len(num)):
if int(num[element]) % 2 == 0:
even += int(num[element])
else:
odd += int(num[element])
return f'Odd sum = {odd}, Even sum = {even}'
print(even_and_odd_sum(input())) |
def _simple_callback_arg_unpack(network, arg, request_id):
network._call(request_id, *arg)
def _simple_callback_arg(network, arg, request_id):
network._call(request_id, arg)
def _simple_callback_no_arg(network, arg, request_id):
network._call(request_id) | def _simple_callback_arg_unpack(network, arg, request_id):
network._call(request_id, *arg)
def _simple_callback_arg(network, arg, request_id):
network._call(request_id, arg)
def _simple_callback_no_arg(network, arg, request_id):
network._call(request_id) |
def find_sra_col(metadata, col=None, PREFIX='SRR'):
def column_iter(md, col):
column = md.get_column(col)
if metadata.columns[col].type != "categorical":
raise ValueError("`col` is not a categorical column.")
yield column.drop_missing_values().to_series()
def metadata_iter... | def find_sra_col(metadata, col=None, PREFIX='SRR'):
def column_iter(md, col):
column = md.get_column(col)
if metadata.columns[col].type != 'categorical':
raise value_error('`col` is not a categorical column.')
yield column.drop_missing_values().to_series()
def metadata_iter... |
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
{
'includes': [
'../sdk/runtime/tools/gyp/runtime-configurations.gypi',
],
'targets': [
{
... | {'includes': ['../sdk/runtime/tools/gyp/runtime-configurations.gypi'], 'targets': [{'target_name': 'oracledart_native_extension', 'type': 'shared_library', 'include_dirs': ['$(ORACLE_OCI_HOME)/include', '../sdk/runtime'], 'sources': ['lib/src/oracledart_native_extension.cc', 'lib/src/oracledart_native_extension_dllmain... |
class Config(object):
DEBUG = False
TESTING = False
APP_NAME = "I choose you"
SLASH_COMMAND = "/ichu"
DATABASE_URI = "mongodb://localhost:27017/ichooseyoudb"
API_URL = "https://ichooseyou.etienne-t.fr"
WAIT_FOR_THREAD_BEFORE_RETURN = False
class ProductionConfig(Config):
DEBUG = False
... | class Config(object):
debug = False
testing = False
app_name = 'I choose you'
slash_command = '/ichu'
database_uri = 'mongodb://localhost:27017/ichooseyoudb'
api_url = 'https://ichooseyou.etienne-t.fr'
wait_for_thread_before_return = False
class Productionconfig(Config):
debug = False
... |
name = input("Put your name : ").capitalize()
lastName = input("Put your last name : ").capitalize()
print("Hello !! %s %s !" % (name,lastName))
text = "Zeno"
textFormatted = "Welcome %s"%(name)
print(textFormatted.center(21,"-"))
print(len(name)) | name = input('Put your name : ').capitalize()
last_name = input('Put your last name : ').capitalize()
print('Hello !! %s %s !' % (name, lastName))
text = 'Zeno'
text_formatted = 'Welcome %s' % name
print(textFormatted.center(21, '-'))
print(len(name)) |
# -*- coding: utf-8 -*-
# the version of software
# this is used by the setup.py script
__version__ = '0.0.1.dev1'
| __version__ = '0.0.1.dev1' |
"""*****************************************************************************
* Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to ... | """*****************************************************************************
* Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to ... |
#Buatlah sebuah fungsi yang memiliki sebuah parameter yang bertipe list dan berisi
#daftar nama orang (hanya terdiri dari satu kata). Lalu kembalikan sebuah string yang
#merupakan nama terpanjang.
def mulai():
nama1 = str(input())
nama2 = str(input())
nama3 = str(input())
if len(nama1) >= len(n... | def mulai():
nama1 = str(input())
nama2 = str(input())
nama3 = str(input())
if len(nama1) >= len(nama2) and len(nama1) >= len(nama3):
return nama1
if len(nama2) >= len(nama1) and len(nama2) >= len(nama3):
return nama2
if len(nama3) >= len(nama2) and len(nama3) >= len(nama1):
... |
## TheJollyDuck
## FizzBuzz
## This program prints out numbers but for
## a specifc multiple of a number with a word
numList = [3,5,10,13]
wordlist = ["fizz","buzz","fizzle","kaboom"]
print("FizzBuzz is starting....")
# TO DO : Implement input safety so that it only accepts ints
numberLimit = int(input("Up to what n... | num_list = [3, 5, 10, 13]
wordlist = ['fizz', 'buzz', 'fizzle', 'kaboom']
print('FizzBuzz is starting....')
number_limit = int(input('Up to what number do you want to print out? [int]: '))
for i in range(0, numberLimit):
output = ''
for j in range(0, len(numList)):
if i % numList[j] == 0:
ou... |
# fibonnaci function
def fib(n):
''' prints out a list of n fibonnaci numbers
Args:
parm1: n is the number of fibonnaci numbers to print
Returns:
nothing
'''
print("Called from ",__name__)
a, b = 0, 1 #Note multiple assignment!
counter = 1
while counter < n:
print (a, end=' ')
a, b = b... | def fib(n):
""" prints out a list of n fibonnaci numbers
Args:
parm1: n is the number of fibonnaci numbers to print
Returns:
nothing
"""
print('Called from ', __name__)
(a, b) = (0, 1)
counter = 1
while counter < n:
print(a, end=' ')
(a, b) = (b, a + b)
print()
... |
load("@build_bazel_rules_swift//swift:repositories.bzl", "swift_rules_dependencies")
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")
load("@rules_jvm_external//:defs.bzl", "maven_install")
load("@... | load('@build_bazel_rules_swift//swift:repositories.bzl', 'swift_rules_dependencies')
load('@build_bazel_rules_apple//apple:repositories.bzl', 'apple_rules_dependencies')
load('@build_bazel_apple_support//lib:repositories.bzl', 'apple_support_dependencies')
load('@rules_jvm_external//:defs.bzl', 'maven_install')
load('@... |
def test_spamd_service(Service):
assert Service('spamd').is_running
def test_spamd_config(File):
assert File('/etc/rc.conf.local').contains('spamd_flags=')
def test_bgpd_config(File, Sudo):
with Sudo():
assert File('/etc/bgpd.conf').contains('spamdAS')
def test_pf_anchor(File, Command, Sudo):
... | def test_spamd_service(Service):
assert service('spamd').is_running
def test_spamd_config(File):
assert file('/etc/rc.conf.local').contains('spamd_flags=')
def test_bgpd_config(File, Sudo):
with sudo():
assert file('/etc/bgpd.conf').contains('spamdAS')
def test_pf_anchor(File, Command, Sudo):
... |
def extractExplore(item):
"""
Explore
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
chp_prefixes = [
('geww ', 'Ghost Emperor Wil... | def extract_explore(item):
"""
Explore
"""
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
chp_prefixes = [('geww ', 'Ghost Emperor Wild Wife: Dandy Eldest Miss', 'translated'), ('VGA... |
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
s = set()
for num in nums:
if num in s:
return True
else:
s.add(num)
return False
| class Solution:
def contains_duplicate(self, nums: List[int]) -> bool:
s = set()
for num in nums:
if num in s:
return True
else:
s.add(num)
return False |
"""
Copyright 2020~ PeTrA. All rights reserved.
. Python Project Structure Repository;
"""
# PythonProjectStructure/tests/package/__init__.py;
| """
Copyright 2020~ PeTrA. All rights reserved.
. Python Project Structure Repository;
""" |
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def github_repository(*, name=None, remote=None, commit=None, tag=None,
branch=None, build_file=None, build_file_content=None,
... | load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository', 'new_git_repository')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def github_repository(*, name=None, remote=None, commit=None, tag=None, branch=None, build_file=None, build_file_content=None, sha256=None, shallow_since=None... |
def parse_while(state, pred):
"""
pred: a boolean-valued function (i.e. a predicate) on a character
postcondition: `state.pos` is at the first character *not* satisfying `pred`,
after the original `state.pos` at call-time, or `len(self.text)` if there is
no such character
returns: the te... | def parse_while(state, pred):
"""
pred: a boolean-valued function (i.e. a predicate) on a character
postcondition: `state.pos` is at the first character *not* satisfying `pred`,
after the original `state.pos` at call-time, or `len(self.text)` if there is
no such character
returns: the te... |
# encoding: utf-8
# module IronPython
# from IronPython.SQLite, Version=2.7.7.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, IronPython.Wpf, Version=2.7.7.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# no function... | """ NamespaceTracker represent a CLS namespace. """ |
def main(j, args, params, tags, tasklet):
params.merge(args)
params.result = ""
tags = params["tags"]
id = tags.tagGet("id")
model = tags.tagGet("model")
actor = tags.tagGet("actor")
application = tags.tagGet("application")
if application == "":
application = "system"
# ... | def main(j, args, params, tags, tasklet):
params.merge(args)
params.result = ''
tags = params['tags']
id = tags.tagGet('id')
model = tags.tagGet('model')
actor = tags.tagGet('actor')
application = tags.tagGet('application')
if application == '':
application = 'system'
if mode... |
# -*- coding: utf-8 -*-
# pylint: disable=unused-argument
"""Tests for the `CifCellContentsParser`."""
def test_cif_cell_contents_standard(
fixture_database, fixture_computer_localhost, generate_calc_job_node, generate_parser
):
"""Test a default `cif_cell_contents` calculation."""
entry_point_calc_job = ... | """Tests for the `CifCellContentsParser`."""
def test_cif_cell_contents_standard(fixture_database, fixture_computer_localhost, generate_calc_job_node, generate_parser):
"""Test a default `cif_cell_contents` calculation."""
entry_point_calc_job = 'codtools.cif_cell_contents'
entry_point_parser = 'codtools.c... |
#
# PySNMP MIB module ALVARION-CONNECTION-LIMITING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-CONNECTION-LIMITING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:06:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pyt... | (alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size... |
class TokenizerNER(object):
r'''
Args:
hf_tokenizer
Must be able to return token offsets
max_len:
Max sequence length, if longer it will be split into multiple examples
'''
def __init__(self, hf_tokenizer, max_len=512, id2type=None):
self.hf_tokenizer = ... | class Tokenizerner(object):
"""
Args:
hf_tokenizer
Must be able to return token offsets
max_len:
Max sequence length, if longer it will be split into multiple examples
"""
def __init__(self, hf_tokenizer, max_len=512, id2type=None):
self.hf_tokenizer = h... |
#
# @lc app=leetcode.cn id=1586 lang=python3
#
# [1586] longest-subarray-of-1s-after-deleting-one-element
#
None
# @lc code=end | None |
# Source : https://leetcode.com/problems/maximum-product-difference-between-two-pairs/
# Author : foxfromworld
# Date : 16/12/2021
# First attempt
class Solution:
def maxProductDifference(self, nums: List[int]) -> int:
nums.sort()
return nums[-1] * nums[-2] - nums[0] * nums[1]
| class Solution:
def max_product_difference(self, nums: List[int]) -> int:
nums.sort()
return nums[-1] * nums[-2] - nums[0] * nums[1] |
listOfGroups = []
with open("C:\\Privat\\advent_of_code20\\puzzle6\\input1.txt") as f:
group = []
for line in f:
line = line.strip()
if line == '':
listOfGroups.append(group)
group = []
continue
for char in line:
if not char in group:
... | list_of_groups = []
with open('C:\\Privat\\advent_of_code20\\puzzle6\\input1.txt') as f:
group = []
for line in f:
line = line.strip()
if line == '':
listOfGroups.append(group)
group = []
continue
for char in line:
if not char in group:
... |
class SpeciesError(Exception):
def __init__(self, msg=None):
self.msg = msg
def __str__(self):
return str(self.msg)
class KineticsError(Exception):
def __init__(self, msg=None):
self.msg = msg
class ConcentrationError(Exception):
def __init__(self, msg=None):
self.... | class Specieserror(Exception):
def __init__(self, msg=None):
self.msg = msg
def __str__(self):
return str(self.msg)
class Kineticserror(Exception):
def __init__(self, msg=None):
self.msg = msg
class Concentrationerror(Exception):
def __init__(self, msg=None):
self.m... |
years = range(1988, 2000)
vars = ['ta_2m', 'pr', 'psl', 'rss', 'rls', 'wss_10m', 'hur_2m',
'albedo', 'ps', 'ts_0m']
hourres = ['1H', '1H', '1H', '3H', '3H', '1H', '1H', '1H', '3H', '1H']
b11b = 'NORA10'
b11c = '11km'
paths = ['%s_%s_%s_%s_%s.nc' % (b11b, hourres[vi], b11c, vars[vi], y)
for vi in ran... | years = range(1988, 2000)
vars = ['ta_2m', 'pr', 'psl', 'rss', 'rls', 'wss_10m', 'hur_2m', 'albedo', 'ps', 'ts_0m']
hourres = ['1H', '1H', '1H', '3H', '3H', '1H', '1H', '1H', '3H', '1H']
b11b = 'NORA10'
b11c = '11km'
paths = ['%s_%s_%s_%s_%s.nc' % (b11b, hourres[vi], b11c, vars[vi], y) for vi in range(len(vars)) for y ... |
test = {
'name': 'Car',
'points': 0,
'suites': [
{
'cases': [
{
'code': r"""
>>> from car import *
>>> deneros_car = Car('Tesla', 'Model S')
>>> deneros_car.model
d44fbfeedd5748e8ed04de29de968251
# locked
>>> deneros_car.gas =... | test = {'name': 'Car', 'points': 0, 'suites': [{'cases': [{'code': "\n >>> from car import *\n >>> deneros_car = Car('Tesla', 'Model S')\n >>> deneros_car.model\n d44fbfeedd5748e8ed04de29de968251\n # locked\n >>> deneros_car.gas = 10\n >>> deneros_car.drive... |
#https://www.acmicpc.net/problem/2798
n, m = map(int, input().split())
a = list(map(int, input().split()))
min_result = m
answer = 0
for i in range(n):
for j in range(i+1, n):
for k in range(j+1, n):
sum_a = a[i]+a[j]+a[k]
if sum_a <= m and m-sum_a < min_result:
mi... | (n, m) = map(int, input().split())
a = list(map(int, input().split()))
min_result = m
answer = 0
for i in range(n):
for j in range(i + 1, n):
for k in range(j + 1, n):
sum_a = a[i] + a[j] + a[k]
if sum_a <= m and m - sum_a < min_result:
min_result = m - (a[i] + a[j] +... |
#
# voice-skill-sdk
#
# (C) 2020, Deutsche Telekom AG
#
# Deutsche Telekom AG and all other contributors /
# copyright owners license this file to you under the MIT
# License (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensou... | __name__ = 'skill-sdk'
__description__ = 'Magenta Voice Skill SDK for Python'
__url__ = 'https://github.com/telekom/voice-skill-sdk/'
__version__ = '0.10.4'
__author__ = 'Deutsche Telekom Voicification Suite'
__author_email__ = 'vineet.hingorani@telekom.de'
__license__ = 'MIT'
__copyright__ = 'Copyright 2020, Deutsche ... |
contents = [
(
"Getting Started",
[
("welcome/index.html", "Welcome to yt!", "What's yt all about?"),
(
"orientation/index.html",
"yt Orientation",
"Quickly get up and running with yt: zero to sixty.",
),
... | contents = [('Getting Started', [('welcome/index.html', 'Welcome to yt!', "What's yt all about?"), ('orientation/index.html', 'yt Orientation', 'Quickly get up and running with yt: zero to sixty.'), ('help/index.html', 'How to Ask for Help', 'Some guidelines on how and where to ask for help with yt'), ('workshop.html',... |
class DataStream:
def __init__(self, *args):
self._processObjects = args;
self._ports = []
self.finished = False
self._executeToken = 0
for po in self._processObjects:
for i in range(po.getNrOfOutputPorts()):
self._ports.append(po.getOutputPort(i))... | class Datastream:
def __init__(self, *args):
self._processObjects = args
self._ports = []
self.finished = False
self._executeToken = 0
for po in self._processObjects:
for i in range(po.getNrOfOutputPorts()):
self._ports.append(po.getOutputPort(i))... |
"""Representation and helpers for app, system, metadata, job permissions
"""
PEM_POSIX_MAPPING = {
'NONE': '---',
'READ': 'r--',
'WRITE': '-w-',
'EXECUTE': '--x',
'READ_WRITE': 'rw-',
'READ_EXECUTE': 'r-x',
'WRITE_EXECUTE': '-wx',
'ALL': 'rwx'
}
__all__ = ['posixify_pem']
def posixif... | """Representation and helpers for app, system, metadata, job permissions
"""
pem_posix_mapping = {'NONE': '---', 'READ': 'r--', 'WRITE': '-w-', 'EXECUTE': '--x', 'READ_WRITE': 'rw-', 'READ_EXECUTE': 'r-x', 'WRITE_EXECUTE': '-wx', 'ALL': 'rwx'}
__all__ = ['posixify_pem']
def posixify_pem(pem):
"""Translate a Tapis ... |
# Day 2 - part 1
def run_intcode_computer(program):
return run_program(program, 0)
# Day 2 - part 2
def find_input_brute_force(program, output):
for noun in range(0, 99):
for verb in range(0, 99):
memory = program.copy()
memory[1] = noun
memory[2] = verb
memory = run_program(memory, 0)
... | def run_intcode_computer(program):
return run_program(program, 0)
def find_input_brute_force(program, output):
for noun in range(0, 99):
for verb in range(0, 99):
memory = program.copy()
memory[1] = noun
memory[2] = verb
memory = run_program(memory, 0)
... |
# Copyright 2020 Aeris Communications 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | class Apiexception(Exception):
"""
Represents an exception with an Aeris API, such as a device not being found or invalid authentication credentials.
Does not represent transport-layer problems, such as not being able to reach the Aeris APIs.
The 'response' attribute will have, at least, the following ... |
for _ in range(int(input())):
M, x, y = map(int, input().split())
cops = [int(x)-1 for x in input().split()]
can_hide = [True] * 100
for c in cops:
can_hide[c] = False
i = 1
while i <= x * y:
if c-i >= 0:
can_hide[c-i] = False
if c+i < 100:... | for _ in range(int(input())):
(m, x, y) = map(int, input().split())
cops = [int(x) - 1 for x in input().split()]
can_hide = [True] * 100
for c in cops:
can_hide[c] = False
i = 1
while i <= x * y:
if c - i >= 0:
can_hide[c - i] = False
if c ... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
# class Solution:
#
# def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
# if not l1 and not l2:
# return None
# if not l1 and l2:
# r... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
if not l1:
return l2
if not l2:
return l1
if l1.val < l2.val:
l1.next = self.merg... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 23 11:04:19 2020
@author: William
"""
| """
Created on Tue Jun 23 11:04:19 2020
@author: William
""" |
"""
return only unique values
Complexity: O(n)
Memory complexity: O(n)
"""
unordered_elements = [12, 43, 1, 3, 1, 3, 44, 21, 2, 18, 15, 19, 1, 33, 45, 2, 22, 2]
def unique(elements):
seen = set()
for element in elements:
if element in seen:
continue
seen.add(element)
yiel... | """
return only unique values
Complexity: O(n)
Memory complexity: O(n)
"""
unordered_elements = [12, 43, 1, 3, 1, 3, 44, 21, 2, 18, 15, 19, 1, 33, 45, 2, 22, 2]
def unique(elements):
seen = set()
for element in elements:
if element in seen:
continue
seen.add(element)
yield ... |
""" 590. N-ary Tree Postorder Traversal
Given an n-ary tree, return the postorder traversal of its nodes' values.
Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples).
Follow up:
Recursive solution is trivial, could you d... | """ 590. N-ary Tree Postorder Traversal
Given an n-ary tree, return the postorder traversal of its nodes' values.
Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples).
Follow up:
Recursive solution is trivial, could you d... |
# pylint: disable=R0903, useless-object-inheritance
"""
Simple test case for an annoying behavior in pylint.
"""
__revision__ = 'pouet'
class Test(object):
"""Smallest test case for reported issue."""
def __init__(self):
self._thing = None
@property
def myattr(self):
"""Getter for my... | """
Simple test case for an annoying behavior in pylint.
"""
__revision__ = 'pouet'
class Test(object):
"""Smallest test case for reported issue."""
def __init__(self):
self._thing = None
@property
def myattr(self):
"""Getter for myattr"""
return self._thing
@myattr.sette... |
class Foo:
x
y = 123
def bar(self):
self.z
self.baz = 456
| class Foo:
x
y = 123
def bar(self):
self.z
self.baz = 456 |
#!/usr/bin/env python3.6
"""
Example usages for pdfminer
"""
def parse_pdf_to_string(pdf_file_path):
"""
:param pdf_file_path: file path of a pdf to convert into a string
:return: string of the parsed pdf
"""
pdf_string = ''
return pdf_string
def multithreaded_parse_pdf_to_string(pdf_file_p... | """
Example usages for pdfminer
"""
def parse_pdf_to_string(pdf_file_path):
"""
:param pdf_file_path: file path of a pdf to convert into a string
:return: string of the parsed pdf
"""
pdf_string = ''
return pdf_string
def multithreaded_parse_pdf_to_string(pdf_file_paths):
"""
:param pd... |
def fakulteta(n):
zmnozek = 1
for x in range(1,n+1):
zmnozek *= x
return zmnozek
def vsota_stevk_fakultete(n):
fakul = fakulteta(n)
vsota = 0
while fakul > 0:
vsota += fakul % 10
fakul //= 10
return vsota
vsota_stevk_fakultete(100)
| def fakulteta(n):
zmnozek = 1
for x in range(1, n + 1):
zmnozek *= x
return zmnozek
def vsota_stevk_fakultete(n):
fakul = fakulteta(n)
vsota = 0
while fakul > 0:
vsota += fakul % 10
fakul //= 10
return vsota
vsota_stevk_fakultete(100) |
# number calculation
x=3+6
print(x)
# x=x+1 # update the variable by +1
x+=1 # x=x+1
print(x)
print ("////////////////////////////////////////////////////")
# String calculation
str1="Hello" *3
str2="Hell\"o"
str3="Hello"+"World"
str4="Hello\nWorld"
print(str1)
print(str2)
print(str3)
print(str4)
print ("////////... | x = 3 + 6
print(x)
x += 1
print(x)
print('////////////////////////////////////////////////////')
str1 = 'Hello' * 3
str2 = 'Hell"o'
str3 = 'Hello' + 'World'
str4 = 'Hello\nWorld'
print(str1)
print(str2)
print(str3)
print(str4)
print('////////////////////////////////////////////////////')
print(str1[0])
print(str1[1:4])... |
#!/usr/bin/env python
# coding: utf-8
# * Validate hexadecimal in range (0, 2**16):<br>
# * 1. at least one and not more than 4 hexdigits in one chunk
# * 2. only hexdigits are allowed: 0-9, a-f, A-F
#
# valid ipv6 ="18:36:F3:98:4F:9A"
# In[1]:
# Validate hexadecimal in range (0, 2**16):
# 1. at least one and not ... | def valid_ipv4(ls):
items = ls.split(':')
if len(items) == 0 or len(items) > 6:
return False
valid = '0123456789abcdefABCDEF'
for item in items:
if len(item) == 0 or len(item) > 4 or (not all((ch in valid for ch in item))):
return False
return True
print(valid_ipv4('18:36... |
print ("Both parties agree to a single prime")
prime=int(input("Enter the prime number to be considered: "))
# Primitive root to be used use
print ("Both must agree with single primitive root to use")
root=int(input("Enter the primitive root: "))
# Party1 chooses a secret number
alicesecret=int(input("Enter... | print('Both parties agree to a single prime')
prime = int(input('Enter the prime number to be considered: '))
print('Both must agree with single primitive root to use')
root = int(input('Enter the primitive root: '))
alicesecret = int(input('Enter a secret number for Party1: '))
bobsecret = int(input('Enter a secret nu... |
blueprint = []
h = 10
w = 8
ID = 1
roofSize = 3
for wi in range(w+1):
blueprint.append((0,wi,5,6))
for hi in range(1,4):
for wi in range(1,w):
blueprint.append((hi,wi,16,8))
blueprint.append((hi,0,20,10))
blueprint.append((hi,w,20,10))
for hi in range(4,h-roofSize):
blueprint.append((hi,0,5... | blueprint = []
h = 10
w = 8
id = 1
roof_size = 3
for wi in range(w + 1):
blueprint.append((0, wi, 5, 6))
for hi in range(1, 4):
for wi in range(1, w):
blueprint.append((hi, wi, 16, 8))
blueprint.append((hi, 0, 20, 10))
blueprint.append((hi, w, 20, 10))
for hi in range(4, h - roofSize):
blueprint.app... |
def divide(n1 , n2):
try:
return n1 / n2
except ZeroDivisionError as error:
print('Log: ', error)
raise
try:
print(divide(2,0))
except ZeroDivisionError as error:
print(error) | def divide(n1, n2):
try:
return n1 / n2
except ZeroDivisionError as error:
print('Log: ', error)
raise
try:
print(divide(2, 0))
except ZeroDivisionError as error:
print(error) |
class Test:
def __init__(self, *args, **kwargs) -> None:
self.args = args
self.kwargs = kwargs
def test_func(self) -> None:
self.args = 'Nothing'
class Test2(Test):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
obj0 = Test(0, test=1)
ob... | class Test:
def __init__(self, *args, **kwargs) -> None:
self.args = args
self.kwargs = kwargs
def test_func(self) -> None:
self.args = 'Nothing'
class Test2(Test):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
obj0 = test(0, test=1)
obj1 ... |
# Reads a list of integers
num_iterations = int(input())
list_items = []
for element in range(num_iterations):
list_items.append(int(input()))
result = 0
for element in list_items:
result += element
print(result)
| num_iterations = int(input())
list_items = []
for element in range(num_iterations):
list_items.append(int(input()))
result = 0
for element in list_items:
result += element
print(result) |
class Animals:
AnimalsType = "Mammal"
class Pets(Animals):
Color = "Multicolor"
class Dogs(Pets):
@staticmethod
def barks():
print("Bow Bow!!")
d = Dogs()
d.barks()
d.barks()
| class Animals:
animals_type = 'Mammal'
class Pets(Animals):
color = 'Multicolor'
class Dogs(Pets):
@staticmethod
def barks():
print('Bow Bow!!')
d = dogs()
d.barks()
d.barks() |
"""
1. Can build a sitemap from a folder
1.1 Number of nodes
1.2 Number of pages in each node
1.3 Node Attributes
1.3.1 Url
1.3.2 Full Url
1.3.3 Source Folder
1.3.4 Temp Folder
1.3.5 Target Folder
1.3.6 Listing Page
1.4 Page Attributes
1.4.1 Ti... | """
1. Can build a sitemap from a folder
1.1 Number of nodes
1.2 Number of pages in each node
1.3 Node Attributes
1.3.1 Url
1.3.2 Full Url
1.3.3 Source Folder
1.3.4 Temp Folder
1.3.5 Target Folder
1.3.6 Listing Page
1.4 Page Attributes
1.4.1 Ti... |
# -*- coding: utf-8 -*-
"""Generic HTTP Request representation passed to Refget functions
The Request class represents the genericized HTTP request passed to the Refget
service. The generic request is used in all Refget functions.
Vendor/Platform-specific request objects (e.g. Tornado Server Request, AWS
lambda reque... | """Generic HTTP Request representation passed to Refget functions
The Request class represents the genericized HTTP request passed to the Refget
service. The generic request is used in all Refget functions.
Vendor/Platform-specific request objects (e.g. Tornado Server Request, AWS
lambda request) are first converted ... |
#!/usr/bin/python
# Vigenere Cipher (Polyalphabetic Substitution Cipher)
# http://inventwithpython.com/hacking (BSD Licensed)
# Further Edited by Mike Weaver to not require pyperclip
# and to add additinoal functionality to main()
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def main():
message = input('Enter message:... | letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def main():
message = input('Enter message: ')
key = input('Enter key [alphanumeric]: ')
mode = input('Encrypt/Decrypt [e/d]: ')
if mode.lower().startswith('e'):
mode = 'encrypt'
translated = encrypt_message(key, message)
elif mode.lower().star... |
# Copyright (c) 2019 The ProtobufBytes Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def protobuf_bytes_deps():
if not native.existing_rule("rules_proto"):
... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def protobuf_bytes_deps():
if not native.existing_rule('rules_proto'):
http_archive(name='rules_proto', sha256='602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208', strip_prefix='rules_proto-97d8af4dc474595af3900dd85cb3a29ad... |
class Solution:
def trimMean(self, arr: List[int]) -> float:
arr.sort()
n = len(arr) * 5 //100
return sum(arr[n:-n])/(len(arr)-(n<<1)) | class Solution:
def trim_mean(self, arr: List[int]) -> float:
arr.sort()
n = len(arr) * 5 // 100
return sum(arr[n:-n]) / (len(arr) - (n << 1)) |
yaxis = 0
xaxis = 0
dead = 0
torch = 0
key = 0
doorone = 0
while dead == 0:
if yaxis == 0 and xaxis == 0:
answer = input("You are in a stone hallway with two exits. Go north, or south?: ")
if answer == "north":
yaxis = yaxis + 1
elif answer == "south":
yaxis = yaxis - 1
#------------------------------... | yaxis = 0
xaxis = 0
dead = 0
torch = 0
key = 0
doorone = 0
while dead == 0:
if yaxis == 0 and xaxis == 0:
answer = input('You are in a stone hallway with two exits. Go north, or south?: ')
if answer == 'north':
yaxis = yaxis + 1
elif answer == 'south':
yaxis = yaxis -... |
class ImageExportOptions(object,IDisposable):
"""
This class defines options for exporting views and sheets as an image.
ImageExportOptions()
"""
def Dispose(self):
""" Dispose(self: ImageExportOptions) """
pass
@staticmethod
def GetFileName(aDoc,dbViewId):
"""
GetFileName(aDoc: Document,... | class Imageexportoptions(object, IDisposable):
"""
This class defines options for exporting views and sheets as an image.
ImageExportOptions()
"""
def dispose(self):
""" Dispose(self: ImageExportOptions) """
pass
@staticmethod
def get_file_name(aDoc, dbViewId):
"""
Get... |
# Dictionary(lug'at)
"""
Dictionary (lug'at) bu tartiblanmagan, o'zgartiriladigan va indexlangan to'plamdir!
ularda kalitlar va qiymatlar saqlanadi!
"""
# Set
"""
Set bu tartiblanmagan va takrorlanmagan elementlardan tashkil topgan to'plam! ... | """
Dictionary (lug'at) bu tartiblanmagan, o'zgartiriladigan va indexlangan to'plamdir!
ularda kalitlar va qiymatlar saqlanadi!
"""
"\nSet bu tartiblanmagan va takrorlanmagan elementlardan tashkil topgan to'plam! \n"
car = {'model': 'kaptiva', 'color ': 'white'}
a = {}
a['name'] = 'Abduha... |
input = """
q(a,b,c).
q(b,c,a).
q(c,b,c).
q(b,b,c).
q(a,b,b).
q(c,a,a).
s(c,b).
s(a,b).
s(a,c).
s(c,c).
t(a).
t(b).
w(b,c).
w(b,b).
w(a,a).
p(X,Y) :- q(X,b,Z), r(Z,b,Y), not r(X,Y,Z).
m(X,Y) :- u(a,X,Y,Y,c,X).
v(X) :- s(a,X), not t(X).
n(X,X) :- q(X,b,X).
r(X,Y,Z) :- t(a), s(X,Z), w(X,Y), not p(Z,Y).
"""
output = ... | input = '\nq(a,b,c).\nq(b,c,a).\nq(c,b,c).\nq(b,b,c).\nq(a,b,b).\nq(c,a,a).\n\ns(c,b).\ns(a,b).\ns(a,c).\ns(c,c).\n\nt(a).\nt(b).\n\nw(b,c).\nw(b,b).\nw(a,a).\n\np(X,Y) :- q(X,b,Z), r(Z,b,Y), not r(X,Y,Z).\nm(X,Y) :- u(a,X,Y,Y,c,X).\nv(X) :- s(a,X), not t(X).\nn(X,X) :- q(X,b,X).\nr(X,Y,Z) :- t(a), s(X,Z), w(X,Y), not ... |
'''
- Leetcode problem: 203
- Difficulty: Easy
- Brief problem description:
Remove all elements from a linked list of integers that have value val.
Example:
Input: 1->2->6->3->4->5->6, val = 6
Output: 1->2->3->4->5
- Solution Summary:
- Used Resources:
--- Bo Zhou
'''
# Definition for singly-linked list.
# c... | """
- Leetcode problem: 203
- Difficulty: Easy
- Brief problem description:
Remove all elements from a linked list of integers that have value val.
Example:
Input: 1->2->6->3->4->5->6, val = 6
Output: 1->2->3->4->5
- Solution Summary:
- Used Resources:
--- Bo Zhou
"""
class Solution:
def remove_elements(... |
'''Config file for log_parser'''
#Path to 'POET' log file
POET_LOG = './Test_Logs/poet.log'
#Path to 'Heartbeat' log file
HEARTBEAT_LOG = './Test_Logs/heartbeat.log'
| """Config file for log_parser"""
poet_log = './Test_Logs/poet.log'
heartbeat_log = './Test_Logs/heartbeat.log' |
{ # pylint: disable=C8101,C8103
'name': 'Odoo Next - Website Address',
'description': 'Adds fields to address checkout',
'version': '14.0.1.0.1',
'category': 'Website',
'author': 'Trustcode',
'license': 'OEEL-1',
'website': 'http://www.odoo-next.com.br',
'contributors': [
'Danim... | {'name': 'Odoo Next - Website Address', 'description': 'Adds fields to address checkout', 'version': '14.0.1.0.1', 'category': 'Website', 'author': 'Trustcode', 'license': 'OEEL-1', 'website': 'http://www.odoo-next.com.br', 'contributors': ['Danimar Ribeiro <danimaribeiro@gmail.com>'], 'depends': ['l10n_br_base_address... |
class MetastoreCredentials:
def __init__(self):
pass
def to_dict(self): return {}
class InvalidCredentials:
def __init__(self, reason: str):
self.reason = reason
def to_dict(self): return {}
| class Metastorecredentials:
def __init__(self):
pass
def to_dict(self):
return {}
class Invalidcredentials:
def __init__(self, reason: str):
self.reason = reason
def to_dict(self):
return {} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.