content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""Test BLUETOOTH hardware
Send .wav file over bluetooth
"""
# TODO
| """Test BLUETOOTH hardware
Send .wav file over bluetooth
""" |
"""
Copyright 2014 Sotera Defense Solutions, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... | """
Copyright 2014 Sotera Defense Solutions, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... |
"""
Examples illustrating the asyncio engine feature of SQLAlchemy.
.. autosource::
"""
| """
Examples illustrating the asyncio engine feature of SQLAlchemy.
.. autosource::
""" |
#
# PySNMP MIB module DHCPCLIENT-PRIVATE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DHCPCLIENT-PRIVATE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:46:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, single_value_constraint, constraints_intersection) ... |
FILENAME = "input.txt"
def get_input() -> list[tuple[int, int]]:
vector_list = list()
with open(FILENAME) as file:
for line in file.readlines():
direction, unit = line.split()
unit = int(unit)
if direction == "forward":
vector = (unit, 0)
... | filename = 'input.txt'
def get_input() -> list[tuple[int, int]]:
vector_list = list()
with open(FILENAME) as file:
for line in file.readlines():
(direction, unit) = line.split()
unit = int(unit)
if direction == 'forward':
vector = (unit, 0)
... |
#use classes to define new types
#constructor is called at the time of creating an oject
class Point:
def __init__(self, x, y): #this is the "constructor" that gets called when a new object is created
self.x = x # "self" is a reference to the current object. And x and y are attribute... | class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def move(self):
print('move')
def draw(self):
print('draw')
point1 = point(10, 20)
print(point1.x)
point1.x = 11
print(point1.x)
class Person:
def __init__(self, name):
self.name = name
def tal... |
#encoding:utf-8
subreddit = 'PoliticalHumor+PoliticalCompassMemes'
t_channel = '@r_PoliticalMemes'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'PoliticalHumor+PoliticalCompassMemes'
t_channel = '@r_PoliticalMemes'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
class Tokenizer():
def __init__(self, go):
# add GO terms in the tokenizer
self.go = go
self.terms = sorted(list(set(go.ont.keys())))
self.vocab_sz = len(self.terms)
# zero is padding
self.term2index = dict(
[(term, i) for i, term in enumerate(self.terms)])
... | class Tokenizer:
def __init__(self, go):
self.go = go
self.terms = sorted(list(set(go.ont.keys())))
self.vocab_sz = len(self.terms)
self.term2index = dict([(term, i) for (i, term) in enumerate(self.terms)])
self.index2term = dict([(i, term) for (i, term) in enumerate(self.te... |
# Copyright 2018 Google 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 applicable law or a... | """ This template creates an IP address. """
def get_address_type(ip_type):
""" Return the address type to reserve. """
if ip_type in ['GLOBAL', 'REGIONAL']:
return 'EXTERNAL'
return 'INTERNAL'
def get_resource_type(ip_type):
""" Return the address resource type. """
if ip_type == 'GLOBAL'... |
# Memo used to store computed Fibonacci values
memo = {0: 0, 1: 1}
def fibonacci_memoized(n):
"""
Returns the Fibonacci number at the nth index in the Fibonacci sequence
Time complexity: O(n)
Space complexity: O(n)
More efficient, uses a memo to store calculated values, avoiding redundant operatio... | memo = {0: 0, 1: 1}
def fibonacci_memoized(n):
"""
Returns the Fibonacci number at the nth index in the Fibonacci sequence
Time complexity: O(n)
Space complexity: O(n)
More efficient, uses a memo to store calculated values, avoiding redundant operations
"""
assert n >= 0, f'Input value {n} is not a pos... |
def production():
"Primes the deployment procedure to execute against production."
config.fab_hosts = ['localhost']
def staging():
"Primes the deployment procedure to execute against staging."
config.fab_hosts = ['127.0.0.1']
def build():
"Compiles, builds and packages our project locally."
l... | def production():
"""Primes the deployment procedure to execute against production."""
config.fab_hosts = ['localhost']
def staging():
"""Primes the deployment procedure to execute against staging."""
config.fab_hosts = ['127.0.0.1']
def build():
"""Compiles, builds and packages our project locall... |
BASE_PATH = 'assets/file_extension_imgs/'
FILE_EXTENSIONS = {
'c': {
'path': BASE_PATH + 'c.png',
'classification': 'backend'
},
'css': {
'path': BASE_PATH + 'css.png',
'classification': 'frontend'
},
'csv': {
'path': BASE_PATH + 'csv.png',
'classific... | base_path = 'assets/file_extension_imgs/'
file_extensions = {'c': {'path': BASE_PATH + 'c.png', 'classification': 'backend'}, 'css': {'path': BASE_PATH + 'css.png', 'classification': 'frontend'}, 'csv': {'path': BASE_PATH + 'csv.png', 'classification': 'config'}, 'd': {'path': BASE_PATH + 'd.png', 'classification': 'ba... |
__all__ = ['Node']
class Node:
def __init__(self, operator, attributes, inputs, outputs, scope):
self.operator = operator
self.attributes = attributes
self.inputs = inputs
self.outputs = outputs
self.scope = scope
@property
def operator(self):
return self._... | __all__ = ['Node']
class Node:
def __init__(self, operator, attributes, inputs, outputs, scope):
self.operator = operator
self.attributes = attributes
self.inputs = inputs
self.outputs = outputs
self.scope = scope
@property
def operator(self):
return self._... |
#
# @lc app=leetcode id=21 lang=python3
#
# [21] Merge Two Sorted Lists
#
# https://leetcode.com/problems/merge-two-sorted-lists/description/
#
# algorithms
# Easy (49.92%)
# Likes: 2925
# Dislikes: 423
# Total Accepted: 751.7K
# Total Submissions: 1.5M
# Testcase Example: '[1,2,4]\n[1,3,4]'
#
# Merge two sorted... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
if l1 is None:
return l2
elif l2 is None:
return l1
if l1.val < l2.val:
head = li... |
# Returns a valid response when request's |referrer| matches
# |expected_referrer|.
def main(request, response):
referrer = request.headers.get("referer", "")
expected_referrer = request.GET.first("expected_referrer", "")
response_headers = [("Content-Type", "text/javascript"),
("Ac... | def main(request, response):
referrer = request.headers.get('referer', '')
expected_referrer = request.GET.first('expected_referrer', '')
response_headers = [('Content-Type', 'text/javascript'), ('Access-Control-Allow-Origin', '*')]
if expected_referrer != '' and referrer.startswith(expected_referrer + ... |
C4R_HOST = 'cloud4rpi.io'
C4R_TOKEN = '__YOUR_DEVICE_TOKEN__'
NOTIFICATION_HOOK_URL = '__YOUR_HOOK_URL__'
# GPIO Pins (BCM)
GPIO_PUMP = 4
GPIO_TRIGGER = 17
GPIO_ECHO = 27
# Distance from the sensor to the water level
# based on the coffee-machine's water tank
MIN_DISTANCE = 2 # cm
MAX_DISTANCE = 8 # cm
# Conside... | c4_r_host = 'cloud4rpi.io'
c4_r_token = '__YOUR_DEVICE_TOKEN__'
notification_hook_url = '__YOUR_HOOK_URL__'
gpio_pump = 4
gpio_trigger = 17
gpio_echo = 27
min_distance = 2
max_distance = 8
stop_pump_distance = 3
distance_delta = 0.4
sensor_error = 1
no_water_error = 2 |
# (C) Datadog, Inc. 2019
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
HISTOGRAM_METRICS = {'mapr.db.table.latency'}
COUNT_METRICS = {
'mapr.cache.lookups_data',
'mapr.cache.lookups_dir',
'mapr.cache.lookups_inode',
'mapr.cache.lookups_largefile',
'mapr.cache.lo... | histogram_metrics = {'mapr.db.table.latency'}
count_metrics = {'mapr.cache.lookups_data', 'mapr.cache.lookups_dir', 'mapr.cache.lookups_inode', 'mapr.cache.lookups_largefile', 'mapr.cache.lookups_meta', 'mapr.cache.lookups_smallfile', 'mapr.cache.lookups_table', 'mapr.cache.misses_data', 'mapr.cache.misses_dir', 'mapr.... |
#!/usr/bin/env python
class Solution(object):
def _count(self, string):
"""
Returns a dictionary of characters counts in the string.
"""
count = dict()
for c in string:
if c not in count:
count[c] = 0
count[c] += 1
return coun... | class Solution(object):
def _count(self, string):
"""
Returns a dictionary of characters counts in the string.
"""
count = dict()
for c in string:
if c not in count:
count[c] = 0
count[c] += 1
return count
def min_window(s... |
def find_and_sum_multiples(maximum, number1, number2=None):
if type(maximum) is not int or type(number1) is not int:
raise TypeError("All parameters should be integers.")
if number1 < 1:
raise ValueError("The second parameter should be an integer with value 1 or higher.")
if maximum < num... | def find_and_sum_multiples(maximum, number1, number2=None):
if type(maximum) is not int or type(number1) is not int:
raise type_error('All parameters should be integers.')
if number1 < 1:
raise value_error('The second parameter should be an integer with value 1 or higher.')
if maximum < numb... |
'''
Source : https://leetcode.com/problems/largest-number-at-least-twice-of-others/
Author : Yuan Wang
Date : 2018-06-13
/**********************************************************************************
In a given integer array nums, there is always exactly one largest element.
Find whether the largest element in... | """
Source : https://leetcode.com/problems/largest-number-at-least-twice-of-others/
Author : Yuan Wang
Date : 2018-06-13
/**********************************************************************************
In a given integer array nums, there is always exactly one largest element.
Find whether the largest element in... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 29 11:11:54 2022
@author: leoda
"""
class Polynomial():
def __init__(self, coeffs=[]):
self.__coefficients = coeffs
self.check_zeros()
# properties and setters
@property
def coefficients(self):
return self.__coefficients
@co... | """
Created on Sat Jan 29 11:11:54 2022
@author: leoda
"""
class Polynomial:
def __init__(self, coeffs=[]):
self.__coefficients = coeffs
self.check_zeros()
@property
def coefficients(self):
return self.__coefficients
@coefficients.setter
def coefficients(self, value):
... |
class ClasseSimples:
contador = 0
def __init__(self):
self.contar()
@classmethod
def contar(cls):
cls.contador += 1
if __name__ == '__main__':
lista = [ClasseSimples(), ClasseSimples()]
print(ClasseSimples.contador) | class Classesimples:
contador = 0
def __init__(self):
self.contar()
@classmethod
def contar(cls):
cls.contador += 1
if __name__ == '__main__':
lista = [classe_simples(), classe_simples()]
print(ClasseSimples.contador) |
# -*- coding: utf-8 -*-
'''
File name: code\square_subsets\sol_619.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #619 :: Square subsets
#
# For more information see:
# https://projecteuler.net/problem=619
# Problem Statement
'''
For a... | """
File name: code\\square_subsets\\sol_619.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
"""
'\nFor a set of positive integers $\\{a, a+1, a+2, \\dots , b\\}$, let $C(a,b)$ be the number of non-empty subsets in which the product of all elements is a perfect square.\nFor exampl... |
# -*- coding: utf-8 -*-
{
'name': "Bugs Management System",
'summary': """
The Purpose of this module is management of Bugs in Project""",
'description': """
Organize and schedule your Bugs
""",
'author': "Whiz IT Services",
'website': "http://www.whizit.co.in",
# Categor... | {'name': 'Bugs Management System', 'summary': '\n The Purpose of this module is management of Bugs in Project', 'description': '\n Organize and schedule your Bugs\n ', 'author': 'Whiz IT Services', 'website': 'http://www.whizit.co.in', 'category': 'Project', 'version': '12.1', 'depends': ['base', 'proj... |
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
""... | """Commands related to Service Fabric Node commands for node tagging"""
def add_node_tags(client, node_name, tags):
"""Add the corresponding tags to a node"""
client.add_node_tags(node_name, tags.split(','))
def remove_node_tags(client, node_name, tags):
"""remove the corresponding tags to a node"""
c... |
# -*- coding: utf-8 -*-
# noinspection PyUnusedLocal
def test(empty_database, create_and_delete_user, create_login_session, create_user_contact):
pass
| def test(empty_database, create_and_delete_user, create_login_session, create_user_contact):
pass |
n = int(input())
my_list = [[1, 2] for _ in range(n)]
print(my_list)
| n = int(input())
my_list = [[1, 2] for _ in range(n)]
print(my_list) |
class Claim:
def __init__(self, claim_type: str, value):
self.type = claim_type
self.value = value
class ClaimsIdentity:
def __init__(self, claims: dict, is_authenticated: bool):
self.claims = claims
self.is_authenticated = is_authenticated
def get_claim_value(self, claim_... | class Claim:
def __init__(self, claim_type: str, value):
self.type = claim_type
self.value = value
class Claimsidentity:
def __init__(self, claims: dict, is_authenticated: bool):
self.claims = claims
self.is_authenticated = is_authenticated
def get_claim_value(self, claim... |
def calculate_result(string, number): # Ab, AB, aB, ab
number = int(number)
if string[0].isupper() and string[1].islower():
aa = string[0].lower()
bb = string[1].lower()
res = number / int((alphabet.index(aa))) + int((alphabet.index(bb))) # Ab (number / a position) + b position)
... | def calculate_result(string, number):
number = int(number)
if string[0].isupper() and string[1].islower():
aa = string[0].lower()
bb = string[1].lower()
res = number / int(alphabet.index(aa)) + int(alphabet.index(bb))
elif string[0].isupper() and string[1].isupper():
aa = str... |
#Gives the average of 3 scores in a file
def main():
infile=open("scoresfeb19.dat","r")
print("Reading from file...")
score1=int(infile.readline())
score2=int(infile.readline())
score3=int(infile.readline())
print(score1,score2,score3)
average=(score1+score2+score3)/3.0
print("The avera... | def main():
infile = open('scoresfeb19.dat', 'r')
print('Reading from file...')
score1 = int(infile.readline())
score2 = int(infile.readline())
score3 = int(infile.readline())
print(score1, score2, score3)
average = (score1 + score2 + score3) / 3.0
print('The average is', average)
in... |
def repeat(character: str) -> str:
"""Repeat returns character repeated 5 times."""
word = ""
for _ in range(5):
word = word + character
return word
| def repeat(character: str) -> str:
"""Repeat returns character repeated 5 times."""
word = ''
for _ in range(5):
word = word + character
return word |
# O(n) time | O(1) space
def getNthFib(n):
defaultArray = [0,1]
if n == 1:
return defaultArray[0]
count = 3
while count <= n:
sum = defaultArray[0] + defaultArray[1]
defaultArray[0] = defaultArray[1]
defaultArray[1] = sum
count = count + 1
return defaultArray[1] | def get_nth_fib(n):
default_array = [0, 1]
if n == 1:
return defaultArray[0]
count = 3
while count <= n:
sum = defaultArray[0] + defaultArray[1]
defaultArray[0] = defaultArray[1]
defaultArray[1] = sum
count = count + 1
return defaultArray[1] |
class Apply_Function(object):
def __init__(self):
pass
def apply_function(self,number_change,list_selected_value,method,dataset):
print("---------Change according to {} method ---------------\n".format(method.name))
for i in range(number_change):
#run(row,col,va... | class Apply_Function(object):
def __init__(self):
pass
def apply_function(self, number_change, list_selected_value, method, dataset):
print('---------Change according to {} method ---------------\n'.format(method.name))
for i in range(number_change):
result = method.run(lis... |
#!/usr/bin/python
"""Submodules for generating project summary.
"""
| """Submodules for generating project summary.
""" |
if __name__ == "__main__":
example_closure = lambda x: x
s = example_closure("hello")
n = example_closure(5)
print(s, n)
x = [1, 2, 3]
equal_to_x = lambda z: z == x
print("this is x", x)
y = [1, 2, 3]
assert equal_to_x(y)
items = [1, 2, 3, 4, 5]
plus_one = list(map(lambd... | if __name__ == '__main__':
example_closure = lambda x: x
s = example_closure('hello')
n = example_closure(5)
print(s, n)
x = [1, 2, 3]
equal_to_x = lambda z: z == x
print('this is x', x)
y = [1, 2, 3]
assert equal_to_x(y)
items = [1, 2, 3, 4, 5]
plus_one = list(map(lambda x: ... |
class Singleton:
def __init__(self, cls):
self._cls = cls
def Instance(self):
try:
return self._instance
except AttributeError:
self._instance = self._cls()
return self._instance
def __call__(self):
raise TypeError('Singletons must be ac... | class Singleton:
def __init__(self, cls):
self._cls = cls
def instance(self):
try:
return self._instance
except AttributeError:
self._instance = self._cls()
return self._instance
def __call__(self):
raise type_error('Singletons must be a... |
class NUnitTestFixture(object):
"""Representation of a NUnitTest test fixture.
Attributes:
name: A string representation of the fixture name.
order: An integer indicating the fixture order inside the test suite.
duration: An integer indicating the fixture execution duration in milliseco... | class Nunittestfixture(object):
"""Representation of a NUnitTest test fixture.
Attributes:
name: A string representation of the fixture name.
order: An integer indicating the fixture order inside the test suite.
duration: An integer indicating the fixture execution duration in milliseco... |
#Question: Given the root of a tree, find the minimum dept the tree goes
#Solution: Use a BFS traversal to find the first leaf node of the tree
#Difficulty: Easy
def minDepth(root):
#Define queue, current queue and a mindepth variable
queue = [root]; current = []; mindepth = 0
#If our current n... | def min_depth(root):
queue = [root]
current = []
mindepth = 0
if not root:
return mindepth
while queue:
for i in queue:
if not i.left and (not i.right):
return mindepth + 1
if i.left:
current.append(i.left)
if i.righ... |
# Copyright (c) 2014, Andrea Esposito <info@andreaesposito.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice,... | def encrypt_message(key, message):
return translate_message(key, message, 'encrypt')
def decrypt_message(key, message):
return translate_message(key, message, 'decrypt')
def translate_message(key, message, mode):
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
translated = [... |
# You're going to create a list of the actors who appeared in the television programme Monty
# Python's Flying Circus.
# Write a function called create_cast_list that takes a filename as input and returns a list of
# actors' names. It will be run on the file flying_circus_cast.txt (this information was collected
# ... | def create_cast_list(filename):
cast_list = []
with open(filename, 'r') as file:
cast = file.readlines()
for actor in cast:
actor_split = actor.split(',')[0]
cast_list.append(actor_split)
return cast_list
cast_list = create_cast_list('flying_circus_cast.txt')
prin... |
with open ("Replace.txt") as f:
content =f.read()
content=content.replace("replace","Sample")
with open("Replace.txt", "w") as f:
f.write(content ) | with open('Replace.txt') as f:
content = f.read()
content = content.replace('replace', 'Sample')
with open('Replace.txt', 'w') as f:
f.write(content) |
class VoiceError(Exception):
pass
class YTDLError(Exception):
pass
class MissingBotToken(Exception):
pass
| class Voiceerror(Exception):
pass
class Ytdlerror(Exception):
pass
class Missingbottoken(Exception):
pass |
# function / module
def first(input):
if(input==1):
print("On")
else:
print("Off")
def second():
print("test")
#first(1)
#second()
| def first(input):
if input == 1:
print('On')
else:
print('Off')
def second():
print('test') |
x = {
'a': 12,
'a': 0b1010,
'a': 0o123,
'a': 0xa123,
'a': 1234567,
'a': 0xffff_ffff,
'a': 1234567,
'a': 0b1_1_0_1_0_1,
'a': 0o777,
'a': 0xeeee,
'a': 1.1,
};
| x = {'a': 12, 'a': 10, 'a': 83, 'a': 41251, 'a': 1234567, 'a': 4294967295, 'a': 1234567, 'a': 53, 'a': 511, 'a': 61166, 'a': 1.1} |
lines = read_test(12)
lines = read(12)
lines = [(x[0], int(x[1:])) for x in lines]
def turn(facing, deg):
new = facing + deg
while new >= 360:
new = new - 360
while new < 0:
new = new + 360
return new
def execute(cmd,n):
global x, y, facing
if cmd == 'N':
y += n
... | lines = read_test(12)
lines = read(12)
lines = [(x[0], int(x[1:])) for x in lines]
def turn(facing, deg):
new = facing + deg
while new >= 360:
new = new - 360
while new < 0:
new = new + 360
return new
def execute(cmd, n):
global x, y, facing
if cmd == 'N':
y += n
el... |
#Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized.
lines=str(input("Enter sequence of lines: "))
lines.upper()
for line in lines:
upper_lines= line.upper()
print(upper_lines,end='') | lines = str(input('Enter sequence of lines: '))
lines.upper()
for line in lines:
upper_lines = line.upper()
print(upper_lines, end='') |
for t in range(int(input())):
n, a, b = map(int, input().split())
for i in range(n):
print(chr(ord('a') + i % b), end="")
print()
| for t in range(int(input())):
(n, a, b) = map(int, input().split())
for i in range(n):
print(chr(ord('a') + i % b), end='')
print() |
# GENERATED VERSION FILE
# TIME: Fri Dec 11 13:54:02 2020
__version__ = '1.0.rc0'
short_version = '1.0.rc0'
| __version__ = '1.0.rc0'
short_version = '1.0.rc0' |
# SOLUTION 1 OF LEETCODE PROBLEM 2
# Santiago Garcia Arango, July 2020
"""
DESCRIPTION:
You are given two non-empty linked lists representing two non-negative
integers.
The digits are stored in reverse order and each of their nodes contain a
single digit. Add the two numbers and return it as a linked list.
You may ass... | """
DESCRIPTION:
You are given two non-empty linked lists representing two non-negative
integers.
The digits are stored in reverse order and each of their nodes contain a
single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero,
except the number 0... |
# -*- coding:utf-8 -*-
"""
@author: leonardo
@created time: 2020-09-19
@last modified time:2020-09-19
""" | """
@author: leonardo
@created time: 2020-09-19
@last modified time:2020-09-19
""" |
# Copyright (c) 2017 Chao Ji
# 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, distribute, ... | _default_stack = [{}] |
"""Kata: Equal sides of an array sum to the same value."""
def find_even_index(arr):
"""."""
for idx, num in enumerate(arr):
if sum(arr[:idx]) == sum(arr[idx + 1:]):
return idx
return '-1'
| """Kata: Equal sides of an array sum to the same value."""
def find_even_index(arr):
"""."""
for (idx, num) in enumerate(arr):
if sum(arr[:idx]) == sum(arr[idx + 1:]):
return idx
return '-1' |
num = int(input())
bonus = 0
if num <= 100:
bonus = 5
elif 1000 >= num > 100:
bonus = num * 20 / 100
else:
bonus = num * 10 / 100
if num % 2 == 0:
bonus = bonus + 1
elif num % 5 == 0:
bonus = bonus + 2
print(bonus)
print(bonus + num)
| num = int(input())
bonus = 0
if num <= 100:
bonus = 5
elif 1000 >= num > 100:
bonus = num * 20 / 100
else:
bonus = num * 10 / 100
if num % 2 == 0:
bonus = bonus + 1
elif num % 5 == 0:
bonus = bonus + 2
print(bonus)
print(bonus + num) |
# Copyright (C) 2020 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notic... | character_table = {'1': [{'rotation_list': 'E', 'character_table': {'A': 1}, 'mapping_table': {'E': (((1, 0, 0), (0, 1, 0), (0, 0, 1)),)}}], '-1': [{'rotation_list': ('E', 'i'), 'character_table': {'Ag': (1, 1), 'Au': (1, -1)}, 'mapping_table': {'E': (((1, 0, 0), (0, 1, 0), (0, 0, 1)),), 'i': (((-1, 0, 0), (0, -1, 0), ... |
a=0
while a>=0:
a=int(input('enter a number '))
print(a)
if a%2==0:
print('this is evan')
else:
print('this is odd') | a = 0
while a >= 0:
a = int(input('enter a number '))
print(a)
if a % 2 == 0:
print('this is evan')
else:
print('this is odd') |
def calc_best_match(encrypted_text):
best_score=0
best_cipher_letter=None
# [a-z]
for cipher_letter in range(97, 123):
score = 0
for encrypted_char in encrypted_text:
decrypted_char = (encrypted_char ^ cipher_letter)
# [a-zA-Z ]
if 96 < decrypted_char... | def calc_best_match(encrypted_text):
best_score = 0
best_cipher_letter = None
for cipher_letter in range(97, 123):
score = 0
for encrypted_char in encrypted_text:
decrypted_char = encrypted_char ^ cipher_letter
if 96 < decrypted_char < 123 or 64 < decrypted_char < 90 ... |
#The power of two. For a given integer N,
#find the greatest integer x where 2 power x is less than or equal to N. Print the exponent value and the result of the expression 2powerx.
N = int(input())
x = 0
while ((2**x) <= N ):
x += 1
print("exponent value is:", (x-1), " and value of 2 power x is:", (2**(x-1)) )
... | n = int(input())
x = 0
while 2 ** x <= N:
x += 1
print('exponent value is:', x - 1, ' and value of 2 power x is:', 2 ** (x - 1)) |
name = 'hdert'
age = 13
loop = ('FALSE')
while loop == 'FALSE':
print(name + ' is\nawesome and also')
print(age)
print('years old')
print()
name = 'hdert'
age = 14
print('now ' + name + '\nis')
print(age)
print('years old and\nstill awesome')
loop = ('TRUE')
| name = 'hdert'
age = 13
loop = 'FALSE'
while loop == 'FALSE':
print(name + ' is\nawesome and also')
print(age)
print('years old')
print()
name = 'hdert'
age = 14
print('now ' + name + '\nis')
print(age)
print('years old and\nstill awesome')
loop = 'TRUE' |
DEBUG = True
SECRET_KEY = '\xd3q\xf9\xb7r\xad\x03Ip$\xfe\x8fd\x17\x1f\xbd\xe8\xd4\xa8\xe7\x99V\xf7\x22'
LDAP_SERVER = 'localhost'
LDAP_ADMIN = 'cn=admin,dc=example,dc=com'
LDAP_PASSWD = 'yay'
LDAP_BASEDN = 'dc=example,dc=com'
| debug = True
secret_key = 'Óqù·r\xad\x03Ip$þ\x8fd\x17\x1f½èÔ¨ç\x99V÷"'
ldap_server = 'localhost'
ldap_admin = 'cn=admin,dc=example,dc=com'
ldap_passwd = 'yay'
ldap_basedn = 'dc=example,dc=com' |
'''
Bitcoin Core version last tested
with Blockchain Backup.
Copyright 2020 DeNova
Last modified: 2020-11-03
'''
CORE_VERSION = '0.20.1'
| """
Bitcoin Core version last tested
with Blockchain Backup.
Copyright 2020 DeNova
Last modified: 2020-11-03
"""
core_version = '0.20.1' |
#
# PySNMP MIB module HUAWEI-QINQ-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-QINQ-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:48:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ... |
"""HealthcareAIError
This is the error to communicate things to non technical users.
"""
class HealthcareAIError(Exception):
"""This is the error that should be thrown to help communicate problems to users in a nice way."""
def __init__(self, message):
"""Instantiate the error with a given message""... | """HealthcareAIError
This is the error to communicate things to non technical users.
"""
class Healthcareaierror(Exception):
"""This is the error that should be thrown to help communicate problems to users in a nice way."""
def __init__(self, message):
"""Instantiate the error with a given message"""... |
"""
Algorithms to find connected components in the graph considering
only dovetails overlaps.
Adapted using the networkx connected module:
networkx/networkx/algorithms/components/connected.py
"""
# Copyright (C) 2011-2013 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swa... | """
Algorithms to find connected components in the graph considering
only dovetails overlaps.
Adapted using the networkx connected module:
networkx/networkx/algorithms/components/connected.py
"""
def _plain_bfs_dovetails(gfa_, source):
if source not in gfa_:
return ()
seen = set()
nextlevel = {sou... |
class TeamData():
""" Manage premier league team data """
def __init__(self):
pass
def read_pl_teams_info(self, teams):
# Get the information of all players
assert teams, '"teams" variable is NULL'
self._teams = teams
@property
def pl_teams_lookup_info_df(self):
... | class Teamdata:
""" Manage premier league team data """
def __init__(self):
pass
def read_pl_teams_info(self, teams):
assert teams, '"teams" variable is NULL'
self._teams = teams
@property
def pl_teams_lookup_info_df(self):
return pd.io.json.json_normalize(data=sel... |
my_list = []
nr=int(input())
for i in range(nr):
my_list.append(input())
print(my_list)
| my_list = []
nr = int(input())
for i in range(nr):
my_list.append(input())
print(my_list) |
#!/usr/bin/env python3
for r in range(1, 5):
with open('conf-part7-r%d.conf' % r, 'w') as f:
for i in range(1, 3):
for j in range(0, 256):
f.write('route 10.%d.%d.0/24 via "veth-R%d-PC%d";\n' % (i+r*2-2, j, r, r))
| for r in range(1, 5):
with open('conf-part7-r%d.conf' % r, 'w') as f:
for i in range(1, 3):
for j in range(0, 256):
f.write('route 10.%d.%d.0/24 via "veth-R%d-PC%d";\n' % (i + r * 2 - 2, j, r, r)) |
"""
y_cable_base.py
Base class for implementing Y-Cable specific functionality in SONiC.
This is the base class of sonic_y_cable implentation. A vendor-specific
implementation of a 'YCable' class needs to inherit from this class.
Classes derived from this class provide the ability to interact
w... | """
y_cable_base.py
Base class for implementing Y-Cable specific functionality in SONiC.
This is the base class of sonic_y_cable implentation. A vendor-specific
implementation of a 'YCable' class needs to inherit from this class.
Classes derived from this class provide the ability to interact
w... |
# class representing a field or field group
class AbstractField:
def __init__(self,level:int,name:str):
self.level = level
self.name = name
self.start_pos:int = 0
self.length:int = 0
def __repr__(self):
return f"name: {self.name}"
def _rename_with_suffix(self,suffi... | class Abstractfield:
def __init__(self, level: int, name: str):
self.level = level
self.name = name
self.start_pos: int = 0
self.length: int = 0
def __repr__(self):
return f'name: {self.name}'
def _rename_with_suffix(self, suffix: str):
self.name += suffix
... |
def minValue(root):
##Your code here
if root is None:
return -1
temp=root
while temp.left!=None:
temp=temp.left
return temp.data
| def min_value(root):
if root is None:
return -1
temp = root
while temp.left != None:
temp = temp.left
return temp.data |
t = int(input('Digite o valor para saber a tabuada:' ))
u = t * 1
d = t * 2
tre = t * 3
q = t * 4
c = t * 5
s = t * 6
set = t * 7
oi = t * 8
no = t * 9
dez = t *10
print('Tabuada de {}\n {} x 1 = {} \n {} x 2 = {}\n {} x 3 = {} \n {} x 4 = {} \n {} x 5 = {} \n {} x 6 = {} \n {} x 7 = {} \n {} x 8 = {} \... | t = int(input('Digite o valor para saber a tabuada:'))
u = t * 1
d = t * 2
tre = t * 3
q = t * 4
c = t * 5
s = t * 6
set = t * 7
oi = t * 8
no = t * 9
dez = t * 10
print('Tabuada de {}\n {} x 1 = {} \n {} x 2 = {}\n {} x 3 = {} \n {} x 4 = {} \n {} x 5 = {} \n {} x 6 = {} \n {} x 7 = {} \n {} x 8 = {} \n {} x ... |
# int(input("Enter number:"))
# def factorial():
# f = 1
# for i in range(1,21):
# f = i * f
# print(f)
# factorial()
def factorial_20(n):
f = 1
for i in range(n,1,-1):
f = i * f
return f
for i in range(1,21):
print(f"{i} is {factorial_20(i)}")
fac... | def factorial_20(n):
f = 1
for i in range(n, 1, -1):
f = i * f
return f
for i in range(1, 21):
print(f'{i} is {factorial_20(i)}')
factorial_20(20) |
def last_element(lst):
"""Return last item in list (None if list is empty.
>>> last_element([1, 2, 3])
3
>>> last_element([]) is None
True
"""
if len(lst) != 0:
return lst[-1]
return None
print(F"last_element.py: last_element([1, 2, 3]) = `3` ... | def last_element(lst):
"""Return last item in list (None if list is empty.
>>> last_element([1, 2, 3])
3
>>> last_element([]) is None
True
"""
if len(lst) != 0:
return lst[-1]
return None
print(f'last_element.py: last_element([1, 2, 3]) = `3` = `{las... |
"""
Capital
Write a program that takes a string as input,
makes every other letter capital, sets the rest
of the characters to be lowercase, and displays
the new string.
Hint: Make sure you don't count non-alphabetic
characters.
Example input: I love Zee the Cat.
Example output: I lOvE zEe ThE cAt.
"""
str = input(... | """
Capital
Write a program that takes a string as input,
makes every other letter capital, sets the rest
of the characters to be lowercase, and displays
the new string.
Hint: Make sure you don't count non-alphabetic
characters.
Example input: I love Zee the Cat.
Example output: I lOvE zEe ThE cAt.
"""
str = input('... |
while True:
a = []
x = int(input())
if (x == 0):
break
for i in range(x):
b = input()
if (type(b) is str):
a.append(b)
a.sort(key=lambda x: x[:2])
print(*a, sep='\n')
| while True:
a = []
x = int(input())
if x == 0:
break
for i in range(x):
b = input()
if type(b) is str:
a.append(b)
a.sort(key=lambda x: x[:2])
print(*a, sep='\n') |
def checkValue(sudoku, value, x, y):
lstx = []
lsty = []
lstr = []
if x > 5:
xlimU = 5
xlimA = 9
elif x > 2:
xlimU = 2
xlimA = 6
else:
xlimU = -1
xlimA = 3
if y > 5:
ylimU = 5
ylimA = 9
elif y > 2:
ylimU = 2
... | def check_value(sudoku, value, x, y):
lstx = []
lsty = []
lstr = []
if x > 5:
xlim_u = 5
xlim_a = 9
elif x > 2:
xlim_u = 2
xlim_a = 6
else:
xlim_u = -1
xlim_a = 3
if y > 5:
ylim_u = 5
ylim_a = 9
elif y > 2:
ylim_u = ... |
# n, m = map(int,input().split())
# pattern = [('.|.'*(2*i + 1)).center(m, '-') for i in range(n//2)]
# print('\n'.join(pattern + ['WELCOME'.center(m, '-')] + pattern[::-1]))
def get_vals():
height, width = map(int, input().split())
assert height % 2 == 1 # Make sure to follow the constraints
assert width... | def get_vals():
(height, width) = map(int, input().split())
assert height % 2 == 1
assert width == height * 3
return (height, width)
def design_mat(design, text):
(h, w) = get_vals()
pattern = [i for i in range(1, h, 2)]
for i in pattern:
yield '{}'.format(str(design * i)).center(w,... |
class ConfigurationError(Exception):
"""Exception class to raise if a Configurable object has an issue."""
pass
class NotFoundError(Exception):
"""Exception class to raise if a file was not found."""
pass
class EstimatorNotTrainedError(Exception):
"""Exception class to raise if estimator is used... | class Configurationerror(Exception):
"""Exception class to raise if a Configurable object has an issue."""
pass
class Notfounderror(Exception):
"""Exception class to raise if a file was not found."""
pass
class Estimatornottrainederror(Exception):
"""Exception class to raise if estimator is used b... |
def get_movies_from_keywords(keywords):
movies = [
{
"ASIN": "B003AI2VGA",
"match": .8,
},
{
"ASIN": "B00006HAXW",
"match": .7
},
{
"ASIN": "B00004CQT3",
"match": .6
},
{
"ASIN... | def get_movies_from_keywords(keywords):
movies = [{'ASIN': 'B003AI2VGA', 'match': 0.8}, {'ASIN': 'B00006HAXW', 'match': 0.7}, {'ASIN': 'B00004CQT3', 'match': 0.6}, {'ASIN': 'B00004CQT4', 'match': 0.5}, {'ASIN': 'B006JIUN2W', 'match': 0.4}]
return movies
def get_movies_from_description(description):
movies ... |
#
# @lc app=leetcode id=7 lang=python3
#
# [7] Reverse Integer
#
# @lc code=start
class Solution:
def reverse(self, x: int) -> int:
# [-2147483648, 2147483647]
if x == 0:
return 0
arr = []
tmp = 0
if x > 0:
tmp = x // 10
arr.append(x % 10)... | class Solution:
def reverse(self, x: int) -> int:
if x == 0:
return 0
arr = []
tmp = 0
if x > 0:
tmp = x // 10
arr.append(x % 10)
else:
arr.append(-(x % -10))
tmp = x // -10
while tmp > 0:
arr.ap... |
"""Constants for the solax integration."""
DOMAIN = "solax"
MANUFACTURER = "SolaX Power"
| """Constants for the solax integration."""
domain = 'solax'
manufacturer = 'SolaX Power' |
def beginning(a_list):
i = 0
while i < len(a_list):
if a_list[i] == 'bye':
if i == 0:
return []
elif i < 10:
return a_list[:i]
else:
break
i += 1
return a_list[:10]
| def beginning(a_list):
i = 0
while i < len(a_list):
if a_list[i] == 'bye':
if i == 0:
return []
elif i < 10:
return a_list[:i]
else:
break
i += 1
return a_list[:10] |
def main(state):
print("foo:", state["foo"])
print("foo2:", state["foo2"])
print("foo3:", state["foo3"])
print("foo4:", state["foo4"])
def register(mf):
mf.register_defaults({
"foo": lambda state, event: state["bar"] if "bar" in state else 0,
"foo2": lambda state, event: state["ba... | def main(state):
print('foo:', state['foo'])
print('foo2:', state['foo2'])
print('foo3:', state['foo3'])
print('foo4:', state['foo4'])
def register(mf):
mf.register_defaults({'foo': lambda state, event: state['bar'] if 'bar' in state else 0, 'foo2': lambda state, event: state['bar2'] if 'bar2' in s... |
try:
x = 0
y = x/x
except Exception as inst:
print(type(inst)) # the exception instance
print(inst.args) # arguments stored in .args
print(inst) # __str__ allows args to be printed directly,
| try:
x = 0
y = x / x
except Exception as inst:
print(type(inst))
print(inst.args)
print(inst) |
match x:
case 1 | 2:
pass
case (1 | 2):
pass
case (1 | 2) | 3:
pass
case 1 | (2 | 3):
pass
| match x:
case 1 | 2:
pass
case 1 | 2:
pass
case (1 | 2) | 3:
pass
case 1 | (2 | 3):
pass |
"""
Check that send will not block in different situations...
"""
#pragma repy restrictions.twoports
localip = "127.0.0.1"
localport = 12345
targetip = "127.0.0.1"
targetport = 12346
timeout = 1.0
tcpserversocket = listenforconnection(targetip, targetport)
conn = openconnection(targetip, targetport, localip, localpo... | """
Check that send will not block in different situations...
"""
localip = '127.0.0.1'
localport = 12345
targetip = '127.0.0.1'
targetport = 12346
timeout = 1.0
tcpserversocket = listenforconnection(targetip, targetport)
conn = openconnection(targetip, targetport, localip, localport, timeout)
conn.send('hi')
(ip, port... |
def full_ticker_list():
"""
List of all the popular tickers identified. Add more to the list if you wish to
"""
list_of_tickers = ["AMC", "BB", "CLOV", "UWMC", "NIO", "TSLA", "AAPL", "SPY", "NOK", "AMD", "NVDA", "MSFT", "GME",
"RBLX", "F", "PLTR", "COIN", "RKT", "MVIS", "FUBO", "D... | def full_ticker_list():
"""
List of all the popular tickers identified. Add more to the list if you wish to
"""
list_of_tickers = ['AMC', 'BB', 'CLOV', 'UWMC', 'NIO', 'TSLA', 'AAPL', 'SPY', 'NOK', 'AMD', 'NVDA', 'MSFT', 'GME', 'RBLX', 'F', 'PLTR', 'COIN', 'RKT', 'MVIS', 'FUBO', 'DISCA', 'VIAC', 'SNDL', ... |
def try_config(config, heading, key):
"""Attempt to extract config[heading][key], with error handling.
This function wraps config access with a try-catch to print out informative
error messages and then exit."""
try:
section = config[heading]
except KeyError:
exit("Missing config se... | def try_config(config, heading, key):
"""Attempt to extract config[heading][key], with error handling.
This function wraps config access with a try-catch to print out informative
error messages and then exit."""
try:
section = config[heading]
except KeyError:
exit('Missing config se... |
# Copyright (c) 2015 Riverbed Technology, Inc.
#
# This software is licensed under the terms and conditions of the MIT License
# accompanying the software ("License"). This software is distributed "AS IS"
# as set forth in the License.
"""
This file defines a custom admin page for any models defined
in models.py.
A ... | """
This file defines a custom admin page for any models defined
in models.py.
A sample admin page for the sample Product model in models.py:
from django.contrib import admin
from steelscript.stock.appfwk.models import Product
class ProductAdmin(admin.ModelAdmin):
list_display = ('name', 'price'... |
load("@rules_jvm_external//:specs.bzl", "maven")
LIFECYCLE_VERSION = "2.2.0-rc03"
ROOM_VERSION = "2.2.3"
ROOM_WORDS_SAMPLE_MAVEN_ARTIFACTS = [
"androidx.annotation:annotation:1.1.0",
"androidx.appcompat:appcompat:1.1.0",
"androidx.constraintlayout:constraintlayout:1.1.3",
"androidx.fragment:fragment:1... | load('@rules_jvm_external//:specs.bzl', 'maven')
lifecycle_version = '2.2.0-rc03'
room_version = '2.2.3'
room_words_sample_maven_artifacts = ['androidx.annotation:annotation:1.1.0', 'androidx.appcompat:appcompat:1.1.0', 'androidx.constraintlayout:constraintlayout:1.1.3', 'androidx.fragment:fragment:1.2.0-rc04', 'androi... |
# *******************************
# |docname| - routinng for web2py
# *******************************
# Provide a default application, so that accessing "https://my-site-name.edu" works, instead of requiring "https://my-site-name.edu/runestone".
#
# See the `web2py manual <http://web2py.com/books/default/chapter/29/04/... | routers = dict(BASE=dict(default_application='runestone')) |
# Convenience utilities for printing
def p(n, duration):
print('{:2d}: {:6.3f} seconds'.format(n, duration))
| def p(n, duration):
print('{:2d}: {:6.3f} seconds'.format(n, duration)) |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Education, obj[4]: Occupation, obj[5]: Bar, obj[6]: Coffeehouse, obj[7]: Restaurant20to50, obj[8]: Direction_same, obj[9]: Distance
# {"feature": "Occupation", "instances": 34, "metric_value": 0.9367, "depth": 1}
if obj[4]<=14:
# {"fea... | def find_decision(obj):
if obj[4] <= 14:
if obj[2] > 0:
if obj[1] <= 3:
if obj[5] <= 3.0:
if obj[6] <= 2.0:
if obj[3] <= 3:
if obj[7] <= 2.0:
if obj[0] <= 2:
... |
def private_function(name):
"""private_function is a docstring().
:meta private:
"""
def _public_function(name):
"""public_function is a docstring().
:meta public:
"""
PRIVATE_CONSTANT = None #: :meta private:
_PUBLIC_CONSTANT = None #: :meta public:
| def private_function(name):
"""private_function is a docstring().
:meta private:
"""
def _public_function(name):
"""public_function is a docstring().
:meta public:
"""
private_constant = None
_public_constant = None |
# -*- coding:utf8 -*-
'''
The model for PDA
'''
class Energy(object):
'''
the Energy model
'''
def __init__(self, name, energy):
'''
The construction funtion
'''
self._name = name
self._energy = energy
@property
def name(self):
'''
the ... | """
The model for PDA
"""
class Energy(object):
"""
the Energy model
"""
def __init__(self, name, energy):
"""
The construction funtion
"""
self._name = name
self._energy = energy
@property
def name(self):
"""
the province name
"... |
def add(x, y):
return x + y
class Calculator:
def __init__(self):
self.current = 0
self.total = 0
def set(self, value):
self.current = value
def add(self):
self.total += self.current
def sub(self):
self.total -= self.current
def total(self):
... | def add(x, y):
return x + y
class Calculator:
def __init__(self):
self.current = 0
self.total = 0
def set(self, value):
self.current = value
def add(self):
self.total += self.current
def sub(self):
self.total -= self.current
def total(self):
... |
def not_none(obj, msg="parameter must not be None"):
if obj is None:
raise ValueError(msg)
else:
return obj
def safe_get(a_list, index):
if index < 0 or index > len(a_list)-1:
raise IndexError("index {} is out of range for {}".format(index, a_list))
else:
return a_list[... | def not_none(obj, msg='parameter must not be None'):
if obj is None:
raise value_error(msg)
else:
return obj
def safe_get(a_list, index):
if index < 0 or index > len(a_list) - 1:
raise index_error('index {} is out of range for {}'.format(index, a_list))
else:
return a_li... |
"""
!/usr/bin/env python3
-*- coding: utf-8 -*-
----------------------------------------------------------------------
Copyright 2021 CFS Engineering
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... | """
!/usr/bin/env python3
-*- coding: utf-8 -*-
----------------------------------------------------------------------
Copyright 2021 CFS Engineering
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... |
class _UNDEFINED(object):pass
class BaseOperatorFactory(object):
def simple_selector(self, func, arg=_UNDEFINED()):
return SimpleSelector(func, arg)
def filter_selector(self, func, arg):
return FilterSelector(func, arg)
def filter_operator(self, op1, op2):
return FilterOperator(o... | class _Undefined(object):
pass
class Baseoperatorfactory(object):
def simple_selector(self, func, arg=_undefined()):
return simple_selector(func, arg)
def filter_selector(self, func, arg):
return filter_selector(func, arg)
def filter_operator(self, op1, op2):
return filter_op... |
"""
leo_cloud.py - synchronize Leo subtrees with remote central server
Terry N. Brown, terrynbrown@gmail.com, Fri Sep 22 10:34:10 2017
(this is the server half, see also leo_cloud.py for the Leo plugin)
This file is a *stub* for a Leo aware LeoCloudIOLeoServer which allows more
granular and real-time synchronization... | """
leo_cloud.py - synchronize Leo subtrees with remote central server
Terry N. Brown, terrynbrown@gmail.com, Fri Sep 22 10:34:10 2017
(this is the server half, see also leo_cloud.py for the Leo plugin)
This file is a *stub* for a Leo aware LeoCloudIOLeoServer which allows more
granular and real-time synchronization... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.