content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def pytest_addoption(parser):
selenium_class_names = ("Android", "Chrome", "Firefox", "Ie", "Opera", "PhantomJS", "Remote", "Safari")
parser.addoption("--webdriver", action="store", choices=selenium_class_names,
default="PhantomJS",
help="Selenium WebDriver interface t... | def pytest_addoption(parser):
selenium_class_names = ('Android', 'Chrome', 'Firefox', 'Ie', 'Opera', 'PhantomJS', 'Remote', 'Safari')
parser.addoption('--webdriver', action='store', choices=selenium_class_names, default='PhantomJS', help='Selenium WebDriver interface to use for running the test. Default: Phanto... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Simone Persiani <iosonopersia@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copie... | meta_csv_output_dir = '<path>/meta_folder/csv_output/'
citations_csv_dir = '<path>/converter_folder/citations/'
converter_citations_csv_output_dir = '<path>/citations_folder/csv_output/'
converter_citations_rdf_output_dir = '<path>/citations_folder/rdf_output/'
base_iri = 'https://w3id.org/oc/meta/'
triplestore_url = '... |
# Time: O(m * n)
# Space: O(min(m, n))
class Solution(object):
def longestCommonSubsequence(self, text1, text2):
"""
:type text1: str
:type text2: str
:rtype: int
"""
if len(text1) < len(text2):
return self.longestCommonSubsequence(text2, text1)
... | class Solution(object):
def longest_common_subsequence(self, text1, text2):
"""
:type text1: str
:type text2: str
:rtype: int
"""
if len(text1) < len(text2):
return self.longestCommonSubsequence(text2, text1)
dp = [[0 for _ in range(len(text2) + 1... |
class FeatureGenerator():
"""
Base class for feature generators
"""
def fit(self, timeseries):
"""
Fit the feature generator
inputs:
timeseries: the timeseries (numpy array) (num_series x series_length)
"""
raise NotImplementedError('FeatureGenerator.f... | class Featuregenerator:
"""
Base class for feature generators
"""
def fit(self, timeseries):
"""
Fit the feature generator
inputs:
timeseries: the timeseries (numpy array) (num_series x series_length)
"""
raise not_implemented_error('FeatureGenerator.... |
dpi = 400
dpcm = dpi / 2.54
INFTY = float('inf')
PAPER = {
'letter': {
'qr_left': (0.0, 0.882, 0.152, 1.0),
'qr_right': (0.848, 0.882, 1.0, 1.0),
'tick': (0.17, 0.88, 0.91, 1.0),
'uin': (0.49, 0.11, 0.964, 0.54)
}
}
| dpi = 400
dpcm = dpi / 2.54
infty = float('inf')
paper = {'letter': {'qr_left': (0.0, 0.882, 0.152, 1.0), 'qr_right': (0.848, 0.882, 1.0, 1.0), 'tick': (0.17, 0.88, 0.91, 1.0), 'uin': (0.49, 0.11, 0.964, 0.54)}} |
'''Soma Simples'''
A = int(input())
B = int(input())
def CalculaSomaSimples(a: int, b: int):
resultado = int(a+b)
return('SOMA = {}'.format(resultado))
print(CalculaSomaSimples(A,B))
| """Soma Simples"""
a = int(input())
b = int(input())
def calcula_soma_simples(a: int, b: int):
resultado = int(a + b)
return 'SOMA = {}'.format(resultado)
print(calcula_soma_simples(A, B)) |
pkgname = "libgpg-error"
pkgver = "1.43"
pkgrel = 0
build_style = "gnu_configure"
hostmakedepends = ["pkgconf"]
pkgdesc = "Library for error values used by GnuPG components"
maintainer = "q66 <q66@chimera-linux.org>"
license = "LGPL-2.1-or-later"
url = "https://www.gnupg.org"
source = f"{url}/ftp/gcrypt/{pkgname}/{pkgn... | pkgname = 'libgpg-error'
pkgver = '1.43'
pkgrel = 0
build_style = 'gnu_configure'
hostmakedepends = ['pkgconf']
pkgdesc = 'Library for error values used by GnuPG components'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'LGPL-2.1-or-later'
url = 'https://www.gnupg.org'
source = f'{url}/ftp/gcrypt/{pkgname}/{pkgn... |
class Person:
name = None
age = 0
gender = None
def __init__(self, n, a, g):
self.name = n
self.age = a
self.gender = g
def walk(self):
print('I am walking')
def eat(self):
print('I am eating :)')
def __str__(self): # string representation of the o... | class Person:
name = None
age = 0
gender = None
def __init__(self, n, a, g):
self.name = n
self.age = a
self.gender = g
def walk(self):
print('I am walking')
def eat(self):
print('I am eating :)')
def __str__(self):
return 'name: {}\tage: {... |
list=input().split()
re=[int(e) for e in input().split()]
new=[]
for i in re:
new.append(list[i])
for l in new:
print(l,end=" ")
| list = input().split()
re = [int(e) for e in input().split()]
new = []
for i in re:
new.append(list[i])
for l in new:
print(l, end=' ') |
shopping_list = []
def show_help():
print("Enter the items/amount for your shopping list")
print("Enter DONE once you have completed the list, Enter Help if you require assistance")
def add_to_list(item):
shopping_list.append(item)
print("Added! List has {} items.".format(len(shopping_list)))
def show_li... | shopping_list = []
def show_help():
print('Enter the items/amount for your shopping list')
print('Enter DONE once you have completed the list, Enter Help if you require assistance')
def add_to_list(item):
shopping_list.append(item)
print('Added! List has {} items.'.format(len(shopping_list)))
def sho... |
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
"""Defines the Constant strings related to Error Analysis."""
class ErrorAnalysisDashboardInterface(object):
"""Dictionary properties shared between python and javascript object."""
TREE_URL = "treeUrl"
MATRIX_URL = "matrixUrl"
E... | """Defines the Constant strings related to Error Analysis."""
class Erroranalysisdashboardinterface(object):
"""Dictionary properties shared between python and javascript object."""
tree_url = 'treeUrl'
matrix_url = 'matrixUrl'
enable_predict = 'enablePredict' |
"""
LIST: MINIMUM AND MAXIMUM ITEMS
"""
__author__ = 'Sol Amour - amoursol@gmail.com'
__twitter__ = '@solamour'
__version__ = '1.0.0'
"""
SYNTAX: min(iterable[, key = x])
min = Return the smallest item in an iterable or the smallest of two or more arguments
iterable = An iterable element (Such as a list,... | """
LIST: MINIMUM AND MAXIMUM ITEMS
"""
__author__ = 'Sol Amour - amoursol@gmail.com'
__twitter__ = '@solamour'
__version__ = '1.0.0'
"\n\nSYNTAX: min(iterable[, key = x])\n\nmin = Return the smallest item in an iterable or the smallest of two or more arguments\niterable = An iterable element (Such as a list, tuple, di... |
GET_HOSTS = [
{
'device_id': '00000000000000000000000000000000',
'cid': '11111111111111111111111111111111',
'agent_load_flags': '0',
'agent_local_time': '2021-12-08T15:16:24.360Z',
'agent_version': '6.30.14406.0',
'bios_manufacturer': 'Amazon EC2',
'bios_versi... | get_hosts = [{'device_id': '00000000000000000000000000000000', 'cid': '11111111111111111111111111111111', 'agent_load_flags': '0', 'agent_local_time': '2021-12-08T15:16:24.360Z', 'agent_version': '6.30.14406.0', 'bios_manufacturer': 'Amazon EC2', 'bios_version': '1.0', 'build_number': '11111', 'config_id_base': '111111... |
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation 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 sou... | def knn_python(train, train_labels, test, k, classes_num, train_size, test_size, predictions, queue_neighbors_lst, votes_to_classes_lst, data_dim):
for i in range(test_size):
queue_neighbors = queue_neighbors_lst[i]
for j in range(k):
x1 = train[j]
x2 = test[i]
di... |
class Solution(object):
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
nc = len(grid)
nr = len(grid[0])
for x in range(1, nr):
grid[0][x] += grid[0][x-1]
for x in range(1, nc):
grid[x][0] += grid[x-1... | class Solution(object):
def min_path_sum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
nc = len(grid)
nr = len(grid[0])
for x in range(1, nr):
grid[0][x] += grid[0][x - 1]
for x in range(1, nc):
grid[x][0] += gri... |
class WordWithTag:
word = ""
tag = ""
separator = ''
def __init__(self, separator):
self.separator = separator
| class Wordwithtag:
word = ''
tag = ''
separator = ''
def __init__(self, separator):
self.separator = separator |
class NvramBatteryStatusEnum(basestring):
"""
ok|partially discharged|fully discharged|not present|near
eol|eol|unknown|over charged|fully charged
Possible values:
<ul>
<li> "battery_ok" ,
<li> "battery_partially_discharged" ,
<li> "battery_fully_discharged" ,
<... | class Nvrambatterystatusenum(basestring):
"""
ok|partially discharged|fully discharged|not present|near
eol|eol|unknown|over charged|fully charged
Possible values:
<ul>
<li> "battery_ok" ,
<li> "battery_partially_discharged" ,
<li> "battery_fully_discharged" ,
<... |
class Solution:
def minOperations(self, n: int) -> int:
num_ops = 0
for i in range(0, n // 2, 1):
num_ops += n - (2 * i + 1)
return num_ops | class Solution:
def min_operations(self, n: int) -> int:
num_ops = 0
for i in range(0, n // 2, 1):
num_ops += n - (2 * i + 1)
return num_ops |
input = """
3 2 2 3 1 0 4
2 5 2 0 1 2 3
1 1 2 1 5 4
2 6 2 0 2 2 3
1 1 2 0 6 4
1 4 0 0
3 3 7 8 9 1 0 10
2 11 3 0 1 7 8 9
1 1 2 1 11 10
2 12 3 0 2 7 8 9
1 1 2 0 12 10
1 10 0 0
1 13 1 0 9
1 14 1 0 8
1 15 1 0 7
1 16 1 0 9
1 17 1 0 7
1 18 1 1 17
1 19 2 0 14 13
1 20 3 0 14 18 15
1 1 2 1 20 2
1 1 2 1 19 3
0
16 i
3 e
20 s
13 f... | input = '\n3 2 2 3 1 0 4\n2 5 2 0 1 2 3\n1 1 2 1 5 4\n2 6 2 0 2 2 3\n1 1 2 0 6 4\n1 4 0 0\n3 3 7 8 9 1 0 10\n2 11 3 0 1 7 8 9\n1 1 2 1 11 10\n2 12 3 0 2 7 8 9\n1 1 2 0 12 10\n1 10 0 0\n1 13 1 0 9\n1 14 1 0 8\n1 15 1 0 7\n1 16 1 0 9\n1 17 1 0 7\n1 18 1 1 17\n1 19 2 0 14 13\n1 20 3 0 14 18 15\n1 1 2 1 20 2\n1 1 2 1 19 3\... |
'''
Largest Continuous Sum Problem
Given an array of integers (positive and negative) find the largest continous sum
'''
def large_cont_sum(arr):
#if array is all positive we return the result as summ of all numbers
#the negative numbers int he array will cause us to need to begin checkin sequences
## Che... | """
Largest Continuous Sum Problem
Given an array of integers (positive and negative) find the largest continous sum
"""
def large_cont_sum(arr):
if len(arr) == 0:
return 0
max_sum = current_sum = arr[0]
for num in arr[1:]:
current_sum = max(current_sum + num, num)
max_sum = max(cur... |
data = (
's', # 0x00
't', # 0x01
'u', # 0x02
'v', # 0x03
'w', # 0x04
'x', # 0x05
'y', # 0x06
'z', # 0x07
'A', # 0x08
'B', # 0x09
'C', # 0x0a
'D', # 0x0b
'E', # 0x0c
'F', # 0x0d
'G', # 0x0e
'H', # 0x0f
'I', # 0x10
'J', # 0x11
'K', # 0x12
'L', # 0x13
'M', # 0... | data = ('s', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C... |
# -*- coding: utf-8 -*-
"""
"main concept of MongoDB is embed whenever possible"
Ref: http://stackoverflow.com/questions/4655610#comment5129510_4656431
"""
transcript = dict(
# The ensemble transcript id
transcript_id=str, # required=True
# The hgnc gene id
hgnc_id=int,
### Protein specific predic... | """
"main concept of MongoDB is embed whenever possible"
Ref: http://stackoverflow.com/questions/4655610#comment5129510_4656431
"""
transcript = dict(transcript_id=str, hgnc_id=int, protein_id=str, sift_prediction=str, polyphen_prediction=str, swiss_prot=str, pfam_domain=str, prosite_profile=str, smart_domain=str, biot... |
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
GEMS_URL = 'https://rubygems.org/api/v1/versions/%s.json'
async def get_version(name, conf, *, cache, **kwargs):
key = conf.get('gems', name)
data = await cache.get_json(GEMS_URL % key)
return data[0]['number']
| gems_url = 'https://rubygems.org/api/v1/versions/%s.json'
async def get_version(name, conf, *, cache, **kwargs):
key = conf.get('gems', name)
data = await cache.get_json(GEMS_URL % key)
return data[0]['number'] |
def msgme(*names):
for i in names:
print(i)
msgme("abc")
msgme("xyz",100)
msgme("apple","mango",1,2,3,7)
| def msgme(*names):
for i in names:
print(i)
msgme('abc')
msgme('xyz', 100)
msgme('apple', 'mango', 1, 2, 3, 7) |
class Dog:
species = 'caniche'
def __init__(self, name, age):
self.name = name
self.age = age
bambi = Dog("Bambi", 5)
mikey = Dog("Rufus", 6)
blacky = Dog("Fosca", 9)
coco = Dog("Coco", 13)
perla = Dog("Neska", 3)
print("{} is {} and {} is {}.". format(bambi.name, bambi.age, mikey.name, mike... | class Dog:
species = 'caniche'
def __init__(self, name, age):
self.name = name
self.age = age
bambi = dog('Bambi', 5)
mikey = dog('Rufus', 6)
blacky = dog('Fosca', 9)
coco = dog('Coco', 13)
perla = dog('Neska', 3)
print('{} is {} and {} is {}.'.format(bambi.name, bambi.age, mikey.name, mikey.ag... |
"""
[11/3/2012] Challenge #110 [Difficult] You can't handle the truth!
https://www.reddit.com/r/dailyprogrammer/comments/12k3xw/1132012_challenge_110_difficult_you_cant_handle/
**Description:**
[Truth Tables](http://en.wikipedia.org/wiki/Truth_table) are a simple table that demonstrates all possible results
given a B... | """
[11/3/2012] Challenge #110 [Difficult] You can't handle the truth!
https://www.reddit.com/r/dailyprogrammer/comments/12k3xw/1132012_challenge_110_difficult_you_cant_handle/
**Description:**
[Truth Tables](http://en.wikipedia.org/wiki/Truth_table) are a simple table that demonstrates all possible results
given a B... |
def getBuiltinTargs():
return {
"1": {
"name": "1",
"ptype": "maven2",
"patterns": [".*"],
"defincpat": ["**"],
"defexcpat": []
},
"2": {
"name": "2",
"ptype": "maven1",
"patterns": [".*"],
... | def get_builtin_targs():
return {'1': {'name': '1', 'ptype': 'maven2', 'patterns': ['.*'], 'defincpat': ['**'], 'defexcpat': []}, '2': {'name': '2', 'ptype': 'maven1', 'patterns': ['.*'], 'defincpat': ['**'], 'defexcpat': []}, '3': {'name': '3', 'ptype': 'maven2', 'patterns': ['(?!.*-sources.*).*'], 'defincpat': ['... |
def add(x,y):
"""add two numbers together"""
return x + y
| def add(x, y):
"""add two numbers together"""
return x + y |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 10 15:43:09 2017
@author: juherask
"""
DEBUG_VERBOSITY = 3
COST_EPSILON = 1e-10
CAPACITY_EPSILON = 1e-10
# how many seconds we give to a MIP solver
MAX_MIP_SOLVER_RUNTIME = 60*10 # 10m
MIP_SOLVER_THREADS = 1 # 0 is automatic (parallel computing)
BENCHMARKS_BASEPATH =... | """
Created on Thu Aug 10 15:43:09 2017
@author: juherask
"""
debug_verbosity = 3
cost_epsilon = 1e-10
capacity_epsilon = 1e-10
max_mip_solver_runtime = 60 * 10
mip_solver_threads = 1
benchmarks_basepath = 'C:\\Users\\juherask\\Dissertation\\Phases\\Benchmarks'
lkh_exe_path = 'C:\\Users\\juherask\\Dissertation\\Phases... |
EXT_STANDARD = 1
INT_STANDARD = 2
EXT_HQ = 3
INT_HQ = 4
EXT_HOUSE = 5
INT_HOUSE = 6
EXT_COGHQ = 7
INT_COGHQ = 8
EXT_KS = 9
INT_KS = 10
| ext_standard = 1
int_standard = 2
ext_hq = 3
int_hq = 4
ext_house = 5
int_house = 6
ext_coghq = 7
int_coghq = 8
ext_ks = 9
int_ks = 10 |
# Basics
""" Summary:
Dictionary are a list of Key and Value
{Key: Value}
You can create a key connected to its own definition
e.g.
{"Bug": "An error in a program that prevents the program from running as expected"}
You can also create more keys, separating each key /w a comma.
{
"Bug": "An error i... | """ Summary:
Dictionary are a list of Key and Value
{Key: Value}
You can create a key connected to its own definition
e.g.
{"Bug": "An error in a program that prevents the program from running as expected"}
You can also create more keys, separating each key /w a comma.
{
"Bug": "An error in a progra... |
# Leo colorizer control file for dart mode.
# This file is in the public domain.
# Properties for dart mode.
properties = {
"commentEnd": "*/",
"commentStart": "/*",
"electricKeys": ":",
"indentCloseBrackets": "]}",
"indentNextLine": "\\s*(((if|while)\\s*\\(|else\\s*|else\\s+if\\s*\\(|for\\s*\\(.*\... | properties = {'commentEnd': '*/', 'commentStart': '/*', 'electricKeys': ':', 'indentCloseBrackets': ']}', 'indentNextLine': '\\s*(((if|while)\\s*\\(|else\\s*|else\\s+if\\s*\\(|for\\s*\\(.*\\))[^{;]*)', 'indentOpenBrackets': '{[', 'lineComment': '//', 'unalignedCloseBrackets': ')', 'unalignedOpenBrackets': '(', 'uninden... |
ACCOUNT_ID = "1234567890"
def parameter_arn(region, parameter_name):
if parameter_name[0] == "/":
parameter_name = parameter_name[1:]
return "arn:aws:ssm:{0}:{1}:parameter/{2}".format(
region, ACCOUNT_ID, parameter_name
)
| account_id = '1234567890'
def parameter_arn(region, parameter_name):
if parameter_name[0] == '/':
parameter_name = parameter_name[1:]
return 'arn:aws:ssm:{0}:{1}:parameter/{2}'.format(region, ACCOUNT_ID, parameter_name) |
#!/bin/python
# Enter your code here. Read input from STDIN. Print output to STDOUT
N = int(raw_input())
n= N
w = 'Weird'
nw = 'Not Weird'
if n % 2 == 1:
print(w)
elif n % 2 == 0 and (n>=2 and n<5):
print(nw)
elif n % 2 == 0 and (n>=6 and n<=20):
print(w)
elif n % 2 == 0 and (n>20):
print(nw)
| n = int(raw_input())
n = N
w = 'Weird'
nw = 'Not Weird'
if n % 2 == 1:
print(w)
elif n % 2 == 0 and (n >= 2 and n < 5):
print(nw)
elif n % 2 == 0 and (n >= 6 and n <= 20):
print(w)
elif n % 2 == 0 and n > 20:
print(nw) |
# Sage version information for Python scripts
# This file is auto-generated by the sage-update-version script, do not edit!
version = '9.3.rc0'
date = '2021-03-23'
banner = 'SageMath version 9.3.rc0, Release Date: 2021-03-23'
| version = '9.3.rc0'
date = '2021-03-23'
banner = 'SageMath version 9.3.rc0, Release Date: 2021-03-23' |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def __str__(self):
return str(self.val)
def print_list(head: ListNode):
cur = head
while cur is not None:
print(cur.val, end=' ')
cur = cu... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def __str__(self):
return str(self.val)
def print_list(head: ListNode):
cur = head
while cur is not None:
print(cur.val, end=' ')
cur = cur.next
if cur is not None:
... |
REDFIN_TABLE_SCHEMA = {
'SCHEMA': {
'SALE_TYPE': 'VARCHAR(50)',
'SOLD_DATE': 'DATE',
'PROPERTY_TYPE': 'VARCHAR(50)',
'ADDRESS': 'VARCHAR(100) NOT NULL',
'CITY': 'VARCHAR(50) NOT NULL',
'STATE': 'VARCHAR(50) NOT NULL',
'ZIPCODE': 'BIGINT',
'PRICE': 'BIG... | redfin_table_schema = {'SCHEMA': {'SALE_TYPE': 'VARCHAR(50)', 'SOLD_DATE': 'DATE', 'PROPERTY_TYPE': 'VARCHAR(50)', 'ADDRESS': 'VARCHAR(100) NOT NULL', 'CITY': 'VARCHAR(50) NOT NULL', 'STATE': 'VARCHAR(50) NOT NULL', 'ZIPCODE': 'BIGINT', 'PRICE': 'BIGINT', 'BEDS': 'BIGINT', 'BATHS': 'DOUBLE PRECISION', 'SQFT': 'BIGINT',... |
message = 'My name is ' 'Tom'
print(message)
| message = 'My name is Tom'
print(message) |
list1 = ["apple", "banana", "cherry"]
list2 = list1.copy()
print(list2)
list3 = list(list1)
print(list3)
list4 = list('T am a list')
print(list4)
# join 2 lists
list5 = list1 + list4
print(list5)
for x in list4:
list1.append(x)
print(list1)
list2.extend(list4)
print(list2)
# list constructor
list7 = list(("appl... | list1 = ['apple', 'banana', 'cherry']
list2 = list1.copy()
print(list2)
list3 = list(list1)
print(list3)
list4 = list('T am a list')
print(list4)
list5 = list1 + list4
print(list5)
for x in list4:
list1.append(x)
print(list1)
list2.extend(list4)
print(list2)
list7 = list(('apple', 'banana', 'cherry'))
print(list7)
... |
"""
URLify: Write a method to replace all spaces in a string with '%20'. You may assume that the string
has sufficient space at the end to hold the additional characters, and that you are given the "true"
length of the string. (Note: If implementing in Java, please use a character array so that you can
perform this ope... | """
URLify: Write a method to replace all spaces in a string with '%20'. You may assume that the string
has sufficient space at the end to hold the additional characters, and that you are given the "true"
length of the string. (Note: If implementing in Java, please use a character array so that you can
perform this ope... |
r"""
``scanInfo`` --- Scan information
====================================
.. code-block:: python
import gempython.vfatqc.utils.scanInfo
Documentation
-------------
"""
#default values for the algorithm to update the trim values in the iterative trimmer
sigmaOffsetDefault=0
highNoiseCutDefault=63
highTrimCutof... | """
``scanInfo`` --- Scan information
====================================
.. code-block:: python
import gempython.vfatqc.utils.scanInfo
Documentation
-------------
"""
sigma_offset_default = 0
high_noise_cut_default = 63
high_trim_cutoff_default = 50
high_trim_weight_default = 1.5 |
class SessionStorage:
"""Class to save data into session section organized by section_id."""
def __init__(self, session):
self.session = session
def set(self, section_id, key, value):
"""Set data to session section."""
session_part = self.session.get(section_id, {})
session... | class Sessionstorage:
"""Class to save data into session section organized by section_id."""
def __init__(self, session):
self.session = session
def set(self, section_id, key, value):
"""Set data to session section."""
session_part = self.session.get(section_id, {})
session... |
_MODELS = dict()
def register(fn):
global _MODELS
_MODELS[fn.__name__] = fn
return fn
def get_model(args=None):
if args.model is None:
return _MODELS
return _MODELS[args.model](args.num_classes)
| _models = dict()
def register(fn):
global _MODELS
_MODELS[fn.__name__] = fn
return fn
def get_model(args=None):
if args.model is None:
return _MODELS
return _MODELS[args.model](args.num_classes) |
Izhikevich = Neuron(
parameters= {
'a': Array(value=0.02, dtype=np.float32),
'b': Array(value=0.2),
'c': Value(value=-65.),
'd': Value(value=-2.),
'VT': Value(value=30.),
},
equations = {
'v': Array(eq="dv/dt = 0.04 * v^2 + 5.0 * v + 140.0 - u + I + ... | izhikevich = neuron(parameters={'a': array(value=0.02, dtype=np.float32), 'b': array(value=0.2), 'c': value(value=-65.0), 'd': value(value=-2.0), 'VT': value(value=30.0)}, equations={'v': array(eq='dv/dt = 0.04 * v^2 + 5.0 * v + 140.0 - u + I + ge - gi', value=0.0, method='midpoint'), 'u': array(eq='du/dt = a * (b * v ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Gammapy integration and system tests.
This package can be used for tests that involved several
Gammapy sub-packages, or that don't fit anywhere else.
"""
| """Gammapy integration and system tests.
This package can be used for tests that involved several
Gammapy sub-packages, or that don't fit anywhere else.
""" |
# class SVNRepo:
# @classmethod
# def isBadVersion(cls, id)
# # Run unit tests to check whether verison `id` is a bad version
# # return true if unit tests passed else false.
# You can use SVNRepo.isBadVersion(10) to check whether version 10 is a
# bad version.
class Solution:
"""
@param n... | class Solution:
"""
@param n: An integer
@return: An integer which is the first bad version.
"""
def find_first_bad_version(self, n):
(start, end) = (1, n)
while start + 1 < end:
mid = start + (end - start) // 2
if SVNRepo.isBadVersion(mid):
e... |
#Lists Challenge 9: Basketball Roster Program
print("Welcome to the Basketball Roster Program")
#Get user input and define our roster
roster = []
player = input("\nWho is your point guard: ").title()
roster.append(player)
player = input("Who is your shooting guard: ").title()
roster.append(player)
player = input("Wh... | print('Welcome to the Basketball Roster Program')
roster = []
player = input('\nWho is your point guard: ').title()
roster.append(player)
player = input('Who is your shooting guard: ').title()
roster.append(player)
player = input('Who is your small forward: ').title()
roster.append(player)
player = input('Who is your p... |
# Helper merge sort function
def mergeSort(arr):
# Clone the array for the merge later
arrClone = arr.clone()
mergeSortAux(arr, arrClone, 0, len(arr) - 1)
# Actual merge sort
def mergeSortAux(arr, arrClone, low, high):
if low < high:
mid = (low + high) / 2
# Sort left
mergeSort... | def merge_sort(arr):
arr_clone = arr.clone()
merge_sort_aux(arr, arrClone, 0, len(arr) - 1)
def merge_sort_aux(arr, arrClone, low, high):
if low < high:
mid = (low + high) / 2
merge_sort_aux(arr, arrClone, low, mid)
merge_sort_aux(arr, arrClone, mid + 1, high)
merge(arr, arr... |
"""
Exceptions
"""
class SubFrameError(Exception):
"""General error."""
pass
| """
Exceptions
"""
class Subframeerror(Exception):
"""General error."""
pass |
# You can comment by putting # in front of a text.
#First off we will start off with the humble while loop.
#Now notice the syntax: first we declare our variable,
#while condition is followed with a colon,
#in order to concenate a string with a number
#we must turn it into a string as well.
#Finally don't forget the i... | n = 0
while n <= 5:
print('While is now ' + str(n))
n = n + 1
for n in range(5):
print(n)
my_sum = 1
for i in range(1, 12, 1):
print('i is now ' + str(i))
if i == 11:
print('Oh snap we are now over 11!')
break
var_a = 200
var_b = 100
if type(varA) == str or type(varB) == str:
pri... |
class DailySchedule:
def __init__(self, day_number: int, day_off: bool = False):
self.day_number = day_number
self.day_off = day_off
self.lessons: list[tuple[str, str, str]] = [] | class Dailyschedule:
def __init__(self, day_number: int, day_off: bool=False):
self.day_number = day_number
self.day_off = day_off
self.lessons: list[tuple[str, str, str]] = [] |
class SpaceSequenceEditor:
display_channel = None
display_mode = None
draw_overexposed = None
grease_pencil = None
overlay_type = None
preview_channels = None
proxy_render_size = None
show_backdrop = None
show_frame_indicator = None
show_frames = None
show_grease_pencil = Non... | class Spacesequenceeditor:
display_channel = None
display_mode = None
draw_overexposed = None
grease_pencil = None
overlay_type = None
preview_channels = None
proxy_render_size = None
show_backdrop = None
show_frame_indicator = None
show_frames = None
show_grease_pencil = Non... |
# Write for loops that iterate over the elements of a list without the use of the range
# function for the following tasks.
# c. Counting how many elements in a list are negative.
list = [ -5, 10, 15, -20, -2, 0, -8, 94 ]
numNegativeElements = 0
for item in list:
if item < 0:
numNegativeElements += ... | list = [-5, 10, 15, -20, -2, 0, -8, 94]
num_negative_elements = 0
for item in list:
if item < 0:
num_negative_elements += 1
print('Number of negative elements:', numNegativeElements) |
# Letter Phone
# https://www.interviewbit.com/problems/letter-phone/
#
# Given a digit string, return all possible letter combinations that the number could represent.
#
# A mapping of digit to letters (just like on the telephone buttons) is given below.
#
# The digit 0 maps to 0 itself.
# The digit 1 maps to 1 itself.... | class Solution:
map = {'0': '0', '1': '1', '2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz'}
def _letter_combinations(self, i, A, sub):
if i == len(A) - 1:
return [sub + char for char in Solution.MAP[A[i]]]
res = list()
for cha... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def test_install_extension(lib):
lib.cmd('extension install hello')
lib.cmd('hello')
def test_install_extension_with_github_syntax(lib):
lib.cmd('extension install clk-project/hello')
lib.cmd('hello')
def test_update_extension(lib):
lib.cmd('exten... | def test_install_extension(lib):
lib.cmd('extension install hello')
lib.cmd('hello')
def test_install_extension_with_github_syntax(lib):
lib.cmd('extension install clk-project/hello')
lib.cmd('hello')
def test_update_extension(lib):
lib.cmd('extension install hello')
lib.cmd('extension update ... |
"""
Module contains class coordinates
Class coordinates represent a pair of coordinates of a single cell on a 10x10 board
"""
class Coordinates:
"""
Represents coordinates of a single cell
Represents coordinates of a single cell with x and y coordinates where x abs is a top row in range a-j and y abs
... | """
Module contains class coordinates
Class coordinates represent a pair of coordinates of a single cell on a 10x10 board
"""
class Coordinates:
"""
Represents coordinates of a single cell
Represents coordinates of a single cell with x and y coordinates where x abs is a top row in range a-j and y abs
... |
'''
ref: https://www.datacamp.com/community/tutorials/decorators-python
'''
def uppercase_decorator(function):
def wrapper():
func = function()
make_uppercase = func.upper()
return make_uppercase
return wrapper
def say_hi():
return 'hi there'
decorate = uppercase_decorator(say_h... | """
ref: https://www.datacamp.com/community/tutorials/decorators-python
"""
def uppercase_decorator(function):
def wrapper():
func = function()
make_uppercase = func.upper()
return make_uppercase
return wrapper
def say_hi():
return 'hi there'
decorate = uppercase_decorator(say_hi)... |
# Copyright Google Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.io/license
"""Test utility to extract the "flat_module_metadata" from transitive Angular deps.
"""
def _extract_flat_module_index(ctx):
return [Defau... | """Test utility to extract the "flat_module_metadata" from transitive Angular deps.
"""
def _extract_flat_module_index(ctx):
return [default_info(files=depset(transitive=[dep.angular.flat_module_metadata for dep in ctx.attr.deps if hasattr(dep, 'angular')]))]
extract_flat_module_index = rule(implementation=_extrac... |
MAX_CHAR_GROUP_NAME = 30
MAX_CHAR_CONTEXT_NAME = 30
MAX_CHAR_DEVICE_NAME = 30
MAX_DEVICES = 10
MAX_GROUPS = 10
MAX_CONTEXTS = 10
MAX_ACTIONS = 10
MAX_TRIGGERS = 10
# in seconds
INTERVAL_PUB_GROUP_DATA = 120
INTERVAL_ONLINE = 60
STATE_NO_CONNECTION = 1
STATE_CONNECTED_INTERNET = 2
STATE_CONNECTED_NO_INTERNET = 3 | max_char_group_name = 30
max_char_context_name = 30
max_char_device_name = 30
max_devices = 10
max_groups = 10
max_contexts = 10
max_actions = 10
max_triggers = 10
interval_pub_group_data = 120
interval_online = 60
state_no_connection = 1
state_connected_internet = 2
state_connected_no_internet = 3 |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 25 19:44:16 2020
@author: Ravi
"""
#Topological Sorting using recursive DFS
# {1: [3], 2: [3], 4: [0, 1], 5: [0, 2]}
# topological order = [3,1,2,1,0,4,5]
# 1->3
# 2->3
# 4->0->1
class Graph:
def __init__(self,edges):
self.explored = set()
... | """
Created on Fri Sep 25 19:44:16 2020
@author: Ravi
"""
class Graph:
def __init__(self, edges):
self.explored = set()
self.edges = edges
self.graph_dict = {1: [2], 2: [3, 4], 3: [11, 8], 4: [5, 7], 5: [6], 6: [7], 7: [5], 8: [7, 9, 10], 9: [6, 10], 10: [11], 11: [8]}
self.order ... |
def login(client, username, password):
payload = dict(username=username, password=password)
return client.post('/login', data=payload, follow_redirects=True)
def logout(client):
return client.get('/logout', follow_redirects=True)
| def login(client, username, password):
payload = dict(username=username, password=password)
return client.post('/login', data=payload, follow_redirects=True)
def logout(client):
return client.get('/logout', follow_redirects=True) |
largest_number=None
smallest_number=None
while True:
order=input('Enter a number: ')
if order=='done':
break
try:
number=int(order)
except Exception as e:
print("Invalid Input")
continue
if largest_number is None:
largest_number=number
if smal... | largest_number = None
smallest_number = None
while True:
order = input('Enter a number: ')
if order == 'done':
break
try:
number = int(order)
except Exception as e:
print('Invalid Input')
continue
if largest_number is None:
largest_number = number
if small... |
# XXXXXXXXXXX
class Node:
def __init__(self, value, prev_item=None, next_item=None):
self.value = value
self.prev_item = prev_item
self.next_item = next_item
class Queue():
def __init__(self, max_size):
self.max_size = max_size
self.size = 0
self.head = None
... | class Node:
def __init__(self, value, prev_item=None, next_item=None):
self.value = value
self.prev_item = prev_item
self.next_item = next_item
class Queue:
def __init__(self, max_size):
self.max_size = max_size
self.size = 0
self.head = None
self.last ... |
#!/usr/bin/python3.6
# created by cicek on 12.10.2018 15:09
digits = "731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805511125406987471585238630507156932909632952274430435576689664895044524452316173185640309871112172238311... | digits = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729... |
user_schema = {
"type": "object",
"properties": {
"name": {"type": "string"}
},
"required": ["name"],
"additionalProperties": False
}
get_users_query_params_schema = {
"type": ["object", "null"],
"properties": {
"page": {"type": "string"}
},
"additionalProperties": F... | user_schema = {'type': 'object', 'properties': {'name': {'type': 'string'}}, 'required': ['name'], 'additionalProperties': False}
get_users_query_params_schema = {'type': ['object', 'null'], 'properties': {'page': {'type': 'string'}}, 'additionalProperties': False} |
## ===============================================================================
## Authors: AFRL/RQQA
## Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division
##
## Copyright (c) 2017 Government of the United State of America, as represented by
## the Secretary of th... | class Loiterdirection:
vehicle_default = 0
counter_clockwise = 1
clockwise = 2
def get__loiter_direction_str(str):
"""
Returns a numerical value from a string
"""
if str == 'VehicleDefault':
return LoiterDirection.VehicleDefault
if str == 'CounterClockwise':
return Loite... |
#!/usr/bin/env python
class HostType:
GPCHECK_HOSTTYPE_UNDEFINED = 0
GPCHECK_HOSTTYPE_APPLIANCE = 1
GPCHECK_HOSTTYPE_GENERIC_LINUX = 2
def hosttype_str(type):
if type == HostType.GPCHECK_HOSTTYPE_APPLIANCE:
return "GPDB Appliance"
elif type == HostType.GPCHECK_HOSTTYPE_GENERIC_LINUX:
... | class Hosttype:
gpcheck_hosttype_undefined = 0
gpcheck_hosttype_appliance = 1
gpcheck_hosttype_generic_linux = 2
def hosttype_str(type):
if type == HostType.GPCHECK_HOSTTYPE_APPLIANCE:
return 'GPDB Appliance'
elif type == HostType.GPCHECK_HOSTTYPE_GENERIC_LINUX:
return 'Generic Linu... |
true = True
false = False
abi = [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"stateMutability": "payable",
"type": "fallback"
},
{
"inputs": [],
"name": "client_cancellation",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs":... | true = True
false = False
abi = [{'inputs': [], 'stateMutability': 'nonpayable', 'type': 'constructor'}, {'stateMutability': 'payable', 'type': 'fallback'}, {'inputs': [], 'name': 'client_cancellation', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function'}, {'inputs': [], 'name': 'client_delete_random_ind... |
# Copyright 2020 The FedLearner Authors. All Rights Reserved.
#
# 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 applica... | _es_datetime_format = 'strict_date_optional_time'
raw_data_mappings = {'dynamic': True, 'dynamic_templates': [{'strings': {'match_mapping_type': 'string', 'mapping': {'type': 'keyword'}}}], 'properties': {'partition': {'type': 'short'}, 'application_id': {'ignore_above': 128, 'type': 'keyword'}, 'event_time': {'format'... |
my_list = list(range(1, 11))
print(my_list)
def maxInList(aList): # non-recursion method
max_number = aList[0]
for i in range(1, len(aList)):
if max_number < aList[i]:
max_number = aList[i]
return max_number
def minInList(aList): # non-recursion method
min_number =... | my_list = list(range(1, 11))
print(my_list)
def max_in_list(aList):
max_number = aList[0]
for i in range(1, len(aList)):
if max_number < aList[i]:
max_number = aList[i]
return max_number
def min_in_list(aList):
min_number = aList[0]
for i in range(1, len(aList)):
if min... |
#!/usr/bin/env python
#
# Copyright (c) 2018 10X Genomics, Inc. All rights reserved.
#
MATRIX_MEM_GB_MULTIPLIER = 2 # TODO reduce this once we're confident about the actual memory bounds
NUM_MATRIX_ENTRIES_PER_MEM_GB = 50e6
# Empirical obs: with new CountMatrix setup, take ~ 50 bytes/bc
NUM_MATRIX_BARCODES_PER_MEM_G... | matrix_mem_gb_multiplier = 2
num_matrix_entries_per_mem_gb = 50000000.0
num_matrix_barcodes_per_mem_gb = 2000000
min_mem_gb = 3
min_mem_gb_nowhitelist = 64
gzip_suffix = '.gz'
lz4_suffix = '.lz4'
h5_compression_level = 1
h5_filetype_key = 'filetype'
h5_feature_ref_attr = 'features'
h5_bcs_attr = 'barcodes'
h5_matrix_da... |
# 8. Write a program that swaps the values of three variables x,y, and z, so that x gets the value
# of y, y gets the value of z, and z gets the value of x.
x, y, z = 5, 10, 15
x, y, z = y, z, x # The power of Python ;)
# print(x, y, z) : 10 15 5
| (x, y, z) = (5, 10, 15)
(x, y, z) = (y, z, x) |
vts = list()
vts.append(0)
vtx = list()
total = 0
def dfs(cur, visited:list):
global vtx, total
if cache[cur] != -1:
total += cache[cur]
return
if not vtx[cur]:
if cur == tg + 3:
total += 1
return
visited = visited.copy()
visited.append(cur)
... | vts = list()
vts.append(0)
vtx = list()
total = 0
def dfs(cur, visited: list):
global vtx, total
if cache[cur] != -1:
total += cache[cur]
return
if not vtx[cur]:
if cur == tg + 3:
total += 1
return
visited = visited.copy()
visited.append(cur)
for i in... |
#!/usr/bin/env prey
async def main():
await x("ls -a")
cd("..")
a = await x("ls")
await asyncio.sleep(2)
| async def main():
await x('ls -a')
cd('..')
a = await x('ls')
await asyncio.sleep(2) |
"""Default configuration
Use env var to override
"""
DEBUG = True
SECRET_KEY = "changeme"
SQLALCHEMY_DATABASE_URI = "sqlite:////tmp/microbiome_api.db"
SQLALCHEMY_TRACK_MODIFICATIONS = False
| """Default configuration
Use env var to override
"""
debug = True
secret_key = 'changeme'
sqlalchemy_database_uri = 'sqlite:////tmp/microbiome_api.db'
sqlalchemy_track_modifications = False |
class Solution:
def halvesAreAlike(self, s: str) -> bool:
num_vowels=0
num_vowels1=0
split = -( ( -len(s) )//2 )
p1, p2 = s[:split], s[split:]
for char in p1:
if char in "aeiouAEIOU":
num_vowels = num_vowels+1
for char in p2:
... | class Solution:
def halves_are_alike(self, s: str) -> bool:
num_vowels = 0
num_vowels1 = 0
split = -(-len(s) // 2)
(p1, p2) = (s[:split], s[split:])
for char in p1:
if char in 'aeiouAEIOU':
num_vowels = num_vowels + 1
for char in p2:
... |
class BaseValidationError(ValueError):
pass
class LogInFileNotParsedError(BaseValidationError):
pass
| class Basevalidationerror(ValueError):
pass
class Loginfilenotparsederror(BaseValidationError):
pass |
# -*- coding: utf-8 -*-
class TransitionType(object):
def __init__(self, utc_offset, is_dst, abbrev):
self.utc_offset = utc_offset
self.is_dst = is_dst
self.abbrev = abbrev
def __repr__(self):
return '<TransitionType [{}, {}, {}]>'.format(
self.utc_offset,
... | class Transitiontype(object):
def __init__(self, utc_offset, is_dst, abbrev):
self.utc_offset = utc_offset
self.is_dst = is_dst
self.abbrev = abbrev
def __repr__(self):
return '<TransitionType [{}, {}, {}]>'.format(self.utc_offset, self.is_dst, self.abbrev) |
class SingleLinkedListNode(object):
def __init__(self, value, nxt):
self.value = value
self.next = nxt
def __repr__(self):
nval = self.next and self.next.value or None
return f"[{self.value}:{repr(nval)}]"
class SingleLinkedList(object):
def __init__(self):
self.b... | class Singlelinkedlistnode(object):
def __init__(self, value, nxt):
self.value = value
self.next = nxt
def __repr__(self):
nval = self.next and self.next.value or None
return f'[{self.value}:{repr(nval)}]'
class Singlelinkedlist(object):
def __init__(self):
self.b... |
"""
0997. Find the Town Judge
In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
The town judge trusts nobody.
Everybody (except for the town judge) trusts the town judge.
There is exactly one person that satisfies... | """
0997. Find the Town Judge
In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
The town judge trusts nobody.
Everybody (except for the town judge) trusts the town judge.
There is exactly one person that satisfies... |
class Solution:
def findLonelyPixel(self, picture: List[List[str]]) -> int:
"""Array.
Running time: O(m * n) where m and n are the size of picture.
"""
m, n = len(picture), len(picture[0])
row, col = [0] * m , [0] * n
for i in range(m):
for j in range(n):... | class Solution:
def find_lonely_pixel(self, picture: List[List[str]]) -> int:
"""Array.
Running time: O(m * n) where m and n are the size of picture.
"""
(m, n) = (len(picture), len(picture[0]))
(row, col) = ([0] * m, [0] * n)
for i in range(m):
for j in... |
#!/usr/bin/env python
# coding: utf-8
# In given array find the duplicate odd number .
#
# Note: There is only one duplicate odd number
#
# <b> Ex [1,4,6,3,1] should return 1 </b>
# In[3]:
def dup_odd_num(num):
count=0
for i in range(len(num)):
if num[i] % 2 != 0:
count+=1
if c... | def dup_odd_num(num):
count = 0
for i in range(len(num)):
if num[i] % 2 != 0:
count += 1
if count > 1:
return num[i]
return False
print(dup_odd_num([1, 3, 2, 3]))
def dup_odd_num(num):
count = 0
dic = {}
for i in range(len(num)):
if num[i] % 2 != ... |
# -*- coding: utf-8 -*-
class OcelotError(Exception):
"""Base for custom ocelot errors"""
pass
class ZeroProduction(OcelotError):
"""Reference production exchange has amount of zero"""
pass
class IdenticalVariables(OcelotError):
"""The same variable name is used twice"""
pass
class Inval... | class Oceloterror(Exception):
"""Base for custom ocelot errors"""
pass
class Zeroproduction(OcelotError):
"""Reference production exchange has amount of zero"""
pass
class Identicalvariables(OcelotError):
"""The same variable name is used twice"""
pass
class Invalidmultioutputdataset(OcelotEr... |
# -*- coding: utf-8 -*-
# *******************************************************
# Copyright (c) VMware, Inc. 2020-2021. All Rights Reserved.
# SPDX-License-Identifier: MIT
# *******************************************************
# *
# * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
# * WARRANTIES OR C... | """Engine fixtures for testing"""
iocs_1 = [{'id': 'j39sbv7', 'match_type': 'equality', 'values': ['127.0.0.1'], 'severity': 1}, {'id': 'kfsd982m', 'match_type': 'equality', 'values': ['127.0.0.2'], 'severity': 1}, {'id': 'slkf038', 'match_type': 'equality', 'values': ['app.exe'], 'severity': 10}, {'id': '0kdl4uf9', 'm... |
a = int(input())
b = int(input())
count = 0
x = 0
a1 = str(a)
b1 = str(b)
if len(a1) == len(b1):
for i in a1:
for j in b1[x::]:
if i != j:
count += 1
x += 1
break
print(count)
| a = int(input())
b = int(input())
count = 0
x = 0
a1 = str(a)
b1 = str(b)
if len(a1) == len(b1):
for i in a1:
for j in b1[x:]:
if i != j:
count += 1
x += 1
break
print(count) |
valores =[]
valores_quadrado =[]
for i in range(10):
valores.append(int(input("Digite um numero inteiro: ")))
for i in valores:
valores_quadrado.append(i**2)
print("Valores da lista ao quadrado: ",valores_quadrado)
print("Soma dos quadrados: ",sum(valores_quadrado)) | valores = []
valores_quadrado = []
for i in range(10):
valores.append(int(input('Digite um numero inteiro: ')))
for i in valores:
valores_quadrado.append(i ** 2)
print('Valores da lista ao quadrado: ', valores_quadrado)
print('Soma dos quadrados: ', sum(valores_quadrado)) |
def str_seems_like_json(txt):
for c in txt:
if c not in "\r\n\t ":
return c == '{'
return False
def bytes_seems_like_json(binary):
for b in binary:
if b not in [13, 10, 9, 32]:
return b == 123
return False
| def str_seems_like_json(txt):
for c in txt:
if c not in '\r\n\t ':
return c == '{'
return False
def bytes_seems_like_json(binary):
for b in binary:
if b not in [13, 10, 9, 32]:
return b == 123
return False |
DEFAULT_SESSION_DURATION = 43200 # 12 hours
SANDBOX_SESSION_DURATION = 60 * 60 # 1 hour
BASTION_PROFILE_ENV_NAME = 'FIGGY_AWS_PROFILE'
AWS_REGIONS = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'af-south-1', 'ap-east-1', 'ap-east-2',
'ap-northeast-3', 'ap-northeast-2', 'ap-northeast-1', 'ap-so... | default_session_duration = 43200
sandbox_session_duration = 60 * 60
bastion_profile_env_name = 'FIGGY_AWS_PROFILE'
aws_regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'af-south-1', 'ap-east-1', 'ap-east-2', 'ap-northeast-3', 'ap-northeast-2', 'ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'ca-cent... |
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Sep 16, 2016 pmoyer Generated
class GetStationsRequest(object):
def __init__(self):
self.pluginName = Non... | class Getstationsrequest(object):
def __init__(self):
self.pluginName = None
def get_plugin_name(self):
return self.pluginName
def set_plugin_name(self, pluginName):
self.pluginName = pluginName |
def compute():
ans = sum(1 for i in range(10000) if is_lychrel(i))
return str(ans)
def is_lychrel(n):
for i in range(50):
n += int(str(n)[ : : -1])
if str(n) == str(n)[ : : -1]:
return False
return True
if __name__ == "__main__":
print(compute())
| def compute():
ans = sum((1 for i in range(10000) if is_lychrel(i)))
return str(ans)
def is_lychrel(n):
for i in range(50):
n += int(str(n)[::-1])
if str(n) == str(n)[::-1]:
return False
return True
if __name__ == '__main__':
print(compute()) |
# lecture 3.6, slide 2
# bisection search for square root
x = 12345
epsilon = 0.01
numGuesses = 0
low = 0.0
high = x
ans = (high + low)/2.0
while abs(ans**2 - x) >= epsilon:
print('low = ' + str(low) + ' high = ' + str(high) + ' ans = ' + str(ans))
numGuesses += 1
if ans**2 < x:
low = ans
else:... | x = 12345
epsilon = 0.01
num_guesses = 0
low = 0.0
high = x
ans = (high + low) / 2.0
while abs(ans ** 2 - x) >= epsilon:
print('low = ' + str(low) + ' high = ' + str(high) + ' ans = ' + str(ans))
num_guesses += 1
if ans ** 2 < x:
low = ans
else:
high = ans
ans = (high + low) / 2.0
pr... |
"""Implementation of Kotlin JS rules."""
load("@io_bazel_rules_kotlin//kotlin/internal:defs.bzl", "KtJsInfo")
def kt_js_import_impl(ctx):
"""Implementation for kt_js_import.
Args:
ctx: rule context
Returns:
Providers for the build rule.
"""
if len(ctx.files.jars) != 1:
fail("... | """Implementation of Kotlin JS rules."""
load('@io_bazel_rules_kotlin//kotlin/internal:defs.bzl', 'KtJsInfo')
def kt_js_import_impl(ctx):
"""Implementation for kt_js_import.
Args:
ctx: rule context
Returns:
Providers for the build rule.
"""
if len(ctx.files.jars) != 1:
fail('a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Question 010
Source : http://www.pythonchallenge.com/pc/return/bull.html
what are you looking at ?
len(a[30]) = ?
a = [1, 11, 21, 1211, 111221]
Solution : http://villemin.gerard.free.fr/Puzzle/SeqComme.htm
"""
a = ["1"]
for i in range(31):
# init value
val... | """Question 010
Source : http://www.pythonchallenge.com/pc/return/bull.html
what are you looking at ?
len(a[30]) = ?
a = [1, 11, 21, 1211, 111221]
Solution : http://villemin.gerard.free.fr/Puzzle/SeqComme.htm
"""
a = ['1']
for i in range(31):
value = ''
last_char = ''
number_count = 0
chars = list(a... |
#!/usr/bin/env python3
# imports go here
#
# Free Coding session for 2015-03-02
# Written by Matt Warren
#
class SimpleClass:
def main(self):
return "HI"
def main2(self):
return "HELLO AGAIN"
if __name__ == '__main__':
sc = SimpleClass()
assert(sc.main.__name__ == 'main')
fn = g... | class Simpleclass:
def main(self):
return 'HI'
def main2(self):
return 'HELLO AGAIN'
if __name__ == '__main__':
sc = simple_class()
assert sc.main.__name__ == 'main'
fn = getattr(sc, 'main')
assert fn() == 'HI'
fn = getattr(sc, 'main', sc.main2)
assert fn() == 'HI'
... |
r =int(input("enter the row:"))
for i in range(1, r+1):
for j in range(1, i+1):
print("*", end = " ")
print("\n")
x = r
for j in range(1, r):
for i in range(1, x):
print("*", end = " ")
x = x - 1
print("\n")
| r = int(input('enter the row:'))
for i in range(1, r + 1):
for j in range(1, i + 1):
print('*', end=' ')
print('\n')
x = r
for j in range(1, r):
for i in range(1, x):
print('*', end=' ')
x = x - 1
print('\n') |
app.config.from_envvar('FLASKR_SETTINGS', silent=True)
def connect_db():
"""Connects to the specific database."""
rv = sqlite3.connect(app.config['DATABASE'])
rv.row_factory = sqlite3.Row
return rv | app.config.from_envvar('FLASKR_SETTINGS', silent=True)
def connect_db():
"""Connects to the specific database."""
rv = sqlite3.connect(app.config['DATABASE'])
rv.row_factory = sqlite3.Row
return rv |
# -*- coding: utf-8 -*-
"""
Project: EverydayWechat-Github
Creator: DoubleThunder
Create time: 2019-07-12 19:09
Introduction:
"""
| """
Project: EverydayWechat-Github
Creator: DoubleThunder
Create time: 2019-07-12 19:09
Introduction:
""" |
SERVIDOR_DESTINO = "BIGSQL"
YAML_SCOOP_IMPORT = "sqoop-import"
YAML_SCOOP_EXPORT = "sqoop-export"
YAML_BIGSQL_EXEC = "bigsql-import"
YAML_HDFS_IMPORT = "hdfs-import"
YAML_HDFS_EXPORT = "hdfs-export"
YAML_PYTHON_SCRIPT = "python-script"
YAML_ORIGEM = "origem"
YAML_DESTINO = "destino"
YAML_TABLE = "tabela"
YAML_QUERY =... | servidor_destino = 'BIGSQL'
yaml_scoop_import = 'sqoop-import'
yaml_scoop_export = 'sqoop-export'
yaml_bigsql_exec = 'bigsql-import'
yaml_hdfs_import = 'hdfs-import'
yaml_hdfs_export = 'hdfs-export'
yaml_python_script = 'python-script'
yaml_origem = 'origem'
yaml_destino = 'destino'
yaml_table = 'tabela'
yaml_query = '... |
"""1423. Maximum Points You Can Obtain from Cards"""
class Solution(object):
def maxScore(self, cardPoints, k):
"""
:type cardPoints: List[int]
:type k: int
:rtype: int
"""
points = res = sum(cardPoints[:k])
c = cardPoints[::-1]
for i in range(k):
... | """1423. Maximum Points You Can Obtain from Cards"""
class Solution(object):
def max_score(self, cardPoints, k):
"""
:type cardPoints: List[int]
:type k: int
:rtype: int
"""
points = res = sum(cardPoints[:k])
c = cardPoints[::-1]
for i in range(k):
... |
{
# Ports for the left-side motors
"leftMotorPorts": [0, 1],
# Ports for the right-side motors
"rightMotorPorts": [2, 3],
# NOTE: Inversions of the slaves (i.e. any motor *after* the first on
# each side of the drive) are *with respect to their master*. This is
# different from the other po... | {'leftMotorPorts': [0, 1], 'rightMotorPorts': [2, 3], 'leftMotorsInverted': [False, False], 'rightMotorsInverted': [False, False], 'encoderPPR': 512, 'leftEncoderInverted': False, 'rightEncoderInverted': False, 'gearing': 1, 'wheelDiameter': 0.333, 'gyroType': 'None', 'gyroPort': ''} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.