content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def process(record):
ids = (record.get('idsurface', '') or '').split(' ')
if len(ids) > 4:
return {'language': record['language'],
'longitude': float(record['longitude'] or 0),
'latitude': float(record['latitude'] or 0),
'idsurface': ids}
| def process(record):
ids = (record.get('idsurface', '') or '').split(' ')
if len(ids) > 4:
return {'language': record['language'], 'longitude': float(record['longitude'] or 0), 'latitude': float(record['latitude'] or 0), 'idsurface': ids} |
a = 2 ** 50
b = 2 ** 50 * 3
c = 2 ** 50 * 3 - 1000
d = 400 / 2 ** 50 + 50
print(a,b,c,d) | a = 2 ** 50
b = 2 ** 50 * 3
c = 2 ** 50 * 3 - 1000
d = 400 / 2 ** 50 + 50
print(a, b, c, d) |
G = 6.67408e-11 # N-m2/kg2
#
# Normalize the constants such that m, r, t and v are of the order 10^1.
#
def get_normalization_constants_alphacentauri():
# Normalize the masses to the mass of our sun
m_nd = 1.989e+30 # kg
# Normalize distances to the distance between Alpha Centauri A and Alpha Centa... | g = 6.67408e-11
def get_normalization_constants_alphacentauri():
m_nd = 1.989e+30
r_nd = 5326000000000.0
v_nd = 30000
t_nd = 79.91 * 365 * 24 * 3600 * 0.51
return (m_nd, r_nd, v_nd, t_nd)
def get_normalization_constants_earthsun():
m_nd = 1.989e+30
r_nd = 149470000000.0
v_nd = 29780.0
... |
"""
BFS
"""
class Solution909:
pass
| """
BFS
"""
class Solution909:
pass |
# Time: 0.72 s
movies = []
for _ in range(int(input())):
movies.append(tuple(map(int, input().split())))
movies.sort(key=lambda x: x[1])
last_end_time = 0
movie_count = 0
for start_time, end_time in movies:
if start_time >= last_end_time:
last_end_time = end_time
movie_count += 1
print(movi... | movies = []
for _ in range(int(input())):
movies.append(tuple(map(int, input().split())))
movies.sort(key=lambda x: x[1])
last_end_time = 0
movie_count = 0
for (start_time, end_time) in movies:
if start_time >= last_end_time:
last_end_time = end_time
movie_count += 1
print(movie_count) |
# 072220
# CodeSignal
# https://app.codesignal.com/arcade/intro/level-6/mCkmbxdMsMTjBc3Bm/solutions
def array_replace(inputArray, elemToReplace, substitutionElem):
# loop through input array
# if element = elemToReplace
# replace that element
for index,i in enumerate(inputArray):
if i == elemT... | def array_replace(inputArray, elemToReplace, substitutionElem):
for (index, i) in enumerate(inputArray):
if i == elemToReplace:
inputArray[index] = substitutionElem
return inputArray |
while True:
print('\n--- MULTIPLICATION TABLE ---')
num = int(input('Type a number integer: '))
if num < 0:
break
for c in range(1, 11):
print(f'{c} X {num} = {c*num}')
print('END PROGRAM') | while True:
print('\n--- MULTIPLICATION TABLE ---')
num = int(input('Type a number integer: '))
if num < 0:
break
for c in range(1, 11):
print(f'{c} X {num} = {c * num}')
print('END PROGRAM') |
def plot(width, height):
for j in range(height):
y = height - j - 1
print("y = {0:3} |".format(y), end="")
for x in range(width):
print("{0:3}".format(f(x,y)), end="")
print()
print(" +", end="")
for x in range(width):
print("---", end="")
prin... | def plot(width, height):
for j in range(height):
y = height - j - 1
print('y = {0:3} |'.format(y), end='')
for x in range(width):
print('{0:3}'.format(f(x, y)), end='')
print()
print(' +', end='')
for x in range(width):
print('---', end='')
prin... |
'''
Psuedo-joystick object for playback of recorded macros
'''
class PlaybackJoystick():
def __init__(self, playback_data):
self.playback_data = playback_data
self.t = 0
def setTime(self, t=0):
self.t = t
def getRawAxis(self, axis):
#TODO fix me, get correct index for ... | """
Psuedo-joystick object for playback of recorded macros
"""
class Playbackjoystick:
def __init__(self, playback_data):
self.playback_data = playback_data
self.t = 0
def set_time(self, t=0):
self.t = t
def get_raw_axis(self, axis):
index = self.t
if index < len(... |
default_app_config = "freight.apps.FreightConfig"
__version__ = "1.5.1"
__title__ = "Freight"
| default_app_config = 'freight.apps.FreightConfig'
__version__ = '1.5.1'
__title__ = 'Freight' |
#
#
# 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 n... | """
Utility for monitoring collected data.
Author: Jeff Kinnison (jkinniso@nd.edu)
"""
class Eventcheckernotcallableexception(Exception):
pass
class Eventhandlernotcallableexception(Exception):
pass
class Eventhandlerdoesnotexistexception(Exception):
pass
class Eventmonitor(object):
"""Checks data ... |
words_file = open('wordlist.txt')
print("export const VALIDGUESSES6 = [")
for word in words_file.read().split('\n'):
word = word.strip()
if word.isalpha() and len(word) == 6:
print(' "%s",' % word.lower())
print("];") | words_file = open('wordlist.txt')
print('export const VALIDGUESSES6 = [')
for word in words_file.read().split('\n'):
word = word.strip()
if word.isalpha() and len(word) == 6:
print(' "%s",' % word.lower())
print('];') |
graph = {}
n = input().split(' ')
node, edge, start = map(int, n)
for i in range(edge):
edge_number = input().split(' ')
n1, n2 = map(int, edge_number)
if n1 not in graph:
graph[n1] = [n2]
elif n2 not in graph[n1]:
graph[n1].append(n2)
if n2 not in graph:
graph[n2] = [... | graph = {}
n = input().split(' ')
(node, edge, start) = map(int, n)
for i in range(edge):
edge_number = input().split(' ')
(n1, n2) = map(int, edge_number)
if n1 not in graph:
graph[n1] = [n2]
elif n2 not in graph[n1]:
graph[n1].append(n2)
if n2 not in graph:
graph[n2] = [n1]... |
#
# PySNMP MIB module TPLINK-COMMANDER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-COMMANDER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:16:55 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) ... |
def hello(name):
return 'Hello ' + 'name'
def test_hello():
assert hello('name') == 'Hello name' | def hello(name):
return 'Hello ' + 'name'
def test_hello():
assert hello('name') == 'Hello name' |
#!/usr/bin/env python
class MatrixUtil:
@classmethod
def allocateMatrix(cls, numRows, numCols):
rv = [0.0] * numRows
for i in range(numRows):
rv[i] = [0.0] * numCols
return rv
@classmethod
def allocateMatrixAsRowMajorArray(cls, numRows, numCols):
return [0.... | class Matrixutil:
@classmethod
def allocate_matrix(cls, numRows, numCols):
rv = [0.0] * numRows
for i in range(numRows):
rv[i] = [0.0] * numCols
return rv
@classmethod
def allocate_matrix_as_row_major_array(cls, numRows, numCols):
return [0.0] * numRows * nu... |
with open("input.txt") as input_file:
lines = input_file.readlines()
result = 0
for line in lines:
print(line.strip(), result)
result += int(line.strip())
print(result)
| with open('input.txt') as input_file:
lines = input_file.readlines()
result = 0
for line in lines:
print(line.strip(), result)
result += int(line.strip())
print(result) |
#License: https://bit.ly/3oLErEI
def test(strs):
return [*map(len, strs)]
strs = ['cat', 'car', 'fear', 'center']
print("Original strings:")
print(strs)
print("Lengths of the said list of non-empty strings:")
print(test(strs))
strs = ['cat', 'dog', 'shatter', 'donut', 'at', 'todo', '']
print("\nOriginal string... | def test(strs):
return [*map(len, strs)]
strs = ['cat', 'car', 'fear', 'center']
print('Original strings:')
print(strs)
print('Lengths of the said list of non-empty strings:')
print(test(strs))
strs = ['cat', 'dog', 'shatter', 'donut', 'at', 'todo', '']
print('\nOriginal strings:')
print(strs)
print('Lengths of the... |
# Write a Python program to compute the greatest common divisor (GCD) of two positive integers.
n1 = int(input("Enter the first number: "))
n2 = int(input("Enter the second number: "))
a1 = []
a2 = []
a3 = []
for i in range(1, n1 + 1):
if n1 % i == 0:
a1.append(i)
for i in range(1, n2 + 1):
if n2 % ... | n1 = int(input('Enter the first number: '))
n2 = int(input('Enter the second number: '))
a1 = []
a2 = []
a3 = []
for i in range(1, n1 + 1):
if n1 % i == 0:
a1.append(i)
for i in range(1, n2 + 1):
if n2 % i == 0:
a2.append(i)
for i in a1:
if i in a2:
a3.append(i)
print(max(a3)) |
# Only used for PyTorch open source BUCK build
IGNORED_ATTRIBUTE_PREFIX = [
"apple",
"fbobjc",
"windows",
"fbandroid",
"macosx",
]
IGNORED_ATTRIBUTES = [
"feature",
"platforms",
]
def filter_attributes(kwgs):
keys = list(kwgs.keys())
# drop unncessary attributes
for key in ke... | ignored_attribute_prefix = ['apple', 'fbobjc', 'windows', 'fbandroid', 'macosx']
ignored_attributes = ['feature', 'platforms']
def filter_attributes(kwgs):
keys = list(kwgs.keys())
for key in keys:
if key in IGNORED_ATTRIBUTES:
kwgs.pop(key)
else:
for invalid_prefix in I... |
# -*- coding: utf-8 -*-
class Solution:
def crackSafe(self, n, k):
if k == 1:
return '0' * n
s = self.deBrujin(n, k)
return s + s[:n - 1]
def deBrujin(self, n, k):
"""See: https://en.wikipedia.org/wiki/De_Bruijn_sequence#Algorithm"""
def _deBrujin(t, p):
... | class Solution:
def crack_safe(self, n, k):
if k == 1:
return '0' * n
s = self.deBrujin(n, k)
return s + s[:n - 1]
def de_brujin(self, n, k):
"""See: https://en.wikipedia.org/wiki/De_Bruijn_sequence#Algorithm"""
def _de_brujin(t, p):
if t > n:
... |
def media_suicida (mediaProvas, mediaTrabalhos):
if mediaProvas >= 5 and mediaTrabalhos >= 5:
return mediaProvas * 0.6 + mediaTrabalhos * 0.4
return min(mediaProvas, mediaTrabalhos)
notasProva = []
notasTrabalho = []
quantidadeProva = int(input("Quantidade de provas: "))
for item in range(quantidade... | def media_suicida(mediaProvas, mediaTrabalhos):
if mediaProvas >= 5 and mediaTrabalhos >= 5:
return mediaProvas * 0.6 + mediaTrabalhos * 0.4
return min(mediaProvas, mediaTrabalhos)
notas_prova = []
notas_trabalho = []
quantidade_prova = int(input('Quantidade de provas: '))
for item in range(quantidadePr... |
print('Begin', __name__)
print('Defines fA')
def fA():
print('Inside fA')
if __name__ == "__main__":
print('Calls fA')
fA()
print('End', __name__)
| print('Begin', __name__)
print('Defines fA')
def f_a():
print('Inside fA')
if __name__ == '__main__':
print('Calls fA')
f_a()
print('End', __name__) |
def find_missing_number(sequence):
try:
numbers = sorted(int(word) for word in sequence.split(" ") if word)
except ValueError:
return 1
return next((i + 1 for i, n in enumerate(numbers) if i + 1 != n), 0) | def find_missing_number(sequence):
try:
numbers = sorted((int(word) for word in sequence.split(' ') if word))
except ValueError:
return 1
return next((i + 1 for (i, n) in enumerate(numbers) if i + 1 != n), 0) |
# Lucas Reicher Prompt #3 - Coding Journal #1
def main():
# Uses formatted strings to output the required info (result & type)
# Adds floats
x = 1.342 # float
y = 3.433 # float
z = x + y # float
float_sum_string = "Addition: {0} + {1} = {2} with type = {3}".format(str(x),str(y),str(z)... | def main():
x = 1.342
y = 3.433
z = x + y
float_sum_string = 'Addition: {0} + {1} = {2} with type = {3}'.format(str(x), str(y), str(z), str(type(z)))
print(float_sum_string)
x = 5
y = 2
z = x - y
float_difference_string = 'Subtraction: {0} - {1} = {2} with type = {3}'.format(str(x), ... |
"""
At infinite membrane resistance, the Neuron does not leak any current out,
and hence it starts firing with the slightest input current,
This shifts the transfer function towards 0, similar to ReLU activation (centered at 0).
Also, when there is minimal refractory time, the neuron can keep firing
at a high input cu... | """
At infinite membrane resistance, the Neuron does not leak any current out,
and hence it starts firing with the slightest input current,
This shifts the transfer function towards 0, similar to ReLU activation (centered at 0).
Also, when there is minimal refractory time, the neuron can keep firing
at a high input cur... |
class Solution:
"""
@param k: The k
@param a: The A
@param b: The B
@return: The answer
"""
def addition(self, k, a, b):
result = ""
i = len(a) - 1
j = len(b) - 1
carry = 0
while i >= 0 and j >= 0:
summ = carry + ord(a[i]) - ord('0') + ord(... | class Solution:
"""
@param k: The k
@param a: The A
@param b: The B
@return: The answer
"""
def addition(self, k, a, b):
result = ''
i = len(a) - 1
j = len(b) - 1
carry = 0
while i >= 0 and j >= 0:
summ = carry + ord(a[i]) - ord('0') + ord... |
# OpenWeatherMap API Key
weather_api_key = "e1067d92d6b631a16363bf4db3023b19"
# Google API Key
g_key = "AIzaSyA4RYdQ1nxoMTIW854C7wvVJMf0Qz5qjNk"
| weather_api_key = 'e1067d92d6b631a16363bf4db3023b19'
g_key = 'AIzaSyA4RYdQ1nxoMTIW854C7wvVJMf0Qz5qjNk' |
class DmsRequestError(Exception):
def __init__(self, error_message, status_code):
self.message = "Error requesting DMS API %s with code %s" \
% (error_message, status_code)
super(DmsRequestError, self).__init__(self.message)
| class Dmsrequesterror(Exception):
def __init__(self, error_message, status_code):
self.message = 'Error requesting DMS API %s with code %s' % (error_message, status_code)
super(DmsRequestError, self).__init__(self.message) |
class Keyword:
def __init__(self, keyword):
if keyword in ['add', 'find']:
self.value = keyword
else:
self.value = 'find'
| class Keyword:
def __init__(self, keyword):
if keyword in ['add', 'find']:
self.value = keyword
else:
self.value = 'find' |
"""Given a string containing only the characters x and y, find whether there are the same number of xs and ys.
balanced("xxxyyy") => true
balanced("yyyxxx") => true
balanced("xxxyyyy") => false
balanced("yyxyxxyxxyyyyxxxyxyx") => true
balanced("xyxxxxyyyxyxxyxxyy") => false
balanced("") => true
balanced("x") =... | """Given a string containing only the characters x and y, find whether there are the same number of xs and ys.
balanced("xxxyyy") => true
balanced("yyyxxx") => true
balanced("xxxyyyy") => false
balanced("yyxyxxyxxyyyyxxxyxyx") => true
balanced("xyxxxxyyyxyxxyxxyy") => false
balanced("") => true
balanced("x") => false
... |
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 28 10:15:21 2021
@author: CC-SXF
"""
| """
Created on Sun Mar 28 10:15:21 2021
@author: CC-SXF
""" |
# import datetime
# import logging
# logger = logging.getLogger(__name__)
# logger.setLevel(logging.INFO)
def run(event, context):
# current_time = datetime.datetime.now().time()
# name = context.function_name
# logger.info("Your cron function " + name + " ran at " + str(current_time))
return "hello ... | def run(event, context):
return 'hello world!' |
# coding: utf-8
class RurouniException(Exception):
pass
class ConfigException(RurouniException):
pass
class TokenBucketFull(RurouniException):
pass
class UnexpectedMetric(RurouniException):
pass | class Rurouniexception(Exception):
pass
class Configexception(RurouniException):
pass
class Tokenbucketfull(RurouniException):
pass
class Unexpectedmetric(RurouniException):
pass |
class ControlStyles(Enum,IComparable,IFormattable,IConvertible):
"""
Specifies the style and behavior of a control.
enum (flags) ControlStyles,values: AllPaintingInWmPaint (8192),CacheText (16384),ContainerControl (1),DoubleBuffer (65536),EnableNotifyMessage (32768),FixedHeight (64),FixedWidth (32),Opaque ... | class Controlstyles(Enum, IComparable, IFormattable, IConvertible):
"""
Specifies the style and behavior of a control.
enum (flags) ControlStyles,values: AllPaintingInWmPaint (8192),CacheText (16384),ContainerControl (1),DoubleBuffer (65536),EnableNotifyMessage (32768),FixedHeight (64),FixedWidth (32),Opaque ... |
"""
how to create a class
a class is constructed through constructor
=> a class can be constructed through specific function called "__init__(self)"
"""
# let's create a Class
class Person:
"""
A class to create a person with the following attributes:
age, marks, phone, user_id, profession, goal
... | """
how to create a class
a class is constructed through constructor
=> a class can be constructed through specific function called "__init__(self)"
"""
class Person:
"""
A class to create a person with the following attributes:
age, marks, phone, user_id, profession, goal
Have the following meth... |
# Write a program that reads a word and prints all substrings, sorted by length. For
# example, if the user provides the input "rum" , the program prints
# r
# u
# m
# ru
# um
# rum
word = str(input("Enter a word: "))
wordLen = len(word)
subLen = 1
start = 0
for i in range(wordLen):
star... | word = str(input('Enter a word: '))
word_len = len(word)
sub_len = 1
start = 0
for i in range(wordLen):
start = 0
while start + subLen <= wordLen:
print(word[start:start + subLen])
start += 1
sub_len += 1 |
x = 100
y = 50
print('x=', x, 'y=', y)
| x = 100
y = 50
print('x=', x, 'y=', y) |
BASE_CASE = {
"model": {
"random_seed": 495279142,
"default_age_grid": "0 0.01917808 0.07671233 1 5 10 20 30 40 50 60 70 80 90 100",
"default_time_grid": "1990 1995 2000 2005 2010 2015 2016",
"add_calc_emr": "from_both",
"birth_prev": 0,
"ode_step_size": 5,
"m... | base_case = {'model': {'random_seed': 495279142, 'default_age_grid': '0 0.01917808 0.07671233 1 5 10 20 30 40 50 60 70 80 90 100', 'default_time_grid': '1990 1995 2000 2005 2010 2015 2016', 'add_calc_emr': 'from_both', 'birth_prev': 0, 'ode_step_size': 5, 'minimum_meas_cv': 0.2, 'rate_case': 'iota_pos_rho_zero', 'data_... |
#Write a function named "falling_distance" that accepts an object's falling time
#(in seconds) as an argument. The function should return the distance, in meters
#, that the object has fallen during the time interval.Write a program that
#calls the function in a loop that passes the values 1 through 10 as arguments
... | def main():
print("This program shows an object's fall distance (in meters) with each")
print('passing second from 1 to 10.')
print()
print('Time(s)\tDistance(m)')
print('--------------------')
for time in range(10 + 1):
distance = falling_distance(time)
print(time, '\t', format(... |
"""Represent the command parameter strings."""
ARG_COMMAND = 'command'
ARG_ARGUMENT = 'argument'
ARG_COUNT = 'count'
ARG_CHANNEL = 'channel'
ARG_CLIENT = 'client'
ARG_GUID = 'guid'
ARG_CHANGELIST = 'cl'
ARG_DEV_CHANNEL = 'dev_channel'
ARG_QUEUE_WORKER_NUMBER = 'worker_number'
ARG_CALLBACK = 'callback'
ARG_PAYLOAD = 'pa... | """Represent the command parameter strings."""
arg_command = 'command'
arg_argument = 'argument'
arg_count = 'count'
arg_channel = 'channel'
arg_client = 'client'
arg_guid = 'guid'
arg_changelist = 'cl'
arg_dev_channel = 'dev_channel'
arg_queue_worker_number = 'worker_number'
arg_callback = 'callback'
arg_payload = 'pa... |
a=list(input().split(','))
st,num=[],[]
for i in a:
s1,n=i.split(':')
st.append(s1)
num.append(n)
print(st)
print(num)
for i in range(len(num)):
for j in range(i):
print(st[j])
| a = list(input().split(','))
(st, num) = ([], [])
for i in a:
(s1, n) = i.split(':')
st.append(s1)
num.append(n)
print(st)
print(num)
for i in range(len(num)):
for j in range(i):
print(st[j]) |
"""
Discussion:
Because we have a facilitatory synapses, as the input rate increases synaptic
resources released per spike also increase. Therefore, we expect that the synaptic
conductance will increase with input rate. However, total synaptic resources are
finite. And they recover in a finite time. Therefore, at... | """
Discussion:
Because we have a facilitatory synapses, as the input rate increases synaptic
resources released per spike also increase. Therefore, we expect that the synaptic
conductance will increase with input rate. However, total synaptic resources are
finite. And they recover in a finite time. Therefore, at ... |
GitHubTarballPackage ('mono', 'mono-basic', '3.0', 'a74642af7f72d1012c87d82d7a12ac04a17858d5',
configure = './configure --prefix="%{prefix}"',
override_properties = { 'make': 'make' }
)
| git_hub_tarball_package('mono', 'mono-basic', '3.0', 'a74642af7f72d1012c87d82d7a12ac04a17858d5', configure='./configure --prefix="%{prefix}"', override_properties={'make': 'make'}) |
# Asking for height and weight input
height = float(input("What is your height in meters: "))
weight = float(input("What is your weight in kilograms: "))
# Calculating BMI (formula is weight/height^2)
bmi = str(round(weight/(height ** 2), 2))
# Printing BMI
print("Your BMI is " + bmi)
| height = float(input('What is your height in meters: '))
weight = float(input('What is your weight in kilograms: '))
bmi = str(round(weight / height ** 2, 2))
print('Your BMI is ' + bmi) |
# IMAGES #
# UI NAVIGATION #
img_addFriend = "add_friend.png"
img_allow = "allow.png"
img_allowFlash = "enableflash_0.png"
img_allowFlash1 = "enableflash_1.png"
img_allowFlash2 = "enableflash_2.png"
img_alreadyStarted = "alreadystarted.png"
img_alreadyStarted1 = "alreadystarted1.png"
img_backButton = "back_button.png... | img_add_friend = 'add_friend.png'
img_allow = 'allow.png'
img_allow_flash = 'enableflash_0.png'
img_allow_flash1 = 'enableflash_1.png'
img_allow_flash2 = 'enableflash_2.png'
img_already_started = 'alreadystarted.png'
img_already_started1 = 'alreadystarted1.png'
img_back_button = 'back_button.png'
img_beginning_game = '... |
class EfficiencyMeasurement():
# input_voltage = None
# input_current = None
# output_voltage = None
# output_current = None
# input_power = None
# output_power = None
# loss_power = None
# efficiency = None
def __init__(self, input_voltage: float, input_current: float,
... | class Efficiencymeasurement:
def __init__(self, input_voltage: float, input_current: float, output_voltage: float, output_current: float):
self.input_voltage = input_voltage
self.input_current = input_current
self.output_voltage = output_voltage
self.output_current = output_current
... |
class Y:
def __init__(self, v0):
self.v0 = v0
self.g = 9.81
def value(self, t):
return self.v0*t - 0.5*self.g*t**2
def formula(self):
return "v0*t - 0.5*g*t**2; v0=%g" % self.v0
| class Y:
def __init__(self, v0):
self.v0 = v0
self.g = 9.81
def value(self, t):
return self.v0 * t - 0.5 * self.g * t ** 2
def formula(self):
return 'v0*t - 0.5*g*t**2; v0=%g' % self.v0 |
"""
* Problem Description
*Suppose you are a university student and you need to pay 1536 dollars as a tuition fee.
*The college is offering a 10% discount on the early payment. How much money do you have to pay if you make an early payment?
*Task
*Create a variable named fee and assign 1536 to it.
*Create another ... | """
* Problem Description
*Suppose you are a university student and you need to pay 1536 dollars as a tuition fee.
*The college is offering a 10% discount on the early payment. How much money do you have to pay if you make an early payment?
*Task
*Create a variable named fee and assign 1536 to it.
*Create another ... |
"""
PASSENGERS
"""
numPassengers = 19216
passenger_arriving = (
(7, 4, 4, 3, 2, 1, 4, 2, 4, 2, 0, 0, 0, 7, 5, 8, 3, 7, 1, 3, 0, 1, 2, 1, 1, 0), # 0
(4, 7, 2, 3, 3, 1, 2, 5, 2, 1, 1, 0, 0, 6, 4, 4, 3, 2, 1, 5, 1, 1, 1, 0, 1, 0), # 1
(6, 4, 5, 6, 2, 1, 2, 4, 1, 1, 0, 0, 0, 11, 3, 6, 7, 7, 0, 3, 2, 1, 2, 0, 0, 0),... | """
PASSENGERS
"""
num_passengers = 19216
passenger_arriving = ((7, 4, 4, 3, 2, 1, 4, 2, 4, 2, 0, 0, 0, 7, 5, 8, 3, 7, 1, 3, 0, 1, 2, 1, 1, 0), (4, 7, 2, 3, 3, 1, 2, 5, 2, 1, 1, 0, 0, 6, 4, 4, 3, 2, 1, 5, 1, 1, 1, 0, 1, 0), (6, 4, 5, 6, 2, 1, 2, 4, 1, 1, 0, 0, 0, 11, 3, 6, 7, 7, 0, 3, 2, 1, 2, 0, 0, 0), (6, 3, 6, 7, 6,... |
class ATMOS(object):
'''
class ATMOS
- attributes:
- self defined
- methods:
- None
'''
def __init__(self,info):
self.info = info
for key in info.keys():
setattr(self, key, info[key])
def __repr__(self):
return 'Instance of class AT... | class Atmos(object):
"""
class ATMOS
- attributes:
- self defined
- methods:
- None
"""
def __init__(self, info):
self.info = info
for key in info.keys():
setattr(self, key, info[key])
def __repr__(self):
return 'Instance of class ATMOS' |
t=int(input())
if not (1 <= t <= 100000): exit(-1)
dp=[0]*100001
dp[3]=3
for i in range(4,100001):
if i%3==0 or i%7==0: dp[i]=i
dp[i]+=dp[i-1]
query=[*map(int,input().split())]
if len(query)!=t: exit(-1)
for i in query:
if not (10 <= int(i) <= 80000): exit(-1)
print(dp[int(i)])
succ=False
try: input(... | t = int(input())
if not 1 <= t <= 100000:
exit(-1)
dp = [0] * 100001
dp[3] = 3
for i in range(4, 100001):
if i % 3 == 0 or i % 7 == 0:
dp[i] = i
dp[i] += dp[i - 1]
query = [*map(int, input().split())]
if len(query) != t:
exit(-1)
for i in query:
if not 10 <= int(i) <= 80000:
exit(-1)... |
"""
Define the environment paths
"""
#Path variables
TEMPLATE_PATH = "/home/scom/documents/opu_surveillance_system/monitoring/master/"
STATIC_PATH = "/home/scom/documents/opu_surveillance_system/monitoring/static/"
| """
Define the environment paths
"""
template_path = '/home/scom/documents/opu_surveillance_system/monitoring/master/'
static_path = '/home/scom/documents/opu_surveillance_system/monitoring/static/' |
N = int(input())
A = list(map(int, input().split()))
ans = 0
for a in A:
if a > 10:
ans += a - 10
print(ans) | n = int(input())
a = list(map(int, input().split()))
ans = 0
for a in A:
if a > 10:
ans += a - 10
print(ans) |
#!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, "espcms")
whatweb.recog_from_file(pluginname, "templates/wap/cn/public/footer.html", "espcms")
| def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, 'espcms')
whatweb.recog_from_file(pluginname, 'templates/wap/cn/public/footer.html', 'espcms') |
vetor = []
entradaUsuario = int(input())
repetir = 1000
indice = 0
adicionar = 0
while(repetir > 0):
vetor.append(adicionar)
adicionar += 1
if(adicionar == entradaUsuario):
adicionar = 0
repetir -= 1
repetir = 1000
while(repetir>0):
repetir -= 1
print("N[{}] = {}".format(indice, vetor[indice]))
indic... | vetor = []
entrada_usuario = int(input())
repetir = 1000
indice = 0
adicionar = 0
while repetir > 0:
vetor.append(adicionar)
adicionar += 1
if adicionar == entradaUsuario:
adicionar = 0
repetir -= 1
repetir = 1000
while repetir > 0:
repetir -= 1
print('N[{}] = {}'.format(indice, vetor[in... |
# -*- coding: utf-8 -*-
"""
eve-app settings
"""
# Use the MongoHQ sandbox as our backend.
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_USERNAME = ''
MONGO_PASSWORD = ''
MONGO_DBNAME = 'notifications'
# also, correctly set the API entry point
# SERVER_NAME = 'localhost'
# Enable reads (GET), inserts (POS... | """
eve-app settings
"""
mongo_host = 'localhost'
mongo_port = 27017
mongo_username = ''
mongo_password = ''
mongo_dbname = 'notifications'
resource_methods = ['GET', 'POST', 'DELETE']
item_methods = ['GET', 'PATCH', 'DELETE']
cache_control = 'max-age=20'
cache_expires = 20
x_domains = '*'
x_headers = ['Authorizati... |
# AUTHOR = PAUL KEARNEY
# DATE = 2018-02-05
# STUDENT ID = G00364787
# EXERCISE 03
#
# filename= gmit--exercise03--collatz--20180205d.py
#
# the Collatz conjecture
print("The COLLATZ CONJECTURE")
# define the variables
num = ""
x = 0
# obtain user input
num = input("A start nummber: ")
x = int(... | print('The COLLATZ CONJECTURE')
num = ''
x = 0
num = input('A start nummber: ')
x = int(num)
print('--Start of sequence.')
print(x)
while x != 1:
if x % 2 == 0:
x = x / 2
else:
x = x * 3 + 1
print(int(x))
print('--End of sequence') |
"""django-livereload"""
__version__ = '1.7'
__license__ = 'BSD License'
__author__ = 'Fantomas42'
__email__ = 'fantomas42@gmail.com'
__url__ = 'https://github.com/Fantomas42/django-livereload'
| """django-livereload"""
__version__ = '1.7'
__license__ = 'BSD License'
__author__ = 'Fantomas42'
__email__ = 'fantomas42@gmail.com'
__url__ = 'https://github.com/Fantomas42/django-livereload' |
DEFAULT_TEXT_TYPE = "mrkdwn"
class BaseBlock:
def generate(self):
raise NotImplemented("Subclass missing generate implementation")
class TextBlock(BaseBlock):
def __init__(self, text, _type=DEFAULT_TEXT_TYPE):
self._text = text
self._type = _type
def __repr__(self):
retu... | default_text_type = 'mrkdwn'
class Baseblock:
def generate(self):
raise not_implemented('Subclass missing generate implementation')
class Textblock(BaseBlock):
def __init__(self, text, _type=DEFAULT_TEXT_TYPE):
self._text = text
self._type = _type
def __repr__(self):
ret... |
#Script to calc. area of circle.
print("enter the radius")
r= float(input())
area= 3.14*r**2
print("area of circle is",area)
| print('enter the radius')
r = float(input())
area = 3.14 * r ** 2
print('area of circle is', area) |
#doc4
#1.
print([1, 'Hello', 1.0])
#2
print([1, 1, [1,2]][2][1])
#3. out: 'b', 'c'
print(['a','b', 'c'][1:])
#4.
weekDict= {'Sunday':0,'Monday':1,'Tuesday':2,'Wednesday':3,'Thursday':4,'Friday':5,'Saturday':6, }
#5. out: 2 if you replace D[k1][1] with D['k1][1]
D={'k1':[1,2,3]}
print(D['k1'][1])
#6.
tup = ( ... | print([1, 'Hello', 1.0])
print([1, 1, [1, 2]][2][1])
print(['a', 'b', 'c'][1:])
week_dict = {'Sunday': 0, 'Monday': 1, 'Tuesday': 2, 'Wednesday': 3, 'Thursday': 4, 'Friday': 5, 'Saturday': 6}
d = {'k1': [1, 2, 3]}
print(D['k1'][1])
tup = ('a', [1, [2, 3]])
print(tup)
x = set('Missipi')
print(x)
x.add('X')
print(x)
prin... |
description = 'Resi instrument setup'
group = 'basic'
includes = ['base']
| description = 'Resi instrument setup'
group = 'basic'
includes = ['base'] |
def quick_sort(array):
'''
Prototypical quick sort algorithm using Python
Time and Space Complexity:
* Best: O(n * log(n)) time | O(log(n)) space
* Avg: O(n * log(n)) time | O(log(n)) space
* Worst: O(n^2) time | O(log(n)) space
'''
return _quick_sort(array, 0, len(array)-1)
def _quick_sort(arr... | def quick_sort(array):
"""
Prototypical quick sort algorithm using Python
Time and Space Complexity:
* Best: O(n * log(n)) time | O(log(n)) space
* Avg: O(n * log(n)) time | O(log(n)) space
* Worst: O(n^2) time | O(log(n)) space
"""
return _quick_sort(array, 0, len(array) - 1)
def _quick_sor... |
def loops():
# String Array
names = ["Apple", "Orange", "Pear"]
# \n is a newline in a string
print('\n---------------')
print(' For Each Loop')
print('---------------\n')
# For Each Loop
for i in names:
print(i)
print('\n---------------')
print(' For Loop')
prin... | def loops():
names = ['Apple', 'Orange', 'Pear']
print('\n---------------')
print(' For Each Loop')
print('---------------\n')
for i in names:
print(i)
print('\n---------------')
print(' For Loop')
print('---------------\n')
for i in range(5):
if i == 1:
... |
class Node:
def __init__(self, value, next_p=None):
self.next = next_p
self.value = value
def __str__(self):
return f'{self.value}'
class InvalidOperationError(Exception):
pass
class Stack:
def __init__(self):
self.top = None
def push(self, value):
curren... | class Node:
def __init__(self, value, next_p=None):
self.next = next_p
self.value = value
def __str__(self):
return f'{self.value}'
class Invalidoperationerror(Exception):
pass
class Stack:
def __init__(self):
self.top = None
def push(self, value):
curre... |
def main():
number = int(input("Enter number (Only positive integer is allowed)"))
print(f'{number} square is {number ** 2}')
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
main()
| def main():
number = int(input('Enter number (Only positive integer is allowed)'))
print(f'{number} square is {number ** 2}')
if __name__ == '__main__':
main() |
number_of_computers = int(input())
number_of_sales = 0
real_sales = 0
made_sales = 0
counter_sales = 0
total_ratings = 0
for i in range (number_of_computers):
rating = int(input())
rating_scale = rating % 10
possible_sales = rating // 10
total_ratings += rating_scale
if rating_scale == 2:
r... | number_of_computers = int(input())
number_of_sales = 0
real_sales = 0
made_sales = 0
counter_sales = 0
total_ratings = 0
for i in range(number_of_computers):
rating = int(input())
rating_scale = rating % 10
possible_sales = rating // 10
total_ratings += rating_scale
if rating_scale == 2:
rea... |
"""
Created: 2001/08/05
Purpose: Turn PythonCard into a package
__version__ = "$Revision: 1.1.1.1 $"
__date__ = "$Date: 2001/08/06 19:53:11 $"
"""
| """
Created: 2001/08/05
Purpose: Turn PythonCard into a package
__version__ = "$Revision: 1.1.1.1 $"
__date__ = "$Date: 2001/08/06 19:53:11 $"
""" |
def main():
valid_passwords_by_range_policy = 0
valid_passwords_by_position_policy = 0
with open('input') as f:
for line in f:
policy_string, password = parse_line(line.strip())
policy = Policy.parse(policy_string)
if policy.is_valid_by_range_policy(password):
... | def main():
valid_passwords_by_range_policy = 0
valid_passwords_by_position_policy = 0
with open('input') as f:
for line in f:
(policy_string, password) = parse_line(line.strip())
policy = Policy.parse(policy_string)
if policy.is_valid_by_range_policy(password):
... |
# LTE using two pointers O(n**3)
class Solution(object):
def fourSumCount(self, A, B, C, D):
# corner case:
if len(A) == 0:
return 0
A.sort()
B.sort()
C.sort()
D.sort()
count = 0
for i in range(len(A)):
for j in range(len(B)... | class Solution(object):
def four_sum_count(self, A, B, C, D):
if len(A) == 0:
return 0
A.sort()
B.sort()
C.sort()
D.sort()
count = 0
for i in range(len(A)):
for j in range(len(B)):
k = 0
t = len(D) - 1
... |
def tree_16b(features):
if features[12] <= 0.0026689696301218646:
if features[2] <= 0.00825153129312639:
if features[19] <= 0.005966400067336508:
if features[19] <= 0.0029812112336458085:
if features[17] <= 0.001915214421615019:
return 0
else: # if features[17] > 0.0... | def tree_16b(features):
if features[12] <= 0.0026689696301218646:
if features[2] <= 0.00825153129312639:
if features[19] <= 0.005966400067336508:
if features[19] <= 0.0029812112336458085:
if features[17] <= 0.001915214421615019:
return ... |
class Employee:
def __init__(self, name, emp_id, email_id):
self.__name=name
self.__emp_id=emp_id
self.__email_id=email_id
def get_name(self):
return self.__name
def get_emp_id(self):
return self.__emp_id
def get_email_id(self):
return self.__email_id
... | class Employee:
def __init__(self, name, emp_id, email_id):
self.__name = name
self.__emp_id = emp_id
self.__email_id = email_id
def get_name(self):
return self.__name
def get_emp_id(self):
return self.__emp_id
def get_email_id(self):
return self.__ema... |
class tablecloumninfo:
col_name=""
data_type=""
comment=""
def __init__(self,col_name,data_type,comment):
self.col_name=col_name
self.data_type=data_type
self.comment=comment
| class Tablecloumninfo:
col_name = ''
data_type = ''
comment = ''
def __init__(self, col_name, data_type, comment):
self.col_name = col_name
self.data_type = data_type
self.comment = comment |
class GraphLearner:
"""Base class for causal discovery methods.
Subclasses implement different discovery methods. All discovery methods are in the package "dowhy.causal_discoverers"
"""
def __init__(self, data, library_class, *args, **kwargs):
self._data = data
self._labels = list(self._data.columns)
self... | class Graphlearner:
"""Base class for causal discovery methods.
Subclasses implement different discovery methods. All discovery methods are in the package "dowhy.causal_discoverers"
"""
def __init__(self, data, library_class, *args, **kwargs):
self._data = data
self._labels = list(self._dat... |
"""
aiida_crystal_dft
AiiDA plugin for running the CRYSTAL code
"""
__version__ = "0.8"
| """
aiida_crystal_dft
AiiDA plugin for running the CRYSTAL code
"""
__version__ = '0.8' |
class attributes_de:
def __init__(self,threshold_list,range_for_r):
self.country_name = 'Germany'
self.population = 83190556
self.url = 'https://opendata.arcgis.com/datasets/dd4580c810204019a7b8eb3e0b329dd6_0.geojson'
self.contains_tests=False
self.csv=False # if the resource... | class Attributes_De:
def __init__(self, threshold_list, range_for_r):
self.country_name = 'Germany'
self.population = 83190556
self.url = 'https://opendata.arcgis.com/datasets/dd4580c810204019a7b8eb3e0b329dd6_0.geojson'
self.contains_tests = False
self.csv = False
se... |
"""
Common bazel version requirements for tests
"""
CURRENT_BAZEL_VERSION = "5.0.0"
OTHER_BAZEL_VERSIONS = [
"4.2.2",
]
SUPPORTED_BAZEL_VERSIONS = [
CURRENT_BAZEL_VERSION,
] + OTHER_BAZEL_VERSIONS
| """
Common bazel version requirements for tests
"""
current_bazel_version = '5.0.0'
other_bazel_versions = ['4.2.2']
supported_bazel_versions = [CURRENT_BAZEL_VERSION] + OTHER_BAZEL_VERSIONS |
# See also examples/example_track/track_meta.py for a longer, commented example
track = dict(
author_username='dansbecker',
course_name='Machine Learning',
course_url='https://www.kaggle.com/learn/intro-to-machine-learning'
)
lessons = [
dict(
topic='Your First BiqQuery ML Model',
... | track = dict(author_username='dansbecker', course_name='Machine Learning', course_url='https://www.kaggle.com/learn/intro-to-machine-learning')
lessons = [dict(topic='Your First BiqQuery ML Model')]
notebooks = [dict(filename='tut1.ipynb', lesson_idx=0, type='tutorial', scriptid=4076893), dict(filename='ex1.ipynb', les... |
class Solution:
def canThreePartsEqualSum(self, A: List[int]) -> bool:
# Since all the three parts are equal, if we sum all element of arrary it should be a multiplication of 3
# so the sum of each part must be equal to sum of all element divided by 3
quotient, remainder = divmod(sum(A), 3)
... | class Solution:
def can_three_parts_equal_sum(self, A: List[int]) -> bool:
(quotient, remainder) = divmod(sum(A), 3)
if remainder != 0:
return False
subarray = 0
partitions = 0
for num in A:
subarray += num
if subarray == quotient:
... |
STATE_CITY = "fluids_state_city"
OBS_QLIDAR = "fluids_obs_qlidar"
OBS_GRID = "fluids_obs_grid"
OBS_BIRDSEYE = "fluids_obs_birdseye"
OBS_NONE = "fluids_obs_none"
BACKGROUND_CSP = "fluids_background_csp"
BACKGROUND_NULL = "fluids_background_null"
REWARD_PATH = "fluids_reward_path"
REWARD_NONE = "fluids_rew... | state_city = 'fluids_state_city'
obs_qlidar = 'fluids_obs_qlidar'
obs_grid = 'fluids_obs_grid'
obs_birdseye = 'fluids_obs_birdseye'
obs_none = 'fluids_obs_none'
background_csp = 'fluids_background_csp'
background_null = 'fluids_background_null'
reward_path = 'fluids_reward_path'
reward_none = 'fluids_reward_none'
right... |
class Solution:
def generate(self, num_rows):
if num_rows == 0:
return []
ans = [1]
result = [ans]
for _ in range(num_rows - 1):
ans = [1] + [ans[i] + ans[i + 1] for i in range(len(ans[:-1]))] + [1]
result.append(ans)
return result
| class Solution:
def generate(self, num_rows):
if num_rows == 0:
return []
ans = [1]
result = [ans]
for _ in range(num_rows - 1):
ans = [1] + [ans[i] + ans[i + 1] for i in range(len(ans[:-1]))] + [1]
result.append(ans)
return result |
for testcase in range(int(input())):
n = int(input())
dict = {}
comb = 1
m = (10**9)+7
for x in input().split():
no = int(x)
try:
dict[no] = dict[no] + 1
except:
dict[no] = 1
dict = list(dict.items())
dict.sort(key=lambda x: x[0], reverse=Tru... | for testcase in range(int(input())):
n = int(input())
dict = {}
comb = 1
m = 10 ** 9 + 7
for x in input().split():
no = int(x)
try:
dict[no] = dict[no] + 1
except:
dict[no] = 1
dict = list(dict.items())
dict.sort(key=lambda x: x[0], reverse=Tru... |
class Timer:
def __init__(self, duration, ticks):
self.duration = duration
self.ticks = ticks
self.thread = None
def start(self):
pass
# start Thread here
| class Timer:
def __init__(self, duration, ticks):
self.duration = duration
self.ticks = ticks
self.thread = None
def start(self):
pass |
#MAIN PROGRAM STARTS HERE:
num = int(input('Enter the number of rows and columns for the square: '))
for x in range(1, num + 1):
for y in range(1, num - 2 + 1):
print ('{} {} '.format(x, y), end='')
print() | num = int(input('Enter the number of rows and columns for the square: '))
for x in range(1, num + 1):
for y in range(1, num - 2 + 1):
print('{} {} '.format(x, y), end='')
print() |
class PrivilegeNotHeldException(UnauthorizedAccessException):
"""
The exception that is thrown when a method in the System.Security.AccessControl namespace attempts to enable a privilege that it does not have.
PrivilegeNotHeldException()
PrivilegeNotHeldException(privilege: str)
PrivilegeNotHeldExcepti... | class Privilegenotheldexception(UnauthorizedAccessException):
"""
The exception that is thrown when a method in the System.Security.AccessControl namespace attempts to enable a privilege that it does not have.
PrivilegeNotHeldException()
PrivilegeNotHeldException(privilege: str)
PrivilegeNotHeldException(... |
def segmented_sieve(n):
# Create an boolean array with all values True
primes = [True]*n
for p in range(2,n):
#If prime[p] is True,it is a prime and its multiples are not prime
if primes[p]:
for i in range(2*p,n,p):
# Mark every multiple of a prime as not prim... | def segmented_sieve(n):
primes = [True] * n
for p in range(2, n):
if primes[p]:
for i in range(2 * p, n, p):
primes[i] = False
for l in range(2, n):
if primes[l]:
print(f'{l} ')
while True:
try:
input_value = int(input('Please a number: '))... |
def test_test():
"""A generic test
:return:
"""
assert True
| def test_test():
"""A generic test
:return:
"""
assert True |
class AuxPowMixin(object):
AUXPOW_START_HEIGHT = 0
AUXPOW_CHAIN_ID = 0x0001
BLOCK_VERSION_AUXPOW_BIT = 0
@classmethod
def is_auxpow_active(cls, header) -> bool:
height_allows_auxpow = header['block_height'] >= cls.AUXPOW_START_HEIGHT
version_allows_auxpow = header['version'] & cls.B... | class Auxpowmixin(object):
auxpow_start_height = 0
auxpow_chain_id = 1
block_version_auxpow_bit = 0
@classmethod
def is_auxpow_active(cls, header) -> bool:
height_allows_auxpow = header['block_height'] >= cls.AUXPOW_START_HEIGHT
version_allows_auxpow = header['version'] & cls.BLOCK_... |
#!/usr/bin/env python3
#filter sensitive words in user's input
def replace_sensitive_words(input_word):
s_words = []
with open('filtered_words','r') as f:
line = f.readline()
while line != '':
s_words.append(line.strip())
line = f.readline()
for word in s_words:
... | def replace_sensitive_words(input_word):
s_words = []
with open('filtered_words', 'r') as f:
line = f.readline()
while line != '':
s_words.append(line.strip())
line = f.readline()
for word in s_words:
if word in input_word:
input_word = input_word.... |
#Calcular el salario neto de un tnrabajador en fucion del numero de horas trabajadas, el precio de la hora
#y el descuento fijo al sueldo base por concepto de impuestos del 20%
horas = float(input("Ingrese el numero de horas trabajadas: "))
precio_hora = float(input("Ingrese el precio por hora trabajada: "))
sueldo_ba... | horas = float(input('Ingrese el numero de horas trabajadas: '))
precio_hora = float(input('Ingrese el precio por hora trabajada: '))
sueldo_base = float(input('Ingrese el valor del sueldo base: '))
pago_hora = horas * precio_hora
impuesto = 0.2
salario_neto = pago_hora + sueldo_base * 0.8
print(f'Si el trabajador tiene... |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# 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 la... | """Actions to manipulate debug symbol outputs."""
load('@build_bazel_rules_apple//apple/bundling:file_actions.bzl', 'file_actions')
def _collect_linkmaps(ctx, debug_outputs, bundle_name):
"""Collects the available linkmaps from the binary.
Args:
ctx: The current context.
debug_outputs: dSYM bundle... |
class Runtime:
@staticmethod
def v3(major: str, feature: str, ml_type: str = None, scala_version: str = "2.12"):
if ml_type and ml_type.lower() not in ["cpu", "gpu"]:
raise ValueError('"ml_type" can only be "cpu" or "gpu"!')
return "".join(
[
f"{major}.",
... | class Runtime:
@staticmethod
def v3(major: str, feature: str, ml_type: str=None, scala_version: str='2.12'):
if ml_type and ml_type.lower() not in ['cpu', 'gpu']:
raise value_error('"ml_type" can only be "cpu" or "gpu"!')
return ''.join([f'{major}.', f'{feature}.x', '' if not ml_typ... |
s = 'abc'; print(s.isupper(), s)
s = 'Abc'; print(s.isupper(), s)
s = 'aBc'; print(s.isupper(), s)
s = 'abC'; print(s.isupper(), s)
s = 'abc'; print(s.isupper(), s)
s = 'ABC'; print(s.isupper(), s)
s = 'abc'; print(s.capitalize().isupper(), s.capitalize())
| s = 'abc'
print(s.isupper(), s)
s = 'Abc'
print(s.isupper(), s)
s = 'aBc'
print(s.isupper(), s)
s = 'abC'
print(s.isupper(), s)
s = 'abc'
print(s.isupper(), s)
s = 'ABC'
print(s.isupper(), s)
s = 'abc'
print(s.capitalize().isupper(), s.capitalize()) |
#!/usr/bin/env python
'''
Global Variables convention:
* start with UpperCase
* have no _ character
* may have mid UpperCase words
'''
Debug = True
Silent = True
Verbose = False
CustomerName = 'customer_name'
AuthHeader = {'Content-Type': 'application/json'}
BaseURL = "https://firewall-api.d-zone.ca"
... | """
Global Variables convention:
* start with UpperCase
* have no _ character
* may have mid UpperCase words
"""
debug = True
silent = True
verbose = False
customer_name = 'customer_name'
auth_header = {'Content-Type': 'application/json'}
base_url = 'https://firewall-api.d-zone.ca'
auth_url = 'https://fir... |
"""Base observer class for weighmail operations.
"""
class BaseObserver(object):
"""Base observer class; does nothing."""
def searching(self, label):
"""Called when the search process has started for a label"""
pass
def labeling(self, label, count):
"""Called when the labelling p... | """Base observer class for weighmail operations.
"""
class Baseobserver(object):
"""Base observer class; does nothing."""
def searching(self, label):
"""Called when the search process has started for a label"""
pass
def labeling(self, label, count):
"""Called when the labelling p... |
#
# PySNMP MIB module FUNI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FUNI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:03:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint) ... |
x = 5
x |= 3
print(x)
| x = 5
x |= 3
print(x) |
## CUDA blocks are initialized here!
## Created by: Aditya Atluri
## Date: Mar 03 2014
def bx(blocks_dec, kernel):
if blocks_dec == False:
string = "int bx = blockIdx.x;\n"
kernel = kernel + string
blocks_dec = True
return kernel, blocks_dec
def by(blocks_dec, kernel):
if blocks_dec == False:
string = "int... | def bx(blocks_dec, kernel):
if blocks_dec == False:
string = 'int bx = blockIdx.x;\n'
kernel = kernel + string
blocks_dec = True
return (kernel, blocks_dec)
def by(blocks_dec, kernel):
if blocks_dec == False:
string = 'int by = blockIdx.y;\n'
kernel = kernel + string... |
def sample(name, custom_package):
native.android_binary(
name = name,
deps = [":sdk"],
srcs = native.glob(["samples/" + name + "/src/**/*.java"]),
custom_package = custom_package,
manifest = "samples/" + name + "/AndroidManifest.xml",
resource_files = native.glob(["sa... | def sample(name, custom_package):
native.android_binary(name=name, deps=[':sdk'], srcs=native.glob(['samples/' + name + '/src/**/*.java']), custom_package=custom_package, manifest='samples/' + name + '/AndroidManifest.xml', resource_files=native.glob(['samples/' + name + '/res/**/*'])) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.