content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#gas_flow_class
class Gas():
def __init__(self) -> None:
self.Pt = 0
self.Tt = 0
self.P = 0
self.T = 0
self.H = 0
self.S = 0
self.Cp = 1.005
self.f = 0 #fraction of air and gas
self.mass = 0 #massflow
self.c = 0 #velocity of gas in m/s
... | class Gas:
def __init__(self) -> None:
self.Pt = 0
self.Tt = 0
self.P = 0
self.T = 0
self.H = 0
self.S = 0
self.Cp = 1.005
self.f = 0
self.mass = 0
self.c = 0
self.a = 0
self.k = 1.33
self.Rg = 287
self.... |
# -*- coding: utf-8 -*-
class B:
print('B is imported')
| class B:
print('B is imported') |
"""
This unit test checks that a thread does not get to log(before exitall is called.,'\n')
If exitall works, the program will terminate immediately, and the log(will not happen.,'\n')
"""
#pragma repy
def thread():
sleep(0.1)
log('After exitall called','\n')
createthread(thread)
exitall()
| """
This unit test checks that a thread does not get to log(before exitall is called.,'
')
If exitall works, the program will terminate immediately, and the log(will not happen.,'
')
"""
def thread():
sleep(0.1)
log('After exitall called', '\n')
createthread(thread)
exitall() |
class Solution:
def deckRevealedIncreasing(self, deck: List[int]) -> List[int]:
n = len(deck)
order = collections.deque(list(range(n)))
m = [-1] * n
cnt = 0
while order:
idx = order.popleft()
m[cnt] = idx
cnt += 1
if order:
... | class Solution:
def deck_revealed_increasing(self, deck: List[int]) -> List[int]:
n = len(deck)
order = collections.deque(list(range(n)))
m = [-1] * n
cnt = 0
while order:
idx = order.popleft()
m[cnt] = idx
cnt += 1
if order:
... |
def test_StrOp_concat():
s: str
s = '3' + '4'
s = "a " + "test"
s = 'test' + 'test' + 'test'
| def test__str_op_concat():
s: str
s = '3' + '4'
s = 'a ' + 'test'
s = 'test' + 'test' + 'test' |
"""P1_boxPrint.py
This program prints out a box based on input sizes.
"""
def boxPrint(symbol: str, width: int, height: int) -> None:
"""Box print
Prints a box of given width and height using the given symbol.
Args:
symbol: String to use to make sides of box.
width: Integer width of bo... | """P1_boxPrint.py
This program prints out a box based on input sizes.
"""
def box_print(symbol: str, width: int, height: int) -> None:
"""Box print
Prints a box of given width and height using the given symbol.
Args:
symbol: String to use to make sides of box.
width: Integer width of bo... |
'''
Write a Min Max Stack class. The class should support pushing and popping values on and off the stack, peeking at
values at the top of the stack, and getting both the minimum and maximum values in the stack. All class methods, when
considered independently, should run in constant time and with constant space.
Inpu... | """
Write a Min Max Stack class. The class should support pushing and popping values on and off the stack, peeking at
values at the top of the stack, and getting both the minimum and maximum values in the stack. All class methods, when
considered independently, should run in constant time and with constant space.
Inpu... |
class SchemaAlreadyRegistered(Exception):
"""Error raised while trying to register a Schema that has already
been registered
"""
def __init__(self, name):
"""
Args:
name (str): schema name
"""
super(SchemaAlreadyRegistered, self).__init__("Schema \"%s\" has al... | class Schemaalreadyregistered(Exception):
"""Error raised while trying to register a Schema that has already
been registered
"""
def __init__(self, name):
"""
Args:
name (str): schema name
"""
super(SchemaAlreadyRegistered, self).__init__('Schema "%s" has alr... |
def genres(items, excludedGenres):
filteredGenres = []
for item in items:
for genre in item["genres"]:
if len(list(set(genre.split()).intersection(excludedGenres))) == 0:
genre = genre.replace(' ', '-').lower()
if not genre in filteredGenres:
... | def genres(items, excludedGenres):
filtered_genres = []
for item in items:
for genre in item['genres']:
if len(list(set(genre.split()).intersection(excludedGenres))) == 0:
genre = genre.replace(' ', '-').lower()
if not genre in filteredGenres:
... |
#
# PySNMP MIB module SAVEPOWER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SAVEPOWER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:00:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) ... |
# encoding: utf-8
# Author: Kyohei Atarashi
# License: MIT
def _cd_linear_epoch(w, X, y, y_pred, col_norm_sq, alpha, loss,
indices_feature):
sum_viol = 0
n_samples = len(y)
for j in indices_feature:
update = 0
# compute gradient with respect to w_j
for i in ran... | def _cd_linear_epoch(w, X, y, y_pred, col_norm_sq, alpha, loss, indices_feature):
sum_viol = 0
n_samples = len(y)
for j in indices_feature:
update = 0
for i in range(n_samples):
update += loss.dloss(y_pred[i], y[i]) * X[i, j]
update += alpha * w[j]
inv_step_size =... |
symbol_1 = input()
symbol_2 = input()
string = input()
total_sum = 0
for letter in string:
if ord(symbol_1) < ord(letter) < ord(symbol_2):
total_sum += ord(letter)
print(total_sum) | symbol_1 = input()
symbol_2 = input()
string = input()
total_sum = 0
for letter in string:
if ord(symbol_1) < ord(letter) < ord(symbol_2):
total_sum += ord(letter)
print(total_sum) |
def teardown_func():
assert 1 == 0
def test():
pass
test.teardown = teardown_func
| def teardown_func():
assert 1 == 0
def test():
pass
test.teardown = teardown_func |
class Note:
def __init__(self, content: str):
self.content = content
| class Note:
def __init__(self, content: str):
self.content = content |
def large_population(population):
if(found > 2000):
return True
else:
return False
| def large_population(population):
if found > 2000:
return True
else:
return False |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
default_date = '2021-03-10'
default_rates = {'EUR': 1.0,
'USD': 1.1892,
'JPY': 129.12,
'BGN': 1.9558,
'CZK': 26.226,
'DKK': 7.4366,
'GBP': 0.85655,
'HUF': 367... | default_date = '2021-03-10'
default_rates = {'EUR': 1.0, 'USD': 1.1892, 'JPY': 129.12, 'BGN': 1.9558, 'CZK': 26.226, 'DKK': 7.4366, 'GBP': 0.85655, 'HUF': 367.48, 'PLN': 4.5752, 'RON': 4.8865, 'SEK': 10.1305, 'CHF': 1.1069, 'ISK': 152.1, 'NOK': 10.0813, 'HRK': 7.5865, 'RUB': 87.9744, 'TRY': 9.0269, 'AUD': 1.543, 'BRL':... |
# If set, it will update the default panel of the PANEL_DASHBOARD.
DEFAULT_PANEL = 'billing_config'
PANEL_DASHBOARD = 'billing'
PANEL_GROUP = 'default'
PANEL = 'billing_config'
ADD_PANEL = 'astutedashboard.dashboards.billing.config.panel.Config'
| default_panel = 'billing_config'
panel_dashboard = 'billing'
panel_group = 'default'
panel = 'billing_config'
add_panel = 'astutedashboard.dashboards.billing.config.panel.Config' |
class Node:
def __init__(self, data) -> None:
self.data = data
self.next = None
class LinkedList:
def __init__(self) -> None:
self.head = None
def insert(self, item):
temp = Node(item)
temp.next = self.head
self.head = temp
def display(node):
... | class Node:
def __init__(self, data) -> None:
self.data = data
self.next = None
class Linkedlist:
def __init__(self) -> None:
self.head = None
def insert(self, item):
temp = node(item)
temp.next = self.head
self.head = temp
def display(node):
temp = n... |
#!/usr/bin/env python3
x = "text"
# these do the same thing.
print("x is:", x) # simply prints two things.
print("x is: " + x) # concatenates to string(no space)
| x = 'text'
print('x is:', x)
print('x is: ' + x) |
'''https://leetcode.com/problems/n-queens-ii/'''
class Solution:
def totalNQueens(self, n: int) -> int:
board = [[0]*n for _ in range(n)]
def placeQ(row, col):
board[row][col] = 1
def removeQ(row, col):
board[row][col] = 0
d... | """https://leetcode.com/problems/n-queens-ii/"""
class Solution:
def total_n_queens(self, n: int) -> int:
board = [[0] * n for _ in range(n)]
def place_q(row, col):
board[row][col] = 1
def remove_q(row, col):
board[row][col] = 0
def check(row, col):
... |
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = int(input())
ans = []
if C in A:
ans.extend(B)
if C in B:
ans.extend(A)
ans = set(ans)
print(len(ans))
print(*sorted(ans), sep='\n')
| a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = int(input())
ans = []
if C in A:
ans.extend(B)
if C in B:
ans.extend(A)
ans = set(ans)
print(len(ans))
print(*sorted(ans), sep='\n') |
def fact(n:int=0)->int:
if n <= 0:
return (1)
if n == 1:
return (1)
return fact(n-1) + fact(n-2)
#main
for i in range(0,10):
print(f"{fact(i)}", end =" ")
| def fact(n: int=0) -> int:
if n <= 0:
return 1
if n == 1:
return 1
return fact(n - 1) + fact(n - 2)
for i in range(0, 10):
print(f'{fact(i)}', end=' ') |
saque = int(input('Valor do saque: R$'))
notas = saque
while saque != 0:
if saque % 50 >= 0:
notas = saque
if notas // 50 != 0: print(f'Total de {notas//50} notas de R$50,00')
saque = saque % 50
if saque % 20 >= 0:
notas = saque
if notas // 20 != 0: print(f'Total de {nota... | saque = int(input('Valor do saque: R$'))
notas = saque
while saque != 0:
if saque % 50 >= 0:
notas = saque
if notas // 50 != 0:
print(f'Total de {notas // 50} notas de R$50,00')
saque = saque % 50
if saque % 20 >= 0:
notas = saque
if notas // 20 != 0:
... |
lista_inteiros = [
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
[9, 1, 8, 9, 9, 7, 2, 1, 6, 8],
[1, 3, 2, 2, 8, 6, 5, 9,6, 7],
[3, 8, 2, 8, 6, 7, 7, 3, 1, 9],
[4, 8, 8, 8, 5, 1, 10, 3, 1, 7],
[1, 3, 7, 2, 2, 1, 5, 1, 9, 9],
[10, 2, 2, 1, 3, 5, 1, 9, 9],
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
]
def encont... | lista_inteiros = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [9, 1, 8, 9, 9, 7, 2, 1, 6, 8], [1, 3, 2, 2, 8, 6, 5, 9, 6, 7], [3, 8, 2, 8, 6, 7, 7, 3, 1, 9], [4, 8, 8, 8, 5, 1, 10, 3, 1, 7], [1, 3, 7, 2, 2, 1, 5, 1, 9, 9], [10, 2, 2, 1, 3, 5, 1, 9, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]
def encontra_duplicado(parametro):
numer... |
# Maltego Entities - Maltego Chlorine 3.6.0
# Parser written by:
# Justin Seitz - justin@hunch.ly
class Unknown(object):
def __init__(self, entity_value):
self.entity_value = entity_value
self.entity_type = "maltego.Unknown"
self.entity_attributes = {}
self.entity_attribute_names = ... | class Unknown(object):
def __init__(self, entity_value):
self.entity_value = entity_value
self.entity_type = 'maltego.Unknown'
self.entity_attributes = {}
self.entity_attribute_names = {}
pass
class Computer(object):
def __init__(self, entity_value):
self.entit... |
# python3 (this comment tells the grading system at Coursera to use python3 rather than python3)
def sum_of_two_digits(first_digit, second_digit):
assert 0 <= first_digit <= 9 and 0 <= second_digit <= 9
return first_digit + second_digit
if __name__ == '__main__':
a, b = map(int, input().split())
pri... | def sum_of_two_digits(first_digit, second_digit):
assert 0 <= first_digit <= 9 and 0 <= second_digit <= 9
return first_digit + second_digit
if __name__ == '__main__':
(a, b) = map(int, input().split())
print(sum_of_two_digits(a, b)) |
for a in range(1,100):
for b in range(1,100):
for c in range(1,100):
if a*a == b*b + c*c:
print(a , b , c)
elif b*b == a*a + c*c:
print(b , a , c)
elif c*c == a*a + b*b:
print(c , a , b) | for a in range(1, 100):
for b in range(1, 100):
for c in range(1, 100):
if a * a == b * b + c * c:
print(a, b, c)
elif b * b == a * a + c * c:
print(b, a, c)
elif c * c == a * a + b * b:
print(c, a, b) |
grid = [[int(x) for x in line] for line in open('input.txt').read().splitlines()]
def dijkstra(grid, start, stop):
distances, temp = {}, {start: 0}
while len(temp)>0:
# set closest point as definite
x,y = min(temp, key=temp.get)
distance = temp.pop((x,y))
distances[(x,y)] = dist... | grid = [[int(x) for x in line] for line in open('input.txt').read().splitlines()]
def dijkstra(grid, start, stop):
(distances, temp) = ({}, {start: 0})
while len(temp) > 0:
(x, y) = min(temp, key=temp.get)
distance = temp.pop((x, y))
distances[x, y] = distance
nbs = [(x + i, y +... |
class Solution:
def slidingPuzzle(self, board: List[List[int]]) -> int:
# 0 1 2
# 3 4 5
target = '123450'
start = ''.join(map(str, board[0])) + ''.join(map(str, board[1]))
start_idx = start.index('0')
moves = [(1, 3), (0, 2, 4), (1, 5), (0, 4), (1, 3, 5), (2, 4)]
... | class Solution:
def sliding_puzzle(self, board: List[List[int]]) -> int:
target = '123450'
start = ''.join(map(str, board[0])) + ''.join(map(str, board[1]))
start_idx = start.index('0')
moves = [(1, 3), (0, 2, 4), (1, 5), (0, 4), (1, 3, 5), (2, 4)]
step = 0
levels = ... |
# define a class
class Dog(object):
kind = "canine" # class variable
def __init__(self, name):
self.name = name #instance variable
self.tricks = [] #instance variable
def add_trick(self, trick):
self.tricks.append(trick)
# instance of a class
e = Dog('Buddy') #first instance
d = Dog... | class Dog(object):
kind = 'canine'
def __init__(self, name):
self.name = name
self.tricks = []
def add_trick(self, trick):
self.tricks.append(trick)
e = dog('Buddy')
d = dog('Fido')
x = object()
e.add_trick('roll over')
d.add_trick('play dead')
print(e.name, e.tricks)
print(d.name,... |
""" Constant Module of device status """
STATUS_BROKEN=-1
STATUS_UNKNOWN=0
STATUS_WAIT=1
STATUS_RUNNING=2
STATUS_CHARGING=3
STATUS_AUTOPROTECT=4
| """ Constant Module of device status """
status_broken = -1
status_unknown = 0
status_wait = 1
status_running = 2
status_charging = 3
status_autoprotect = 4 |
def main(context):
session = context.session
session.execute("INSERT INTO test (id, name) values (1, 'jon')")
| def main(context):
session = context.session
session.execute("INSERT INTO test (id, name) values (1, 'jon')") |
class ErrorTrapTransport(Exception):
pass
class ConfigNotFoundError(Exception):
pass
class ConfigNotParsedError(Exception):
pass
class MibCompileError(Exception):
pass
class MibCompileFailed(Exception):
pass
class FilterPathError(Exception):
pass
class FilterProcessError(Exception):
pass
c... | class Errortraptransport(Exception):
pass
class Confignotfounderror(Exception):
pass
class Confignotparsederror(Exception):
pass
class Mibcompileerror(Exception):
pass
class Mibcompilefailed(Exception):
pass
class Filterpatherror(Exception):
pass
class Filterprocesserror(Exception):
pa... |
"""Adds repostories/archives."""
########################################################################
# DO NOT EDIT THIS FILE unless you are inside the
# https://github.com/3rdparty/stout-flags repository. If you
# encounter it anywhere else it is because it has been copied there in
# order to simplify adding tran... | """Adds repostories/archives."""
load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
def repos(external=True, repo_mapping={}):
maybe(http_archive, name='com_google_... |
H,W,*A = [x for x in open(0).read().split()]
H=int(H)
W=int(W)
whites=[0]*W
for a in A:
for i,c in enumerate(a):
if c=='.':
whites[i]+=1
checks=[white != H for white in whites]
wline='.'*W
for a in A:
if a == wline:
continue
print(''.join([c for i,c in enumerate(a) if checks[i]])... | (h, w, *a) = [x for x in open(0).read().split()]
h = int(H)
w = int(W)
whites = [0] * W
for a in A:
for (i, c) in enumerate(a):
if c == '.':
whites[i] += 1
checks = [white != H for white in whites]
wline = '.' * W
for a in A:
if a == wline:
continue
print(''.join([c for (i, c) in... |
#
# PySNMP MIB module HARMONIC-INC-NSG9000-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HARMONIC-INC-NSG9000-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:11:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, constraints_intersection, value_size_constraint, single_value_constraint) ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Settings for analysis setup
The information set here
"""
raise NotImplementedError('work in progress...')
#: Base directory for output storage
OUT_BASE = './output/'
# alternative ts_types in case one of the provided in setup is not in dataset
TS_TYPE_READ_ALT = {'d... | """
Settings for analysis setup
The information set here
"""
raise not_implemented_error('work in progress...')
out_base = './output/'
ts_type_read_alt = {'daily': ['hourly', '3hourly'], 'monthly': ['daily', 'hourly', '3hourly']}
ts_type_setup = dict(monthly=['monthly', 'yearly'], daily=['monthly', 'yearly'], read_alt... |
# status: testado com exemplos da prova
if __name__ == '__main__':
N = input()
values = [int(x) for x in input().split()]
max_record = 0
last_record = 0
last_value = 0
for value in values:
last_record += 1
if not value == last_value:
last_record = 1
max_rec... | if __name__ == '__main__':
n = input()
values = [int(x) for x in input().split()]
max_record = 0
last_record = 0
last_value = 0
for value in values:
last_record += 1
if not value == last_value:
last_record = 1
max_record = last_record if last_record > max_reco... |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: param root: The root of the binary search tree
@param k1: An integer
@param k2: An integer
@return: return: Return all keys... | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: param root: The root of the binary search tree
@param k1: An integer
@param k2: An integer
@return: return: Return all keys... |
"""Fantasy Game Inventory."""
stuff = {'rope': 1, 'torch': 6, 'gold coin': 42,
'dagger': 1, 'arrow': 12, 'map fragments': 3}
def display_inventory(inventory):
"""Print contents and total number of items in inventory."""
print('Inventory:')
item_total = 0
for k, v in inventory.items():
... | """Fantasy Game Inventory."""
stuff = {'rope': 1, 'torch': 6, 'gold coin': 42, 'dagger': 1, 'arrow': 12, 'map fragments': 3}
def display_inventory(inventory):
"""Print contents and total number of items in inventory."""
print('Inventory:')
item_total = 0
for (k, v) in inventory.items():
print(s... |
class Solution:
def numIslands(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
if not grid:
return 0
if not len(grid[0]):
return 0
visited = [[0 for i in range(len(grid[0]))] for j in range(len(grid))]
result = 0... | class Solution:
def num_islands(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
if not grid:
return 0
if not len(grid[0]):
return 0
visited = [[0 for i in range(len(grid[0]))] for j in range(len(grid))]
result = 0
... |
P = 1000000007 # edit this
Q = 2210070043 # edit this
N = P * Q
print(f"N={N} -- tell Bob this")
Z = (P - 1) * (Q - 1)
print(f"Z={Z}")
print("Pick a different number between 1 and Z")
E = 49979693 # edit this to be a different prime number between 1 and Z
print(f"E={E} (public key)")
D = pow(E, -1, Z)
print(f"D=... | p = 1000000007
q = 2210070043
n = P * Q
print(f'N={N} -- tell Bob this')
z = (P - 1) * (Q - 1)
print(f'Z={Z}')
print('Pick a different number between 1 and Z')
e = 49979693
print(f'E={E} (public key)')
d = pow(E, -1, Z)
print(f'D={D} (private key)')
c = 653470184995596571
m = pow(C, D, N)
print(f'Secret message M = {M}... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 21 11:52:34 2016
@author: WELG
"""
#####################################
# EXAMPLE: Towers of Hanoi
#####################################
def printMove(fr, to):
print('move from ' + str(fr) + ' to ' + str(to))
def Towers(n, fr, to, spare):
if n == 1:
p... | """
Created on Wed Sep 21 11:52:34 2016
@author: WELG
"""
def print_move(fr, to):
print('move from ' + str(fr) + ' to ' + str(to))
def towers(n, fr, to, spare):
if n == 1:
print_move(fr, to)
else:
towers(n - 1, fr, spare, to)
towers(1, fr, to, spare)
towers(n - 1, spare, t... |
class FileHandler:
"""read input from file and provide states
read state sequence and print out output file"""
def __init__(self,filename):
self.filename=filename
self.testcases=0
self.train_num=[] #list or single value let it be list for now
self.content=None #check1
def readFile(self):
wi... | class Filehandler:
"""read input from file and provide states
read state sequence and print out output file"""
def __init__(self, filename):
self.filename = filename
self.testcases = 0
self.train_num = []
self.content = None
def read_file(self):
with open(self.f... |
# TODO add linters, automated tests, etc
def gos_py_library(name, **kwargs):
native.py_library(
name = name,
**kwargs
)
def gos_py_binary(name, **kwargs):
native.py_binary(
name = name,
**kwargs
)
def gos_py_test(name, **kwargs):
native.py_test(
name = name... | def gos_py_library(name, **kwargs):
native.py_library(name=name, **kwargs)
def gos_py_binary(name, **kwargs):
native.py_binary(name=name, **kwargs)
def gos_py_test(name, **kwargs):
native.py_test(name=name, **kwargs) |
'''
File: __init__.py
Project: optimizer
File Created: Monday, 17th August 2020 3:52:54 pm
Author: Sparsh Dutta (sparsh.dtt@gmail.com)
-----
Last Modified: Monday, 17th August 2020 3:52:54 pm
Modified By: Sparsh Dutta (sparsh.dtt@gmail.com>)
-----
Copyright 2020 Sparsh Dutta
'''
| """
File: __init__.py
Project: optimizer
File Created: Monday, 17th August 2020 3:52:54 pm
Author: Sparsh Dutta (sparsh.dtt@gmail.com)
-----
Last Modified: Monday, 17th August 2020 3:52:54 pm
Modified By: Sparsh Dutta (sparsh.dtt@gmail.com>)
-----
Copyright 2020 Sparsh Dutta
""" |
"""
PASSENGERS
"""
numPassengers = 3262
passenger_arriving = (
(3, 6, 4, 4, 3, 0, 2, 7, 3, 3, 0, 0), # 0
(3, 7, 9, 2, 1, 0, 3, 12, 1, 6, 2, 0), # 1
(3, 10, 6, 3, 0, 0, 6, 6, 7, 5, 0, 0), # 2
(5, 6, 12, 6, 0, 0, 8, 9, 3, 5, 2, 0), # 3
(3, 10, 4, 1, 1, 0, 9, 8, 5, 3, 0, 0), # 4
(4, 8, 3, 6, 2, 0, 5, 7, 7, 4... | """
PASSENGERS
"""
num_passengers = 3262
passenger_arriving = ((3, 6, 4, 4, 3, 0, 2, 7, 3, 3, 0, 0), (3, 7, 9, 2, 1, 0, 3, 12, 1, 6, 2, 0), (3, 10, 6, 3, 0, 0, 6, 6, 7, 5, 0, 0), (5, 6, 12, 6, 0, 0, 8, 9, 3, 5, 2, 0), (3, 10, 4, 1, 1, 0, 9, 8, 5, 3, 0, 0), (4, 8, 3, 6, 2, 0, 5, 7, 7, 4, 0, 0), (3, 8, 9, 5, 4, 0, 4, 10,... |
## =========================================================
## Copyright 2019 Dietrich Bollmann
##
## 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/license... | """newskylabs/utils/generic.py:
Generic utilities...
"""
def set_recursively(structure, path, value):
"""Set a value in a recursive structure."""
path = path.split('.')
lastkey = path.pop()
for key in path:
if not key in structure or not isinstance(structure[key], dict):
structure... |
class Route:
def __init__(self, routes, graph):
self.routes = routes
self.graph = graph
self.v_start = graph[0]
self.dist = self.route_dist()
def route_dist(self):
'''total route distance (fitness)'''
total_dist = 0
for route in self.routes:
... | class Route:
def __init__(self, routes, graph):
self.routes = routes
self.graph = graph
self.v_start = graph[0]
self.dist = self.route_dist()
def route_dist(self):
"""total route distance (fitness)"""
total_dist = 0
for route in self.routes:
... |
#Given two (singly) linked lists, determine if the two lists intersect. Return the intersecting node . Note that the intersetion is defined
#based on reference, not value. That is if kth node of the first linked list is the exact same node(by reference) as the jth node of the
#second linked list, the they are intersec... | class Node:
next = None
def __init__(self, value):
self.value = value
class Linkedlist:
head = None
tail = None
size = 0
def debug(self):
current = self.head
while current:
print(current.value)
current = current.next
def insert(self, value)... |
EPOCHS = 3
LOG_ITER = 25
TEST_ITER = 50
WRITE_PERIOD = 100
#1440 train examples
#360 train examples | epochs = 3
log_iter = 25
test_iter = 50
write_period = 100 |
class BaseLinOp:
def __init__(self):
pass
@property
def T(self):
return Adjoint(self)
def __add__(self, other):
if isinstance(other, BaseLinOp):
return Sum(self, other)
else:
return ScalarSum(self, other)
def __radd__(self, other):
i... | class Baselinop:
def __init__(self):
pass
@property
def t(self):
return adjoint(self)
def __add__(self, other):
if isinstance(other, BaseLinOp):
return sum(self, other)
else:
return scalar_sum(self, other)
def __radd__(self, other):
... |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-LogicalProcessorMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-LogicalProcessorMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:19:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_union, value_size_constraint, constraints_intersection) ... |
'''
Leetcode problem No 81 Search in Rotated Sorted Array II
Solution written by Xuqiang Fang on 11 May, 2018
'''
class Solution(object):
def search(self, nums, target):
"""
:type nums : List[int]
:type target: int
:rtype: bool
"""
if len(nums) == 0 : return False
... | """
Leetcode problem No 81 Search in Rotated Sorted Array II
Solution written by Xuqiang Fang on 11 May, 2018
"""
class Solution(object):
def search(self, nums, target):
"""
:type nums : List[int]
:type target: int
:rtype: bool
"""
if len(nums) == 0:
ret... |
txt = "one one was a race horse, two two was one too."
x = txt.replace("one", "three", 2)
print(x)
| txt = 'one one was a race horse, two two was one too.'
x = txt.replace('one', 'three', 2)
print(x) |
"""
all the different icons we have to represent different types of AIS stations
ICONS(dict): keys are the AIS station type as a string, values are the filename
of the icon
"""
ICONS = {'Base Station': 'basestn.png',
'Class A': 'classa.png',
'Navigation Aid': 'navaid.png',
'Cla... | """
all the different icons we have to represent different types of AIS stations
ICONS(dict): keys are the AIS station type as a string, values are the filename
of the icon
"""
icons = {'Base Station': 'basestn.png', 'Class A': 'classa.png', 'Navigation Aid': 'navaid.png', 'Class B': 'classb.png', 'Unknow... |
description = 'Verify the user can create a new page from the project page'
pages = ['login',
'common',
'index',
'project_pages']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
index.create_access_project('test')
common.navigate_menu('Pages')
def test(data)... | description = 'Verify the user can create a new page from the project page'
pages = ['login', 'common', 'index', 'project_pages']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
index.create_access_project('test')
common.navigate_menu('Pages')
def test(data):
store('page_name', 'pag... |
class PatternLibraryException(Exception):
pass
class TemplateIsNotPattern(PatternLibraryException):
pass
class PatternLibraryEmpty(PatternLibraryException):
pass
| class Patternlibraryexception(Exception):
pass
class Templateisnotpattern(PatternLibraryException):
pass
class Patternlibraryempty(PatternLibraryException):
pass |
def load_input():
cases = open("input.txt", "r").readlines()
for i in range(len(cases)):
cases[i] = cases[i].replace('\n','')
return cases
groups = []
def parse_input():
inp = load_input()
inp_len = len(inp)
group = []
for i in range(inp_len):
line = inp[i]
if line ... | def load_input():
cases = open('input.txt', 'r').readlines()
for i in range(len(cases)):
cases[i] = cases[i].replace('\n', '')
return cases
groups = []
def parse_input():
inp = load_input()
inp_len = len(inp)
group = []
for i in range(inp_len):
line = inp[i]
if line ... |
USCIS_CONFIG = {
'hostname': 'egov.uscis.gov',
'endpoint': '/casestatus/mycasestatus.do',
'querytype': 'CHECK STATUS'
}
| uscis_config = {'hostname': 'egov.uscis.gov', 'endpoint': '/casestatus/mycasestatus.do', 'querytype': 'CHECK STATUS'} |
# -*- coding: utf-8 -*-
bind = '{{ gunicorn_bind }}'
pidfile = '{{ gunicorn_pidfile }}'
proc_name = 'slugify'
user = '{{ web_user }}'
loglevel = 'warn'
errorlog = '-'
accesslog = '-'
| bind = '{{ gunicorn_bind }}'
pidfile = '{{ gunicorn_pidfile }}'
proc_name = 'slugify'
user = '{{ web_user }}'
loglevel = 'warn'
errorlog = '-'
accesslog = '-' |
def quicksort(items):
"""O(n * log n)."""
if len(items) < 2:
return items
else:
pivot_index = len(items) // 2
pivot = items[pivot_index]
left = [num for i, num in enumerate(items) if num <= pivot and i != pivot_index]
right = [num for i, num in enumerate(items) if num... | def quicksort(items):
"""O(n * log n)."""
if len(items) < 2:
return items
else:
pivot_index = len(items) // 2
pivot = items[pivot_index]
left = [num for (i, num) in enumerate(items) if num <= pivot and i != pivot_index]
right = [num for (i, num) in enumerate(items) if... |
budget_for_the_film = float(input("Enter the budget for the film: "))
number_of_extras = int(input("Enter the number of extras: "))
clothes_price_per_extra = float(input("Enter the price of the clothes per extra: "))
decor_price = budget_for_the_film * 0.1
clothes_price = number_of_extras * clothes_price_per_extra
if... | budget_for_the_film = float(input('Enter the budget for the film: '))
number_of_extras = int(input('Enter the number of extras: '))
clothes_price_per_extra = float(input('Enter the price of the clothes per extra: '))
decor_price = budget_for_the_film * 0.1
clothes_price = number_of_extras * clothes_price_per_extra
if n... |
class graph(object):
def __init__(self, nodes, edge_list = None):
self.N = nodes
self.A = [[False for i in range(self.N+1)] for j in range(self.N+1)] # initialise the adjacency matrix as an (N+1)*(N+1) array, so we can use indexes from 1.
if edge_list != None: # let's optionally give this c... | class Graph(object):
def __init__(self, nodes, edge_list=None):
self.N = nodes
self.A = [[False for i in range(self.N + 1)] for j in range(self.N + 1)]
if edge_list != None:
for x in edge_list:
self.set_edge(x)
def is_valid_tuple(self, x):
return isi... |
#
# PySNMP MIB module UCD-SNMP-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/UCD-SNMP-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:32:22 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:52)
#
( Oc... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint, constraints_union) ... |
def printing(T):
print (f'hello {T}')
w=__name__
if w=="__main__":
printing("wajaht") | def printing(T):
print(f'hello {T}')
w = __name__
if w == '__main__':
printing('wajaht') |
x = [1, [2, None]]
y = [1, 2]
z = [1, 2]
x[1][0] = y # should nudge y to over the right
z[1] = x # should nudge BOTH x and y over to the right
| x = [1, [2, None]]
y = [1, 2]
z = [1, 2]
x[1][0] = y
z[1] = x |
"""
Regular expression matching using simplified and memoized Brzozowski
derivatives.
"""
def match(re, s):
for c in s:
re = re(c)
return re.nullable
def mark(nullable, deriv):
deriv.nullable = nullable
return deriv
fail = mark(False, lambda c: fail)
empty = mark(True, lambda c: fail)
def _l... | """
Regular expression matching using simplified and memoized Brzozowski
derivatives.
"""
def match(re, s):
for c in s:
re = re(c)
return re.nullable
def mark(nullable, deriv):
deriv.nullable = nullable
return deriv
fail = mark(False, lambda c: fail)
empty = mark(True, lambda c: fail)
def _li... |
# earth_coords.py
#
# For coordinates relative to Earth's surface,
# in terms of latitude, longitude, and altitude.
# All stored as floats.
#
# E.g., the GPS antenna in our window in the APCR-DRDL lab is at:
# latitude = 30.428236 degrees (N)
# longitude = -84.285 degrees (W)
# altitude = 40 m... | __all__ = ['EarthCoords']
class Earthcoords:
def __init__(this, lat, long, alt):
this.lat = lat
this.long = long
this.alt = alt
def deg_to_degmin(degrees):
intdeg = int(degrees)
fracdeg = abs(degrees - intdeg)
minutes = fracdeg * 60
return (intdeg, minutes)
def deg_to_deg... |
class Car:
someStaticPublicVar = 'Abc'
def __init__(self, name, make, year):
self.name = name
self.make = make
self.year = year
def drive(self):
print(self.name + " started")
@staticmethod
def hello():
print("Hello from car")
@classmethod
def show(... | class Car:
some_static_public_var = 'Abc'
def __init__(self, name, make, year):
self.name = name
self.make = make
self.year = year
def drive(self):
print(self.name + ' started')
@staticmethod
def hello():
print('Hello from car')
@classmethod
def sh... |
# Author : @Moglten
# Fizz , Buzz and Fizzbuzz
# from 1 to 100
def printFizzBuzz(n) :
for x in range(1,n+1) : print(x) if print_FizzBuzz(x) else None
def print_FizzBuzz(n):
if n % 5 == n % 3 == 0:
print( "FizzBuzz" )
return False
else: return print_Buzz( n )
def print_Buz... | def print_fizz_buzz(n):
for x in range(1, n + 1):
print(x) if print__fizz_buzz(x) else None
def print__fizz_buzz(n):
if n % 5 == n % 3 == 0:
print('FizzBuzz')
return False
else:
return print__buzz(n)
def print__buzz(n):
if n % 5 == 0:
print('Buzz')
retur... |
def Union2SortedArrays(arr1, arr2):
m = arr1[-1]
n = arr2[-1]
ans = 0
if m > n:
ans = m
else:
ans = n
returner = []
newtable = [0] * (ans + 1)
returner.append(arr1[0])
newtable[arr1[0]] += 1
for i in range(1, len(arr1)):
if arr1[i] != arr1[i - 1]:
returner.append(arr1[i])
n... | def union2_sorted_arrays(arr1, arr2):
m = arr1[-1]
n = arr2[-1]
ans = 0
if m > n:
ans = m
else:
ans = n
returner = []
newtable = [0] * (ans + 1)
returner.append(arr1[0])
newtable[arr1[0]] += 1
for i in range(1, len(arr1)):
if arr1[i] != arr1[i - 1]:
... |
"""Module containing an exception class for Surgeo"""
class SurgeoException(Exception):
"""This is an application specific Exception class."""
pass
| """Module containing an exception class for Surgeo"""
class Surgeoexception(Exception):
"""This is an application specific Exception class."""
pass |
#!/usr/bin/env python
# encoding: utf-8
class Solution:
def nthUglyNumber(self, n: int) -> int:
if n == 0: return 0
seen = {1, }
heap = []
heapq.heappush(heap, 1)
for _ in range(n):
ugly_number = heapq.heappop(heap)
for i in [2, 3, 5]:
... | class Solution:
def nth_ugly_number(self, n: int) -> int:
if n == 0:
return 0
seen = {1}
heap = []
heapq.heappush(heap, 1)
for _ in range(n):
ugly_number = heapq.heappop(heap)
for i in [2, 3, 5]:
new_ugly = ugly_number * i
... |
filename = 'alice.txt'
# with open(filename, encoding='utf-8') as file_object:
# contents = file_object.read()
try:
with open(filename, encoding='utf-8') as file_object:
contents = file_object.read()
except FileNotFoundError:
print(f"Sorry, the file {filename} does not exist.")
else:
# Calculat... | filename = 'alice.txt'
try:
with open(filename, encoding='utf-8') as file_object:
contents = file_object.read()
except FileNotFoundError:
print(f'Sorry, the file {filename} does not exist.')
else:
words = contents.split()
num_words = len(words)
print(f'The file {filename} has about {num_word... |
# Basic Calculator II: https://leetcode.com/problems/basic-calculator-ii/
# Given a string s which represents an expression, evaluate this expression and return its value.
# The integer division should truncate toward zero.
# Note: You are not allowed to use any built-in function which evaluates strings as mathematica... | class Solution:
def calculate(self, s: str) -> int:
if len(s) == 0:
return 0
(operand, sign) = (0, '+')
stack = []
for i in range(len(s)):
char = s[i]
if char is not ' ':
if char.isdigit():
operand = operand * 1... |
class Solution:
def __init__(self):
self.keys = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
'7': 'pqrs',
'8': 'tuv',
'9': 'wxyz'
}
# straightforward solution, easier to understand
... | class Solution:
def __init__(self):
self.keys = {'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz'}
def letter_combinations(self, digits: str) -> list[str]:
if digits == '':
return []
results = ['']
for digit in digits:... |
wildcards = ['wildcard1', 'wildcard2', 'wildcard3', 'wildcard4']
class Player:
def __init__(self, name, rfid, skills):
self.name = name
self.rfid = rfid
self.skills = skills
def __str__(self):
return 'Player {} ({}, {})'.format(self.name, self.rfid, list(self.skills))
def ... | wildcards = ['wildcard1', 'wildcard2', 'wildcard3', 'wildcard4']
class Player:
def __init__(self, name, rfid, skills):
self.name = name
self.rfid = rfid
self.skills = skills
def __str__(self):
return 'Player {} ({}, {})'.format(self.name, self.rfid, list(self.skills))
def... |
saarc = [
'Afganistan',
'Bangladesh',
'Bhutan',
'Nepal',
'India',
'Pakistan',
'Sri Lanka'
]
print(saarc)
if "Bangladesh" in saarc:
print("Bangladesh is in Saarc")
| saarc = ['Afganistan', 'Bangladesh', 'Bhutan', 'Nepal', 'India', 'Pakistan', 'Sri Lanka']
print(saarc)
if 'Bangladesh' in saarc:
print('Bangladesh is in Saarc') |
def isOneAway(s1, s2):
if len(s1) == len(s2):
# check replace
replace = False
for c1, c2 in zip(s1, s2):
if c1 != c2:
if replace:
return False
else:
replace = True
return True
elif len(s1) == len(... | def is_one_away(s1, s2):
if len(s1) == len(s2):
replace = False
for (c1, c2) in zip(s1, s2):
if c1 != c2:
if replace:
return False
else:
replace = True
return True
elif len(s1) == len(s2) + 1:
del... |
class Coord:
def __init__(self, x, y):
self.x = x
self.y = y
class Ball:
def __init__(self, x, y):
self.diameter = 0.1
self.x = x
self.y = y
self.coord = Coord(x,y)
class ObjectBall(Ball):
pass
class One(ObjectBall):
pass
class Two(ObjectBall):
pas... | class Coord:
def __init__(self, x, y):
self.x = x
self.y = y
class Ball:
def __init__(self, x, y):
self.diameter = 0.1
self.x = x
self.y = y
self.coord = coord(x, y)
class Objectball(Ball):
pass
class One(ObjectBall):
pass
class Two(ObjectBall):
... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Copyright 2017 Ronnasayd Machado <ronnasayd@hotmail.com>
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.... | """
Copyright 2017 Ronnasayd Machado <ronnasayd@hotmail.com>
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 or agr... |
class ZomatoLocation():
def __init(self, entity_type, entity_id, title, latitude, longitude, city_id, city_name, country_id, country_name):
self.entity_type = entity_type
self.entity_id = entity_id
self.title = title
self.latitude = latitude
self.longitude = longitude
... | class Zomatolocation:
def __init(self, entity_type, entity_id, title, latitude, longitude, city_id, city_name, country_id, country_name):
self.entity_type = entity_type
self.entity_id = entity_id
self.title = title
self.latitude = latitude
self.longitude = longitude
... |
g=open(accountList, r)
pickle.load(adminUsers)
print("Welcome to AdminTools!")
print("Please enter your official AdminTools account credentials:")
print("NOTE: You may enter your PythonG Live account credentials if you have access.")
print("Please enter your admin username:")
adminu = input()
print("Please enter your a... | g = open(accountList, r)
pickle.load(adminUsers)
print('Welcome to AdminTools!')
print('Please enter your official AdminTools account credentials:')
print('NOTE: You may enter your PythonG Live account credentials if you have access.')
print('Please enter your admin username:')
adminu = input()
print('Please enter your... |
# Event: LCCS Python Fundamental Skills Workshop
# Date: Dec 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Purpose: A program to demonstrate recursion
def fib(n):
"""Recursive function to
return the nth Fibonacci number """
if n <= 1:
return n
else:
return(fi... | def fib(n):
"""Recursive function to
return the nth Fibonacci number """
if n <= 1:
return n
else:
return fib(n - 1) + fib(n - 2)
for i in range(10):
print(fib(i), end=' ') |
"""
164. Maximum Gap
Example 1:
Input: [3,6,9,1]
Output: 3
Explanation: The sorted form of the array is [1,3,6,9], either
(3,6) or (6,9) has the maximum difference 3.
Example 2:
Input: [10]
Output: 0
Explanation: The array contains less than 2 elements, therefore return 0.
"""
class Sol... | """
164. Maximum Gap
Example 1:
Input: [3,6,9,1]
Output: 3
Explanation: The sorted form of the array is [1,3,6,9], either
(3,6) or (6,9) has the maximum difference 3.
Example 2:
Input: [10]
Output: 0
Explanation: The array contains less than 2 elements, therefore return 0.
"""
class Solution:
def... |
'''
Copyright [2020] [Timothy Chua]
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 or agreed to in writing, software
... | """
Copyright [2020] [Timothy Chua]
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 or agreed to in writing, software
... |
"""
NOTE:
the below code is to be maintained Python 2.x-compatible
as the whole Cookiecutter Django project initialization
can potentially be run in Python 2.x environment.
TODO: ? restrict Cookiecutter Django project initialization to Python 3.x environments only
"""
project_slug = '{{ cookiecutter.proje... | """
NOTE:
the below code is to be maintained Python 2.x-compatible
as the whole Cookiecutter Django project initialization
can potentially be run in Python 2.x environment.
TODO: ? restrict Cookiecutter Django project initialization to Python 3.x environments only
"""
project_slug = '{{ cookiecutter.projec... |
D, J = [map(int, input().split()) for _ in range(2)]
ans = 0
for d, j in zip(D, J):
ans += max(d, j)
print(ans)
| (d, j) = [map(int, input().split()) for _ in range(2)]
ans = 0
for (d, j) in zip(D, J):
ans += max(d, j)
print(ans) |
#!/usr/bin/python3.4
count = 0
while count < 9:
print("The count is: ", count)
count = count + 1
print("Good bye")
| count = 0
while count < 9:
print('The count is: ', count)
count = count + 1
print('Good bye') |
"""
@Author: Abel Hristodor
@Description: SDA (AZS) Telegram bot made for Romanian churches
@Date: 10/12/2020
@Github: github.com/AbelHristodor/azs-telegram-bot
Contains the messages used by the bot.
"""
WELCOME_MESSAGE = "<i>Bine ati venit in grupul Bisericii Adventiste de Ziua a Saptea din Verona: <strong>$user</st... | """
@Author: Abel Hristodor
@Description: SDA (AZS) Telegram bot made for Romanian churches
@Date: 10/12/2020
@Github: github.com/AbelHristodor/azs-telegram-bot
Contains the messages used by the bot.
"""
welcome_message = '<i>Bine ati venit in grupul Bisericii Adventiste de Ziua a Saptea din Verona: <strong>$user</st... |
def ColourNames(filename) -> dict:
rtn = {}
with open(filename) as handle:
for line in handle:
line = line.strip()
r, g, b, name = line.split(maxsplit=3)
rtn[name] = [int(r), int(g), int(b)]
return rtn
| def colour_names(filename) -> dict:
rtn = {}
with open(filename) as handle:
for line in handle:
line = line.strip()
(r, g, b, name) = line.split(maxsplit=3)
rtn[name] = [int(r), int(g), int(b)]
return rtn |
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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
#
# U... | alarm_conf_absolute = {'default': {'rusage_user': (500000, 1000000, None), 'rusage_system': (500000, 1000000, None), 'evictions': (80000, 100000, 120000), 'reclaimed': (80000, None, None), 'cmd_get': (40000, 80000, 200000), 'cmd_set': (40000, 80000, 200000)}, 'band': {'evictions': (150000, 150000, 200000)}}
alarm_conf_... |
# model
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{3, 2, 2, 2}")
i2 = Input("op2", "TENSOR_FLOAT32", "{2, 2}")
act = Int32Scalar("act", 0) # an int32_t scalar fuse_activation
i3 = Output("op3", "TENSOR_FLOAT32", "{3, 2, 2, 2}")
model = model.Operation("SUB", i1, i2, act).To(i3)
# Example 1. Input in operand... | model = model()
i1 = input('op1', 'TENSOR_FLOAT32', '{3, 2, 2, 2}')
i2 = input('op2', 'TENSOR_FLOAT32', '{2, 2}')
act = int32_scalar('act', 0)
i3 = output('op3', 'TENSOR_FLOAT32', '{3, 2, 2, 2}')
model = model.Operation('SUB', i1, i2, act).To(i3)
input0 = {i1: [0.02648412, 0.12737854, 0.92319058, 0.60023185, 0.35821535... |
# int: signed, unlimited signed precision integer
# specified in decimal by default
print("Decimal 10: " + str(10))
print("Binary 10: " + str(0b10))
print("Octal 10: " + str(0o10))
print("Hex 10: " + str(0x10))
# Conversation from float (rounded off to nearest int towards 0)
print("3.5 in int is " + str(in... | print('Decimal 10: ' + str(10))
print('Binary 10: ' + str(2))
print('Octal 10: ' + str(8))
print('Hex 10: ' + str(16))
print('3.5 in int is ' + str(int(3.5)))
print('3.6 in int is ' + str(int(3.6)))
print('-3.6 in int is ' + str(int(-3.6)))
print('String 456 to int: ' + str(int('456')))
print('A floating point number: ... |
load("@rules_jvm_external//:defs.bzl", "maven_install")
def hocon_repositories():
maven_install(
name = "hocon_maven",
artifacts = [
"com.typesafe:config:1.3.3",
"org.rogach:scallop_2.12:3.3.2",
],
repositories = [
"https://repo.maven.apache.org/m... | load('@rules_jvm_external//:defs.bzl', 'maven_install')
def hocon_repositories():
maven_install(name='hocon_maven', artifacts=['com.typesafe:config:1.3.3', 'org.rogach:scallop_2.12:3.3.2'], repositories=['https://repo.maven.apache.org/maven2', 'https://maven-central.storage-download.googleapis.com/maven2', 'https:... |
#The database URI that should be used for the connection.
#fomate: dialect+driver://username:password@host:port/database
#mysql format : mysql://scott:tiger@localhost/database_name
SQLALCHEMY_DATABASE_URI = 'mysql://root:63005610@localhost/cuit_acm'
#A dictionary that maps bind keys to SQLAlchemy connection URIs.
SQL... | sqlalchemy_database_uri = 'mysql://root:63005610@localhost/cuit_acm'
sqlalchemy_binds = {}
admin = ['Rayn', 'dreameracm']
oj_map = {'hdu': 'HDU', 'cf': 'Codeforces', 'bc': 'BestCoder', 'poj': 'POJ', 'uva': 'UVA', 'zoj': 'ZOJ', 'bnu': 'BNU', 'vj': 'Virtual Judge'}
server_time_deltta = 6
csrf_enabled = True
secret_key = ... |
# a2_q2.py
def check_teams(graph, csp_sol):
total_var = len(csp_sol)
for i in range(total_var):
for j in range(1,total_var):
if csp_sol[i] == csp_sol[j]:
if j in graph[i]:
return False
return True
| def check_teams(graph, csp_sol):
total_var = len(csp_sol)
for i in range(total_var):
for j in range(1, total_var):
if csp_sol[i] == csp_sol[j]:
if j in graph[i]:
return False
return True |
SHAPES = ['pin', 'airport', 'hospital', 'home', 'dot', 'start', 'heart',
'flag']
COLORS = {
'amber' : ('FFC107', 'FF6F00'),
'blakwhite' : ('000000', 'FFFFFF'),
'blue' : ('2196F3', '0D47A1'),
'bluewhite' : ('0277BD', 'FFFFFF'),
'cyan' : ('00BCD4', '006064'),
'deeppurple':... | shapes = ['pin', 'airport', 'hospital', 'home', 'dot', 'start', 'heart', 'flag']
colors = {'amber': ('FFC107', 'FF6F00'), 'blakwhite': ('000000', 'FFFFFF'), 'blue': ('2196F3', '0D47A1'), 'bluewhite': ('0277BD', 'FFFFFF'), 'cyan': ('00BCD4', '006064'), 'deeppurple': ('673AB7', '311B92'), 'deeporange': ('FF5722', 'BF360C... |
"""
You have d dice, and each die has f faces numbered 1, 2, ..., f.
Return the number of possible ways (out of fd total ways) modulo 10^9 + 7 to
roll the dice so the sum of the face up numbers equals target.
Example 1:
Input: d = 1, f = 6, target = 3 Output: 1
Explanation: You... | """
You have d dice, and each die has f faces numbered 1, 2, ..., f.
Return the number of possible ways (out of fd total ways) modulo 10^9 + 7 to
roll the dice so the sum of the face up numbers equals target.
Example 1:
Input: d = 1, f = 6, target = 3 Output: 1
Explanation: You... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.