content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Policy(object):
def __init__(self, action=""):
self.action = action
def get_action(self, state):
return self.action | class Policy(object):
def __init__(self, action=''):
self.action = action
def get_action(self, state):
return self.action |
def is_prime(n):
if n % 2 == 0:
return False
for i in range(3, int(n**0.5) + 1, 2):
if n % i == 0:
return False
return True
input = int(input("Enter a number: "))
factors = [1]
if input % 2 == 0:
factors.append(2)
for x in range(3, int(input / 2) + 1):
if input % x == 0:
if is_prime(x) ... | def is_prime(n):
if n % 2 == 0:
return False
for i in range(3, int(n ** 0.5) + 1, 2):
if n % i == 0:
return False
return True
input = int(input('Enter a number: '))
factors = [1]
if input % 2 == 0:
factors.append(2)
for x in range(3, int(input / 2) + 1):
if input % x == 0... |
''' .strip returms a copy and removes the whitespace
replace() searchs for a string and then replaces it
greet = 'Hello Bob'
nstr = greet.replace('Bob', 'Jane' )
print(nstr)
nstr = greet.replace('o', 'X' )
print(nstr)
'''
'''facy format operator
camels = 42
camCount = 'I have spotted %d camels' % camels
print(camCoun... | """ .strip returms a copy and removes the whitespace
replace() searchs for a string and then replaces it
greet = 'Hello Bob'
nstr = greet.replace('Bob', 'Jane' )
print(nstr)
nstr = greet.replace('o', 'X' )
print(nstr)
"""
"facy format operator\ncamels = 42 \ncamCount = 'I have spotted %d camels' % camels\nprint(camCou... |
REQ_TITLES = {
'1.1': 'Transport Layer Security Validation',
'1.2': 'HSTS Validation',
'2': 'Cache Control',
'3': 'Validity of Domain Registration and TLS Certificates',
'4': 'Domain and Subdomain Takeover',
'5': 'Authentication and Authorization of Application Resources',
'6': 'Authenticati... | req_titles = {'1.1': 'Transport Layer Security Validation', '1.2': 'HSTS Validation', '2': 'Cache Control', '3': 'Validity of Domain Registration and TLS Certificates', '4': 'Domain and Subdomain Takeover', '5': 'Authentication and Authorization of Application Resources', '6': 'Authentication and Authorization of Store... |
# Use this with GIMP
# Copy and paste into the terminal
# Last time i tested it didn't work
# But sometimes it does
def save_mod(filename):
img = pdb.gimp_file_load(filename, filename)
img.scale(41,26)
new_filename = '/'.join(filename.split('/')[0:-1]) + "/medium/" + filename.split('/')[-1]
pdb.gimp_file_save(img... | def save_mod(filename):
img = pdb.gimp_file_load(filename, filename)
img.scale(41, 26)
new_filename = '/'.join(filename.split('/')[0:-1]) + '/medium/' + filename.split('/')[-1]
pdb.gimp_file_save(img, img.layers[0], new_filename, new_filename)
img = pdb.gimp_file_load(filename, filename)
img.sca... |
largest = -1
print("Starting now: ", largest)
for i in [5, 9, 12, 28, 74, 41, 55]:
if i > largest:
largest = i
print("Largest now: ", largest)
print("Finally: ", largest) | largest = -1
print('Starting now: ', largest)
for i in [5, 9, 12, 28, 74, 41, 55]:
if i > largest:
largest = i
print('Largest now: ', largest)
print('Finally: ', largest) |
a = 1
b = 2
acc = 0
while a < 4000000 or b < 4000000:
if a < 4000000 and not a%2: acc += a
if b < 4000000 and not b%2: acc += b
a += b
b += a
print(acc)
| a = 1
b = 2
acc = 0
while a < 4000000 or b < 4000000:
if a < 4000000 and (not a % 2):
acc += a
if b < 4000000 and (not b % 2):
acc += b
a += b
b += a
print(acc) |
IT_RRVV = 0
IT_N = 1
IT_RRVV64 = 2
IT_VIRTUAL = 3
IT_INVALID = 4
class OpCode:
def __init__(self, i, itype, iname):
self.i = i
self.type = itype
self.name = iname
OPCODES = {
"MOV": OpCode(0, IT_RRVV, "MOV"),
"MOV8": OpCode(1, IT_RRVV, "MOV8"),
"MOV16": OpCode(2, IT_RRVV, "MOV16"),
"PUSH"... | it_rrvv = 0
it_n = 1
it_rrvv64 = 2
it_virtual = 3
it_invalid = 4
class Opcode:
def __init__(self, i, itype, iname):
self.i = i
self.type = itype
self.name = iname
opcodes = {'MOV': op_code(0, IT_RRVV, 'MOV'), 'MOV8': op_code(1, IT_RRVV, 'MOV8'), 'MOV16': op_code(2, IT_RRVV, 'MOV16'), 'PUSH... |
lista = list()
while True:
entrada = input()
if entrada == '0 0 0 0':
break
entrada = entrada.split()
for pos, elemento in enumerate(entrada):
entrada[pos] = int(elemento)
posicaoAtual = entrada[0:2]
posicaoFinal = entrada[2:]
posicao = [posicaoAtual, posicaoFinal]
lista.... | lista = list()
while True:
entrada = input()
if entrada == '0 0 0 0':
break
entrada = entrada.split()
for (pos, elemento) in enumerate(entrada):
entrada[pos] = int(elemento)
posicao_atual = entrada[0:2]
posicao_final = entrada[2:]
posicao = [posicaoAtual, posicaoFinal]
li... |
def run():
dev = __proxy__['junos.conn']()
op = dev.rpc.get_ospf_interface_information(interface_name="[efgx][et]-*")
interface_names = [i.text for i in op.xpath('ospf-interface/interface-name')]
ret = []
for interface_name in interface_names:
item = __salt__['fpc.get_mapping_from_interface'... | def run():
dev = __proxy__['junos.conn']()
op = dev.rpc.get_ospf_interface_information(interface_name='[efgx][et]-*')
interface_names = [i.text for i in op.xpath('ospf-interface/interface-name')]
ret = []
for interface_name in interface_names:
item = __salt__['fpc.get_mapping_from_interface'... |
def find_pattern_match_length(input, input_offset, match_offset, max_length):
length = 0
while length <= max_length and input_offset + length < len(input) and match_offset + length < len(input) and input[input_offset + length] == input[match_offset + length]:
length += 1
return length
... | def find_pattern_match_length(input, input_offset, match_offset, max_length):
length = 0
while length <= max_length and input_offset + length < len(input) and (match_offset + length < len(input)) and (input[input_offset + length] == input[match_offset + length]):
length += 1
return length
def find_... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"save_16bit": "README.ipynb",
"distort_coords": "README.ipynb",
"undistort_array": "README.ipynb",
"get_essential": "README.ipynb",
"get_fundamental": "README.ipynb",
... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'save_16bit': 'README.ipynb', 'distort_coords': 'README.ipynb', 'undistort_array': 'README.ipynb', 'get_essential': 'README.ipynb', 'get_fundamental': 'README.ipynb', 'fusi_rigid_rect': 'README.ipynb', 'fusi_cam_rect': 'README.ipynb', 'rect_homograp... |
#Write a short Python function that takes a positive integer n and returns
#the sum of the squares of all odd positive integers smaller than n.
def sumOfSquareN(n):
sum=0
for i in range(1,n):
if i&1 != 0:
sum += i**2
return sum
n = int(input('please input an positive integer:'))
print(su... | def sum_of_square_n(n):
sum = 0
for i in range(1, n):
if i & 1 != 0:
sum += i ** 2
return sum
n = int(input('please input an positive integer:'))
print(sum_of_square_n(n)) |
EMAIL_ERROR_MESSAGES = {
"min_length": "Email must be atleast 8 chararcters long",
"required": "Email is required",
"blank": "Email is required",
}
PASSWORD_ERROR_MESSAGES = {
"min_length": "Password must be atleast 8 chararcters long",
"required": "Password is required",
"blank": "Password is ... | email_error_messages = {'min_length': 'Email must be atleast 8 chararcters long', 'required': 'Email is required', 'blank': 'Email is required'}
password_error_messages = {'min_length': 'Password must be atleast 8 chararcters long', 'required': 'Password is required', 'blank': 'Password is required'}
phone_number_error... |
# Given 2 strings, a and b, return a string of the form short+long+short, with the
# shorter string on the outside and the longer string on the inside. The strings will
# not be the same length, but they may be empty ( length 0 ).
# For example:
# solution("1", "22") # returns "1221"
# solution("22", "1") # returns... | def solution(a, b):
return a + b + a if len(a) < len(b) else b + a + b
def test_solution():
assert solution('45', '1') == '1451'
assert solution('13', '200') == '1320013'
assert solution('Soon', 'Me') == 'MeSoonMe'
assert solution('U', 'False') == 'UFalseU' |
def eig(self,curNode):
self._CodeGen__emitCode("np.linalg.eig(")
self._CodeGen__genExp(curNode.child[0])
self._CodeGen__visitSibling(curNode.child[0],self._CodeGen__genExp,", ")
self._CodeGen__emitCode(")")
| def eig(self, curNode):
self._CodeGen__emitCode('np.linalg.eig(')
self._CodeGen__genExp(curNode.child[0])
self._CodeGen__visitSibling(curNode.child[0], self._CodeGen__genExp, ', ')
self._CodeGen__emitCode(')') |
cont_feat_events = [
"INVOICE_VALUE_GBP_log",
"FEE_INVOICE_ratio",
"MARGIN_GBP",
]
cont_feat_profiles = ["AGE_YEARS"]
discr_feat_events = [
"ACTION_STATE",
"ACTION_TYPE",
"BALANCE_STEP_TYPE",
"BALANCE_TRANSACTION_TYPE",
"PRODUCT_TYPE",
"SENDER_TYPE",
"SOURCE_CURRENCY",
"SUCC... | cont_feat_events = ['INVOICE_VALUE_GBP_log', 'FEE_INVOICE_ratio', 'MARGIN_GBP']
cont_feat_profiles = ['AGE_YEARS']
discr_feat_events = ['ACTION_STATE', 'ACTION_TYPE', 'BALANCE_STEP_TYPE', 'BALANCE_TRANSACTION_TYPE', 'PRODUCT_TYPE', 'SENDER_TYPE', 'SOURCE_CURRENCY', 'SUCCESSFUL_ACTION', 'TARGET_CURRENCY']
discr_feat_pro... |
# variaveis de classe
class A:
vc = 123
a1 = A()
a2 = A()
| class A:
vc = 123
a1 = a()
a2 = a() |
day = "day11"
filepath_data = f"input/{day}.txt"
filepath_example = f"input/{day}-example.txt"
Coordinate = tuple[int, int]
CoordList = list[Coordinate]
OctopusMap = list[list[int]]
class OctopusLevels:
def __init__(self, map_str: str) -> None:
self.map = map_str
@property
def map(self) -> Octop... | day = 'day11'
filepath_data = f'input/{day}.txt'
filepath_example = f'input/{day}-example.txt'
coordinate = tuple[int, int]
coord_list = list[Coordinate]
octopus_map = list[list[int]]
class Octopuslevels:
def __init__(self, map_str: str) -> None:
self.map = map_str
@property
def map(self) -> Octo... |
#Sort Stack: Write a program to sort a stack such that the smallest items are on the top. You can use
#an additional temporary stack, but you may not copy the elements into any other data structure
#(such as an array). The stack supports the following operations: push, pop, peek, and is Empty.
# do I implement inside o... | class Llist:
value = None
next = None
def __init__(self):
pass
def print_list(self):
if self.next is None:
print(self.value)
return
print(self.value, end=' ')
return self.next.print_list()
class Nclassicstack:
def __init__(self):
se... |
class Link():
def __init__(self):
self.id = None
self.source = None
self.target = None
self.quality = None
self.type = None
class LinkConnector():
def __init__(self):
self.id = None
self.interface = None
def __repr__(self):
return "LinkConnector(%d, %s)" % (self.id, self.interfac... | class Link:
def __init__(self):
self.id = None
self.source = None
self.target = None
self.quality = None
self.type = None
class Linkconnector:
def __init__(self):
self.id = None
self.interface = None
def __repr__(self):
return 'LinkConnecto... |
#
# PySNMP MIB module ChrComPmDs3DS3-Current-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ChrComPmDs3DS3-Current-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:19:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ... |
HEART_BEAT_INTERVAL = 1
SEND_ENTRIES_INTERVAL = 0.1
FOLLOWER_TIMEOUT = 5
CANDIDATE_TIMEOUT = 5
| heart_beat_interval = 1
send_entries_interval = 0.1
follower_timeout = 5
candidate_timeout = 5 |
budget = float(input())
price_flour = float(input())
price_eggs = price_flour * 0.75
price_milk = 1.25 * price_flour
cozunacs_made = 0
one_cozunac = price_eggs + price_flour + (price_milk / 4)
colored_eggs = 0
while True:
budget -= one_cozunac
cozunacs_made += 1
colored_eggs += 3
if cozunacs_made % 3 ==... | budget = float(input())
price_flour = float(input())
price_eggs = price_flour * 0.75
price_milk = 1.25 * price_flour
cozunacs_made = 0
one_cozunac = price_eggs + price_flour + price_milk / 4
colored_eggs = 0
while True:
budget -= one_cozunac
cozunacs_made += 1
colored_eggs += 3
if cozunacs_made % 3 == 0... |
'''
Created on 1.12.2016
@author: Darren
''''''
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
set... | """
Created on 1.12.2016
@author: Darren
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
set(key, value) - Se... |
# subplotable.py
# by Behnam Heydarshahi, October 2017
# Empirical/Programming Assignment 2
# COMP 135 Machine Learning
#
# This class models data needed for a single sub plot
class SubPlotable:
def __init__(self, label, x_values, y_values, y_std_error_values):
self.label = label
self.x_values... | class Subplotable:
def __init__(self, label, x_values, y_values, y_std_error_values):
self.label = label
self.x_values = x_values
self.y_values = y_values
self.y_std_err_values = y_std_error_values |
''' When all lookups failed. This module provides a last chance to get a config value.
i.e. A system level default values for Config variables.
If a variable is not defined in this file, it will throw an error if the following
checks failed:
- a configuration in the default configuration file (in t... | """ When all lookups failed. This module provides a last chance to get a config value.
i.e. A system level default values for Config variables.
If a variable is not defined in this file, it will throw an error if the following
checks failed:
- a configuration in the default configuration file (in t... |
# Given a list of N positive weights
#divide the list into two lists such that the sum of weights in both lists are equal
#The problem is solved using dynamic approch
#find_subset finds a subset from list weights whoes sum is goal
#returns list of subset if found else empty list
def find_subset(weight,n,goal):
... | def find_subset(weight, n, goal):
table = [[False for i in range(goal + 1)] for i in range(n + 1)]
for i in range(n + 1):
table[i][0] = True
for i in range(1, goal + 1):
table[0][i] = False
for i in range(1, n + 1):
for j in range(1, goal + 1):
if j < weight[i - 1]:
... |
# -*- coding: utf-8 -*-
class Session(object):
ID = 0
def __init__(self):
self.responsed = False # if responsed to client
self.client_addr = None # client addr
self.req_data = None # client request
self.send_ts = 0 # ts to send to ... | class Session(object):
id = 0
def __init__(self):
self.responsed = False
self.client_addr = None
self.req_data = None
self.send_ts = 0
self.server_resps = {}
self.sid = self.__class__.ID
self.__class__.ID += 1 |
with open('input.txt') as file:
line = file.readline().split(',')
fish = []
for f in line:
fish.append(int(f))
for day in range(80):
newfish = []
for i in range(len(fish)):
fish[i] = fish[i] - 1
if fish[i] == -1:
fish[i] = 6
... | with open('input.txt') as file:
line = file.readline().split(',')
fish = []
for f in line:
fish.append(int(f))
for day in range(80):
newfish = []
for i in range(len(fish)):
fish[i] = fish[i] - 1
if fish[i] == -1:
fish[i] = 6
... |
class IContent:
pass
class Content(IContent):
def __str__(self):
return str(vars(self))
| class Icontent:
pass
class Content(IContent):
def __str__(self):
return str(vars(self)) |
class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def insert_node(root_node, new_node):
if new_node.value > root_node.value:
if root_node.right is None:
root_node.right = new_node
else:
insert_node(root_node.right, new_node)
else:
if root_node.left is Non... | class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def insert_node(root_node, new_node):
if new_node.value > root_node.value:
if root_node.right is None:
root_node.right = new_node
else:
insert_node(root_... |
def quickSort(alist):
quickSortHelper(alist,0,len(alist)-1)
def quickSortHelper(alist, first, last):
if first >= last:
return
splitpoint = partition(alist, first, last)
quickSortHelper(alist, first, splitpoint-1)
quickSortHelper(alist, splitpoint+1, last)
def partition(alist, first, las... | def quick_sort(alist):
quick_sort_helper(alist, 0, len(alist) - 1)
def quick_sort_helper(alist, first, last):
if first >= last:
return
splitpoint = partition(alist, first, last)
quick_sort_helper(alist, first, splitpoint - 1)
quick_sort_helper(alist, splitpoint + 1, last)
def partition(ali... |
class Solution:
# 1st solution
# O(1) time | O(1) space
def tictactoe(self, moves: List[List[int]]) -> str:
grid = [[0 for j in range(3)] for i in range(3)]
for i, move in enumerate(moves):
x, y = move
if i & 1 == 0:
grid[x][y] = 1
else:
... | class Solution:
def tictactoe(self, moves: List[List[int]]) -> str:
grid = [[0 for j in range(3)] for i in range(3)]
for (i, move) in enumerate(moves):
(x, y) = move
if i & 1 == 0:
grid[x][y] = 1
else:
grid[x][y] = -1
retur... |
# 101020400
if sm.hasQuest(21201):
sm.warpInstanceIn(914021000, 1)
sm.addQRValue(21203, "0")
sm.setInstanceTime(15*60)
if sm.hasQuest(21302):
sm.warpInstanceIn(914022100, 0)
sm.setQRValue(21203, "1", False)
sm.setInstanceTime(20*60)
| if sm.hasQuest(21201):
sm.warpInstanceIn(914021000, 1)
sm.addQRValue(21203, '0')
sm.setInstanceTime(15 * 60)
if sm.hasQuest(21302):
sm.warpInstanceIn(914022100, 0)
sm.setQRValue(21203, '1', False)
sm.setInstanceTime(20 * 60) |
A = [1,34,21,3,5,1,2,11]
for i in range(0,len(A)-1):
minIndex = i
for j in range(i+1, len(A)):
if A[j] < A[minIndex]:
minIndex = j
if minIndex != i:
A[i],A[minIndex] = A[minIndex],A[i]
print(A)
| a = [1, 34, 21, 3, 5, 1, 2, 11]
for i in range(0, len(A) - 1):
min_index = i
for j in range(i + 1, len(A)):
if A[j] < A[minIndex]:
min_index = j
if minIndex != i:
(A[i], A[minIndex]) = (A[minIndex], A[i])
print(A) |
def transform(self, x, y):
# return self.transform_2D(x, y)
return self.transform_perspective(x, y)
def transform_2D(self, x, y):
return x, y
def transform_perspective(self, pt_x, pt_y):
lin_y = pt_y * self.perspective_point_y / self.height
if lin_y > self.perspective_point_y:
lin_y = se... | def transform(self, x, y):
return self.transform_perspective(x, y)
def transform_2_d(self, x, y):
return (x, y)
def transform_perspective(self, pt_x, pt_y):
lin_y = pt_y * self.perspective_point_y / self.height
if lin_y > self.perspective_point_y:
lin_y = self.perspective_point_y
diff_x = ... |
class Config(object):
SECRET_KEY='fdsa'
APIKEY='e9dddf3b02c04ac98d341b24036bc18f'
LEGACYURL='http://fsg-datahub.azure-api.net/legacy'
FLIGTHSTATEURL='https://fsg-datahub.azure-api.net/flightstate/' | class Config(object):
secret_key = 'fdsa'
apikey = 'e9dddf3b02c04ac98d341b24036bc18f'
legacyurl = 'http://fsg-datahub.azure-api.net/legacy'
fligthstateurl = 'https://fsg-datahub.azure-api.net/flightstate/' |
# Bo Pace, Sep 2016
# Merge sort
# Merge sort makes use of an algorithmic principle known as
# "divide and conquer." In any case (best, worst, average) the
# merge sort will take O(nlogn) time. This is pretty good! The
# O(logn) complexity comes from the fact that in each iteration
# of our merge, we're splitting the l... | def mergesort(alist):
if len(alist) > 1:
mid = len(alist) / 2
left = mergesort(alist[:mid])
right = mergesort(alist[mid:])
new_list = []
i = j = 0
while i < len(left) and j < len(right):
if left[i] < right[j]:
new_list.append(left[i])
... |
__author__ = 'Abdulhafeth'
def is_mobile_app(request):
user_agent = request.META.get('HTTP_USER_AGENT', '')
if user_agent:
user_agent = user_agent.lower()
if 'dalvik' in user_agent or 'cfnetwork' in user_agent or "alamofire" in user_agent:
return True
return False | __author__ = 'Abdulhafeth'
def is_mobile_app(request):
user_agent = request.META.get('HTTP_USER_AGENT', '')
if user_agent:
user_agent = user_agent.lower()
if 'dalvik' in user_agent or 'cfnetwork' in user_agent or 'alamofire' in user_agent:
return True
return False |
class Solution:
def flatten(self, root):
if not root:
return
self.flatten(root.left)
self.flatten(root.right)
t = root.right
root.right = root.left
root.left = None
while root.right:
root = root.right
root.right = t
| class Solution:
def flatten(self, root):
if not root:
return
self.flatten(root.left)
self.flatten(root.right)
t = root.right
root.right = root.left
root.left = None
while root.right:
root = root.right
root.right = t |
#
# PySNMP MIB module CISCO-UNIFIED-COMPUTING-CAPABILITY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-CAPABILITY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:58:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, constraints_union, value_size_constraint) ... |
#@title Set up model training and evaluation { form-width: "30%" }
# The model we explore includes three components:
# - An "Encoder" graph net, which independently encodes the edge, node, and
# global attributes (does not compute relations etc.).
# - A "Core" graph net, which performs N rounds of processing (messa... | tf.reset_default_graph()
rand = np.random.RandomState(SEED)
num_processing_steps_tr = 1
num_processing_steps_ge = 1
num_training_iterations = 100000
batch_size_tr = 256
batch_size_ge = 100
num_time_steps = 50
step_size = 0.1
num_masses_min_max_tr = (5, 9)
dist_between_masses_min_max_tr = (0.2, 1.0)
model = models.Encod... |
#:copyright: Copyright 2009-2010 by the Vesper team, see AUTHORS.
#:license: Dual licenced under the GPL or Apache2 licences, see LICENSE.
@Action
def updateAction(kw, retval):
'''
Run this action every request but should only add content the first time
'''
pjson = [{ 'id' : 'a_resource',
'label'... | @Action
def update_action(kw, retval):
"""
Run this action every request but should only add content the first time
"""
pjson = [{'id': 'a_resource', 'label': 'foo', 'comment': 'page content.'}]
kw['__server__'].defaultStore.update(pjson)
return retval
@Action
def query_action(kw, retval):
... |
def main():
trick.real_time_enable()
trick.itimer_enable()
trick.exec_set_thread_process_type(1, trick.PROCESS_TYPE_AMF_CHILD)
trick.exec_set_thread_amf_cycle_time(1, 10.0)
if __name__ == "__main__":
main()
| def main():
trick.real_time_enable()
trick.itimer_enable()
trick.exec_set_thread_process_type(1, trick.PROCESS_TYPE_AMF_CHILD)
trick.exec_set_thread_amf_cycle_time(1, 10.0)
if __name__ == '__main__':
main() |
params = {}
# Cutting array parametes
params['numX'] = 4
params['numY'] = 1
params['offsetX'] = 2.5
params['offsetY'] = 0.0
params['width'] = 4.5
params['height'] = 4.5
params['radius'] = 0.25
params['thickness'] = 0.514
params['toolDiam'] = 0.25
params['partSepX'] = params['width'] + 4.0*params['toolDiam']
params... | params = {}
params['numX'] = 4
params['numY'] = 1
params['offsetX'] = 2.5
params['offsetY'] = 0.0
params['width'] = 4.5
params['height'] = 4.5
params['radius'] = 0.25
params['thickness'] = 0.514
params['toolDiam'] = 0.25
params['partSepX'] = params['width'] + 4.0 * params['toolDiam']
params['partSepY'] = params['height... |
CLIENT_ID = ""
CLIENT_SECRET = ""
USERNAME = ""
PASSWORD = ""
REDIRECT_URI = ""
USER_AGENT = ""
REDIS_HOST = "localhost"
REDIS_PORT = 6379
SUBREDDIT = ""
PERIOD_HOURS = 24
REPORT_ALL = True
SEND_MODMAIL = True
REPORT_THRESHOLD = 2
REMOVE_THRESHOLD = 3
REPORT_MESSAGE = "Excessive Posting ({num_posts} in {period}h, ma... | client_id = ''
client_secret = ''
username = ''
password = ''
redirect_uri = ''
user_agent = ''
redis_host = 'localhost'
redis_port = 6379
subreddit = ''
period_hours = 24
report_all = True
send_modmail = True
report_threshold = 2
remove_threshold = 3
report_message = 'Excessive Posting ({num_posts} in {period}h, max {... |
expected_ouptut = {
'interface': {
'TenGigabitEthernet1/0/33': {
'domain': 0,
'state': 'MASTER'},
'TenGigabitEthernet1/0/34': {
'domain': 0,
'state': 'MASTER'},
'TenGigabitEthernet1/0/42': {
'domain': 0,
'state': 'MASTER... | expected_ouptut = {'interface': {'TenGigabitEthernet1/0/33': {'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/34': {'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/42': {'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/43': {'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/6': {'domain': 0... |
#
# PySNMP MIB module BAS-ANALYZER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAS-ANALYZER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:33:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
def factorial(n):
if n == 1:
return n
else:
return n * factorial(n - 1)
def combinatoric_selections(limit):
count = 0
for n in range(1, limit + 1):
for r in range(1, n):
if factorial(n) / (factorial(r) * (factorial(n - r))) > 1000000:
cou... | def factorial(n):
if n == 1:
return n
else:
return n * factorial(n - 1)
def combinatoric_selections(limit):
count = 0
for n in range(1, limit + 1):
for r in range(1, n):
if factorial(n) / (factorial(r) * factorial(n - r)) > 1000000:
count += 1
ret... |
class Solution:
def largeGroupPositions(self, S):
res = []
l = r = 0
for i in range(1, len(S)):
if S[i] == S[i - 1]: r += 1
if r - l >= 2 and (S[i] != S[i - 1] or i == len(S) - 1): res.append([l, r])
if S[i] != S[i - 1]: l = r = i
return res | class Solution:
def large_group_positions(self, S):
res = []
l = r = 0
for i in range(1, len(S)):
if S[i] == S[i - 1]:
r += 1
if r - l >= 2 and (S[i] != S[i - 1] or i == len(S) - 1):
res.append([l, r])
if S[i] != S[i - 1]:
... |
first = int(input("Type first number: "))
second = int(input("Type second number: "))
third = int(input("Type third number: "))
if first >= second and first >= third:
print(f"Maximum: {first}")
elif second >= first and second >= third:
print(f"Maximum: {second}")
else:
print(f"Maximum: {third}")
if first <= sec... | first = int(input('Type first number: '))
second = int(input('Type second number: '))
third = int(input('Type third number: '))
if first >= second and first >= third:
print(f'Maximum: {first}')
elif second >= first and second >= third:
print(f'Maximum: {second}')
else:
print(f'Maximum: {third}')
if first <=... |
# this code checks if a triangle has an angle of 90 degrees (i.e. if the triangle is a right-angled triangle)
print("Please input the three sides of the right-angled triangle. Note that a and b are the shorter sides, while c is the longest side (also known as the hypotenuse).")
a = float(input("Side a: "))
b = flo... | print('Please input the three sides of the right-angled triangle. Note that a and b are the shorter sides, while c is the longest side (also known as the hypotenuse).')
a = float(input('Side a: '))
b = float(input('Side b: '))
c = float(input('Side c: '))
def right__angled__triangle(a, b, c):
if a ** 2 + b ** 2 ==... |
items = input().split("|")
budget = float(input())
virtual_budget = budget
profit = 0
for i in items:
item = i.split("->")
if float(item[1]) <= 50.00 and item[0] == "Clothes":
if virtual_budget < float(item[1]):
continue
else:
virtual_budget -= float(item[1])
... | items = input().split('|')
budget = float(input())
virtual_budget = budget
profit = 0
for i in items:
item = i.split('->')
if float(item[1]) <= 50.0 and item[0] == 'Clothes':
if virtual_budget < float(item[1]):
continue
else:
virtual_budget -= float(item[1])
p... |
GitHubPackage ('kumpera', 'ccache', '3.1.9',
revision = '55f1fc61765c96ce5ac90e253bab4d8feddea828',
configure = './autogen.sh --prefix="%{package_prefix}"; CC=cc ./configure --prefix="%{package_prefix}"',
override_properties = { 'build_dependency' : True }
)
| git_hub_package('kumpera', 'ccache', '3.1.9', revision='55f1fc61765c96ce5ac90e253bab4d8feddea828', configure='./autogen.sh --prefix="%{package_prefix}"; CC=cc ./configure --prefix="%{package_prefix}"', override_properties={'build_dependency': True}) |
class TestFullAutoComplete:
def test_full_autocomplete(self, client):
res = client.get("/autocomplete?q=sci")
json_data = res.get_json()
first_object = json_data["results"][0]
assert first_object["id"] == "https://openalex.org/C41008148"
assert first_object["display_name"] ==... | class Testfullautocomplete:
def test_full_autocomplete(self, client):
res = client.get('/autocomplete?q=sci')
json_data = res.get_json()
first_object = json_data['results'][0]
assert first_object['id'] == 'https://openalex.org/C41008148'
assert first_object['display_name'] =... |
f=open("dev_trans.txt","r")
lines=f.readlines()
copylst=[]
count=0
l=[]
for i,line in enumerate(lines):
if i% 9 == 5:
count+=1
l+=[count]*len(line.split())
rules=line.split()
for rule in rules:
if int(rule) > 1000000:
copylst.append(1)
... | f = open('dev_trans.txt', 'r')
lines = f.readlines()
copylst = []
count = 0
l = []
for (i, line) in enumerate(lines):
if i % 9 == 5:
count += 1
l += [count] * len(line.split())
rules = line.split()
for rule in rules:
if int(rule) > 1000000:
copylst.append(... |
#!/usr/bin/env python3
iterables = dict, list, tuple, map
nl = "\n"
trailing = ","
indent = " "
# print all elements of give nested data structure to then go over all elements and format them given the data type
def main(iterable):
return iterable, sum(len(iterable) for x in a)
if __name__ == "__main__":
... | iterables = (dict, list, tuple, map)
nl = '\n'
trailing = ','
indent = ' '
def main(iterable):
return (iterable, sum((len(iterable) for x in a)))
if __name__ == '__main__':
iterable = [a, b, {'a': 1, 'a': 1}]
main(iterable) |
cfg = {
'host': '127.0.0.1',
'port': 4001,
'base': '/api',
'cloudflare': True,
'oauth2': {
'token_uri': 'https://muck.gg/auth/callback',
'discord': {
'id': '',
'secret': '',
'redirect_uri': 'https://muck.gg/api/bot/discord/oauth2/callback',
'invite': 'https://discord.gg/kcPjgg3'
},
'github': {
... | cfg = {'host': '127.0.0.1', 'port': 4001, 'base': '/api', 'cloudflare': True, 'oauth2': {'token_uri': 'https://muck.gg/auth/callback', 'discord': {'id': '', 'secret': '', 'redirect_uri': 'https://muck.gg/api/bot/discord/oauth2/callback', 'invite': 'https://discord.gg/kcPjgg3'}, 'github': {'url': 'https://github.com/Muc... |
#!/bin/python3
class Node:
def __init__(self,data):
self.data = data
self.next = None
class Solution:
def insert(self,head,data):
p = Node(data)
if head==None:
head=p
elif head.next==None:
head.next=p
... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Solution:
def insert(self, head, data):
p = node(data)
if head == None:
head = p
elif head.next == None:
head.next = p
else:
start = head
... |
class Color:
def __init__(self, color_id, color_name, color_hexcode):
self.id = color_id
self.name = color_name
self.hexcode = color_hexcode
def label(self):
# "red (ff0000)"
return f"{self.name} ({self.hexcode})"
def row(self):
return str(self.id).rjust(... | class Color:
def __init__(self, color_id, color_name, color_hexcode):
self.id = color_id
self.name = color_name
self.hexcode = color_hexcode
def label(self):
return f'{self.name} ({self.hexcode})'
def row(self):
return str(self.id).rjust(2) + ' ' + self.name.ljust(... |
def is_valid_number(number_as_string):
try:
if number_as_string.isnumeric():
return True
elif number_as_string[0] == "-":
if number_as_string[1:].isnumeric():
return True
else:
return False
elif "." in number_as_string:
... | def is_valid_number(number_as_string):
try:
if number_as_string.isnumeric():
return True
elif number_as_string[0] == '-':
if number_as_string[1:].isnumeric():
return True
else:
return False
elif '.' in number_as_string:
... |
# From 3.2 text_file.py
def readline(self, line):
while True:
if self.join_lines:
if line:
continue
if self:
continue
return line
while __name__ != '__main__':
b = 4
| def readline(self, line):
while True:
if self.join_lines:
if line:
continue
if self:
continue
return line
while __name__ != '__main__':
b = 4 |
TWITTER_CONSUMER_KEY = ""
TWITTER_CONSUMER_SECRET = ""
SECURITY_CONFIRMABLE = False
SECURITY_REGISTERABLE = True
SECURITY_SEND_REGISTER_EMAIL = False
#SECURITY_PASSWORD_HASH = "bcrypt"
| twitter_consumer_key = ''
twitter_consumer_secret = ''
security_confirmable = False
security_registerable = True
security_send_register_email = False |
class Button():
new_map = None
save = None
load = None
exit = None
done = None
delete = None
class Level():
lock = None
unlock = None
cleared = None
class Terrain():
tile = {}
class Unit():
unit = {} | class Button:
new_map = None
save = None
load = None
exit = None
done = None
delete = None
class Level:
lock = None
unlock = None
cleared = None
class Terrain:
tile = {}
class Unit:
unit = {} |
def includeme(config):
config.add_route("index", "/")
config.add_route("feature_flags_test", "/flags/test")
config.add_route("welcome", "/welcome")
config.add_route("assets", "/assets/*subpath")
config.add_route("status", "/_status")
config.add_route("favicon", "/favicon.ico")
config.add_rou... | def includeme(config):
config.add_route('index', '/')
config.add_route('feature_flags_test', '/flags/test')
config.add_route('welcome', '/welcome')
config.add_route('assets', '/assets/*subpath')
config.add_route('status', '/_status')
config.add_route('favicon', '/favicon.ico')
config.add_rou... |
def maximum(x,y):
if (x>y):
return x
else:
return y
z=maximum(2,3)
print(str(z))
| def maximum(x, y):
if x > y:
return x
else:
return y
z = maximum(2, 3)
print(str(z)) |
def test_migrate_feature_segments_forward(migrator):
# Given - the migration state is at 0017 (before the migration we want to test)
old_state = migrator.apply_initial_migration(('features', '0017_auto_20200607_1005'))
OldFeatureSegment = old_state.apps.get_model('features', 'FeatureSegment')
OldFeatu... | def test_migrate_feature_segments_forward(migrator):
old_state = migrator.apply_initial_migration(('features', '0017_auto_20200607_1005'))
old_feature_segment = old_state.apps.get_model('features', 'FeatureSegment')
old_feature_state = old_state.apps.get_model('features', 'FeatureState')
feature = old_s... |
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def insert(head, x):
new_node = ListNode(x)
last_node = head
while last_node.next:
last_node = last_node.next
last_node.next = new_node
def printList(head):
curr = head
while curr... | class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
def insert(head, x):
new_node = list_node(x)
last_node = head
while last_node.next:
last_node = last_node.next
last_node.next = new_node
def print_list(head):
curr = head
while curr:
... |
speed(0)
for i in range(10, 51, 10):
left(90)
pendown()
forward(i)
right(90)
forward(10)
right(90)
forward(i)
right(90)
forward(10)
left(180)
penup()
forward(25)
| speed(0)
for i in range(10, 51, 10):
left(90)
pendown()
forward(i)
right(90)
forward(10)
right(90)
forward(i)
right(90)
forward(10)
left(180)
penup()
forward(25) |
'''
Write a function that takes in a string made up of brackets("(","[",""{",")","]","}") and other optional characters.
The function should return a boolean representing whether or not the string is balanced in regards to brackets.
A string is said to be balanced if it has as many opening brackets of a given type as i... | """
Write a function that takes in a string made up of brackets("(","[",""{",")","]","}") and other optional characters.
The function should return a boolean representing whether or not the string is balanced in regards to brackets.
A string is said to be balanced if it has as many opening brackets of a given type as i... |
class Solution:
def islandPerimeter(self, grid: List[List[int]]) -> int:
direc = [ [-1, 0], [0, 1], [1, 0], [0, -1] ]
ans = 0
n = len(grid)
m = len(grid[0])
vis = [ [ False for __ in range(m) ] for _ in range(n) ]
q = collections.deque()
for i in range(n... | class Solution:
def island_perimeter(self, grid: List[List[int]]) -> int:
direc = [[-1, 0], [0, 1], [1, 0], [0, -1]]
ans = 0
n = len(grid)
m = len(grid[0])
vis = [[False for __ in range(m)] for _ in range(n)]
q = collections.deque()
for i in range(n):
... |
atomic_to_ps = 2.41888E-5
plank_ev = 4.135667696E-15
ps_to_atomic = 1.0 / atomic_to_ps
atomic_to_angstrom = 0.529177249
angstrom_to_atomic = 1.0 / atomic_to_angstrom
amber_to_angstrom_ps = 20.455
angstrom_ps_to_amber = 1.0 / amber_to_angstrom_ps
angstrom_ps_to_atomic = ps_to_atomic / angstrom_to_atomic
amber_to_atomic... | atomic_to_ps = 2.41888e-05
plank_ev = 4.135667696e-15
ps_to_atomic = 1.0 / atomic_to_ps
atomic_to_angstrom = 0.529177249
angstrom_to_atomic = 1.0 / atomic_to_angstrom
amber_to_angstrom_ps = 20.455
angstrom_ps_to_amber = 1.0 / amber_to_angstrom_ps
angstrom_ps_to_atomic = ps_to_atomic / angstrom_to_atomic
amber_to_atomic... |
class classTable:
l_k_t_c = {'[128, 128]': [11, 2],
'[128, 256]': [15, 2],
'[256, 256]': [15, 4],
'[256, 512]': [19, 4],
'[512, 512]': [19, 8]}
even_indexes_0 = [0, 4, 8, 12, 16, 20]
even_indexes_2 = [2, 6, 10, 14, 18, 22]
even_indexes_3 = [1,... | class Classtable:
l_k_t_c = {'[128, 128]': [11, 2], '[128, 256]': [15, 2], '[256, 256]': [15, 4], '[256, 512]': [19, 4], '[512, 512]': [19, 8]}
even_indexes_0 = [0, 4, 8, 12, 16, 20]
even_indexes_2 = [2, 6, 10, 14, 18, 22]
even_indexes_3 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
even_indexes = [0, 2, 4,... |
def tags(tag):
def decorator(function):
def wrapper(*args):
res = function(*args)
return f"<{tag}>{res}</{tag}>"
return wrapper
return decorator
@tags('p')
def join_strings(*args):
return "".join(args)
print(join_strings("Hello", " you!"))
@tags('h1')
def to_upper(... | def tags(tag):
def decorator(function):
def wrapper(*args):
res = function(*args)
return f'<{tag}>{res}</{tag}>'
return wrapper
return decorator
@tags('p')
def join_strings(*args):
return ''.join(args)
print(join_strings('Hello', ' you!'))
@tags('h1')
def to_upper... |
day_num = 5
file_load = open("input/day5.txt", "r")
file_in = file_load.read()
file_load.close()
file_in = file_in.split("\n")
def run():
def find(field_in):
id_row = list(range(128))
id_col= list(range(8))
for temp_char in range(7):
if field_in[temp_char] == "F":
id_row = id_row[:len(i... | day_num = 5
file_load = open('input/day5.txt', 'r')
file_in = file_load.read()
file_load.close()
file_in = file_in.split('\n')
def run():
def find(field_in):
id_row = list(range(128))
id_col = list(range(8))
for temp_char in range(7):
if field_in[temp_char] == 'F':
... |
#!/usr/bin/env python3
for _ in range(int(input())):
a, b, c = map(int, input().split())
print(a * b % c)
| for _ in range(int(input())):
(a, b, c) = map(int, input().split())
print(a * b % c) |
height = 5
counter = 0
for i in range(0, height):
for j in range(0, height + 1):
if j == counter or j == height - counter and i <= height // 2:
print("*", end="")
else:
print(end=" ")
print()
if i < height // 2:
counter = counter + 1
| height = 5
counter = 0
for i in range(0, height):
for j in range(0, height + 1):
if j == counter or (j == height - counter and i <= height // 2):
print('*', end='')
else:
print(end=' ')
print()
if i < height // 2:
counter = counter + 1 |
algorithm = "spawning_nonadiabatic"
#algorithm = "hagedorn"
potential = "delta_gap"
T = 10
dt = 0.01
eps = 0.1
delta = 0.75*eps
f = 4.0
ngn = 4096
leading_component = 0
basis_size = 80
P = 1.0j
Q = 1.0-5.0j
S = 0.0
parameters = [ (P, Q, S, 1.0, -5.0), (P, Q, S, 1.0, -5.0) ]
coefficients = [[(0,1.0)], [(0,0.0)]]
... | algorithm = 'spawning_nonadiabatic'
potential = 'delta_gap'
t = 10
dt = 0.01
eps = 0.1
delta = 0.75 * eps
f = 4.0
ngn = 4096
leading_component = 0
basis_size = 80
p = 1j
q = 1.0 - 5j
s = 0.0
parameters = [(P, Q, S, 1.0, -5.0), (P, Q, S, 1.0, -5.0)]
coefficients = [[(0, 1.0)], [(0, 0.0)]]
matrix_exponential = 'arnoldi'
... |
# In the code below, you can see a program that creates a full
# name from the first and last names for several people.
name_1 = "John"
last_name_1 = "Lennon"
full_name_1 = name_1 + " " + last_name_1
name_2 = "Hermione"
last_name_2 = "Granger"
full_name_2 = name_2 = " " + last_name_2
# Wouldn't it be much easier if ... | name_1 = 'John'
last_name_1 = 'Lennon'
full_name_1 = name_1 + ' ' + last_name_1
name_2 = 'Hermione'
last_name_2 = 'Granger'
full_name_2 = name_2 = ' ' + last_name_2
def create_full_name(name, last_name):
return name + ' ' + last_name |
metadata = {
'protocolName': 'Station C; Randox Pathway - 24 Samples',
'author': 'Chaz <chaz@opentrons.com; Anton <acjs@stanford.edu>',
'source': 'COVID-19 Project',
'apiLevel': '2.2'
}
# Protocol constants
PCR_LABWARE = 'opentrons_96_aluminumblock_nest_wellplate_100ul'
'''PCR labware definition is bas... | metadata = {'protocolName': 'Station C; Randox Pathway - 24 Samples', 'author': 'Chaz <chaz@opentrons.com; Anton <acjs@stanford.edu>', 'source': 'COVID-19 Project', 'apiLevel': '2.2'}
pcr_labware = 'opentrons_96_aluminumblock_nest_wellplate_100ul'
'PCR labware definition is based on anonymous plate. May need to change.... |
SECRET_KEY = 'test'
CACHES = {
'default': {
'BACKEND': 'django_memcached_consul.memcached.MemcachedCache',
'TIMEOUT': 60,
'CONSUL_TTL': 60,
# Alt cache will be used if consul is unreachable
'CONSUL_ALT_TTL': 3600,
'CONSUL_CACHE': 'consul-memcached',
'CONSUL_H... | secret_key = 'test'
caches = {'default': {'BACKEND': 'django_memcached_consul.memcached.MemcachedCache', 'TIMEOUT': 60, 'CONSUL_TTL': 60, 'CONSUL_ALT_TTL': 3600, 'CONSUL_CACHE': 'consul-memcached', 'CONSUL_HOST': 'consul.organization.com', 'CONSUL_PORT': 8500, 'CONSUL_SERVICE': 'memcached-service'}, 'consul-memcached':... |
def create_types_message(types, full = False):
msg = f"\nAvailable {'scripts and types' if full else 'types'}\n\n"
for i, type_ in enumerate(types):
msg += f"{i}. {type_['name']}\n"
if full:
msg += f"\t{type_['description']}\n"
for i, script in enumerate(type_['scripts'])... | def create_types_message(types, full=False):
msg = f"\nAvailable {('scripts and types' if full else 'types')}\n\n"
for (i, type_) in enumerate(types):
msg += f"{i}. {type_['name']}\n"
if full:
msg += f"\t{type_['description']}\n"
for (i, script) in enumerate(type_['script... |
input = []
with open('input.txt') as f:
for line in f:
input += [ int(x) for x in line.strip().split(',') ]
op = { 1: lambda a,b: a+b, 2: lambda a,b: a*b}
def solve(m, noun, verb):
m[1] = noun
m[2] = verb
pc = 0
while True:
o, a, b, d = m[pc:pc+4]
if o == 99:
b... | input = []
with open('input.txt') as f:
for line in f:
input += [int(x) for x in line.strip().split(',')]
op = {1: lambda a, b: a + b, 2: lambda a, b: a * b}
def solve(m, noun, verb):
m[1] = noun
m[2] = verb
pc = 0
while True:
(o, a, b, d) = m[pc:pc + 4]
if o == 99:
... |
# if any of the values evaluates to true
# returns true
print (any([0,0,0,1]))
#True
widget_one = ''
widget_two = ''
widget_three = 'button'
widgets_exist = any([widget_one, widget_two, widget_three])
print (widgets_exist)
#True | print(any([0, 0, 0, 1]))
widget_one = ''
widget_two = ''
widget_three = 'button'
widgets_exist = any([widget_one, widget_two, widget_three])
print(widgets_exist) |
first = "http://www.clpig.org/magnet/"
last = ".html"
url = "http://www.clpig.org/magnet/AE2616045992C6C63B1D22B0A78EC8876DE60ACA.html"
print(url[len(first):-len(last)]) | first = 'http://www.clpig.org/magnet/'
last = '.html'
url = 'http://www.clpig.org/magnet/AE2616045992C6C63B1D22B0A78EC8876DE60ACA.html'
print(url[len(first):-len(last)]) |
'''Miles To Kilometers'''
def milesToKilo(miles):
#My Conversion Factor
return miles*1.60934
def milesToKiloTest():
#Converts 1 Mile to Kilomters
print('Testing 1 Mile')
if milesToKilo(1) == 1.60934:
print('Correct')
else:
print('Wrong!!')
#Converts 10 Mile to Kilomters
print('Tes... | """Miles To Kilometers"""
def miles_to_kilo(miles):
return miles * 1.60934
def miles_to_kilo_test():
print('Testing 1 Mile')
if miles_to_kilo(1) == 1.60934:
print('Correct')
else:
print('Wrong!!')
print('Testing 10 Miles')
if miles_to_kilo(10) == 16.0934:
print('Correct... |
CODE_TEMPLATES = {'python3': '''
import json
${HELPER_CODE}
${SOLUTION}
if __name__ == '__main__':
print(json.dumps(${TEST_CASE}))
'''
}
| code_templates = {'python3': "\nimport json\n${HELPER_CODE}\n\n${SOLUTION}\n\nif __name__ == '__main__':\n print(json.dumps(${TEST_CASE}))\n"} |
R, C, K = map(int, input().split())
n = int(input())
r_list = [0 for _ in range(R)]
c_list = [0 for _ in range(C)]
points = []
for i in range(n):
r, c = map(int, input().split())
r_list[r-1] += 1
c_list[c-1] += 1
points.append((r-1, c-1))
r_count = [0 for _ in range(K+1)]
c_count = [0 for _ in range(K... | (r, c, k) = map(int, input().split())
n = int(input())
r_list = [0 for _ in range(R)]
c_list = [0 for _ in range(C)]
points = []
for i in range(n):
(r, c) = map(int, input().split())
r_list[r - 1] += 1
c_list[c - 1] += 1
points.append((r - 1, c - 1))
r_count = [0 for _ in range(K + 1)]
c_count = [0 for ... |
tc = int(input())
inn = out = 0
for pos in range (0,tc):
n = int(input())
if 10 <= n <= 20:
inn += 1;
else:
out += 1
print ("%d in\n%d out" %(inn,out))
| tc = int(input())
inn = out = 0
for pos in range(0, tc):
n = int(input())
if 10 <= n <= 20:
inn += 1
else:
out += 1
print('%d in\n%d out' % (inn, out)) |
load(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive"
)
def _maybe(repo_rule, name, **kwargs):
if name not in native.existing_rules():
repo_rule(name = name, **kwargs)
def repositories():
_maybe(
# native.http_archive,
http_archive,
name = "com_github_gfl... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def _maybe(repo_rule, name, **kwargs):
if name not in native.existing_rules():
repo_rule(name=name, **kwargs)
def repositories():
_maybe(http_archive, name='com_github_gflags_gflags', sha256='6e16c8bc91b1310a44f3965e616383dbda48f83e8... |
FILE = "data/Clothing_Store.csv"
OUT = "data/Preprocessed.csv"
# Names of attributes
columns = ["CUSTOMER_ID", "ZIP_CODE", "TOTAL_VISITS", "TOTAL_SPENT", "AVRG_SPENT_PER_VISIT", "HAS_CREDIT_CARD",
"PSWEATERS", "PKNIT_TOPS", "PKNIT_DRES", "PBLOUSES", "PJACKETS", "PCAR_PNTS", "PCAS_PNTS", "PSHIRTS",
... | file = 'data/Clothing_Store.csv'
out = 'data/Preprocessed.csv'
columns = ['CUSTOMER_ID', 'ZIP_CODE', 'TOTAL_VISITS', 'TOTAL_SPENT', 'AVRG_SPENT_PER_VISIT', 'HAS_CREDIT_CARD', 'PSWEATERS', 'PKNIT_TOPS', 'PKNIT_DRES', 'PBLOUSES', 'PJACKETS', 'PCAR_PNTS', 'PCAS_PNTS', 'PSHIRTS', 'PDRESSES', 'PSUITS', 'POUTERWEAR', 'PJEWEL... |
def func1():
pass
def func2():
pass
x = lambda x: x()
x(func1)
x(func2)
| def func1():
pass
def func2():
pass
x = lambda x: x()
x(func1)
x(func2) |
### The Config ###
# Name of the Gym environment for the agent to learn & play
ENV_NAME = 'BreakoutDeterministic-v4'
# Loading and saving information.
# If LOAD_FROM is None, it will train a new agent.
# If SAVE_PATH is None, it will not save the agent
LOAD_FROM = None
SAVE_PATH = 'breakout-saves'
LOAD_REPLAY_BUFFER ... | env_name = 'BreakoutDeterministic-v4'
load_from = None
save_path = 'breakout-saves'
load_replay_buffer = True
write_tensorboard = True
tensorboard_dir = 'tensorboard/'
use_per = False
priority_scale = 0.7
clip_reward = True
total_frames = 30000000
max_episode_length = 18000
frames_between_eval = 100000
eval_length = 10... |
sequence_of_elements = input().split()
count_moves = 0
command = input()
while not command == "end":
count_moves += 1
index1 = int(command.split()[0])
index2 = int(command.split()[1])
if index1 == index2 or index1 < 0 or index2 < 0 or index1 >= len(sequence_of_elements) or index2 >= len(sequence_of_elem... | sequence_of_elements = input().split()
count_moves = 0
command = input()
while not command == 'end':
count_moves += 1
index1 = int(command.split()[0])
index2 = int(command.split()[1])
if index1 == index2 or index1 < 0 or index2 < 0 or (index1 >= len(sequence_of_elements)) or (index2 >= len(sequence_of_e... |
#!/usr/bin/env python
x = int(input("Enter a number to know it factorial:-"))
def fact(x):
if x > 1: return x * fact(x -1)
return 1
print("------+++++++++++++++++++++++++++------")
print("The factorial of entered number is: {}\n\n".format(fact(x)))
print("------Counting permutation------\n")
print("T... | x = int(input('Enter a number to know it factorial:-'))
def fact(x):
if x > 1:
return x * fact(x - 1)
return 1
print('------+++++++++++++++++++++++++++------')
print('The factorial of entered number is: {}\n\n'.format(fact(x)))
print('------Counting permutation------\n')
print('The formular is: -- n!/(... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'accessibility',
'type': '<(component)',
'dependencies... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'accessibility', 'type': '<(component)', 'dependencies': ['../../base/base.gyp:base', '../gfx/gfx.gyp:gfx'], 'defines': ['ACCESSIBILITY_IMPLEMENTATION'], 'sources': ['ax_enums.h', 'ax_node.cc', 'ax_node_data.cc', 'ax_node_data.h', 'ax_node.h', 'ax_serializ... |
class marrentill_tar_config():
SCRIPT_NAME = "MARRENTILL TAR MAKING SCRIPT 0.1v";
BUTTON = [
];
CHATBOX = [
".\\resources\\method\\marrentill_tar\\chatbox\\yes.png",
];
FUNCTION = [
".\\resources\\method\\marrentill_tar\\function\\make_marrentill_tar.png",
];
INTERF... | class Marrentill_Tar_Config:
script_name = 'MARRENTILL TAR MAKING SCRIPT 0.1v'
button = []
chatbox = ['.\\resources\\method\\marrentill_tar\\chatbox\\yes.png']
function = ['.\\resources\\method\\marrentill_tar\\function\\make_marrentill_tar.png']
interface = []
item = ['.\\resources\\item\\inven... |
'''
icmplib
~~~~~~~
A powerful library for forging ICMP packets and performing ping
and traceroute.
https://github.com/ValentinBELYN/icmplib
:copyright: Copyright 2017-2021 Valentin BELYN.
:license: GNU LGPLv3, see the LICENSE for details.
~~~~~~~
This program is free softwa... | """
icmplib
~~~~~~~
A powerful library for forging ICMP packets and performing ping
and traceroute.
https://github.com/ValentinBELYN/icmplib
:copyright: Copyright 2017-2021 Valentin BELYN.
:license: GNU LGPLv3, see the LICENSE for details.
~~~~~~~
This program is free softwa... |
##Introduction
#---------------------------------------Say "Hello, World!" With Python-----------------------------------------------------
print("Hello, World!")
#------------------------------------------------Python If-Else-------------------------------------------------------------
num = int(input())
... | print('Hello, World!')
num = int(input())
n = num % 2
if n == 0 and 2 <= num <= 5:
print('Not Weird')
elif n == 0 and 6 <= num <= 20:
print('Weird')
elif n == 0 and num > 20:
print('Not Weird')
elif num % 2 != 0:
print('Weird')
if __name__ == '__main__':
a = int(input())
b = int(input())
pri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.