content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
__all__ = ['BaseModel']
class BaseModel(object):
"""Subclasses of this class are fed into the :meth:`~cosmic.api.API.model`
decorator to attach models to an API. The API object doesn't care about
how you implement this class, it just copies the necessary properties and
leaves the class alone.
"""
... | __all__ = ['BaseModel']
class Basemodel(object):
"""Subclasses of this class are fed into the :meth:`~cosmic.api.API.model`
decorator to attach models to an API. The API object doesn't care about
how you implement this class, it just copies the necessary properties and
leaves the class alone.
"""
... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class HackrfHost(CMakePackage):
"""Software for HackRF, a low cost, open source Software Defined
Radio platform."... | class Hackrfhost(CMakePackage):
"""Software for HackRF, a low cost, open source Software Defined
Radio platform."""
homepage = 'https://github.com/mossmann/hackrf'
url = 'https://github.com/mossmann/hackrf/archive/v2018.01.1.tar.gz'
maintainers = ['aweits']
root_cmakelists_dir = 'host'
versi... |
{
'name': 'Chapter 06, Recipe 07 code',
'summary': 'Port old API code to the new API',
'depends': ['base'],
}
| {'name': 'Chapter 06, Recipe 07 code', 'summary': 'Port old API code to the new API', 'depends': ['base']} |
"""Settings for the ``django-cms`` app."""
gettext = lambda s: s
CMS_LANGUAGES = [
('en', 'English'),
('de', 'German'),
]
CMS_FRONTEND_LANGUAGES = ['en', 'de', ]
CMS_TEMPLATES = (
('base.html', gettext('Base Template')),
)
CMS_SEO_FIELDS = True
CMS_SEO_ROOT = True
| """Settings for the ``django-cms`` app."""
gettext = lambda s: s
cms_languages = [('en', 'English'), ('de', 'German')]
cms_frontend_languages = ['en', 'de']
cms_templates = (('base.html', gettext('Base Template')),)
cms_seo_fields = True
cms_seo_root = True |
f = open('in.txt', 'r');
id_to_payto = {}
payto_to_id = {}
for line in f:
# INSERT INTO PAYTO VALUES(1,'Cineplex')
if line.startswith('INSERT INTO PAYTO VALUES'):
line = line.split('(')[1]
line = line.split(')')[0] # should now have the values inside the ()
tokens = line.split(',')
id_to_payto[token... | f = open('in.txt', 'r')
id_to_payto = {}
payto_to_id = {}
for line in f:
if line.startswith('INSERT INTO PAYTO VALUES'):
line = line.split('(')[1]
line = line.split(')')[0]
tokens = line.split(',')
id_to_payto[tokens[0]] = tokens[1]
payto_to_id[tokens[1]] = tokens[0]
f.close(... |
class Solution:
def shuffle(self, nums: List[int], n: int) -> List[int]:
p1 = 0
p2 = n
output = []
while p2 < len(nums):
output.append(nums[p1])
p1 += 1
output.append(nums[p2])
p2 += 1
return output | class Solution:
def shuffle(self, nums: List[int], n: int) -> List[int]:
p1 = 0
p2 = n
output = []
while p2 < len(nums):
output.append(nums[p1])
p1 += 1
output.append(nums[p2])
p2 += 1
return output |
class Toks():
UNK = 0
BOS = 1 #beginning of sentence
EOS = 2 #end of sentence
NEGATIVE_SAMPLING_NUM = 10
IN_TO_OUT_UNITS_RATIO = 2
SENT_COUNTS_FILENAME = 's_counts'
WORD_COUNTS_FILENAME = 'w_counts'
TOTAL_COUNTS_FILENAME = 'totals' | class Toks:
unk = 0
bos = 1
eos = 2
negative_sampling_num = 10
in_to_out_units_ratio = 2
sent_counts_filename = 's_counts'
word_counts_filename = 'w_counts'
total_counts_filename = 'totals' |
class Error(Exception):
"""Base class for exceptions in the imgix module."""
def __init__(self, message):
"""Initialize the `Error` with a `message` explaining why the
exception occurred.
Parameters
----------
message : str
A brief description explaining why... | class Error(Exception):
"""Base class for exceptions in the imgix module."""
def __init__(self, message):
"""Initialize the `Error` with a `message` explaining why the
exception occurred.
Parameters
----------
message : str
A brief description explaining why... |
url_config = {
'g3': 'oracle+cx_oracle://dbmgr:Yypp8msc@10.1.5.165:1521/KM',
'vip': 'oracle+cx_oracle://dbmgr:Yypp8msc@10.1.5.160:1521/kmvip',
'scrm': 'mysql+pymysql://dbmon:dbmon1234@10.1.5.143/baihui'}
sql_config = {
'SUBFHD_LSH_OLD': '''
select distinct ticketno from (
select subbh || lsh as ticket... | url_config = {'g3': 'oracle+cx_oracle://dbmgr:Yypp8msc@10.1.5.165:1521/KM', 'vip': 'oracle+cx_oracle://dbmgr:Yypp8msc@10.1.5.160:1521/kmvip', 'scrm': 'mysql+pymysql://dbmon:dbmon1234@10.1.5.143/baihui'}
sql_config = {'SUBFHD_LSH_OLD': '\nselect distinct ticketno from (\nselect subbh || lsh as ticketno from GZDBO.subfh... |
age = 35
if age < 2:
print("This person is a baby!")
if age >= 2 and age < 4:
print("This person is a toddler!")
if age >= 4 and age < 13:
print("This person is a kid!")
if age >= 20 and age < 65:
print("This person is an adult!")
if age > 65:
print("This person is an elder!") | age = 35
if age < 2:
print('This person is a baby!')
if age >= 2 and age < 4:
print('This person is a toddler!')
if age >= 4 and age < 13:
print('This person is a kid!')
if age >= 20 and age < 65:
print('This person is an adult!')
if age > 65:
print('This person is an elder!') |
# Entering the list input in one line
lst = list(map(int, input().split()))
ans = 0
length = len(lst)
for i in range(len(lst)):
ans += ((((i + 1) * (length - i) + 1) // 2) * lst[i])
# Since we have i+1 choices on the left from lst[0] to lst[i]
# and we have length-i choices on the right lst[i] to lst[length... | lst = list(map(int, input().split()))
ans = 0
length = len(lst)
for i in range(len(lst)):
ans += ((i + 1) * (length - i) + 1) // 2 * lst[i]
print(ans) |
'''
Idea:
After Object Detection Model extracts all of the targets detected,
we will have to store it in a data structure that will contain all of the targets, and more data.
2 classes will help accomplish this task in the pipeline.
-TargetStore class that will store all of the targets and do any manipulation r... | """
Idea:
After Object Detection Model extracts all of the targets detected,
we will have to store it in a data structure that will contain all of the targets, and more data.
2 classes will help accomplish this task in the pipeline.
-TargetStore class that will store all of the targets and do any manipulation req... |
#!/usr/bin/env python3
def display_menu():
print("The Movie List program")
print()
print("COMMAND MENU")
print("list - List all movies")
print("add - Add a movie")
print("del - Delete a movie")
print("exit - Exit program")
print()
def list(movie_list):
i = 1
for movie in movi... | def display_menu():
print('The Movie List program')
print()
print('COMMAND MENU')
print('list - List all movies')
print('add - Add a movie')
print('del - Delete a movie')
print('exit - Exit program')
print()
def list(movie_list):
i = 1
for movie in movie_list:
print(st... |
def forward_match(seq: str, recog: list) -> (bool):
"""
Match the sequence with a recognition sequence.
:param seq: the sequence to search in
:param recogn: a list with bases that should be
matched subsequently
:return: True if the sequence matches the
recogn... | def forward_match(seq: str, recog: list) -> bool:
"""
Match the sequence with a recognition sequence.
:param seq: the sequence to search in
:param recogn: a list with bases that should be
matched subsequently
:return: True if the sequence matches the
recognition sequ... |
#-*- coding: utf-8 -*-
#
# Copyright (c) 2012, VPSMate development team
# All rights reserved.
#
# VPSMate is distributed under the terms of the (new) BSD License.
# The full license can be found in 'LICENSE.txt'.
# repository list that YUM support
yum_repolist = ('base', 'updates', 'epel', 'CentALT', 'ius', 'atomic'... | yum_repolist = ('base', 'updates', 'epel', 'CentALT', 'ius', 'atomic', '10gen')
yum_reporpms = {'base': {5: {'x86_64': ('http://mirror.centos.org/centos/5/os/x86_64/CentOS/centos-release-notes-5.8-0.x86_64.rpm', 'http://mirror.centos.org/centos/5/os/x86_64/CentOS/centos-release-5-8.el5.centos.x86_64.rpm'), 'i386': ('ht... |
#!/usr/bin/python3
# Filename: expression.py
length = 5 # assign variables
breadth = 2
area = length * breadth # assign new variable from product
print('Area is', area) # print to console
print('Perimeter is', 2 * (length + breadth)) # note order of precedence | length = 5
breadth = 2
area = length * breadth
print('Area is', area)
print('Perimeter is', 2 * (length + breadth)) |
# Types of Linked Lists
# In this notebook we'll explore three versions of linked-lists: singly-linked lists, doubly-linked lists, and circular lists.
class Node:
def __init__(self, value):
self.value = value
self.next = None
# A small linked list:
head = Node(1)
head.next = Node(2) | class Node:
def __init__(self, value):
self.value = value
self.next = None
head = node(1)
head.next = node(2) |
"""This module contains EVM exception types used by LASER."""
class VmException(Exception):
"""The base VM exception type."""
pass
class StackUnderflowException(IndexError, VmException):
"""A VM exception regarding stack underflows."""
pass
class StackOverflowException(VmException):
"""A VM ... | """This module contains EVM exception types used by LASER."""
class Vmexception(Exception):
"""The base VM exception type."""
pass
class Stackunderflowexception(IndexError, VmException):
"""A VM exception regarding stack underflows."""
pass
class Stackoverflowexception(VmException):
"""A VM excep... |
class T0:
def __init__(self, x, y):
self.status = 0
self.x = x
self.y = y
def get_status(self):
return self.status
def set_status(self, status):
self.status = status
def get_pos(self):
return self.x, self.y
class T1:
def __init__(self, x_pos, y_po... | class T0:
def __init__(self, x, y):
self.status = 0
self.x = x
self.y = y
def get_status(self):
return self.status
def set_status(self, status):
self.status = status
def get_pos(self):
return (self.x, self.y)
class T1:
def __init__(self, x_pos, y... |
# possible phases of the engine, used throughout the project.
TRAIN = 'training'
VALID = 'validation'
INFER = 'inference'
EXPORT = 'export'
EVAL = 'evaluation'
ALL = 'all'
| train = 'training'
valid = 'validation'
infer = 'inference'
export = 'export'
eval = 'evaluation'
all = 'all' |
# Pre-built replacers.
def uuid(anon, obj, field, val):
"""
Returns a random uuid string
"""
return anon.faker.uuid(field=field)
def varchar(anon, obj, field, val):
"""
Returns random data for a varchar field.
"""
return anon.faker.varchar(field=field)
def bool(anon, obj, field, va... | def uuid(anon, obj, field, val):
"""
Returns a random uuid string
"""
return anon.faker.uuid(field=field)
def varchar(anon, obj, field, val):
"""
Returns random data for a varchar field.
"""
return anon.faker.varchar(field=field)
def bool(anon, obj, field, val):
"""
Returns a r... |
"""
Purpose: format station file for QuakeMigrate from IRIS GMAP
(https://ds.iris.edu/gmap/) output.
QuakeMigrate station file format is:
Latitude, Longitude, Elevation (km), Station Name
"""
# define the IRIS GMAP station file path
gmap_Station_File = "stations.txt"
# define path that Quak... | """
Purpose: format station file for QuakeMigrate from IRIS GMAP
(https://ds.iris.edu/gmap/) output.
QuakeMigrate station file format is:
Latitude, Longitude, Elevation (km), Station Name
"""
gmap__station__file = 'stations.txt'
qm__station__file = 'qm_stations.txt'
station__dict = {}
networ... |
{
"targets": [{
"target_name": "binding",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": [
"src/main.cpp",
"src/StoreContext.cpp",
"src/WindowsStoreImpl.cpp",
"src/RequestPurchaseAsyncWorker.cpp",
... | {'targets': [{'target_name': 'binding', 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'sources': ['src/main.cpp', 'src/StoreContext.cpp', 'src/WindowsStoreImpl.cpp', 'src/RequestPurchaseAsyncWorker.cpp', 'src/GetStoreProductsAsyncWorker.cpp', 'src/GetCustomerPurchaseIdAsyncWorker.cpp', 'src/GetAppL... |
class Plugin:
def __init__(self, owner):
self.owner = owner
return
def Load(self, options):
# Caller requires but that's it
return
def Save(self) -> dict:
# Caller consumes dict of settings
options = {}
return options | class Plugin:
def __init__(self, owner):
self.owner = owner
return
def load(self, options):
return
def save(self) -> dict:
options = {}
return options |
def anagram(s):
l = len(s)
k = int(l / 2)
if l % 2 == 0:
c = 0
a1 = list(s[0:k])
b1 = list(s[k:])
p2 = b1.copy()
for i in a1:
if i in p2:
p2.pop(p2.index(i))
else:
c += 1
return c
else:
return... | def anagram(s):
l = len(s)
k = int(l / 2)
if l % 2 == 0:
c = 0
a1 = list(s[0:k])
b1 = list(s[k:])
p2 = b1.copy()
for i in a1:
if i in p2:
p2.pop(p2.index(i))
else:
c += 1
return c
else:
return... |
##
##
mydictionary = {'node001':['rtr001', '192.168.1.1', 'IOS-XE', '3rd Floor'],
'node002':['rtr002', '192.168.1.2', 'IOS-XR', '5th Floor'],
'node003':['rtr003', '192.168.1.3', 'IOS', '1st Floor']}
print(mydictionary['node001'])
print(mydictionary['node002'])
print(mydictionary['node00... | mydictionary = {'node001': ['rtr001', '192.168.1.1', 'IOS-XE', '3rd Floor'], 'node002': ['rtr002', '192.168.1.2', 'IOS-XR', '5th Floor'], 'node003': ['rtr003', '192.168.1.3', 'IOS', '1st Floor']}
print(mydictionary['node001'])
print(mydictionary['node002'])
print(mydictionary['node003']) |
# Non-abundant sums
def faktor(i):
f = set()
j = 1
while not j in f and j < i:
if i%j == 0:
f.add(j)
f.add(i / j)
j += 1
return f
def razvrsti(i):
vsota = sum(faktor(i)) - i
if vsota < i:
return -1
if vsota == i:
return 0
if vsota... | def faktor(i):
f = set()
j = 1
while not j in f and j < i:
if i % j == 0:
f.add(j)
f.add(i / j)
j += 1
return f
def razvrsti(i):
vsota = sum(faktor(i)) - i
if vsota < i:
return -1
if vsota == i:
return 0
if vsota > i:
retur... |
__author__ = 'toadicus'
class Mod:
def __init__(self, *args, **kwargs):
self.versions = []
""":type : list[ModVersion]"""
self.author = None
""":type : str"""
self.downloads = None
""":type : int"""
self.default_version_id = None
""":type : int"""
... | __author__ = 'toadicus'
class Mod:
def __init__(self, *args, **kwargs):
self.versions = []
':type : list[ModVersion]'
self.author = None
':type : str'
self.downloads = None
':type : int'
self.default_version_id = None
':type : int'
self.follo... |
LIBRARY_ARTIFACT_ID = "micro-kotlin-args"
LIBRARY_VERSION = "HEAD-SNAPSHOT" # Don't refactor this without altering tools/deploy.kts
# What language compliance levels are we configuring
JAVA_LANGUAGE_LEVEL = "1.8"
KOTLIN_LANGUAGE_LEVEL = "1.3"
# What version of kotlin are we using
KOTLIN_VERSION = "1.4.32"
KOTLINC_RE... | library_artifact_id = 'micro-kotlin-args'
library_version = 'HEAD-SNAPSHOT'
java_language_level = '1.8'
kotlin_language_level = '1.3'
kotlin_version = '1.4.32'
kotlinc_release_sha = 'dfef23bb86bd5f36166d4ec1267c8de53b3827c446d54e82322c6b6daad3594c'
kotlinc_release_url = 'https://github.com/JetBrains/kotlin/releases/dow... |
result_set = [1,2,8,2]
max = result_set[0]
min = result_set[0]
for x in result_set:
total = 0
counter = 0
total = total + x
counter = counter + 1
if(x > max):
max = x
if (x < min):
min = x
print(max)
indexmax = result_set.index(max)
print(indexmax)
print(min)
indexmin = resu... | result_set = [1, 2, 8, 2]
max = result_set[0]
min = result_set[0]
for x in result_set:
total = 0
counter = 0
total = total + x
counter = counter + 1
if x > max:
max = x
if x < min:
min = x
print(max)
indexmax = result_set.index(max)
print(indexmax)
print(min)
indexmin = result_se... |
def filter_cars(year: int) -> list:
result = []
for car in car_list:
if car["year"] < year:
result.append(car)
return result
if __name__ == "__main__":
car_list = [
{
"serial": 32145,
"color": "red",
"year": 2015,
},
{... | def filter_cars(year: int) -> list:
result = []
for car in car_list:
if car['year'] < year:
result.append(car)
return result
if __name__ == '__main__':
car_list = [{'serial': 32145, 'color': 'red', 'year': 2015}, {'serial': 32133, 'color': 'black', 'year': 2011}, {'serial': 31145... |
load("@bazel_gazelle//:deps.bzl", "go_repository")
def runc_dependencies():
go_repository(
name = "com_github_opencontainers_runc",
commit = "029124da7af7360afa781a0234d1b083550f797c", # v1.0.0-rc7 plus a few patches for a regression
importpath = "github.com/opencontainers/runc",
)
| load('@bazel_gazelle//:deps.bzl', 'go_repository')
def runc_dependencies():
go_repository(name='com_github_opencontainers_runc', commit='029124da7af7360afa781a0234d1b083550f797c', importpath='github.com/opencontainers/runc') |
n, m = map(int, input().split())
a = [0] * (n+1)
b = [0] * (n+1)
c = 0
for i in [0]*(m):
s = input().split()
if a[int(s[0])] == 0:
if s[1] == "AC":
a[int(s[0])] = 1
c += b[int(s[0])]
else:
b[int(s[0])] += 1
print(sum(a), c)
| (n, m) = map(int, input().split())
a = [0] * (n + 1)
b = [0] * (n + 1)
c = 0
for i in [0] * m:
s = input().split()
if a[int(s[0])] == 0:
if s[1] == 'AC':
a[int(s[0])] = 1
c += b[int(s[0])]
else:
b[int(s[0])] += 1
print(sum(a), c) |
translatable_strings = [
'Remove this comment?',
'Remove',
'This comment has been removed.',
'moderator',
'sections',
'Check if applies',
'New comments have been disabled for this page.',
'Correct answer',
'Download',
'You are leaving the <b>Internet of Good Things</b> to visit a... | translatable_strings = ['Remove this comment?', 'Remove', 'This comment has been removed.', 'moderator', 'sections', 'Check if applies', 'New comments have been disabled for this page.', 'Correct answer', 'Download', 'You are leaving the <b>Internet of Good Things</b> to visit an external website and standard data char... |
"""
Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution
still work?
Note:
You may only use constant extra space.
For example,
Given the following binary tree,
1
/ \
2 3
/ \ \
4 5 ... | """
Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution
still work?
Note:
You may only use constant extra space.
For example,
Given the following binary tree,
1
/ 2 3
/ \\ 4 5 7
... |
# set the possible resource methods for all branches
RESOURCE_METHODS = ['GET', 'POST']
DOMAIN = {
# create a `user` branch
'user': {
'schema': {
'username': {
'type': 'string',
'unique': True
},
'password': {
'type': '... | resource_methods = ['GET', 'POST']
domain = {'user': {'schema': {'username': {'type': 'string', 'unique': True}, 'password': {'type': 'string'}}, 'additional_lookup': {'url': 'regex("[\\w]+")', 'field': 'username'}}, 'people': {'schema': {'name': {'type': 'string', 'unique': True}}, 'public_methods': ['GET', 'POST'], '... |
#
# Example file for working with functions
#
# define a basic function
def func1():
print("I am a function")
# function that takes arguments
def func2(arg1, arg2):
print(arg1, " ", arg2)
# function that returns a value
def cube(x):
return x * 9
# function with default value for an argument
def power(num, x=... | def func1():
print('I am a function')
def func2(arg1, arg2):
print(arg1, ' ', arg2)
def cube(x):
return x * 9
def power(num, x=1):
result = 1
for i in range(x):
result = result * num
return result
def multi_add(*args):
result = 0
for x in args:
result = result + x
... |
def sequence_data():
return [[1465980660.726887, 1, 0.07000000029802322],
[1465980660.767164, 2, 0.18000000715255737],
[1465980660.799817, 3, 0.3199999928474426],
[1465980660.831853, 4, 0.33000001311302185],
[1465980660.86555, 5, 0.3400000035762787],
[1465... | def sequence_data():
return [[1465980660.726887, 1, 0.07000000029802322], [1465980660.767164, 2, 0.18000000715255737], [1465980660.799817, 3, 0.3199999928474426], [1465980660.831853, 4, 0.33000001311302185], [1465980660.86555, 5, 0.3400000035762787], [1465980660.898716, 6, 0.6000000238418579], [1465980660.930804, 7... |
class ActionSpace(object):
def __init__(self, driver=None):
self.driver = driver
self.available_actions = [
self.mouse_press,
self.mouse_scroll_up,
self.mouse_scroll_down,
self.move_mouse_right,
self.move_mouse_left,
self.move... | class Actionspace(object):
def __init__(self, driver=None):
self.driver = driver
self.available_actions = [self.mouse_press, self.mouse_scroll_up, self.mouse_scroll_down, self.move_mouse_right, self.move_mouse_left, self.move_mouse_up, self.move_mouse_down]
self.number_of_actions = len(self... |
'''5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. En... | """5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. En... |
'''
Visit the link : https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Maze&url=worlds%2Ftutorial_en%2Fmaze1.json
'''
def turn_right():
turn_left()
turn_left()
turn_left()
while not at_goal():
if right_is_clear():
turn_right()
move()
... | """
Visit the link : https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Maze&url=worlds%2Ftutorial_en%2Fmaze1.json
"""
def turn_right():
turn_left()
turn_left()
turn_left()
while not at_goal():
if right_is_clear():
turn_right()
move()
... |
class Solution:
def numEnclaves(self, A: List[List[int]]) -> int:
col_length = len(A)
row_length = len(A[0])
def dfs(land, col, row):
if col < 0:
return
if col > col_length - 1:
return
if row < 0:
... | class Solution:
def num_enclaves(self, A: List[List[int]]) -> int:
col_length = len(A)
row_length = len(A[0])
def dfs(land, col, row):
if col < 0:
return
if col > col_length - 1:
return
if row < 0:
return
... |
inputs = [
"tau1_pt_gen",
"tau1_eta_gen",
"tau1_phi_gen",
"tau2_pt_gen",
"tau2_eta_gen",
"tau2_phi_gen",
"jet1_pt_reco",
"jet1_eta_reco",
"jet1_phi_reco",
"jet2_pt_reco",
"jet2_eta_reco",
"jet2_phi_reco",
"remaining_jets_pt_reco",
"remaining_jets_eta_reco",
"r... | inputs = ['tau1_pt_gen', 'tau1_eta_gen', 'tau1_phi_gen', 'tau2_pt_gen', 'tau2_eta_gen', 'tau2_phi_gen', 'jet1_pt_reco', 'jet1_eta_reco', 'jet1_phi_reco', 'jet2_pt_reco', 'jet2_eta_reco', 'jet2_phi_reco', 'remaining_jets_pt_reco', 'remaining_jets_eta_reco', 'remaining_jets_phi_reco', 'remaining_jets_N_reco', 'MET_pt_gen... |
"""
while condition:
continue
break
while condition:
while condition:
while / else
"""
x = 0
while x < 10:
if x == 3:
x += 1
continue # jump to the next loop
print(x)
x += 1
print('finish\n')
x = 0
while x < 10:
if x == 3:
x += 1
break # break the while loop
p... | """
while condition:
continue
break
while condition:
while condition:
while / else
"""
x = 0
while x < 10:
if x == 3:
x += 1
continue
print(x)
x += 1
print('finish\n')
x = 0
while x < 10:
if x == 3:
x += 1
break
print(x)
x += 1
print('finish\n')
x = 0
while x... |
myemp = {
'Name': 'Angela',
'Age':30,
'Sex': 'Female',
'Profession': 'Doctor'}
print(myemp.items())# I1
print(type(myemp.items()))# I2
for key, value in myemp.items():
print(key, '-----',value)# I3
| myemp = {'Name': 'Angela', 'Age': 30, 'Sex': 'Female', 'Profession': 'Doctor'}
print(myemp.items())
print(type(myemp.items()))
for (key, value) in myemp.items():
print(key, '-----', value) |
__author__ = "Sunil Kumar (kumar.sunil.p@gmail.com)"
__copyright__ = "Copyright 2014, Washington University in St. Louis"
__credits__ = ["Sunil Kumar", "Steve Pieper", "Dan Marcus"]
__license__ = "XNAT Software License Agreement " + "(see: http://xnat.org/about/license.php_)"
__version__ = "2.1.1"
__maint... | __author__ = 'Sunil Kumar (kumar.sunil.p@gmail.com)'
__copyright__ = 'Copyright 2014, Washington University in St. Louis'
__credits__ = ['Sunil Kumar', 'Steve Pieper', 'Dan Marcus']
__license__ = 'XNAT Software License Agreement ' + '(see: http://xnat.org/about/license.php_)'
__version__ = '2.1.1'
__maintainer__ = 'Ric... |
"""
# Copyright 2020 Adobe
# All Rights Reserved.
# NOTICE: Adobe permits you to use, modify, and distribute this file in
# accordance with the terms of the Adobe license agreement accompanying
# it.
"""
| """
# Copyright 2020 Adobe
# All Rights Reserved.
# NOTICE: Adobe permits you to use, modify, and distribute this file in
# accordance with the terms of the Adobe license agreement accompanying
# it.
""" |
#
# PySNMP MIB module XYLAN-ASCONFIG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-ASCONFIG-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:38:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
"""
Module to aid in testing tree related functionality.
"""
def assert_tree_structure(tree, children_paths):
"""
Assert a tree structure from tree node paths to values.
Args:
tree: The tree whose structure to inspect.
children_paths: A dictionary from child indices to token indices.
... | """
Module to aid in testing tree related functionality.
"""
def assert_tree_structure(tree, children_paths):
"""
Assert a tree structure from tree node paths to values.
Args:
tree: The tree whose structure to inspect.
children_paths: A dictionary from child indices to token indices.
"... |
class Solution:
def XXX(self, digits: List[int]) -> List[int]:
r = len(digits) - 1
while r >= 0:
if digits[r] < 9:
digits[r] += 1
return digits
else:
digits[r] = 0
r -= 1
if r < 0:
digits.inse... | class Solution:
def xxx(self, digits: List[int]) -> List[int]:
r = len(digits) - 1
while r >= 0:
if digits[r] < 9:
digits[r] += 1
return digits
else:
digits[r] = 0
r -= 1
if r < 0:
digits.ins... |
# Copyright 2014 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': 'devices_app_lib',
'type': 'static_library',
'include_d... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'devices_app_lib', 'type': 'static_library', 'include_dirs': ['../..'], 'sources': ['devices_app.cc', 'devices_app.h', 'usb/device_impl.cc', 'usb/device_impl.h', 'usb/device_manager_impl.cc', 'usb/device_manager_impl.h', 'usb/type_converters.cc', 'usb/type... |
"""
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an
algorithm to find the maximum profit.
"""
__author__ = 'Danyang'
class Solution(object):
de... | """
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an
algorithm to find the maximum profit.
"""
__author__ = 'Danyang'
class Solution(object):
def max_prof... |
"""Role testing files using testinfra."""
def test_fail2ban_is_installed(host):
command = """dnf list installed fail2ban | grep -c 'fail2ban'"""
cmd = host.run(command)
assert '1' in cmd.stdout
def test_fail2ban_is_running(host):
command = """systemctl status fail2ban | grep -c 'active (running)'"""... | """Role testing files using testinfra."""
def test_fail2ban_is_installed(host):
command = "dnf list installed fail2ban | grep -c 'fail2ban'"
cmd = host.run(command)
assert '1' in cmd.stdout
def test_fail2ban_is_running(host):
command = "systemctl status fail2ban | grep -c 'active (running)'"
cmd =... |
#Creating new file
outputFile = open(r'temp_file.txt','w')
#write raw text
outputFile.write('This line is from string')
#write a list to file
text = ['This','line','is','from','a','list']
outputFile.writelines(text)
#write a list to file
text = ('This','line','is','from','a','tuple')
outputFile.writelines(text)
#cl... | output_file = open('temp_file.txt', 'w')
outputFile.write('This line is from string')
text = ['This', 'line', 'is', 'from', 'a', 'list']
outputFile.writelines(text)
text = ('This', 'line', 'is', 'from', 'a', 'tuple')
outputFile.writelines(text)
outputFile.close()
input_file = open('temp_file.txt', 'r')
read_text = inpu... |
'''
Priority Queue implementation using binary heaps
https://www.youtube.com/watch?v=eVq8CmoC1x8&list=PLDV1Zeh2NRsB6SWUrDFW2RmDotAfPbeHu&index=17
This code is done without using reverse mapping - takes O(n) time for remove_elem(elem)
Can be improved by implementing it - https://www.youtube.com/watch?v=eVq8CmoC1x8&li... | """
Priority Queue implementation using binary heaps
https://www.youtube.com/watch?v=eVq8CmoC1x8&list=PLDV1Zeh2NRsB6SWUrDFW2RmDotAfPbeHu&index=17
This code is done without using reverse mapping - takes O(n) time for remove_elem(elem)
Can be improved by implementing it - https://www.youtube.com/watch?v=eVq8CmoC1x8&li... |
numbers = input("Enter a string of number: ")
num_strings = list(numbers)
if len(num_strings) > 2:
print(num_strings[0:2])
else:
print(num_strings)
| numbers = input('Enter a string of number: ')
num_strings = list(numbers)
if len(num_strings) > 2:
print(num_strings[0:2])
else:
print(num_strings) |
#!/usr/bin/env python3
def printPrimeNumber(startN, value):
if(startN!=0):
n = startN + 1
else:
n = 0
value += n
while n<value:
n += 1
if is_prime(n):
pass
def is_prime(n):
if n % 2 == 0 and n > 2:
return False
return all(n % i for i in range(3, int(n**0.5) + 1, 2))
printPrimeNumber(0, 1000000) | def print_prime_number(startN, value):
if startN != 0:
n = startN + 1
else:
n = 0
value += n
while n < value:
n += 1
if is_prime(n):
pass
def is_prime(n):
if n % 2 == 0 and n > 2:
return False
return all((n % i for i in range(3, int(n ** 0.5) ... |
# Autogenerated file for HID Adapter
# Add missing from ... import const
_JD_SERVICE_CLASS_HID_ADAPTER = const(0x1e5758b5)
_JD_HID_ADAPTER_REG_NUM_CONFIGURATIONS = const(0x80)
_JD_HID_ADAPTER_REG_CURRENT_CONFIGURATION = const(0x81)
_JD_HID_ADAPTER_CMD_GET_CONFIGURATION = const(0x80)
_JD_HID_ADAPTER_CMD_SET_BINDING = co... | _jd_service_class_hid_adapter = const(509040821)
_jd_hid_adapter_reg_num_configurations = const(128)
_jd_hid_adapter_reg_current_configuration = const(129)
_jd_hid_adapter_cmd_get_configuration = const(128)
_jd_hid_adapter_cmd_set_binding = const(130)
_jd_hid_adapter_cmd_clear_binding = const(131)
_jd_hid_adapter_cmd_c... |
array = [1,1,2,6,24,120,720,5040,40320, 362880, 3628800]
answer = 0
aL = []
for i in range(1, 10000000):
digit_sum = 0
p_num = i
while p_num > 0:
digit_sum += array[int(p_num%10)]
if digit_sum > i:
break
p_num = int(p_num/10)
if digit_sum == i:
answer += i
... | array = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800]
answer = 0
a_l = []
for i in range(1, 10000000):
digit_sum = 0
p_num = i
while p_num > 0:
digit_sum += array[int(p_num % 10)]
if digit_sum > i:
break
p_num = int(p_num / 10)
if digit_sum == i:
an... |
menu = True
submenu = True
first_check = True
def operator_checker(operator):
if operator == "+":
return True
elif operator == "-":
return True
elif operator == "*":
return True
elif operator == "/":
return True
else:
return False
while menu:
# We use... | menu = True
submenu = True
first_check = True
def operator_checker(operator):
if operator == '+':
return True
elif operator == '-':
return True
elif operator == '*':
return True
elif operator == '/':
return True
else:
return False
while menu:
while submen... |
class CPU(object):
def __init__(self, program):
self.program = program
self.ip = 0
self.registers = {'a': 0, 'b': 0}
self.instr = {
'hlf': self.hlf,
'tpl': self.tpl,
'inc': self.inc,
'jmp': self.jmp,
'jie': self.jie,
... | class Cpu(object):
def __init__(self, program):
self.program = program
self.ip = 0
self.registers = {'a': 0, 'b': 0}
self.instr = {'hlf': self.hlf, 'tpl': self.tpl, 'inc': self.inc, 'jmp': self.jmp, 'jie': self.jie, 'jio': self.jio}
def reset(self, a, b):
self.ip = 0
... |
# Space: O(n)
# Time: O(n)
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def increasingBST(self, root):
if root is None: return root
if... | class Solution:
def increasing_bst(self, root):
if root is None:
return root
if root.left is None and root.right is None:
return root
def inorder_traversal(root):
if root:
yield from inorder_traversal(root.left)
yield root... |
"""
Is Unique
Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?
"""
# Time: O(n)
# Space: O(1)
# Assuming an ASCII string
class Solution1:
def is_unique(self, s: str) -> bool:
if len(s) > 128:
return False
unique_chars = [Fal... | """
Is Unique
Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?
"""
class Solution1:
def is_unique(self, s: str) -> bool:
if len(s) > 128:
return False
unique_chars = [False] * 128
for c in s:
... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def push(self, new_data):
new_node = Node(new_data)
new_node.next = self.head
self.head = new_node
def reverse(self, h... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def push(self, new_data):
new_node = node(new_data)
new_node.next = self.head
self.head = new_node
def reverse(self, head, k... |
class Solution:
def myAtoi(self, s: str) -> int:
max_value = 2 ** 31 - 1
min_value = -2 ** 31
num = 0
digit_only = False
sign = None
for c in s:
if '0' <= c <= '9':
digit_only = True
c = int(c)
if num is None... | class Solution:
def my_atoi(self, s: str) -> int:
max_value = 2 ** 31 - 1
min_value = -2 ** 31
num = 0
digit_only = False
sign = None
for c in s:
if '0' <= c <= '9':
digit_only = True
c = int(c)
if num is No... |
def count_dict_dups(dictionary):
"""dict -> int
Returns a set of the integers that have duplicates.
>>>count_dict_dups({'red': 1, 'blue': 2, 'green': 1, 'orange': 1})
1
>>>count_dict_dups({'a': 2, 'b': 2, 'c': 4, 'd': 4})
2
"""
seen_values = set()
duplicates = set()
for i in d... | def count_dict_dups(dictionary):
"""dict -> int
Returns a set of the integers that have duplicates.
>>>count_dict_dups({'red': 1, 'blue': 2, 'green': 1, 'orange': 1})
1
>>>count_dict_dups({'a': 2, 'b': 2, 'c': 4, 'd': 4})
2
"""
seen_values = set()
duplicates = set()
for i in d... |
class FileTypeError(Exception):
"""
Thrown when an XML dump file is not of an expected type.
"""
pass
class MalformedXML(Exception):
"""
Thrown when an XML dump file is not formatted as expected.
"""
pass
| class Filetypeerror(Exception):
"""
Thrown when an XML dump file is not of an expected type.
"""
pass
class Malformedxml(Exception):
"""
Thrown when an XML dump file is not formatted as expected.
"""
pass |
class mymathlib:
def __init__(self):
"""Constructor for this class..."""
print("Creating object : "+self.__class__.__name__)
def add(self, x, y):
return (x+y)
def mul(self, x, y):
return (x*y)
def sub(self, x, y):
return (x-y)
def div(self, x, y):
... | class Mymathlib:
def __init__(self):
"""Constructor for this class..."""
print('Creating object : ' + self.__class__.__name__)
def add(self, x, y):
return x + y
def mul(self, x, y):
return x * y
def sub(self, x, y):
return x - y
def div(self, x, y):
... |
# Exercise from Section 18.3
class Time:
def time_to_int(self):
return self.second + 60 * (self.minute + 60* self.hour)
def __lt__(self, other):
return self.time_to_int() < other.time_to_int()
| class Time:
def time_to_int(self):
return self.second + 60 * (self.minute + 60 * self.hour)
def __lt__(self, other):
return self.time_to_int() < other.time_to_int() |
# Defining the Error Classes
class InvalidServiceName(Exception):
# Raised when the Service Name entered is Invalid
pass
| class Invalidservicename(Exception):
pass |
# Clone Graph
# Definition for a Node.
class Node:
def __init__(self, val = 0, neighbors = None):
self.val = val
self.neighbors = neighbors if neighbors is not None else []
def __repr__(self):
return f"{self.val} - [{', '.join(str(n.val) for n in self.neighbors)}]"
class Solution:
... | class Node:
def __init__(self, val=0, neighbors=None):
self.val = val
self.neighbors = neighbors if neighbors is not None else []
def __repr__(self):
return f"{self.val} - [{', '.join((str(n.val) for n in self.neighbors))}]"
class Solution:
def clone_helper(self, node, nodeMap):
... |
#!/usr/bin/env python3
# MIT License
# Copyright (c) 2019 Anshuman Dhuliya
"""Project wide messages.."""
CONTROL_HERE_ERROR = "Control should not reach here."
START_BB_ID_NOT_MINUS_ONE = (
"Start BB id is not -1 in the given input Dict["
"BasicBlockId, BB]."
)
END_BB_ID_NOT_ZERO = (
"End BB id is not 0 in th... | """Project wide messages.."""
control_here_error = 'Control should not reach here.'
start_bb_id_not_minus_one = 'Start BB id is not -1 in the given input Dict[BasicBlockId, BB].'
end_bb_id_not_zero = 'End BB id is not 0 in the given input Dict[BasicBlockId, BB].\nThis is required if BB count is greater than one.'
ptr_i... |
print("import pycenter")
def center(var: str, space: int = None, icon: str = "", sep: bool = False):
center_content = f"{f'var={var}' if var else ''}{f', space={space}' if space else ''}{f', icon={icon}' if icon else ''}{f', sep={sep}' if sep else ''}"
print(f'pycenter.center("{center_content}")')
ret... | print('import pycenter')
def center(var: str, space: int=None, icon: str='', sep: bool=False):
center_content = f"{(f'var={var}' if var else '')}{(f', space={space}' if space else '')}{(f', icon={icon}' if icon else '')}{(f', sep={sep}' if sep else '')}"
print(f'pycenter.center("{center_content}")')
return... |
"""Top-level package for Crypto Fernet."""
__author__ = """Sergey Panfilov"""
__email__ = 'sergray@gmail.com'
__version__ = '0.1.0'
| """Top-level package for Crypto Fernet."""
__author__ = 'Sergey Panfilov'
__email__ = 'sergray@gmail.com'
__version__ = '0.1.0' |
def find_max_cross_subarray(A, low, mid, high):
left_sum = float('-inf')
temp_sum = 0
for i in range(mid - 1, low - 1, -1):
# tricy place in python, in python range(1,3) means only 1,2 without 3
temp_sum = temp_sum + A[i]
if temp_sum > left_sum:
left_sum = temp_sum
... | def find_max_cross_subarray(A, low, mid, high):
left_sum = float('-inf')
temp_sum = 0
for i in range(mid - 1, low - 1, -1):
temp_sum = temp_sum + A[i]
if temp_sum > left_sum:
left_sum = temp_sum
max_left = i
right_sum = float('-inf')
temp_sum = 0
for i in ... |
###########################################################
#
###########################################################
class Graph:
#######################################################
def __init__(self, n):
self.n = n
self.CleanUpEdges()
#####################################... | class Graph:
def __init__(self, n):
self.n = n
self.CleanUpEdges()
def clean_up_edges(self):
self.edges = [None] * self.n
for i in range(self.n):
self.edges[i] = set()
def add_edge(self, a, b):
self.edges[a].add(b)
self.edges[b].add(a)
def ... |
class Institution:
def __init__(self, environment, name=None):
self.environment = environment # environment in which the institution is invoked
self.recorder = self.environment.recorder
self.id = None # id for the institution - what should this be?
self.name = name ... | class Institution:
def __init__(self, environment, name=None):
self.environment = environment
self.recorder = self.environment.recorder
self.id = None
self.name = name
self.event_registry = {}
self.player = None
self.players = {}
self.player_object = ... |
# This is an input class. Do not edit.
class Node:
def __init__(self, value):
self.value = value
self.prev = None
self.next = None
# Feel free to add new properties and methods to the class.
class DoublyLinkedList:
def __init__(self):
self.head = None
self.tail = None
... | class Node:
def __init__(self, value):
self.value = value
self.prev = None
self.next = None
class Doublylinkedlist:
def __init__(self):
self.head = None
self.tail = None
def set_head(self, node):
if node == self.head and node == self.tail:
pass... |
n = 1
while n >= 1:
print(n)
n += 1
| n = 1
while n >= 1:
print(n)
n += 1 |
input = [x for x in open('input.txt', 'r').read().splitlines()]
def check_position(data, x, y):
return data[y][x % len(data[0])] == '#'
def check_slope(data, slope):
height = len(data)
n = 0
for i in range(height):
if slope[1]*i > height:
break
if check_position(data, slo... | input = [x for x in open('input.txt', 'r').read().splitlines()]
def check_position(data, x, y):
return data[y][x % len(data[0])] == '#'
def check_slope(data, slope):
height = len(data)
n = 0
for i in range(height):
if slope[1] * i > height:
break
if check_position(data, slo... |
DEBUG = True
AUTH_REQUIRED = False
URL_PREFIX = '/gitlab/v1'
LISTENER = 'http://10.112.0.113:5000/git/v1/saltenvs'
| debug = True
auth_required = False
url_prefix = '/gitlab/v1'
listener = 'http://10.112.0.113:5000/git/v1/saltenvs' |
class Marker:
"""Map marker model"""
def __init__(self):
self.lat = None
self.long = None
self.label = None
@classmethod
def from_json(cls, marker_json):
marker = cls()
marker.lat = marker_json.get('lat')
marker.long = marker_json.get('long')
mark... | class Marker:
"""Map marker model"""
def __init__(self):
self.lat = None
self.long = None
self.label = None
@classmethod
def from_json(cls, marker_json):
marker = cls()
marker.lat = marker_json.get('lat')
marker.long = marker_json.get('long')
mar... |
x = 5
y = "John"
print(x)
print(y)
x = 4
x = "Sally"
print(x)
x = str(3)
y = int(3)
z = float(3)
x = 5
y = "John"
print(type(x))
print(type(y))
x, y, z = "Orange", "Bananna", "Cherry"
print(x, y, z)
x = y = z = "Orange"
print(x)
print(y)
print(z)
fruit = ["apple", "banana", 'cherry']
x, y, z = fruit
print(x)
prin... | x = 5
y = 'John'
print(x)
print(y)
x = 4
x = 'Sally'
print(x)
x = str(3)
y = int(3)
z = float(3)
x = 5
y = 'John'
print(type(x))
print(type(y))
(x, y, z) = ('Orange', 'Bananna', 'Cherry')
print(x, y, z)
x = y = z = 'Orange'
print(x)
print(y)
print(z)
fruit = ['apple', 'banana', 'cherry']
(x, y, z) = fruit
print(x)
prin... |
class Polynomial:
def __init__(self, *coeffs):
self.coeffs = coeffs
def __repr__(self):
return 'Polynomial(*{!r})'.format(self.coeffs)
def __add__(self, other):
return Polynomial(*(x + y for x, y in zip(self.coeffs, other.coeffs)))
def __sub__(self, other):
... | class Polynomial:
def __init__(self, *coeffs):
self.coeffs = coeffs
def __repr__(self):
return 'Polynomial(*{!r})'.format(self.coeffs)
def __add__(self, other):
return polynomial(*(x + y for (x, y) in zip(self.coeffs, other.coeffs)))
def __sub__(self, other):
return p... |
# Lumi Coding Challenge
# _____________________
#
# We have a set of tasks, each running at least daily, which are scheduled with a simplified cron. We want to find when each of them will next run.
#
# The scheduler config looks like this (the task names are arbitrary examples here):
#
# 30 1 /bin/run_me_daily
# 45 * /... | class Cronjob:
def __init__(self, minutes='*', hours='*', bin='/bin/bash'):
self.minutes = minutes
self.hours = hours
self.bin = bin
self.execs = []
self._execs()
def next(self, time):
_time = int(''.join(time.split(':')))
next_exec = self._next(_time)
... |
USER_NAME_REGEX: str = r"[^\x00-\x7F]+"
URL_REGEX: str = r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
OKWHITE: str = '\033[00m'
OKBLUE: str = '\033[94m'
OKGREEN: str = '\033[92m'
WARNING: str = '\033[93m'
ERROR: str = '\033[91m'
BOLD: str = '\033[1m'
ROLE_ADMIN: str = "a... | user_name_regex: str = '[^\\x00-\\x7F]+'
url_regex: str = 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
okwhite: str = '\x1b[00m'
okblue: str = '\x1b[94m'
okgreen: str = '\x1b[92m'
warning: str = '\x1b[93m'
error: str = '\x1b[91m'
bold: str = '\x1b[1m'
role_admin: str = 'admin'
role... |
class SeekStoryboard(ControllableStoryboardAction):
"""
A trigger action that provides functionality for seeking (skipping) to a specified time within the active period of a System.Windows.Media.Animation.Storyboard.
SeekStoryboard()
"""
def ShouldSerializeOffset(self):
"""
ShouldSerializeOffset(se... | class Seekstoryboard(ControllableStoryboardAction):
"""
A trigger action that provides functionality for seeking (skipping) to a specified time within the active period of a System.Windows.Media.Animation.Storyboard.
SeekStoryboard()
"""
def should_serialize_offset(self):
"""
ShouldSerializeOf... |
def docs(**kwargs):
def wrapper(func):
kwargs['produces'] = ['application/json']
if not hasattr(func, '__apispec__'):
func.__apispec__ = {'parameters': [], 'requests': {}, 'responses': {}}
extra_parameters = kwargs.pop('parameters', [])
extra_responses = kwargs.pop('respo... | def docs(**kwargs):
def wrapper(func):
kwargs['produces'] = ['application/json']
if not hasattr(func, '__apispec__'):
func.__apispec__ = {'parameters': [], 'requests': {}, 'responses': {}}
extra_parameters = kwargs.pop('parameters', [])
extra_responses = kwargs.pop('resp... |
def run():
my_list = [i for i in range(100000) if i % 4 == 0 and i % 6 == 0 and i % 9 == 0]
print(my_list)
if __name__ == '__main__':
run()
| def run():
my_list = [i for i in range(100000) if i % 4 == 0 and i % 6 == 0 and (i % 9 == 0)]
print(my_list)
if __name__ == '__main__':
run() |
class ErrorMessages:
EMPTY_FILE_UPLOAD="Please upload at least one file"
INVALID_FILE_FORMAT = "The following file format are not allowed"
MULTI_FILE_ERROR = "Only one file uploaded is allowed"
USER_EXISTS = "User already exists in the database"
INCORRECT_PARAMS=" password and username are required ... | class Errormessages:
empty_file_upload = 'Please upload at least one file'
invalid_file_format = 'The following file format are not allowed'
multi_file_error = 'Only one file uploaded is allowed'
user_exists = 'User already exists in the database'
incorrect_params = ' password and username are requi... |
"""Collection of utilities to validate database input.
This module contains utilities that validate database input and perform
actions for invalid input.
"""
def invalid_utf8_columns(utf8_columns, column_values):
"""Return a list of column names that have invalid utf-8 encoded values.
Args:
utf8_columns: A ... | """Collection of utilities to validate database input.
This module contains utilities that validate database input and perform
actions for invalid input.
"""
def invalid_utf8_columns(utf8_columns, column_values):
"""Return a list of column names that have invalid utf-8 encoded values.
Args:
utf8_columns: A... |
while True:
n=int(input())
if not n:
break
L=[]
for i in range(n):
L.append(input())
for i in range((n+1)//2):
print(L[i])
if (n+1)//2+i < n:
print(L[(n+1)//2+i]) | while True:
n = int(input())
if not n:
break
l = []
for i in range(n):
L.append(input())
for i in range((n + 1) // 2):
print(L[i])
if (n + 1) // 2 + i < n:
print(L[(n + 1) // 2 + i]) |
def cvt_dict_to_discord_pretty_text(value, spaces=18, custom_space={}, rename_keys={}, show_index=True):
"""
Given list of dictionaries pretties them for display purpose:
eg: input: [{a:1, b:2}, {a:3, b:4]
output: a b
1 2
3 4
:param value: list of dict... | def cvt_dict_to_discord_pretty_text(value, spaces=18, custom_space={}, rename_keys={}, show_index=True):
"""
Given list of dictionaries pretties them for display purpose:
eg: input: [{a:1, b:2}, {a:3, b:4]
output: a b
1 2
3 4
:param value: list of dict... |
"""
API endpoint paths stored as constants
"""
GET_INDEX_LIST = 'GetIndexList'
TOP_LIST_NAMES = 'TopListName'
TOP_LIST = 'TopList'
TP_SERIES = 'TPSeries'
GET_OPTION_CHAIN = 'GetOptionChain'
EXCH_MESSAGE = 'ExchMsg'
GET_BROKER_MESSAGE = 'GetBrokerMsg'
SPAN_CALCULATOR = 'SpanCalc' | """
API endpoint paths stored as constants
"""
get_index_list = 'GetIndexList'
top_list_names = 'TopListName'
top_list = 'TopList'
tp_series = 'TPSeries'
get_option_chain = 'GetOptionChain'
exch_message = 'ExchMsg'
get_broker_message = 'GetBrokerMsg'
span_calculator = 'SpanCalc' |
# Aminoacidos
AMINOACIDS = {
"AAA": "lisina",
"AAC": "asparagina",
"AGC": "serina"
}
# Codons
CODONS = list(AMINOACIDS.keys())
class Ribosome:
@staticmethod
def translation(sequence: str):
"RNA to protein"
#TODO Completar aminoacidos y hacer traduccion
pass | aminoacids = {'AAA': 'lisina', 'AAC': 'asparagina', 'AGC': 'serina'}
codons = list(AMINOACIDS.keys())
class Ribosome:
@staticmethod
def translation(sequence: str):
"""RNA to protein"""
pass |
class InstanceCounter(object):
count = 0
def __init__(self, val):
self.val = self.filterint(val)
InstanceCounter.count += 1
# @classmethod
@staticmethod
def filterint(value):
if not isinstance(value, int):
return 0
else:
return value
a = Instanc... | class Instancecounter(object):
count = 0
def __init__(self, val):
self.val = self.filterint(val)
InstanceCounter.count += 1
@staticmethod
def filterint(value):
if not isinstance(value, int):
return 0
else:
return value
a = instance_counter(5)
b =... |
class IP:
def __init__(self, ip: str, subnet_mask: str = "255.255.0.0") -> None:
self.ip: str = ip
self.subnet_mask: str = subnet_mask
def octets(self) -> list[str]:
return self.ip.split(".")
def octets_as_ints(self) -> list[int]:
return [int(i) for i in self.octets()]
... | class Ip:
def __init__(self, ip: str, subnet_mask: str='255.255.0.0') -> None:
self.ip: str = ip
self.subnet_mask: str = subnet_mask
def octets(self) -> list[str]:
return self.ip.split('.')
def octets_as_ints(self) -> list[int]:
return [int(i) for i in self.octets()]
... |
# -*- python -*-
load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_package",
)
def nix_zlib():
nixpkgs_package(
name = "nix-zlib_static",
attribute_path = "zlib.static",
repositories = {"nixpkgs": "@nixpkgs"},
)
nixpkgs_package(
name = "nix-zlib",
... | load('@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl', 'nixpkgs_package')
def nix_zlib():
nixpkgs_package(name='nix-zlib_static', attribute_path='zlib.static', repositories={'nixpkgs': '@nixpkgs'})
nixpkgs_package(name='nix-zlib', attribute_path='zlib.dev', repositories={'nixpkgs': '@nixpkgs'}, build_file_conten... |
"""Definitions for cc_library/cc_test targets that use the TFLite shims."""
def cc_library_with_tflite(
name,
deps = [],
tflite_deps = [],
**kwargs):
"""Defines a cc_library that uses the TFLite shims.
This is a hook to allow applying different build flags (etc.)
for target... | """Definitions for cc_library/cc_test targets that use the TFLite shims."""
def cc_library_with_tflite(name, deps=[], tflite_deps=[], **kwargs):
"""Defines a cc_library that uses the TFLite shims.
This is a hook to allow applying different build flags (etc.)
for targets that use the TFLite shims.
Not... |
suma_de_cuadrados = 0
suma = 0
'''recorro los primeros 100 naturales calculando su cuadrado para luego sumarlo
a 'suma_de_cuadrados'. Y sumo los naturales en 'suma'
'''
for n in range(101):
suma_de_cuadrados += n ** 2
suma += n
print(suma ** 2 - suma_de_cuadrados) | suma_de_cuadrados = 0
suma = 0
"recorro los primeros 100 naturales calculando su cuadrado para luego sumarlo\na 'suma_de_cuadrados'. Y sumo los naturales en 'suma'\n"
for n in range(101):
suma_de_cuadrados += n ** 2
suma += n
print(suma ** 2 - suma_de_cuadrados) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.