content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""Constants for Traccar integration."""
CONF_MAX_ACCURACY = "max_accuracy"
CONF_SKIP_ACCURACY_ON = "skip_accuracy_filter_on"
ATTR_ADDRESS = "address"
ATTR_CATEGORY = "category"
ATTR_GEOFENCE = "geofence"
ATTR_MOTION = "motion"
ATTR_SPEED = "speed"
ATTR_TRACKER = "tracker"
ATTR_TRACCAR_ID = "traccar_id"
ATTR_STATUS =... | """Constants for Traccar integration."""
conf_max_accuracy = 'max_accuracy'
conf_skip_accuracy_on = 'skip_accuracy_filter_on'
attr_address = 'address'
attr_category = 'category'
attr_geofence = 'geofence'
attr_motion = 'motion'
attr_speed = 'speed'
attr_tracker = 'tracker'
attr_traccar_id = 'traccar_id'
attr_status = '... |
# Input: x = 123
# Output: 321
# Input: x = -123
# Output: -321
class Solution:
def reverse(self, x: int) -> int:
string = str(abs(x))
reversed = int(string[::-1])
if reversed > 2147483647:
return 0
elif x > 0:
return reversed
return -1 * reversed... | class Solution:
def reverse(self, x: int) -> int:
string = str(abs(x))
reversed = int(string[::-1])
if reversed > 2147483647:
return 0
elif x > 0:
return reversed
return -1 * reversed |
primes = []
def is_prime(number):
for i in primes:
if number % i == 0:
return False
return True
def get_prime(target):
i = 1
while(len(primes)< target):
i += 1
if is_prime(i):
primes.append(i)
return primes[-1]
print(get_prime(10001))
| primes = []
def is_prime(number):
for i in primes:
if number % i == 0:
return False
return True
def get_prime(target):
i = 1
while len(primes) < target:
i += 1
if is_prime(i):
primes.append(i)
return primes[-1]
print(get_prime(10001)) |
load(":utils.bzl", "CONDA_EXT_MAP", "EXECUTE_TIMEOUT", "INSTALLER_SCRIPT_EXT_MAP", "execute_waitable_windows", "get_arch", "get_os", "windowsify")
# CONDA CONFIGURATION
CONDA_MAJOR = "3"
CONDA_MINOR = "py39_4.10.3"
CONDA_SHA = {
"Windows": {
"x86_64": "b33797064593ab2229a0135dc69001bea05cb56a20c2f243b12312... | load(':utils.bzl', 'CONDA_EXT_MAP', 'EXECUTE_TIMEOUT', 'INSTALLER_SCRIPT_EXT_MAP', 'execute_waitable_windows', 'get_arch', 'get_os', 'windowsify')
conda_major = '3'
conda_minor = 'py39_4.10.3'
conda_sha = {'Windows': {'x86_64': 'b33797064593ab2229a0135dc69001bea05cb56a20c2f243b1231213642e260a', 'x86': '24f438e57ff2ef1c... |
num=int(input("Enter a number to be reversed: "))
print("The number in reversed order is: ")
for i in range(len(str(num))):
m=num%10
print(m,end='')
num//=10 | num = int(input('Enter a number to be reversed: '))
print('The number in reversed order is: ')
for i in range(len(str(num))):
m = num % 10
print(m, end='')
num //= 10 |
#
# @lc app=leetcode id=320 lang=python3
#
# [320] Generalized Abbreviation
#
# @lc code=start
class Solution:
def generateAbbreviations(self, word: str):
if not word:
return [""]
ans = ['']
for i in range(len(word)):
temp = []
for item in ans:
... | class Solution:
def generate_abbreviations(self, word: str):
if not word:
return ['']
ans = ['']
for i in range(len(word)):
temp = []
for item in ans:
temp.append(item + word[i])
if not item:
temp.append... |
class Tile:
def __init__(self, x, y, tile_type):
self.x = x
self.y = y
self.tile_type = tile_type
| class Tile:
def __init__(self, x, y, tile_type):
self.x = x
self.y = y
self.tile_type = tile_type |
"""
defines a command extension system that is used by billy-util
new commands can be added by deriving from BaseCommand and overriding a few
attributes:
name: name of subcommand
help: help string displayed for subcommand
add_args(): method that calls `self.add_argument`
han... | """
defines a command extension system that is used by billy-util
new commands can be added by deriving from BaseCommand and overriding a few
attributes:
name: name of subcommand
help: help string displayed for subcommand
add_args(): method that calls `self.add_argument`
han... |
# Define the rotors
# Each value represents the amount that must be added
# to get the output value when feeding input into that index.
# Index values must be adjusted to account for rotation.
rotors = [[1, 2, 4, 7, 1, 9, 2, 0, 1, 3],
[0, 2, 3, 9, 2, 4, 5, 7, 0, 8],
[5, 8, 9, 4, 9, 3, 4, 5, 6, 7],
... | rotors = [[1, 2, 4, 7, 1, 9, 2, 0, 1, 3], [0, 2, 3, 9, 2, 4, 5, 7, 0, 8], [5, 8, 9, 4, 9, 3, 4, 5, 6, 7], [1, 5, 3, 9, 5, 5, 1, 7, 5, 9]]
inverse_rotors = [[3, 9, 7, 8, 1, 9, 6, 0, 8, 9], [0, 5, 1, 8, 3, 7, 8, 2, 0, 6], [6, 1, 5, 1, 4, 5, 3, 6, 7, 2], [5, 9, 1, 5, 3, 7, 5, 9, 1, 5]]
reflector = [3, 5, 6, 7, 1, 9, 5, 2,... |
class stack(object):
def __init__(self):
self.stk = [] #initializing an array as a stack
def is_empty(self):
return self.stk == []
def push(self, item):
self.stk.append(data)
def pop(self):
if self.is_empty():
print("the stack is empty")
... | class Stack(object):
def __init__(self):
self.stk = []
def is_empty(self):
return self.stk == []
def push(self, item):
self.stk.append(data)
def pop(self):
if self.is_empty():
print('the stack is empty')
else:
self.stk.pop()
def si... |
n=int(input())
coin=[]
for i in range(n):
a,b=map(int,input().split())
coin.append([min(a,b),max(a,b)])
print(len(list(map(list,set(map(tuple,coin)))))) | n = int(input())
coin = []
for i in range(n):
(a, b) = map(int, input().split())
coin.append([min(a, b), max(a, b)])
print(len(list(map(list, set(map(tuple, coin)))))) |
class Node():
def __init__(self, val, children: list['Node'] = []) -> None:
self.val = val
self.children = children
# 1
# / \
# 2 3
# / \ / \
# 4 5 6 7
four = Node(4)
five = Node(5)
six = Node(6)
seven = Node(7)
two = Node(2, [four, five])... | class Node:
def __init__(self, val, children: list['Node']=[]) -> None:
self.val = val
self.children = children
four = node(4)
five = node(5)
six = node(6)
seven = node(7)
two = node(2, [four, five])
three = node(3, [six, seven])
one = node(1, [two, three])
basic_tree = one |
"""
The :mod:`websockets.extensions.base` defines abstract classes for extensions.
See https://tools.ietf.org/html/rfc6455#section-9.
"""
class ClientExtensionFactory:
"""
Abstract class for client-side extension factories.
Extension factories handle configuration and negotiation.
"""
name = .... | """
The :mod:`websockets.extensions.base` defines abstract classes for extensions.
See https://tools.ietf.org/html/rfc6455#section-9.
"""
class Clientextensionfactory:
"""
Abstract class for client-side extension factories.
Extension factories handle configuration and negotiation.
"""
name = ..... |
# -*- coding: utf-8 -*-
description = 'sps devices'
group = 'lowlevel'
tangohost = 'phys.spheres.frm2'
profibus_base = 'tango://%s:10000/spheres/profibus/sps_' % tangohost
profinet_base = 'tango://%s:10000/spheres/profinet/back_' % tangohost
analogs = dict(
rpower = dict(desc='reactor power', unit='MW', low=Fal... | description = 'sps devices'
group = 'lowlevel'
tangohost = 'phys.spheres.frm2'
profibus_base = 'tango://%s:10000/spheres/profibus/sps_' % tangohost
profinet_base = 'tango://%s:10000/spheres/profinet/back_' % tangohost
analogs = dict(rpower=dict(desc='reactor power', unit='MW', low=False), chop_vib1=dict(desc='chopper p... |
def to_camel_case(snake_str: str) -> str:
"""
Convert a snake_case string to camelCase.
:param snake_str: The input in snake_case
:return: The input, but in camelCase
"""
components = snake_str.split('_')
# We capitalize the first letter of each component except the first one
# with the... | def to_camel_case(snake_str: str) -> str:
"""
Convert a snake_case string to camelCase.
:param snake_str: The input in snake_case
:return: The input, but in camelCase
"""
components = snake_str.split('_')
return components[0] + ''.join((x.title() for x in components[1:])) |
"""
This package contains the cryptography backends.
==========
Submodules
==========
* :py:mod:`.dummy`: Fast but insecure key generation (pk == sk == address) and encryption (enc = (+), dec = (-)) for debugging
* :py:mod:`.rsa_pkcs15`: Slow, secure rsa key generation and encryption using RSA PKCS1.5 padding
* :py:mo... | """
This package contains the cryptography backends.
==========
Submodules
==========
* :py:mod:`.dummy`: Fast but insecure key generation (pk == sk == address) and encryption (enc = (+), dec = (-)) for debugging
* :py:mod:`.rsa_pkcs15`: Slow, secure rsa key generation and encryption using RSA PKCS1.5 padding
* :py:mo... |
# This is the solution for Sorting > NumberOfDiscIntersections
#
# This is marked as RESPECTABLE difficulty
class Disc():
def __init__(self, low_x, high_x):
self.low_x = low_x
self.high_x = high_x
def index_less_than(sortedDiscList, i, start, last):
mid = start + (last - start) // 2
if las... | class Disc:
def __init__(self, low_x, high_x):
self.low_x = low_x
self.high_x = high_x
def index_less_than(sortedDiscList, i, start, last):
mid = start + (last - start) // 2
if last <= start and sortedDiscList[mid].low_x > i:
return mid - 1
elif last <= start:
return mi... |
class FileFormatError(Exception):
"""
raised on errors parsing various files
"""
pass
class UnknownFileExtension(Exception):
def __init__(self, file_extension):
self.file_extension = file_extension
class FileNotFound(Exception):
def __init__(self, filename):
self.filename = f... | class Fileformaterror(Exception):
"""
raised on errors parsing various files
"""
pass
class Unknownfileextension(Exception):
def __init__(self, file_extension):
self.file_extension = file_extension
class Filenotfound(Exception):
def __init__(self, filename):
self.filename = f... |
def main():
print(summation(100)-multiplication(100))
def summation(n):
res = 0
for i in range(1, n+1):
res += i
return res*res
def multiplication(n):
res = 0
for i in range(1, n+1):
res += i * i
return res
| def main():
print(summation(100) - multiplication(100))
def summation(n):
res = 0
for i in range(1, n + 1):
res += i
return res * res
def multiplication(n):
res = 0
for i in range(1, n + 1):
res += i * i
return res |
N = int(input())
towers = 0
last = 0
sequence = [int(x) for x in input().split()]
for x in sequence:
if (x > last):
towers += 1
last = x
print(towers)
| n = int(input())
towers = 0
last = 0
sequence = [int(x) for x in input().split()]
for x in sequence:
if x > last:
towers += 1
last = x
print(towers) |
# Available constants:
# They are to assign a type to a field with a value null.
# NULL_BOOLEAN, NULL_CHAR, NULL_BYTE, NULL_SHORT, NULL_INTEGER, NULL_LONG
# NULL_FLOATNULL_DOUBLE, NULL_DATE, NULL_DATETIME, NULL_TIME, NULL_DECIMAL
# NULL_BYTE_ARRAY, NULL_STRING, NULL_LIST, NULL_MAP
#
# Available Objects:
#
# ... | for record in records:
try:
output.write(record)
except Exception as e:
error.write(record, str(e)) |
# LCM 33
class Solution:
def search(self, nums: List[int], target: int) -> int:
n = len(nums)
if n == 0:
return -1
if n == 1:
return 0 if nums[0] == target else -1
# apply modified binary search
low = 0
high = n-1
while low <= high:
... | class Solution:
def search(self, nums: List[int], target: int) -> int:
n = len(nums)
if n == 0:
return -1
if n == 1:
return 0 if nums[0] == target else -1
low = 0
high = n - 1
while low <= high:
mid = (low + high) // 2
... |
# -*- coding: utf-8 -*-
__name__ = 'google_streetview'
__author__ = 'Richard Wen'
__email__ = 'rrwen.dev@gmail.com'
__version__ = '1.2.9'
__license__ = 'MIT'
__description__ = 'A command line tool and module for Google Street View Image API.'
__long_description_content_type__='text/markdown'
__keywords__ = [
... | __name__ = 'google_streetview'
__author__ = 'Richard Wen'
__email__ = 'rrwen.dev@gmail.com'
__version__ = '1.2.9'
__license__ = 'MIT'
__description__ = 'A command line tool and module for Google Street View Image API.'
__long_description_content_type__ = 'text/markdown'
__keywords__ = ['google', 'api', 'street', 'view'... |
def print_sequence(n):
for i in range(1, n+1):
print(i, end="")
if __name__ == '__main__':
n = int(input("Enter number :"))
print_sequence(n)
| def print_sequence(n):
for i in range(1, n + 1):
print(i, end='')
if __name__ == '__main__':
n = int(input('Enter number :'))
print_sequence(n) |
class Hello(object):
@staticmethod
def hello_w() -> str:
return f"hello"
| class Hello(object):
@staticmethod
def hello_w() -> str:
return f'hello' |
class NodoCola:
def __init__(self):
self.__numero = 0
self.__siguiente = None
def getNumero(self):
return self.__numero
def setNumero(self, numero):
self.__numero = numero
def getSiguiente(self):
return self.__siguiente
def setSiguiente(self, siguiente):
... | class Nodocola:
def __init__(self):
self.__numero = 0
self.__siguiente = None
def get_numero(self):
return self.__numero
def set_numero(self, numero):
self.__numero = numero
def get_siguiente(self):
return self.__siguiente
def set_siguiente(self, siguient... |
# Copyright (c) 2016 Cloudbase Solutions Srl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | migration_status_running = 'RUNNING'
migration_status_completed = 'COMPLETED'
migration_status_error = 'ERROR'
task_status_pending = 'PENDING'
task_status_running = 'RUNNING'
task_status_completed = 'COMPLETED'
task_status_error = 'ERROR'
task_status_canceled = 'CANCELED'
task_type_export_instance = 'EXPORT_INSTANCE'
t... |
node = S(input, "application/json")
oldValue = node.prop("order")
jsonObject = {
"name": "test",
"comment": "42!"
}
node.prop("order", jsonObject)
newValue = node.prop("order") | node = s(input, 'application/json')
old_value = node.prop('order')
json_object = {'name': 'test', 'comment': '42!'}
node.prop('order', jsonObject)
new_value = node.prop('order') |
class Button:
def __init__(self, fn):
self.fn = fn
def click(self):
self.fn()
def test(string):
print(string)
fn = lambda: test('Pesho')
button_1 = Button(fn)
button_1.click()
button_1.click()
button_2 = Button(lambda: test('Toto'))
button_2.click()
| class Button:
def __init__(self, fn):
self.fn = fn
def click(self):
self.fn()
def test(string):
print(string)
fn = lambda : test('Pesho')
button_1 = button(fn)
button_1.click()
button_1.click()
button_2 = button(lambda : test('Toto'))
button_2.click() |
# Contributed by @Hinal-Srivastava
#Get Inputs from User
def get_input():
a = int(input("Enter 1st number: "))
b = int(input("Enter 2nd number: "))
return a, b
#Error Message for IndexOutOfBoundException
def error():
print("Invalid Entry")
#Addition
def add():
x, y = get_input()
return x + y
... | def get_input():
a = int(input('Enter 1st number: '))
b = int(input('Enter 2nd number: '))
return (a, b)
def error():
print('Invalid Entry')
def add():
(x, y) = get_input()
return x + y
def subtract():
(x, y) = get_input()
return x - y
def multiply():
(x, y) = get_input()
ret... |
"""
Demonstrates iterating/looping through a list
"""
#A list named temperatures
temperatures = [34.56, 56.45, 45.98, 47.62, 67.87, 55.12]
#Prints every value in the temperatures list using a for loop
for t in temperatures :
print(t)
#********************************#
print()
"""
#Prints every value in the temper... | """
Demonstrates iterating/looping through a list
"""
temperatures = [34.56, 56.45, 45.98, 47.62, 67.87, 55.12]
for t in temperatures:
print(t)
print()
'\n#Prints every value in the temperatures list using the\n#range function in a for loop\nfor i in range(len(temperatures)) :\n print(temperatures[i])\n'
print()
'... |
# -*- coding: utf-8 -*-
n = int(input())
for _ in range(n):
A, B = input().split()
if A[len(A)-len(B):] == B:
print('encaixa')
else:
print('nao encaixa')
| n = int(input())
for _ in range(n):
(a, b) = input().split()
if A[len(A) - len(B):] == B:
print('encaixa')
else:
print('nao encaixa') |
class TemplateFileType:
def __init__(self):
pass
StandardPage = 0
WikiPage = 1
FormPage = 2
| class Templatefiletype:
def __init__(self):
pass
standard_page = 0
wiki_page = 1
form_page = 2 |
# /usr/bin/env/ python3
"""
custom exception handling
"""
class PreconditionError(Exception):
"""
an exception for detecting precondition error
"""
def capture_exception(e: Exception) -> None:
"""
global way of capturing an exception
:param e:
:return:
"""
print(str(e))
def capt... | """
custom exception handling
"""
class Preconditionerror(Exception):
"""
an exception for detecting precondition error
"""
def capture_exception(e: Exception) -> None:
"""
global way of capturing an exception
:param e:
:return:
"""
print(str(e))
def capture_message(message: str) ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Advent of Code 2018, Day 00 - Part 0
# https://github.com/vesche
#
def main():
with open("day00_input.txt") as f:
data = f.read()
if __name__ == "__main__":
main()
| def main():
with open('day00_input.txt') as f:
data = f.read()
if __name__ == '__main__':
main() |
#!/usr/local/bin/python
# Code Fights Range Bit Count (Core) Problem
def rangeBitCount(a, b):
return (''.join([bin(n) for n in range(a, b + 1)])).count('1')
def main():
tests = [
[2, 7, 11],
[0, 1, 1],
[1, 10, 17],
[8, 9, 3],
[9, 10, 4]
]
for t in tests:
... | def range_bit_count(a, b):
return ''.join([bin(n) for n in range(a, b + 1)]).count('1')
def main():
tests = [[2, 7, 11], [0, 1, 1], [1, 10, 17], [8, 9, 3], [9, 10, 4]]
for t in tests:
res = range_bit_count(t[0], t[1])
if t[2] == res:
print('PASSED: rangeBitCount({}, {}) returned... |
# # Approach 3: Divide and Conquer
# class Solution(object):
# def searchMatrix(self, matrix, target):
# """
# :type matrix: List[List[int]]
# :type target: int
# :rtype: bool
# """
# if not matrix:
# return False
# return self.searchRect(0, 0, len... | class Solution(object):
def search_matrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
if len(matrix) == 0 or len(matrix[0]) == 0:
return False
height = len(matrix)
weidth = len(matrix[0])
... |
# -*- coding: utf-8 -*-
# Copyright 2019 Carsten Blank
#
# 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... | result = {'experiment': {'qobj': {'qobj_id': '2019-06-07T08:24:07.836571-exp-sim-regular', 'config': {'shots': 8192, 'memory_slots': 2, 'max_credits': 315, 'memory': False, 'n_qubits': 5}, 'experiments': [{'instructions': [{'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'me... |
"""
Increment Decrement.
Writing "a += 1" is equivalent to "a = a + 1".
Writing "a -= 1" is equivalent to "a = a - 1".
"""
a = 0
b = 0
direction = True
def setup():
size(640, 360)
colorMode(RGB, width)
b = width
frameRate(30)
def draw():
a += 1
if a > width:
a = 0
direction ... | """
Increment Decrement.
Writing "a += 1" is equivalent to "a = a + 1".
Writing "a -= 1" is equivalent to "a = a - 1".
"""
a = 0
b = 0
direction = True
def setup():
size(640, 360)
color_mode(RGB, width)
b = width
frame_rate(30)
def draw():
a += 1
if a > width:
a = 0
direction ... |
# Time: O(n) | Space: O(d) is depth
def productSum(array, multiplier = 1):
sum = 0
for element in array:
if type(element) is list:
sum += productSum(element, multiplier + 1)
else:
sum += element
return sum * multiplier | def product_sum(array, multiplier=1):
sum = 0
for element in array:
if type(element) is list:
sum += product_sum(element, multiplier + 1)
else:
sum += element
return sum * multiplier |
input()
string = input()
result = string[0]
lastChar = string[0]
for i in range(len(string)):
if string[i] != lastChar:
result += string[i]
lastChar = string[i]
print(len(string) - len(result)) | input()
string = input()
result = string[0]
last_char = string[0]
for i in range(len(string)):
if string[i] != lastChar:
result += string[i]
last_char = string[i]
print(len(string) - len(result)) |
garbled = "IXXX aXXmX aXXXnXoXXXXXtXhXeXXXXrX sXXXXeXcXXXrXeXt mXXeXsXXXsXaXXXXXXgXeX!XX"
message = filter(lambda letter: letter.replace("X", ""), garbled)
print(message)
| garbled = 'IXXX aXXmX aXXXnXoXXXXXtXhXeXXXXrX sXXXXeXcXXXrXeXt mXXeXsXXXsXaXXXXXXgXeX!XX'
message = filter(lambda letter: letter.replace('X', ''), garbled)
print(message) |
N = int(input('Digite um numero:'))
a = N - 1
s = N + 1
#print('analisando o valor {} , seu antecessor e {} e o sucessor e {} '.format(N, a, s))
print(f'Analisando o valor {N} , seu antecessor e {a} e o sucessor e {s}')
| n = int(input('Digite um numero:'))
a = N - 1
s = N + 1
print(f'Analisando o valor {N} , seu antecessor e {a} e o sucessor e {s}') |
__version__ = '0.0.8'
__title__ = 'repovisor'
__summary__ = 'A tool for managing many repositories and creating daily reports'
__uri__ = 'https://github.com/gjcooper/repovisor'
__license__ = 'BSD'
__author__ = 'Gavin Cooper'
__email__ = 'gjcooper@gmail.com'
| __version__ = '0.0.8'
__title__ = 'repovisor'
__summary__ = 'A tool for managing many repositories and creating daily reports'
__uri__ = 'https://github.com/gjcooper/repovisor'
__license__ = 'BSD'
__author__ = 'Gavin Cooper'
__email__ = 'gjcooper@gmail.com' |
# This is the main code for the problem! Driver code should be same as present on HackerRank!
def isPalindrome(s):
for idx in range(len(s)//2):
if s[idx] != s[len(s)-idx-1]:
return False
return True
def palindromeIndex(s):
for idx in range((len(s)+1)//2):
if s[idx] != s[len(s)... | def is_palindrome(s):
for idx in range(len(s) // 2):
if s[idx] != s[len(s) - idx - 1]:
return False
return True
def palindrome_index(s):
for idx in range((len(s) + 1) // 2):
if s[idx] != s[len(s) - idx - 1]:
if is_palindrome(s[:idx] + s[idx + 1:]):
re... |
name = 'rextest'
version = '1.3'
def commands():
env.REXTEST_ROOT = '{root}'
env.REXTEST_VERSION = this.version
env.REXTEST_MAJOR_VERSION = this.version.major
# prepend to non-existent var
env.REXTEST_DIRS.prepend('{root}/data')
alias('rextest', 'foobar')
# Copyright 2013-2016 Allan Johns.
#
... | name = 'rextest'
version = '1.3'
def commands():
env.REXTEST_ROOT = '{root}'
env.REXTEST_VERSION = this.version
env.REXTEST_MAJOR_VERSION = this.version.major
env.REXTEST_DIRS.prepend('{root}/data')
alias('rextest', 'foobar') |
# site_no -- Site identification number
# station_nm -- Site name
# site_tp_cd -- Site type
# lat_va -- DMS latitude
# long_va -- DMS longitude
# dec_lat_va -- Decimal latitude
# dec_long_va -- Decimal longitude
# coord_meth_cd -- Latitude-longitude method
# coord_... | streamflow_attributes = ['site_no', 'station_nm', 'site_tp_cd', 'dec_lat_va', 'dec_long_va', 'coord_meth_cd', 'coord_acy_cd', 'coord_datum_cd', 'dec_coord_datum_cd', 'district_cd', 'state_cd', 'county_cd', 'country_cd', 'land_net_ds', 'map_nm', 'map_scale_fc', 'alt_va', 'alt_meth_cd', 'alt_acy_va', 'alt_datum_cd', 'huc... |
# /*
# * Copyright (C) 2019 Atos Spain SA. All rights reserved.
# *
# * This file is part of pCEP.
# *
# * pCEP is free software: you can redistribute it and/or modify it under the
# * terms of the Apache License, Version 2.0 (the License);
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * The softw... | class Bcolors:
header = '\x1b[95m'
okblue = '\x1b[94m'
okgreen = '\x1b[92m'
warning = '\x1b[93m'
fail = '\x1b[91m'
endc = '\x1b[0m'
bold = '\x1b[1m'
underline = '\x1b[4m' |
a = 1
done = False
list = [3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19]
while not done:
if a % 10 == 0:
for i in list:
if a % i == 0:
if i == 19:
done = True
print(a)
else:
break
a += 1
| a = 1
done = False
list = [3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19]
while not done:
if a % 10 == 0:
for i in list:
if a % i == 0:
if i == 19:
done = True
print(a)
else:
break
a += 1 |
# Copyright 2016 The Oppia 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 ... | """Config file for threshold metrics of Performance Tests.
This file contains, for every Oppia page, corresponding thresholds for
different performance metrics.
Each page entry includes:
url: relative path to the page.
size_limits_mb: threshold for the total data transferred to load the page,
... |
__author__ = 'ThanhNam'
# Enter your code for the Adopter class here
class Adopter:#(object):
"""
Adopters represent people interested in adopting a species.
They have a desired species type that they want, and their score is
simply the number of species that the shelter has of that species.
"""
... | __author__ = 'ThanhNam'
class Adopter:
"""
Adopters represent people interested in adopting a species.
They have a desired species type that they want, and their score is
simply the number of species that the shelter has of that species.
"""
def __init__(self, name, desired_species):
s... |
free = True
node_id = '762'
node_password = '656531'
local_path = ''
code_done = False
| free = True
node_id = '762'
node_password = '656531'
local_path = ''
code_done = False |
class BfsSearchNode:
def __init__(self, position, moves, parent = None, warpHistory = None):
self.parent = parent
self.position = position
self.moves = moves
self.warpHistory = warpHistory or []
def getMinimumSteps(maze, multilevel = False):
startingPoint, endingPoint, warpPoint... | class Bfssearchnode:
def __init__(self, position, moves, parent=None, warpHistory=None):
self.parent = parent
self.position = position
self.moves = moves
self.warpHistory = warpHistory or []
def get_minimum_steps(maze, multilevel=False):
(starting_point, ending_point, warp_poin... |
""" Parser for MCNP in-files"""
EN_DELTA = 0.001
class Surface:
def __init__(self, num, geom_type, geom_params):
self.num = num
self.type = geom_type
self.geom_params = geom_params
def __repr__(self):
s = "%i %s " % (self.num, self.type)
s += " ".join... | """ Parser for MCNP in-files"""
en_delta = 0.001
class Surface:
def __init__(self, num, geom_type, geom_params):
self.num = num
self.type = geom_type
self.geom_params = geom_params
def __repr__(self):
s = '%i %s ' % (self.num, self.type)
s += ' '.join([str(g) for g... |
print('Welcome to the Average Calculator App.')
# get user input
name = input('\nWhat is your name? : ').title().strip()
count = int(input('How many grades would you like to enter? : '))
# get user's grades
grades = []
for i in range(1, count + 1):
grades.append(int(input('Enter grade : ')))
# sort grades and pri... | print('Welcome to the Average Calculator App.')
name = input('\nWhat is your name? : ').title().strip()
count = int(input('How many grades would you like to enter? : '))
grades = []
for i in range(1, count + 1):
grades.append(int(input('Enter grade : ')))
grades.sort(reverse=True)
print('\nGrades highest to lowest:... |
class Solution:
def findWords(self, words: List[str]) -> List[str]:
"""Hash set.
"""
rows = [set(['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p']),
set(['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l']),
set(['z', 'x', 'c', 'v', 'b', 'n', 'm'])]
res = []... | class Solution:
def find_words(self, words: List[str]) -> List[str]:
"""Hash set.
"""
rows = [set(['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p']), set(['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l']), set(['z', 'x', 'c', 'v', 'b', 'n', 'm'])]
res = []
for word in words:
... |
lf=[]
for i in range(2):
l=[int(i) for i in input().strip().split()]
lf.append(l)
print(lf)
for i in lf:
print(i)
| lf = []
for i in range(2):
l = [int(i) for i in input().strip().split()]
lf.append(l)
print(lf)
for i in lf:
print(i) |
class Item():
def __init__(self,value):
self.value = value
self.nxt = None
self.prev = None
def get_nxt(self):
return self.nxt
def get_prev(self):
return self.prev
def get_val(self):
return self.value
def set_nxt(self,nxt_):
self.nxt = nxt_
def set_prev(self,prev_):
self.prev = pre... | class Item:
def __init__(self, value):
self.value = value
self.nxt = None
self.prev = None
def get_nxt(self):
return self.nxt
def get_prev(self):
return self.prev
def get_val(self):
return self.value
def set_nxt(self, nxt_):
self.nxt = nxt... |
color_list = ["Red", "Green", "White", "Black"]
print("%s %s" % (color_list[0], color_list[-1]))
"""
Write a Python program to display the first and last colors from the
following list. Go to the editor
color_list = ["Red","Green","White" ,"Black"]
"""
| color_list = ['Red', 'Green', 'White', 'Black']
print('%s %s' % (color_list[0], color_list[-1]))
'\nWrite a Python program to display the first and last colors from the \nfollowing list. Go to the editor\ncolor_list = ["Red","Green","White" ,"Black"]\n' |
class Base:
WINDOW_W = 700
WINDOW_H = 550
GAME_WH = 500
SIZE = 5
FPS = 60
DEBUG = False
COLORS = {
'0': (205, 193, 180),
'2': (238, 228, 218),
'4': (237, 224, 200),
'8': (242, 177, 121),
'16': (245, 149, 99),
'32': (246, 124, 95),
'64'... | class Base:
window_w = 700
window_h = 550
game_wh = 500
size = 5
fps = 60
debug = False
colors = {'0': (205, 193, 180), '2': (238, 228, 218), '4': (237, 224, 200), '8': (242, 177, 121), '16': (245, 149, 99), '32': (246, 124, 95), '64': (246, 94, 59), '128': (237, 207, 114), '256': (237, 204,... |
"""
A module showing off the second while-loop pattern.
Here we are using a while-loop that stops when a goal in the specification
is true.
Author: Walker M. White
Date: April 15, 2019
"""
def prompt(prompt,valid):
"""
Returns: the choice from a given prompt.
This function asks the user a questio... | """
A module showing off the second while-loop pattern.
Here we are using a while-loop that stops when a goal in the specification
is true.
Author: Walker M. White
Date: April 15, 2019
"""
def prompt(prompt, valid):
"""
Returns: the choice from a given prompt.
This function asks the user a questio... |
def is_alt(s):
return helper(s, 0, 1) if s[0] in "aeiou" else helper(s, 1, 0)
def helper(s, n, m):
for i in range(n, len(s), 2):
if s[i] not in "aeiou":
return False
for i in range(m, len(s), 2):
if s[i] in "aeiou":
return False
return True | def is_alt(s):
return helper(s, 0, 1) if s[0] in 'aeiou' else helper(s, 1, 0)
def helper(s, n, m):
for i in range(n, len(s), 2):
if s[i] not in 'aeiou':
return False
for i in range(m, len(s), 2):
if s[i] in 'aeiou':
return False
return True |
"""Palette of colors collected from Mondrian's paintings"""
mondrian_palette = {
"red2": {
"rgb": [
221,
40,
32
],
"hex": "#dd2820"
},
"yellow": {
"rgb": [
252,
218,
77
],
"hex": "#fcda4d... | """Palette of colors collected from Mondrian's paintings"""
mondrian_palette = {'red2': {'rgb': [221, 40, 32], 'hex': '#dd2820'}, 'yellow': {'rgb': [252, 218, 77], 'hex': '#fcda4d'}, 'blue': {'rgb': [1, 36, 89], 'hex': '#012459'}, 'blue2': {'rgb': [0, 73, 165], 'hex': '#0049a5'}, 'yellow2': {'rgb': [242, 177, 3], 'hex'... |
print('___')
answers = []
for i in range(2, 10000000):
s = 0
for k in str(i):
s += int(k) ** 5
if i == s:
answers.append(i)
print(answers, sum(answers))
| print('___')
answers = []
for i in range(2, 10000000):
s = 0
for k in str(i):
s += int(k) ** 5
if i == s:
answers.append(i)
print(answers, sum(answers)) |
input = """
% test skip of Propagate_DeriveSingleUndefinedPosBodyLiteral()
a :- b.
b :- a.
a | b.
-a :- not a.
-b :- not b.
"""
output = """
% test skip of Propagate_DeriveSingleUndefinedPosBodyLiteral()
a :- b.
b :- a.
a | b.
-a :- not a.
-b :- not b.
"""
| input = '\n% test skip of Propagate_DeriveSingleUndefinedPosBodyLiteral()\n\na :- b.\nb :- a.\n\na | b.\n\n-a :- not a.\n-b :- not b.\n\n'
output = '\n% test skip of Propagate_DeriveSingleUndefinedPosBodyLiteral()\n\na :- b.\nb :- a.\n\na | b.\n\n-a :- not a.\n-b :- not b.\n\n' |
class StackTrace(object):
"""
Represents a stack trace,which is an ordered collection of one or more stack frames.
StackTrace()
StackTrace(fNeedFileInfo: bool)
StackTrace(skipFrames: int)
StackTrace(skipFrames: int,fNeedFileInfo: bool)
StackTrace(e: Exception)
StackTrace(e: Exception,fN... | class Stacktrace(object):
"""
Represents a stack trace,which is an ordered collection of one or more stack frames.
StackTrace()
StackTrace(fNeedFileInfo: bool)
StackTrace(skipFrames: int)
StackTrace(skipFrames: int,fNeedFileInfo: bool)
StackTrace(e: Exception)
StackTrace(e: Exception,fNeedFileInfo: ... |
# your credentials.py should look as follows
USER_TOKEN = 'your facebook user token'
email_address = 'email address to send out menus'
email_password = 'email password'
admin_email = 'admin email to sent error messages'
slack_webhook = 'slack webhook to post to slack'
| user_token = 'your facebook user token'
email_address = 'email address to send out menus'
email_password = 'email password'
admin_email = 'admin email to sent error messages'
slack_webhook = 'slack webhook to post to slack' |
nome = input('Digite o seu nome: ')
print(nome.upper())
print(nome.lower())
nome = nome.split()
primeironome = nome[0]
nome = ''.join(nome)
print('Seu nome tem {} letras'.format(len(nome)))
print('O seu primeiro nome ({}) tem {} letras'.format(primeironome, len(primeironome))) | nome = input('Digite o seu nome: ')
print(nome.upper())
print(nome.lower())
nome = nome.split()
primeironome = nome[0]
nome = ''.join(nome)
print('Seu nome tem {} letras'.format(len(nome)))
print('O seu primeiro nome ({}) tem {} letras'.format(primeironome, len(primeironome))) |
"""Hyper parameters."""
__author__ = 'Erdene-Ochir Tuguldur'
class HParams:
"""Hyper parameters"""
disable_progress_bar = False # set True if you don't want the progress bar in the console
logdir = "logdir" # log dir where the checkpoints and tensorboard files are saved
data_path = '/media/DATA/SW... | """Hyper parameters."""
__author__ = 'Erdene-Ochir Tuguldur'
class Hparams:
"""Hyper parameters"""
disable_progress_bar = False
logdir = 'logdir'
data_path = '/media/DATA/SWARA_DATA/SWARA_wav_16k_new_trim/'
mels_path = '/media/DATA/SWARA_DATA/SWARA_wav_16k_new_trim/'
mags_path = '/media/DATA/SW... |
"""
[04/16/13] Week-Long Challenge #1: Make a (tiny) video game!
https://www.reddit.com/r/dailyprogrammer/comments/1ch463/041613_weeklong_challenge_1_make_a_tiny_video_game/
# [](#EasyIcon) *(Easy)*: Make a tiny video game!
**Please note this is an official week-long challenge; all submissions are due by Monday night... | """
[04/16/13] Week-Long Challenge #1: Make a (tiny) video game!
https://www.reddit.com/r/dailyprogrammer/comments/1ch463/041613_weeklong_challenge_1_make_a_tiny_video_game/
# [](#EasyIcon) *(Easy)*: Make a tiny video game!
**Please note this is an official week-long challenge; all submissions are due by Monday night... |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A, B, K):
# write your code in Python 3.6
if K == 0:
print('terrible mistake, someone is trying to divide by 0')
return 0
result = 0
biggyfound = smallyfound = False
upperbonus = ... | def solution(A, B, K):
if K == 0:
print('terrible mistake, someone is trying to divide by 0')
return 0
result = 0
biggyfound = smallyfound = False
upperbonus = lowerbonus = 0
if A % K == 0:
lowerbonus += 1
smally = A
smallyfound = True
if B % K == 0:
... |
#
# PySNMP MIB module TPT-HIGH-AVAIL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPT-HIGH-AVAIL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:18:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
class Silly:
def __setattr__(self, attr, value):
if attr == "silly" and value == 7:
raise AttributeError("you shall not set 7 for silly")
super().__setattr__(attr, value)
def __getattribute__(self, attr):
if attr == "silly":
return "Just Try and Change Me!"
... | class Silly:
def __setattr__(self, attr, value):
if attr == 'silly' and value == 7:
raise attribute_error('you shall not set 7 for silly')
super().__setattr__(attr, value)
def __getattribute__(self, attr):
if attr == 'silly':
return 'Just Try and Change Me!'
... |
def leiaint(msg):
while True:
try:
n = int(input(msg))
except (ValueError, TypeError):
print('\033[31mERRO: Por favor, digite um numero inteiro valido.\033[m ')
continue
except (KeyboardInterrupt):
print('\033[31mUsuario preferiu nao digitar es... | def leiaint(msg):
while True:
try:
n = int(input(msg))
except (ValueError, TypeError):
print('\x1b[31mERRO: Por favor, digite um numero inteiro valido.\x1b[m ')
continue
except KeyboardInterrupt:
print('\x1b[31mUsuario preferiu nao digitar esse... |
#!/bin/python3
def n2l(n):
return chr((n%26)+65)
def l2n(l):
return (ord(l.upper())-65) % 26
def l2n2ls(l,s=0):
if l.isalpha():
if l.isupper():
return n2l(l2n(l) + s)
else:
return (n2l(l2n(l) + s)).lower()
else:
return l
if __name__ == '__main__':
... | def n2l(n):
return chr(n % 26 + 65)
def l2n(l):
return (ord(l.upper()) - 65) % 26
def l2n2ls(l, s=0):
if l.isalpha():
if l.isupper():
return n2l(l2n(l) + s)
else:
return n2l(l2n(l) + s).lower()
else:
return l
if __name__ == '__main__':
print('A: ', n... |
class CustomException(Exception):
def __init__(self, *args, **kwargs):
return super().__init__(self, *args, **kwargs)
def __str__(self):
return str(self.args [1])
class DeprecatedException(CustomException):
def __init__(self, *args, **kwargs):
return super().__init__(*args, **kwargs)... | class Customexception(Exception):
def __init__(self, *args, **kwargs):
return super().__init__(self, *args, **kwargs)
def __str__(self):
return str(self.args[1])
class Deprecatedexception(CustomException):
def __init__(self, *args, **kwargs):
return super().__init__(*args, **kwar... |
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... |
class nBitArray() :
m = 32
f = 'I'
_default_type = None
def __init__(self, n_bit) :
if not (isinstance(n_bit, int) and n_bit > 0) :
raise ValueError
self.n_bit = n_bit
self.n_item = 0
self.b_mask = (2 ** self.n_bit) - 1
self.i_mask = ((0x1 << self.m) - 1)
def _normalize_index(self, i... | class Nbitarray:
m = 32
f = 'I'
_default_type = None
def __init__(self, n_bit):
if not (isinstance(n_bit, int) and n_bit > 0):
raise ValueError
self.n_bit = n_bit
self.n_item = 0
self.b_mask = 2 ** self.n_bit - 1
self.i_mask = (1 << self.m) - 1
d... |
class Matcher:
def __init__(self, routes):
self._routes = routes
def match_request(self, request):
for route in self._routes:
match_dict = {}
rest = request.path
value = True
for typ, data in route.segments:
if typ == 'exact':
... | class Matcher:
def __init__(self, routes):
self._routes = routes
def match_request(self, request):
for route in self._routes:
match_dict = {}
rest = request.path
value = True
for (typ, data) in route.segments:
if typ == 'exact':
... |
# Specs
SPECS_STORAGE_PATH = 'specs/'
SPECS_FILE_NAME = 'specs.txt'
PHONE_LIST = 'phone_list.txt'
GSM_ARENA_BASE_URL = "https://www.gsmarena.com/"
# Reviews
REVIEW_STORAGE_PATH = 'reviews/'
REVIEWS_FILE_NAME = 'reviews.txt'
AMAZON_BASE_URL = 'https://www.amazon.com/'
AMAZON_REVIEW_URL_1 = '/ref=cm_cr_arp_d_paging_btm?i... | specs_storage_path = 'specs/'
specs_file_name = 'specs.txt'
phone_list = 'phone_list.txt'
gsm_arena_base_url = 'https://www.gsmarena.com/'
review_storage_path = 'reviews/'
reviews_file_name = 'reviews.txt'
amazon_base_url = 'https://www.amazon.com/'
amazon_review_url_1 = '/ref=cm_cr_arp_d_paging_btm?ie=UTF8&reviewerTyp... |
{
"targets": [
{
"target_name": "roaring",
"default_configuration": "Release",
"cflags_cc": ["-O3", "-std=c++14"],
"sources": [
"src/cpp/v8utils/v8utils.cpp",
"src/cpp/RoaringBitmap32.cpp"
],
"conditions"... | {'targets': [{'target_name': 'roaring', 'default_configuration': 'Release', 'cflags_cc': ['-O3', '-std=c++14'], 'sources': ['src/cpp/v8utils/v8utils.cpp', 'src/cpp/RoaringBitmap32.cpp'], 'conditions': [["OS=='win'", {'configurations': {'Release': {'msvs_settings': {'VCCLCompilerTool': {'AdditionalOptions': ['/std:c++la... |
# based on: https://github.com/tigertv/secretpy/blob/master/secretpy/ciphers/columnar_transposition.py
class cipher_columnar_transposition:
def __dec(self, alphabet, key, text):
chars = [alphabets.get_index_in_alphabet(char, alphabet)
for char in key]
keyorder = sorted(enumerate(ch... | class Cipher_Columnar_Transposition:
def __dec(self, alphabet, key, text):
chars = [alphabets.get_index_in_alphabet(char, alphabet) for char in key]
keyorder = sorted(enumerate(chars), key=lambda x: x[1])
ret = u''
rows = int(len(text) / len(key))
cols = [0] * len(key)
... |
class AssignParametersMixin:
"""
Adds the functionality to generate the code for passing the parameters in the following form:
parameterName={{parameterName}}
"""
def generate_parameters_code(self):
return super().generate_parameters_code() + \
[parameter.name + "={{" + param... | class Assignparametersmixin:
"""
Adds the functionality to generate the code for passing the parameters in the following form:
parameterName={{parameterName}}
"""
def generate_parameters_code(self):
return super().generate_parameters_code() + [parameter.name + '={{' + parameter.name + '}}' ... |
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../../build/common.gypi',
'../../build/version.gypi',
],
'targets': [
{
... | {'variables': {'chromium_code': 1}, 'includes': ['../../build/common.gypi', '../../build/version.gypi'], 'targets': [{'target_name': 'installer', 'type': 'none', 'dependencies': ['../../converter/converter.gyp:o3dConverter', '../../breakpad/breakpad.gyp:reporter', '../../documentation/documentation.gyp:*', '../../plugi... |
# Title: Construct Binary Tree from Preorder and Inorder Traversal
# Runtime: 68 ms
# Memory: 18.1 MB
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# Time Complexity: O(n)
# Space Complexity: O(n)
class... | class Solution:
def get_mapping(self, inorder: List[int]) -> dict:
mapping = {}
for index in range(len(inorder)):
num = inorder[index]
mapping[num] = index
return mapping
def build_tree_recursive(self, preorder: List[int], mapping: dict, left: int, right: int) -... |
class AnnotationObjectBase(RhinoObject):
"""
Provides a base class for Rhino.Geometry.AnnotationBase-derived
objects that are placed in a document.
"""
DisplayText=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the text that is displayed to users.
Get: DisplayText(... | class Annotationobjectbase(RhinoObject):
"""
Provides a base class for Rhino.Geometry.AnnotationBase-derived
objects that are placed in a document.
"""
display_text = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the text that is displayed to users.\n\n\n\nGet: Displa... |
"""Module containing all the controllers for the rest_api_to_db IEX service"""
IEX_REST_API_TO_DB_CONTROLLERS = [
]
| """Module containing all the controllers for the rest_api_to_db IEX service"""
iex_rest_api_to_db_controllers = [] |
class Config:
# AWS Information
ACCESS_KEY = ""
SECRET_KEY = ""
INSTANCE_ID = ""
EC2_REGION = ""
# SSH Key Path
SSH_KEY_FILE_NAME = ""
# Login Password
SERVER_PASSWORD = "1"
| class Config:
access_key = ''
secret_key = ''
instance_id = ''
ec2_region = ''
ssh_key_file_name = ''
server_password = '1' |
Patk = 15
Pdef = 12
Php = 25
Pgold = 250
choices = [ ' a) Fight like a champion.',
' b) Run like a coward.',
' c) Analyze the situation first.',
' d) Attempt to heal.'
]
wit_access_token = 'GIKG4P7FJTE44GV3U6YPUJGCRY7AYPDH'
| patk = 15
pdef = 12
php = 25
pgold = 250
choices = [' a) Fight like a champion.', ' b) Run like a coward.', ' c) Analyze the situation first.', ' d) Attempt to heal.']
wit_access_token = 'GIKG4P7FJTE44GV3U6YPUJGCRY7AYPDH' |
largest = None
smallest = None
def Maximum(largest, num):
if largest is None:
largest = num
elif largest < num:
largest = num
return largest
def Minimum(smallest, num):
if smallest is None:
smallest = num
elif smallest > num:
smallest = num
re... | largest = None
smallest = None
def maximum(largest, num):
if largest is None:
largest = num
elif largest < num:
largest = num
return largest
def minimum(smallest, num):
if smallest is None:
smallest = num
elif smallest > num:
smallest = num
return smallest
while... |
print('''
A string is said to be palindrome if it reads
the same backward as forward. For e.g. "AKA" string
is a palindrome because if we try to read it from
backward, it is same as forward. One of the approach
to check this is iterate through the string till
middle of string and compare a character from bac... | print('\nA string is said to be palindrome if it reads \nthe same backward as forward. For e.g. "AKA" string \nis a palindrome because if we try to read it from \nbackward, it is same as forward. One of the approach \nto check this is iterate through the string till \nmiddle of string and compare a character from back ... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"format_cookie_str": "01_Advanced_Request.ipynb",
"get_children": "01_Advanced_Request.ipynb",
"get_class": "01_Advanced_Request.ipynb",
"get_all_class": "01_Advanced_Request.ipynb"... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'format_cookie_str': '01_Advanced_Request.ipynb', 'get_children': '01_Advanced_Request.ipynb', 'get_class': '01_Advanced_Request.ipynb', 'get_all_class': '01_Advanced_Request.ipynb', 'get_class_count': '01_Advanced_Request.ipynb', 'is_content_list':... |
"""
Terminal Returner Plugin
************************
**Plugin Name:** ``terminal``
This plugin prints rendered result to terminal screen
applying minimal formating to improve readability.
For instance if these are rendering results::
{'rt-1': 'interface Gi1/1\\n'
' description Customer A\\n'
... | """
Terminal Returner Plugin
************************
**Plugin Name:** ``terminal``
This plugin prints rendered result to terminal screen
applying minimal formating to improve readability.
For instance if these are rendering results::
{'rt-1': 'interface Gi1/1\\n'
' description Customer A\\n'
... |
# -*- coding: utf-8 -*-
questoes = int(input())
respostas = input()
gabarito = input()
acertos = 0
for i in range(questoes):
if respostas[i] == gabarito[i]:
acertos += 1
print(acertos)
| questoes = int(input())
respostas = input()
gabarito = input()
acertos = 0
for i in range(questoes):
if respostas[i] == gabarito[i]:
acertos += 1
print(acertos) |
class Solution:
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
last = "NaN"
uniques = 0
i = 0
while i < len(nums): # len must be evaluated at every step for this to work
if nums[i] == last:
del n... | class Solution:
def remove_duplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
last = 'NaN'
uniques = 0
i = 0
while i < len(nums):
if nums[i] == last:
del nums[i]
else:
uniques += 1... |
#!/usr/bin/python
# Author: Wayne Keenan
# email: wayne@thebubbleworks.com
# Twitter: https://twitter.com/wkeenan
HCIPY_HCI_CMD_STRUCT_HEADER = "<BHB"
HCIPY_HCI_FILTER_STRUCT = "<LLLH"
# HCI ioctl Commands:
HCIDEVUP = 0x400448c9 # 201
HCIDEVDOWN = 0x400448ca # 202
HCIGETDEVINFO = -2147202861 #0x800448d3L # ... | hcipy_hci_cmd_struct_header = '<BHB'
hcipy_hci_filter_struct = '<LLLH'
hcidevup = 1074022601
hcidevdown = 1074022602
hcigetdevinfo = -2147202861
hci_success = 0
hci_oe_user_ended_connection = 19
le_public_address = 0
le_random_address = 1
scan_type_passive = 0
scan_type_active = 1
scan_filter_duplicates = 1
scan_disabl... |
#Adapted from https://github.com/FakeNewsChallenge/fnc-1/blob/master/scorer.py
#Original credit - @bgalbraith
LABELS = ['agree', 'disagree', 'discuss', 'unrelated']
LABELS_RELATED = ['unrelated','related']
RELATED = LABELS[0:3]
def score_submission(gold_labels, test_labels):
score = 0.0
cm = [[0, 0, 0, 0],
... | labels = ['agree', 'disagree', 'discuss', 'unrelated']
labels_related = ['unrelated', 'related']
related = LABELS[0:3]
def score_submission(gold_labels, test_labels):
score = 0.0
cm = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
for (i, (g, t)) in enumerate(zip(gold_labels, test_labels)):
... |
"""basics"""
def main():
a = [1,2,3,4]
TestError( len(a)==4 )
#b = list()
#TestError( len(b)==0 )
| """basics"""
def main():
a = [1, 2, 3, 4]
test_error(len(a) == 4) |
#CODE:
def create_stack():
stack = []
return stack
def peek(stack):
if len(stack) == 0:
return "Underflow"
else:
return stack[-1]
def isEmpty(stack):
if len(stack) == 0:
return True
else:
return False
def push(stack):
element=int(input("Enter the element:"))
#int should be used if we want to a... | def create_stack():
stack = []
return stack
def peek(stack):
if len(stack) == 0:
return 'Underflow'
else:
return stack[-1]
def is_empty(stack):
if len(stack) == 0:
return True
else:
return False
def push(stack):
element = int(input('Enter the element:'))
... |
class ObjectBase(dict):
def __init__(self, data, client=None):
"""
Create a new object from API result data.
"""
super().__init__(data)
self.client = client
def _get_property(self, name):
"""Return the named property from dictionary values."""
if name not... | class Objectbase(dict):
def __init__(self, data, client=None):
"""
Create a new object from API result data.
"""
super().__init__(data)
self.client = client
def _get_property(self, name):
"""Return the named property from dictionary values."""
if name no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.