content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def generate(self, numRows: int) -> List[List[int]]:
result = [[1]]
for i in range(1, numRows):
temp = [1]
for j in range(1, i):
temp.append(result[-1][j-1] + result[-1][j])
temp.append(1)
result.append(temp... | class Solution:
def generate(self, numRows: int) -> List[List[int]]:
result = [[1]]
for i in range(1, numRows):
temp = [1]
for j in range(1, i):
temp.append(result[-1][j - 1] + result[-1][j])
temp.append(1)
result.append(temp)
... |
class responder():
def resp_hello():
hello=[]
hello.append('Hey there "{usr}"! how\'s it going?')
hello.append('Hi "{usr}" :grinning:')
hello.append('Hello "{usr}", whats up?')
hello.append('Hey "{usr}" :wave:,\nHow are you doing?')
hello.append('Hi "{usr}"!\nI\'m StrugBot, and I\'m super happy to be here!... | class Responder:
def resp_hello():
hello = []
hello.append('Hey there "{usr}"! how\'s it going?')
hello.append('Hi "{usr}" :grinning:')
hello.append('Hello "{usr}", whats up?')
hello.append('Hey "{usr}" :wave:,\nHow are you doing?')
hello.append('Hi "{usr}"!\nI\'m St... |
"""Implement a weighted graph."""
class Graph(object):
"""Structure for values in a weighted graph."""
def __init__(self):
"""Create a graph with no values."""
self.graph = {}
def nodes(self):
"""Get all nodes in the graph to display in list form."""
return list(self.grap... | """Implement a weighted graph."""
class Graph(object):
"""Structure for values in a weighted graph."""
def __init__(self):
"""Create a graph with no values."""
self.graph = {}
def nodes(self):
"""Get all nodes in the graph to display in list form."""
return list(self.graph... |
class BaseCommand:
def __init__(self, table_name):
self.table_name = table_name
self._can_add = True
@staticmethod
def _convert_values(values):
converted = [SQLType.convert(v) for v in values]
return converted
def check_intersection(self, other):
return self.w... | class Basecommand:
def __init__(self, table_name):
self.table_name = table_name
self._can_add = True
@staticmethod
def _convert_values(values):
converted = [SQLType.convert(v) for v in values]
return converted
def check_intersection(self, other):
return self.wh... |
class Acl(object):
def __init__(self, read_acl):
self.read_acl = read_acl
@staticmethod
def from_acl_response(acl_response):
'''Takes JSON response from API and converts to ACL object'''
if 'read' in acl_response:
read_acl = AclType.from_acl_response(acl_response['read']... | class Acl(object):
def __init__(self, read_acl):
self.read_acl = read_acl
@staticmethod
def from_acl_response(acl_response):
"""Takes JSON response from API and converts to ACL object"""
if 'read' in acl_response:
read_acl = AclType.from_acl_response(acl_response['read'... |
the_simpsons = ["Homer", "Marge", "Bart", "Lisa", "Maggie"]
print(the_simpsons[::-1])
for char in the_simpsons[::-1]:
print(f"{char} has a total of {len(char)} characters.")
print(reversed(the_simpsons))
print(type(reversed(the_simpsons))) # generator object
for char in reversed(the_simpsons): # laduje za kazda... | the_simpsons = ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie']
print(the_simpsons[::-1])
for char in the_simpsons[::-1]:
print(f'{char} has a total of {len(char)} characters.')
print(reversed(the_simpsons))
print(type(reversed(the_simpsons)))
for char in reversed(the_simpsons):
print(f'{char} has a total of {len(c... |
TEST_CONFIG_OVERRIDE = {
# An envvar key for determining the project id to use. Change it
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
"gcloud_project_env": "BUILD_SPECIFIC_GCLOUD_... | test_config_override = {'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT', 'envs': {'GA_TEST_PROPERTY_ID': '276206997', 'GA_TEST_ACCOUNT_ID': '199820965', 'GA_TEST_USER_LINK_ID': '103401743041912607932', 'GA_TEST_PROPERTY_USER_LINK_ID': '105231969274497648555', 'GA_TEST_ANDROID_APP_DATA_STREAM_ID': '2828100949', 'G... |
# -*- coding: utf-8 -*-
"""
Defines constants used by P4P2P. Usually these are based upon concepts from
the Kademlia DHT and where possible naming is derived from the original
Kademlia paper as are the suggested default values.
"""
#: Represents the degree of parallelism in network calls.
ALPHA = 3
#: The maximum num... | """
Defines constants used by P4P2P. Usually these are based upon concepts from
the Kademlia DHT and where possible naming is derived from the original
Kademlia paper as are the suggested default values.
"""
alpha = 3
k = 20
lookup_timeout = 600
rpc_timeout = 5
response_timeout = 1800
refresh_timeout = 3600
replicate_i... |
# grappelli
GRAPPELLI_ADMIN_TITLE = 'pangolin - Administration panel'
# rest framework
# REST_FRAMEWORK = {
# 'PAGINATE_BY_PARAM': 'limit',
# 'SEARCH_PARAM': 'q'
# }
| grappelli_admin_title = 'pangolin - Administration panel' |
x=input("Enter a umber of which you want to know the square root.")
x=int(x)
g=x/2
while (g*g-x)*(g*g-x)>0.00000000001:
g=(g+x/g)/2
print(g)
print(g)
| x = input('Enter a umber of which you want to know the square root.')
x = int(x)
g = x / 2
while (g * g - x) * (g * g - x) > 1e-11:
g = (g + x / g) / 2
print(g)
print(g) |
'''
practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses
by Aashik J Krishnan/Aash Gates
'''
x = 10
y = "ten"
#step 1
x,y = y,x
#printing on next line
print(x)
print(y)
#end of the program | """
practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses
by Aashik J Krishnan/Aash Gates
"""
x = 10
y = 'ten'
(x, y) = (y, x)
print(x)
print(y) |
# coding: utf-8
SCHEMA_MAPPING = {
"persons": {
"type": "object",
"patternProperties": {
r"\d+": {
"type": "object",
"properties": {
"first_name": {"type": "string"},
"last_name": {"type": "string"},
... | schema_mapping = {'persons': {'type': 'object', 'patternProperties': {'\\d+': {'type': 'object', 'properties': {'first_name': {'type': 'string'}, 'last_name': {'type': 'string'}}, 'patternProperties': {'.+': {'type': ['integer', 'string']}}, 'required': ['first_name', 'last_name']}}}, 'camera': {'type': 'object', 'prop... |
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
return self.binary_search(nums, target, 0, len(nums) - 1)
def binary_search(self, nums, target, low, hight):
mid = low + (hight - low) // 2... | class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
return self.binary_search(nums, target, 0, len(nums) - 1)
def binary_search(self, nums, target, low, hight):
mid = low + (hight - low) // ... |
# Single-quoted string is preceded and succeeded by newlines.
# Translators: This is a helpful comment.
_(
'5'
)
| _('5') |
quarter=int(input())
p1=int(input())
p2=int(input())
p3=int(input())
time=0
while quarter>0:
if quarter == 0:
continue
p1+=1
quarter-=1
time+=1
if p1==35:
quarter+=30
p1=0
if quarter == 0:
continue
time+=1
p2+=1
quarter-=1
... | quarter = int(input())
p1 = int(input())
p2 = int(input())
p3 = int(input())
time = 0
while quarter > 0:
if quarter == 0:
continue
p1 += 1
quarter -= 1
time += 1
if p1 == 35:
quarter += 30
p1 = 0
if quarter == 0:
continue
time += 1
p2 += 1
quarter -= 1... |
"""
TAG: 0-1 Knapsack Problem, Dynamic Programming (DP), O(nW)
References:
- https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10/
weights and values of n items, capacity -> max value
"""
N, W = map(int, input().split()) # number of items, capacity
weights = []
values = []
for i in range(N):
w, v = m... | """
TAG: 0-1 Knapsack Problem, Dynamic Programming (DP), O(nW)
References:
- https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10/
weights and values of n items, capacity -> max value
"""
(n, w) = map(int, input().split())
weights = []
values = []
for i in range(N):
(w, v) = map(int, input().split())
... |
# To print fibonacci series upto a given number n.
first = 0
second = 1
n = int(input())
print("Fibbonacci Series:")
for i in range(0,n):
print(first, end=", ")
next = second + first
first = second
second = next
| first = 0
second = 1
n = int(input())
print('Fibbonacci Series:')
for i in range(0, n):
print(first, end=', ')
next = second + first
first = second
second = next |
nums = [0,1]
def calcFi():
n1 = nums[-2]
n2 = nums[-1]
sM = n1 + n2
phi = sM/n2
nums.append(sM)
return (phi)
for i in range(45):
if i % 15 == 0 or i == 44:
phi = calcFi()
print(phi)
if i == 44:
with open("outputs/phi.txt", "w") as f:
f... | nums = [0, 1]
def calc_fi():
n1 = nums[-2]
n2 = nums[-1]
s_m = n1 + n2
phi = sM / n2
nums.append(sM)
return phi
for i in range(45):
if i % 15 == 0 or i == 44:
phi = calc_fi()
print(phi)
if i == 44:
with open('outputs/phi.txt', 'w') as f:
f... |
a = [2, 4, 5, 7, 8, 9]
sum = 0
for i in range(len(a) - 1):
if a[i] % 2 == 0:
sum = sum + a[i]
print(sum)
| a = [2, 4, 5, 7, 8, 9]
sum = 0
for i in range(len(a) - 1):
if a[i] % 2 == 0:
sum = sum + a[i]
print(sum) |
#students exams data entries for terminal report card
print("Westside Educational Complex--End Of second Terminal Report--Class-KKJA--Name:Theodora Obaa Yaa Gyarbeng")
while True:
student_score = float(input ("Enter the student score:"))
if student_score >= 1.0 and student_score <= 39.9:
print("stud... | print('Westside Educational Complex--End Of second Terminal Report--Class-KKJA--Name:Theodora Obaa Yaa Gyarbeng')
while True:
student_score = float(input('Enter the student score:'))
if student_score >= 1.0 and student_score <= 39.9:
print('student_score is F9', 'fail')
elif student_score >= 40 and ... |
n = int(input())
l = []
c = 0
for i in range(0,n):
p = input()
print('c -> ', c)
if p in l:
c += 1
l.append(p)
print("Falta(m) {} pomekon(s).".format(151 - (n-c))) | n = int(input())
l = []
c = 0
for i in range(0, n):
p = input()
print('c -> ', c)
if p in l:
c += 1
l.append(p)
print('Falta(m) {} pomekon(s).'.format(151 - (n - c))) |
inst_25 = [(35,0,15),(29,0,20),(9,0,11),(9,13,35),(3,0,19),(37,0,8),(11,0,30),(19,0,25),(13,0,25),(39,0,18)]
inst_bait = [(10,0,10), (14,0,11), (33,0,26),(4,2,18),(4,20,30),(39,117,137),(12,5,21),(28,0,14),(32,5,14),(32,15,44),(36,0,9),(40,0,14),(2,1,15),(2,17,35),(5,160,168),(11,158,164),(13,116,131)]
inst_30 = []
... | inst_25 = [(35, 0, 15), (29, 0, 20), (9, 0, 11), (9, 13, 35), (3, 0, 19), (37, 0, 8), (11, 0, 30), (19, 0, 25), (13, 0, 25), (39, 0, 18)]
inst_bait = [(10, 0, 10), (14, 0, 11), (33, 0, 26), (4, 2, 18), (4, 20, 30), (39, 117, 137), (12, 5, 21), (28, 0, 14), (32, 5, 14), (32, 15, 44), (36, 0, 9), (40, 0, 14), (2, 1, 15),... |
#To run the code, write
#from ishashad import ishashad
#then ishashad(number)
def ishashad(n):
if n % sum(map(int,str(n))) == 0:
print("True")
else:
print("False")
return | def ishashad(n):
if n % sum(map(int, str(n))) == 0:
print('True')
else:
print('False')
return |
class Relogio:
def __init__(self):
self.horas = 6
self.minutos = 0
self.dia = 1
def __str__(self):
return f"{self.horas:02d}:{self.minutos:02d} do dia {self.dia:02d}"
def avancaTempo(self, minutos):
self.minutos += minutos
while(self.minutos >= 60):... | class Relogio:
def __init__(self):
self.horas = 6
self.minutos = 0
self.dia = 1
def __str__(self):
return f'{self.horas:02d}:{self.minutos:02d} do dia {self.dia:02d}'
def avanca_tempo(self, minutos):
self.minutos += minutos
while self.minutos >= 60:
... |
"""
@Author : xiaotao
@Email : 18773993654@163.com
@Lost modifid : 2020/4/24 10:02
@Filename : __init__.py.py
@Description :
@Software : PyCharm
""" | """
@Author : xiaotao
@Email : 18773993654@163.com
@Lost modifid : 2020/4/24 10:02
@Filename : __init__.py.py
@Description :
@Software : PyCharm
""" |
# https://www.geeksforgeeks.org/write-a-program-to-reverse-an-array-or-string/
# Time: O(n)
# Space: 1
def reverseByMiddles(arr):
n = len(arr)
limit = n//2
for i in range(limit):
temp = arr[i]
arr[i] = arr[(n-1)-i]
arr[(n-1)-i] = temp
return arr
arr = [1,2,3]
result = reverseByMiddles(arr)
print(r... | def reverse_by_middles(arr):
n = len(arr)
limit = n // 2
for i in range(limit):
temp = arr[i]
arr[i] = arr[n - 1 - i]
arr[n - 1 - i] = temp
return arr
arr = [1, 2, 3]
result = reverse_by_middles(arr)
print(result)
print(reverse_by_middles(arr=[1, 2, 3, 4])) |
coordinates_01EE00 = ((121, 126),
(121, 132), (121, 134), (121, 135), (121, 137), (121, 138), (121, 139), (121, 140), (121, 141), (122, 114), (122, 115), (122, 116), (122, 117), (122, 119), (122, 125), (122, 127), (122, 128), (122, 142), (123, 110), (123, 111), (123, 112), (123, 113), (123, 120), (123, 124), (123, 12... | coordinates_01_ee00 = ((121, 126), (121, 132), (121, 134), (121, 135), (121, 137), (121, 138), (121, 139), (121, 140), (121, 141), (122, 114), (122, 115), (122, 116), (122, 117), (122, 119), (122, 125), (122, 127), (122, 128), (122, 142), (123, 110), (123, 111), (123, 112), (123, 113), (123, 120), (123, 124), (123, 126... |
cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars -drivers
cars_driven = drivers
carpool_carpacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print("There are", cars, "cars available")
print("There are only", drivers, "drivers available")
prin... | cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_carpacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print('There are', cars, 'cars available')
print('There are only', drivers, 'drivers available')
prin... |
course = "Python Programming"
print(course.upper())
print(course.lower())
print(course.title())
course = " Python Programming"
print(course)
print(course.strip())
print(course.find("Pro"))
print(course.find("pro"))
print(course.replace("P", "-"))
print("Programming" in course)
print("Programming" not in course)
| course = 'Python Programming'
print(course.upper())
print(course.lower())
print(course.title())
course = ' Python Programming'
print(course)
print(course.strip())
print(course.find('Pro'))
print(course.find('pro'))
print(course.replace('P', '-'))
print('Programming' in course)
print('Programming' not in course) |
def init():
# Set locale environment
# Set config
# Set user and group
# init logger
pass | def init():
pass |
def determinant(matA):
dimA = []
# find dimensions of arrA
a = matA
while type(a) == list:
dimA.append(len(a))
a = a[0]
#is it square
if dimA[0] != dimA[1]:
raise Exception("Matrix is not square")
#find determinant
total = 0
if dimA[0] == 2:
total = ma... | def determinant(matA):
dim_a = []
a = matA
while type(a) == list:
dimA.append(len(a))
a = a[0]
if dimA[0] != dimA[1]:
raise exception('Matrix is not square')
total = 0
if dimA[0] == 2:
total = matA[0][0] * matA[1][1] - matA[1][0] * matA[0][1]
return total
... |
#
# PySNMP MIB module BAY-STACK-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAY-STACK-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:19:06 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... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, constraints_intersection, value_size_constraint, value_range_constraint) ... |
objects = {}
def instantiate():
# This function is called once during server startup. Modify the global 'objects' dict with of instantiated
# shared objects that you wish to store in the parent process and have access to from child request handler
# processes. Each object must support being shared via... | objects = {}
def instantiate():
return |
host = "localhost"
port = 9999
dboptions = {
"host": "194.67.198.163",
"user": "postgres",
"password": "werdwerd2012",
"database": "zno_bot",
'migrate': True
}
API_PATH = '/api/'
API_VERSION = 'v1'
API_URL = API_PATH + API_VERSION
| host = 'localhost'
port = 9999
dboptions = {'host': '194.67.198.163', 'user': 'postgres', 'password': 'werdwerd2012', 'database': 'zno_bot', 'migrate': True}
api_path = '/api/'
api_version = 'v1'
api_url = API_PATH + API_VERSION |
class Frequency:
def __init__(self):
self.frequency = 0
def increment(self, i):
self.frequency = self.frequency + i
def decrement(self, i):
self.frequency = self.frequency - i
def __str__(self):
return str(self.frequency)
def __repr__(self):
return str(self.fr... | class Frequency:
def __init__(self):
self.frequency = 0
def increment(self, i):
self.frequency = self.frequency + i
def decrement(self, i):
self.frequency = self.frequency - i
def __str__(self):
return str(self.frequency)
def __repr__(self):
return str(se... |
# Copyright (c) 2004, The Long Now Foundation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | popup_template = '\n<div class="node" id="node%n" onmouseout="javascript:hideNode(\'%n\')">\n<table cellpadding="0" cellspacing="0" border="0" width="100%">\n<tr>\n<td class="exp">\nBET<br><span class="txt">%n</span></td>\n\n<td class="exp" align="right">\n%d\n</td>\n</tr>\n</table>\n\n<div class="txt-sm">\n%1</div>\n\... |
#! python3
# -*- coding: utf-8 -*-
"""
Euler description from https://projecteuler.net/
Problem 0002
Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibo... | """
Euler description from https://projecteuler.net/
Problem 0002
Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not e... |
'''
Created on Mar 30, 2019
@author: PIKU
'''
def justSayHello():
print("Hello ...")
def getHello():
return "Hello guys"
if __name__ == '__main__':
justSayHello()
x = getHello()
print(x)
| """
Created on Mar 30, 2019
@author: PIKU
"""
def just_say_hello():
print('Hello ...')
def get_hello():
return 'Hello guys'
if __name__ == '__main__':
just_say_hello()
x = get_hello()
print(x) |
def formstash_to_querystring(formStash):
err = []
for (k, v) in formStash.errors.items():
err.append(("%s--%s" % (k, v)).replace("\n", "+").replace(" ", "+"))
err = sorted(err)
err = "---".join(err)
return err
class _UrlSafeException(Exception):
@property
def as_querystring(self):
... | def formstash_to_querystring(formStash):
err = []
for (k, v) in formStash.errors.items():
err.append(('%s--%s' % (k, v)).replace('\n', '+').replace(' ', '+'))
err = sorted(err)
err = '---'.join(err)
return err
class _Urlsafeexception(Exception):
@property
def as_querystring(self):
... |
"""solution.py"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
"""
T: O(?)
S: O(?)
"""
l3 = ListNode(0)
... | """solution.py"""
class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode:
"""
T: O(?)
S: O(?)
"""
l3 = list_node(0)
temp_l3 = l3
carry = 0
... |
DATA_S3 = "bioanalyze-ec2-test-nf-rnaseq-06o3qdtm7v"
JOB_S3 = DATA_S3
# These come from the terraform code in auto-deployment/terraform
ECR = "dabbleofdevops/nextflow-rnaseq-tutorial"
COMPUTE_ENVIRONMENT = "bioanalyze-ec2-test-nf-rnaseq"
JOB_DEF_NAME = "bioanalyze-ec2-test-nf-rnaseq"
JOB_QUEUE_NAME = "bioanalyze-ec2-... | data_s3 = 'bioanalyze-ec2-test-nf-rnaseq-06o3qdtm7v'
job_s3 = DATA_S3
ecr = 'dabbleofdevops/nextflow-rnaseq-tutorial'
compute_environment = 'bioanalyze-ec2-test-nf-rnaseq'
job_def_name = 'bioanalyze-ec2-test-nf-rnaseq'
job_queue_name = 'bioanalyze-ec2-test-nf-rnaseq-default-job-queue'
job_role = 'arn:aws:iam::018835827... |
# encoding: utf-8
# module _ctypes
# from /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so
# by generator 1.145
""" Create and manipulate C compatible data types in Python. """
# no imports
# Variables with simple values
FUNCFLAG_CDECL = 1
FUNCFLAG_PYTHONAPI = 4
FUNCFLAG_USE_ERRNO = 8
FUNCFLAG_... | """ Create and manipulate C compatible data types in Python. """
funcflag_cdecl = 1
funcflag_pythonapi = 4
funcflag_use_errno = 8
funcflag_use_lasterror = 16
rtld_global = 256
rtld_local = 0
_cast_addr = 140388692655680
_memmove_addr = 140388724844976
_memset_addr = 140388724996464
_string_at_addr = 140388692647104
_ws... |
#!/usr/bin/env python3
class stressTestPV:
def __init__( self, pvName ):
self._pvName = pvName
self._tsValues = {} # Dict of collected values, keys are float timestamps
self._tsRates = {} # Dict of collection rates, keys are int secPastEpoch values
self._tsMissR... | class Stresstestpv:
def __init__(self, pvName):
self._pvName = pvName
self._tsValues = {}
self._tsRates = {}
self._tsMissRates = {}
self._timeoutRates = {}
self._numMissed = 0
self._numTimeouts = 0
self._startTime = None
self._endTime = None
... |
_base_ = ['./rotated-detection_static.py', '../_base_/backends/tensorrt.py']
onnx_config = dict(
output_names=['dets', 'labels'],
input_shape=None,
dynamic_axes={
'input': {
0: 'batch',
2: 'height',
3: 'width'
},
'dets': {
0: 'batch',
... | _base_ = ['./rotated-detection_static.py', '../_base_/backends/tensorrt.py']
onnx_config = dict(output_names=['dets', 'labels'], input_shape=None, dynamic_axes={'input': {0: 'batch', 2: 'height', 3: 'width'}, 'dets': {0: 'batch', 1: 'num_dets'}, 'labels': {0: 'batch', 1: 'num_dets'}})
backend_config = dict(common_confi... |
#!/usr/bin/env python
class Solution:
def twoCitySchedCost(self, costs):
N = len(costs)//2
costs = list(sorted(costs, key=lambda c: c[0]-c[1]))
s = 0
for i, c in enumerate(costs):
s += c[0] if i < N else c[1]
return s
costs = [[10,20],[30,200],[400,50],[30,20]]
... | class Solution:
def two_city_sched_cost(self, costs):
n = len(costs) // 2
costs = list(sorted(costs, key=lambda c: c[0] - c[1]))
s = 0
for (i, c) in enumerate(costs):
s += c[0] if i < N else c[1]
return s
costs = [[10, 20], [30, 200], [400, 50], [30, 20]]
sol = s... |
pdu_objects = [
{
'header': {
'command_length': 0,
'command_id': 'bind_transmitter',
'command_status': 'ESME_ROK',
'sequence_number': 0,
},
'body': {
'mandatory_parameters': {
'system_id': 'test_system',
... | pdu_objects = [{'header': {'command_length': 0, 'command_id': 'bind_transmitter', 'command_status': 'ESME_ROK', 'sequence_number': 0}, 'body': {'mandatory_parameters': {'system_id': 'test_system', 'password': 'abc123', 'system_type': '', 'interface_version': '34', 'addr_ton': 1, 'addr_npi': 1, 'address_range': ''}}}, {... |
#!/usr/bin/env python
# -*- coding: utf-8 -*--
# Copyright (c) 2021, 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
class Parser:
@property
def pos(self):
raise NotImplementedError()
@property
def no... | class Parser:
@property
def pos(self):
raise not_implemented_error()
@property
def noun(self):
raise not_implemented_error()
@property
def adjective(self):
raise not_implemented_error()
@property
def adverb(self):
raise not_implemented_error()
@pr... |
class Template:
def __init__(self, data):
"""Class representing log templates.
Note:
Timestamps are represented in ISO format with timezone information.
e.g, 2021-10-07T13:18:09.178477+02:00.
"""
self._timestamp = data.get("@timestamp", None)
self.... | class Template:
def __init__(self, data):
"""Class representing log templates.
Note:
Timestamps are represented in ISO format with timezone information.
e.g, 2021-10-07T13:18:09.178477+02:00.
"""
self._timestamp = data.get('@timestamp', None)
self._... |
def strategy(history, memory):
round = history.shape[1]
GRUDGE = 0
LASTACTION = 1
if round == 0:
mem = []
mem.append(False)
mem.append(0)
return "cooperate", mem
mem = memory
if mem[GRUDGE]:
return "defect", mem
if round >= 5:
sin = 0
f... | def strategy(history, memory):
round = history.shape[1]
grudge = 0
lastaction = 1
if round == 0:
mem = []
mem.append(False)
mem.append(0)
return ('cooperate', mem)
mem = memory
if mem[GRUDGE]:
return ('defect', mem)
if round >= 5:
sin = 0
... |
test = [
'nop +0',
'acc +1',
'jmp +4',
'acc +3',
'jmp -3',
'acc -99',
'acc +1',
'jmp -4',
'acc +6',
]
actual = [
'acc +17',
'acc +37',
'acc -13',
'jmp +173',
'nop +100',
'acc -7',
'jmp +447',
'nop +283',
'acc +41',
'acc +32',
'jmp +1',... | test = ['nop +0', 'acc +1', 'jmp +4', 'acc +3', 'jmp -3', 'acc -99', 'acc +1', 'jmp -4', 'acc +6']
actual = ['acc +17', 'acc +37', 'acc -13', 'jmp +173', 'nop +100', 'acc -7', 'jmp +447', 'nop +283', 'acc +41', 'acc +32', 'jmp +1', 'jmp +585', 'jmp +1', 'acc -5', 'nop +71', 'acc +49', 'acc -18', 'jmp +527', 'jmp +130',... |
class Solution:
def generateMatrix(self, n):
matrix = []
num = 1
for i in range(n):
matrix.append([0 for i in range(n)])
top = 0
bottom = n - 1
left = 0
right = n - 1
while top <= bottom and left <= right:
for i in range(left, r... | class Solution:
def generate_matrix(self, n):
matrix = []
num = 1
for i in range(n):
matrix.append([0 for i in range(n)])
top = 0
bottom = n - 1
left = 0
right = n - 1
while top <= bottom and left <= right:
for i in range(left,... |
# classification related details
classification_datasets = ['imagenet', 'coco']
classification_schedulers = ['fixed', 'clr', 'hybrid', 'linear', 'poly']
classification_models = ['espnetv2', 'dicenet', 'shufflenetv2']
classification_exp_choices = ['main', 'ablation']
# segmentation related details
segmentation_schedule... | classification_datasets = ['imagenet', 'coco']
classification_schedulers = ['fixed', 'clr', 'hybrid', 'linear', 'poly']
classification_models = ['espnetv2', 'dicenet', 'shufflenetv2']
classification_exp_choices = ['main', 'ablation']
segmentation_schedulers = ['poly', 'fixed', 'clr', 'linear', 'hybrid']
segmentation_da... |
# encoding: utf-8
# module win32profile
# from C:\Python27\lib\site-packages\win32\win32profile.pyd
# by generator 1.147
# no doc
# no imports
# Variables with simple values
PI_APPLYPOLICY = 2
PI_NOUI = 1
PT_MANDATORY = 4
PT_ROAMING = 2
PT_TEMPORARY = 1
# functions
def CreateEnvironmentBlock(*args, **kwargs): # re... | pi_applypolicy = 2
pi_noui = 1
pt_mandatory = 4
pt_roaming = 2
pt_temporary = 1
def create_environment_block(*args, **kwargs):
""" Retrieves environment variables for a user """
pass
def delete_profile(*args, **kwargs):
""" Remove a user's profile """
pass
def expand_environment_strings_for_user(*arg... |
def checkrot(str1,str2):
if len(str1)==len(str2):
str3=str1+str1
ad=str3.__contains__(str2)
if ad==True:
print("it is right rotate")
else:
print("It is not right rotate ")
else:
print("It is invalid string.Out of range")
def main():
str1=input(" Enter the first String : ")
str2=input("Enter the s... | def checkrot(str1, str2):
if len(str1) == len(str2):
str3 = str1 + str1
ad = str3.__contains__(str2)
if ad == True:
print('it is right rotate')
else:
print('It is not right rotate ')
else:
print('It is invalid string.Out of range')
def main():
... |
#
# This file is part of the Ingram Micro CloudBlue Connect EaaS Extension Runner.
#
# Copyright (c) 2021 Ingram Micro. All Rights Reserved.
#
class EaaSError(Exception):
pass
class MaintenanceError(EaaSError):
pass
class CommunicationError(EaaSError):
pass
class StopBackoffError(EaaSError):
pass
| class Eaaserror(Exception):
pass
class Maintenanceerror(EaaSError):
pass
class Communicationerror(EaaSError):
pass
class Stopbackofferror(EaaSError):
pass |
a=int(input('enter a:'))
b=int(input('enter b:'))
c=int(input('enter c:'))
min_value= a if a<b and a<c else b if b<c else c
print(min_value) | a = int(input('enter a:'))
b = int(input('enter b:'))
c = int(input('enter c:'))
min_value = a if a < b and a < c else b if b < c else c
print(min_value) |
class Animals:
def comer(self):
print("Comiendo")
def dormir(self):
print("Durmiendo")
class Perro:
def __init__(self, nombre):
self.nombre = nombre
def comer(self):
print("Comiendo")
def dormir(self):
print("Durmiendo")
def ladrar(self):
print("Ladrando")
print("----------------------... | class Animals:
def comer(self):
print('Comiendo')
def dormir(self):
print('Durmiendo')
class Perro:
def __init__(self, nombre):
self.nombre = nombre
def comer(self):
print('Comiendo')
def dormir(self):
print('Durmiendo')
def ladrar(self):
pr... |
_base_ = [
'../_base_/models/resnet50.py', '../_base_/datasets/cancer_bs32_pil_resize.py',
'../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py'
]
model = dict(
head=dict(
num_classes=2,
topk=(1,))
)
data = dict(
train=dict(
data_prefix='/data3/zzhang/tmp... | _base_ = ['../_base_/models/resnet50.py', '../_base_/datasets/cancer_bs32_pil_resize.py', '../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py']
model = dict(head=dict(num_classes=2, topk=(1,)))
data = dict(train=dict(data_prefix='/data3/zzhang/tmp/classification/train'), val=dict(data_prefix='/... |
"""Base utility functions, that manipulate basic data structures, etc."""
###################################################################################################
###################################################################################################
def flatten(lst):
"""Flatten a list of l... | """Base utility functions, that manipulate basic data structures, etc."""
def flatten(lst):
"""Flatten a list of lists into a single list.
Parameters
----------
lst : list of list
A list of embedded lists.
Returns
-------
lst
A flattened list.
"""
return [item for ... |
""" Class description goes here. """
"""Package containing gRPC classes."""
__author__ = 'Enrico La Sala <enrico.lasala@bsc.es>'
__copyright__ = '2017 Barcelona Supercomputing Center (BSC-CNS)'
| """ Class description goes here. """
'Package containing gRPC classes.'
__author__ = 'Enrico La Sala <enrico.lasala@bsc.es>'
__copyright__ = '2017 Barcelona Supercomputing Center (BSC-CNS)' |
class CircularQueue:
"""
A circlular queue: a first-in-first-out data structure with a fixed buffer size.
"""
def __init__(self, size):
if type(size) is not int:
raise TypeError("Queue size must be a postive integer.")
if size <= 0:
raise ValueError("Queue size m... | class Circularqueue:
"""
A circlular queue: a first-in-first-out data structure with a fixed buffer size.
"""
def __init__(self, size):
if type(size) is not int:
raise type_error('Queue size must be a postive integer.')
if size <= 0:
raise value_error('Queue size... |
# -*- coding: utf-8 -*-
class IkazuchiError(Exception):
""" ikazuchi root exception """
pass
class TranslatorError(IkazuchiError):
""" ikazuchi translator exception """
pass
class NeedApiKeyError(TranslatorError): pass
| class Ikazuchierror(Exception):
""" ikazuchi root exception """
pass
class Translatorerror(IkazuchiError):
""" ikazuchi translator exception """
pass
class Needapikeyerror(TranslatorError):
pass |
XPAHS_CONSULT = {
'jobs_urls': '//div[contains(@class, "listResults")]//div[contains(@data-jobid, "")]//h2//a/@href',
'results': '//span[@class="description fc-light fs-body1"]//text()',
'pagination_indicator': '//a[contains(@class, "s-pagination--item")][last()]//span[contains(text(), "next")]',
'pagi... | xpahs_consult = {'jobs_urls': '//div[contains(@class, "listResults")]//div[contains(@data-jobid, "")]//h2//a/@href', 'results': '//span[@class="description fc-light fs-body1"]//text()', 'pagination_indicator': '//a[contains(@class, "s-pagination--item")][last()]//span[contains(text(), "next")]', 'pagination_url': '//a[... |
"""
Author: bkc@data_analysis
Project: autoencoder_ng
Created: 7/29/20 10:51
Purpose: START SCRIPT FOR AUTOENCODER_NG PROJECT
"""
| """
Author: bkc@data_analysis
Project: autoencoder_ng
Created: 7/29/20 10:51
Purpose: START SCRIPT FOR AUTOENCODER_NG PROJECT
""" |
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-ssl-redirect
SECURE_SSL_REDIRECT = True
# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-secure
SES... | secure_proxy_ssl_header = ('HTTP_X_FORWARDED_PROTO', 'https')
secure_ssl_redirect = True
session_cookie_secure = True
csrf_cookie_secure = True
secure_hsts_preload = True
secure_hsts_include_subdomains = True
secure_hsts_seconds = 31536000
secure_content_type_nosniff = True |
# The `Environment` class represents the dynamic environment of McCarthy's original Lisp. The creation of
# this class is actually an interesting story. As many of you probably know, [Paul Graham wrote a paper and
# code for McCarthy's original Lisp](http://www.paulgraham.com/rootsoflisp.html) and it was my first e... | class Environment:
def __init__(self, par=None, bnd=None):
if bnd:
self.binds = bnd
else:
self.binds = {}
self.parent = par
if par:
self.level = self.parent.level + 1
else:
self.level = 0
def get(self, key):
if key... |
class Exercises:
def __init__(self, topic, course_name, judge_contest_link, problems):
self.topic = topic
self.course_name = course_name
self.judge_contest_link = judge_contest_link
self.problems = [*problems]
def get_info(self):
info = f'Exercises: {self.topic}\n' \
... | class Exercises:
def __init__(self, topic, course_name, judge_contest_link, problems):
self.topic = topic
self.course_name = course_name
self.judge_contest_link = judge_contest_link
self.problems = [*problems]
def get_info(self):
info = f'Exercises: {self.topic}\nProble... |
input = """
% This is a synthetic example documenting a bug in an early version of DLV's
% backjumping algorithm.
% The abstract computation tree looks as follows (choice order should be fixed
% by disabling heuristics with -OH-):
%
% o
% a / \ -a
% / \_..._
% o \
% ... | input = "\n% This is a synthetic example documenting a bug in an early version of DLV's\n% backjumping algorithm.\n\n% The abstract computation tree looks as follows (choice order should be fixed\n% by disabling heuristics with -OH-):\n%\n% o\n% a / \\ -a\n% / \\_..._\n% o % b ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 6 17:38:00 2015
@author: dbwrigh3
"""
| """
Created on Fri Feb 6 17:38:00 2015
@author: dbwrigh3
""" |
class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
Max = -float("inf")
currMax = -float("inf")
for num in nums:
currMax = max(num, num + currMax)
Max = max(Max, currMax)
retur... | class Solution(object):
def max_sub_array(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
max = -float('inf')
curr_max = -float('inf')
for num in nums:
curr_max = max(num, num + currMax)
max = max(Max, currMax)
return Ma... |
# =================================================
# SERVER CONFIGURATIONS
# =================================================
CLIENT_ID=''
CLIENT_SECRET=''
REDIRECT_URI='http://ROCKOPY/'
# =================================================
# SERVER CONFIGURATIONS
# =================================================
S... | client_id = ''
client_secret = ''
redirect_uri = 'http://ROCKOPY/'
server_ip = '127.0.0.1'
server_port = 5043
tracks_to_search = 5 |
"""
Bazel macros for defining proto libraries.
"""
load("@rules_proto//proto:defs.bzl", "proto_library")
# TODO(#4096): Remove this once it's no longer needed.
def oppia_proto_library(name, **kwargs):
"""
Defines a new proto library.
Note that the library is defined with a stripped import prefix which en... | """
Bazel macros for defining proto libraries.
"""
load('@rules_proto//proto:defs.bzl', 'proto_library')
def oppia_proto_library(name, **kwargs):
"""
Defines a new proto library.
Note that the library is defined with a stripped import prefix which ensures that protos have a
common import directory (wh... |
allData = {'AK': {'Aleutians East': {'pop': 3141, 'tracts': 1},
'Aleutians West': {'pop': 5561, 'tracts': 2},
'Anchorage': {'pop': 291826, 'tracts': 55},
'Bethel': {'pop': 17013, 'tracts': 3},
'Bristol Bay': {'pop': 997, 'tracts': 1},
'Denali': {'pop': 1826, 'tracts': 1},
... | all_data = {'AK': {'Aleutians East': {'pop': 3141, 'tracts': 1}, 'Aleutians West': {'pop': 5561, 'tracts': 2}, 'Anchorage': {'pop': 291826, 'tracts': 55}, 'Bethel': {'pop': 17013, 'tracts': 3}, 'Bristol Bay': {'pop': 997, 'tracts': 1}, 'Denali': {'pop': 1826, 'tracts': 1}, 'Dillingham': {'pop': 4847, 'tracts': 2}, 'Fai... |
#code https://practice.geeksforgeeks.org/problems/swap-and-maximize/0
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
max = 0
for i in range(n//2):
max -= 2*arr[i]
max += 2*arr[n-i-1]
print(max) | for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
max = 0
for i in range(n // 2):
max -= 2 * arr[i]
max += 2 * arr[n - i - 1]
print(max) |
def som(a, b):
"""Bereken de som van twee getallen. Als de som groter is dan nul return je de som.
Als de som kleiner is dan nul, dan return je nul.
Args:
a (int): het eerste getal
b (int): het tweede getal
"""
pass
assert som(1, 2) == 3
assert som(-1, -2) == -3
assert som(0, ... | def som(a, b):
"""Bereken de som van twee getallen. Als de som groter is dan nul return je de som.
Als de som kleiner is dan nul, dan return je nul.
Args:
a (int): het eerste getal
b (int): het tweede getal
"""
pass
assert som(1, 2) == 3
assert som(-1, -2) == -3
assert som(0, 0) ... |
# for loops
# for letter in "Cihat Salik":
# print(letter)
friends = ["Hasan", "Mahmut", "Ali", "Veli"]
for friend in friends:
print(friend)
for index in range(3, 10):
print(index)
for index in range(len(friends)):
print(friends[index])
for index in range(5):
if index == 0:
print("Fi... | friends = ['Hasan', 'Mahmut', 'Ali', 'Veli']
for friend in friends:
print(friend)
for index in range(3, 10):
print(index)
for index in range(len(friends)):
print(friends[index])
for index in range(5):
if index == 0:
print('First Iteration')
else:
print('Not first') |
"Used to reference the nested workspaces for examples in /WORKSPACE"
ALL_EXAMPLES = [
"angular",
"app",
"kotlin",
"nestjs",
"parcel",
"protocol_buffers",
"user_managed_deps",
"vendored_node",
"vendored_node_and_yarn",
"web_testing",
"webapp",
"worker",
]
| """Used to reference the nested workspaces for examples in /WORKSPACE"""
all_examples = ['angular', 'app', 'kotlin', 'nestjs', 'parcel', 'protocol_buffers', 'user_managed_deps', 'vendored_node', 'vendored_node_and_yarn', 'web_testing', 'webapp', 'worker'] |
class Workset(WorksetPreview,IDisposable):
""" Represents a workset in the document. """
@staticmethod
def Create(document,name):
"""
Create(document: Document,name: str) -> Workset
Creates a new workset.
document: The document in which the new instance is created.
name: The wo... | class Workset(WorksetPreview, IDisposable):
""" Represents a workset in the document. """
@staticmethod
def create(document, name):
"""
Create(document: Document,name: str) -> Workset
Creates a new workset.
document: The document in which the new instance is created.
name: The... |
def decode_lines(lines_bytes, encoding: str):
if isinstance(lines_bytes[0], bytes):
lines_str = [line.decode(encoding) for line in lines_bytes]
elif isinstance(lines_bytes[0], str):
lines_str = lines_bytes
else:
raise TypeError(type(lines_bytes[0]))
return lines_str
| def decode_lines(lines_bytes, encoding: str):
if isinstance(lines_bytes[0], bytes):
lines_str = [line.decode(encoding) for line in lines_bytes]
elif isinstance(lines_bytes[0], str):
lines_str = lines_bytes
else:
raise type_error(type(lines_bytes[0]))
return lines_str |
# Fitness monday variables
morning_1 = "10:00"
morning_2 = "8:00"
afternoon_1 = "13:00"
afternoon_2 = "14:30"
afternoon_3 = "15:30"
afternoon_4 = "17:55"
evening_1 = "20:30"
evening_2 = "21:10"
date_announce = [1, 2, 3, 4, 5]
image_file_list = [
'Exercise_Three.png',
'Exercise_Two_2.png'
]
... | morning_1 = '10:00'
morning_2 = '8:00'
afternoon_1 = '13:00'
afternoon_2 = '14:30'
afternoon_3 = '15:30'
afternoon_4 = '17:55'
evening_1 = '20:30'
evening_2 = '21:10'
date_announce = [1, 2, 3, 4, 5]
image_file_list = ['Exercise_Three.png', 'Exercise_Two_2.png']
morning_1_msg = 'Do some stretches! @everyone.'
morning_2_... |
#!/usr/bin/python3
# from time import time
# from math import sqrt
# with open("inp.txt", "r") as f:
# a, b = list(i for i in f.read().split())
a, b = input().split()
# print(a,b,c, type(a), type(int(a)))
a = int(a)
b = int(b)
# st = time()
# -----
s1 = a * (a - 1) // 2
cuoi = b - 2
dau = b - a
s2 = (dau + cuoi) *... | (a, b) = input().split()
a = int(a)
b = int(b)
s1 = a * (a - 1) // 2
cuoi = b - 2
dau = b - a
s2 = (dau + cuoi) * (a - 1) // 2
result = s1 + s2
print(result) |
n = int(input())
a = input().split()
a = [str(m) for m in a]
for i in a:
if i == "Y":
print("Four")
exit()
print("Three") | n = int(input())
a = input().split()
a = [str(m) for m in a]
for i in a:
if i == 'Y':
print('Four')
exit()
print('Three') |
""" Solve 2021 Day 1: Sonar Sweep Problem """
def solver_problem1(inputs):
""" Count the number of increasement from given list """
num_increased = 0
for i in range(1, len(inputs)):
if inputs[i] > inputs[i - 1]:
num_increased += 1
return num_increased
def solver_problem2(... | """ Solve 2021 Day 1: Sonar Sweep Problem """
def solver_problem1(inputs):
""" Count the number of increasement from given list """
num_increased = 0
for i in range(1, len(inputs)):
if inputs[i] > inputs[i - 1]:
num_increased += 1
return num_increased
def solver_problem2(inputs):
... |
"""
Card games exercise
"""
def get_rounds(number):
"""
:param number: int - current round number.
:return: list - current round and the two that follow.
"""
return [i + number for i in range(3)]
def concatenate_rounds(rounds_1, rounds_2):
"""
:param rounds_1: list - first rounds... | """
Card games exercise
"""
def get_rounds(number):
"""
:param number: int - current round number.
:return: list - current round and the two that follow.
"""
return [i + number for i in range(3)]
def concatenate_rounds(rounds_1, rounds_2):
"""
:param rounds_1: list - first rounds p... |
# Copyright 2020 Thomas Rogers
# SPDX-License-Identifier: Apache-2.0
LOWER_LINK_TAG = 6
UPPER_LINK_TAG = 7
UPPER_WATER_TAG = 9
LOWER_WATER_TAG = 10
UPPER_STACK_TAG = 11
LOWER_STACK_TAG = 12
UPPER_GOO_TAG = 13
LOWER_GOO_TAG = 14
LOWER_LINK_TYPES = {LOWER_LINK_TAG, LOWER_WATER_TAG, LOWER_STACK_TAG, LOWER_GOO_TAG}
UP... | lower_link_tag = 6
upper_link_tag = 7
upper_water_tag = 9
lower_water_tag = 10
upper_stack_tag = 11
lower_stack_tag = 12
upper_goo_tag = 13
lower_goo_tag = 14
lower_link_types = {LOWER_LINK_TAG, LOWER_WATER_TAG, LOWER_STACK_TAG, LOWER_GOO_TAG}
upper_link_types = {UPPER_LINK_TAG, UPPER_WATER_TAG, UPPER_STACK_TAG, UPPER_... |
def pattern(n):
res=""
for i in range(n,0,-1):
for j in range(i):
res+=str(n-j)
res+="\n"
return res[:-1] | def pattern(n):
res = ''
for i in range(n, 0, -1):
for j in range(i):
res += str(n - j)
res += '\n'
return res[:-1] |
def generated_file_staleness_test(name, outs, generated_pattern):
"""Tests that checked-in file(s) match the contents of generated file(s).
The resulting test will verify that all output files exist and have the
correct contents. If the test fails, it can be invoked with --fix to
bring the checked-in... | def generated_file_staleness_test(name, outs, generated_pattern):
"""Tests that checked-in file(s) match the contents of generated file(s).
The resulting test will verify that all output files exist and have the
correct contents. If the test fails, it can be invoked with --fix to
bring the checked-in ... |
"""Package list handling"""
load(":private/set.bzl", "set")
def pkg_info_to_ghc_args(pkg_info):
"""
Takes the package info collected by `ghc_info()` and returns the actual
list of command line arguments that should be passed to GHC.
"""
args = [
# In compile.bzl, we pass this just before a... | """Package list handling"""
load(':private/set.bzl', 'set')
def pkg_info_to_ghc_args(pkg_info):
"""
Takes the package info collected by `ghc_info()` and returns the actual
list of command line arguments that should be passed to GHC.
"""
args = ['-hide-all-packages']
if not pkg_info.has_version:... |
# Copyright (c) 2016 SwiftStack, Inc.
#
# 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 w... | class Metamiddleware(object):
def __init__(self, app, conf):
self.app = app
def __call__(self, env, start_response):
h_to_del = list()
v_to_add = list()
for h in env:
if h.upper() == 'HTTP_X_PROXYFS_BIMODAL':
hToDel.append(h)
vToAdd.a... |
class call_if(object):
def __init__(self, cond):
self.condition = cond
def __call__(self, func):
def inner(*args, **kwargs):
if getattr(args[0], self.condition):
return func(*args, **kwargs)
else:
return None
return inner | class Call_If(object):
def __init__(self, cond):
self.condition = cond
def __call__(self, func):
def inner(*args, **kwargs):
if getattr(args[0], self.condition):
return func(*args, **kwargs)
else:
return None
return inner |
""" This is a test file used for testing the pytest plugin. """
def test_function_passed(snapshot):
""" The snapshot for this function is expected to exist. """
snapshot.assert_match(3 + 4j)
def test_function_new(snapshot):
""" The snapshot for this function is expected to exist, but only one assertion ... | """ This is a test file used for testing the pytest plugin. """
def test_function_passed(snapshot):
""" The snapshot for this function is expected to exist. """
snapshot.assert_match(3 + 4j)
def test_function_new(snapshot):
""" The snapshot for this function is expected to exist, but only one assertion is... |
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | hostname = 'http://localhost'
qq_oauth_state = 'openhackathon'
hackathon_api_endpoint = 'http://localhost:15000'
github_client_id = 'b44f3d47bdeb26b9c4e6'
github_client_secret = '98de14161c4b2ed3ea7a19787d62cda73b8e292c'
qq_client_id = '101200890'
qq_client_secret = '88ad67bd4521c4cc47136854781cb9b5'
qq_meta_content = ... |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def length(head) -> int:
"""
The method length, which accepts a linked list
(head), and returns the length of the list.
:param head:
:return:
"""
i = 0
if head is Non... | def length(head) -> int:
"""
The method length, which accepts a linked list
(head), and returns the length of the list.
:param head:
:return:
"""
i = 0
if head is None:
return 0
while head.next is not None:
head = head.next
i += 1
return i + 1 |
#MenuTitle: Generate lowercase from uppercase
"""
Generate lowercase a-z from uppercase A-Z
TODO (M Foley) Generate all lowercase glyphs, not just a-z
"""
font = Glyphs.font
glyphs = list('abcdefghijklmnopqrstuvwxyz')
masters = font.masters
for glyph_name in glyphs:
glyph = GSGlyph(glyph_name)
glyph.updateGl... | """
Generate lowercase a-z from uppercase A-Z
TODO (M Foley) Generate all lowercase glyphs, not just a-z
"""
font = Glyphs.font
glyphs = list('abcdefghijklmnopqrstuvwxyz')
masters = font.masters
for glyph_name in glyphs:
glyph = gs_glyph(glyph_name)
glyph.updateGlyphInfo()
font.glyphs.append(glyph)
for... |
def multiple(first,second):
return first * second
def add(x,y):
return x+y
| def multiple(first, second):
return first * second
def add(x, y):
return x + y |
# Copyright 2020 BlueCat Networks. All rights reserved.
# -*- coding: utf-8 -*-
type = 'ui'
sub_pages = [
{
'name' : 'get_audit_info_page',
'title' : u'Get Audit Info',
'endpoint' : 'get_audit_info/get_audit_info_endpoint',
'description' : u'get_audit_info'
},
]
| type = 'ui'
sub_pages = [{'name': 'get_audit_info_page', 'title': u'Get Audit Info', 'endpoint': 'get_audit_info/get_audit_info_endpoint', 'description': u'get_audit_info'}] |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2016 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
def cat_arrays(vector_arrays):
"""Return a new |VectorArray| which a concatenation of the arr... | def cat_arrays(vector_arrays):
"""Return a new |VectorArray| which a concatenation of the arrays in `vector_arrays`."""
vector_arrays = list(vector_arrays)
total_length = sum(map(len, vector_arrays))
cated_arrays = vector_arrays[0].empty(reserve=total_length)
for a in vector_arrays:
cated_ar... |
template = """<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css">
<style>
.tradingvi... | template = '<!DOCTYPE html>\n<html>\n<head>\n <meta charset="UTF-8">\n <title>Title of the document</title>\n <script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>\n <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css">\n <style>\n .tra... |
a = str(input('Enter the number you want to reverse:'))
b = (a[::-1])
c = int(b)
print('the reversed number is',c)
| a = str(input('Enter the number you want to reverse:'))
b = a[::-1]
c = int(b)
print('the reversed number is', c) |
class BaseHandler:
def send(self, data, p):
pass
def recv(self, data, p):
pass
def shutdown(self, p, direction=2):
pass
def close(self):
pass
| class Basehandler:
def send(self, data, p):
pass
def recv(self, data, p):
pass
def shutdown(self, p, direction=2):
pass
def close(self):
pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.