content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# SQlite queries for the Gold database.
# The values are inserted at the ? by cursor.execute(query, (val1, val2, val3))
# Get allocation usage data for all institutes for all time.
# Order by allocation start, end and then project name
# (as first allocation all starts on same date).
def gold_by_all_allocation_period... | def gold_by_all_allocation_periods():
query = 'SELECT j.g_project, sum(j.g_charge), r.g_id as date_alloc, r.g_account,\n a.g_start_time, a.g_end_time, count(*) as num_jobs\n FROM g_job AS j\n INNER JOIN g_reservation_allocation AS r\n ON j.g_reque... |
class DataModel:
"""holds the data for STL models"""
def __init__(self):
"""add doc"""
self.header = None
self.triangles = []
self.nr_of_faces = 0
class Triangle:
"""each Triangle object holds coordinates for normals and vertexes"""
def __init__(self):
"""add d... | class Datamodel:
"""holds the data for STL models"""
def __init__(self):
"""add doc"""
self.header = None
self.triangles = []
self.nr_of_faces = 0
class Triangle:
"""each Triangle object holds coordinates for normals and vertexes"""
def __init__(self):
"""add d... |
a=[]
total_data=0
print("Enter the bucket size: ")
bs=input()
print("Enter no of packets: ")
np=input()
i=0
for i in range(int(np)):
if (i<int(bs)):
a.append(int(input()))
total_data=total_data+a[i];
else:
print("Bucket is full. Further packets will overflow")
print("Enter bits of da... | a = []
total_data = 0
print('Enter the bucket size: ')
bs = input()
print('Enter no of packets: ')
np = input()
i = 0
for i in range(int(np)):
if i < int(bs):
a.append(int(input()))
total_data = total_data + a[i]
else:
print('Bucket is full. Further packets will overflow')
print('Enter b... |
_robot_target_comm = None
def set_global_robot_target_comm(robot_target_comm):
global _robot_target_comm
_robot_target_comm = robot_target_comm
def get_global_robot_target_comm():
return _robot_target_comm
| _robot_target_comm = None
def set_global_robot_target_comm(robot_target_comm):
global _robot_target_comm
_robot_target_comm = robot_target_comm
def get_global_robot_target_comm():
return _robot_target_comm |
q = input()
for f in ['<[', ']>', '=>> ((???))', '!']:
q = q.replace(f, '').strip()
print('question:', q)
num = []
oper = []
for idx, this in enumerate(q.split(' ')):
if idx%2!=0: # operater
oper.append(this)
else: # num
num.append(int(this))
print(num, oper)
ans = num[0]
for i in range(4):... | q = input()
for f in ['<[', ']>', '=>> ((???))', '!']:
q = q.replace(f, '').strip()
print('question:', q)
num = []
oper = []
for (idx, this) in enumerate(q.split(' ')):
if idx % 2 != 0:
oper.append(this)
else:
num.append(int(this))
print(num, oper)
ans = num[0]
for i in range(4):
if oper... |
def partition(a,first,last):
pivot = a[last]
wall = first-1
for i in range(first,last):
if a[i] < pivot:
wall += 1
if i != wall:
a[i], a[wall] = a[wall], a[i]
a[wall+1], a[last] = a[last], a[wall+1]
print(" ".join(map(str, a)))
return wal... | def partition(a, first, last):
pivot = a[last]
wall = first - 1
for i in range(first, last):
if a[i] < pivot:
wall += 1
if i != wall:
(a[i], a[wall]) = (a[wall], a[i])
(a[wall + 1], a[last]) = (a[last], a[wall + 1])
print(' '.join(map(str, a)))
ret... |
# Space: O(n)
# Time: O(n)
# Solution without collections library
class LRUCache:
def __init__(self, capacity: int):
self.capacity = capacity
self.storage = {}
self.key_stack = []
self.status = 0
def get(self, key: int) -> int:
if key in self.storage:
sel... | class Lrucache:
def __init__(self, capacity: int):
self.capacity = capacity
self.storage = {}
self.key_stack = []
self.status = 0
def get(self, key: int) -> int:
if key in self.storage:
self._refersh(key)
return self.storage[key]
return -... |
#
# PySNMP MIB module INTERFACETOPN-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/INTERFACETOPN-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:17:25 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:5... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ... |
def ksintegrate(u, Lx, dt, Nt) :
"""ksintegrate: integrate kuramoto-sivashinsky equation (Python)
u_t = -u*u_x - u_xx - u_xxxx, domain x in [0,Lx], periodic BCs
inputs
u = initial condition (vector of u(x) values on uniform gridpoints))
Lx = domain length
dt = time step
... | def ksintegrate(u, Lx, dt, Nt):
"""ksintegrate: integrate kuramoto-sivashinsky equation (Python)
u_t = -u*u_x - u_xx - u_xxxx, domain x in [0,Lx], periodic BCs
inputs
u = initial condition (vector of u(x) values on uniform gridpoints))
Lx = domain length
dt = time step
... |
'''
You are given coordinates, a string that represents the coordinates of a square of the chessboard
Below is a chessboard for your reference.
Return true if the square is white, and false if the square is black.
The coordinate will always represent a valid chessboard square.
The coordinate will always have the l... | """
You are given coordinates, a string that represents the coordinates of a square of the chessboard
Below is a chessboard for your reference.
Return true if the square is white, and false if the square is black.
The coordinate will always represent a valid chessboard square.
The coordinate will always have the letter... |
class NotConfigured(Exception):
"""Indicates a missing configuration situation"""
pass
class UsageError(Exception):
"""To indicate a command-line usage error"""
def __init__(self, *a, **kw):
self.print_help = kw.pop('print_help', True)
super(UsageError, self).__init__(*a, **kw) | class Notconfigured(Exception):
"""Indicates a missing configuration situation"""
pass
class Usageerror(Exception):
"""To indicate a command-line usage error"""
def __init__(self, *a, **kw):
self.print_help = kw.pop('print_help', True)
super(UsageError, self).__init__(*a, **kw) |
# Ejercicio 5
def textInMark(texto):
# Dado un string la funcion retorna otro string
# con las palabras colocadas en un marco
length = len(texto)
line1 = ("*")*(length + 2) + "\n"
line2 = "*" + " "*length + "*\n"
line3 = "*" + texto + "*\n"
print(line1 + line2 + line3 + line2 + line1)
tex... | def text_in_mark(texto):
length = len(texto)
line1 = '*' * (length + 2) + '\n'
line2 = '*' + ' ' * length + '*\n'
line3 = '*' + texto + '*\n'
print(line1 + line2 + line3 + line2 + line1)
texto = 'Hello World!'
val = text_in_mark(texto)
print(val) |
class Server:
def __init__(self):
self._status = None
self._response_headers = []
def start_response(self, status, response_headers, exc_info=None):
self._status = status;
self._response_headers = response_headers
@property
def status(self):
return self._status
... | class Server:
def __init__(self):
self._status = None
self._response_headers = []
def start_response(self, status, response_headers, exc_info=None):
self._status = status
self._response_headers = response_headers
@property
def status(self):
return self._status
... |
__author__ = 'Raquel G. Alhama'
#Path to store temporary results
TMP = "../../../tmp/"
#Probabilities won't sum up to 1 due to floating point arithmetic; this is the allowed deviation \
# when checking for probabilities.
TOLERANCE_PROB = 0.001
#Languages
LANGS = ("hb", "es", "en")
langstr = dict(zip(LANGS, ("Hebrew... | __author__ = 'Raquel G. Alhama'
tmp = '../../../tmp/'
tolerance_prob = 0.001
langs = ('hb', 'es', 'en')
langstr = dict(zip(LANGS, ('Hebrew', 'Spanish', 'English')))
color_palette = {'hb': '#7570b3', 'en': '#1b9e77', 'es': '#d95f02'}
markers = {'hb': 'D', 'en': 'o', 'es': '>'}
condition_palette = {'f2neg': 'salmon', 'f2... |
"""empty message
Revision ID: de021a1ca60d
Revises: ('0b1f1ab473c0', 'cefabc8f7d38')
Create Date: 2018-12-18 22:45:55.783083
"""
# revision identifiers, used by Alembic.
revision = 'de021a1ca60d'
down_revision = ('0b1f1ab473c0', 'cefabc8f7d38', '3e1b21cd94a4')
def upgrade():
pass
def downgrade():
pass
| """empty message
Revision ID: de021a1ca60d
Revises: ('0b1f1ab473c0', 'cefabc8f7d38')
Create Date: 2018-12-18 22:45:55.783083
"""
revision = 'de021a1ca60d'
down_revision = ('0b1f1ab473c0', 'cefabc8f7d38', '3e1b21cd94a4')
def upgrade():
pass
def downgrade():
pass |
def simpleArraySum(ar):
acc = 0
for i in ar:
acc += i
return acc | def simple_array_sum(ar):
acc = 0
for i in ar:
acc += i
return acc |
# -*- coding: utf-8 -*-
"""Top-level package for Basic Find."""
__author__ = """Richard Seldon"""
__email__ = 'arcseldon@gmail.com'
__version__ = '0.0.3'
| """Top-level package for Basic Find."""
__author__ = 'Richard Seldon'
__email__ = 'arcseldon@gmail.com'
__version__ = '0.0.3' |
### TODO: Add numbers, lowercase letters, and punctuation
toLED = {'A' :[
[0,1,1,1,0],
[1,0,0,0,1],
[1,0,0,0,1],
[1,0,0,0,1],
[1,1,1,1,1],
[1,0,0,0,1],
[1,0,0,0,1],
[1,0,0,0,1]
],
'B' : [
[1,1,1,1,0],
[1,0,0,0,1],
[1,0,0,0,1],
[1,1,1,1,0],
[1,0,0,0,1],
[1,0,0,0,1],
[1,0,0,0,1],
[1,... | to_led = {'A': [[0, 1, 1, 1, 0], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1]], 'B': [[1, 1, 1, 1, 0], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 0], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 0]], 'C': [[0, 1, 1, 1, 0], [... |
"""
Lecture 15: Linear Programming
Flow Network
------------
Below is a class that will be used as a data structure representing
a residual flow network which will be used for finding the maximum
flow allowable through a flow network. See lecture 13-14 for more
information.
This data structure is used in linprog.py f... | """
Lecture 15: Linear Programming
Flow Network
------------
Below is a class that will be used as a data structure representing
a residual flow network which will be used for finding the maximum
flow allowable through a flow network. See lecture 13-14 for more
information.
This data structure is used in linprog.py f... |
#!/usr/bin/env python
# encoding: utf-8
name = "T3"
shortDesc = ""
longDesc = """
ARC v1.1.0
ARC project T3
Levels of theory used:
Conformers: wb97xd/def2svp
TS guesses: wb97xd/def2svp
Optimization: b3lyp/6-311+g(3df,2p) (using a fine grid)
Frequencies: b3lyp/6-311+g(3df,2p)
Single point: b3... | name = 'T3'
short_desc = ''
long_desc = "\nARC v1.1.0\nARC project T3\n\nLevels of theory used:\n\nConformers: wb97xd/def2svp\nTS guesses: wb97xd/def2svp\nOptimization: b3lyp/6-311+g(3df,2p) (using a fine grid)\nFrequencies: b3lyp/6-311+g(3df,2p)\nSingle point: b3lyp/6-311+g(3df,2p)\nRotor scan... |
# Bubble sort
# Time: O(n^2); Space: O(1)
def sort_colors(nums):
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] > nums[j]:
nums[j], nums[i] = nums[i], nums[j]
# Counting sort
# Time: O(n^2) or O(n) ?; Space: O(1)
def sort_colors2(nums):
count = [0] ... | def sort_colors(nums):
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] > nums[j]:
(nums[j], nums[i]) = (nums[i], nums[j])
def sort_colors2(nums):
count = [0] * 3
for n in nums:
count[n] += 1
pos = 0
for (i, n) in enumerate(count):
... |
def split_and_check(pw_input):
counts, symbol, pw = pw_input.split(' ')
symbol = symbol[:-1]
lower_bound, upper_bound = counts.split('-')
occurrence_count = pw.count(symbol)
if int(lower_bound) <= occurrence_count <= int(upper_bound):
return 1
else:
return 0
pw_file = open('dat... | def split_and_check(pw_input):
(counts, symbol, pw) = pw_input.split(' ')
symbol = symbol[:-1]
(lower_bound, upper_bound) = counts.split('-')
occurrence_count = pw.count(symbol)
if int(lower_bound) <= occurrence_count <= int(upper_bound):
return 1
else:
return 0
pw_file = open('d... |
# -*- coding: utf-8 -*-
VERSION = (0, 5, 2)
__version__ = '.'.join(map(str, VERSION))
default_app_config = 'warthog.app_config.WarthogAppConfig'
| version = (0, 5, 2)
__version__ = '.'.join(map(str, VERSION))
default_app_config = 'warthog.app_config.WarthogAppConfig' |
#!/usr/bin/env python
"""
Utils
=====
"""
def get_n_features(matrix, min_=2):
"""Get the number of features in a matrix.
Args:
matrix : ndarray
A numeric numpy array. Features are
assumed to be the columns.
min_ : int
The smallest number of features that
... | """
Utils
=====
"""
def get_n_features(matrix, min_=2):
"""Get the number of features in a matrix.
Args:
matrix : ndarray
A numeric numpy array. Features are
assumed to be the columns.
min_ : int
The smallest number of features that
`matrix` is p... |
class Sample:
def __init__(self):
self.data = None
self.label = None
| class Sample:
def __init__(self):
self.data = None
self.label = None |
# Imported Python Transfer Function
@nrp.NeuronMonitor(nrp.brain.record, nrp.spike_recorder)
def all_neurons_monitor(t):
return True
##
| @nrp.NeuronMonitor(nrp.brain.record, nrp.spike_recorder)
def all_neurons_monitor(t):
return True |
#!/usr/bin/env python
# file: $nedc_nfc/class/python/nedc_sys_tools/nedc_text_tools.py
#
# revision history:
# 20170716 (JP): Upgraded to using the new annotation tools.
# 20170709 (JP): Initial version.
#
# usage:
# import nedc_text_tools as ntt
#
# This file contains some useful Python functions and classes that ... | max_precision = int(10)
null_class = '***'
def first_substring(strings_a, substring_a):
return next((i for (i, string) in enumerate(strings_a) if substring_a in string))
def first_string(strings_a, tstring_a):
return next((i for (i, string) in enumerate(strings_a) if tstring_a == string)) |
class Solution(object):
def gameOfLife(self, board):
"""
:type board: List[List[int]]
:rtype: void Do not return anything, modify board in-place instead.
"""
def neighbor(board, i, j):
cnt = 0
for a in xrange(i-1, i+2):
for b in xrange(... | class Solution(object):
def game_of_life(self, board):
"""
:type board: List[List[int]]
:rtype: void Do not return anything, modify board in-place instead.
"""
def neighbor(board, i, j):
cnt = 0
for a in xrange(i - 1, i + 2):
for b in... |
# coding=utf-8
"""
README GENERATOR
Readme content variables
Autor: Pablo Pizarro R. @ ppizarror.com
Licencia:
The MIT License (MIT)
Copyright 2017 Pablo Pizarro R.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Soft... | """
README GENERATOR
Readme content variables
Autor: Pablo Pizarro R. @ ppizarror.com
Licencia:
The MIT License (MIT)
Copyright 2017 Pablo Pizarro R.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to ... |
"""
Given an integer array nums sorted in ascending order, and an integer target.
Suppose that nums is rotated at some pivot unknown to you beforehand (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You should search for target in nums and if found return its index, otherwise return -1.
Example 1:
Input: nums ... | """
Given an integer array nums sorted in ascending order, and an integer target.
Suppose that nums is rotated at some pivot unknown to you beforehand (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You should search for target in nums and if found return its index, otherwise return -1.
Example 1:
Input: nums ... |
# [8 kyu] 5 Without Numbers!!
#
# Author: Hsins
# Date: 2019/11/28
def unusual_five():
return len(" ")
| def unusual_five():
return len(' ') |
# Score categories.
# Change the values as you see fit.
YACHT = "YACHT"
ONES = "ONES"
TWOS = "TWOS"
THREES = "THREES"
FOURS = "FOURS"
FIVES = "FIVES"
SIXES = "SIXES"
FULL_HOUSE = "FULL_HOUSE"
FOUR_OF_A_KIND = "FOUR_OF_A_KIND"
LITTLE_STRAIGHT = "LITTLE_STRAIGHT"
BIG_STRAIGHT = "BIG_STRAIGHT"
CHOICE = "CHOICE"
little_st... | yacht = 'YACHT'
ones = 'ONES'
twos = 'TWOS'
threes = 'THREES'
fours = 'FOURS'
fives = 'FIVES'
sixes = 'SIXES'
full_house = 'FULL_HOUSE'
four_of_a_kind = 'FOUR_OF_A_KIND'
little_straight = 'LITTLE_STRAIGHT'
big_straight = 'BIG_STRAIGHT'
choice = 'CHOICE'
little_straight = {1, 2, 3, 4, 5}
big_straight = {2, 3, 4, 5, 6}
... |
f=open('t.txt','r')
l=f.readlines()
d={}
for i in (l):
k = i.strip()
m = list(k)
if (m[0] == '>'):
s = k.lstrip('>')
d[s] = ''
j = s
else:
d[j] += k
for i in d.keys():
suf = d[i][len(d[i])-3: ]
for j in d.keys():
if(j!=i):
pre = d[j][0:3]
... | f = open('t.txt', 'r')
l = f.readlines()
d = {}
for i in l:
k = i.strip()
m = list(k)
if m[0] == '>':
s = k.lstrip('>')
d[s] = ''
j = s
else:
d[j] += k
for i in d.keys():
suf = d[i][len(d[i]) - 3:]
for j in d.keys():
if j != i:
pre = d[j][0:3]
... |
# Variable declaration
s = 'Dany Sluijk';
split = s.split(' ');
print(split[0][0]+split[1][0]);
| s = 'Dany Sluijk'
split = s.split(' ')
print(split[0][0] + split[1][0]) |
class Sirt6BaseException(Exception):
pass
class InvalidLayoutError(Sirt6BaseException):
pass
| class Sirt6Baseexception(Exception):
pass
class Invalidlayouterror(Sirt6BaseException):
pass |
#!/usr/bin/python
class LoadBlacklist:
list = []
def loadlist(self):
tmplist = []
f = open("./config/blacklist.txt","r")
for counter, data in enumerate(f.readlines()):
tmplist.append([])
item = data
item = item.replace('\n', '')
item = item.replace('\n', '')
tmplist[coun... | class Loadblacklist:
list = []
def loadlist(self):
tmplist = []
f = open('./config/blacklist.txt', 'r')
for (counter, data) in enumerate(f.readlines()):
tmplist.append([])
item = data
item = item.replace('\n', '')
item = item.replace('\n',... |
t=int(input())
l = []
while (t>0):
N,K=input().split()
N,K=int(N),int(K)
A=input().split()
A=[int(i) for i in A]
lst=[]
for i in A:
if (K%i==0):
lst.append(i)
if (len(lst)==0):
l.append(-1)
else:
l.append(max(lst))
t-=1
for i in l:
... | t = int(input())
l = []
while t > 0:
(n, k) = input().split()
(n, k) = (int(N), int(K))
a = input().split()
a = [int(i) for i in A]
lst = []
for i in A:
if K % i == 0:
lst.append(i)
if len(lst) == 0:
l.append(-1)
else:
l.append(max(lst))
t -= 1
for... |
broker_url = 'amqp://couchbase:couchbase@172.23.97.73:5672/broker'
broker_pool_limit = None
worker_hijack_root_logger = False
result_backend = "amqp://"
result_persistent = False
result_exchange = "perf_results"
accept_content = ['pickle']
result_serializer = 'pickle'
task_serializer = 'pickle'
task_protocol = 1
broker... | broker_url = 'amqp://couchbase:couchbase@172.23.97.73:5672/broker'
broker_pool_limit = None
worker_hijack_root_logger = False
result_backend = 'amqp://'
result_persistent = False
result_exchange = 'perf_results'
accept_content = ['pickle']
result_serializer = 'pickle'
task_serializer = 'pickle'
task_protocol = 1
broker... |
'''
Classical notion of self-play. Where the opponent is ALWAYS the same as the agent that is being learnt.
'''
def opponent_sampling_distribution(menagerie, training_agent):
'''
:param menagerie: archive of agents selected by the curator and the potential opponents
:param training_agent: AgentHook of the... | """
Classical notion of self-play. Where the opponent is ALWAYS the same as the agent that is being learnt.
"""
def opponent_sampling_distribution(menagerie, training_agent):
"""
:param menagerie: archive of agents selected by the curator and the potential opponents
:param training_agent: AgentHook of the ... |
"""
===========================================================
Utilities (:mod:`utilities` package)
===========================================================
This package contains various classes and functions for the pipeline construction and execution.
File Access (:mod:`utilities.file_access_utilities`)
-------... | """
===========================================================
Utilities (:mod:`utilities` package)
===========================================================
This package contains various classes and functions for the pipeline construction and execution.
File Access (:mod:`utilities.file_access_utilities`)
-------... |
def index():
return {
"message": "healthy & running"
}, 200
| def index():
return ({'message': 'healthy & running'}, 200) |
screening_type = input()
rows = int(input())
columns = int(input())
income = 0
cinema_capacity = rows * columns
if screening_type == "Premiere":
income = cinema_capacity * 12
elif screening_type == "Normal":
income = cinema_capacity * 7.50
elif screening_type == "Discount":
income = cinema_capacity * 5.00
... | screening_type = input()
rows = int(input())
columns = int(input())
income = 0
cinema_capacity = rows * columns
if screening_type == 'Premiere':
income = cinema_capacity * 12
elif screening_type == 'Normal':
income = cinema_capacity * 7.5
elif screening_type == 'Discount':
income = cinema_capacity * 5.0
pri... |
#-----------------------------------------------------------------------------
class SNAP:
'''Class to use snap for command line via gpt, directly from Python'''
graph_amplitude = 'Preprocessing_amplitude.xml'
#variable outputs: Amplitude_VV, incidence angle
#pixel resolution = 100x100 m
... | class Snap:
"""Class to use snap for command line via gpt, directly from Python"""
graph_amplitude = 'Preprocessing_amplitude.xml'
graph_intensity = 'Preprocessing_sigmaintensity.xml'
graph_waves = 'Preprocessing_sigmaintensity_no_multilook.xml'
graph_objects = 'Preprocessing_intensity.xml'
grap... |
# Exercise 2 - Faulty Calculator
# 45 * 3 = 555, 56+9 = 77, 56/6 = 4
# Design a calculator which will correctly solve all the problems except
# the following ones:
# 45 * 3 = 555, 56+9 = 77, 56/6 = 4
# Your program should take operator and the two numbers as input from the user
# and then return the result
# solutio... | var1 = int(input('ENTER YOUR FIRST number\n'))
var2 = int(input('ENTER YOUR SECOUND number\n'))
opp1 = input('NOW ENTER THE OPERATOR\n')
if var1 == 45 and var2 == 3 and (opp1 == '*'):
print('YOU CHEATER\nYOUR ANSWER IS ', 555)
elif var1 == 56 and var2 == 9 and (opp1 == '+'):
print('YOU CHEATER\nYOUR ANSWER IS '... |
class NotFittedError(ValueError, AttributeError):
"""Exception class to raise if estimator is used before fitting.
This class inherits from both ValueError and AttributeError to help with
exception handling and backward compatibility.
Examples
--------
>>> from sklearn.svm import LinearSVC
... | class Notfittederror(ValueError, AttributeError):
"""Exception class to raise if estimator is used before fitting.
This class inherits from both ValueError and AttributeError to help with
exception handling and backward compatibility.
Examples
--------
>>> from sklearn.svm import LinearSVC
... |
"""
Arithmetic Operators
The provided code stub reads two integers from STDIN, a and b.
Add code to print three lines where:
1. The first line contains the sum of the two numbers.
2. The second line contains the difference of the two numbers (first - second).
3. The third line contains the product of the ... | """
Arithmetic Operators
The provided code stub reads two integers from STDIN, a and b.
Add code to print three lines where:
1. The first line contains the sum of the two numbers.
2. The second line contains the difference of the two numbers (first - second).
3. The third line contains the product of the ... |
__all__ = [
'__title__', '__summary__', '__uri__', '__version__', '__author__',
'__email__', '__license__', '__copyright__',
]
__title__ = 'TauBD'
__summary__ = 'TBD: Tau Be Damned.'
__uri__ = 'https://github.com/Intrinsically-Disordered/TBD'
__version__ = '1.0'
__author__ = 'TBD'
__email__ = 'jiaweihe@uw.ed... | __all__ = ['__title__', '__summary__', '__uri__', '__version__', '__author__', '__email__', '__license__', '__copyright__']
__title__ = 'TauBD'
__summary__ = 'TBD: Tau Be Damned.'
__uri__ = 'https://github.com/Intrinsically-Disordered/TBD'
__version__ = '1.0'
__author__ = 'TBD'
__email__ = 'jiaweihe@uw.edu'
__license__... |
# labmda function that returns a test number is even or not
f = lambda x: 'Even' if x%2==0 else 'Odd'
print(f(int(input('Enter a number \n')))) | f = lambda x: 'Even' if x % 2 == 0 else 'Odd'
print(f(int(input('Enter a number \n')))) |
Mano = 0
def on_gesture_shake():
global Mano
Mano = randint(1, 3)
if Mano == 1:
basic.show_leds("""
# # . . #
# # . # .
. # # . .
# # . # .
# # . . #
""")
else:
if Mano == 2:
basic.show_le... | mano = 0
def on_gesture_shake():
global Mano
mano = randint(1, 3)
if Mano == 1:
basic.show_leds('\n # # . . #\n # # . # .\n . # # . .\n # # . # .\n # # . . #\n ')
elif Mano == 2:
basic.show_leds('\n . # # #... |
title = "All my commands, peko!"
description = "If you have any problems with me, feel free to contact the creator on Discord (bemxio#5847) or on Reddit (u/bemxioo) peko!"
invite = "Here's my invite link peko! https://discord.com/api/oauth2/authorize?client_id=817481976797069383&permissions=116736&scope=bot"
dm_check =... | title = 'All my commands, peko!'
description = 'If you have any problems with me, feel free to contact the creator on Discord (bemxio#5847) or on Reddit (u/bemxioo) peko!'
invite = "Here's my invite link peko! https://discord.com/api/oauth2/authorize?client_id=817481976797069383&permissions=116736&scope=bot"
dm_check =... |
print('Challenge 9: WAF to concatinate 2 string with out using +.')
str1 = "Hello"
str2 = "World"
print("{} {}".format(str1, str2))
| print('Challenge 9: WAF to concatinate 2 string with out using +.')
str1 = 'Hello'
str2 = 'World'
print('{} {}'.format(str1, str2)) |
def _get_change_making_matrix(set_of_coins, r):
m = [[0 for _ in range(r + 1)] for _ in range(len(set_of_coins) + 1)]
for i in range(r + 1):
m[0][i] = i
return m
def change_making(coins, n):
"""This function assumes that all coins are available infinitely.
n is the number that we ... | def _get_change_making_matrix(set_of_coins, r):
m = [[0 for _ in range(r + 1)] for _ in range(len(set_of_coins) + 1)]
for i in range(r + 1):
m[0][i] = i
return m
def change_making(coins, n):
"""This function assumes that all coins are available infinitely.
n is the number that we need to ... |
ACCESS_TOKEN = '#####'
ACCESS_TOKEN_SECRET = '########'
CONSUMER_KEY = '######'
CONSUMER_SERET = '#######'
| access_token = '#####'
access_token_secret = '########'
consumer_key = '######'
consumer_seret = '#######' |
FLASK_ADMIN_SWATCH = "paper"
SECRET_KEY = "123456790"
DATABASE_FILENAME = "example_app_01.db"
SQLALCHEMY_DATABASE_URI = "sqlite:///" + DATABASE_FILENAME
SQLALCHEMY_ECHO = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
| flask_admin_swatch = 'paper'
secret_key = '123456790'
database_filename = 'example_app_01.db'
sqlalchemy_database_uri = 'sqlite:///' + DATABASE_FILENAME
sqlalchemy_echo = True
sqlalchemy_track_modifications = False |
AGG_SIG_UNSAFE = 49
AGG_SIG_ME = 50
# the conditions below reserve coin amounts and have to be accounted for in output totals
CREATE_COIN = 51
RESERVE_FEE = 52
# the conditions below deal with announcements, for inter-coin communication
# coin announcements
CREATE_COIN_ANNOUNCEMENT = 60
ASSERT_COIN_ANNOUNCEMENT = 6... | agg_sig_unsafe = 49
agg_sig_me = 50
create_coin = 51
reserve_fee = 52
create_coin_announcement = 60
assert_coin_announcement = 61
create_puzzle_announcement = 62
assert_puzzle_announcement = 63
assert_my_coin_id = 70
assert_my_parent_id = 71
assert_my_puzzlehash = 72
assert_my_amount = 73
assert_seconds_relative = 80
a... |
#
# PySNMP MIB module EQLREPLPARTNER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EQLREPLPARTNER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:05:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint, constraints_union) ... |
class GeneratorBase:
__parameters__: dict
__saved__: dict
def __init__(self):
self.reset_params()
self.reset_saved()
def reset_params(self):
pass
def reset_saved(self):
self.__saved__ = {'default': self.__parameters__.copy()}
def save(self, param_key: str):
... | class Generatorbase:
__parameters__: dict
__saved__: dict
def __init__(self):
self.reset_params()
self.reset_saved()
def reset_params(self):
pass
def reset_saved(self):
self.__saved__ = {'default': self.__parameters__.copy()}
def save(self, param_key: str):
... |
__author__ = 'lorcan'
# get int from user
# get a base from user to convert int to
# get BASE_X string
# convert BASE_X string back to integer
# get int from user
myStr = input("Enter an integer to convert binary: ")
myInt = int(myStr)
# get a base from user to convert int to
baseStr = input("\nChoose Base 2,8,16 t... | __author__ = 'lorcan'
my_str = input('Enter an integer to convert binary: ')
my_int = int(myStr)
base_str = input('\nChoose Base 2,8,16 to convert to: ')
base_int = int(baseStr)
bin_str = ''
while myInt > 0:
if myInt % baseInt == 10:
bin_str = 'A' + binStr
my_int //= baseInt
elif myInt % baseInt... |
class Configurable:
def __init__(self):
pass
def function_support(self, function: str) -> bool:
pass
def parameter_template(self, function: str) -> dict:
pass
| class Configurable:
def __init__(self):
pass
def function_support(self, function: str) -> bool:
pass
def parameter_template(self, function: str) -> dict:
pass |
def add_me_to_the_queue(express_queue, normal_queue, ticket_type, person_name):
pass
def find_his_friend(queue, friend_name):
pass
def add_person_with_his_friends(queue, index, person_name):
pass
def remove_the_mean_person(queue, person_name):
pass
def how_many_dopplegangers(queue, person_name):
... | def add_me_to_the_queue(express_queue, normal_queue, ticket_type, person_name):
pass
def find_his_friend(queue, friend_name):
pass
def add_person_with_his_friends(queue, index, person_name):
pass
def remove_the_mean_person(queue, person_name):
pass
def how_many_dopplegangers(queue, person_name):
... |
#!/usr/bin/env python
__author__ = "Christopher and Cody Reichert"
__copyright__ = "Copyright 2015, SimplyRETS Inc. <support@simplyrets.com>"
__credits__ = ["Christopher Reichert", "Cody Reichert"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Christopher Reichert"
__email__ = "christopher@simplyrets.com"
... | __author__ = 'Christopher and Cody Reichert'
__copyright__ = 'Copyright 2015, SimplyRETS Inc. <support@simplyrets.com>'
__credits__ = ['Christopher Reichert', 'Cody Reichert']
__license__ = 'MIT'
__version__ = '0.1'
__maintainer__ = 'Christopher Reichert'
__email__ = 'christopher@simplyrets.com'
__status__ = 'Productio... |
n = int(input())
while n > 0 :
print (n)
n -= 1
print ("0!!") | n = int(input())
while n > 0:
print(n)
n -= 1
print('0!!') |
class Config:
"""Base config."""
# pylint: disable=too-few-public-methods
STATIC_FOLDER = "static"
CACHE_TYPE = "simple"
CACHE_DEFAULT_TIMEOUT = 3600
QUIET = False
class ProdConfig(Config):
"""Production configuration."""
# pylint: disable=too-few-public-methods
FLASK_ENV = "pro... | class Config:
"""Base config."""
static_folder = 'static'
cache_type = 'simple'
cache_default_timeout = 3600
quiet = False
class Prodconfig(Config):
"""Production configuration."""
flask_env = 'production'
debug = False
testing = False
quiet = True
class Devconfig(Config):
... |
# print(max(1, 2, 3, 4, 5, 100, -2, -2, -10))
# print(min(1, 2, 3, 4, 5, 100, -2, -2, -10))
"""
Time Complexity: O(n)
Space Complexity: O(n)
"""
n = int(input())
numbers = [x for x in range(1, n)]
print(numbers)
# print(max(numbers))
# print(min(numbers))
print(sum(numbers))
| """
Time Complexity: O(n)
Space Complexity: O(n)
"""
n = int(input())
numbers = [x for x in range(1, n)]
print(numbers)
print(sum(numbers)) |
class Graph:
def __init__(self, v):
self.v = v
self.graph = []
def add_edge(self, s, d, w):
self.graph.append([s,d,w])
def bellman_ford(self, src):
dist = [float('inf')]* self.v
dist[src] = 0
# Relax v-1
for i in range(self.v - 1):
fo... | class Graph:
def __init__(self, v):
self.v = v
self.graph = []
def add_edge(self, s, d, w):
self.graph.append([s, d, w])
def bellman_ford(self, src):
dist = [float('inf')] * self.v
dist[src] = 0
for i in range(self.v - 1):
for (u, v, c) in self.... |
__title__ = 'arbalest'
__version__ = '1.6.2'
__author__ = 'Fredrick Galoso'
__copyright__ = 'Copyright 2015 Dwolla, Inc'
| __title__ = 'arbalest'
__version__ = '1.6.2'
__author__ = 'Fredrick Galoso'
__copyright__ = 'Copyright 2015 Dwolla, Inc' |
# https://leetcode.com/problems/add-two-numbers/
class ListNode:
def __init__(self, val = 0, next = None):
self.val = val
self.next = next
def __eq__(self, other):
if other != None:
return self.val == other.val and self.next == other.next
def __add__(se... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def __eq__(self, other):
if other != None:
return self.val == other.val and self.next == other.next
def __add__(self, other):
return self.val + other.val
def add_nodes(a: Lis... |
# ------------------------------
# 54. Spiral Matrix
#
# Description:
# Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
#
# Example 1:
# Input:
# [
# [ 1, 2, 3 ],
# [ 4, 5, 6 ],
# [ 7, 8, 9 ]
# ]
# Output: [1,2,3,6,9,8,7,4,5]
#
# Example 2:
# Input:
# [
# ... | class Solution:
def spiral_order(self, matrix: List[List[int]]) -> List[int]:
if not matrix or not matrix[0]:
return []
m = len(matrix)
n = len(matrix[0])
seen = [[False] * N for _ in range(M)]
res = []
dr = [0, 1, 0, -1]
dc = [1, 0, -1, 0]
... |
def main(S, W):
if S > W:
print('safe')
else:
print('unsafe')
if __name__ == '__main__':
S, W = list(map(int, input().split()))
main(S, W)
| def main(S, W):
if S > W:
print('safe')
else:
print('unsafe')
if __name__ == '__main__':
(s, w) = list(map(int, input().split()))
main(S, W) |
# encoding: utf-8
"""
Core exceptions
"""
class GozokiaError(Exception):
'''raise this when there's a lookup error for my app'''
pass
class GozokiaNotImplemented(Exception):
'''raise this when there's a lookup error for my app'''
pass
class ImproperlyConfigured(Exception):
pass
| """
Core exceptions
"""
class Gozokiaerror(Exception):
"""raise this when there's a lookup error for my app"""
pass
class Gozokianotimplemented(Exception):
"""raise this when there's a lookup error for my app"""
pass
class Improperlyconfigured(Exception):
pass |
coordinates_E0E1E1 = ((128, 117),
(128, 119), (128, 121), (129, 116), (129, 124), (130, 115), (130, 117), (130, 118), (130, 119), (130, 120), (130, 121), (130, 123), (131, 114), (131, 116), (131, 123), (132, 118), (132, 119), (132, 120), (132, 121), (132, 123), (133, 113), (133, 116), (133, 123), (134, 114), (134, 12... | coordinates_e0_e1_e1 = ((128, 117), (128, 119), (128, 121), (129, 116), (129, 124), (130, 115), (130, 117), (130, 118), (130, 119), (130, 120), (130, 121), (130, 123), (131, 114), (131, 116), (131, 123), (132, 118), (132, 119), (132, 120), (132, 121), (132, 123), (133, 113), (133, 116), (133, 123), (134, 114), (134, 12... |
'''
Created on Sep 30, 2018
@author: cat_t
'''
class Location(object):
'''
classdocs
'''
def __init__(self, name = ""):
'''
Constructor
'''
self.name = name
def __eq__(self, other):
try:
if self.name == other.name:
retu... | """
Created on Sep 30, 2018
@author: cat_t
"""
class Location(object):
"""
classdocs
"""
def __init__(self, name=''):
"""
Constructor
"""
self.name = name
def __eq__(self, other):
try:
if self.name == other.name:
return True
... |
class ListNode:
def __init__(self, val):
self.val = val
self.next = None
class LinkedList:
def __init__(self, head=None, items=None):
self.head = head # ListNode
if items is not None: # should be List[ListNode]
for node in items:
self.append(node)... | class Listnode:
def __init__(self, val):
self.val = val
self.next = None
class Linkedlist:
def __init__(self, head=None, items=None):
self.head = head
if items is not None:
for node in items:
self.append(node)
def append(self, node):
if... |
# /* megatest texts, C-ified */
# // Copyright 2010 Kurt Hackenberg & William S. Yerazunis, each individually
# // with full rights to relicense.
# //
# // This collection contains texts in the public domain; the copyright
# // is not on the texts themselves but on their use as test texts for
# // the LGPLed CRM... | alice = 'CHAPTER I. Down the Rabbit-Hole\n\nAlice was beginning to get very tired of sitting by her sister on the\nbank, and of having nothing to do: once or twice she had peeped into the\nbook her sister was reading, but it had no pictures or conversations in\nit, \'and what is the use of a book,\' thought Alice \'wit... |
class Solution:
def isAnagram(self, s, t):
ds={}
dt={}
for i in s:
if ds.get(i):
ds[i]+=1
else:
ds[i]=1
for i in t:
if dt.get(i):
dt[i]+=1
else:
dt[i]=1
if ds==dt:
... | class Solution:
def is_anagram(self, s, t):
ds = {}
dt = {}
for i in s:
if ds.get(i):
ds[i] += 1
else:
ds[i] = 1
for i in t:
if dt.get(i):
dt[i] += 1
else:
dt[i] = 1
... |
# -*- coding: utf-8 -*-
"""Advent of Code 2015 - Day 1: Not Quite Lisp."""
def load_and_parse_input(input_file: str):
with open(input_file) as inf:
return inf.read().strip()
def part_1(puzzle):
# start on the ground floor
floor: int = 0
for order in puzzle:
if order == "(":
... | """Advent of Code 2015 - Day 1: Not Quite Lisp."""
def load_and_parse_input(input_file: str):
with open(input_file) as inf:
return inf.read().strip()
def part_1(puzzle):
floor: int = 0
for order in puzzle:
if order == '(':
floor += 1
elif order == ')':
floor... |
highscore = {
'alice': 123,
'bob': 234,
'claire': 345,
}
phonenumbers = {
'alice': '555-1234',
'bob': '555-2345',
'claire': '555-3456',
}
k1 = highscore.keys()
print(k1)
print(id(k1))
print(highscore.values())
print('-'*40)
k2 = phonenumbers.keys()
print(k2)
print(id(k2))
print(phonenumbers.va... | highscore = {'alice': 123, 'bob': 234, 'claire': 345}
phonenumbers = {'alice': '555-1234', 'bob': '555-2345', 'claire': '555-3456'}
k1 = highscore.keys()
print(k1)
print(id(k1))
print(highscore.values())
print('-' * 40)
k2 = phonenumbers.keys()
print(k2)
print(id(k2))
print(phonenumbers.values()) |
def fbx_data_bindpose_element(objectsParent, key, id, count):
"""
Helper, since bindpose are used by both meshes shape keys and armature bones...
"""
# We assume bind pose for our bones are their "Editmode" pose...
# All matrices are expected in global (world) space.
fbx_pose = elem_data_single_... | def fbx_data_bindpose_element(objectsParent, key, id, count):
"""
Helper, since bindpose are used by both meshes shape keys and armature bones...
"""
fbx_pose = elem_data_single_int64(objectsParent, b'Pose', id)
fbx_pose.add_string(fbx_name_class(key.encode()))
fbx_pose.add_string(b'BindPose')
... |
"""
entrada
dinero-->float-->d
salida
ganancia-->str-->g
"""
d=int(input("digite el valor de su inversion "))
g=d*(2/100)
print("la ganancia es de " + str(g) ) | """
entrada
dinero-->float-->d
salida
ganancia-->str-->g
"""
d = int(input('digite el valor de su inversion '))
g = d * (2 / 100)
print('la ganancia es de ' + str(g)) |
# Autogenerated file for Buzzer
# Add missing from ... import const
_JD_SERVICE_CLASS_BUZZER = const(0x1b57b1d7)
_JD_BUZZER_REG_VOLUME = const(JD_REG_INTENSITY)
_JD_BUZZER_CMD_PLAY_TONE = const(0x80)
_JD_BUZZER_CMD_PLAY_NOTE = const(0x81) | _jd_service_class_buzzer = const(458731991)
_jd_buzzer_reg_volume = const(JD_REG_INTENSITY)
_jd_buzzer_cmd_play_tone = const(128)
_jd_buzzer_cmd_play_note = const(129) |
def printStuff():
print("stuff")
x = 1
y = 2
z = 3
if x == 1:
print(x, y, z)
print("ololo")
print("stuff")
| def print_stuff():
print('stuff')
x = 1
y = 2
z = 3
if x == 1:
print(x, y, z)
print('ololo')
print('stuff') |
def binary_array_to_number(arr):
return int(''.join([str(i) for i in arr]), 2)
b = [0, 1, 0, 1]
print(binary_array_to_number(b)) | def binary_array_to_number(arr):
return int(''.join([str(i) for i in arr]), 2)
b = [0, 1, 0, 1]
print(binary_array_to_number(b)) |
# Tools
def strQ2B(ustring):
rstring = ""
for uchar in ustring:
inside_code = ord(uchar)
if inside_code == 0x3000:
inside_code = 0x0020
else:
inside_code -= 0xfee0
if inside_code < 0x0020 or inside_code > 0x7e:
inside_code = ord(uchar)
... | def str_q2_b(ustring):
rstring = ''
for uchar in ustring:
inside_code = ord(uchar)
if inside_code == 12288:
inside_code = 32
else:
inside_code -= 65248
if inside_code < 32 or inside_code > 126:
inside_code = ord(uchar)
rstring += unichr... |
_base_ = [
'../_base_/datasets/bdd100k.py', '../_base_/models/dla34_bdd100k.py',
'../_base_/schedules/bdd100k.py', '../_base_/default_runtime.py'
]
find_unused_parameters = True | _base_ = ['../_base_/datasets/bdd100k.py', '../_base_/models/dla34_bdd100k.py', '../_base_/schedules/bdd100k.py', '../_base_/default_runtime.py']
find_unused_parameters = True |
# rotating 3d cube
# based on MicroViewCube.ino by Jim Lindblom @ SparkFun Electronics
# https://github.com/sparkfun/SparkFun_MicroView_Arduino_Library/blob/master/examples/MicroViewCube/MicroViewCube.ino
pi = math.pi
size = 700
width = display.width
height = display.height
d = 3
px = [-d, d, d, -d, -d, d, d, -... | pi = math.pi
size = 700
width = display.width
height = display.height
d = 3
px = [-d, d, d, -d, -d, d, d, -d]
py = [-d, -d, d, d, -d, -d, d, d]
pz = [-d, -d, -d, -d, d, d, d, d]
p2x = [0, 0, 0, 0, 0, 0, 0, 0]
p2y = [0, 0, 0, 0, 0, 0, 0, 0]
r = [0, 0, 0]
def draw_cube():
r[0] = r[0] + pi / 180.0
r[1] = r[1] + p... |
XX_train = np.concatenate((X_train, np.sin(4 * X_train)), axis=1)
XX_test = np.concatenate((X_test, np.sin(4 * X_test)), axis=1)
regressor.fit(XX_train, y_train)
y_pred_test_sine = regressor.predict(XX_test)
plt.plot(X_test, y_test, 'o', label="data")
plt.plot(X_test, y_pred_test_sine, 'o', label="prediction with sine... | xx_train = np.concatenate((X_train, np.sin(4 * X_train)), axis=1)
xx_test = np.concatenate((X_test, np.sin(4 * X_test)), axis=1)
regressor.fit(XX_train, y_train)
y_pred_test_sine = regressor.predict(XX_test)
plt.plot(X_test, y_test, 'o', label='data')
plt.plot(X_test, y_pred_test_sine, 'o', label='prediction with sine'... |
# { 'a': 'A',
# 'b': 'B',
# 'c': 'C',
# 'd': 'D',
# 'e': 'E',
# 'f': 'F',
# 'g': 'G',
# 'h': 'H',
# 'i': 'I',
# 'j': 'J',
# 'k': 'K',
# 'l': 'L',
# 'm': 'M',
# 'n': 'N',
# 'o': 'O',
# 'p': 'P',
# 'q': 'Q',
# 'r': 'R',
# 's': 'S',
# 't': 'T',
# 'u': 'U',
# '... | minusculas = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}
maiusculas = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}
maiuscula_para_minuscula = {'A':... |
class BaseDriver:
dbapi = None
schema_class = None
def __init__(self, config):
self.config = config
self._conn = None
@property
def schema(self):
if self.schema_class is None:
return
return self.schema_class(self)
def get_connect_params(self):
... | class Basedriver:
dbapi = None
schema_class = None
def __init__(self, config):
self.config = config
self._conn = None
@property
def schema(self):
if self.schema_class is None:
return
return self.schema_class(self)
def get_connect_params(self):
... |
class Conta:
def __init__(self, clientes, numero, saldo=0):
self.saldo = saldo
self.clientes = clientes
self.numero = numero
def resumo(self):
print(f'CC numero: {self.numero} Saldo: {self.saldo:10.2f}')
def saque(self, valor):
if self.saldo >= valor:
se... | class Conta:
def __init__(self, clientes, numero, saldo=0):
self.saldo = saldo
self.clientes = clientes
self.numero = numero
def resumo(self):
print(f'CC numero: {self.numero} Saldo: {self.saldo:10.2f}')
def saque(self, valor):
if self.saldo >= valor:
s... |
'''
Created on 2013-11-18
@author: Nich
'''
class CommandExecutor(object):
def execute(self, command_package):
command, args = command_package
command(**args) | """
Created on 2013-11-18
@author: Nich
"""
class Commandexecutor(object):
def execute(self, command_package):
(command, args) = command_package
command(**args) |
AUTH_INCORRECT_CREDENTIALS = 'Incorrect username or password.'
AUTH_EMAIL_MISSING = 'Missing required "email" parameter.'
AUTH_PSSWD_MISSING = 'Missing required "password" parameter.'
AUTH_USERNAME_EXISTS = 'Selected username already exists.'
AUTH_NOT_FOUND = 'User {} was not found.'
AUTH_SMTP_ERROR = 'Error sending em... | auth_incorrect_credentials = 'Incorrect username or password.'
auth_email_missing = 'Missing required "email" parameter.'
auth_psswd_missing = 'Missing required "password" parameter.'
auth_username_exists = 'Selected username already exists.'
auth_not_found = 'User {} was not found.'
auth_smtp_error = 'Error sending em... |
"""Summary."""
def test_gauss_dist():
"""Summary."""
pass
def test_gamma_dist():
"""Summary."""
pass
| """Summary."""
def test_gauss_dist():
"""Summary."""
pass
def test_gamma_dist():
"""Summary."""
pass |
#######################################################
#
# ReceiveConnectionsProcess.py
# Python implementation of the Class ReceiveConnectionsProcess
# Generated by Enterprise Architect
# Created on: 21-May-2020 9:47:41 AM
# Original author: Natha Paquette
#
####################################################... | class Receiveconnectionsprocess:
def __init__(self):
self.receiveConnections = '' |
def part_1():
# we'll attempt to fit in all into memory
inputs = set()
with open("./01.txt", mode="r") as fp:
for line in fp.readlines():
i = int(line.strip())
# since we're working with 2 numbers it's easy to figure out what number we're looking for
# if we've se... | def part_1():
inputs = set()
with open('./01.txt', mode='r') as fp:
for line in fp.readlines():
i = int(line.strip())
if 2020 - i in inputs:
return f'{i}, {2020 - i} = {i * (2020 - i)}'
inputs.add(i)
def part_2():
inputs = set()
targets = {}
... |
# coding: utf8
# Copyright (C) 2015 Zhe Wang <0x1998@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | class Gssedge(object):
def __init__(self, return_state, target, nonpacked_node):
self.return_state = return_state
self.target = target
self.nonpacked_node = nonpacked_node
class Gssnode(object):
"""
A GSS Node records the return grammar position, needed to continue parsing
afte... |
class EbelgeUsers: # The target object of the parser
def __init__(self):
self.tax_id = ""
self.is_tax_data = False
self.activity_count = 0
self.is_einvoice_document = False
self.is_edespatchadvice_document = False
self.is_efatura_user = False
self.is_eirsaliy... | class Ebelgeusers:
def __init__(self):
self.tax_id = ''
self.is_tax_data = False
self.activity_count = 0
self.is_einvoice_document = False
self.is_edespatchadvice_document = False
self.is_efatura_user = False
self.is_eirsaliye_user = False
self.return... |
# 15/15
tipping_point = int(input())
infected = int(input())
infection_rate = int(input())
iterations = 0
newly_infected = infected
while infected <= tipping_point:
iterations += 1
newly_infected = newly_infected * infection_rate
infected += newly_infected
print(iterations)
| tipping_point = int(input())
infected = int(input())
infection_rate = int(input())
iterations = 0
newly_infected = infected
while infected <= tipping_point:
iterations += 1
newly_infected = newly_infected * infection_rate
infected += newly_infected
print(iterations) |
class Instruction:
SET_PROPERTY = "setp"
START_GAME = "start"
class Update:
PLAYER_JOINED = "u_join"
GAME_RUNNING = "u_running"
QUIT_GAME = "u_quit"
CHAT_MESSAGE = "u_message"
class Game:
PICKUP_CARD = "g_pickup"
PLACE_CARD = "g_place"
SEND_DECK ... | class Instruction:
set_property = 'setp'
start_game = 'start'
class Update:
player_joined = 'u_join'
game_running = 'u_running'
quit_game = 'u_quit'
chat_message = 'u_message'
class Game:
pickup_card = 'g_pickup'
place_card = 'g_place'
send_deck ... |
for w in AbstractWidget.objects.filter(package='ilp'):
w.package = 'rdm.wrappers'
w.save()
| for w in AbstractWidget.objects.filter(package='ilp'):
w.package = 'rdm.wrappers'
w.save() |
def end_signal():
# Hey, computer, let me know when you're done! :)
# NOTE: This only works for Windows
winsound.Beep(440, 100)
time.sleep(.05)
winsound.Beep(660, 100)
| def end_signal():
winsound.Beep(440, 100)
time.sleep(0.05)
winsound.Beep(660, 100) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.