content stringlengths 7 1.05M |
|---|
# from recipes.decor.tests import test_cases as tcx
# pylint: disable-all
def test_expose_decor():
@expose.show
def foo(a, b=1, *args, c=2, **kws):
pass
foo(88, 12, 11, c=4, y=1)
def test_expose_decor():
@expose.args
def foo(a, b=1, *args, c=2, **kws):
pass
foo(88, 12, 11,... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 CESAR SINCHIGUANO <cesarsinchiguano@hotmail.es>
#
# Distributed under terms of the BSD license.
"""
"""
#The Fibonacci sequence is a number sequence where each
#number is the sum of the previous two numbers. The first
#two numbers ar... |
def fill_bin_num(dataframe, feature, bin_feature, bin_size, stat_measure, min_bin=None, max_bin=None, default_val='No'):
if min_bin is None:
min_bin = dataframe[bin_feature].min()
if max_bin is None:
max_bin = dataframe[bin_feature].max()
new_dataframe = dataframe.copy()
df_meancat = pd.... |
def main():
num = int(input("introduce un numero:"))
for x in range (1,num):
print(x, end=",")
else:
print(num, end="") |
'''
Mysql Table Create Queries
'''
tables = [
# master_config Table
'''
CREATE TABLE IF NOT EXISTS master_config (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
author VARCHAR(20) NOT NULL,
PRIMARY KEY(id)
);
''',
'''
CREATE TABLE IF NOT EXISTS user (
id VARCHAR(200) NOT NULL,
... |
class Person:
'''
这是一个 Person类
实例属性:
None: 没有任何东西
'''
print('--------')
print(Person.__doc__)
print('--------')
Person.__doc__ = "三扥东方"
print(Person.__doc__)
print('--------')
|
x,y = map(int,input().split())
if x+y < 10:
print(x+y)
else:
print("error") |
class Address(object):
ADDRESS_UTIM = 0
ADDRESS_UHOST = 1
ADDRESS_DEVICE = 2
ADDRESS_PLATFORM = 3
|
s = "a quick {0} brown fox {2} jumped over {1} the lazy dog";
x = 100;
y = 200;
z = 300;
t = s.format(x,y,z);
print(t); |
def uncollapse(s):
for n in ['zero','one','two','three','four','five','six','seven','eight','nine']:
s=s.replace(n,n+' ')
return s[:-1]
def G(s):
for n in ['zero','one','two','three','four','five','six','seven','eight','nine']:
s=s.replace(n,n+' ')
return s[:-1]
|
"""This file defines the unified tensor framework interface required by DGL
unit testing, other than the ones used in the framework itself.
"""
###############################################################################
# Tensor, data type and context interfaces
def cuda():
"""Context object for CUDA."""
... |
# based on https://nlp.stanford.edu/software/dependencies_manual.pdf
DEPENDENCY_DEFINITONS = {
'acomp': 'adjectival_complement',
'advcl': 'adverbial_clause_modifier',
'advmod': 'adverb_modifier',
'agent': 'agent',
'amod': 'adjectival_modifier',
'appos': 'appositional_modifier',
'aux': 'auxiliary',
'auxpass': 'p... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def sumOfLeftLeaves(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if root is None:
retu... |
'''Exercício Python 072: Crie um programa que tenha uma dupla totalmente preenchida com uma contagem por extenso, de zero até vinte. Seu programa deverá ler um número pelo teclado (entre 0 e 20) e mostrá-lo por extenso.'''
#----------------------------------------------------
tupla20 = ('zero','um', 'dois','três','quat... |
"""The functional module implements various functional needed
for reinforcement learning calculations.
Exposed functions:
* :py:func:`loss.entropy`
* :py:func:`loss.policy_gradient`
* :py:func:`vtrace.from_logits`
"""
|
class GH_GrasshopperLibraryInfo(GH_AssemblyInfo):
""" GH_GrasshopperLibraryInfo() """
AuthorContact=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: AuthorContact(self: GH_GrasshopperLibraryInfo) -> str
"""
AuthorName=property(lambda self: object(),lambda self,v: None,lambd... |
class Solution:
def reverse(self, x: int) -> int:
s = ''
if x < 0:
s += '-'
x *= -1
else:
s += '0'
while x > 0:
tmp = x % 10
s += str(tmp)
x = x // 10
res = int(s)
if res > 2**31 - 1 or res < - 2*... |
#!/usr/bin/env python
# encoding: utf-8
"""
surrounded_regions.py
Created by Shengwei on 2014-07-15.
"""
# https://oj.leetcode.com/problems/surrounded-regions/
# tags: hard, matrix, bfs
"""
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.
A region is captured by flipping all 'O's into... |
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param headA: the first list
@param headB: the second list
@return: a ListNode
"""
def getIntersectionNode(self, headA, headB):
... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
result = ListNode(0)
curr = result
carry = 0
while l1 or l2... |
string = "PATTERN"
strlen = len(string)
for x in range(0, strlen):
print(string[0:strlen-x]) |
# 姓名
names = ['singi', 'lily', 'sam']
print(names[0])
print(names[1])
print(names[2])
|
#Donal Maher
# Check if one number divides by another
def sleep_in(weekday, vacation):
if (weekday and vacation == False):
return False
else:
return True
result = sleep_in(False, False)
print("The result is {} ".format(result)) |
def calc(n1 ,op ,n2):
result = 0
if op == '+':
result = n1 + n2
elif op == '-':
result = n1 - n2
elif op == '*':
result = n1 * n2
elif op == '/':
result = n1 / n2
else:
result = 0
return result
num1 = input('Input num1...')
num2 = input('Input num2...... |
n = int(input())
L = list(map(int,input().split()))
ans = 1
c = L[0]
cnt = 1
for i in L[1:]:
if c <= i:
cnt+=1
c = i
ans = max(ans,cnt)
else:
cnt = 1
c = i
c = L[0]
cnt = 1
for i in L[1:]:
if c >= i:
cnt+=1
c = i
ans = max(ans,cnt)
else:
... |
"""
백준 2525번 : 오븐 시계
"""
a, b = map(int, input().split())
c = int(input())
b = b + c
mock = b // 60
b = b % 60
a = mock + a
if a >= 24:
a = a - 24
print(a, b) |
# -*- coding: utf-8 -*-
class Config(object):
def __init__(self, bucket, root):
self.bucket = bucket
self.root = root
|
def find_best_investment(arr):
if len(arr) < 2:
return None, None
current_min = arr[0]
current_max_profit = -float("inf")
result = (None, None)
for item in arr[1:]:
current_profit = item - current_min
if current_profit > current_max_profit:
current_max_profit = ... |
def returnValues(z):
results = [(x, y)
for x in range(z)
for y in range(z)
if x + y == 5
if x > y]
return results
print(returnValues(10)) |
# This file is used on sr restored train set (which includes dev segments) tagged with their segment headers
# It splits the set into the dev and train sets using the header information
dev_path = 'dev/text' # stores dev segment information
restored_sr = 'train/text_restored_by_inference_version2_with_tim... |
"""FrequencyEstimator.py
Estimate frequencies of items in a data stream.
D. Eppstein, Feb 2016."""
class FrequencyEstimator:
"""Estimate frequencies of a stream of items to a specified accuracy
(e.g. accuracy=0.1 means within 10% of actual frequency)
using only O(1/accuracy) bytes of memory."""
def _... |
async with pyryver.Ryver("organization_name", "username", "password") as ryver:
await ryver.load_chats()
a_user = ryver.get_user(username="tylertian123")
a_forum = ryver.get_groupchat(display_name="Off-Topic")
|
# tests require to import from Faiss module
# so thus require PYTHONPATH
# the other option would be installing via requirements
# but that would always be a different version
# only required for CI. DO NOT add real tests here, but in top-level integration
def test_dummy():
pass
|
numbers = [int(n) for n in input().split(", ")]
count_of_beggars = int(input())
collected = []
index = 0
for i in range(count_of_beggars):
current_list = []
for index in range(0, len(numbers) + 1, count_of_beggars):
index += i
if index < len(numbers):
current_list.append(numbers[i... |
# list comprehension is an elegant way to creats list based on exesting list
# We can use this one liner comprehensioner for dictnory ans sets also.
#l1 = [3,5,6,7,8,90,12,34,67,0]
'''
# For addind even in l2
l2 =[]
for item in l1:
if item%2 == 0:
l2.append(item)
print(l2)
'''
'''
# Shortcut to write the s... |
'''
Created on Apr 11, 2017
tutorial:
https://www.youtube.com/watch?v=nefopNkZmB4&list=PL6gx4Cwl9DGAcbMi1sH6oAMk4JHw91mC_&index=3
modules:
https://www.youtube.com/watch?v=sKYiQLRe254
@author: halil
'''
class BayesianFilter(object):
'''
classdocs
'''
def __init__(self):
'''
Constru... |
#Функция вычисления чисел Фибоначчи
def fib(n):
if n == 1 or n == 2:
return 1
return (fib(n-1) + fib(n-2))
print(fib(int(input())))
fib(0)
fib(1)
fib(9)
|
"""
This is one solution to the cash machine challenge.
It will be good to re run this when they start to do OOP and see how subtly different the code
is.
I have got around the local scope of the subroutines by declaring thst I will be using the global
variables at the start of the subroutines. This is not the only wa... |
rpc_impl_rename = "_rpc_impl_name"
def impl_name(name: str):
"""
允许 RPC 服务的定义跟实现使用不同名称的类型
:param name:
:return:
"""
def wrap(cls):
setattr(cls, rpc_impl_rename, name)
return cls
return wrap
|
"""Simplest possible f-string with one string variable."""
name = "Peter"
print(f"Hello {name}")
|
rules = {}
appearances = {}
original = input()
input()
while True:
try:
l, r = input().split(" -> ")
except:
break
rules[l] = r
appearances[l] = 0
for i in range(len(original)-1):
a = original[i]
b = original[i+1]
appearances[a+b] += 1
def polymerization(d):
new = {x... |
#opens the file data2.txt and prints all the lines in it that contain the the word “lol”
#in any mixture of upper and lower case
f = open("data2.txt")
text = f.read()
lines = text.split("\n")
print(lines)
for i in range(len(lines)):
if ((lines[i].lower()).find("lol") != -1):
print(lines[i])
def dict_to_st... |
class AccountManagement:
"""
All Account requests allow managing the authenticated user's account or are in some way
connected to account management.
"""
def __init__(self, resolve):
self.resolve = resolve
def get_account_information(self):
"""
Returns the account detai... |
#Potrebno je da izračunate ukupno vrijeme leta za nadolazeće putovanje.
#Letite iz Los Angelesa do Sydney-a čija udaljenost iznosi 7425 milja. Avion leti prosječnom brzinom od 550 milja po satu.
#Izračunajte i ispišite ukupno vrijeme leta u satima
#HINT: Rezultat bi trebao biti float
udaljenost = 7425 #milja
prosjecna... |
n, m = map(int, input().split())
res = []
for _ in range(m):
res.append(int(input()))
res.sort()
price, ans = 0,0
for i in range(m):
result = min(m-i, n)
if ans < res[i] * result:
price = res[i]
ans = res[i] * result
print(price, ans) |
# Crie um programa que leia nome, sexo e idade de várias pessoas, guardando os dados de cada pessoa em um dicionário e todos os dicionários em uma lista. No final, mostre:
# A) Quantas pessoas foram cadastradas
# B) A média de idade
# C) Uma lista com as mulheres
# D) Uma lista de pessoas com idade acima da média
pess... |
n1 = float(input('Digite sua primeira nota: '))
n2 = float(input('Digite sua segunda nota: '))
média = (n1+n2) / 2
if média < 5.0:
print('sua média é {}, você está \033[1;31mReprovado\033[m'.format(média))
elif média < 7.0:
print('Sua média é {}, você está em \033[1;32mRecuperação\033[m'.format(média))
else:
... |
__version__ = "0.3.1"
__logo__ = [
" _ _",
"| | _____ | |__ _ __ __ _",
"| |/ / _ \\| '_ \\| '__/ _` |",
"| < (_) | |_) | | | (_| |",
"|_|\\_\\___/|_.__/|_| \\__,_|",
" "
]
|
def _RELIC__word_list_prep():
file = open('stopwords.txt')
new_file = open('stopwords_new.txt', 'w')
for line in file:
if line.strip():
new_file.write(line)
file.close()
new_file.close()
|
# There are a total of n courses you have to take, labeled from 0 to n - 1.
# Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
# Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish al... |
"""
Web server settings
"""
# 433 MHz Outlet Codes -----------------------------------------------------------------------------
rfcodes = {'1': {'on': '21811', 'off': '21820'},
'2': {'on': '21955', 'off': '21964'},
'3': {'on': '22275', 'off': '22284'},
'4': {'on': '23811', 'off': '2382... |
# acutal is the list of actual labels, pred is the list of predicted labels.
# sensitive is the column of sensitive attribute, target_group is s in S = s
# positive_pred is the favorable result in prediction task. e.g. get approved for a loan
def calibration_pos(actual,pred,sensitive,target_group,positive_pred):
to... |
# Problem Link: https://www.hackerrank.com/contests/projecteuler/challenges/euler013/problem
sum = 0
for _ in range(int(input())):
sum += int(input())
print(str(sum)[:10])
|
# -*- coding: utf-8 -*-
#
# -- General configuration -------------------------------------
source_suffix = ".rst"
master_doc = "index"
project = u"Sphinx theme for dynamic html presentation style"
copyright = u"2012-2021, Sphinx-users.jp"
version = "0.5.0"
# -- Options for HTML output ------------------------------... |
"""Custom mail app exceptions"""
class MultiEmailValidationError(Exception):
"""
General exception for failures while validating multiple emails
"""
def __init__(self, invalid_emails, msg=None):
"""
Args:
invalid_emails (set of str): All email addresses that failed validat... |
operators = {
'+': (lambda a, b: a + b),
'-': (lambda a, b: a - b),
'*': (lambda a, b: a * b),
'/': (lambda a, b: a / b),
'**': (lambda a, b: a ** b),
'^': (lambda a, b: a ** b)
}
priorities = {
'+': 1,
'-': 1,
'*': 2,
'/': 2,
'**': 3,
'^': 3
}
op_chars = {char for o... |
states = ["Washington", "Oregon", "California"]
for x in states:
print(x)
print("Washington" in states)
print("Tennessee" in states)
print("Washington" not in states)
states2 = ["Arizona", "Ohio", "Louisiana"]
best_states = states + states2
print(best_states)
print(best_states[1:3])
print(best_states[:2])
print(... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
##
# Calculates and display a restaurant bill with tax and tips
# @author: rafael magalhaes
# Tax Rate in percent
TAX = 8/100
# Tip percentage
TIP = 18/100
# Getting the meal value
print("Welcome to grand total restaurant app.")
meal_value = float(input("How much was ... |
# Topics
topics = {
# Letter A
"Amor post mortem" : ["Love beyond death.", "The nature of love is eternal, a bond that goes beyond physical death."]
, "Amor bonus" : ["Good love.", "The nature of love is good."]
, "Amor ferus" : ["Fiery love.", "A negative nature of the physical love, reference to passionate, rough ... |
def xfail(fun, excp):
flag = False
try:
fun()
except excp:
flag = True
assert flag
|
# 立方
cube = [v**3 for v in range(1, 11)]
for v in cube:
print(v)
|
def reverse_words(text): # 7 kyu
reverse = []
words = text.split(' ')
for word in words:
reverse.append(word[::-1])
return ' '.join(reverse)
t = "This is an example!"
print(reverse_words(t)) |
with open('p11_grid.txt', 'r') as file:
lines = file.readlines()
n = []
for line in lines:
a = line.split(' ')
b = []
for i in a:
b.append(int(i))
n.append(b)
N = 0
for i in range(20):
for j in range(20):
horizontal, vertical, diag1, diag2 = 0, 0,... |
"""
Problem 11
-----------
In the 20×20 grid below, four numbers along a diagonal line
have been marked in red.
[moved to data/011.txt]
The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
What is the greatest product of four adjacent numbersin the same
direction (up, down, left, right, or diagonally) in the... |
class BST:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
class TreeInfo:
def __init__(self, numberOfNodesVisited, latestVisitedNodeValue):
self.numberOfNodesVisited = numberOfNodesVisited
self.latestVisitedNodeValue = latestVi... |
class ObjectA:
"""first type of object to be matched when running the gale-shapley algorithm"""
def __init__(self, name: str):
self.name = name
def __repr__(self):
return self.name
class ObjectB:
"""second type of object to be matched when running the gale-shapley algorithm"""
d... |
class Solution:
def mostCommonWord(self, paragraph, banned):
"""
:type paragraph: str
:type banned: List[str]
:rtype: str
"""
return collections.Counter(word for word in re.sub("[!?',;.]", " ", paragraph).lower().split() if word not in banned).most_common(1)[0][0] |
#encoding=utf-8
#人类能理解的版本
dataset = [16,9,21,3,13,14,23,6,4,11,3,15,99,8,22]
for i in range(len(dataset)-1,0,-1):
print("-------",dataset[0:i+1],len(dataset),i)
#for index in range(int(len(dataset)/2),0,-1):
for index in range(int((i+1)/2),0,-1):
print(index)
p_index = index
... |
def compute(data):
lines = data.split('\n')
pairs = {
'(':')',
'[':']',
'{':'}',
'<':'>',
}
p1_scores = {
')':3,
']':57,
'}':1197,
'>':25137,
}
p2_scores = {
')':1,
']':2,
'}':3,
'>':4,
}
... |
n = int(input())
count = 0
a_prev, b_prev = -1, 0
for _ in range(n):
a, b = map(int, input().split())
start = max(a_prev, b_prev)
end = min(a, b)
if end >= start:
count += end - start + 1
if a_prev == b_prev:
count -= 1
a_prev, b_prev = a, b
print(count)
|
# Copyright 2021 by Saithalavi M, saithalavi@gmail.com
# All rights reserved.
# This file is part of the Nessaid readline Framework, nessaid_readline python package
# and is released under the "MIT License Agreement". Please see the LICENSE
# file included as part of this package.
#
# common
CR = "\x0d"
LF = "\x0a"
BA... |
"""
Given a binary tree, find the maximum path sum.
For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path does not need to go through the root.
For example:
Given the below binary tree,
1
/ \
2 3
... |
"""Ext macros."""
load("@b//:lib2.bzl", "bar")
foo = bar
|
# The contents of this file is free and unencumbered software released into the
# public domain. For more information, please refer to <http://unlicense.org/>
manga_query = '''
query ($id: Int,$search: String) {
Page (perPage: 10) {
media (id: $id, type: MANGA,search: $search) {
id
title {
... |
# this code will accept an input string and check if it is a plandrome
# it will then return true if it is a plaindrome and false if it is not
def reverse(str1):
if(len(str1) == 0):
return str1
else:
return reverse(str1[1:]) + str1[0]
string = input("Please enter your own String : ")
# chec... |
ticket_dict1 = {
"pagination": {
"object_count": 2,
"continuation": None,
"page_count": 1,
"page_size": 50,
"has_more_items": False,
"page_number": 1
},
"ticket_classes": [
{
"actual_cost": None,
"actual_fee": {
... |
# sorting
n=7
print(n)
arr=[5,1,1,2,10,2,1]
arr.sort()
for i in arr:
print(i,end=' ')
|
n = int(input())
for _ in range(n):
(d, m) = map(int, input().split(' '))
days = list(map(int, input().split(' ')))
day_of_week = 0
friday_13s = 0
for month in range(m):
for day in range(1, days[month] + 1):
if day_of_week == 5 and day == 13:
friday_13s += 1
... |
class Solution(object):
def reverseVowels(self, s):
"""
:type s: str
:rtype: str
"""
vowels = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'}
letters = list(s)
start, end = 0, len(letters) - 1
while start < end:
while start < end and let... |
f = open("13.txt", "r")
sum = 0
while (1):
num = 0
line = f.readline()
if line:
line = line.strip('\n')
for i in range(0, len(line)):
num = num * 10 + int(line[i])
sum += num
else:
break
ans = str(sum)
for i in range(0, 10):
print(ans[i], end = '') |
def from_file(input, output, fasta, fai):
"""
Args:
input - A 23andme data file,
output - Output VCF file,
fasta - An uncompressed reference genome GRCh37 fasta file
fai - The fasta index for for the reference
"""
args = {
'input': input,
'ou... |
#!/usr/bin/env python3
def string_to_max_list(s):
"""Given an input string, convert it to a descendant list of numbers
from the length of the string down to 0"""
out_list = list(range(len(s) - 1, -1, -1))
return out_list
def string_to_min_list(s):
out_list = list(range(len(s)))
out... |
def getNewAddress():
pass
def pushRawP2PKHTxn():
pass
def pushRawP2SHTxn():
pass
def pushRawBareP2WPKHTxn():
pass
def pushRawBareP2WSHTxn():
pass
def pushRawP2SH_P2WPKHTxn():
pass
def pushRawP2SH_P2WSHTxn():
pass
def getSignedTxn():
pass
|
def nextPermutation(nums: list[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
def reverse(nums, left, right):
while left < right:
nums[left], nums[right] = nums[right], nums[left]
left += 1
right -= 1
if not nums:
... |
"""
Mercedes Me APIs
Author: G. Ravera
For more details about this component, please refer to the documentation at
https://github.com/xraver/mercedes_me_api/
"""
# Software Name & Version
NAME = "Mercedes Me API"
DOMAIN = "mercedesmeapi"
VERSION = "0.8"
# Software Parameters
TOKEN_FILE = ".mercedesme_token"
CREDENTIA... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-12-29 15:17
albert_models_google = {
'albert_base_zh': 'https://storage.googleapis.com/albert_models/albert_base_zh.tar.gz',
'albert_large_zh': 'https://storage.googleapis.com/albert_models/albert_large_zh.tar.gz',
'albert_xlarge_zh': 'https://storage.go... |
# -*- coding:utf-8; -*-
class Solution:
"""思路:关键是理解高位设置以后,其后的数字应该排列为最小的数值这一点。
1. 倒序寻找第一个破坏升序的数nums[pos]。为什么这样查找,因为最大的那个数字排序肯定是倒序的。时间复杂度O(n),例如 [2,4,3,1] 中2 破坏了升序。
2. 然后在遍历过的数里寻找第一个比nums[pos]大数字nums[i],时间复杂度O(n),该数字是3。
3. 交换nums[pos]和nums[i],这里交换2和3,新序列是[3,4,2,1]
4. 将pos后面的数字改为升序,这是因为高位重新设置后,其后的数字应... |
class Solution(object):
def getMoneyAmount(self, n):
"""
:type n: int
:rtype: int
"""
cache = [[0] * (n + 1) for _ in xrange(n + 1)]
def dc(cache, start, end):
if start >= end:
return 0
if cache[start][end] != 0:
... |
AWR_CONFIGS = {
"Ant-v2":
{
"actor_net_layers": [128, 64],
"actor_stepsize": 0.00005,
"actor_momentum": 0.9,
"actor_init_output_scale": 0.01,
"actor_batch_size": 256,
"actor_steps": 1000,
"action_std": 0.2,
"critic_net_layers": [128, 64],
... |
"""
Custom exceptions for runpandas
"""
class InvalidFileError(Exception):
def __init__(self, msg):
message = "It doesn't like a valid %s file!" % (msg)
super().__init__(message)
class RequiredColumnError(Exception):
def __init__(self, column, cls=None):
if cls is None:
... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
__author__ = 'exchris'
"""
204.计数质数
统计所以小于非负整数n的质数的数量
输入:10
输出: 4
解释:小于10的质数一共有4个,它们是2,3,5,7
"""
class Solution:
def countPrimes(self, n):
if n < 3:
return 0
prime = [1] * n
prime[0] = prime[1] = 0
for i in range(2, int(n ** 0.... |
# 给定两个字符串 text1 和 text2,返回这两个字符串的最长公共子序列。
#
# 一个字符串的 子序列 是指这样一个新的字符串:它是由原字符串在不改变字符的相对顺序的情况下删除某些字符(也可以不删除任何字符)后组成的新字符串。
# 例如,"ace" 是 "abcde" 的子序列,但 "aec" 不是 "abcde" 的子序列。两个字符串的「公共子序列」是这两个字符串所共同拥有的子序列。
#
# 若这两个字符串没有公共子序列,则返回 0。
#
#
#
# 示例 1:
#
# 输入:text1 = "abcde", text2 = "ace"
# 输出:3
# 解释:最长公共子序列是 "ace",它的长度为 3。
# 示例... |
class MonoMacPackage (Package):
def __init__ (self):
self.pkgconfig_version = '1.0'
self.maccore_tag = '0b71453'
self.maccore_source_dir_name = 'mono-maccore-0b71453'
self.monomac_tag = 'ae428c7'
self.monomac_source_dir_name = 'mono-monomac-ae428c7'
Package.__init__ (self, 'monomac', self.monomac_tag)
... |
# flake8: noqa
# Disable all security
c.NotebookApp.token = ""
c.NotebookApp.password = ""
c.NotebookApp.open_browser = True
c.NotebookApp.ip = "localhost"
|
"""STATES"""
ON = "ON"
OFF = "OFF"
|
"""Message type identifiers for Connections."""
MESSAGE_FAMILY = "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/credential-issuance/0.1"
CREDENTIAL_OFFER = f"{MESSAGE_FAMILY}/credential-offer"
CREDENTIAL_REQUEST = f"{MESSAGE_FAMILY}/credential-request"
CREDENTIAL_ISSUE = f"{MESSAGE_FAMILY}/credential-issue"
MESSAGE_TYPES = {
... |
# -*- coding: utf-8 -*-
def comp_mass_magnets(self):
"""Compute the mass of the hole magnets
Parameters
----------
self : HoleM50
A HoleM50 object
Returns
-------
Mmag: float
mass of the 2 Magnets [kg]
"""
M = 0
# magnet_0 and magnet_1 can have different mat... |
A, B = map(int, input().split())
if A > 8 or B > 8:
print(":(")
else:
print("Yay!") |
class PointObject(RhinoObject):
# no doc
def DuplicatePointGeometry(self):
""" DuplicatePointGeometry(self: PointObject) -> Point """
pass
PointGeometry = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: PointGeometry(self: PointObj... |
playlist_list = [['MIT 8.01SC Classical Mechanics, Fall 2016', 'https://www.youtube.com/playlist?list=PLUl4u3cNGP61qDex7XslwNJ-xxxEFzMNV'],
['How We Teach MIT 8.13-14 Experimental Physics I & II “Junior Lab”, Fall 2016 - Spring 2017','https://www.youtube.com/playlist?list=PLUl4u3cNGP6393Jj6WMmNd1_pOs0UDq2R'],
['MIT 18... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.