content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""Created by sgoswami on 7/26/17."""
"""Given a nested list of integers, return the sum of all integers in the list weighted by their depth.
Each element is either an integer, or a list -- whose elements may also be integers or other lists.
Example 1:
Given the list [[1,1],2,[1,1]], return 10. (four 1's at depth 2, o... | """Created by sgoswami on 7/26/17."""
"Given a nested list of integers, return the sum of all integers in the list weighted by their depth.\nEach element is either an integer, or a list -- whose elements may also be integers or other lists.\n\nExample 1:\nGiven the list [[1,1],2,[1,1]], return 10. (four 1's at depth 2,... |
# exceptions.py -- custom exception classes for this module
class PayloadException(Exception):
'''
Something went wrong with the payload from the GitHub API.
'''
pass
class WorkerException(Exception):
'''
Something went wrong in the worker process.
'''
pass
class QueueException(Exc... | class Payloadexception(Exception):
"""
Something went wrong with the payload from the GitHub API.
"""
pass
class Workerexception(Exception):
"""
Something went wrong in the worker process.
"""
pass
class Queueexception(Exception):
"""
Something went wrong in the queue process.
... |
class MatrixOperations:
#Function which returns the transpose of given matrix A
def transpose(self, A) :
#T is used to store the transpose of A
T = [[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]
# iterate through rows
for i in range(len(A)):
# iterate thr... | class Matrixoperations:
def transpose(self, A):
t = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(len(A)):
for j in range(len(A[0])):
T[j][i] = A[i][j]
return T
def mult(self, A, T):
result = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in rang... |
# Given an array with n objects colored red, white or blue, sort them in-place so
# that objects of the same color are adjacent, with the colors in the order red,
# white and blue.
#
# Here, we will use the integers 0, 1, and 2 to represent the color red, white,
# and blue respectively.
#
# Note: You are not suppose to... | class Solution:
def sort_colors(self, nums):
index = 0
zero_index = 0
two_index = len(nums) - 1
while index <= two_index:
if nums[index] == 0:
(nums[index], nums[zero_index]) = (nums[zero_index], nums[index])
index += 1
zer... |
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param p, a tree node
# @param q, a tree node
# @return a boolean
def isSameTree(self, p, q):
if p is None or q i... | class Solution:
def is_same_tree(self, p, q):
if p is None or q is None:
return p is q
return p.val == q.val and self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right) |
# -*- coding: utf-8 -*-
"""
execution_report.py
@author: Darwinex Labs (www.darwinex.com), 2021-*
execution_report - A data structure to hold execution reports
"""
class execution_report():
# Side: 1=buy, 2=sell
def __init__(self, ClOrdID, Symbol, Side, Price, OrdType,
O... | """
execution_report.py
@author: Darwinex Labs (www.darwinex.com), 2021-*
execution_report - A data structure to hold execution reports
"""
class Execution_Report:
def __init__(self, ClOrdID, Symbol, Side, Price, OrdType, OrdStatus, OrderQty, MinQty, CumQty, LeavesQty):
self.ClOrdID = ClO... |
#!/usr/bin/env python
actions = {}
asts = []
# hgawk
asts.append('''class DollarNumber(ast.expr):
_fields = ("n",)
def __init__(self, n, **kwds):
self.n = n
self.__dict__.update(kwds)
''')
actions['''atom : DOLLARNUMBER'''] = ''' p[0] = DollarNumber(int(p[1][0][1:]), **p[1][1])'''
# Python... | actions = {}
asts = []
asts.append('class DollarNumber(ast.expr):\n _fields = ("n",)\n def __init__(self, n, **kwds):\n self.n = n\n self.__dict__.update(kwds)\n')
actions['atom : DOLLARNUMBER'] = ' p[0] = DollarNumber(int(p[1][0][1:]), **p[1][1])'
actions['file_input : ENDMARKER'] = ' p[0] = ... |
def printHi():
print('hi')
def print2():
print('2') | def print_hi():
print('hi')
def print2():
print('2') |
#
# PySNMP MIB module ONEACCESS-MISC-CONFIG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-MISC-CONFIG-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:25:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint, constraints_union) ... |
"""
Initial Migration
"""
name = "20201002172400_init"
dependencies = []
def upgrade(db):
db.teams.insert_many([
{"name": "cx"},
{"name": "voyager"},
{"name": "dar"},
{"name": "platform"},
{"name": "infra"},
{"name": "embedded"},
{"name": "helios"}
])
... | """
Initial Migration
"""
name = '20201002172400_init'
dependencies = []
def upgrade(db):
db.teams.insert_many([{'name': 'cx'}, {'name': 'voyager'}, {'name': 'dar'}, {'name': 'platform'}, {'name': 'infra'}, {'name': 'embedded'}, {'name': 'helios'}])
def downgrade(db):
db.teams.drop() |
def read_seats(file_location):
"""Read file the code
"""
seats = []
seat_map = open(file_location, 'r').read().split('\n')
for line in seat_map:
if line == '':
continue
seats.append(list(line))
return seats
def count_occupied(locations):
"""Count occupied loca... | def read_seats(file_location):
"""Read file the code
"""
seats = []
seat_map = open(file_location, 'r').read().split('\n')
for line in seat_map:
if line == '':
continue
seats.append(list(line))
return seats
def count_occupied(locations):
"""Count occupied locatio... |
class Assembly:
def __init__(self):
self.name = 'UnnamedAssembly'
self.methods = []
self.extern = False
self.version = '1.0.0.0'
self.hashAlgorithm = None
self.customAttributes = []
self.classes = []
| class Assembly:
def __init__(self):
self.name = 'UnnamedAssembly'
self.methods = []
self.extern = False
self.version = '1.0.0.0'
self.hashAlgorithm = None
self.customAttributes = []
self.classes = [] |
# -*- coding: utf-8 -*-
class NotNullFieldError(Exception):
pass
class TooLargeContent(Exception):
pass
class NoDateTimeGiven(Exception):
pass
class NoBooleanGiven(Exception):
pass
class NoListOrTupleGiven(Exception):
pass
| class Notnullfielderror(Exception):
pass
class Toolargecontent(Exception):
pass
class Nodatetimegiven(Exception):
pass
class Nobooleangiven(Exception):
pass
class Nolistortuplegiven(Exception):
pass |
"""
Class to parse precipitation file line
"""
class PrecipLine:
"""
Line parser for precipitation data
"""
def __init__(self, line):
"""
Init precip_line.
:param line: Raw input line
"""
self.station = line[3:9]
self.state_code = line[3:5]
self... | """
Class to parse precipitation file line
"""
class Precipline:
"""
Line parser for precipitation data
"""
def __init__(self, line):
"""
Init precip_line.
:param line: Raw input line
"""
self.station = line[3:9]
self.state_code = line[3:5]
self.... |
# title
# defines the title of the whole set of queries
# OPTIONAL, if not set, timestamp will be used
title = "General overview queries"
# description
# defines the textual and human-intended description of the purpose of these queries
# OPTIONAL, if not set, nothing will be used or displayed
description = "Queri... | title = 'General overview queries'
description = 'Queries extracted from google doc: https://docs.google.com/document/d/1aJnpoMIr2MUOLlGKk3ZvLTE5mEGk6fzaixunrMF4HhE/edit#heading=h.3i3qrymun2lk'
output_destination = 'https://drive.google.com/drive/folders/13v-SQyeene9-YpUtJPeb79pSqD4DE6rw'
output_format = ''
summary_sam... |
#!/usr/bin/env python3
for _ in range(int(input())):
n = int(input())
# https://www.wolframalpha.com/input/?i=sum_k%3D(n(n-1)%2B1)%5E(n(n-1)%2B2n)+k
print(n * (n * n * 2 + 1))
| for _ in range(int(input())):
n = int(input())
print(n * (n * n * 2 + 1)) |
class A(object):
def __init__(self, b):
self.b = b
def a(self):
print(self.b)
A(2).a()
| class A(object):
def __init__(self, b):
self.b = b
def a(self):
print(self.b)
a(2).a() |
# 63. Unique Paths II
# ttungl@gmail.com
# Follow up for "Unique Paths":
# Now consider if some obstacles are added to the grids. How many unique paths would there be?
# An obstacle and empty space is marked as 1 and 0 respectively in the grid.
# For example,
# There is one obstacle in the middle of a 3x3 grid as il... | class Solution(object):
def unique_paths_with_obstacles(self, obstacleGrid):
"""
:type obstacleGrid: List[List[int]]
:rtype: int
"""
(rows, cols) = (len(obstacleGrid), len(obstacleGrid[0]))
obstacleGrid[0][0] = 1 - obstacleGrid[0][0]
for i in range(1, cols):
... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"unhex": "defaults.ipynb",
"unimplemented": "defaults.ipynb",
"list_to_indexdir": "factory.ipynb",
"create_model": "factory.ipynb",
"assemble_sunspec_model": "factory.ipynb... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'unhex': 'defaults.ipynb', 'unimplemented': 'defaults.ipynb', 'list_to_indexdir': 'factory.ipynb', 'create_model': 'factory.ipynb', 'assemble_sunspec_model': 'factory.ipynb', 'assemble': 'factory.ipynb', 'ShadowSunspecEncoder': 'factory.ipynb', 'NAM... |
myString="UHHHHHH HMMMMMM HMM"
myStringLength=len(myString)
print(myStringLength)
| my_string = 'UHHHHHH HMMMMMM HMM'
my_string_length = len(myString)
print(myStringLength) |
# encoding: utf-8
# module Autodesk.Gis.Map.Platform.Interop calls itself Interop
# from Autodesk.Map.Platform, Version=24.0.30.14, Culture=neutral, PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class AcMapDisplayManagementService(MgService):
""" AcMapDisplayMa... | class Acmapdisplaymanagementservice(MgService):
""" AcMapDisplayManagementService(cPtr: IntPtr, cMemoryOwn: bool) """
@staticmethod
def disable_groups_view_draw_order():
""" DisableGroupsViewDrawOrder() """
pass
def dispose(self):
""" Dispose(self: AcMapDisplayManagementService... |
# default configuration values
questions = {
"number_of_options": 4,
"number_show_lines": 4
}
printing = {
"line_width": 20
}
| questions = {'number_of_options': 4, 'number_show_lines': 4}
printing = {'line_width': 20} |
async def example():
await channel.put(json.dumps({
'text': data.text,
'image': image,
'username': data.user.screen_name,
}))
| async def example():
await channel.put(json.dumps({'text': data.text, 'image': image, 'username': data.user.screen_name})) |
print('Welcome to your Fitness Guide!')
arm_ne = ['arms circle', 'tricep dips', 'push-ups', 'body saw']
back_ne = ['superman','plank', 'reverse snow angels', 'aquaman' ]
shoulder_ne = ['plank tap', 'side plank with lateral raise', 'crab walk', 'incline push-up' ]
abs_ne = ['mountain climber twist', 'plank up',... | print('Welcome to your Fitness Guide!')
arm_ne = ['arms circle', 'tricep dips', 'push-ups', 'body saw']
back_ne = ['superman', 'plank', 'reverse snow angels', 'aquaman']
shoulder_ne = ['plank tap', 'side plank with lateral raise', 'crab walk', 'incline push-up']
abs_ne = ['mountain climber twist', 'plank up', 'bicycle ... |
def main():
n = int(input())
for i in range(n):
a = int(input())
b = set([int(x) for x in input().split()])
if (max(b) - min(b)) < len(b):
print("YES")
else:
print("NO")
if __name__ == '__main__':
main()
| def main():
n = int(input())
for i in range(n):
a = int(input())
b = set([int(x) for x in input().split()])
if max(b) - min(b) < len(b):
print('YES')
else:
print('NO')
if __name__ == '__main__':
main() |
'''
n Python, we can pass a variable number of arguments to a function using special symbols. There are two special symbols:
*args (Non Keyword Arguments)
**kwargs (Keyword Arguments)
We use *args and **kwargs as an argument when we are unsure about the number of arguments to pass in the functions.
'''
def func(a,b,c,... | """
n Python, we can pass a variable number of arguments to a function using special symbols. There are two special symbols:
*args (Non Keyword Arguments)
**kwargs (Keyword Arguments)
We use *args and **kwargs as an argument when we are unsure about the number of arguments to pass in the functions.
"""
def func(a, b, ... |
args_count = {'documentclass':(1, 1),
'usepackage':(1, 1),
'title':(1, 0),
'author':(1, 0),
'date':(1, 0),
'color':(1, 0),
'input':(1, 0),
'part':(1, 0),
'chapter':(1, 1),
'section':(1, 1),
... | args_count = {'documentclass': (1, 1), 'usepackage': (1, 1), 'title': (1, 0), 'author': (1, 0), 'date': (1, 0), 'color': (1, 0), 'input': (1, 0), 'part': (1, 0), 'chapter': (1, 1), 'section': (1, 1), 'subsection': (1, 1), 'subsubsection': (1, 1), 'paragraph': (1, 1), 'subparagraph': (1, 1), 'chapter*': (1, 1), 'section... |
"""
This problem was asked by LinkedIn.
Given a list of points, a central point, and an integer k, find the nearest k points from the central point.
For example, given the list of points [(0, 0), (5, 4), (3, 1)], the central point (1, 2), and k = 2,
return [(0, 0), (3, 1)].
"""
def k_nearest(points, central, k):
... | """
This problem was asked by LinkedIn.
Given a list of points, a central point, and an integer k, find the nearest k points from the central point.
For example, given the list of points [(0, 0), (5, 4), (3, 1)], the central point (1, 2), and k = 2,
return [(0, 0), (3, 1)].
"""
def k_nearest(points, central, k):
... |
"""
Source: https://pe.usps.com/text/pub28/welcome.htm
"""
STREET_NAME_POST_ABBREVIATIONS = {
"ALLEE": "ALY",
"ALLEY": "ALY",
"ALLY": "ALY",
"ALY": "ALY",
"ANEX": "ANX",
"ANNEX": "ANX",
"ANNX": "ANX",
"ANX": "ANX",
"ARC": "ARC",
"ARC ": "ARC",
"ARCADE": "ARC",... | """
Source: https://pe.usps.com/text/pub28/welcome.htm
"""
street_name_post_abbreviations = {'ALLEE': 'ALY', 'ALLEY': 'ALY', 'ALLY': 'ALY', 'ALY': 'ALY', 'ANEX': 'ANX', 'ANNEX': 'ANX', 'ANNX': 'ANX', 'ANX': 'ANX', 'ARC': 'ARC', 'ARC ': 'ARC', 'ARCADE': 'ARC', 'ARCADE ': 'ARC', 'AV': 'AVE', 'AVE': 'AVE', 'AVEN': 'AVE',... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 20 17:06:02 2018
The Selection sort algorithm is based on the idea of finding the minimum or
maximum element in an unsorted array and then putting
it in its correct position in a sorted array.
@author: Akash
"""
def swap(num1,num2):
temp = num1
num1=nu... | """
Created on Wed Jun 20 17:06:02 2018
The Selection sort algorithm is based on the idea of finding the minimum or
maximum element in an unsorted array and then putting
it in its correct position in a sorted array.
@author: Akash
"""
def swap(num1, num2):
temp = num1
num1 = num2
num2 = temp
return ... |
#!/usr/bin/env python3
s = input()
n = 0
base = 2
i = 0
while i < len(s):
n = (base * n) + int(s[i])
i = i + 1
print(n)
| s = input()
n = 0
base = 2
i = 0
while i < len(s):
n = base * n + int(s[i])
i = i + 1
print(n) |
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def add(self, value):
node = Node(value)
if not self.head:
self.head = node
else:
current = self.hea... | class Node:
def __init__(self, value):
self.value = value
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def add(self, value):
node = node(value)
if not self.head:
self.head = node
else:
current = self.head
... |
#!/usr/bin/env python
"""
interaction.py
--------------
"""
class Interaction(object):
"""
Class that rappresents an interaction between instances of mape elements.
Args:
name (str): Name of the interaction.
data_class: ROS message type associated with the interaction.
"""
def __i... | """
interaction.py
--------------
"""
class Interaction(object):
"""
Class that rappresents an interaction between instances of mape elements.
Args:
name (str): Name of the interaction.
data_class: ROS message type associated with the interaction.
"""
def __init__(self, name, data... |
"""
Run Command Line Interface
==========================
Define a set of functions that perform runtime task over specific set of scenarios.
"""
| """
Run Command Line Interface
==========================
Define a set of functions that perform runtime task over specific set of scenarios.
""" |
size(800, 800)
background(255)
smooth()
fill(86, 135, 174, 175)
noStroke()
# Verschiebe Nullpunkt des Koordinatensystems von der Ecke links oben des
# grafischen Ausgabefensters ins Zentrum.
translate(width / 2, height / 2)
radius = 350.0
for i in range(0, 8):
arc(radius / 2, 0.0, radius, radius, 0, PI)
rota... | size(800, 800)
background(255)
smooth()
fill(86, 135, 174, 175)
no_stroke()
translate(width / 2, height / 2)
radius = 350.0
for i in range(0, 8):
arc(radius / 2, 0.0, radius, radius, 0, PI)
rotate(PI / 4.0) |
class KStacks():
def __init__(self, k, capacity):
self.nextAvailable = 0
self.data = [0] * capacity
self.front = [-1] * k
self.rear = [-1] * k
self.nextIndex = [i+1 for i in range(capacity)]
self.nextIndex[capacity-1] = -1
def isFull(self):
return self.ne... | class Kstacks:
def __init__(self, k, capacity):
self.nextAvailable = 0
self.data = [0] * capacity
self.front = [-1] * k
self.rear = [-1] * k
self.nextIndex = [i + 1 for i in range(capacity)]
self.nextIndex[capacity - 1] = -1
def is_full(self):
return sel... |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
ResourceMap = {
"k8s.config-map": "c7n_kube.resources.core.configmap.ConfigMap",
"k8s.custom-cluster-resource": "c7n_kube.resources.crd.CustomResourceDefinition",
"k8s.custom-namespaced-resource": "c7n_kube.resources.crd.CustomNa... | resource_map = {'k8s.config-map': 'c7n_kube.resources.core.configmap.ConfigMap', 'k8s.custom-cluster-resource': 'c7n_kube.resources.crd.CustomResourceDefinition', 'k8s.custom-namespaced-resource': 'c7n_kube.resources.crd.CustomNamespacedResourceDefinition', 'k8s.daemon-set': 'c7n_kube.resources.apps.daemonset.DaemonSet... |
"""pydtk modules."""
__version__ = "0.0.0-0"
__commit_id__ = "335be874b189127a42620a0475877155cdf0f870"
| """pydtk modules."""
__version__ = '0.0.0-0'
__commit_id__ = '335be874b189127a42620a0475877155cdf0f870' |
def capitalize_title(title):
pass
def check_sentence_ending(sentence):
pass
def remove_extra_spaces(sentence):
pass
def replace_word_choice(sentence, new_word, old_word):
pass
| def capitalize_title(title):
pass
def check_sentence_ending(sentence):
pass
def remove_extra_spaces(sentence):
pass
def replace_word_choice(sentence, new_word, old_word):
pass |
TASK_NAME = 'NERTaggingTask'
JS_ASSETS = ['']
JS_ASSETS_OUTPUT = 'scripts/vulyk-ner.js'
JS_ASSETS_FILTERS = 'yui_js'
CSS_ASSETS = ['']
CSS_ASSETS_OUTPUT = 'styles/vulyk-ner.css'
CSS_ASSETS_FILTERS = 'yui_css'
| task_name = 'NERTaggingTask'
js_assets = ['']
js_assets_output = 'scripts/vulyk-ner.js'
js_assets_filters = 'yui_js'
css_assets = ['']
css_assets_output = 'styles/vulyk-ner.css'
css_assets_filters = 'yui_css' |
#
# Example file for working with conditional statements
#
def main():
x, y = 10, 100
# conditional flow uses if, elif, else
if x<y:
print("x is less than y")
elif x>y:
print("x is more than y")
else:
print("x is equal to y")
# conditional statements let you use "a if C else b"
print("x... | def main():
(x, y) = (10, 100)
if x < y:
print('x is less than y')
elif x > y:
print('x is more than y')
else:
print('x is equal to y')
print('x is less than y' if x < y else 'x is more than y')
if __name__ == '__main__':
main() |
test = [1, "dog", (("tost", "tost1"), ("test", "test1")), 'c', 4, 'cat']
def mysort(eleme):
if type(eleme) == int:
return str(eleme)
else:
return eleme
print(test[2][0][1])
# print(c)
# print(test.count(self))
| test = [1, 'dog', (('tost', 'tost1'), ('test', 'test1')), 'c', 4, 'cat']
def mysort(eleme):
if type(eleme) == int:
return str(eleme)
else:
return eleme
print(test[2][0][1]) |
patches = [
# backwards compatibility
{
"op": "move",
"from": "/PropertyTypes/AWS::CodeCommit::Repository.RepositoryTrigger",
"path": "/PropertyTypes/AWS::CodeCommit::Repository.Trigger",
},
{
"op": "replace",
"path": "/ResourceTypes/AWS::CodeCommit::Repository/Pr... | patches = [{'op': 'move', 'from': '/PropertyTypes/AWS::CodeCommit::Repository.RepositoryTrigger', 'path': '/PropertyTypes/AWS::CodeCommit::Repository.Trigger'}, {'op': 'replace', 'path': '/ResourceTypes/AWS::CodeCommit::Repository/Properties/Triggers/ItemType', 'value': 'Trigger'}] |
#!/usr/bin/env python3
_min, c = 7856, 0
for i in range(4855, 7856):
if i % 8 == 0 and i % 19 == 0 and i % 7 != 0 and i % 16 != 0 and i % 24 != 0 and i % 26 != 0:
_min = min(_min, i)
c += 1
print(c, _min)
| (_min, c) = (7856, 0)
for i in range(4855, 7856):
if i % 8 == 0 and i % 19 == 0 and (i % 7 != 0) and (i % 16 != 0) and (i % 24 != 0) and (i % 26 != 0):
_min = min(_min, i)
c += 1
print(c, _min) |
def replace_links(course_id,links,title):
new_links = []
for link in links:
split_href = link['href'].split('dev.brightspace.com')
if course_id in split_href[1]:
my_href = 'data/rubrics%s.json'%split_href[1].replace(course_id,title)
else:
my_href = 'data/rubrics%s... | def replace_links(course_id, links, title):
new_links = []
for link in links:
split_href = link['href'].split('dev.brightspace.com')
if course_id in split_href[1]:
my_href = 'data/rubrics%s.json' % split_href[1].replace(course_id, title)
else:
my_href = 'data/rubr... |
pattern = r'</?p>'
for p in re.split(pattern, TEXT):
if p.startswith('We choose to go to the moon'):
result = p
| pattern = '</?p>'
for p in re.split(pattern, TEXT):
if p.startswith('We choose to go to the moon'):
result = p |
# Copyright 2021 san kim
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | _ne_tags = ['PS', 'LC', 'OG', 'DT', 'TI', 'QT', 'AF', 'CV', 'AM', 'PT', 'FD', 'TR', 'EV', 'MT', 'TM']
_ne_iob2_tags = ['O', 'B-PS', 'I-PS', 'B-LC', 'I-LC', 'B-OG', 'I-OG', 'B-DT', 'I-DT', 'B-TI', 'I-TI', 'B-QT', 'I-QT', 'B-AF', 'I-AF', 'B-CV', 'I-CV', 'B-AM', 'I-AM', 'B-PT', 'I-PT', 'B-FD', 'I-FD', 'B-TR', 'I-TR', 'B-E... |
# GMOS geometry_conf.py module containing information
# for Transform-based tileArrays/mosaicDetectors
# for tileArrays(): key=detector_name(), value=gap (unbinned pixels)
tile_gaps = {
# GMOS-N
'EEV9273-16-03EEV9273-20-04EEV9273-20-03': 37,
'e2v 10031-23-05,10031-01-03,10031-18-04': 37,
'BI13-20-4k-1,... | tile_gaps = {'EEV9273-16-03EEV9273-20-04EEV9273-20-03': 37, 'e2v 10031-23-05,10031-01-03,10031-18-04': 37, 'BI13-20-4k-1,BI12-09-4k-2,BI13-18-4k-2': 67, 'EEV2037-06-03EEV8194-19-04EEV8261-07-04': 37, 'EEV8056-20-03EEV8194-19-04EEV8261-07-04': 37, 'BI5-36-4k-2,BI11-33-4k-1,BI12-34-4k-1': 61}
geometry = {'EEV9273-16-03EE... |
n, c = list(map(int, input().split()))
p = list(map(int, input().split()))
t = list(map(int, input().split()))
limak = 0
Radewoosh = 0
sm, sm2 =0,0
for i in range(n):
sm +=t[i]
sm2 +=t[n-i-1]
limak += max(0,p[i] - c*sm)
Radewoosh += max(0,p[n-i-1] - c*sm2)
if limak > Radewoosh:
print("... | (n, c) = list(map(int, input().split()))
p = list(map(int, input().split()))
t = list(map(int, input().split()))
limak = 0
radewoosh = 0
(sm, sm2) = (0, 0)
for i in range(n):
sm += t[i]
sm2 += t[n - i - 1]
limak += max(0, p[i] - c * sm)
radewoosh += max(0, p[n - i - 1] - c * sm2)
if limak > Radewoosh:
... |
'''
@Date: 2019-08-20 09:16:33
@Author: ywyz
@LastModifiedBy: ywyz
@Github: https://github.com/ywyz
@LastEditors: ywyz
@LastEditTime: 2019-08-20 09:16:33
'''
print("\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8")
| """
@Date: 2019-08-20 09:16:33
@Author: ywyz
@LastModifiedBy: ywyz
@Github: https://github.com/ywyz
@LastEditors: ywyz
@LastEditTime: 2019-08-20 09:16:33
"""
print('αβγδεζηθ') |
class BlazingException(Exception):
def __init__(self, http_status_code: int, message: str):
super(BlazingException, self).__init__(message)
self.message: str = message
self.status_code: int = http_status_code
def __str__(self):
message = "Message: %s. Status Code: %s" % (self.m... | class Blazingexception(Exception):
def __init__(self, http_status_code: int, message: str):
super(BlazingException, self).__init__(message)
self.message: str = message
self.status_code: int = http_status_code
def __str__(self):
message = 'Message: %s. Status Code: %s' % (self.m... |
physconst = {
"h" : 6.62606896E-34, # The Planck constant (Js)
"c" : 2.99792458E8, # Speed of light (ms$^{-1}$)
"kb" : 1.3806504E-23, # The Boltzmann constant (JK$^{-1}$)
"R" ... | physconst = {'h': 6.62606896e-34, 'c': 299792458.0, 'kb': 1.3806504e-23, 'R': 8.314472, 'bohr2angstroms': 0.52917720859, 'bohr2m': 5.2917720859e-11, 'bohr2cm': 5.2917720859e-09, 'amu2g': 1.660538782e-24, 'amu2kg': 1.660538782e-27, 'au2amu': 0.0005485799097, 'hartree2J': 4.359744e-18, 'hartree2aJ': 4.359744, 'cal2J': 4.... |
# DEBUG
DEBUG = True
# DJANGO SECRET KEY
SECRET_KEY = 'xh=yw8#%ob65a@ijq=2r41(6#8*ghhk7an)bcupk6ifd42bid+'
# ALLOWED HOSTS
ALLOWED_HOSTS = []
# DBS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'db',
'USER': 'root',
'PASSWORD': 'secret',
'HOST': ... | debug = True
secret_key = 'xh=yw8#%ob65a@ijq=2r41(6#8*ghhk7an)bcupk6ifd42bid+'
allowed_hosts = []
databases = {'default': {'ENGINE': 'django.db.backends.mysql', 'NAME': 'db', 'USER': 'root', 'PASSWORD': 'secret', 'HOST': 'localhost', 'PORT': '3306'}} |
"""
File for representing argus-specific exceptions.
"""
class ArgusException(Exception):
"""
Exception class for the Argus application
"""
pass
class ImageLoadException(ArgusException):
"""
Exception raised when an image file could not be loaded
"""
pass
class InvalidQueryExceptio... | """
File for representing argus-specific exceptions.
"""
class Argusexception(Exception):
"""
Exception class for the Argus application
"""
pass
class Imageloadexception(ArgusException):
"""
Exception raised when an image file could not be loaded
"""
pass
class Invalidqueryexception(A... |
# b 0
# f 1
# l 0
# r 1
def part1(data):
return max(get_seats(data))
def get_seats(data):
seats = []
for line in data:
row = line[:7].replace('B', '1').replace('F', '0')
col = line[7:].replace('L', '0').replace('R', '1')
seats.append(int(row, 2) * 8 + int(col, 2))
return s... | def part1(data):
return max(get_seats(data))
def get_seats(data):
seats = []
for line in data:
row = line[:7].replace('B', '1').replace('F', '0')
col = line[7:].replace('L', '0').replace('R', '1')
seats.append(int(row, 2) * 8 + int(col, 2))
return sorted(seats)
def part2(data):... |
for val in "string":
if val == "i":
break
print(val)
print()
for val in range(1,10):
if val == 5:
break
print(val)
| for val in 'string':
if val == 'i':
break
print(val)
print()
for val in range(1, 10):
if val == 5:
break
print(val) |
def base_logic(login_generator, password_generator, query):
login = login_generator.generate()
if login is None:return
while True:
password = password_generator.generate()
if password is None:return
if query(login, password):
print('Success',login,password)
... | def base_logic(login_generator, password_generator, query):
login = login_generator.generate()
if login is None:
return
while True:
password = password_generator.generate()
if password is None:
return
if query(login, password):
print('Success', login, ... |
# Copyright (c) 2020 Kirill Snezhko
# 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, publish, distr... | """Module for storin urls and payloads fro different requests"""
urls = {'login_xiaomi': 'https://account.xiaomi.com/oauth2/authorize?skip_confirm=false&client_id=2882303761517383915&pt=0&scope=1+6000+16001+20000&redirect_uri=https%3A%2F%2Fhm.xiaomi.com%2Fwatch.do&_locale=en_US&response_type=code', 'tokens_amazfit': 'h... |
class Solution:
def shortestPalindrome(self, s: str) -> str:
double = s + '*' + s[::-1]
lps = self.longestPrefixString(double)
index = lps[-1]
return s[index: ][::-1] + s
def longestPrefixString(self, s):
lps = [0] * len(s)
i, j = 0, 1
while ... | class Solution:
def shortest_palindrome(self, s: str) -> str:
double = s + '*' + s[::-1]
lps = self.longestPrefixString(double)
index = lps[-1]
return s[index:][::-1] + s
def longest_prefix_string(self, s):
lps = [0] * len(s)
(i, j) = (0, 1)
while j < le... |
class SummonerModel:
def __init__(self, dbRow):
self.ID = dbRow["ID"]
self.User = dbRow["User"]
self.SummonerName = dbRow["SummonerName"]
self.SummonerID = dbRow["SummonerID"]
self.Shadow = dbRow["Shadow"]
self.Region = dbRow["Region"]
self.Timestamp = dbRow["Timestamp"] | class Summonermodel:
def __init__(self, dbRow):
self.ID = dbRow['ID']
self.User = dbRow['User']
self.SummonerName = dbRow['SummonerName']
self.SummonerID = dbRow['SummonerID']
self.Shadow = dbRow['Shadow']
self.Region = dbRow['Region']
self.Timestamp = dbRow[... |
#ml = [1, 2, 3, 4, 5, 6]
for num in range(10): # generators
print(num)
for num in range(0, 10, 2):
print(num)
index_count = 0
for letter in 'abcde':
print('At index {} the letter is {}'.format(index_count, letter))
index_count += 1
print(list(range(0, 11, 2)))
index_count = 0
word = 'abcdefg'
for ... | for num in range(10):
print(num)
for num in range(0, 10, 2):
print(num)
index_count = 0
for letter in 'abcde':
print('At index {} the letter is {}'.format(index_count, letter))
index_count += 1
print(list(range(0, 11, 2)))
index_count = 0
word = 'abcdefg'
for letter in word:
print(word[index_count])... |
#
# PySNMP MIB module NOKIA-UNITTYPES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NOKIA-UNITTYPES-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:13:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_intersection, constraints_union, single_value_constraint) ... |
names = [ 'Noah', 'Liam', 'Mason', 'Jacob', 'William', 'Ethan', 'Michael', 'Alexander' ]
surnames = [ 'Smith', 'Johnson', 'Williams', 'Jones', 'Brown', 'Davis', 'Miller', 'Wilson' ]
streets_num = [ '357', '173', '543', '731', '276', '851', '624', '932' ]
streets = [ 'Fulton St', 'Park Avenue', 'Lafayette Avenue', 'D... | names = ['Noah', 'Liam', 'Mason', 'Jacob', 'William', 'Ethan', 'Michael', 'Alexander']
surnames = ['Smith', 'Johnson', 'Williams', 'Jones', 'Brown', 'Davis', 'Miller', 'Wilson']
streets_num = ['357', '173', '543', '731', '276', '851', '624', '932']
streets = ['Fulton St', 'Park Avenue', 'Lafayette Avenue', 'Dyer Avenue... |
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
def parse_instruction(instruction):
return instruction.split(' ')
class Program:
def __init__(self, program):
self.registers = {}
self.line = 0
self.program = program
self.commands = {'mo... | def is_number(s):
try:
float(s)
return True
except ValueError:
return False
def parse_instruction(instruction):
return instruction.split(' ')
class Program:
def __init__(self, program):
self.registers = {}
self.line = 0
self.program = program
se... |
class Solution:
def multiply(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
value = [0]*(len(num1)+len(num2))
for i in range(len(num1)-1, -1, -1):
for j in range(len(num2)-1, -1, -1):
value[i+j+1] += int(n... | class Solution:
def multiply(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
value = [0] * (len(num1) + len(num2))
for i in range(len(num1) - 1, -1, -1):
for j in range(len(num2) - 1, -1, -1):
value[i + j + 1... |
f2 = lambda x: (lambda : lambda y: x + y)()
inc = f2(1)
plus10 = f2(10)
___assertEqual(inc(1), 2)
___assertEqual(plus10(5), 15)
| f2 = lambda x: (lambda : lambda y: x + y)()
inc = f2(1)
plus10 = f2(10)
___assert_equal(inc(1), 2)
___assert_equal(plus10(5), 15) |
def encode(value_to_encode):
"""
Bencodes python value to binary string
:param value_to_encode: int, string, list or dict
:return: Bencoded `value_to_encode`
:raise: ValueError if the provided value cannot be encoded
"""
try:
return _encode_value(value_to_encode)
except Excepti... | def encode(value_to_encode):
"""
Bencodes python value to binary string
:param value_to_encode: int, string, list or dict
:return: Bencoded `value_to_encode`
:raise: ValueError if the provided value cannot be encoded
"""
try:
return _encode_value(value_to_encode)
except Exceptio... |
"""
File: anagram.py
Name:
----------------------------------
This program recursively finds all the anagram(s)
for the word input by user and terminates when the
input string matches the EXIT constant defined
at line 19
If you correctly implement this program, you should see the
number of anagrams for each word liste... | """
File: anagram.py
Name:
----------------------------------
This program recursively finds all the anagram(s)
for the word input by user and terminates when the
input string matches the EXIT constant defined
at line 19
If you correctly implement this program, you should see the
number of anagrams for each word liste... |
def staircase(n):
for index in range(1, n+1):
print(" " * (n-index) + "#" * index)
| def staircase(n):
for index in range(1, n + 1):
print(' ' * (n - index) + '#' * index) |
#!/usr/bin/env python
def check_connected(device):
return(device.connected)
| def check_connected(device):
return device.connected |
class Deactivated(Exception):
pass
class NotApplicable(Exception):
pass
class NotUniqueError(Exception):
pass
| class Deactivated(Exception):
pass
class Notapplicable(Exception):
pass
class Notuniqueerror(Exception):
pass |
# -*- coding: utf-8 -*-
"""
@author: salimt
"""
def getGuessedWord(secretWord, lettersGuessed):
'''
secretWord: string, the word the user is guessing
lettersGuessed: list, what letters have been guessed so far
returns: string, comprised of letters and underscores that represents
what le... | """
@author: salimt
"""
def get_guessed_word(secretWord, lettersGuessed):
"""
secretWord: string, the word the user is guessing
lettersGuessed: list, what letters have been guessed so far
returns: string, comprised of letters and underscores that represents
what letters in secretWord have been gu... |
"""
Binary search
-------------
- Worst time complexity: O(log n); The half-ing of the list on each iteration follows a log n of the number
of elements progression (log x is assumed to be log base 2).
- a search strategy used to find elements within an ordered list of items
- by consistently reducing the amount of data... | """
Binary search
-------------
- Worst time complexity: O(log n); The half-ing of the list on each iteration follows a log n of the number
of elements progression (log x is assumed to be log base 2).
- a search strategy used to find elements within an ordered list of items
- by consistently reducing the amount of data... |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Coupon_validity, obj[4]: Gender, obj[5]: Age, obj[6]: Children, obj[7]: Education, obj[8]: Occupation, obj[9]: Income, obj[10]: Bar, obj[11]: Coffeehouse, obj[12]: Restaurant20to50, obj[13]: Direction_same, obj[14]: Distance
# {"feature":... | def find_decision(obj):
if obj[7] <= 3:
if obj[2] > 1:
if obj[5] <= 2:
if obj[8] <= 14:
if obj[0] <= 2:
return 'True'
elif obj[0] > 2:
if obj[1] <= 2:
return 'False... |
# Copyright (c) 2016-2017 Dustin Doloff
# Licensed under Apache License v2.0
load(
"@bazel_toolbox//labels:labels.bzl",
"executable_label",
)
load(
"@io_bazel_rules_sass//sass:sass.bzl",
"sass_binary",
)
def _assert_descending_sizes_impl(ctx):
ctx.actions.run(
mnemonic = "AssertingFilesOfD... | load('@bazel_toolbox//labels:labels.bzl', 'executable_label')
load('@io_bazel_rules_sass//sass:sass.bzl', 'sass_binary')
def _assert_descending_sizes_impl(ctx):
ctx.actions.run(mnemonic='AssertingFilesOfDescendingSizes', arguments=['--stamp', ctx.outputs.stamp_file.path] + ['--files'] + [file.path for file in ctx.... |
MIN_BRANCH_ROTATION = 3
NUM_TRIES = 100
BRANCH_RATIO_FACTOR = 0.5
NEW_BRANCH_RATIO_FACTOR = 0.7
NUM_SIDES_FACTOR = 0.05
BRANCH_MIN_THICKNESS = 0.05 | min_branch_rotation = 3
num_tries = 100
branch_ratio_factor = 0.5
new_branch_ratio_factor = 0.7
num_sides_factor = 0.05
branch_min_thickness = 0.05 |
# class Solution:
# def fibonacci(self, n):
# a = 0
# b = 1
# for i in range(n - 1):
# a, b = b, a + b
# return a
# if __name__ == "__main__":
# so = Solution()
# print(so.fibonacci(100))
class Solution:
def fibonacci(self, n):
a,b = 0,1
num ... | class Solution:
def fibonacci(self, n):
(a, b) = (0, 1)
num = 1
while num < n:
(a, b) = (b, a + b)
num += 1
return a
if __name__ == '__main__':
so = solution()
print(so.fibonacci(100)) |
class Solution:
def gameOfLife(self, board: List[List[int]]) -> None:
"""
Do not return anything, modify board in-place instead.
"""
# 0,2 - dead, dead->live
# 1,3 - live, live->dead
def neighbors(r,c):
for nr, nc in ((r,c-1), (r,c+1),(r-1,c),(r+1... | class Solution:
def game_of_life(self, board: List[List[int]]) -> None:
"""
Do not return anything, modify board in-place instead.
"""
def neighbors(r, c):
for (nr, nc) in ((r, c - 1), (r, c + 1), (r - 1, c), (r + 1, c), (r - 1, c - 1), (r + 1, c + 1), (r - 1, c + 1), (... |
trp_player = 0
trp_multiplayer_profile_troop_male = 1
trp_multiplayer_profile_troop_female = 2
trp_temp_troop = 3
trp_temp_array_a = 4
trp_multiplayer_data = 5
trp_british_infantry_ai = 6
trp_british_infantry2_ai = 7
trp_british_highlander_ai = 8
trp_british_foot_guard_ai = 9
trp_british_light_infantry_ai = 10
trp_brit... | trp_player = 0
trp_multiplayer_profile_troop_male = 1
trp_multiplayer_profile_troop_female = 2
trp_temp_troop = 3
trp_temp_array_a = 4
trp_multiplayer_data = 5
trp_british_infantry_ai = 6
trp_british_infantry2_ai = 7
trp_british_highlander_ai = 8
trp_british_foot_guard_ai = 9
trp_british_light_infantry_ai = 10
trp_brit... |
class IdentifierSeparator():
identifier_name = None
def __init__(self, identifier_name):
self.identifier_name = identifier_name
def get_separated_identifier(self):
separated_word: str = self.identifier_name
last_char = separated_word[0]
index = 1
while index <... | class Identifierseparator:
identifier_name = None
def __init__(self, identifier_name):
self.identifier_name = identifier_name
def get_separated_identifier(self):
separated_word: str = self.identifier_name
last_char = separated_word[0]
index = 1
while index < len(sep... |
# Basket settings
OSCAR_BASKET_COOKIE_LIFETIME = 7*24*60*60
OSCAR_BASKET_COOKIE_OPEN = 'oscar_open_basket'
OSCAR_BASKET_COOKIE_SAVED = 'oscar_saved_basket'
# Currency
OSCAR_DEFAULT_CURRENCY = 'GBP'
# Max number of products to keep on the user's history
OSCAR_RECENTLY_VIEWED_PRODUCTS = 4
# Image paths
OSCAR_IMAGE_FOL... | oscar_basket_cookie_lifetime = 7 * 24 * 60 * 60
oscar_basket_cookie_open = 'oscar_open_basket'
oscar_basket_cookie_saved = 'oscar_saved_basket'
oscar_default_currency = 'GBP'
oscar_recently_viewed_products = 4
oscar_image_folder = 'images/products/%Y/%m/'
oscar_promotion_folder = 'images/promotions/'
oscar_search_sugge... |
# PROBLEM 1: Shortest Word
# Given a string of words, return the length of the shortest word(s).
def find_short(sentence):
# your code here
sentence = sentence.split()
shortest = len(sentence[0])
for word in sentence:
if len(word) < shortest:
shortest = len(word)
print('shortest'... | def find_short(sentence):
sentence = sentence.split()
shortest = len(sentence[0])
for word in sentence:
if len(word) < shortest:
shortest = len(word)
print('shortest', shortest)
return shortest
def find_short(s):
return min((len(x) for x in s.split()))
def xo(s):
s = s.... |
class Solution:
def XXX(self, n):
"""
:type n: int
:rtype: int
"""
if n <= 2:
return n
a = 1
b = 2
for i in range(2, n):
c = a + b
a = b
b = c
return c
| class Solution:
def xxx(self, n):
"""
:type n: int
:rtype: int
"""
if n <= 2:
return n
a = 1
b = 2
for i in range(2, n):
c = a + b
a = b
b = c
return c |
def main(j, args, params, tags, tasklet):
page = args.page
page.addMessage(str(params.requestContext.params))
page.addMessage("this is a test macro tasklet")
# use the page object to add content to the page
# play with it you can debug in this tasklet
# use
#from pylabs.Shell import ipsh... | def main(j, args, params, tags, tasklet):
page = args.page
page.addMessage(str(params.requestContext.params))
page.addMessage('this is a test macro tasklet')
return params
def match(j, args, params, tags, tasklet):
return True |
# view definition
view = {
'view_name' : 'cb_trans',
'module_id' : 'cb',
'short_descr' : 'Cb transactions',
'long_descr' : 'Cb transactions',
'base_tables' : ['cb_tran_rec', 'cb_tran_pmt', 'cb_tran_tfr_out', 'cb_tran_tfr_in'],
'path_to_row' : [
'tran_type', {
... | view = {'view_name': 'cb_trans', 'module_id': 'cb', 'short_descr': 'Cb transactions', 'long_descr': 'Cb transactions', 'base_tables': ['cb_tran_rec', 'cb_tran_pmt', 'cb_tran_tfr_out', 'cb_tran_tfr_in'], 'path_to_row': ['tran_type', {'cb_rec': ('cb_tran_rec', 'row_id', 'tran_row_id', 'cb_receipt'), 'cb_pmt': ('cb_tran_p... |
"""Global constants for the AgavePy package
"""
__all__ = [
'PLATFORM', 'BASE_URL', 'SESSION_CACHE_DIRS', 'CACHE_FILENAME',
'SESSIONS_FILENAME', 'AGPY_FILENAME', 'ENV_USERNAME', 'ENV_PASSWORD',
'ENV_TOKEN', 'ENV_REFRESH_TOKEN', 'ENV_BASE_URL', 'ENV_API_KEY',
'ENV_API_SECRET', 'ENV_TENANT_ID', 'TOKEN_SCO... | """Global constants for the AgavePy package
"""
__all__ = ['PLATFORM', 'BASE_URL', 'SESSION_CACHE_DIRS', 'CACHE_FILENAME', 'SESSIONS_FILENAME', 'AGPY_FILENAME', 'ENV_USERNAME', 'ENV_PASSWORD', 'ENV_TOKEN', 'ENV_REFRESH_TOKEN', 'ENV_BASE_URL', 'ENV_API_KEY', 'ENV_API_SECRET', 'ENV_TENANT_ID', 'TOKEN_SCOPE', 'TOKEN_TTL',... |
class parent:
def __init__(self):
self.y=40
self.x=50
def update(self):
print(self.y)
class child(parent):
def __init__(self):
parent.__init__(self)
# def update(self):
# print(self.x)
c=child()
c.update()
| class Parent:
def __init__(self):
self.y = 40
self.x = 50
def update(self):
print(self.y)
class Child(parent):
def __init__(self):
parent.__init__(self)
c = child()
c.update() |
DEBUG = True
CELERY_ALWAYS_EAGER = True
DATABASES = {
'default': {
'ENGINE': 'giscube.db.backends.postgis',
'NAME': os.environ.get('TEST_DB_NAME', 'test'),
'USER': os.environ.get('TEST_DB_USER', 'admin'),
'PASSWORD': os.environ.get('TEST_DB_PASSWORD', 'admin'),
'HOST': os.e... | debug = True
celery_always_eager = True
databases = {'default': {'ENGINE': 'giscube.db.backends.postgis', 'NAME': os.environ.get('TEST_DB_NAME', 'test'), 'USER': os.environ.get('TEST_DB_USER', 'admin'), 'PASSWORD': os.environ.get('TEST_DB_PASSWORD', 'admin'), 'HOST': os.environ.get('TEST_DB_HOST', 'localhost'), 'PORT':... |
def generate_hex(content):
begin = "unsigned char game["+str(len(content))+"] = {"
middle = ""
end = " };"
for byte in content:
middle = middle + str(hex(byte))+","
final = begin+middle+end
print(final)
def open_file(file_path):
try:
f = open(file_path,"rb")
con... | def generate_hex(content):
begin = 'unsigned char game[' + str(len(content)) + '] = {'
middle = ''
end = ' };'
for byte in content:
middle = middle + str(hex(byte)) + ','
final = begin + middle + end
print(final)
def open_file(file_path):
try:
f = open(file_path, 'rb')
... |
def phone_home():
s = """
.;''-.
.' | `._
/` ; `'.
.' \\ \\
,'\\| `| |
| -'_ \ `'.__,J
;' `. `'.__.'
| `"-.___ ,'
'-, /
|.-`-.______-|
} __.--'L
; _,- _.-"`\ ___
`7-;" ' _,,--._ ,-'`__ `.
... | def phone_home():
s = '\n .;\'\'-.\n .\' | `._\n /` ; `\'.\n .\' \\ \\\n ,\'\\| `| |\n | -\'_ \\ `\'.__,J\n ;\' `. `\'.__.\'\n | `"-.___ ,\'\n \'-, /\n |.-`-.______-|\n } __.--\'L\n ; _,- _.-"`\\ ___\n `7-;" \' _,,--._ ... |
class Station(object):
'''
classdocs
'''
def __init__(self):
self.platformNameSet = set()
#note: this is for convenience only
| class Station(object):
"""
classdocs
"""
def __init__(self):
self.platformNameSet = set() |
class PyNFTException(Exception):
def __init__(self, rc, obj, msg):
self.rc = rc
self.obj = obj
self.msg = msg | class Pynftexception(Exception):
def __init__(self, rc, obj, msg):
self.rc = rc
self.obj = obj
self.msg = msg |
"""
@file
@brief `vis.js <https://github.com/almende/vis>`_
The script was obtained from the
`release page <https://github.com/almende/vis/tree/master/dist>`_.
"""
def version():
"version"
return "4.21.1"
| """
@file
@brief `vis.js <https://github.com/almende/vis>`_
The script was obtained from the
`release page <https://github.com/almende/vis/tree/master/dist>`_.
"""
def version():
"""version"""
return '4.21.1' |
def count_letters(id=''):
# chars = id.split('')
counts = {}
for char in id:
if char in counts:
counts[char] = counts[char] + 1
else:
counts[char] = 1
# print('id = {}, counts = {}'.format(id, counts))
return counts
f = open('input.txt', 'r')
ids = [line.st... | def count_letters(id=''):
counts = {}
for char in id:
if char in counts:
counts[char] = counts[char] + 1
else:
counts[char] = 1
return counts
f = open('input.txt', 'r')
ids = [line.strip() for line in f]
f.close()
letter_counts = [count_letters(id) for id in ids]
twos... |
Contents = """
POS MV V5 User Interface Control Document
Document # : PUBS-ICD-004089 Revision: 10 Date: 23 August 2017
The information contained herein is proprietary to Applanix corporation. Release to third parties of this publication or of information contained herein is prohibited without the prior written conse... | contents = '\nPOS MV V5 User Interface Control Document \nDocument # : PUBS-ICD-004089 Revision: 10 Date: 23 August 2017 \nThe information contained herein is proprietary to Applanix corporation. Release to third parties of this publication or of information contained herein is prohibited without the prior written cons... |
#
# PySNMP MIB module APPN-DLUR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APPN-DLUR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:24:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (sna_control_point_name,) = mibBuilder.importSymbols('APPN-MIB', 'SnaControlPointName')
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, valu... |
def add(x, y):
"""adds two numbers"""
return x+y
def subtract(x,y):
"""subtract x from y andreturn value"""
return y-x
| def add(x, y):
"""adds two numbers"""
return x + y
def subtract(x, y):
"""subtract x from y andreturn value"""
return y - x |
class ExtractedNoti:
def __init__(self, title, date, href):
self.title = title
self.date = date
self.href = href
class ExtractedNotiList:
def __init__(self):
self.numOfNoti = 0
self.category = ''
self.extractedNotiList = []
| class Extractednoti:
def __init__(self, title, date, href):
self.title = title
self.date = date
self.href = href
class Extractednotilist:
def __init__(self):
self.numOfNoti = 0
self.category = ''
self.extractedNotiList = [] |
#!python3
def main():
with open('16.txt', 'r') as f, open('16_out.txt', 'w') as f_out:
line = f.readline()
dance_moves = line.strip().split(',')
letters = [chr(c) for c in range(97, 113)]
# Part 1
programs = letters.copy()
# programs = ['a', 'b', 'c', 'd', 'e']
... | def main():
with open('16.txt', 'r') as f, open('16_out.txt', 'w') as f_out:
line = f.readline()
dance_moves = line.strip().split(',')
letters = [chr(c) for c in range(97, 113)]
programs = letters.copy()
for move in dance_moves:
if move[0] == 's':
... |
# https://leetcode.com/problems/nim-game/
#
# algorithms
# Medium (55.8%)
# Total Accepted: 189,849
# Total Submissions: 340,261
class Solution(object):
def canWinNim(self, n):
"""
:type n: int
:rtype: bool
"""
if n % 4 == 0:
return False
return True... | class Solution(object):
def can_win_nim(self, n):
"""
:type n: int
:rtype: bool
"""
if n % 4 == 0:
return False
return True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.