content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class RestApiBaseTest(object):
def assert_items(self, items, cls):
"""Asserts that all items in a collection are instances of a class
"""
for item in items:
assert isinstance(item, cls)
def assert_has_valid_head(self, response, expected):
... | class Restapibasetest(object):
def assert_items(self, items, cls):
"""Asserts that all items in a collection are instances of a class
"""
for item in items:
assert isinstance(item, cls)
def assert_has_valid_head(self, response, expected):
"""Asserts a response h... |
def target_file():
return ".html"
def target_domain():
return "https://lyricsmania.com/"
def artist_query(name):
return target_domain() + str.lower(name) + "_lyrics" + target_file()
if __name__ == "__main__":
print(artist_query("Lizzo")) | def target_file():
return '.html'
def target_domain():
return 'https://lyricsmania.com/'
def artist_query(name):
return target_domain() + str.lower(name) + '_lyrics' + target_file()
if __name__ == '__main__':
print(artist_query('Lizzo')) |
load("@bazel_skylib//lib:paths.bzl", "paths")
GlslLibraryInfo = provider("Set of GLSL header files", fields = ["hdrs", "includes"])
SpirvLibraryInfo = provider("Set of Spirv files", fields = ["spvs", "includes"])
def _export_headers(ctx, virtual_header_prefix):
strip_include_prefix = ctx.attr.strip_include_prefix... | load('@bazel_skylib//lib:paths.bzl', 'paths')
glsl_library_info = provider('Set of GLSL header files', fields=['hdrs', 'includes'])
spirv_library_info = provider('Set of Spirv files', fields=['spvs', 'includes'])
def _export_headers(ctx, virtual_header_prefix):
strip_include_prefix = ctx.attr.strip_include_prefix
... |
node = S(input, "application/json")
node.prop("comment", "42!")
propertyNode = node.prop("comment")
value = propertyNode.stringValue() | node = s(input, 'application/json')
node.prop('comment', '42!')
property_node = node.prop('comment')
value = propertyNode.stringValue() |
def moeda(funcao, moeda='R$'):
return f'{moeda}{funcao:.2f}'.replace('.', ',')
def aumentar(p, taxa):
res = p * (1 + taxa/100)
return res
def diminuir(p, taxa):
res = p * (1 - taxa/100)
return res
def dobro(p):
res = p * 2
return res
def metade(p):
res = p / 2
return res
| def moeda(funcao, moeda='R$'):
return f'{moeda}{funcao:.2f}'.replace('.', ',')
def aumentar(p, taxa):
res = p * (1 + taxa / 100)
return res
def diminuir(p, taxa):
res = p * (1 - taxa / 100)
return res
def dobro(p):
res = p * 2
return res
def metade(p):
res = p / 2
return res |
class Solution:
def naive(self,root):
self.res = 0
def dfs(tree,s):
s_ = s*10+tree.val
if tree.left==None and tree.right==None:
self.res+=s_
return
if tree.left:
dfs(tree.left,s_)
if tree.right:
... | class Solution:
def naive(self, root):
self.res = 0
def dfs(tree, s):
s_ = s * 10 + tree.val
if tree.left == None and tree.right == None:
self.res += s_
return
if tree.left:
dfs(tree.left, s_)
if tree.r... |
class Solution:
def getSmallestString(self, n: int, k: int) -> str:
op=['a']*n
k=k-n
i=n-1
while k:
k+=1
if k/26>=1:
op[i]='z'
i-=1
k=k-26
else:
op[i]=chr(k+96)
k=0
... | class Solution:
def get_smallest_string(self, n: int, k: int) -> str:
op = ['a'] * n
k = k - n
i = n - 1
while k:
k += 1
if k / 26 >= 1:
op[i] = 'z'
i -= 1
k = k - 26
else:
op[i] = ch... |
# -*- coding: utf-8 -*-
"""An implementation of learning priority sort algorithm_learning with NTM.
Input sequence length: "1 ~ 20: (1*2+1)=3 ~ (20*2+1)=41"
Input dimension: "8"
Output sequence length: equal to input sequence length.
Output dimension: equal to input dimension.
"""
| """An implementation of learning priority sort algorithm_learning with NTM.
Input sequence length: "1 ~ 20: (1*2+1)=3 ~ (20*2+1)=41"
Input dimension: "8"
Output sequence length: equal to input sequence length.
Output dimension: equal to input dimension.
""" |
def summation(n,term):
total,k=0,1
while k<=n:
total,k = term(k) + total, k+1
return total
def square(x):
return x*x
def pi_summantion(n):
return summation(n, lambda x: 8 / ((4*x-3) * (4*x-1)))
def suqare_summantio(n):
return summation(n, square)
print(pi_summantion(1e6))
print(s... | def summation(n, term):
(total, k) = (0, 1)
while k <= n:
(total, k) = (term(k) + total, k + 1)
return total
def square(x):
return x * x
def pi_summantion(n):
return summation(n, lambda x: 8 / ((4 * x - 3) * (4 * x - 1)))
def suqare_summantio(n):
return summation(n, square)
print(pi_s... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 13 14:05:03 2020
Introduction to Computation and Programming Using Python. John V. Guttag, 2016, 2nd ed
Book Chapter 2 Finger Exercises
Using While Loop
@author: Atanas Kozarev - github.com/ultraasi-atanas
"""
numXs = int(input('How many times should I print the letter ... | """
Created on Fri Nov 13 14:05:03 2020
Introduction to Computation and Programming Using Python. John V. Guttag, 2016, 2nd ed
Book Chapter 2 Finger Exercises
Using While Loop
@author: Atanas Kozarev - github.com/ultraasi-atanas
"""
num_xs = int(input('How many times should I print the letter X? '))
to_print = ''
whi... |
def sort_2d_np(edges):
"""
edges: (m x 2)
Sort ascendngly according to each column.
Example:
edges = array(
[[9, 8],
[3, 6],
[1, 3],
[8, 6],
[3, 2],
[9, 1],
[5, 1]]
)
sorte... | def sort_2d_np(edges):
"""
edges: (m x 2)
Sort ascendngly according to each column.
Example:
edges = array(
[[9, 8],
[3, 6],
[1, 3],
[8, 6],
[3, 2],
[9, 1],
[5, 1]]
)
sorted... |
class PhotoAlbum:
def __init__(self, pages: int):
self.pages = pages
self.photos = [[] for _ in range(self.pages)]
@classmethod
def from_photos_count(cls, photos_count: int):
pages_count = photos_count // 4
if photos_count % 4 != 0:
pages_count += 1
retur... | class Photoalbum:
def __init__(self, pages: int):
self.pages = pages
self.photos = [[] for _ in range(self.pages)]
@classmethod
def from_photos_count(cls, photos_count: int):
pages_count = photos_count // 4
if photos_count % 4 != 0:
pages_count += 1
retu... |
print('hii'+str(5))
print(int(8)+5);
print(float(8.5)+5);
print(int(8.5)+5);
#print(int('C'))
| print('hii' + str(5))
print(int(8) + 5)
print(float(8.5) + 5)
print(int(8.5) + 5) |
def compare(v1, operator, v2):
if operator == ">":
return v1 > v2
elif operator == "<":
return v1 < v2
elif operator == ">=":
return v1 >= v2
elif operator == "<=":
return v1 <= v2
elif operator == "=" or "==":
return v1 == v2
elif operator == "!=":
... | def compare(v1, operator, v2):
if operator == '>':
return v1 > v2
elif operator == '<':
return v1 < v2
elif operator == '>=':
return v1 >= v2
elif operator == '<=':
return v1 <= v2
elif operator == '=' or '==':
return v1 == v2
elif operator == '!=':
... |
def return_load(**kwargs):
if kwargs['_type'] == 'Point':
load = PointLoad(**kwargs)
elif kwargs['_type'] == 'Uniform':
load = UniformLoad(**kwargs)
else:
print('Invalid type: returned default `PointLoad`')
return PointLoad()
return load
class PointLoad(object):
"""... | def return_load(**kwargs):
if kwargs['_type'] == 'Point':
load = point_load(**kwargs)
elif kwargs['_type'] == 'Uniform':
load = uniform_load(**kwargs)
else:
print('Invalid type: returned default `PointLoad`')
return point_load()
return load
class Pointload(object):
"... |
#pythran export fib_pythran(int)
def fib_pythran(n):
i, sum, last, curr = 0, 0, 0, 1
if n <= 2:
return 1
while i < n - 1:
sum = last + curr
last = curr
curr = sum
i += 1
return sum
#pythran export count_doubles_pythran_zip(str, int)
def count_doubles_pythran_zip... | def fib_pythran(n):
(i, sum, last, curr) = (0, 0, 0, 1)
if n <= 2:
return 1
while i < n - 1:
sum = last + curr
last = curr
curr = sum
i += 1
return sum
def count_doubles_pythran_zip(val, n):
total = 0
for (c1, c2) in zip(val, val[1:]):
if c1 == c2... |
#
# PySNMP MIB module PNNI-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PNNI-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:41:07 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,... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) ... |
"""
@author Huaze Shen
@date 2019-10-05
"""
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def delete_duplicates(head):
if head is None or head.next is None:
return head
pre = head
while pre:
cur = pre
while cur.next and cur.val == cur.ne... | """
@author Huaze Shen
@date 2019-10-05
"""
class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def delete_duplicates(head):
if head is None or head.next is None:
return head
pre = head
while pre:
cur = pre
while cur.next and cur.val == cur.nex... |
# flake8: noqa
bm25 = BatchRetrieve(index, "BM25")
axiom = (ArgUC() & QTArg() & QTPArg()) | ORIG()
# Re-rank top-20 documents with KwikSort.
kwiksort = bm25 % 20 >> \
KwikSortReranker(axiom, index)
pipeline = kwiksort ^ bm25
| bm25 = batch_retrieve(index, 'BM25')
axiom = arg_uc() & qt_arg() & qtp_arg() | orig()
kwiksort = bm25 % 20 >> kwik_sort_reranker(axiom, index)
pipeline = kwiksort ^ bm25 |
ciphertext = "WAPSD EXTCO EEREF SELIO RSARC LIETE OIHHP VASTF EGBER IPAPN TOEGI AIATH DDHIY EACYE RQAEN OHRTE TEVME BGHMF EIOWS GFHCL XEUUC OMTOT LERES SDEWW ORCCS HEURE ATTEG ALSEB APXET IURWV RTEEH IOTLO SNACN NULCV LCMTH HHCOH TIOTD ASNAL TSANA CASOR LEKAS TATCW INTLO TRYER YLTND RILER AOMAX OITDE ECOIA HAALS TYIOA ... | ciphertext = 'WAPSD EXTCO EEREF SELIO RSARC LIETE OIHHP VASTF EGBER IPAPN TOEGI AIATH DDHIY EACYE RQAEN OHRTE TEVME BGHMF EIOWS GFHCL XEUUC OMTOT LERES SDEWW ORCCS HEURE ATTEG ALSEB APXET IURWV RTEEH IOTLO SNACN NULCV LCMTH HHCOH TIOTD ASNAL TSANA CASOR LEKAS TATCW INTLO TRYER YLTND RILER AOMAX OITDE ECOIA HAALS TYIOA ... |
class PractitionerTemplate:
def __init__(self):
super().__init__()
def practitioner_default(self, data_list):
keys = []
for data in data_list:
key = f"{data.get('rowid')},{data.get('employee_id')}"
keys.append(key)
return keys
| class Practitionertemplate:
def __init__(self):
super().__init__()
def practitioner_default(self, data_list):
keys = []
for data in data_list:
key = f"{data.get('rowid')},{data.get('employee_id')}"
keys.append(key)
return keys |
def update_bit(num, bit, value):
mask = ~(1 << bit)
return (num & mask) | (value << bit)
def get_bit(num, bit):
return (num & (1 << bit)) != 0
def insert_bits(n, m, i, j):
for bit in range(i, j + 1):
n = update_bit(n, bit, get_bit(m, bit - i))
return n
def insert_bits_mask(n, m, i, j):
mask = (~0 ... | def update_bit(num, bit, value):
mask = ~(1 << bit)
return num & mask | value << bit
def get_bit(num, bit):
return num & 1 << bit != 0
def insert_bits(n, m, i, j):
for bit in range(i, j + 1):
n = update_bit(n, bit, get_bit(m, bit - i))
return n
def insert_bits_mask(n, m, i, j):
mask =... |
nodes = [[1,3], [0,2], [1,3], [0,2]]
otherNodes = [[1,2,3], [0,2], [0,1,3], [0,2]]
def isBipartite(nodes):
colors = [0] * len(nodes)
for index, node in enumerate(nodes):
if colors[index] == 0 and not properColor(nodes, colors, 1, index):
return False
return True
def properColor(graph, colors, color, n... | nodes = [[1, 3], [0, 2], [1, 3], [0, 2]]
other_nodes = [[1, 2, 3], [0, 2], [0, 1, 3], [0, 2]]
def is_bipartite(nodes):
colors = [0] * len(nodes)
for (index, node) in enumerate(nodes):
if colors[index] == 0 and (not proper_color(nodes, colors, 1, index)):
return False
return True
def pr... |
manipulated_string = input()
while True:
line = input()
if line == "end":
break
command_element = line.split(' ')
command = command_element[0]
first_condition = int(command_element[1])
if command == 'Right':
for i in range(first_condition):
manipulated_string = manipu... | manipulated_string = input()
while True:
line = input()
if line == 'end':
break
command_element = line.split(' ')
command = command_element[0]
first_condition = int(command_element[1])
if command == 'Right':
for i in range(first_condition):
manipulated_string = manipu... |
c = {a: 1, b: 2}
fun(a, b, **c)
# EXPECTED:
[
...,
LOAD_NAME('fun'),
...,
BUILD_TUPLE(2),
...,
CALL_FUNCTION_EX(1),
...,
]
| c = {a: 1, b: 2}
fun(a, b, **c)
[..., load_name('fun'), ..., build_tuple(2), ..., call_function_ex(1), ...] |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def partition(self, head, x):
"""
:type head: ListNode
:type x: int
:rtype: ListNode
"""
if not head:... | class Solution(object):
def partition(self, head, x):
"""
:type head: ListNode
:type x: int
:rtype: ListNode
"""
if not head:
return head
d1 = list_node(-1)
temp1 = d1
d2 = list_node(-1)
temp2 = d2
temp = head
... |
entrada = 'Gilberto'
saida = '{:+^12}'.format(entrada)
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.capitalize()
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.title()
print(saida)
entrada = 'GilberTo'
saida = entrada.lower()
print(saida)
entrada = 'Gilberto'
saida =... | entrada = 'Gilberto'
saida = '{:+^12}'.format(entrada)
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.capitalize()
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.title()
print(saida)
entrada = 'GilberTo'
saida = entrada.lower()
print(saida)
entrada = 'Gilberto'
saida = '{:*<10}'.format(ent... |
n = int(input())
l = {}
for i in range(n):
k = input()
if k in l:
l[k] += 1
else:
l[k] = 1
print(len(l))
for i in l:
print(l[i], end=" ")
| n = int(input())
l = {}
for i in range(n):
k = input()
if k in l:
l[k] += 1
else:
l[k] = 1
print(len(l))
for i in l:
print(l[i], end=' ') |
# @Time: 2022/4/12 20:29
# @Author: chang liu
# @Email: chang_liu_tamu@gmail.com
# @File:4-3-Creating-New-Iteration-Patterns-With-Generators.py
def frange(start, stop, increment):
x = start
while x < stop:
yield x
x += increment
# for n in frange(1, 5, 0.6):
# print(n)
def countdown(n):... | def frange(start, stop, increment):
x = start
while x < stop:
yield x
x += increment
def countdown(n):
print(f'starting counting from {n}')
while n > 0:
yield n
n -= 1
print('Done')
g = countdown(3)
print(next(g))
print(next(g))
print(next(g))
print('*' * 30)
i = ite... |
"""
Created on 20 Feb 2019
@author: Frank Ypma
"""
class Location:
"""
Simple x,y coordinate wrapper
"""
def __init__(self, x=0, y=0):
self.x = x
self.y = y | """
Created on 20 Feb 2019
@author: Frank Ypma
"""
class Location:
"""
Simple x,y coordinate wrapper
"""
def __init__(self, x=0, y=0):
self.x = x
self.y = y |
def test_get_key(case_data):
"""
Test :meth:`.get_key`.
Parameters
----------
case_data : :class:`.CaseDat`
A test case. Holds the key maker to test and the correct key
it should produce.
Returns
-------
None : :class`NoneType`
"""
_test_get_key(
key_m... | def test_get_key(case_data):
"""
Test :meth:`.get_key`.
Parameters
----------
case_data : :class:`.CaseDat`
A test case. Holds the key maker to test and the correct key
it should produce.
Returns
-------
None : :class`NoneType`
"""
_test_get_key(key_maker=case_... |
# https://leetcode.com/explore/learn/card/fun-with-arrays/527/searching-for-items-in-an-array/3251/
class Solution:
def validMountainArray(self, arr: List[int]) -> bool:
inc = True
incd = False
decd = False
for i,elmnt in enumerate(arr):
if i == 0:continue
if ... | class Solution:
def valid_mountain_array(self, arr: List[int]) -> bool:
inc = True
incd = False
decd = False
for (i, elmnt) in enumerate(arr):
if i == 0:
continue
if inc == True and arr[i] > arr[i - 1]:
incd = True
... |
def get_input() -> list:
with open(f"{__file__.rstrip('code.py')}input.txt") as f:
return [int(l[:-1]) for l in f.readlines()]
def has_pair(sum_val: int, vals: list) -> bool:
for idx_i, i in enumerate(vals):
for j in vals[idx_i+1:]:
if i + j == sum_val:
return True
... | def get_input() -> list:
with open(f"{__file__.rstrip('code.py')}input.txt") as f:
return [int(l[:-1]) for l in f.readlines()]
def has_pair(sum_val: int, vals: list) -> bool:
for (idx_i, i) in enumerate(vals):
for j in vals[idx_i + 1:]:
if i + j == sum_val:
return Tr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
##############################################
# Institut Villebon, UE 3.1
# Projet : mon_via_navigo
# Auteur : C.Lavrat, B. Marie Joseph, S. Sonko
# Date de creation : 27/12/15
# Date de derniere modification : 27/12/15
##############################################
cla... | class Station:
"""
The Station module
==================
This class creates stations and contains all the informations of the stations
Parameters
----------
:param name: name of the station
:param position: position of the station
:param in_line: line of the station
:type name:... |
"""
Profile ../profile-datasets-py/div52_zen50deg/034.py
file automaticaly created by prof_gen.py script
"""
self["ID"] = "../profile-datasets-py/div52_zen50deg/034.py"
self["Q"] = numpy.array([ 1.607768, 4.15376 , 5.83064 , 7.181963, 6.558055,
7.26391 , 9.444143, 8.659606, ... | """
Profile ../profile-datasets-py/div52_zen50deg/034.py
file automaticaly created by prof_gen.py script
"""
self['ID'] = '../profile-datasets-py/div52_zen50deg/034.py'
self['Q'] = numpy.array([1.607768, 4.15376, 5.83064, 7.181963, 6.558055, 7.26391, 9.444143, 8.659606, 7.119357, 7.498499, 7.80505, 7.015238... |
"""The markdown module."""
# pylint: disable=invalid-name
def bold(text):
"""Bold.
Args:
text (str): text to make bold.
Returns:
str: bold text.
"""
return '**' + text + '**'
def code(text, inline=False, lang=''):
"""Code.
Args:
text (str): text to make code.
... | """The markdown module."""
def bold(text):
"""Bold.
Args:
text (str): text to make bold.
Returns:
str: bold text.
"""
return '**' + text + '**'
def code(text, inline=False, lang=''):
"""Code.
Args:
text (str): text to make code.
inline (bool, optional): f... |
n = int(input())
arr = [int(x) for x in input().split()]
counter = [0]*1001
for i in range(n):
counter[arr[i]] += 1
counts = []
for i in range(1001):
if counter[i] > 0:
counts.append((counter[i],i))
counts.sort(key=lambda x: (-x[0], x[1]))
q = []
for freq,i in counts:
q.extend([i]*freq)
j = 0
o... | n = int(input())
arr = [int(x) for x in input().split()]
counter = [0] * 1001
for i in range(n):
counter[arr[i]] += 1
counts = []
for i in range(1001):
if counter[i] > 0:
counts.append((counter[i], i))
counts.sort(key=lambda x: (-x[0], x[1]))
q = []
for (freq, i) in counts:
q.extend([i] * freq)
j = ... |
def testIter(encoder, decoder, sentence, word2ix, ix2word, max_length=20):
input_variable = sentence
input_length = input_variable.size()[0]
encoder_hidden = encoder.initHidden()
encoder_outputs = Variable(torch.zeros(max_length, encoder.hidden_size))
if use_cuda:
encoder_outputs = encoder_outputs.cuda()
for ... | def test_iter(encoder, decoder, sentence, word2ix, ix2word, max_length=20):
input_variable = sentence
input_length = input_variable.size()[0]
encoder_hidden = encoder.initHidden()
encoder_outputs = variable(torch.zeros(max_length, encoder.hidden_size))
if use_cuda:
encoder_outputs = encoder_... |
# -*- coding: utf-8 -*-
# Part of BrowseInfo. See LICENSE file for full copyright and licensing details.
{
"name" : "Hospital Management in Odoo/OpenERP",
"version" : "12.0.0.3",
"summary": "Hospital Management",
"category": "Industries",
"description": """
BrowseInfo developed a new odoo/OpenERP m... | {'name': 'Hospital Management in Odoo/OpenERP', 'version': '12.0.0.3', 'summary': 'Hospital Management', 'category': 'Industries', 'description': "\nBrowseInfo developed a new odoo/OpenERP module apps.\nThis module is used to manage Hospital Mangement.\n Also use for manage the healthcare management, Clinic manageme... |
#!/usr/bin/python
'''
From careercup.com
Write a pattern matching function using wild char
? Matches any char exactly one instance
* Matches one or more instances of previous char
Ex text = "abcd" pattern = "ab?d" True
Ex text = "abccdddef" pattern = "ab?*f" True
Ex text = "abccd" pattern = "ab?*ccd" false
(a... | """
From careercup.com
Write a pattern matching function using wild char
? Matches any char exactly one instance
* Matches one or more instances of previous char
Ex text = "abcd" pattern = "ab?d" True
Ex text = "abccdddef" pattern = "ab?*f" True
Ex text = "abccd" pattern = "ab?*ccd" false
(added missing cases,... |
# -*- coding: utf-8 -*-
"""
lytics
~~~~~~
Main file for lytics app.
Usage: python lyrics.py
:copyright: (c) 2016 by Patrick Spencer.
:license: Apache 2.0, see LICENSE for more details.
"""
| """
lytics
~~~~~~
Main file for lytics app.
Usage: python lyrics.py
:copyright: (c) 2016 by Patrick Spencer.
:license: Apache 2.0, see LICENSE for more details.
""" |
frase = str(input('Digite uma frase:\n->')).strip()
separado = frase.split()
junto = ''.join(separado)
correto = list(junto.upper())
invertido = list(reversed(junto.upper()))
print(correto)
print(invertido)
if correto == invertido:
print('verdadeiro')
else:
print('falso')
| frase = str(input('Digite uma frase:\n->')).strip()
separado = frase.split()
junto = ''.join(separado)
correto = list(junto.upper())
invertido = list(reversed(junto.upper()))
print(correto)
print(invertido)
if correto == invertido:
print('verdadeiro')
else:
print('falso') |
# Copied from https://rosettacode.org/wiki/Trabb_Pardo%E2%80%93Knuth_algorithm#Python
def f(x):
return abs(x) ** 0.5 + 5 * x**3
def ask():
return [float(y)
for y in input('\n11 numbers: ').strip().split()[:11]]
if __name__ == '__main__':
s = ask()
s.reverse()
for x in s:
resu... | def f(x):
return abs(x) ** 0.5 + 5 * x ** 3
def ask():
return [float(y) for y in input('\n11 numbers: ').strip().split()[:11]]
if __name__ == '__main__':
s = ask()
s.reverse()
for x in s:
result = f(x)
if result > 400:
print(' %s:%s' % (x, 'TOO LARGE!'), end='')
... |
def toBaseTen(n, base):
'''
This function takes arguments: number that you want to convert and its base
It will return an int in base 10
Examples:
..................
>>> toBaseTen(2112, 3)
68
..................
>>> toBaseTen('AB12', 12)
61904
..................
>>> toBaseTen('AB12', 16)
111828
.............. | def to_base_ten(n, base):
"""
This function takes arguments: number that you want to convert and its base
It will return an int in base 10
Examples:
..................
>>> toBaseTen(2112, 3)
68
..................
>>> toBaseTen('AB12', 12)
61904
..................
>>> toBaseTen('AB12', 16)
111828
......... |
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
buying_price = prices[0]
max_profit = 0
for i in range(1, len(prices)):
profit = prices[i] - buying_price
if max_profit < profit:
... | class Solution(object):
def max_profit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
buying_price = prices[0]
max_profit = 0
for i in range(1, len(prices)):
profit = prices[i] - buying_price
if max_profit < profit:
... |
vc = float(input('Qual o valor da casa: R$'))
s = float(input('Qual o seu salario'))
a = int(input('Em quantos anos voce quer pagar :'))
m = a * 12
p = vc/m
if s*(30/100) >= p :
print ('O emprestimo sera feito em {} anos com prestacoes mensais de R${:.2f} e foi aprovado '.format(a,p))
else:
print(' Emprestimo ... | vc = float(input('Qual o valor da casa: R$'))
s = float(input('Qual o seu salario'))
a = int(input('Em quantos anos voce quer pagar :'))
m = a * 12
p = vc / m
if s * (30 / 100) >= p:
print('O emprestimo sera feito em {} anos com prestacoes mensais de R${:.2f} e foi aprovado '.format(a, p))
else:
print(' Emprest... |
grid = [
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0],
]
goal = [len(grid) - 1, len(grid[0]) - 1]
cost = 1 # the cost associated with moving from a cell to an adjacent one
delta = [
[-1, 0], # go up
[0, -1], # go left
[1, 0], # g... | grid = [[0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0]]
goal = [len(grid) - 1, len(grid[0]) - 1]
cost = 1
delta = [[-1, 0], [0, -1], [1, 0], [0, 1]]
delta_name = ['^', '<', 'v', '>']
def compute_value(grid, goal, cost):
value = [[99 for row in range(len(grid[0]))... |
## Read input as specified in the question.
## Print output as specified in the question.
# Pattern 1-212-32123...
# Reading number of rows
row = int(input())
# Generating pattern
for i in range(1,row+1):
# for space
for j in range(1, row+1-i):
print(' ', end='')
# for decreasing pattern... | row = int(input())
for i in range(1, row + 1):
for j in range(1, row + 1 - i):
print(' ', end='')
for j in range(i, 0, -1):
print(j, end='')
for j in range(2, i + 1):
print(j, end='')
print() |
# This file implements some custom exceptions that can
# be used by all bots.
# We avoid adding these exceptions to lib.py, because the
# current architecture works by lib.py importing bots, not
# the other way around.
class ConfigValidationError(Exception):
"""
Raise if the config data passed to a bot's vali... | class Configvalidationerror(Exception):
"""
Raise if the config data passed to a bot's validate_config()
is invalid (e.g. wrong API key, invalid email, etc.).
""" |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def run():
print("run")
main()
return None
def aaa():
print("aaa")
return None
def main():#
print ("Hello, test is running")
if __name__ == '__main__':
main()
| def run():
print('run')
main()
return None
def aaa():
print('aaa')
return None
def main():
print('Hello, test is running')
if __name__ == '__main__':
main() |
class GradientBoostingMachine():
def __init__(self, nEstimators = 100):
self.nEstimators = nEstimators
if __name__ == '__main__':
gbm = GradientBoostingMachine(nEstimators=10)
| class Gradientboostingmachine:
def __init__(self, nEstimators=100):
self.nEstimators = nEstimators
if __name__ == '__main__':
gbm = gradient_boosting_machine(nEstimators=10) |
def exp_sum(n):
p = n
# calculation taken from here
# https://math.stackexchange.com/questions/2675382/calculating-integer-partitions
def pentagonal_number(k):
return int(k * (3 * k - 1) / 2)
def compute_partitions(goal):
partitions = [1]
for n in range(1, goal + 1):
... | def exp_sum(n):
p = n
def pentagonal_number(k):
return int(k * (3 * k - 1) / 2)
def compute_partitions(goal):
partitions = [1]
for n in range(1, goal + 1):
partitions.append(0)
for k in range(1, n + 1):
coeff = (-1) ** (k + 1)
... |
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | """Actions that cover historical needs as things migrate."""
load('@build_bazel_apple_support//lib:apple_support.bzl', 'apple_support')
load('@build_bazel_rules_apple//apple/internal:platform_support.bzl', 'platform_support')
def _add_dicts(*dictionaries):
"""Adds a list of dictionaries into a single dictionary.""... |
def encode_for_get_list(src_data, thats_all_flag, default_keys, items_fetcher, item_handler):
if not isinstance(src_data, dict):
src_data = {"*": None}
result = {}
unknown_flag = False
for name, value in src_data.items():
if name == "*":
for name2 in items_fetcher():
... | def encode_for_get_list(src_data, thats_all_flag, default_keys, items_fetcher, item_handler):
if not isinstance(src_data, dict):
src_data = {'*': None}
result = {}
unknown_flag = False
for (name, value) in src_data.items():
if name == '*':
for name2 in items_fetcher():
... |
#!/usr/bin/python
def generateSet(name, value, type, indentationLevel):
finalLine = " "*indentationLevel
finalLine += name
finalLine += " = "
if type == 'string':
# Whatever you use for defining strings (either single, double, etc.)
finalLine += '"' + value + '"'
else:
f... | def generate_set(name, value, type, indentationLevel):
final_line = ' ' * indentationLevel
final_line += name
final_line += ' = '
if type == 'string':
final_line += '"' + value + '"'
else:
final_line += value
final_line += '\n'
return finalLine
def generate_if(comparison,... |
'''variabile'''
"""a=8
a+=7
a=24
b=3
b-=2
c=2
d=2
nume = "it factory"
a,b,c =1,2,3
print(a+b)
print(a/b)
print(a//b)
print(a%b)
print(a)
print(b)
print(c**d)
"""
check = False
if 8>7:
check = True
print(check)
print(type(check))
nume="ioan vasile anton"
print(nume[0])
print(nume[5:11])
print(nume[0:10:2])
print(l... | """variabile"""
'a=8\na+=7\na=24\nb=3\nb-=2\nc=2\nd=2\nnume = "it factory"\na,b,c =1,2,3\nprint(a+b)\nprint(a/b)\nprint(a//b)\nprint(a%b)\nprint(a)\nprint(b)\nprint(c**d)\n'
check = False
if 8 > 7:
check = True
print(check)
print(type(check))
nume = 'ioan vasile anton'
print(nume[0])
print(nume[5:11])
print(nume[0:... |
#
# PySNMP MIB module SIP-COMMON-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIP-COMMON-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:04:21 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_intersection, constraints_union, single_value_constraint) ... |
if 3 > 4 or 5 < 10: # true
pass
if 3 > 4 or 5 > 10: # false
pass
| if 3 > 4 or 5 < 10:
pass
if 3 > 4 or 5 > 10:
pass |
"""
j is the index to insert when a "new" number are found.
For each iteration, nums[:j] is the output result we currently have.
So nums[i] should check with nums[j-1] and nums[j-2].
"""
class Solution(object):
def removeDuplicates(self, nums):
j = 2
for i in xrange(2, len(nums)):
... | """
j is the index to insert when a "new" number are found.
For each iteration, nums[:j] is the output result we currently have.
So nums[i] should check with nums[j-1] and nums[j-2].
"""
class Solution(object):
def remove_duplicates(self, nums):
j = 2
for i in xrange(2, len(nums)):
if ... |
class Solution:
# Runtime: 36 ms
# Memory Usage: 16.3 MB
def maxDepth(self, root: TreeNode) -> int:
if root is None:
return 0
return self.search(root, 0)
def search(self, node, depth):
depth += 1
depth_left = depth
depth_right = depth
... | class Solution:
def max_depth(self, root: TreeNode) -> int:
if root is None:
return 0
return self.search(root, 0)
def search(self, node, depth):
depth += 1
depth_left = depth
depth_right = depth
if node.left is not None:
depth_left = self... |
# Write a program that uses a for loop to print the numbers 8, 11, 14, 17, 20, ..., 83, 86, 89.
for i in range(8, 90, 3):
print(i)
| for i in range(8, 90, 3):
print(i) |
puzzle_input = "359282-820401"
pwd_interval = [int(a) for a in puzzle_input.split('-')]
pwd_range = range(pwd_interval[0] , pwd_interval[1]+1)
# Part 1
def is_valid_pwd(code):
str_code = str(code)
double = False
increase = True
for i in range(5):
if str_code[i] == str_code[i+1]:
do... | puzzle_input = '359282-820401'
pwd_interval = [int(a) for a in puzzle_input.split('-')]
pwd_range = range(pwd_interval[0], pwd_interval[1] + 1)
def is_valid_pwd(code):
str_code = str(code)
double = False
increase = True
for i in range(5):
if str_code[i] == str_code[i + 1]:
double = ... |
# Write a program which accepts a sequence of comma-separated numbers from console
# and generate a list and a tuple which contains every number.Given the input:
# 34,67,55,33,12,98
# Then, the output should be:
# ['34', '67', '55', '33', '12', '98']
# ('34', '67', '55', '33', '12', '98')
str = input("Enter list: ")
... | str = input('Enter list: ')
res = str.split(',')
print(res)
str = tuple(map(int, str.split(',')))
print(str) |
file = open('noTimeForATaxiCab_input.txt', 'r')
lines_read = file.readlines()
instructions = lines_read[0]
steps = instructions.split(", ")
x_blocks = 0
y_blocks = 0
# together, is_on_y_axis and is_facing_forward give you the cardinal direction you are facing
# North: is_on_y_axis = True, is_facing_forward = True
# ... | file = open('noTimeForATaxiCab_input.txt', 'r')
lines_read = file.readlines()
instructions = lines_read[0]
steps = instructions.split(', ')
x_blocks = 0
y_blocks = 0
is_on_y_axis = True
is_facing_forward = True
for step in steps:
direction = step[0]
blocks = int(step[1:])
is_right_turn = direction == 'R'
... |
def factorial(num):
fact = 0
if num == 0:
return 1
else:
fact = num * factorial(num-1)
return fact
num = 5
print("Factorial of",num,"is:",factorial(num))
| def factorial(num):
fact = 0
if num == 0:
return 1
else:
fact = num * factorial(num - 1)
return fact
num = 5
print('Factorial of', num, 'is:', factorial(num)) |
# Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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 o... | version = '1.6.2a1'
required_versions = {'pyyaml': '>=5.1', 'tsv': '==1.2', 'scikit-learn': '==0.22.1', 'pyvcf': '==0.6.8', 'futures': '==3.1.1'}
dependency_links = [] |
class Role(object):
id = None
name = None
color = None
managed = None
hoist = None
position = None
permissions = None
def __init__(self, stores, id):
self._stores = stores
self.id = int(id)
def update(self, role_data):
self.name = role_data.get('name', self.... | class Role(object):
id = None
name = None
color = None
managed = None
hoist = None
position = None
permissions = None
def __init__(self, stores, id):
self._stores = stores
self.id = int(id)
def update(self, role_data):
self.name = role_data.get('name', self.... |
class Command:
def __init__(self, callback, *args, **kwargs):
self.callback = callback
self.args = args
self.kwargs = kwargs
def __call__(self):
return apply(self.callback, self.args, self.kwargs)
| class Command:
def __init__(self, callback, *args, **kwargs):
self.callback = callback
self.args = args
self.kwargs = kwargs
def __call__(self):
return apply(self.callback, self.args, self.kwargs) |
class Solution(object):
def XXX(self, n):
"""
:type n: int
:rtype: str
"""
dp = {1:'1'}
for i in range(2, n+1):
if not i in dp:
dp[i] = self.say(dp[i-1])
return dp[n]
def say(self, numstr):
res = ''
tmp ... | class Solution(object):
def xxx(self, n):
"""
:type n: int
:rtype: str
"""
dp = {1: '1'}
for i in range(2, n + 1):
if not i in dp:
dp[i] = self.say(dp[i - 1])
return dp[n]
def say(self, numstr):
res = ''
tmp = ... |
def main():
s = input()
le = len(s)
l = list(zip(s, range(le)))
l = sorted(l, key = lambda x: (x[0], -x[1]), reverse=True)
s = l[0][0]
current_index = l[0][1]
for i in l[1:]:
if i[1]>current_index:
s += i[0]
current_index = i[1]
print(s)
if __name__=='__... | def main():
s = input()
le = len(s)
l = list(zip(s, range(le)))
l = sorted(l, key=lambda x: (x[0], -x[1]), reverse=True)
s = l[0][0]
current_index = l[0][1]
for i in l[1:]:
if i[1] > current_index:
s += i[0]
current_index = i[1]
print(s)
if __name__ == '__... |
"""
algoritmos primitivos para a elaboracao de um score
para avaliar um dado tabuleiro
"""
sudoku = [[5, 3, 0, 0, 7, 0, 0, 0, 0],
[6, 0, 0, 1, 9, 5, 0, 0, 0],
[0 ,9 ,8, 0, 0, 0, 0, 6, 0],
[8, 0, 0, 0, 6, 0, 0, 0, 3],
[4, 0, 0, 8, 0, 3, 0, 0, 1],
[7, 0, 0, 0,... | """
algoritmos primitivos para a elaboracao de um score
para avaliar um dado tabuleiro
"""
sudoku = [[5, 3, 0, 0, 7, 0, 0, 0, 0], [6, 0, 0, 1, 9, 5, 0, 0, 0], [0, 9, 8, 0, 0, 0, 0, 6, 0], [8, 0, 0, 0, 6, 0, 0, 0, 3], [4, 0, 0, 8, 0, 3, 0, 0, 1], [7, 0, 0, 0, 2, 0, 0, 0, 6], [0, 6, 0, 0, 0, 0, 2, 8, 0], [0, 0, 0, 4, 1, ... |
#
# Exam Link: https://www.interviewbit.com/problems/implement-power-function/
#
# Question:
#
# Implement pow(x, n) % d.
#
# In other words, given x, n and d,
#
# find (xn % d)
#
# Note that remainders on division cannot be negative.
# In other words, make sure the answer you return is non negative.
... | class Solution:
def pow(self, x, n, d):
res = 1
base = x % d
while n > 0:
if n % 2 == 1:
res = res * base % d
n = n >> 1
base = base * base % d
return res % d |
# Define
list = [1, 2, 3]
# Insertion
val = 4
list.append(val)
# Deletion
index = 0
del list[index]
# Access
print(list[index])
| list = [1, 2, 3]
val = 4
list.append(val)
index = 0
del list[index]
print(list[index]) |
print("Enter the no of rows and starting number respectively: ")
n, i = map(int, input().split())
b = n
for j in range(0, n):
for k in range(b, 0, -1):
print(i, end=" ")
i = i - 1
b = b - 1
print() | print('Enter the no of rows and starting number respectively: ')
(n, i) = map(int, input().split())
b = n
for j in range(0, n):
for k in range(b, 0, -1):
print(i, end=' ')
i = i - 1
b = b - 1
print() |
#a very useless function
def hi():
return "Hello World!"
| def hi():
return 'Hello World!' |
x = 1.10
y = 1.0
z = -35.59
print(type(x))
print(type(y))
print(type(z))
| x = 1.1
y = 1.0
z = -35.59
print(type(x))
print(type(y))
print(type(z)) |
BN_MOMENTUM = 0.95
BN_RENORM = False
L2_REG = 1.25e-5
DROPOUT = 0.25
ACTIVATION = "relu"
KERNEL_INIT = "he_uniform" | bn_momentum = 0.95
bn_renorm = False
l2_reg = 1.25e-05
dropout = 0.25
activation = 'relu'
kernel_init = 'he_uniform' |
class InputItem:
def __init__(self, id_list, index_list, data=None, label=None, receipt_time=0):
self.query_id_list = id_list
self.sample_index_list = index_list
self.data = data
self.label = label
self.receipt_time = receipt_time
| class Inputitem:
def __init__(self, id_list, index_list, data=None, label=None, receipt_time=0):
self.query_id_list = id_list
self.sample_index_list = index_list
self.data = data
self.label = label
self.receipt_time = receipt_time |
class Something:
pass
# No book version will cause an error.
| class Something:
pass |
#
# PySNMP MIB module A3Com-Filter-r5-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-FILTER-R5-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:03:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, single_value_constraint, constraints_intersection) ... |
# Copyright 2016 PerfKitBenchmarker 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 appli... | flavors = [{'name': 'Micro', 'ram': 1024, 'cores': 1}, {'name': 'Small', 'ram': 2048, 'cores': 1}, {'name': 'Medium', 'ram': 4096, 'cores': 2}, {'name': 'Large', 'ram': 7168, 'cores': 4}, {'name': 'ExtraLarge', 'ram': 14336, 'cores': 8}, {'name': 'MemoryIntensiveSmall', 'ram': 16384, 'cores': 2}, {'name': 'MemoryIntens... |
class Solution(object):
def productExceptSelf(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
res = []
p = 1
for i in range(len(nums)):
res.append(p)
p *= nums[i]
p = 1
for i in range(len(nums) - 1, -1, -1)... | class Solution(object):
def product_except_self(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
res = []
p = 1
for i in range(len(nums)):
res.append(p)
p *= nums[i]
p = 1
for i in range(len(nums) - 1, -1, -... |
__all__ = [
'ALPHABET',
'DIGITS',
'LOWERCASE',
'UPPERCASE',
]
DIGITS = '0123456789'
ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
LOWERCASE = 'abcdefghijklmnopqrstuvwxyz'
UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
| __all__ = ['ALPHABET', 'DIGITS', 'LOWERCASE', 'UPPERCASE']
digits = '0123456789'
alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
lowercase = 'abcdefghijklmnopqrstuvwxyz'
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
BOT_NAME = 'councilman_scraper'
SPIDER_MODULES = ['councilman.spiders.spider']
NEWSPIDER_MODULE = 'councilman.spiders'
LOG_ENABLED = True
ITEM_PIPELINES = {
'councilman.pipelines.CouncilmanPipeline': 300,
}
| bot_name = 'councilman_scraper'
spider_modules = ['councilman.spiders.spider']
newspider_module = 'councilman.spiders'
log_enabled = True
item_pipelines = {'councilman.pipelines.CouncilmanPipeline': 300} |
def string_contains(string: str, substr: str) -> bool:
"""Determines whether substring is part of string or not
>>> string_contains("hello", "he")
True
>>> string_contains("hello", "wo")
False
"""
return substr in string
def string_begins_with(string: str, substr: str) -> bool:
"""Dete... | def string_contains(string: str, substr: str) -> bool:
"""Determines whether substring is part of string or not
>>> string_contains("hello", "he")
True
>>> string_contains("hello", "wo")
False
"""
return substr in string
def string_begins_with(string: str, substr: str) -> bool:
"""Deter... |
def finder(data): ## define the finder argument (data)
return finder_rec(data, len(data)-1) ## return the answer
def finder_rec(data, x): ## define the finder_recursive argument as data and x
if x == 0: ## compares if x is equal to 0, then true
return data[x] ## return the answer
v1 = data[x]... | def finder(data):
return finder_rec(data, len(data) - 1)
def finder_rec(data, x):
if x == 0:
return data[x]
v1 = data[x]
v2 = finder_rec(data, x - 1)
if v1 > v2:
return v1
else:
return v2
print(finder([0, -247, 341, 1001, 741, 22])) |
#coding: utf-8
def merge_sort(array):
if len(array) < 2:
return;
mid = len(array) / 2;
left = array[:mid];
right = array[mid:];
leftI = 0;
rightI = 0;
arrayI = 0;
while leftI < len(left) and rightI < len(right):
if left[leftI] < right[rightI]:
array[arrayI] = left[leftI];
... | def merge_sort(array):
if len(array) < 2:
return
mid = len(array) / 2
left = array[:mid]
right = array[mid:]
left_i = 0
right_i = 0
array_i = 0
while leftI < len(left) and rightI < len(right):
if left[leftI] < right[rightI]:
array[arrayI] = left[leftI]
... |
class ClientConfig(object):
PUBLIC_KEY = 'coGBxfv6BmRyw3TuucG2Awds5gRlk5fwxiDwAIIQ5v4'
APP_NAME = 'frumentarii'
COMPANY_NAME = 'JackEaston'
HTTP_TIMEOUT = 30
MAX_DOWNLOAD_RETRIES = 3
UPDATE_URLS = ['https://github.com/perseusnova/Frumentarii-Python']
| class Clientconfig(object):
public_key = 'coGBxfv6BmRyw3TuucG2Awds5gRlk5fwxiDwAIIQ5v4'
app_name = 'frumentarii'
company_name = 'JackEaston'
http_timeout = 30
max_download_retries = 3
update_urls = ['https://github.com/perseusnova/Frumentarii-Python'] |
# Tai Sakuma <tai.sakuma@gmail.com>
##__________________________________________________________________||
class ProgressReport(object):
"""A progress report
Args:
name (str): the name of the task. if ``taskid`` is ``None``, used to identify the task
done (int): the number of the iterations do... | class Progressreport(object):
"""A progress report
Args:
name (str): the name of the task. if ``taskid`` is ``None``, used to identify the task
done (int): the number of the iterations done so far
total (int): the total iterations to be done
taskid (immutable, optional): if give... |
_base_ = [
'../_base_/datasets/waymo_cars_and_peds.py',
'../_base_/models/pointnet2_seg.py',
'../_base_/schedules/cyclic_20e.py', '../_base_/default_runtime.py'
]
# data settings
data = dict(samples_per_gpu=16)
evaluation = dict(interval=50)
# runtime settings
checkpoint_config = dict(interval=50)
# Point... | _base_ = ['../_base_/datasets/waymo_cars_and_peds.py', '../_base_/models/pointnet2_seg.py', '../_base_/schedules/cyclic_20e.py', '../_base_/default_runtime.py']
data = dict(samples_per_gpu=16)
evaluation = dict(interval=50)
checkpoint_config = dict(interval=50)
runner = dict(type='EpochBasedRunner', max_epochs=500)
sha... |
# -*- coding: utf-8 -*-
'''
Created on 20.12.2012
@author: 802300
'''
c_cycle_dark = (32,88,103)
c_cycle = (49,133,155)
c_cycle_light = (139,202,218)
c_cycle_alt = (146,208,80)
c_due = (192,0,0)
c_due_later = (255,86,30)
c_sub = (255,238,87)
c_sub_alt = (255,192,0)
c_sub2 = (66,191,89)
c_vorlauf = c_sub_alt
c_submiss... | """
Created on 20.12.2012
@author: 802300
"""
c_cycle_dark = (32, 88, 103)
c_cycle = (49, 133, 155)
c_cycle_light = (139, 202, 218)
c_cycle_alt = (146, 208, 80)
c_due = (192, 0, 0)
c_due_later = (255, 86, 30)
c_sub = (255, 238, 87)
c_sub_alt = (255, 192, 0)
c_sub2 = (66, 191, 89)
c_vorlauf = c_sub_alt
c_submission = c... |
with open("program") as file:
initialProgram = file.readlines()[0]
initialProgram = initialProgram.split(",")
def executeProgram(program):
pointer = 0
result = 0
while 1:
arg1 = program[pointer+1]
arg2 = program[pointer+2]
if program[pointer] == 1:
result = program[... | with open('program') as file:
initial_program = file.readlines()[0]
initial_program = initialProgram.split(',')
def execute_program(program):
pointer = 0
result = 0
while 1:
arg1 = program[pointer + 1]
arg2 = program[pointer + 2]
if program[pointer] == 1:
result = pr... |
#######################################
#########Variaveis de mails############
#######################################
ADMIN_MAIL = "admin@mtgchance.com"
SITE_NAME = "MTG CHANCE"
SITE_LOCATION = "www.mtgchance.com"
#######################################
##########PAISES ADMITIDOS#############
##############... | admin_mail = 'admin@mtgchance.com'
site_name = 'MTG CHANCE'
site_location = 'www.mtgchance.com'
allowed_countries = ['Portugal', 'Brasil']
value_of_common_card = 2
value_of_uncommon_card = 8
value_of_rare_card = 30
number_cards_to_take_out_by_importance = 3
number_of_common_uncommon_to_take = 6
number_of_rare_to_take =... |
"""
This scripts shows how to train a POS tagger using trapper. However,
intentionally, the dependency injection mechanism is not used, instead the
objects are instantiated directly from concrete classes suitable for the job.
Although we recommended config file based training using the trapper CLI instead,
you can use ... | """
This scripts shows how to train a POS tagger using trapper. However,
intentionally, the dependency injection mechanism is not used, instead the
objects are instantiated directly from concrete classes suitable for the job.
Although we recommended config file based training using the trapper CLI instead,
you can use ... |
"""
Contains configuration data for interacting with the source_data folder.
These are hardcoded here as this is meant to be a dumping
ground. Source_data is not actually user configurable.
For customized data loading, use mhwdata.io directly.
"""
supported_ranks = ('LR', 'HR')
"A mapping of all translations"
all_l... | """
Contains configuration data for interacting with the source_data folder.
These are hardcoded here as this is meant to be a dumping
ground. Source_data is not actually user configurable.
For customized data loading, use mhwdata.io directly.
"""
supported_ranks = ('LR', 'HR')
'A mapping of all translations'
all_lan... |
def distance(strand1, strand2):
count = 0
for x, y in zip(strand1, strand2):
if x != y:
count += 1
return count
| def distance(strand1, strand2):
count = 0
for (x, y) in zip(strand1, strand2):
if x != y:
count += 1
return count |
"""
NOTE: This is a future consensus test not yet ready to merge
Let the work below be a point of reference for testing
import os
import pathlib
from mapmerge.constants import FREE, OCCUPIED, UNKNOWN
from mapmerge.merge_utils import augment_map, combine_aligned_maps, detect_fault, load_mercer_map, acceptance_ind... | """
NOTE: This is a future consensus test not yet ready to merge
Let the work below be a point of reference for testing
import os
import pathlib
from mapmerge.constants import FREE, OCCUPIED, UNKNOWN
from mapmerge.merge_utils import augment_map, combine_aligned_maps, detect_fault, load_mercer_map, acceptance_ind... |
class Mapper():
prg_banks = 0
chr_banks = 0
def __init__(self, prg_banks, chr_banks): pass
def cpuMapRead(self, addr): pass
def cpuMapWrite(self, addr): pass
def ppuMapRead(self, addr): pass
def ppuMapWrite(self, addr): pass
def reset(self): pass
| class Mapper:
prg_banks = 0
chr_banks = 0
def __init__(self, prg_banks, chr_banks):
pass
def cpu_map_read(self, addr):
pass
def cpu_map_write(self, addr):
pass
def ppu_map_read(self, addr):
pass
def ppu_map_write(self, addr):
pass
def reset(s... |
HOST = "127.0.0.1"
PORT = 1337
COMMAND_START = "docker start minecraft-server"
COMMAND_STOP = "docker stop minecraft-server"
MCSTATUS_COMMAND = "docker exec minecraft-server mcstatus localhost status"
# Time to wait for the port to become available
STARTUP_DELAY = 1
# Time to wait for the player to join
STARTUP_TIME... | host = '127.0.0.1'
port = 1337
command_start = 'docker start minecraft-server'
command_stop = 'docker stop minecraft-server'
mcstatus_command = 'docker exec minecraft-server mcstatus localhost status'
startup_delay = 1
startup_timer = 90
shutdown_timer = 300
edit_motd = False |
# FIRST CLASS FUNCTIONS:
# a programming language is said to have first class functions if it treats functions as first class citizens.
# FIRST CLASS CITIZEN (PROGRAMMING):
# a first class citizen (sometimes called first class object) in a programming language is an entity
# which supports all the operations generall... | def square(x):
return x ** 2
f = square(5)
print(square)
print(f)
f = square
print(square)
print(f)
print(f(5))
def my_map(func, arg_list):
r_list = []
for i in arg_list:
r_list.append(func(i))
return r_list
def cube(x):
return x ** 3
cubes = my_map(cube, [1, 2, 3, 4, 5, 6, 7])
print(cubes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.