content stringlengths 7 1.05M |
|---|
# -----------------------Path related parameters---------------------------------------
train_ct_path = '/content/gdrive/My Drive/MICCAI-LITS2017-master/train/ct' # CT data path of the original training set
train_seg_path = '/content/gdrive/My Drive/MICCAI-LITS2017-master/train/seg' # Original training set lab... |
print("Enter the no of rows: ")
n = int(input())
for i in range(n):
count = 0
flag = 0
for j in range(n):
if(i==j):
flag = 1
if(flag==1):
print(n-count, end=" ")
count+=1
if(flag!=1):
print("1",end=" ")
print()
# Enter the no o... |
I=input
k=int(I())
l=int(I())
r=1
while k**r<l:r+=1
print(['NO','YES\n'+str(r-1)][k**r==l])
|
bot_is_not_admin = 'Ой! Для того, чтобы бот мог менять название беседы, нужно сделать его админом.'
setting = 'Для настройки смены названия для вашей беседы введите, разделяя вертикальной ' \
'чертой "@wchanger Название чётной недели | Название нечётной недели"'
success = 'Бот успешно настроен и теперь будет ... |
# Advance Lists
my_list = [1, 2, 3]
# Add element
print('\n# Add element\n')
my_list.append(4)
my_list.append(4)
print(my_list)
# Count element's occurrences
print('\n# Count element\'s occurrences\n')
print(f'2 = {my_list.count(2)}')
print(f'4 = {my_list.count(4)}')
print(f'5 = {my_list.count(5)}')
# Extend
print... |
#!/usr/bin/env python
# coding=utf-8
# author: zengyuetian
content_type_json = {'Content-Type': 'application/json'}
accept_type_json = {'Accept': 'application/json'}
if __name__ == "__main__":
pass |
#
# %CopyrightBegin%
#
# Copyright Ericsson AB 2013. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with t... |
# Marcelo Campos de Medeiros
# ADS UNIFIP
# REVISÃO DE PYTHON
# AULA 10 CONDIÇÕES GUSTAVO GUANABARA
'''
Faça um Programa que leia um ano qualquer e mostre se ele é BISSEXTO.
'''
print('='*30)
print('{:#^30}'.format(' ANO BISSEXTO '))
print('='*30)
print()
ano = int(input('Informe o ano: '))
print()
# condição para ... |
# 264. Ugly Number II
# Runtime: 173 ms, faster than 54.94% of Python3 online submissions for Ugly Number II.
# Memory Usage: 14.2 MB, less than 73.79% of Python3 online submissions for Ugly Number II.
class Solution:
# Three Pointers
def nthUglyNumber(self, n: int) -> int:
nums = [1]
p2, p3... |
def showAries():
print("ARIES (March 21 – April 19)")
print("")
print("Aries is independent in nature, fun loving, impulsive and a tough cookie. You desire big goals and possess the determination to accomplish them without getting weakened by any hurdle. " +
"The courage and ambition you hold ... |
# -*- coding: utf-8 -*-
"""
@Time : 2020/3/13 13:39
@Author : 半纸梁
@File : contains.py
"""
PER_PAGE_NUMBER = 10 # 分页每页显示数据条数
IMAGE_MAX_SIZE = 5 * 1024 * 1024 # 5M 图片大小最大为5M
IMAGE_EXT_NAME_LS = ["bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf",
"... |
class Constraints(object):
''' Contains all of the primary and foreign key constraint
names for the given entity as tuples of entities and
relations which are part of constraints '''
def __init__(self, pk_constraints, fk_constraints):
self.pk_constraints = pk_constraints
self.f... |
_base_ = [
'../_base_/models/du_pspnet_r50-d8.py', '../_base_/datasets/yantai_st12.py',
'../_base_/runtimes/yantai_runtime.py', '../_base_/schedules/schedule_yantai.py'
]
model = dict(
decode_head=dict(num_classes=4), auxiliary_head=dict(num_classes=4))
test_cfg = dict(mode='whole') |
#!/usr/bin/env python3
print("Gioco del tic tac toe")
board = [
['-','-','-'],
['-','-','-'],
['-','-','-']
]
symList = ['X','O']
def mostra_tabellone():
for i in range(3):
for j in range(3):
print(board[i][j], end=" ")
print()
def win(board):
... |
class Level:
def __init__(self, ident, desc, nresources):
self.id = ident
self.description = desc
self.networkResources = nresources
|
o = input()
e = input()
ans = ''
for i in range(len(e)):
ans += o[i]
ans += e[i]
if len(o)-len(e) == 1:
ans += o[-1]
print(ans)
|
# from ..sims.deprecated.cat_mouse import data_visualizer as cat_mouse_vis
# from ..sims.deprecated.route_choice import data_visualizer as route_choice_vis
# from ..sims.deprecated.simple_migration import data_visualizer as simple_mig_vis
"""
@pytest.mark.skip(reason="deprecated")
def test_cat_mouse_visualizer():
... |
#!/usr/bin/python3
class colors:
"""Colored terminal outputs"""
# Colors can be added and they will be loaded throughout the program
# To output "test" in green:
# print(colors.GREEN + "test" + colors.RESET)
# print({1}test{0}.format(colors.RESET, colors.GREEN))
GREEN = '\033[92m'
YELLOW = '\033[93m'
BLUE = '\0... |
class Item(object):
"""
item对象,
"""
def __init__(self, schema=None, **kwargs):
"""
:param schema: 建表语句,要求有建表权限
:param kwargs: 要存储的数据
"""
self.capacity = kwargs
self.schema = schema
# 增加元素
def __setitem__(self, key, value):
self.capacity[k... |
{
"targets": [{
"target_name": "mine.uv",
"type": "executable",
"dependencies": [
"mine.uv-lib",
],
"sources": [
"src/main.c",
],
}, {
"target_name": "mine.uv-lib",
"type": "<(library)",
"include_dirs": [ "src" ],
"dependencies": [
"deps/uv/uv.gyp:libuv",
... |
#
# PySNMP MIB module CISCO-UNIFIED-COMPUTING-SYSFILE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-SYSFILE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:17:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Usi... |
def duel1(a, b, c):
k = 0
for _ in range(c):
a = a * 16807 % 2147483647
b = b * 48271 % 2147483647
k += a & 0xffff == b & 0xffff
return k
def duel2(a, b, c):
k = 0
for _ in range(c):
a = a * 16807 % 2147483647
while a & 0x3:
a = a * 16807 % 214748... |
{
'name': 'OpenERP Web Diagram',
'category': 'Hidden',
'description': """
Openerp Web Diagram view.
=========================
""",
'version': '2.0',
'depends': ['web'],
'js': [
'static/lib/js/raphael.js',
'static/lib/js/jquery.mousewheel.js',
'static/src/js/vec2.js',
... |
class Solution:
def __init__(self):
self.res = ""
self.maxLen = 0
def naive(self,s):
self.length = len(s)
def loop(start,end):
l,r = start,end
while l>=0 and r<=self.length-1 and s[l]==s[r]:
if r-l+1>self.maxLen:
self.re... |
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
def f():
(some_global): int
print(some_global)
# EXPECTED:
[
...,
LOAD_CONST(Code((1, 0))),
LOAD_CONST('f'),
MAKE_FUNCTION(0),
STORE_NAME('f'),
LOAD_CONST(None),
RETURN_VALUE(0),
CODE_START('f'),
~L... |
#This program computes compound interest
#Prompt the user to input the inital investment
C = int(input('Enter the initial amount of an investment(C): '))
#Prompt the user to input the yearly rate of interest
r = float(input('Enter the yearly rate of interest(r): '))
#Prompt the user to input the number of years unti... |
{
"targets": [
{
"target_name": "index",
"sources": [ "epoc.cc"],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
"conditions": [
['OS=="mac"', {
"cflags": [ "-m64" ],
"ldflags": [ "-m64" ],
"xcode_settings": {
"OTHER_C... |
SAMPLE_DATASET = """GATATATGCATATACTT
ATAT
"""
SAMPLE_OUTPUT = """2 4 10"""
def kmer_generator(string, n):
"""returns a generator for kmers of length n"""
return (string[i : i + n] for i in range(0, len(string)))
def solution(dataset: list) -> str:
s, t = map(lambda x: x.strip(), dataset) # clean
l... |
"""Some utility functions module."""
def camel_to_snake(s):
""" converts CamelCase string to camel_case\
taken from https://stackoverflow.com/a/44969381
:param s: some string
:type s: str:
:return: a camel_case string
:rtype: str:
"""
no_camel = ''.join(['_'+c.low... |
n1 = float(input('Primeiro número: '))
n2 = float(input('Segundo número: '))
opcao = 0
while opcao != 5:
print()
print(''' [1]Somar
[2]Multiplicar
[3]Maior
[4]Novos números
[5]Sair do programa''')
print()
opcao = int(input('Escolha uma opção: '))
if opcao == 1:... |
"""
ranges from taking the first k to taking the last k, so try all the combinations, shifting one numbr at a time
"""
class Solution:
def maxScore(self, cardPoints: List[int], k: int) -> int:
max_score = curr_score = sum(cardPoints[:k])
for i in range(1, k+1):
curr_score += cardPoints[... |
class IdentityHolder:
"""
Wraps an object so that it can be quickly compared by object identity rather than value.
Also provides a total order based on object address.
This is frequently useful for sets representing cycles: set value equality is O(n) but object identity equality is O(1).
Different ... |
def uniqueOccurrences(self, arr: List[int]) -> bool:
m = {}
for i in arr:
if i in m:
m[i] += 1
else:
m[i] = 1
return len(m.values()) == len(set(m.values())) |
#Faça um Programa que leia três números e mostre o maior deles.
a = int(input("Digite o primeiro número: "))
b = int(input("Digite o segundo número: "))
c = int(input("DIgite o terceiro número: "))
primeiro = a
segundo = b
terceiro = c
if terceiro > segundo:
terceiro,segundo = segundo,terceiro
if segundo > pri... |
# leetcode
class Solution:
def hammingDistance(self, x: int, y: int) -> int:
ans = 0
xor = bin(x^y)[2:]
for l in xor:
if l == '1':
ans += 1
return ans |
'''
Write a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l.
Here are some examples to show how your function should work.
>>> sumprimes([3,3,1,13])
19
'''
def sumprimes(l):
prime_sum = int()
for num in l:
if is_prime(num):
... |
'''
date : 31/03/2020
description : this module keeps information on print
objects used by editor
author : Celray James CHAWANDA
contact : celray.chawanda@outlook.com
licence : MIT 2020
'''
print_obj_lookup = {
"basin_wb" : "1",
"basin_nb" : "2",
"basin_ls" : "3",
"ba... |
load("//scala:scala_cross_version.bzl",
"scala_mvn_artifact",
)
def specs2_version():
return "3.8.8"
def specs2_repositories():
native.maven_jar(
name = "io_bazel_rules_scala_org_specs2_specs2_core",
artifact = scala_mvn_artifact("org.specs2:specs2-core:" + specs2_version()),
sha1 = "495bed0... |
class Solution:
def XXX(self, nums: List[int]) -> List[List[int]]:
l = len(nums)
if l <= 1:
return [nums]
total = 1
for i in range(2, l + 1):
total *= i
res = [[] for _ in range(total)]
div = total
for i in range(l):
ni = nu... |
#Program for merge sort in linked list
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def append(self, new_value):
new_node = Node(new_value)
if self.head is None:
self.head = new_node
return
curr_node = self.head
... |
'''
CoG application-level constants.
'''
SECTION_DEFAULT = 'DEFAULT'
SECTION_ESGF = 'ESGF'
SECTION_EMAIL = 'EMAIL'
SECTION_GLOBUS = 'GLOBUS'
SECTION_PID = 'PID'
# note: use lower case
VALID_MIME_TYPES = { '.bmp': ['image/bmp', 'image/x-windows-bmp'],
'.csv': ['text/plain'],
... |
"""The exception for the rayvision api."""
class RayvisionError(Exception):
"""Raise RayvisionError if something wrong."""
def __init__(self, error_code, error, *args, **kwargs):
"""Initialize error message, inherited Exception.
Args:
error_code (int): Error status code.
... |
#!/usr/bin/env python
# coding: utf-8
# ---
# # Python Basics - Assingment 3 ToDo
#
# ---
# **Exercise 1**
#
# **Task 1** Define a function called **repeat_stuff** that takes in two inputs, **stuff**, and **num_repeats**.
#
# We will want to make this function print a string with stuff repeated num_repeats amount o... |
sessions = [{
"1": {
"type": "session",
"source": {"id": "scope"},
"id": "1",
'profile': {"id": "1"}
}
}]
profiles = [
{"1": {'id': "1", "traits": {}}},
{"2": {'id': "2", "traits": {}}},
]
class MockStorageCrud:
def __init__(self, index, domain_class_ref, entity):... |
m = float(input('Digite uma distância em metros: '))
k = m/1000
hct = m/100
dct = m/10
dcm = m*10
cm = m*100
mm = m*1000
print('A distância de {} metros informada corresponde a: \n{} Quilômetros;\n{} Hectômetros;\n{}Decâmetros;\n{:.0f}Decímetros;\n{:.0f}Centímetros e;\n{:.0f}Milímetros.'.format(m, k, hct, dct, dcm, cm,... |
# Configuration file for opasDataLoader
default_build_pattern = "(bEXP_ARCH1|bSeriesTOC)"
default_process_pattern = "(bKBD3|bSeriesTOC)"
# Global variables (for data and instances)
options = None
# Source codes (books/journals) which should store paragraphs
SRC_CODES_TO_INCLUDE_PARAS = ["GW", "SE"]
# for these code... |
class Chocolatine:
def __init__(self):
print("je suis mangé!")
def nom(self):
return "CH0C0LA71N3 !!!!!"
cadeau = (Chocolatine(), "Nicolas", "Julian")
#déplier un tuple
objet, destinataire, expediteur = cadeau
#afficher un tuple
print(cadeau)
#fonction qui mange un objet de type: tuple... |
""" Custom Exceptions """
__author__ = "Alastair Tse <alastair@tse.id.au>"
__license__ = "BSD"
__copyright__ = "Copyright (c) 2004, Alastair Tse"
__revision__ = "$Id: exceptions.py,v 1.2 2004/05/04 12:18:21 acnt2 Exp $"
class ID3Exception(Exception):
"""General ID3Exception"""
pass
class ID3EncodingException(ID3... |
class Recommendation:
def __init__(self, title):
self.title = title
self.wikidata_id = None
self.rank = None
self.pageviews = None
self.url = None
self.sitelink_count = None
def __dict__(self):
return dict(title=self.title,
wikidata_id... |
class Solution:
def reverse(self, x: int) -> int:
b = 0
if x < 0:
b, x = 1, abs(x)
mod, res = 0, 0
while x:
#下面两行分离出每一个位,从而完成逆序
x, mod = x // 10, x % 10
res = res * 10 + mod
if res > 2147483648:
return 0
... |
# coding=utf8
#
# OOO$QHHHQ$$$$$$$$$QQQHHHHNHHHNNNNNNNNNNN
# OO$$QHHNHQ$$$$$O$$$QQQHHHNNHHHNNNNNNMNNN
# $$$QQHHHH$$$OOO$$$$QQQQHHHHHHHNHNNNMNNNN
# HHQQQHHH--:!OOO$$$QQQQQQQHHHHHNNNNNNNNNN
# NNNHQHQ-;-:-:O$$$$$QQQ$QQQQHHHHNNNNNNNNN
# NMNHHQ;-;----:$$$$$$$:::OQHHHHHNNNNHHNNN
# NNNHH;;;-----:C$$$$$::----::-::>NNNNNNNN
# N... |
class Category:
def __init__(self, category):
self.name = category
self.ledger = [] # Each entry is a dictionary
self.ledger1 = [] # Each entry is an array
self.balance = 0
self.withdrawals = 0
def deposit(self, amt, desc=""):
self.balance += amt
self.... |
__author__ = "songjiangshan"
__copyright__ = "Copyright (C) 2021 songjiangshan \n All Rights Reserved."
__license__ = ""
__version__ = "1.0"
DEVICE_TYPE_TAG=0 #OLD3
DEVICE_TYPE_ANCHOR=1 #OLD2
DEVICE_TYPE_ANCHORZ=2 #OLD1
def client_id_remove_group(client_id):
return str(client_id_get_type(client_id)) + '-' + str(... |
def extractExpandablefemaleBlogspotCom(item):
'''
DISABLED
Parser for 'expandablefemale.blogspot.com'
'''
return None |
# -*- coding: utf-8 -*-
"""
Impact
@author: Michael Howden (michael@sahanafoundation.org)
@date-created: 2010-10-12
Impact resources used by I(ncident)RS and Assessment
"""
module = "impact"
if deployment_settings.has_module("irs") or deployment_settings.has_module("assess"):
# ---... |
# -*- coding: utf-8 -*-
# pyxliff/__init__.py
"""Provides useful functions for SDLXliff terms verification and discovery."""
__version__ = "0.1.0"
|
class NanoblocksClass:
"""
Global class that should be inherited by any Nanoblocks class that requires access to the network.
"""
def __init__(self, nano_network):
self._nano_network = nano_network
@property
def network(self):
return self._nano_network
@property
def n... |
#
# PySNMP MIB module ZYXEL-L3-IP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-L3-IP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:50:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
# Given an Android 3x3 key lock screen and two integers m and n,
# where 1 ≤ m ≤ n ≤ 9, count the total number of unlock patterns of the Android lock screen,
# which consist of minimum of m keys and maximum n keys.
# Rules for a valid pattern:
# Each pattern must connect at least m keys and at most n keys.
# All the... |
"""
Dana jest tablica T[N]. Proszę napisać program zliczający liczbę “enek” o określonym iloczynie.
"""
def number_of_ns(T, product, n, idx=0):
if product == 1 and n == 0:
return 1
if n == 0:
return 0
count = 0
for i in range(idx, len(T)):
if product % T[i] == 0:
co... |
##planets = [
## {
## "planet": "Tatooine",
## "visited": False,
## "reachable": ["Dagobah", "Hoth"]
## },
## {
## "planet": "Dagobah",
## "visited": False,
## "reachable": ["Hoth", "Endor"]
## },
## {
## "planet": "Endor",
## "visited": False,
## ... |
# -*- coding: utf-8 -*-
def main():
n, m = map(int, input().split())
xs = sorted(list(map(int, input().split())))
if n >= m:
print(0)
else:
ans = xs[-1] - xs[0]
diff = [0 for _ in range(m - 1)]
for i in range(m - 1):
diff[i] = xs[i + 1] - xs[... |
if True:
pass
if 0:
pass
if 1:
pass
if (1==1) :
pass
if 1 == 2 + - 1 :
pass
if 456 == 244:
pass
if 1 == 0 - 5 + 6 - 1:
pass
if 2 + 2 == 5:
pass
if 23313 + 31313 == 0:
pass
if 2 + 2 == 3 + 1 * 0 + 1 :
pass
if 1 == 1:
pass
if - 1== 2-3 :
pass
if (2 + 2) + 2 == 7:
... |
# lists02.py
def test_list_01():
# Tuples: immutable
t1 = (1, 2, 3)
print(t1, type(t1))
# Lists: immutable
l1 = [1, 2, 3]
print(l1, type(l1))
t2 = t1
l2 = l1
# Kopie, Clone erzeugen
l2 = list(l1) # Neue Liste mit den Elementen aus l1
l3 = l1.copy()
t2 = t2 + (4, )... |
#
# PySNMP MIB module ALCATEL-IND1-IPX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-IPX-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:02:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
command = input()
command = command.strip()
tokens = []
numbers = ['0','1','2','3','4','5','6','7','9']
if (command[:4]=="cout" and command[-1]==';'):
index = 4
while(True):
if(command[index]=='<' and command[index+1]=='<'):
index+=2
s=""
while(command[index]!='<' and... |
"""
Source: https://en.wikipedia.org/wiki/Palindrome#Names
"""
def is_palindrome(text: str) -> bool:
return text.lower() == text.lower()[::-1]
if __name__=='__main__':
text = input('Give me the text to analyze: ')
print(f'{text} Is Palindrome?: {is_palindrome(text)}')
|
result = {
"due-date": "2018-11-13T00:00:00",
"features": [
{
"geometry": {
"coordinates": [
[
[
9.52487,
46.85514
],
[
... |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 5 16:32:17 2020
Write a Python function that returns a list of keys in aDict that map to
integer values that are unique (i.e. values appear exactly once in aDict).
The list of keys you return should be sorted in increasing order.
(If aDict does not contain any unique v... |
class Solution:
def findLHS(self, nums: list) -> int:
nums.sort()
start_index = 0
l_count = 0
m_count = 0
LHS = 0
for i in range(len(nums)):
if start_index == 0:
l_count = 1
min_num = nums[i]
start_index = 1... |
MAX_WORD_SENTENCE = 40
# VECTORIZATIONS
TDIDF_EMBEDDING = 'tdidf'
TOKENIZER = 'tokenizer'
# IMBALANCE
SMOTE_IMBALANCE = 'smote'
# DATASET TYPES
FINANCIAL_DATASET = 'financial_phrases_bank'
MOVIE_DATASET = 'movie_data'
SST_DATASET = 'sst_dataset'
TWITTER_DATASET = 'twitter_data'
YAHOO_DATASET = 'yahoo_data'
NN_DATASE... |
# Faça um programa que leia um número inteiro e mostre na tela o seu sucessor e seu antecessor
num = int(input('Digite um número inteiro: '))
ant = num - 1
suc = num + 1
print('O sucessor de {} é {} e seu antecessor é {}'.format(num, suc, ant))
# Resolução com somente uma variável:
# print('O sucessor de {} é {} e se... |
__all__ = [
'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn',
'vgg19_bn', 'vgg19',
]
model_urls = {
'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth',
'vgg13': 'https://download.pytorch.org/models/vgg13-c768596a.pth',
'vgg16': 'https://download.pytorch.org/model... |
class BaseDriver(object):
EXECUTABLE_PATH = None
BINARY_PATH = None
def __init__(self):
self._driver = None
@property
def driver(self):
return self._driver
|
# 2019-02-18
# sentence to dictionary meaning
sentence = "It is truth universally acknowledged"
f = open('dict_test.TXT', 'r', encoding='utf-8')
dictionary = {}
for line in f:
word = line[:-1].split(" : ", 1)
dictionary.update({word[0]:word[-1]})
f.close()
print("Sentence :", sentence)
for word in senten... |
def calcIoU(rectA, rectB):
"""Calculate IoU for two rectangles.
Args:
rectA: Rectangular bounding box ([top left X, top left Y, bottom right X, bottom right Y]).
rectB: Rectangular bounding box ([top left X, top left Y, bottom right X, bottom right Y]).
Returns:
Returns IoU, intersection area, r... |
class MultiCollector(object):
'a collector combining multiple other collectors'
def __init__(self):
self._collectors = {}
def register(self, name, collector):
self._collectors[name] = collector
def start(self):
for name in self._collectors:
self._collectors[name].... |
# Set number of participants
num_dyads = 4
num_participants = num_dyads*2
# Create lists for iterations
participants = list(range(num_participants))
dyads = list(range(num_dyads)) |
class Node(object):
def Class(self):
"""
self.Class() -> Class of node.
@return: Class of node.
"""
# raise NotImplementedError("This function is not written yet. Please put in an issue on the github page.")
return "%s(%r)" % (self.__class__, self.__dict__)
def ... |
basrol = input("Başrolün ismi: ")
kardes = input("Başrolün Ağabeyi: ")
anne = input("Başrolün Annesi: ")
baba = input("Başrolün Babası: ")
sevgili1 = input("Basrolun Sevdiği: ")
arkadas = input("Başrolün Yakın Arkadaşı: ")
mekan = input("Nerede: ")
isyeri = input("Nerede Çalışıyorlar: ")
print ("--------... |
__all__ = ['v1', 'f1', 'C1']
v1 = 18
v2 = 36
def f1():
pass
def f2():
pass
class C1(object):
pass
class C2(object):
pass
|
values = {
'r': 0.000000000001
}
typers = {
'r': float
}
def setGlobal(key, value):
values[key] = value
|
"""
Settings for tests.
"""
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'example.sqlite',
},
}
INSTALLED_APPS = [
'tests.django_app'
]
MIDDLEWARE_CLASSES = ()
SECRET_KEY = 'testing.'
|
class UnsupportedMethod(Exception):
def __init__(self, message, errors):
super().__init__(message)
class NoPayload(Exception):
def __init__(self):
super().__init__() |
def print_multiplication_table(vertical_interval, horizontal_interval):
print('\t', end='')
for i in range(horizontal_interval[0], horizontal_interval[1] + 1):
print(i, end='\t')
print()
for i in range(vertical_interval[0], vertical_interval[1] + 1):
print(i, end='\t')
for j in ... |
class Colors:
def __init__(self):
self.color_dict = {
"ERROR": ';'.join([str(7), str(31), str(47)]),
"WARN": ';'.join([str(7), str(33), str(40)]),
"INFO": ';'.join([str(7), str(32), str(40)]),
"GENERAL": ';'.join([str(7), str(34), str(47)])
}
... |
def globals(request):
#import pdb
#pdb.set_trace()
data = {}
if 'menu_item' in request.session:
data['menu_item'] = request.session['menu_item']
return data
|
SQLALCHEMY_DATABASE_URI = \
'mysql+cymysql://root:00000000@localhost/ucar'
SECRET_KEY = '***'
SQLALCHEMY_TRACK_MODIFICATIONS = True
MINA_APP = {
'AppID': '***',
'AppSecret': '***'
}
|
#!/usr/bin/env python
def upgradeDriverCfg(version, dValue={}, dOption=[]):
"""Upgrade the config given by the dict dValue and dict dOption to the
latest version."""
# the dQuantUpdate dict contains rules for replacing missing quantities
dQuantReplace = {}
# update quantities depending on version
... |
class Class:
def __init__(self, name: str):
self.name = name
class Instance:
def __init__(self, cls: Class):
self.cls = cls
self._fields = {}
def get_attr(self, name: str):
if name not in self._fields:
raise AttributeError(f"'{self.cls.name}' has no attribute {... |
# Pell Numbers
class Pell:
def __init__(self):
self.limiter = 1000
self.numbers = [0, 1]
self.path = r'./Pell_Sequence/results.txt'
def void(self):
with open(self.path, "w+") as file:
for i in range(self.limiter):
self.numbers.append(2 * sel... |
def squares(n):
i = 1
while i <= n:
yield i * i
i += 1
print(list(squares(5))) |
def prod(L):
p = 1
for i in L:
p *= i
return p
|
'''13 - Tendo como dado de entrada a altura (h) de uma pessoa, construa um algoritmo que calcule seu peso ideal,
utilizando as seguintes fórmulas:
* Para homens: (72.7*h) - 58
* Para mulheres: (62.1*h) - 44.7
'''
altura = float(input('Digite a sua altura em metros: '))
print(f'O peso ideal para homens é de {(72.7*... |
# a,b = [set(input().split()) for i in range(4)][1::2]
# print ('\n'.join(sorted(a^b, key=int)))
a,b=(int(input()),input().split())
c,d=(int(input()),input().split())
x=set(b)
y=set(d)
p=y.difference(x)
q=x.difference(y)
r=p.union(q)
print ('\n'.join(sorted(r, key=int)))
|
def partida ():
n = int(input("Escolha quantas peças para jogar: "))
while n <= 0:
print ("Jogada não permitida. Escolha um número inteiro positivo")
n = int(input("Escolha quantas peças para jogar: "))
m = int(input("Qual a quantidade máxima de peças removidas? "))
while m >= n or m <= ... |
def f(bar):
# type: (str) -> str
return bar
f(bytearray()) |
# job_list_one_shot.py ---
#
# Filename: job_list_one_shot.py
# Author: Abhishek Udupa
# Created: Tue Jan 26 15:13:19 2016 (-0500)
#
#
# Copyright (c) 2015, Abhishek Udupa, University of Pennsylvania
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permit... |
class Vehicle:
''' Documentation needed here
'''
def __init__(self, numberOfTires, colorOfVehicle):
''' Documentation needed here
'''
self.numberOfTires = numberOfTires
self.colorOfVehicle = colorOfVehicle
def start(self):
''' This function starts the vehicle
'''
print("I started!")
def dr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.