content stringlengths 7 1.05M |
|---|
class DsapiParams:
def __init__(self, limit=1, bundles = [], role=None, tenant=None, format = 'json'):
self.limit = limit
self.bundles = bundles
self.role = role
self.tenant = tenant
self.format = format
def formatForRequest(self):
formattedString = '?'
n... |
def decode_flag(value, alphabet):
# Construct inverse alphabet.
map_inv = [0]*len(alphabet)
for i in range(len(alphabet)):
map_inv[alphabet[i]] = i
# Apply.
result = bytearray()
for i in range(len(value)):
c = value[i]
if i % 2 == 1:
c -= 1
cc = map_... |
###
### Copyright (C) 2019-2022 Intel Corporation
###
### SPDX-License-Identifier: BSD-3-Clause
###
subsampling = {
"Y800" : ("YUV400", 8),
"I420" : ("YUV420", 8),
"NV12" : ("YUV420", 8),
"YV12" : ("YUV420", 8),
"P010" : ("YUV420", 10),
"P012" : ("YUV420", 12),
"I010" : ("YUV420", 10),
"422H" : ("Y... |
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def maxDepth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
height_left = self.ma... |
class Matrix:
def __init__(self, matrix_string):
self.row_string = matrix_string.splitlines()
self.matrix = [[int(num) for num in row.split()] for row in self.row_string]
def row(self, index):
return self.matrix[index -1]
def column(self, index):
return [row[index -1] for r... |
"""
Genre class
"""
class Genre(object):
"""
Represents a genre for MyMusic
Key properties are:
* `id` - ID of the artist (Amazon ASIN)
* `name` - Artist name.
* `coverUrl` - URL containing cover art for the artist.
* `genre` - Genre of the album.
* `rating` - Average review score (ou... |
""" Ejercicio 1 """
def isSquare(num):
"""" Devuelve verdadero si el número es un cuadrado, caso contrario devuelve falso """
start = 1
end = num
while start <= end:
mid = int(start + (end - start) / 2)
square = mid * mid
if square == num:
return True
if square > num:
en... |
class DataClassFile():
def functionName1(self):
""" One Function (without parameters) with one test function (with single line comments)
where the documentation had not been generated.
"""
say = "say"
fu = "fu"
return say + " " + fu |
vel = int(input('digite a velocidade do carro:'))
multa = (vel - 80)*7
if vel>80:
print(f'MULTADO! você excedeu o limite permitido que é 80Km/h e vai pagar uma multa de {multa}')
|
class Solution(object):
def myAtoi(self, _str):
"""
:type str: str
:rtype: int
"""
valid = set(['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'])
signs = set(['-', '+'])
ns = []
ss = _str.strip()
if len(ss) == 0:
return 0
f... |
#coding=utf-8
"""
__create_time__ = '13-10-29'
__author__ = 'Madre'
"""
|
"""
LeetCode Problem: 694. Number of Distinct Islands
Link: https://leetcode.com/problems/number-of-distinct-islands/
Language: Python
Written by: Mostofa Adib Shakib
Time Complexity: O(n)
Space Complexity: O(n)
X => Start
O => Out of bound or water
U => Up
L => Left
R => Right
D => Down
"""
class Solution:
... |
#!/usr/bin/env python
"""Script for producing bad_ants text files."""
JDs = [
2458098,
2458099,
2458101,
2458102,
2458103,
2458104,
2458105,
2458106,
2458107,
2458108,
2458109,
2458110,
2458111,
2458112,
2458113,
2458114,
2458115,
2458116,
245... |
# Leo colorizer control file for velocity mode.
# This file is in the public domain.
# Properties for velocity mode.
properties = {
"commentEnd": "*#",
"commentStart": "#*",
"lineComment": "##",
}
# Attributes dict for velocity_main ruleset.
velocity_main_attributes_dict = {
"default": "nu... |
"""Constants used in Integer.
"""
MAX_INT = 2 ** 31 - 1
FAILED = -2147483646.0
|
num_waves = 4
num_eqn = 5
num_aux = 5
# Conserved quantities
sigma_11 = 0
sigma_22 = 1
sigma_12 = 2
u = 3
v = 4
# Auxiliary variables
density = 0
lamda = 1
mu = 2
cp = 3
cs = 4
|
# encoding:utf-8
class Word:
def __init__(self, id, form, label):
self.id = id
self.org_form = form
self.form = form.lower()
self.label = label
def __str__(self):
values = [str(self.id), self.org_form, self.label]
return '\t'.join(values)
class Sentence:
d... |
BATCH_SIZE = 100
# Constants describing the training process.
MOVING_AVERAGE_DECAY = 0.9999 # The decay to use for the moving average.
NUM_EPOCHS_PER_DECAY = 50 # Epochs after which learning rate decays.
LEARNING_RATE_DECAY_FACTOR = 0.1 # Learning rate decay factor.
INITIAL_LEARNING_RATE = 0.001 # Ini... |
def rsum(any_list):
'''(list of int) -> int
REQ: Length of the list must be greater than 0
This function will add up all the integers in the given list of integers
>>>rsum([9,1000,-1000,57,78,0])
144
>>>rsum([1])
1
'''
# Base case for one element
if len(any_list) == 1:
# ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of Androwarn.
#
# Copyright (C) 2012, 2019, Thomas Debize <tdebize at mail.com>
# All rights reserved.
#
# Androwarn is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
#... |
# network size
ict_head_size = None
# checkpointing
ict_load = None
bert_load = None
# data
titles_data_path = None
query_in_block_prob = 0.1
use_one_sent_docs = False
# training
report_topk_accuracies = []
# faiss index
faiss_use_gpu = False
block_data_path = None
# indexer
indexer_batch_size = 128
indexer_log_i... |
#
# PySNMP MIB module TFTIF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TFTIF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:16:16 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... |
# -------------------------------
# UFSC - CTC - INE - INE5663
# Exercício da Matriz de Inteiros
# -------------------------------
# Classe que representa uma matriz de números inteiros.
#
class MatrizDeInteiros:
def __init__(self, dimensoes_ou_numeros):
'''Cria uma matriz de números inteiros. Há duas form... |
"""chfn help text"""
CHSH = dict(
text="""chsh changes your "shell" on Redbrick.
** WARNING - Do not use this command if you are unsure
** of what you are doing! :-)
A "Shell" is the style of command line environment on RedBrick.
It is essentially, the 'prompt' and set of commands that you get
when you log in.
... |
def partition(lista: list[int], low: int, high: int) -> int:
i = low
pivot = lista[high]
for j in range(low, high):
if lista[j] <= pivot:
# swap
lista[i], lista[j] = lista[j], lista[i]
i += 1
lista[i], lista[high] = lista[high], lista[i]
return i
def f... |
DATA_FOLDER = './materialist/data'
TEST_FOLDER = './materialist/data/test'
TRAIN_FOLDER = './materialist/data/train'
VALIDATION_FOLDER = './materialist/data/validation'
TEST_FILE = './materialist/data/test.json'
TRAIN_FILE = './materialist/data/train.json'
VALIDATION_FILE = './materialist/data/validation.json'
TEST_... |
print(f'This is the python code file bar.py and my name currently is:{__name__}')
if __name__ == 'bar':
print(f'I was imported as a module.')
print(f'bar.py __file__ variable:{__file__}')
print('If the slashes in the file path lean to the right then I am __main__')
|
class View:
@staticmethod
def show_message(message):
print(message)
@staticmethod
def get_input():
return input()
|
class Test:
def ptr(self):
print(self)
print(self.__class__)
class Test2:
def ptr(baidu):
print(baidu)
print(baidu.__class__)
class people:
name = ''
age = 0
__weight = 0
def __init__(self, n, a, w):
self.name = n
self.age = a
self.__w... |
class LambdaContext(object):
def __init__(
self,
request_id="request_id",
function_name="my-function",
function_version="v1.0",
):
self.aws_request_id = request_id
self.function_name = function_name
self.function_version = function_version
def get_rem... |
for i in range(int(input())):
n,m,x,y = [int(j) for j in input().split()]
if((n-1)%x==0 and (m-1)%y==0):
print('Chefirnemo')
elif(n-2>=0 and m-2>=0):
if((n-2)%x==0 and (m-2)%y==0):
print('Chefirnemo')
else:
print('Pofik')
else:
print('Pofik')
|
###################################################
# header_common.py
# This file contains common declarations.
# DO NOT EDIT THIS FILE!
###################################################
server_event_preset_message = 0
server_event_play_sound = 1
server_event_scene_prop_p... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 1 09:38:18 2022
@author: JHOSS
"""
#CONTAR LOS NUMEROS PRIMOS DEL 1 AL 100
num = 1
while num <=100:
cont =1
x=0
while cont <= num:
if num % cont == 0:
x=x+1
cont = cont +1
if x==2:
print(num)
num = num +1
... |
## class <nombre_del_objeto>:
## def <metodo_del_objeto>(self):
# variable -> atributos
# funciones -> metodos
def hola():
print("hola a todos")
hola()
class Persona:
def __init__(self, nombre):
self.nombre = nombre
def hola(self):
print("Hola a todos, soy", self.nombre)
de... |
#
# PySNMP MIB module CISCO-IETF-SCTP-EXT-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IETF-SCTP-EXT-CAPABILITY
# Produced by pysmi-0.3.4 at Wed May 1 12:01:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... |
def first_last(s1):
# [out of bound error] s2 = s1[0] + s1[1] + s1[4] + s1[5]
# [out of bound error] s2 = s1[0] + s1[1] + s1[-2] + s1[-1]
# [false result] s2 = s1[0:2] + s1[-2:-1]
s2 = s1[0:2] + s1[-2:]
# [out of bound error] s2 = s1[:2] + s1[-2]
return s2
print(first_last("spring"))
p... |
ref = [
"A00002",
"A00005",
"A10001",
"A10002",
"A10003",
"A10004",
"A10005",
"A10006",
"A10007",
"A10008",
"A10009",
"A10010",
"A10011",
"A10012",
"A10013",
"A10014",
"A10015",
"A10016",
"A10017",
"A10018",
"A10019",
"A10020",
... |
# Copyright 2008 Canonical Ltd.
# This file is part of lazr.restfulclient.
#
# lazr.restfulclient is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) ... |
ROBOT_POSITION_RESSOURCE = '/robotposition'
CUBE_POSITION_RESSOURCE = '/cubeposition'
PATH_RESSOURCE = '/path'
FLAG_RESSOURCE = '/flag' |
server = "uri.pi"
port = 4711
# well World
home = Vec3(-66.9487,7.0,-39.5313)
|
def Black_mesa(thoughts, eyes, eye, tongue):
return f"""
{thoughts}
{thoughts}
.-;+\$XHHHHHHX\$+;-.
,;X\@\@X%/;=----=:/%X\@\@X/,
=\$\@\@%=. .=+H\@X:
-XMX: =XMX=
/\@\@: =H\@+
%\@X, .\$\@\$
... |
# file handling
# 1) without using with statement
file = open('t1.txt', 'w')
file.write('hello world !')
file.close()
# 2) without using with statement
file = open('t2.txt', 'w')
try:
file.write('hello world')
finally:
file.close()
# 3) using with statement
with open('t3.txt', 'w') as file:
file.write('h... |
"""
Sentinel module to signify that a parameter should use its default value.
Useful when the default value or ``None`` are both valid options.
"""
|
"""
Desempacotamento de listas em python
"""
lista = ['Luiz', 'João', 'Maria', 1, 2, 3, 4, 5]
n1, n2, *n3 = lista #todo: usando a * cria outra lista, e os valores que eu quiser mostrar, começa pelas ultimas
print(n3)
|
#Will add a fixed header and return a sendable string (we should add pickle support here at some point somehow), also encodes the message for you
def createMsg(data):
msg = data
msg = f'{len(msg):<10}' + msg
return msg.encode("utf-8")
#streams data from the 'target' socket with an initial buffersiz... |
class Solution:
def maxNonOverlapping(self, nums: List[int], target: int) -> int:
last = {0:-1}
s = 0
dp = [0]*len(nums)
for i in range(len(nums)):
s += nums[i]
if s-target in last:
dp[i] = max(dp[i-1] if i-1>=0 else 0, 1+ (dp[last[s-target]] if last... |
def ascii_cipher(message, key):
pfactor = max(
i for i in range(2, abs(key)+1)
if is_prime(i) and key%i==0
)*(-1 if key<0 else 1)
return ''.join(chr((ord(c)+pfactor)%128) for c in message)
def is_prime(n):
if n < 2: return False
return all(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__project__ = 'leetcode'
__file__ = '__init__.py'
__author__ = 'king'
__time__ = '2020/2/10 14:40'
_ooOoo_
o8888888o
88" . "88
(| -_- |)
... |
class Solution:
"""
@param heights: a matrix of integers
@return: an integer
"""
def trapRainWater(self, heights):
"""
:type heightMap: List[List[int]]
:rtype: int
"""
m = len(heights)
n = len(heights[0]) if m else 0
peakMap = [[0x7FFFFFF... |
def add_two(a, b):
'''Adds two numbers together'''
return a + b
def multiply_two(a, b):
'''Multiplies two numbers together'''
return a * b
|
# -*- coding:utf8 -*-
"""
@Author: Zhirui(Alex) Yang
@Date: 2021/4/25 下午11:07
""" |
# # example string
# string = 'cat'
# width = 5
# print right justified string
# print(string.rjust(width))
# print(string.rjust(width))
# # example string
# string = 'cat'
# width = 5
# fillchar = '*'
# # print right justified string
# print(string.rjust(width, fillchar))
# # .centre function
# string = "Python ... |
turno = input('M-matutino, V-vespertino, N-noturno: ')
if (turno == 'M')or(turno == 'm') :
print ('Bom Dia')
if (turno == 'V')or(turno == 'v'):
print ('Boa Tarde')
if (turno == 'N')or(turno == 'n'):
print ('Boa Noite')
else:
print ('Valor inválido')
|
"""
In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1.
Two nodes of a binary tree are cousins if they have the same depth, but have different parents.
We are given the root of a binary tree with unique values, and the values x and y of two different nodes in the tree.
R... |
def test_use_provider(accounts, networks):
with networks.fantom.local.use_provider("test"):
account = accounts.test_accounts[0]
account.transfer(account, 100)
|
class Field(object):
def render(self, field):
raise NotImplementedError('Field.render needs to be defined')
class Attr(Field):
def __init__(self, attr, default=None, type=None):
self.attr = attr
self.default = default
if type is None:
self.type = lambda x: x
... |
# 给定一个单词列表,我们将这个列表编码成一个索引字符串 S 与一个索引列表 A。
# 例如,如果这个列表是 ["time", "me", "bell"],我们就可以将其表示为 S = "time#bell#" 和 indexes = [0, 2, 5]。
# 对于每一个索引,我们可以通过从字符串 S 中索引的位置开始读取字符串,直到 "#" 结束,来恢复我们之前的单词列表。
# 那么成功对给定单词列表进行编码的最小字符串长度是多少呢?
#
# 示例:
# 输入: words = ["time", "me", "bell"]
# 输出: 10
# 说明: S = "time#bell#" ... |
def set_elements_sum(a, b):
c = []
for i in range(len(a)):
result = a[i] + b[i]
c.append(result)
return c
ll = [1, 2, 3, 4, 5]
ll2 = [3, 4, 5, 6, 7]
print(set_elements_sum(ll, ll2))
# [4, 6, 8, 10, 12]
|
# URI Online Judge 1133
X = int(input())
Y = int(input())
soma = 0
if Y < X:
X, Y = Y, X
for i in range(X,Y+1):
if i%13!=0:
soma += i
print(soma) |
salario = float(input())
if (salario >= 0 and salario <= 2000.00):
print('Isento')
elif (salario >= 2000.01 and salario <= 3000.00):
resto = salario - 2000
resul = resto * 0.08
print('R$ {:.2f}'.format(resul))
elif (salario >= 3000.01 and salario <= 4500.00):
resto = salario - 3000
resul = (res... |
for i in range(int(input())):
a, b, c = map(int, input().split())
mi = min(a, b)
ma = max(a, b)
half_circle_people = (ma - mi)
full_circle_people = 2 * half_circle_people
if ma > half_circle_people * 2 or c > full_circle_people:
print(-1)
else:
print((c - half_circle_people... |
# model settings
model = dict(
type='Recognizer3DRPL',
backbone=dict(
type='ResNet3dSlowOnly',
depth=50,
pretrained='torchvision://resnet50',
lateral=False,
out_indices=(2, 3),
conv1_kernel=(1, 7, 7),
conv1_stride_t=1,
pool1_stride_t=1,
inf... |
def make_divider():
return {"type": "divider"}
def make_markdown(text):
return {"type": "mrkdwn", "text": text }
def make_section(text):
return {"type":"section", "text": make_markdown(text)}
def make_context(*args):
return {"type":"context", "elements": [*args]}
def make_blocks(*args):
return [... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/nvidia/linorobot_ws/src/imu_calib/include;/usr/local/include/eigen3".split(';') if "/home/nvidia/linorobot_ws/src/imu_calib/include;/usr/local/include/eigen3" != "" else []
PROJECT_CATKIN_DEPENDS... |
numero = int(input("Entre com um numero inteiro e menor que 1000: "))
if numero > 1000:
print("Numero invalido")
else:
unidade = numero % 10
numero = (numero - unidade) / 10
dezena = int(numero % 10)
numero = (numero - dezena) / 10
centena = int(numero)
print(f"{centena} centena(s) , {dezena... |
def str_to_bool(s):
if isinstance(s, bool): # do not convert if already a boolean
return s
else:
if s == 'True' \
or s == 'true' \
or s == '1' \
or s == 1 \
or s == True:
return True
elif s == 'False' \
... |
"""Version
==========
"""
__version__ = "0.4.0"
|
class Solution:
def compareVersion(self, version1: str, version2: str) -> int:
ver1 = version1.split('.')
ver2 = version2.split('.')
def removeLeadingZeros(s):
while len(s) > 1 and s[0] == '0':
s = s[1:]
return s
ver1... |
GUIDs = {
"ASROCK_ACPIS4_DXE_GUID": [69196166, 45078, 18382, 175, 197, 34, 105, 237, 212, 173, 100],
"ASROCK_USBRT_GUID": [82487969, 10657, 4567, 136, 56, 0, 80, 4, 115, 212, 235],
"ASROCK_RAID_SETUP_GUID": [152494882, 14144, 12750, 173, 98, 189, 23, 44, 236, 202, 54],
"ASROCK_RAID_LOADER_GUID": [16450... |
lista = [[], [], []]
soma=somapar=0
for l in range(3):
for c in range(3):
if c == 2:
n = int(input(f'Digite um valor para [{l}, {c}]: '))
lista[l].append(n)
soma += n
if n % 2 == 0:
somapar += n
else:
n = int(input(f'Digite... |
"""
General unit tests
"""
class TestClass:
def test_base(self):
assert 42 == 42
|
'''
Python program to convert the distance (in feet) to inches,yards, and miles
'''
def distanceInInches (d_ft):
print("The distance in inches is %i inches." %(d_ft * 12))
def distanceInYard (d_ft):
print("The distance in yards is %.2f yards." %(d_ft / 3.0))
def distanceInMiles (d_ft):
print("The distanc... |
# coding=utf-8
#
# @lc app=leetcode id=33 lang=python
#
# [33] Search in Rotated Sorted Array
#
# https://leetcode.com/problems/search-in-rotated-sorted-array/description/
#
# algorithms
# Medium (32.65%)
# Likes: 2445
# Dislikes: 314
# Total Accepted: 421.1K
# Total Submissions: 1.3M
# Testcase Example: '[4,5,6... |
def somme(liste_nombres):
pass
def moyenne(liste_nombres):
pass
|
class Solution:
def solve(self, genes):
ans = 0
seen = set()
genes = set(genes)
for gene in genes:
if gene in seen:
continue
ans += 1
dfs = [gene]
seen.add(gene)
while dfs:
cur = dfs.pop()
... |
# 3. Номера строк. Напишите программу, которая запрашивает у пользователя
# имя файла. Программа должна вывести на экран содержимое файла, при этом
# каждая строка должна предваряться ее номером и двоеточием. Нумерация строк
# должна начинаться с 1. number_list.txt
def main():
try:
name_file = input('N... |
def ficha():
print(30*'-')
n = str(input('Nome do Jogador: '))
if n == '':
n = '<desconhecido>'
g = str(input('Números de Gols: '))
if g.isnumeric():
g = int(g)
else:
g = 0
print(f'O jogador {n} fez {g} gol(s) no campeonato.')
ficha() |
def title1(content):
return "<h1 class='display-1'>{}</h1>".format(content)
def title2(content):
return "<h2 class='display-2'>{}</h2>".format(content)
def title3(content):
return "<h3 class='display-3'>{}</h3>".format(content)
def title4(content):
return "<h4 class='display-4'>{}... |
class Constants:
# DATA TYPES
GENERATE_EPR_IF_NONE = 'generate_epr_if_none'
AWAIT_ACK = 'await_ack'
SEQUENCE_NUMBER = 'sequence_number'
PAYLOAD = 'payload'
PAYLOAD_TYPE = 'payload_type'
SENDER = 'sender'
RECEIVER = 'receiver'
PROTOCOL = 'protocol'
KEY = 'key'
# WAIT TIME
... |
#--------------------------------------------------------------------#
# Help program.
# Created by: Jim - https://www.youtube.com/watch?v=XCgWYx-lGl8
# Changed by: Thiago Piovesan
#--------------------------------------------------------------------#
# When to use class methods and when to use static methods ?
#-----... |
FIPS_Reference = {
"AL":"01",
"AK":"02",
"AZ":"04",
"AR":"05",
"AS":"60",
"CA":"06",
"CO":"08",
"CT":"09",
"DE":"10",
"FL":"12",
"GA":"13",
"GU":"66",
"HI":"15",
"ID":"16",
"IL":"17",
"IN":"18... |
def check_full_text(fb_full_text, filter_full_text) -> bool:
if filter_full_text is None or fb_full_text == filter_full_text:
return True
return False
def check_contains(fb_contains, filter_contains) -> bool:
if filter_contains is None:
return True
intersection = list(fb_contains & fil... |
class _Manager(type):
""" Singletone for cProfile manager """
_inst = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._inst:
cls._inst[cls] = super(_Manager, cls).__call__(*args, **kwargs)
return cls._inst[cls]
class ProfileManager(metaclass=_Manager):
def __init... |
class Solution:
def maxRotateFunction(self, nums: List[int]) -> int:
sums = sum(nums)
index = 0
res = 0
for ele in nums:
res += index*ele
index += 1
ans = res
for i in range(1,len(nums)):
res = res + sums - (len(nums))*nums[len(nums... |
def is_even(n):
return n % 2 == 0
def is_odd(n):
return not is_even(n)
lost_numbers = (4, 8, 15, 16, 23, 42)
|
# You are given two non-empty linked lists representing two non-negative integers.
# The digits are stored in reverse order and each of their nodes contain a single digit.
# Add the two numbers and return it as a linked list.
# You may assume the two numbers do not contain any leading zero, except the number 0 itself... |
# Given two strings s and t, determine if they are isomorphic.
# Two strings s and t are isomorphic if the characters in s can be replaced to
# get t.
# All occurrences of a character must be replaced with another character while
# preserving the order of characters. No two characters may map to the same
# character,... |
def mergeSort(elements):
if len(elements) == 0 or len(elements) == 1:
# BASE CASE
return elements
middle = len(elements) // 2
left = mergeSort(elements[:middle])
right = mergeSort(elements[middle:])
if left == [] or right == []:
return left or right
result = []
i, ... |
__author__ = 'James Myatt'
__version__ = '0.0.2'
__all__ = [
'monitor', 'sensor', 'utils',
'time', 'w1therm'
]
|
class SocketAPIError(Exception):
pass
class InvalidRequestError(SocketAPIError):
pass
class InvalidURIError(InvalidRequestError):
pass
class NotFoundError(InvalidRequestError):
pass
|
# Prints out a string
print("Mary had a little lamb.")
# Prints out a formatted string
print("Its fleece was white as {}.".format('snow'))
# Prints out another string
print("and everywhere that Mary went.")
# Prints a period for ten times
print("." * 10) # what'd that do?
# Assign a letter to string variable
end1 = "... |
"""
Drones library and API version.
"""
DRONES_VERSION = "0.1.2"
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class HookitConnectionError(Exception):
pass
__all__ = ['HookitConnectionError']
|
def get_gene_ne(global_variables,gene_dictionary):
values_list = []
# gets the ordered samples
sample_list = global_variables["sample_list"]
for sample in sample_list:
values_list.append(gene_dictionary[sample])
return values_list
|
def ceasear_encode( msg, key ):
code = ""
key = ord(key.upper())-ord("A")
for c in msg.upper():
if c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
new_ord = ord(c)+key
if new_ord > ord("Z"):
new_ord -= 26
code += chr(new_ord)
else:
code +=... |
def version():
"""Function takes no aruguments and returns a STR value of the current version of the library. This value should match
the value in the setup.py
:param None
:return str value of the current version of the library
:rtype str
>>> version()
1.0.33
"""
print ('1.0.34') |
"""
The main module of DAFEST project.
ADAFEST is an abbreviation: 'A Data-Driven Approach to Estimating / Evaluating Software Testability'
The full version of source code will be available
as soon as the relevant paper(s) are published.
"""
class Main():
"""Welcome to project ADAFEST
This file contains t... |
def sublime():
return [
('MacOS', 'https://download.sublimetext.com/Sublime%20Text%20Build%203126.dmg', 'sublime/sublime.dmg'),
('Windows (32-bit)', 'https://download.sublimetext.com/Sublime%20Text%20Build%203126%20Setup.exe', 'sublime/sublime-x86.exe'), # noqa
('Windows (64-bit)', 'https:... |
class PyEVMError(Exception):
"""
Base class for all py-hvm errors.
"""
pass
class VMNotFound(PyEVMError):
"""
Raised when no VM is available for the provided block number.
"""
pass
class NoGenesisBlockPresent(PyEVMError):
"""
Raised when a block is imported but there is no gen... |
example_data = """\
1721
979
366
299
675
1456\
"""
data = """\
1914
1931
1892
1584
1546
1988
1494
1709
1624
1755
1849
1430
1890
1675
1604
1580
1500
1277
1729
1456
2002
1075
1512
895
1843
1921
1904
1989
1407
1552
1714
757
1733
1459
1777
1440
1649
1409
1662
1968
1775
1998
1754
1938
1964
1415
1990
1997
1870
1664
1145
178... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.