content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Lecture 6.3, slide 3
def removeDups(L1, L2):
for e1 in L1:
for e1 in L2:
L1.remove(e1)
L1 = [1, 2, 3, 4]
L2 = [1, 2, 5, 6]
removeDups(L1, L2) # Will yield L1 = [2, 3, 4]
def removeDupsBetter(L1, L2):
L1Start = L1[:]
for e1 in L1Start:
for e1 in L2:
L1.remove(e1)... | def remove_dups(L1, L2):
for e1 in L1:
for e1 in L2:
L1.remove(e1)
l1 = [1, 2, 3, 4]
l2 = [1, 2, 5, 6]
remove_dups(L1, L2)
def remove_dups_better(L1, L2):
l1_start = L1[:]
for e1 in L1Start:
for e1 in L2:
L1.remove(e1)
l1 = [1, 2, 3, 4]
l2 = [1, 2, 5, 6]
remove_dups_... |
class Countries:
def __init__(self, country_code):
self.country_code = country_code
self.total_time = 0
self.visits = []
def add_visit_time(self, visit):
self.total_time = self.total_time + visit.get_total_visit_time()
def add_visit_to_list(self, visit):
self.visits... | class Countries:
def __init__(self, country_code):
self.country_code = country_code
self.total_time = 0
self.visits = []
def add_visit_time(self, visit):
self.total_time = self.total_time + visit.get_total_visit_time()
def add_visit_to_list(self, visit):
self.visit... |
word_list = ["Life", "is", "short"]
for _, w in enumerate(word_list):
print(w, end=" ")
| word_list = ['Life', 'is', 'short']
for (_, w) in enumerate(word_list):
print(w, end=' ') |
FILE_SIZE_MB = 2
FILE_SIZE_B = FILE_SIZE_MB * 1024 * 1024
GENERATION_TIMEOUT_SEC = 120
UBUNTU_IMAGE_NAME = "ghcr.io/neuro-inc/ubuntu:latest"
NGINX_IMAGE_NAME = "ghcr.io/neuro-inc/nginx:latest"
ALPINE_IMAGE_NAME = "ghcr.io/neuro-inc/alpine:latest"
format_list = "{type:<15}{size:<15,}{name:<}".format
format_list_patter... | file_size_mb = 2
file_size_b = FILE_SIZE_MB * 1024 * 1024
generation_timeout_sec = 120
ubuntu_image_name = 'ghcr.io/neuro-inc/ubuntu:latest'
nginx_image_name = 'ghcr.io/neuro-inc/nginx:latest'
alpine_image_name = 'ghcr.io/neuro-inc/alpine:latest'
format_list = '{type:<15}{size:<15,}{name:<}'.format
format_list_pattern ... |
HOME_PAGE = "Home Page"
MY_WALL = "My Wall"
ICON = "icon.ico"
SEARCH_FRIENDS = "Search Friends"
PRIVATE_CHAT = "Private Chat"
GROUP_CHAT = "Group Chat"
ADD_FRIENDS = "Add Friends"
SETTINGS = "Settings"
SETTINGS_PAGE = "Settings"
LOG_OUT = "Log Out"
OFFLINE = "Offline"
UPLOAD_PICTURE = "Upload Picture"
UPLOAD_STATUS = "... | home_page = 'Home Page'
my_wall = 'My Wall'
icon = 'icon.ico'
search_friends = 'Search Friends'
private_chat = 'Private Chat'
group_chat = 'Group Chat'
add_friends = 'Add Friends'
settings = 'Settings'
settings_page = 'Settings'
log_out = 'Log Out'
offline = 'Offline'
upload_picture = 'Upload Picture'
upload_status = '... |
"""OSENV CLI Tool."""
_program = "osenv-tool"
_description = "Create and load .ostackrc credentials confidentialy."
_author = "opnmind"
_url = "https://github.com/opnmind/osenv-tool"
__version__ = "0.7.1"
| """OSENV CLI Tool."""
_program = 'osenv-tool'
_description = 'Create and load .ostackrc credentials confidentialy.'
_author = 'opnmind'
_url = 'https://github.com/opnmind/osenv-tool'
__version__ = '0.7.1' |
__author__ = 'jbowman'
# https://pythonspot.com/datatype-casting/
# Function Description
# int(x) Converts x to an integer
# long(x) Converts x to a long integer
# float(x) Converts x to a floating point number
# str(x) Converts x to an string. x can be of the type float. integer or long.
# hex(x) Converts x integer ... | __author__ = 'jbowman'
x = 3
y = 2.15315315313532
print('We have defined two numbers,')
print('x = ' + str(x))
print('y = ' + str(y))
a = '135.31421'
b = '133.1112223'
c = float(a) + float(b)
print(c)
print('a + b = ' + str(c)) |
class Solution:
def jump(self, nums: List[int]) -> int:
step = 0
cur_max=0
start=0
end = 0
for i in range(len(nums)-1):
step+=1
for j in range(start,end+1):
if nums[j]+j>=len(nums)-1:
return step
... | class Solution:
def jump(self, nums: List[int]) -> int:
step = 0
cur_max = 0
start = 0
end = 0
for i in range(len(nums) - 1):
step += 1
for j in range(start, end + 1):
if nums[j] + j >= len(nums) - 1:
return step
... |
def Solution(signs, n):
mn = [(s[0] + s[1], s[0] - s[2]) for s in signs]
return (0, 0)
for t in range(int(input())):
n = int(input())
signs = [list(map(int, input().split())) for _ in range(n)]
s = Solution(signs, n)
print ('Case #%d: %d %d' % (t + 1, s[0], s[1]))
| def solution(signs, n):
mn = [(s[0] + s[1], s[0] - s[2]) for s in signs]
return (0, 0)
for t in range(int(input())):
n = int(input())
signs = [list(map(int, input().split())) for _ in range(n)]
s = solution(signs, n)
print('Case #%d: %d %d' % (t + 1, s[0], s[1])) |
'''
Standard Python only (no numpy/scipy, pandas or sklearn) feature hasher based
on Sam Hocevar's Avazu benchmark code. Avoiding non-standard libraries means
that we can use Pypy for a large speedup.
author: David Thaler
date: July 2015
'''
def hash_features(x, D):
'''
Performs a sparse one-hot encoding of a di... | """
Standard Python only (no numpy/scipy, pandas or sklearn) feature hasher based
on Sam Hocevar's Avazu benchmark code. Avoiding non-standard libraries means
that we can use Pypy for a large speedup.
author: David Thaler
date: July 2015
"""
def hash_features(x, D):
"""
Performs a sparse one-hot encoding of a... |
# def binarySearch(array, x, low, high):
# if high >= low:
# mid = low + (high - low)//2
# # If found at mid, then return it
# if array[mid] == x:
# return mid
# # Search the left half
# elif array[mid] > x:
# return binarySearch(array, x, low, mid... | def binary_search(arr, x, low, high):
if high >= low:
mid = low + (high - low) // 2
if arr[mid] == x:
return mid
elif arr[mid] > x:
return binary_search(arr, x, low, high - 1)
else:
return binary_search(arr, x, mid + 1, high)
else:
retu... |
"""
==================
ns1.pkg
==================
"""
__version__ = '0.1'
| """
==================
ns1.pkg
==================
"""
__version__ = '0.1' |
'''
Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree [1,2,2,3,4,4,3] is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following [1,2,2,null,3,null,3] is not:
1
/ \
2 2
\ \
3 3
=================... | """
Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree [1,2,2,3,4,4,3] is symmetric:
1
/ 2 2
/ \\ / 3 4 4 3
But the following [1,2,2,null,3,null,3] is not:
1
/ 2 2
\\ 3 3
=======================... |
{
"targets": [
{
"target_name": "addon",
"sources": [ "main.cpp",'/content/node-js-cuda/test.o'],
'conditions': [
[ 'OS=="linux"', {
'libraries': ['-lcuda','-lcudart'],
'library_dirs': ['/usr/local/cuda/lib64']
}]
],
"include_dirs": [
"<!(node -... | {'targets': [{'target_name': 'addon', 'sources': ['main.cpp', '/content/node-js-cuda/test.o'], 'conditions': [['OS=="linux"', {'libraries': ['-lcuda', '-lcudart'], 'library_dirs': ['/usr/local/cuda/lib64']}]], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'defines': ['NAPI_DISABLE_CPP_EXCEPTIONS']}]} |
# TDD is the back bone for sucessfull CI/CD pipeline.
# CI/CD to complex, helps in saving a lot of cost in long run.
# There are 3 types of test.
# 1. Unit test : test the smallest degree of functionality, like a function.
# 2. Integration test : test how different modules integrate with each other.
# 3. Functional tes... | a = 5
assert a > 1
assert a < 1
print('Hello') |
def find_min_count(ls,num):
comparison = []
if(num%3 ==0):
comparison.append(ls[int(num/3)])
if num%2 ==0:
comparison.append(ls[int(num/2)])
comparison.append(ls[num -1])
m=min(comparison)
ls.append(m+1)
n = int(input())
list=[0,0,1,1]
for i in range(4,n+1):
find_min_count(l... | def find_min_count(ls, num):
comparison = []
if num % 3 == 0:
comparison.append(ls[int(num / 3)])
if num % 2 == 0:
comparison.append(ls[int(num / 2)])
comparison.append(ls[num - 1])
m = min(comparison)
ls.append(m + 1)
n = int(input())
list = [0, 0, 1, 1]
for i in range(4, n + 1)... |
#!/usr/local/bin/python3
"""Print al factorials less than 1000."""
#c = 0
c = 1
f = 1
while (f < 1000):
print(f)
c += 1
# f = 1
f *= c
# for n in range(c, 0, -1):
# f = f * n
| """Print al factorials less than 1000."""
c = 1
f = 1
while f < 1000:
print(f)
c += 1
f *= c |
#
# PySNMP MIB module A3Com-IPXpolicy-r3-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-IPXPOLICY-R3-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:08:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ... |
#!/usr/bin/python
def handle(event, context):
return "payment failed!"
| def handle(event, context):
return 'payment failed!' |
sentence=input("Enter the sentence")
pattern=input("Enter the pattern")
position=[]
count=0
j=len(pattern)
for i in range(0,len(sentence)):
for j in range(i+1,len(sentence)):
extract=sentence[i:j]
if(extract==pattern):
position.append(i)
count+=1
if(count>0):
... | sentence = input('Enter the sentence')
pattern = input('Enter the pattern')
position = []
count = 0
j = len(pattern)
for i in range(0, len(sentence)):
for j in range(i + 1, len(sentence)):
extract = sentence[i:j]
if extract == pattern:
position.append(i)
count += 1
if count >... |
reference_data_path = '../testing_data/test_model_data_for_e3sm_diags/climatology'
test_data_path = '../testing_data/test_model_data_for_e3sm_diags/climatology'
test_name = "20161118.beta0.F1850COSP"
reference_name = "20161118.beta0.F1850COSP"
results_dir = 'model_climo_vs_model_climo_results'
run_type = 'model_vs_mo... | reference_data_path = '../testing_data/test_model_data_for_e3sm_diags/climatology'
test_data_path = '../testing_data/test_model_data_for_e3sm_diags/climatology'
test_name = '20161118.beta0.F1850COSP'
reference_name = '20161118.beta0.F1850COSP'
results_dir = 'model_climo_vs_model_climo_results'
run_type = 'model_vs_mode... |
# -*- encoding: utf-8 -*-
#######################################################################################################################
# DESCRIPTION:
#######################################################################################################################
# TODO
#############################... | class Cnf:
def __init__(self, size):
self.variables = size ** 2
self.clauses = []
def add(self, clause):
self.clauses.append(clause)
def parse(self, file_path):
variables = []
with open(file_path) as file:
for (index, line) in enumerate(file):
... |
def selection_sort(lst):
for i, e in enumerate(lst):
mn = min(range(i,len(lst)), key=lst.__getitem__)
lst[i], lst[mn] = lst[mn], e
return lst
if __name__ == "__main__":
"""Sample usage and simple test suite"""
def executeTask(i):
testcase = [16+i,93,-99,95,-96,-24,-53,-71,96,-66,-21,72,-1... | def selection_sort(lst):
for (i, e) in enumerate(lst):
mn = min(range(i, len(lst)), key=lst.__getitem__)
(lst[i], lst[mn]) = (lst[mn], e)
return lst
if __name__ == '__main__':
'Sample usage and simple test suite'
def execute_task(i):
testcase = [16 + i, 93, -99, 95, -96, -24, -53, -71, ... |
g1 = input()
g2 = input()
letters = input()
if sorted(g1 + g2) == sorted(letters):
print('YES')
else:
print('NO') | g1 = input()
g2 = input()
letters = input()
if sorted(g1 + g2) == sorted(letters):
print('YES')
else:
print('NO') |
# Copyright 2020 Red Hat, Inc.
# 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... | class Viewbuilder(object):
"""Model default type API response as a python dictionary."""
_collection_name = 'default_types'
def _convert_to_dict(self, default):
return {'project_id': default.project_id, 'volume_type_id': default.volume_type_id}
def create(self, default_type):
"""Detail... |
# Open the sample named 'sample_name' and store it in the variable 'image'.
# 'sample_name' must refer to an iage actually present on Wayne
# Rasband site; they are listed in the Fie >> Open Sample menu.
# For instance:
sample_name = 'blobs.gif';
image = IJ.openImage('http://rsb.info.nih.gov/ij/images/'+sample_name)
# ... | sample_name = 'blobs.gif'
image = IJ.openImage('http://rsb.info.nih.gov/ij/images/' + sample_name)
image.show() |
## Algoritmo de busqueda por profundidad recursivo para pintar una matris
## Autor: Luque Ccosi Paul Alexander
## algoritmo como tal
def dfs_recursive(matrix, startX, startY, simbVisited, simbPared):
## Visitar el primer valor, verificamos si es pares, y si esta en los limites
try:
if(matrix[startX][st... | def dfs_recursive(matrix, startX, startY, simbVisited, simbPared):
try:
if matrix[startX][startY] != simbPared:
matrix[startX][startY] = simbVisited
else:
print('es pared, no se pude pintar')
return matrix
except:
print('Fuera del os limites')
... |
def soma(a, b):
s = a + b
print(s)
soma (2*3, 4)
soma (2, 3) | def soma(a, b):
s = a + b
print(s)
soma(2 * 3, 4)
soma(2, 3) |
# Amir Shokri
# 9811920009
# Dr.Fadaei
# amirsh.nll@gmail.com
# python exercise - 7
n = 23543
counter = 0
for x in range(2,round(n / 2) + 1):
if n % x == 0:
counter+=1
if counter==0:
print('yes')
else:
print('no') | n = 23543
counter = 0
for x in range(2, round(n / 2) + 1):
if n % x == 0:
counter += 1
if counter == 0:
print('yes')
else:
print('no') |
def iterPower(base, exp):
'''
calculates the exponential base^exp by simply using successive multiplication.
For example, iterPower(base, exp) should compute bas^exp
by multiplying base times itself exp times.
base: int or float.
exp: int >= 0
returns: int or float, base^exp
'''
r... | def iter_power(base, exp):
"""
calculates the exponential base^exp by simply using successive multiplication.
For example, iterPower(base, exp) should compute bas^exp
by multiplying base times itself exp times.
base: int or float.
exp: int >= 0
returns: int or float, base^exp
"""
... |
# Time: O(nd) | Space: O(n)
def numberOfWaysToMakeChange(n, denoms):
ways = [0 for amount in range(n+1)]
ways[0] = 1
for denom in denoms:
for amount in range(1, n + 1):
if denom <= amount:
ways[amount] += ways[amount - denom]
return ways[n] | def number_of_ways_to_make_change(n, denoms):
ways = [0 for amount in range(n + 1)]
ways[0] = 1
for denom in denoms:
for amount in range(1, n + 1):
if denom <= amount:
ways[amount] += ways[amount - denom]
return ways[n] |
def add_args(parser):
"""Add arguments to the argparse.ArgumentParser
Args:
parser: argparse.ArgumentParser
Returns:
parser: a parser added with args
"""
# Training settings
parser.add_argument(
"--task",
type=str,
default="train",
metavar="T",
... | def add_args(parser):
"""Add arguments to the argparse.ArgumentParser
Args:
parser: argparse.ArgumentParser
Returns:
parser: a parser added with args
"""
parser.add_argument('--task', type=str, default='train', metavar='T', help='the type of task: train or denoise')
parser.add_ar... |
N = int(input())
ABC = []
for _ in range(N):
ABC.append(list(map(int, input().split())))
def chmax(i, j):
diff = max([dp[i-1][x] for x in {0, 1, 2}-{j}])
if dp[i][j] < ABC[i][j] + diff:
dp[i][j] = ABC[i][j] + diff
return True
return False
dp = [[0, 0, 0] for _ in range(N)]
dp[0][0] ... | n = int(input())
abc = []
for _ in range(N):
ABC.append(list(map(int, input().split())))
def chmax(i, j):
diff = max([dp[i - 1][x] for x in {0, 1, 2} - {j}])
if dp[i][j] < ABC[i][j] + diff:
dp[i][j] = ABC[i][j] + diff
return True
return False
dp = [[0, 0, 0] for _ in range(N)]
dp[0][0] ... |
class GeocodeError(Exception):
pass
class MatrixServiceError(Exception):
pass
class RelationshipError(Exception):
pass
class EmptyRouteException(Exception):
pass
class RouteStateException(Exception):
pass
class LocationStateException(Exception):
pass
class LanguageOptionError(Excepti... | class Geocodeerror(Exception):
pass
class Matrixserviceerror(Exception):
pass
class Relationshiperror(Exception):
pass
class Emptyrouteexception(Exception):
pass
class Routestateexception(Exception):
pass
class Locationstateexception(Exception):
pass
class Languageoptionerror(Exception):
... |
pancakes = int(input())
if pancakes > 3:
print('Yum!')
if pancakes <= 3:
print('Still hungry!')
| pancakes = int(input())
if pancakes > 3:
print('Yum!')
if pancakes <= 3:
print('Still hungry!') |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'betterforms-tests.db',
},
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'betterforms'... | databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'betterforms-tests.db'}}
installed_apps = ('django.contrib.auth', 'django.contrib.admin', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.staticfiles', 'betterforms', 'tests')
debug = True
secret_key = 'JVpuGfSgVm2IxJ03xA... |
class Solution:
def findNumberOfLIS(self, nums: List[int]) -> int:
# dp[i] means LIS ended with nums[i]
# dp[i] = max(dp[k] | where nums[k] < nums[i]) + 1
# O(n^2)
n = len(nums)
dp = [1 for _ in range(n)]
cnt = [1 for _ in range(n)]
for i in range(n):... | class Solution:
def find_number_of_lis(self, nums: List[int]) -> int:
n = len(nums)
dp = [1 for _ in range(n)]
cnt = [1 for _ in range(n)]
for i in range(n):
for j in range(i):
if nums[j] < nums[i]:
if dp[i] < dp[j] + 1:
... |
def doesnt_match(words):
print('Doesn\'t match: ' + words)
result = model_x28.doesnt_match(words.split())
print(result)
def most_similar(word):
if word not in x28_index2word:
return
print('Most similar: ' + word)
row_format = "{:>30} {}"
for result, score in model_x28.wv.most_simil... | def doesnt_match(words):
print("Doesn't match: " + words)
result = model_x28.doesnt_match(words.split())
print(result)
def most_similar(word):
if word not in x28_index2word:
return
print('Most similar: ' + word)
row_format = '{:>30} {}'
for (result, score) in model_x28.wv.most_simil... |
#!/usr/bin/env python3
with open("input.txt", "r") as f:
string = f.read()
passports = [x.replace("\n", " ").split() for x in string.split("\n\n")]
passports = [x for x in passports if x != []]
new_passports = []
for x in passports:
v = {}
for field in x:
k, val = field.split(":")
v[k] = val
new_passports.... | with open('input.txt', 'r') as f:
string = f.read()
passports = [x.replace('\n', ' ').split() for x in string.split('\n\n')]
passports = [x for x in passports if x != []]
new_passports = []
for x in passports:
v = {}
for field in x:
(k, val) = field.split(':')
v[k] = val
new_passports.ap... |
DEFAULT_SIGNED_URL_CREATOR = "https://europe-west2-chai-959f8.cloudfunctions.net/signed-url-creator"
GUEST_UID = "20c900f0-e6f5-440c-bd83-e1ad894ad598"
GUEST_KEY = "LyRgaRjLmldLltvIL5Q5QY6XxNgIAMiTxxQdq2GyiJA8jsd55q7FxYcOgZUbV2dFmeK75pt4vd3zXe9Acd7pyw"
BOT_DELETER_ENDPOINT = "https://europe-west2-chai-959f8.cloudfunct... | default_signed_url_creator = 'https://europe-west2-chai-959f8.cloudfunctions.net/signed-url-creator'
guest_uid = '20c900f0-e6f5-440c-bd83-e1ad894ad598'
guest_key = 'LyRgaRjLmldLltvIL5Q5QY6XxNgIAMiTxxQdq2GyiJA8jsd55q7FxYcOgZUbV2dFmeK75pt4vd3zXe9Acd7pyw'
bot_deleter_endpoint = 'https://europe-west2-chai-959f8.cloudfuncti... |
# pylint: disable=line-too-long
{
'name': "{{name}}",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'author': "Oondeo",
'website': "https://www.oondeo.es",
'license': "GPL-3",
# Categories can b... | {'name': '{{name}}', 'summary': "\n Short (1 phrase/line) summary of the module's purpose, used as\n subtitle on modules listing or apps.openerp.com", 'author': 'Oondeo', 'website': 'https://www.oondeo.es', 'license': 'GPL-3', 'category': 'Uncategorized', 'version': '{{ $odoo_version }}.0.1.0.0', 'depends... |
def add_two(user_input):
if "number" in user_input and isinstance(user_input["number"], int):
return user_input["number"] + 2
return None
| def add_two(user_input):
if 'number' in user_input and isinstance(user_input['number'], int):
return user_input['number'] + 2
return None |
# -----------------------------------------------------------------------------
# $Id$
#
# Copyright (C) 2010 MINT Working group. All rights reserved.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional... | class Xmlnode:
"""
This class handles an XML node.
"""
def __init__(self, name):
"""
Construct from XML tag name.
"""
self.name = name
self.parent = None
self.children = []
self.text = ''
self.attbDict = {}
def get_name(self):
... |
# Possible Answers:
fig = plt.figure(0)
# Get a list of degree centrality scores for all of the
# nodes in the graph
degree_centralities = list(
nx.degree_centrality(G).values())
x, y = ecdf(degree_centralities)
# Plot the histogram of degree centralities.
plt.scatter(x, y)
# Set the plot title.
plt.title('Degree C... | fig = plt.figure(0)
degree_centralities = list(nx.degree_centrality(G).values())
(x, y) = ecdf(degree_centralities)
plt.scatter(x, y)
plt.title('Degree Centralities') |
def getNumberOfOptions(priceOfJeans, priceOfShoes, priceOfSkirts, priceOfTops, dollars):
# Write your code here
jeanShoesMap = dict()
res = 0
for jprice in priceOfJeans:
for shprice in priceOfShoes:
cur_sum = jprice + shprice
jeanShoesMap[cur_sum] = jeanShoesMap... | def get_number_of_options(priceOfJeans, priceOfShoes, priceOfSkirts, priceOfTops, dollars):
jean_shoes_map = dict()
res = 0
for jprice in priceOfJeans:
for shprice in priceOfShoes:
cur_sum = jprice + shprice
jeanShoesMap[cur_sum] = jeanShoesMap.get(cur_sum, 0) + 1
for skp... |
nestedList=[[[3],[2],[[4]],3],[[[[2,[3]],44],[3,4]],2]]
number=0
counter=[]
def nestedCall():#also adds moves counter to next one
global counter
global nestedList
repeat=True
while repeat:
repeat=False
i=nestedList
number=0
while type(i)==list:
print("i",i,"nu... | nested_list = [[[3], [2], [[4]], 3], [[[[2, [3]], 44], [3, 4]], 2]]
number = 0
counter = []
def nested_call():
global counter
global nestedList
repeat = True
while repeat:
repeat = False
i = nestedList
number = 0
while type(i) == list:
print('i', i, 'number',... |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def dbus():
http_archive(
name="dbus" ,
build_file="//bazel/deps/dbus:build.BUILD" ,
sha256="2e44543b27364868ceb02... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def dbus():
http_archive(name='dbus', build_file='//bazel/deps/dbus:build.BUILD', sha256='2e44543b27364868ceb02b3aed734c142253d447f13c2ec87dff5d1a2909e9fb', strip_prefix='dbus-5c0575850fe17177bc1b82ff2fe1a1e4dc4e9261', urls=['https://github.com/U... |
class Node:
def __init__(self, v = None, n = None):
self._v = v;
self._n = n if isinstance(n, self.__class__) else None;
@property
def next(self):
return (self._n);
@next.setter
def next(self, v):
self._n = v;
@property
def val(self):
return (self._v... | class Node:
def __init__(self, v=None, n=None):
self._v = v
self._n = n if isinstance(n, self.__class__) else None
@property
def next(self):
return self._n
@next.setter
def next(self, v):
self._n = v
@property
def val(self):
return self._v
@va... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Pseudo-random number generator
"""
def lcg(a,c,m,seed):
"""Linear congruential generator."""
while True:
seed = (a*seed+c)%m
yield seed
g = lcg(3,1,17,1)
print([next(g) for _ in range(100)])
| """
Pseudo-random number generator
"""
def lcg(a, c, m, seed):
"""Linear congruential generator."""
while True:
seed = (a * seed + c) % m
yield seed
g = lcg(3, 1, 17, 1)
print([next(g) for _ in range(100)]) |
class CustomStack(object):
def __init__(self, maxSize):
"""
:type maxSize: int
"""
self.stack = [None]*maxSize
self.top = 0
def push(self, x):
"""
:type x: int
:rtype: None
"""
if(self.top != len(self.stack)):
... | class Customstack(object):
def __init__(self, maxSize):
"""
:type maxSize: int
"""
self.stack = [None] * maxSize
self.top = 0
def push(self, x):
"""
:type x: int
:rtype: None
"""
if self.top != len(self.stack):
self.st... |
class Solution:
def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]:
for i in range(len(A)):
A[i] = A[i][::-1] # reversing
for j in range(len(A[i])):
A[i][j] ^= 1
return A
| class Solution:
def flip_and_invert_image(self, A: List[List[int]]) -> List[List[int]]:
for i in range(len(A)):
A[i] = A[i][::-1]
for j in range(len(A[i])):
A[i][j] ^= 1
return A |
"""
2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value).
https://github.com/promises-aplus/promises-tests/blob/2.1.1/lib/tests/2.2.5.js
I don't know that this is testable either as this deals with a javascript construct.
""" | """
2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value).
https://github.com/promises-aplus/promises-tests/blob/2.1.1/lib/tests/2.2.5.js
I don't know that this is testable either as this deals with a javascript construct.
""" |
class SuperResolution():
def __init__(self, scale):
self.scale = 4
| class Superresolution:
def __init__(self, scale):
self.scale = 4 |
class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
res = [1]*len(nums)
left, right = 1, 1
for i in range(len(nums)):
res[i] *= left
res[-1-i] *= right
left *= nums[i]
right *= nums[-1-i]
return res
... | class Solution:
def product_except_self(self, nums: List[int]) -> List[int]:
res = [1] * len(nums)
(left, right) = (1, 1)
for i in range(len(nums)):
res[i] *= left
res[-1 - i] *= right
left *= nums[i]
right *= nums[-1 - i]
return res |
def maxSubArraySum(arr,size):
max_till_now = arr[0]
max_ending = 0
for i in range(0, size):
max_ending = max_ending + arr[i]
if max_ending < 0:
max_ending = 0
elif (max_till_now < max_ending):
max_till_now = max_ending
... | def max_sub_array_sum(arr, size):
max_till_now = arr[0]
max_ending = 0
for i in range(0, size):
max_ending = max_ending + arr[i]
if max_ending < 0:
max_ending = 0
elif max_till_now < max_ending:
max_till_now = max_ending
return max_till_now
arr = [-2, -3, ... |
#!/usr/bin/python
"""
All BULK exportable tables in Eloqua
DO NOT MODIFY
"""
tables = ['accounts', 'contacts', 'EmailOpen', 'EmailClickthrough', 'EmailSend', 'Subscribe', 'Unsubscribe',
'Bounceback', 'WebVisit', 'PageView', 'FormSubmit']
campaign_col_def = {
'currentStatus': 'TEXT',
... | """
All BULK exportable tables in Eloqua
DO NOT MODIFY
"""
tables = ['accounts', 'contacts', 'EmailOpen', 'EmailClickthrough', 'EmailSend', 'Subscribe', 'Unsubscribe', 'Bounceback', 'WebVisit', 'PageView', 'FormSubmit']
campaign_col_def = {'currentStatus': 'TEXT', 'id': 'INTEGER PRIMARY KEY', 'createdAt': 'DATETIME', '... |
height = input('what height?')
height = float(height)
level_height = 4.0
max_height = 200.0
site_area = float(input('what area'))
pro_person = float(input('how much pro person'))
if(height <= max_height):
level_number = height/level_height
level_number = round(level_number)
print(level_number)
total_a... | height = input('what height?')
height = float(height)
level_height = 4.0
max_height = 200.0
site_area = float(input('what area'))
pro_person = float(input('how much pro person'))
if height <= max_height:
level_number = height / level_height
level_number = round(level_number)
print(level_number)
total_ar... |
class Solution:
def minRemoveToMakeValid(self, s: str) -> str:
# Remove a ")" if it is encountered when stack was already empty (prevent negative balance).
# Remove a "(" if it is left on stack at end (prevent non-zero final balance).
# use stack (list in python) to p... | class Solution:
def min_remove_to_make_valid(self, s: str) -> str:
ls = list(s)
stack = []
for i in range(len(ls)):
if ls[i] == '(':
stack.append(i)
elif ls[i] == ')':
if stack:
stack.pop()
else:
... |
# Variable Global
# VariableGlobal : Singleton
class VariableGlobal:
class __VariableGlobal:
def __init__(self):
self.count = 1
self.table = {}
self.variableCounter = 0
self.labelCounter = 0
self.comparisonCounter = 0
def __str... | class Variableglobal:
class __Variableglobal:
def __init__(self):
self.count = 1
self.table = {}
self.variableCounter = 0
self.labelCounter = 0
self.comparisonCounter = 0
def __str__(self):
return repr(self) + self.val
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# FILE: dbConfig.py
#
# A simple DB configuration object
#
# Copyright by Author. All rights reserved. Not for reuse without
# express permissions.
#
#
class DBConfiguration(object):
def __init__(self,
protocol = 'mysql',
db_... | class Dbconfiguration(object):
def __init__(self, protocol='mysql', db_name=None, host_name=None, user_name=None, password=None, module_path=None, db_settings=None, test=False):
if db_settings:
self.db_name = db_settings['database_name']
self.protocol = db_settings['database_protoco... |
#!/usr/bin/env python3
enc = "jyvzzpunaolybipjvunfzpthre"
for i in range(26):
flag = ""
for c in enc:
flag += chr((ord(c)-97+i)%26+97)
print("%d: picoCTF{%s}"%(i,flag)) | enc = 'jyvzzpunaolybipjvunfzpthre'
for i in range(26):
flag = ''
for c in enc:
flag += chr((ord(c) - 97 + i) % 26 + 97)
print('%d: picoCTF{%s}' % (i, flag)) |
def test_rstBootstrap3(flamingo_env):
flamingo_env.settings.PLUGINS = ['flamingo.plugins.rstBootstrap3']
flamingo_env.write('/content/test.rst', """
.. div::
.. alert:: info
info
.. youtube:: foo
.. row::
.. col:: md-6
foo
.. col:: md-6
... | def test_rst_bootstrap3(flamingo_env):
flamingo_env.settings.PLUGINS = ['flamingo.plugins.rstBootstrap3']
flamingo_env.write('/content/test.rst', '\n\n\n .. div::\n\n .. alert:: info\n\n info\n\n .. youtube:: foo\n\n .. row::\n\n .. col:: md-6\n\n foo\n\n ... |
class Node:
def __init__(self, x = None):
self.m_data = x
self.m_next = None
self.m_prev = None
class List:
def __init__(self):
self.m_head = Node()
self.m_tail = self.m_head
def push_back(self, x):
self.insert(self.m_tail, x)
def pop_back(self):
... | class Node:
def __init__(self, x=None):
self.m_data = x
self.m_next = None
self.m_prev = None
class List:
def __init__(self):
self.m_head = node()
self.m_tail = self.m_head
def push_back(self, x):
self.insert(self.m_tail, x)
def pop_back(self):
... |
# -*- coding: utf-8 -*-
"""Definition of modules that are to be automatically loaded for `verdi shell`."""
DEFAULT_MODULES_LIST = [
('aiida.orm', 'Node', 'Node'),
('aiida.orm', 'Calculation', 'Calculation'),
('aiida.orm', 'load_workflow', 'load_workflow'),
('aiida.orm', 'JobCalculation', 'JobCalculatio... | """Definition of modules that are to be automatically loaded for `verdi shell`."""
default_modules_list = [('aiida.orm', 'Node', 'Node'), ('aiida.orm', 'Calculation', 'Calculation'), ('aiida.orm', 'load_workflow', 'load_workflow'), ('aiida.orm', 'JobCalculation', 'JobCalculation'), ('aiida.orm', 'Data', 'Data'), ('aiid... |
value = {
"fontSize": "6rem",
"alignSelf": "end"
}
label = {
"fontSize": "2rem"
}
value_horizontal = {
"fontSize": "6rem",
"justifySelf": "end"
}
label_horizontal = {
"fontSize": "6rem",
"justifySelf": "start"
}
data_table = {
"style_header": {
"backgroundColor": "#303030"
... | value = {'fontSize': '6rem', 'alignSelf': 'end'}
label = {'fontSize': '2rem'}
value_horizontal = {'fontSize': '6rem', 'justifySelf': 'end'}
label_horizontal = {'fontSize': '6rem', 'justifySelf': 'start'}
data_table = {'style_header': {'backgroundColor': '#303030'}, 'style_data': {'backgroundColor': '#444444'}} |
LEAGUE_IDS = {
"BL": 430,
"BL2": 431,
"FL": 434 ,
"FL2": 435,
"EPL": 426,
"EL1": 428,
"ECH": 427,
"LLIGA": 436,
"SD": 437,
"SA": 438,
"PPL": 439,
"DED": 433,
"CL": 405
}
| league_ids = {'BL': 430, 'BL2': 431, 'FL': 434, 'FL2': 435, 'EPL': 426, 'EL1': 428, 'ECH': 427, 'LLIGA': 436, 'SD': 437, 'SA': 438, 'PPL': 439, 'DED': 433, 'CL': 405} |
# Function is some reusable code --> helps to reduce repeat codes
# Takes arguments as input
# Does computation then returns a result
# def to define a function
# function_name(argument) to invoke with argument
def hello():
print('Hello!')
name = input('Who are you? ')
print('Welcome ' + name + ".")
hell... | def hello():
print('Hello!')
name = input('Who are you? ')
print('Welcome ' + name + '.')
hello()
big = max('1, 2, 3')
print(big) |
JSON = 'application/json'
mimetype_map = {
'xml': 'application/rdf+xml',
'json-ld': JSON,
'n3': 'text/n3',
'turtle': 'application/x-turtle',
# None: 'text/xml'
}
def correct_format(output_format):
if output_format is None:
corrected_output_format = 'xml'
else:
corrected_outp... | json = 'application/json'
mimetype_map = {'xml': 'application/rdf+xml', 'json-ld': JSON, 'n3': 'text/n3', 'turtle': 'application/x-turtle'}
def correct_format(output_format):
if output_format is None:
corrected_output_format = 'xml'
else:
corrected_output_format = output_format
return corre... |
"""
Mod class defines a mod.
TODO: alias_names needs work/implementation
"""
class Mod:
def __init__(self, mod_name, nexus_id, game_name, alias_names=[]):
self.mod_name = mod_name
self.nexus_id = nexus_id
self.game_name = game_name
# for common abbreviations/aliases like "iH... | """
Mod class defines a mod.
TODO: alias_names needs work/implementation
"""
class Mod:
def __init__(self, mod_name, nexus_id, game_name, alias_names=[]):
self.mod_name = mod_name
self.nexus_id = nexus_id
self.game_name = game_name
self.alias_names = []
def print_out(self):
... |
############# Configuration file #############
# Name of dataset
#name = 'Granulocytes_vs_Mononuclear'
#name = 'Granulocytes'
#name = 'Mononuclear'
#name = 'Lymphocyte'
#name = 'WBC'
# Open dataset testout
#name = 'BCCD'
#name = 'AUG_BCCD'
#name = 'GM_BCCD'
#name = 'G_BCCD'
#name = 'M_BCCD'
name = 'AUG_GM'
#name = 'A... | name = 'AUG_GM'
data_base = '/mnt/datasets/' + name
resize_base = '/home/bumsoo/Data/resized/'
split_base = '/home/bumsoo/Data/_train_val/'
resize_dir = resize_base + name
split_dir = split_base + name
rotate_mode = 'strict'
split = 'ratio'
val_ratio = 0.2
val_num = 25 |
num1 = int(input("Digite primer numero: "))
num2 = int(input("Digite segundo numero: "))
if num1>num2:
print ("el numero " , num1, " es mayor que " ,num2 )
else:
print ("el numero " , num2, " es mayor que " ,num1 )
| num1 = int(input('Digite primer numero: '))
num2 = int(input('Digite segundo numero: '))
if num1 > num2:
print('el numero ', num1, ' es mayor que ', num2)
else:
print('el numero ', num2, ' es mayor que ', num1) |
"""
Sermin constants
"""
Undefined = object()
VERBOSITY_DEBUG = 'debug' # Decisions
VERBOSITY_INFO = 'info' # Actions
VERBOSITY_WARNING = 'warning' # Warnings
VERBOSITY_ERROR = 'error' # Errors
VERBOSITY_LEVEL = {
verbosity: level for level, verbosity in enumerate([
VERBOSITY_DEBUG, VERBOSITY_INFO, V... | """
Sermin constants
"""
undefined = object()
verbosity_debug = 'debug'
verbosity_info = 'info'
verbosity_warning = 'warning'
verbosity_error = 'error'
verbosity_level = {verbosity: level for (level, verbosity) in enumerate([VERBOSITY_DEBUG, VERBOSITY_INFO, VERBOSITY_WARNING, VERBOSITY_ERROR])} |
"""
Custom exceptions
"""
class MissingIonError(Exception):
"""
An error to raise if an ion cannot be found in the database
"""
pass
class MissingDatabaseError(Exception):
"""
An error to raise when the database file cannot be found.
"""
class MissingASCIIFileError(Exception):
"""
... | """
Custom exceptions
"""
class Missingionerror(Exception):
"""
An error to raise if an ion cannot be found in the database
"""
pass
class Missingdatabaseerror(Exception):
"""
An error to raise when the database file cannot be found.
"""
class Missingasciifileerror(Exception):
"""
... |
def update_metadata():
print('updating meta data ...', end='')
RE.md['det_pos'] = ({'saxs': {'x':saxs.x.position, 'y':saxs.y.position, 'z':saxs.z.position},
'waxs1': {'x':waxs1.x.position, 'y':waxs1.y.position, 'z':waxs1.z.position},
'waxs2': {'x':waxs2.x.positi... | def update_metadata():
print('updating meta data ...', end='')
RE.md['det_pos'] = {'saxs': {'x': saxs.x.position, 'y': saxs.y.position, 'z': saxs.z.position}, 'waxs1': {'x': waxs1.x.position, 'y': waxs1.y.position, 'z': waxs1.z.position}, 'waxs2': {'x': waxs2.x.position, 'y': waxs2.y.position, 'z': waxs2.z.posi... |
DOMAIN = "denon_aios"
CONF_MODEL = "model"
CONF_MANUFACTURER = "manufacturer"
CONF_SERIAL_NUMBER = "serial_number"
CONF_DEVICE = "device"
CONF_VOLUME_CONTROL = "volume_control"
VOLUME_CONTROL_INTERNAL = "internal"
VOLUME_CONTROL_EXTERNAL = "external"
| domain = 'denon_aios'
conf_model = 'model'
conf_manufacturer = 'manufacturer'
conf_serial_number = 'serial_number'
conf_device = 'device'
conf_volume_control = 'volume_control'
volume_control_internal = 'internal'
volume_control_external = 'external' |
# Make it possible to define only `aplus_client` in django settings.py INSTALLED_APPS
default_app_config = 'aplus_client.django.apps.AplusClientConfig'
__version__ = '1.1.0'
| default_app_config = 'aplus_client.django.apps.AplusClientConfig'
__version__ = '1.1.0' |
"""Submodule of the parser related to Gaussian files for ESTAMPES
A module providing the submodules to be used by ESTAMPES:
fchk
Formatted checkpoint files.
glog
Gaussian output files.
See submodules for details.
"""
| """Submodule of the parser related to Gaussian files for ESTAMPES
A module providing the submodules to be used by ESTAMPES:
fchk
Formatted checkpoint files.
glog
Gaussian output files.
See submodules for details.
""" |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# zigzag.py
#
# Copyright 2010 Javier Rovegno Campos <tatadeluxe<at>gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# th... | def zigzag(n):
aux = [['x' for x in range(n)] for y in range(n)]
i = 0
j = 0
der = True
abajo = False
izq_abajo = False
der_arriba = False
for k in range(n ** 2):
aux[i][j] = k
if der:
j += 1
der = False
if i == 0:
izq_a... |
__author__ = 'zirony'
def _ratio2float(ratio):
return float(ratio.num / ratio.den)
def latitude(tags):
if 'GPS GPSLatitude' not in tags:
return False
neg = False
if 'GPS GPSLatitudeRef' in tags:
ref = str(tags['GPS GPSLatitudeRef'].values)
neg = (ref == 'S')
lat = _rati... | __author__ = 'zirony'
def _ratio2float(ratio):
return float(ratio.num / ratio.den)
def latitude(tags):
if 'GPS GPSLatitude' not in tags:
return False
neg = False
if 'GPS GPSLatitudeRef' in tags:
ref = str(tags['GPS GPSLatitudeRef'].values)
neg = ref == 'S'
lat = _ratio2floa... |
"""GWT Rules
Skylark rules for building [GWT](http://www.gwtproject.org/) applications using
Bazel.
"""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")
load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")
def _gwt_war_impl(ctx):
output_war = ctx.outputs.output_war
... | """GWT Rules
Skylark rules for building [GWT](http://www.gwtproject.org/) applications using
Bazel.
"""
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_jar')
load('@bazel_tools//tools/build_defs/repo:jvm.bzl', 'jvm_maven_import_external')
def _gwt_war_impl(ctx):
output_war = ctx.outputs.output_war
... |
__version__ = '0.6.0'
__author__ = 'Gram (@orsinium)'
__license__ = 'MIT'
| __version__ = '0.6.0'
__author__ = 'Gram (@orsinium)'
__license__ = 'MIT' |
SUBSCRIBE_HOST = "127.0.0.1"
SUBSCRIBE_PORT = "25"
SUBSCRIBE_USER = "robot@localhost"
SUBSCRIBE_PWD = None
SUBSCRIBE_TLS = False | subscribe_host = '127.0.0.1'
subscribe_port = '25'
subscribe_user = 'robot@localhost'
subscribe_pwd = None
subscribe_tls = False |
CRITICAL = "\033[1;31m"
HIGH = "\033[1;33m"
MEDIUM = "\033[1;36m"
LOW = "\033[1;34m"
INFO = "\033[1;37m"
CLEAR = "\033[0m"
BOLD = "\033[1m"
SUCCESS = "\033[1;32m"
LEVEL_NAMES = ["INFO", "LOW", "MEDIUM", "HIGH", "CRITICAL"]
STYLED_LEVELS = [globals()[level] + level + CLEAR for level in LEVEL_NAMES]
| critical = '\x1b[1;31m'
high = '\x1b[1;33m'
medium = '\x1b[1;36m'
low = '\x1b[1;34m'
info = '\x1b[1;37m'
clear = '\x1b[0m'
bold = '\x1b[1m'
success = '\x1b[1;32m'
level_names = ['INFO', 'LOW', 'MEDIUM', 'HIGH', 'CRITICAL']
styled_levels = [globals()[level] + level + CLEAR for level in LEVEL_NAMES] |
#
# PySNMP MIB module ZHNGPONLINK (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHNGPONLINK
# Produced by pysmi-0.3.4 at Wed May 1 15:46:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ... |
class Dog:
def __init__(self, breed):
self.breed = breed
@staticmethod
def bark():
return 'Woof'
| class Dog:
def __init__(self, breed):
self.breed = breed
@staticmethod
def bark():
return 'Woof' |
# 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 dfs(self, root, voyage):
if not root:
return
if root.val != voyage[self... | class Solution:
def dfs(self, root, voyage):
if not root:
return
if root.val != voyage[self.idx]:
self.ans = [-1]
return
self.idx += 1
if root.left and root.left.val != voyage[self.idx]:
self.ans.append(root.val)
self.dfs(r... |
name = 'sip'
version = '4.19.6'
authors = [
'Riverbank Computing Limited <https://www.riverbankcomputing.com>'
]
description = \
'''
SIP is a tool that makes it very easy to create Python bindings for C and
C++ libraries.
'''
build_requires = [
'python-2.7',
]
variants = [
['platform-li... | name = 'sip'
version = '4.19.6'
authors = ['Riverbank Computing Limited <https://www.riverbankcomputing.com>']
description = '\n SIP is a tool that makes it very easy to create Python bindings for C and\n C++ libraries.\n '
build_requires = ['python-2.7']
variants = [['platform-linux', 'arch-x86_64', 'os-CentO... |
expected_output = {
"testing123456789_987654321_123456789_987654321": {
"name": "testing123456789_987654321_123456789_987654321",
"color": 80001,
"end_point": "1.1.1.1",
"owners": "CLI",
"status": {
"admin": "up",
"operational": {
"stat... | expected_output = {'testing123456789_987654321_123456789_987654321': {'name': 'testing123456789_987654321_123456789_987654321', 'color': 80001, 'end_point': '1.1.1.1', 'owners': 'CLI', 'status': {'admin': 'up', 'operational': {'state': 'up', 'time_for_state': '00:02:46', 'since': '08-24 20:20:28.539'}}, 'candidate_path... |
#!/usr/bin/env python3
"""Advent of Code 2020 Day 03 - Toboggan Trajectory."""
def count_trees_on_slope(area: list, right_step: int, down_step: int) -> int:
"""Return number of trees encounterd in area on slope (right/down step).
Args:
area: Rows of characters representing coordinates of a map.
... | """Advent of Code 2020 Day 03 - Toboggan Trajectory."""
def count_trees_on_slope(area: list, right_step: int, down_step: int) -> int:
"""Return number of trees encounterd in area on slope (right/down step).
Args:
area: Rows of characters representing coordinates of a map.
right_step: Amount to... |
'''
Even or not even
'''
a = int(input())
b = int(input())
c = int(input())
even = (a % 2 == 0) or (b % 2 == 0) or (c % 2 == 0)
not_even = (a % 2 != 0) or (b % 2 != 0) or (c % 2 != 0)
if (even and not_even):
print('YES')
else:
print('NO')
| """
Even or not even
"""
a = int(input())
b = int(input())
c = int(input())
even = a % 2 == 0 or b % 2 == 0 or c % 2 == 0
not_even = a % 2 != 0 or b % 2 != 0 or c % 2 != 0
if even and not_even:
print('YES')
else:
print('NO') |
n = int(input())
seq = [int(i) for i in input().split()]
def checkisl(index, params):
seq, x = params
return seq[index] >= x
def checkisr(index, params):
seq, x = params
return seq[index] <= x
def lbinsearch(l, r, check, checkparams):
while l < r:
m = (l + r) // 2
if check(m, che... | n = int(input())
seq = [int(i) for i in input().split()]
def checkisl(index, params):
(seq, x) = params
return seq[index] >= x
def checkisr(index, params):
(seq, x) = params
return seq[index] <= x
def lbinsearch(l, r, check, checkparams):
while l < r:
m = (l + r) // 2
if check(m, ... |
list1 = [1 , 2, 3]
list2 = [4, 5, 6, 7, 8]
list3 = []
def main():
max_count = 0
if len(list1) < len(list2):
max_count = len(list1)
elif len(list1) > len(list2):
max_count = len(list2)
else:
max_count = len(list1)
for i in range(max_count):
list3.append(list1[i])
list3.append(list2[i])
print(list3)
... | list1 = [1, 2, 3]
list2 = [4, 5, 6, 7, 8]
list3 = []
def main():
max_count = 0
if len(list1) < len(list2):
max_count = len(list1)
elif len(list1) > len(list2):
max_count = len(list2)
else:
max_count = len(list1)
for i in range(max_count):
list3.append(list1[i])
... |
LAST_TAG = "HWI"
with open("countries.txt", "r", encoding='utf-8') as read_file:
with open("country_tag.py", "w", encoding='utf-8') as write_file:
write_file.write("tag_dictionary = {")
for line in read_file:
if(line == "\n" or line[0] == "#"):
continue
print... | last_tag = 'HWI'
with open('countries.txt', 'r', encoding='utf-8') as read_file:
with open('country_tag.py', 'w', encoding='utf-8') as write_file:
write_file.write('tag_dictionary = {')
for line in read_file:
if line == '\n' or line[0] == '#':
continue
print(l... |
# MIT License
#
# Copyright (c) 2022 SneaksAndData
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge... | """
Wrapper for java.io.BufferedOutputStream
"""
class Bufferedoutputstream:
"""
Wrapper for java.io.BufferedOutputStream
"""
def __init__(self, underlying):
"""
Class init
"""
self.underlying = underlying
def write(self, data):
"""
Wraps writ... |
LOCALHOST = "127.0.0.1"
PORT = 55555
BUFFER = 2048
ENCODING = "utf-8"
| localhost = '127.0.0.1'
port = 55555
buffer = 2048
encoding = 'utf-8' |
#
# PySNMP MIB module FASTTRAKIDERAID-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTTRAKIDERAID-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:12:48 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')
(single_value_constraint, value_size_constraint, constraints_intersection, constraints_union, value_range_constraint) ... |
# Test Data
TD_NAME = "name"
TD_IDS = "ids"
# Images
IMG_INTERVENTION_ID = "intervention_id"
IMG_INTERVENTION_ID = "intervention_id"
IMG_ANNOTATIONS = "annotations"
IMG_FRAME_NUMBER = "frame_number"
IMG_IS_FRAME = "is_frame"
# Shared
ORIGIN = "origin"
METADATA = "metadata"
| td_name = 'name'
td_ids = 'ids'
img_intervention_id = 'intervention_id'
img_intervention_id = 'intervention_id'
img_annotations = 'annotations'
img_frame_number = 'frame_number'
img_is_frame = 'is_frame'
origin = 'origin'
metadata = 'metadata' |
def update_fname(self):
first_name = input('Enter first name: ')
return first_name
def update_lname(self):
last_name = input('Enter last name: ')
return last_name
def update_email(self):
email_address = input('Enter email address: ')
return email_address
def update_reg... | def update_fname(self):
first_name = input('Enter first name: ')
return first_name
def update_lname(self):
last_name = input('Enter last name: ')
return last_name
def update_email(self):
email_address = input('Enter email address: ')
return email_address
def update_registration(self):
reg... |
listnumbers = []
for c in range(0, 5):
numbers = int(input("Type a value: "))
if c == 0 or numbers > listnumbers[-1]:
listnumbers.append(numbers)
else:
pos = 0
while pos < len(listnumbers):
if numbers <= listnumbers[pos]:
listnumbers.insert(pos, numbers)
... | listnumbers = []
for c in range(0, 5):
numbers = int(input('Type a value: '))
if c == 0 or numbers > listnumbers[-1]:
listnumbers.append(numbers)
else:
pos = 0
while pos < len(listnumbers):
if numbers <= listnumbers[pos]:
listnumbers.insert(pos, numbers)
... |
"""
Vortex OpenSplice
This software and documentation are Copyright 2006 to TO_YEAR ADLINK
Technology Limited, its affiliated companies and licensors. All rights
reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the Lice... | """
Vortex OpenSplice
This software and documentation are Copyright 2006 to TO_YEAR ADLINK
Technology Limited, its affiliated companies and licensors. All rights
reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the Lice... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.