content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""Directives and roles for documenting traitlets config options.
::
.. configtrait:: Application.log_datefmt
Description goes here.
Cross reference like this: :configtrait:`Application.log_datefmt`.
"""
def setup(app):
app.add_object_type('configtrait', 'configtrait', objname='Config option')... | """Directives and roles for documenting traitlets config options.
::
.. configtrait:: Application.log_datefmt
Description goes here.
Cross reference like this: :configtrait:`Application.log_datefmt`.
"""
def setup(app):
app.add_object_type('configtrait', 'configtrait', objname='Config option')
... |
"""
Implementation of a vertex, as used in graphs
"""
################################################################################
# #
# Undirected #
# ... | """
Implementation of a vertex, as used in graphs
"""
class Undirectedvertex(object):
def __init__(self, val=None, attrs=None):
self._val = val or id(self)
self._attrs = attrs or {}
self._edges = set()
self._has_self_edge = False
def __repr__(self):
display = (self.val... |
def aumentar(preco,taxa):
res = preco * (1 + taxa)
return res
def diminuir(preco,taxa):
res = preco * (1 - taxa)
return res
def dobro(preco):
res = preco * 2
return res
def metade(preco):
res = preco/2
return res
| def aumentar(preco, taxa):
res = preco * (1 + taxa)
return res
def diminuir(preco, taxa):
res = preco * (1 - taxa)
return res
def dobro(preco):
res = preco * 2
return res
def metade(preco):
res = preco / 2
return res |
"""All Lena exceptions are subclasses of :exc:`LenaException`
and corresponding Python exceptions (if they exist).
"""
# pylint: disable=missing-docstring
# Most Exceptions here are familiar to Python programmers
# and are self-explanatory.
class LenaException(Exception):
"""Base class for all Lena exceptions.""... | """All Lena exceptions are subclasses of :exc:`LenaException`
and corresponding Python exceptions (if they exist).
"""
class Lenaexception(Exception):
"""Base class for all Lena exceptions."""
pass
class Lenaattributeerror(LenaException, AttributeError):
pass
class Lenaenvironmenterror(LenaException, Env... |
def ps(uid='-1',det='default',suffix='default',shift=.5,logplot='off',figure_number=999):
'''
function to determine statistic on line profile (assumes either peak or erf-profile)\n
calling sequence: uid='-1',det='default',suffix='default',shift=.5)\n
det='default' -> get detector from metadata, otherwis... | def ps(uid='-1', det='default', suffix='default', shift=0.5, logplot='off', figure_number=999):
"""
function to determine statistic on line profile (assumes either peak or erf-profile)
calling sequence: uid='-1',det='default',suffix='default',shift=.5)
det='default' -> get detector from metadata, othe... |
"""
Question 38 :
Define a function which can generated a list where the values
are square of numbers between 1 and 20 (both included). Then the
function need to print the last 5 elements in the list.
Hints : Use ** operator to get power of a number. Use range()
for loop. Use list.append() to add v... | """
Question 38 :
Define a function which can generated a list where the values
are square of numbers between 1 and 20 (both included). Then the
function need to print the last 5 elements in the list.
Hints : Use ** operator to get power of a number. Use range()
for loop. Use list.append() to add v... |
# Copyright (c) Ville de Montreal. All rights reserved.
# Licensed under the MIT license.
# See LICENSE file in the project root for full license information.
CITYSCAPE_LABELS = [
('unlabeled', 0, 0, 0, 0),
('ego vehicle', 1, 0, 0, 0),
('rectification border', 2, 0, 0, 0),
('out of roi', 3, 0, 0, 0),
... | cityscape_labels = [('unlabeled', 0, 0, 0, 0), ('ego vehicle', 1, 0, 0, 0), ('rectification border', 2, 0, 0, 0), ('out of roi', 3, 0, 0, 0), ('static', 4, 0, 0, 0), ('dynamic', 5, 111, 74, 0), ('ground', 6, 81, 0, 81), ('road', 7, 128, 64, 128), ('sidewalk', 8, 244, 35, 232), ('parking', 9, 250, 170, 160), ('rail trac... |
email = input()
while True:
commands = input().split()
command = commands[0]
if command == "Complete":
break
if command == "Make":
case = commands[1]
if case == "Upper":
email = email.upper()
elif case == "Lower":
email = email.lower()
pr... | email = input()
while True:
commands = input().split()
command = commands[0]
if command == 'Complete':
break
if command == 'Make':
case = commands[1]
if case == 'Upper':
email = email.upper()
elif case == 'Lower':
email = email.lower()
prin... |
#tuples are immutable like strings
eggs = ('hello', 42, 0.5)
eggs[0]
'hello'
eggs[1:3]
(42, 0.5)
print(len(eggs))
type(('hello',)) #class 'tuple'
type(('hello')) #class 'str'
#Converting Types with the list() and tuple() Functions
tuple(['cat', 'dog', 5]) #('cat', 'dog', 5)
list(('cat', 'dog', 5)) ... | eggs = ('hello', 42, 0.5)
eggs[0]
'hello'
eggs[1:3]
(42, 0.5)
print(len(eggs))
type(('hello',))
type('hello')
tuple(['cat', 'dog', 5])
list(('cat', 'dog', 5))
list('hello') |
#!/usr/bin/python
class Problem7:
'''
10001st prime
Problem 7
104743
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
'''
def solution(self):
primes = []
nextPrime = 2
for i ... | class Problem7:
"""
10001st prime
Problem 7
104743
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
"""
def solution(self):
primes = []
next_prime = 2
for i in range(10001):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Contains all abstract class definitions """
__author__ = 'San Kilkis'
class AttrDict(dict):
""" Nested Attribute Dictionary
A class to convert a nested Dictionary into an object with key-values
accessibly using attribute notation (AttrDict.attribute) i... | """ Contains all abstract class definitions """
__author__ = 'San Kilkis'
class Attrdict(dict):
""" Nested Attribute Dictionary
A class to convert a nested Dictionary into an object with key-values
accessibly using attribute notation (AttrDict.attribute) in addition to
key notation (Dict["key"]). Thi... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 14 13:29:10 2020
@author: Ham
"""
def locate(ar, target):
lft = 0
rgt = len(ar) - 1
while lft <= rgt:
mid = (lft + rgt) // 2
if ar[mid] == target:
return mid
if target < ar[mid]:
rgt = mid - 1
... | """
Created on Mon Dec 14 13:29:10 2020
@author: Ham
"""
def locate(ar, target):
lft = 0
rgt = len(ar) - 1
while lft <= rgt:
mid = (lft + rgt) // 2
if ar[mid] == target:
return mid
if target < ar[mid]:
rgt = mid - 1
else:
lft = mid + 1
... |
class_ds = \
"""A One-Group Light Water Reactor Fuel Cycle Component. This is a daughter
class of Reactor1G and a granddaughter of FCComp.
Parameters
----------
lib : str, optional
The path the the LWR HDF5 data library. This value is set to
Reactor1G.libfile and used by Reactor1G.loadlib().
rp : ReactorPa... | class_ds = 'A One-Group Light Water Reactor Fuel Cycle Component. This is a daughter \nclass of Reactor1G and a granddaughter of FCComp.\n\nParameters\n----------\nlib : str, optional\n The path the the LWR HDF5 data library. This value is set to \n Reactor1G.libfile and used by Reactor1G.loadlib().\nrp : React... |
class Solution:
# Top Down DP (Accepted), O(n^2) time, O(1) space
def minimumTotal(self, triangle: List[List[int]]) -> int:
for i in range(1, len(triangle)):
row = triangle[i]
row[0] += triangle[i-1][0]
row[-1] += triangle[i-1][-1]
for j in range(1, len(ro... | class Solution:
def minimum_total(self, triangle: List[List[int]]) -> int:
for i in range(1, len(triangle)):
row = triangle[i]
row[0] += triangle[i - 1][0]
row[-1] += triangle[i - 1][-1]
for j in range(1, len(row) - 1):
row[j] += min(triangle[... |
#! /usr/bin/env python
#Asking for input until a list of 10 integers given
while True:
num = input("Enter a list of 10 integers separated by a ',' : ").split(',')
l = len(num)
try:
for i in range(l):
num[i] = int(num[i])
p = (l==10)
if p:
break
except:
... | while True:
num = input("Enter a list of 10 integers separated by a ',' : ").split(',')
l = len(num)
try:
for i in range(l):
num[i] = int(num[i])
p = l == 10
if p:
break
except:
continue
prime_num = []
for x in num:
if x > 1:
for i in r... |
#!/usr/bin/env python3
# Lists
# Create a list
list_1 = [] # Creates an empty list using parantheses
list_2 = list() # Creates an empty list using the list() builtin
# Lists can accomodate different/multiple data types
list_2 = [1, 2, 3]
list_3 = ["a", "b", "c"]
list_4 = ["a", "hello", 1, "5"]
# Lists can accomod... | list_1 = []
list_2 = list()
list_2 = [1, 2, 3]
list_3 = ['a', 'b', 'c']
list_4 = ['a', 'hello', 1, '5']
list_5 = [[1, 2, 3], [5, 6, 1]]
list_6 = list_5.__add__(list_4)
print(list_6)
print(dir())
list_copy_1 = list_4
print(id(list_copy_1))
print(id(list_4))
list_copy_1 is list_4
list_copy_2 = list_4[:]
print(id(list_cop... |
class File:
def __init__(self, name: str, mode: str):
self.file = open(name, mode)
def write(self, line: str):
self.file.write(line + "\n")
def write_dict(self, dict):
for key, val in dict.items():
self.write(f"{key}: {val}")
def close(self):
self.file.clos... | class File:
def __init__(self, name: str, mode: str):
self.file = open(name, mode)
def write(self, line: str):
self.file.write(line + '\n')
def write_dict(self, dict):
for (key, val) in dict.items():
self.write(f'{key}: {val}')
def close(self):
self.file.c... |
"""
There are n people, each of them has a unique ID from 0 to n - 1 and each
person of them belongs to exactly one group.
Given an integer array groupSizes which indicated that the person with
ID = i belongs to a group of groupSize[i] persons.
Return an array of the groups where ans[j] contains t... | """
There are n people, each of them has a unique ID from 0 to n - 1 and each
person of them belongs to exactly one group.
Given an integer array groupSizes which indicated that the person with
ID = i belongs to a group of groupSize[i] persons.
Return an array of the groups where ans[j] contains t... |
query_set = [
"SELECT subscriber.s_id, subscriber.sub_nbr, \
subscriber.bit_1, subscriber.bit_2, subscriber.bit_3, subscriber.bit_4, subscriber.bit_5, subscriber.bit_6, subscriber.bit_7, \
subscriber.bit_8, subscriber.bit_9, subscriber.bit_10, \
subscriber.hex... | query_set = ['SELECT subscriber.s_id, subscriber.sub_nbr, subscriber.bit_1, subscriber.bit_2, subscriber.bit_3, subscriber.bit_4, subscriber.bit_5, subscriber.bit_6, subscriber.bit_7, subscriber.bit_8, subscriber.bit_9, subscriber.bit_10, subscriber.hex_1, subscriber.hex_2, ... |
class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: Set[str]
:rtype: bool
"""
## DP
dp = [False for _ in range(len(s) + 1)]
dp[0] = True
for j in range(1, len(s) + 1):
for i in range(0, j):
... | class Solution(object):
def word_break(self, s, wordDict):
"""
:type s: str
:type wordDict: Set[str]
:rtype: bool
"""
dp = [False for _ in range(len(s) + 1)]
dp[0] = True
for j in range(1, len(s) + 1):
for i in range(0, j):
... |
## https://leetcode.com/problems/find-all-duplicates-in-an-array/
## pretty simple solution -- use a set to keep track of the numbers
## that have already appeared (because lookup time is O(1) given
## the implementation in python via a hash table). Gives me an O(N)
## runtime
## runetime is 79th percentile; memory... | class Solution:
def find_duplicates(self, nums: List[int]) -> List[int]:
already_appeared = set([])
twice = []
while len(nums):
n = nums.pop()
if n in already_appeared:
twice.append(n)
else:
already_appeared.add(n)
... |
world_cities = ['Dubai', 'New Orleans', 'Santorini', 'Gaza', 'Seoul']
print('***********')
print(world_cities)
print('***********')
print(sorted(world_cities))
print('***********')
print(world_cities)
print('***********')
print(sorted(world_cities, reverse=True))
print('***********')
print(world_cities)
print('********... | world_cities = ['Dubai', 'New Orleans', 'Santorini', 'Gaza', 'Seoul']
print('***********')
print(world_cities)
print('***********')
print(sorted(world_cities))
print('***********')
print(world_cities)
print('***********')
print(sorted(world_cities, reverse=True))
print('***********')
print(world_cities)
print('********... |
# Given a non-negative integer num, return the number of steps to reduce it to zero.
# If the current number is even, you have to divide it by 2,
# otherwise, you have to subtract 1 from it.
def count_steps(num):
steps = 0
while num != 0:
if num % 2 == 1:
num -= 1
else:
... | def count_steps(num):
steps = 0
while num != 0:
if num % 2 == 1:
num -= 1
else:
num /= 2
steps += 1
return steps |
# https://leetcode.com/problems/is-subsequence/
class Solution:
def isSubsequence(self, s: str, t: str) -> bool:
if len(s) == 0:
return True
sIndex = 0
for tIndex, tChar in enumerate(t):
if s[sIndex] == tChar:
sIndex += 1
... | class Solution:
def is_subsequence(self, s: str, t: str) -> bool:
if len(s) == 0:
return True
s_index = 0
for (t_index, t_char) in enumerate(t):
if s[sIndex] == tChar:
s_index += 1
if sIndex == len(s):
return True
r... |
#
# PySNMP MIB module H3C-FTM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-FTM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:09:18 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ... |
# Row-by-column representation of the board
BOARD_SIZE = 6, 7
# Define size of each cell in the GUI of the game
CELL_SIZE = 100
# Define radius of dot
RADIUS = (CELL_SIZE // 2) - 5
# Define size of GUI screen
GUI_SIZE = (BOARD_SIZE[0] + 1) * CELL_SIZE, (BOARD_SIZE[1]) * CELL_SIZE
# Define various colors used on the GUI... | board_size = (6, 7)
cell_size = 100
radius = CELL_SIZE // 2 - 5
gui_size = ((BOARD_SIZE[0] + 1) * CELL_SIZE, BOARD_SIZE[1] * CELL_SIZE)
red = (255, 0, 0)
blue = (0, 0, 255)
black = (0, 0, 0)
white = (255, 255, 255)
yellow = (255, 255, 0)
human_player = 0
q_robot = 1
random_robot = 2
mini_max_robot = 3
reward_win = 1
re... |
'''This tnsertion sort algorithm
which is shown in most websites
and books, is slower than another
insertion sort algorithm.'''
def insertion_sort_slow(arr):
for i in range(1, len(arr)):
key = arr[i]
j = i-1
while j >= 0 and key < arr[j]:
arr[j + 1] = arr[j]
j -=... | """This tnsertion sort algorithm
which is shown in most websites
and books, is slower than another
insertion sort algorithm."""
def insertion_sort_slow(arr):
for i in range(1, len(arr)):
key = arr[i]
j = i - 1
while j >= 0 and key < arr[j]:
arr[j + 1] = arr[j]
... |
"""class krypton_patch:
def __init__(self, driver) -> None:
self.driver = driver
self.js = driver.driver.execute_script
driver.driver.execute_script("javascript/index.js") #patch 0.1
def FakeReply(self, korban, pesan, chat_id, MsgId, teks):
return self.js(f"return await FakeR... | """class krypton_patch:
def __init__(self, driver) -> None:
self.driver = driver
self.js = driver.driver.execute_script
driver.driver.execute_script("javascript/index.js") #patch 0.1
def FakeReply(self, korban, pesan, chat_id, MsgId, teks):
return self.js(f"return await FakeR... |
# Solution for the problem "Cats and a mouse"
# https://www.hackerrank.com/challenges/cats-and-a-mouse/problem
# Number of test cases
numQueries = int(input())
# Running the queries
for queryIndex in range(0, numQueries):
# Locations of Cat A, Cat B and mouse
locCatA, locCatB, locMouse = map(int, input().stri... | num_queries = int(input())
for query_index in range(0, numQueries):
(loc_cat_a, loc_cat_b, loc_mouse) = map(int, input().strip().split(' '))
dist_cat_a = abs(locCatA - locMouse)
dist_cat_b = abs(locCatB - locMouse)
if distCatA == distCatB:
print('Mouse C')
elif distCatA < distCatB:
p... |
"""
DESCRIPTION:
Write a code to extract each digit from an integer, in the reverse order
EXAMPLE
Input:
n = 1234
Output:
"4 3 2 1"
"""
def main(n: int) -> str:
ret_val: str = ""
# Enter the code below
return ret_val
| """
DESCRIPTION:
Write a code to extract each digit from an integer, in the reverse order
EXAMPLE
Input:
n = 1234
Output:
"4 3 2 1"
"""
def main(n: int) -> str:
ret_val: str = ''
return ret_val |
# configuration for building the network
y_dim = 6
tr_dim = 7
ir_dim = 10
latent_dim = 128
z_dim = 128
batch_size = 128
lr = 0.0002
beta1 = 0.5
# configuration for the supervisor
logdir = "./log"
sampledir = "./example"
max_steps = 30000
sample_every_n_steps = 100
summary_every_n_steps = 1
save_model_secs = 120
checkp... | y_dim = 6
tr_dim = 7
ir_dim = 10
latent_dim = 128
z_dim = 128
batch_size = 128
lr = 0.0002
beta1 = 0.5
logdir = './log'
sampledir = './example'
max_steps = 30000
sample_every_n_steps = 100
summary_every_n_steps = 1
save_model_secs = 120
checkpoint_basename = 'layout'
checkpoint_dir = './checkpoints'
filenamequeue = './... |
N = int(input())
s = [input() for _ in range(N)]
for y in range(N):
for x in range(N):
print(s[N - 1 - x][y], end='')
print('')
| n = int(input())
s = [input() for _ in range(N)]
for y in range(N):
for x in range(N):
print(s[N - 1 - x][y], end='')
print('') |
class Message(object):
"""`Message` stores the SMS text and the originating phone number.
"""
def __init__(self, from_number, text, provider=None, *args, **kwargs):
self.from_number = from_number
self.text = text
self._provider = provider
def reply(self, text):
self._pro... | class Message(object):
"""`Message` stores the SMS text and the originating phone number.
"""
def __init__(self, from_number, text, provider=None, *args, **kwargs):
self.from_number = from_number
self.text = text
self._provider = provider
def reply(self, text):
self._pr... |
S = input()
def check_even(stri):
if len(stri) % 2 !=0:
return False
else:
half = int(len(stri)/2)
if stri[:half] == stri[half:]:
return True
else:
return False
for i in range(len(S)):
if check_even(S[:-(i+1)]):
print(len(S)-(i+1))
... | s = input()
def check_even(stri):
if len(stri) % 2 != 0:
return False
else:
half = int(len(stri) / 2)
if stri[:half] == stri[half:]:
return True
else:
return False
for i in range(len(S)):
if check_even(S[:-(i + 1)]):
print(len(S) - (i + 1))
... |
N = int(input("Cuantos digitos quiere ingresar? "))
lista = []
lista2 = []
for i in range(N):
lista.append(int(input("Digite un numero: ")))
print("Su lista es: ", lista)
for i in range(N):
lista2.append(1*(lista[i]+1))
print("La segunda lista es: ", lista2) | n = int(input('Cuantos digitos quiere ingresar? '))
lista = []
lista2 = []
for i in range(N):
lista.append(int(input('Digite un numero: ')))
print('Su lista es: ', lista)
for i in range(N):
lista2.append(1 * (lista[i] + 1))
print('La segunda lista es: ', lista2) |
# @dependency 001-main/002-createrepository.py
frontend.json(
"repositories",
expect={ "repositories": [critic_json] })
frontend.json(
"repositories/1",
expect=critic_json)
frontend.json(
"repositories",
params={ "name": "critic" },
expect=critic_json)
frontend.json(
"repositories/47... | frontend.json('repositories', expect={'repositories': [critic_json]})
frontend.json('repositories/1', expect=critic_json)
frontend.json('repositories', params={'name': 'critic'}, expect=critic_json)
frontend.json('repositories/4711', expect={'error': {'title': 'No such resource', 'message': 'Resource not found: Invalid... |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
# Copyright (C) 2020 Daniel Rodriguez
# Use of this source code is governed by the MIT License
###############################################################################... | __all__ = ['SEED_AVG', 'SEED_LAST', 'SEED_SUM', 'SEED_NONE', 'SEED_ZERO', 'SEED_ZFILL', '_INCPERIOD', '_DECPERIOD', '_MINIDX', '_SERIES', '_MPSERIES', '_SETVAL', '_MPSETVAL']
seed_avg = 0
seed_last = 1
seed_sum = 2
seed_none = 4
seed_zero = 5
seed_zfill = 6
def _incperiod(x, p=1):
"""
Forces an increase `p` in... |
##Patterns: E0103
def test():
while True:
break
##Err: E0103
break
for letter in 'Python':
if letter == 'h':
continue
##Err: E0103
continue
| def test():
while True:
break
break
for letter in 'Python':
if letter == 'h':
continue
continue |
def checkio(f, g):
def call(function, *args, **kwargs):
try: return function(*args, **kwargs)
except Exception: return None
def h(*args, **kwargs):
value_f, value_g = call(f, *args, **kwargs), call(g, *args, **kwargs)
status = ""
if (value_f is None and value_g... | def checkio(f, g):
def call(function, *args, **kwargs):
try:
return function(*args, **kwargs)
except Exception:
return None
def h(*args, **kwargs):
(value_f, value_g) = (call(f, *args, **kwargs), call(g, *args, **kwargs))
status = ''
if value_f i... |
# --------------
# Code starts here
class_1 = ['Geoffrey Hinton' , 'Andrew Ng' , 'Sebastian Raschka' , 'Yoshua Bengio']
class_2 = ['Hilary Mason' , 'Carla Gentry' , 'Corinna Cortes']
new_class = class_1+class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(... | class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
courses = {'Math': 65, 'English... |
N = int(input())
a,b = 1,1
print(0,end=' ')
for i in range(1,N-1):
if i != N:
print(a,end=' ')
a,b = b,a+b
print(a,end='\n') | n = int(input())
(a, b) = (1, 1)
print(0, end=' ')
for i in range(1, N - 1):
if i != N:
print(a, end=' ')
(a, b) = (b, a + b)
print(a, end='\n') |
# This is a dummy file to allow the automatic loading of modules without error on none.
def setup(robot_config):
return
def say(*args):
return
def mute():
return
def unmute():
return
def volume(level):
return | def setup(robot_config):
return
def say(*args):
return
def mute():
return
def unmute():
return
def volume(level):
return |
class FeeValidator:
def __init__(self, specifier) -> None:
super().__init__()
self.specifier = specifier
def validate(self, fee):
failed=False
try:
if fee != 0 and not 1 <= fee <= 100:
failed=True
except TypeError:
failed=True
... | class Feevalidator:
def __init__(self, specifier) -> None:
super().__init__()
self.specifier = specifier
def validate(self, fee):
failed = False
try:
if fee != 0 and (not 1 <= fee <= 100):
failed = True
except TypeError:
failed = ... |
#!/usr/bin/env python3
"""
Get information on the inferface.
"""
help(gdb)
help(gdb.command)
help(gdb.events)
help(gdb.function)
| """
Get information on the inferface.
"""
help(gdb)
help(gdb.command)
help(gdb.events)
help(gdb.function) |
INSERT_ONE_BY_BYTE = "insert_one_by_byte"
INSERT_ONE_BY_PATH = "insert_one_by_path"
INSERT_MANY_BY_BYTE = "insert_many_by_byte"
INSERT_MANY_BY_DIR = "insert_many_by_dir"
INSERT_MANY_BY_PATHS = "insert_many_by_paths"
DELETE_ONE_BY_ID = "delete_one_by_id"
DELETE_MANY_BY_IDS = "delete_many_by_ids"
DELETE_ALL = "delete_al... | insert_one_by_byte = 'insert_one_by_byte'
insert_one_by_path = 'insert_one_by_path'
insert_many_by_byte = 'insert_many_by_byte'
insert_many_by_dir = 'insert_many_by_dir'
insert_many_by_paths = 'insert_many_by_paths'
delete_one_by_id = 'delete_one_by_id'
delete_many_by_ids = 'delete_many_by_ids'
delete_all = 'delete_all... |
lista = []
lista_par = []
lista_impar = []
while True:
n = (int(input('Digite os numeros: ')))
lista.append(n)
if n % 2 == 0:
lista_par.append(n)
else:
lista_impar.append(n)
res = str(input('Quer continuar [S/N] : '))
if res in 'Nn':
break
print(f'O numeros da... | lista = []
lista_par = []
lista_impar = []
while True:
n = int(input('Digite os numeros: '))
lista.append(n)
if n % 2 == 0:
lista_par.append(n)
else:
lista_impar.append(n)
res = str(input('Quer continuar [S/N] : '))
if res in 'Nn':
break
print(f'O numeros da lista fora : ... |
input = """
1 2 0 0
1 3 0 0
1 4 0 0
1 5 0 0
1 6 0 0
1 7 0 0
1 8 0 0
1 9 0 0
1 10 0 0
1 11 0 0
1 12 0 0
1 13 0 0
1 14 0 0
1 15 0 0
1 16 0 0
1 17 0 0
1 18 1 1 19
1 20 1 1 21
1 22 1 1 23
1 24 1 1 25
1 26 1 1 27
1 28 1 1 29
1 19 1 1 18
1 21 1 1 20
1 23 1 1 22
1 25 1 1 24
1 27 1 1 26
1 29 1 1 28
1 1 1 1 18
2 30 2 0 2 22 20
... | input = '\n1 2 0 0\n1 3 0 0\n1 4 0 0\n1 5 0 0\n1 6 0 0\n1 7 0 0\n1 8 0 0\n1 9 0 0\n1 10 0 0\n1 11 0 0\n1 12 0 0\n1 13 0 0\n1 14 0 0\n1 15 0 0\n1 16 0 0\n1 17 0 0\n1 18 1 1 19\n1 20 1 1 21\n1 22 1 1 23\n1 24 1 1 25\n1 26 1 1 27\n1 28 1 1 29\n1 19 1 1 18\n1 21 1 1 20\n1 23 1 1 22\n1 25 1 1 24\n1 27 1 1 26\n1 29 1 1 28\n1... |
test = [11.0, "Alice has a cat", 12, 4, "5"]
print("len(test) = " + str(len(test)))
print("test[1] = " + str(test[1]))
print("test[3:6] = " + str(test[3:6]))
print("test[1:6:2] = " + str(test[1:6:2]))
print("test[:6] = " + str(test[:6]))
print("test[-2] = " + str(test[-2]))
test.append(121)
test2 = test + [1, 2, 3... | test = [11.0, 'Alice has a cat', 12, 4, '5']
print('len(test) = ' + str(len(test)))
print('test[1] = ' + str(test[1]))
print('test[3:6] = ' + str(test[3:6]))
print('test[1:6:2] = ' + str(test[1:6:2]))
print('test[:6] = ' + str(test[:6]))
print('test[-2] = ' + str(test[-2]))
test.append(121)
test2 = test + [1, 2, 3]
pri... |
class dotStringProperty_t(object):
# no doc
aName=None
aValueString=None
FatherId=None
ValueStringIteration=None
| class Dotstringproperty_T(object):
a_name = None
a_value_string = None
father_id = None
value_string_iteration = None |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License
#
# Copyright (c) 2011 Wyss Institute at Harvard University
#
# 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, i... | class Modifier(object):
"""
Modifiers do affect an applied sequence and do not store a sequence
themselves. They cause a base changed to another sequence.
Modifiers DO NOT affect the length of a strand
"""
def __init__(self, idx):
if self.__class__ == Modifier:
e = 'Modifie... |
# pylint: disable=missing-function-docstring, missing-module-docstring/
@toto # pylint: disable=undefined-variable
def f():
pass
| @toto
def f():
pass |
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
class Solution:
"""
@param root: An object of TreeNode, denote the root of the binary tree.
This method will be invoked first, you should design your own algorithm
to serialize a binary tree ... | class Treenode:
def __init__(self, val):
self.val = val
(self.left, self.right) = (None, None)
class Solution:
"""
@param root: An object of TreeNode, denote the root of the binary tree.
This method will be invoked first, you should design your own algorithm
to serialize a binary ... |
x = 50
def func(x):
print('x is',x)
x = 2
print('Changed local x to',x)
func(x)
print('x is still',x) | x = 50
def func(x):
print('x is', x)
x = 2
print('Changed local x to', x)
func(x)
print('x is still', x) |
"""Adapters for twisted.vfs.
This package provides adapters to hook up systems SFTP and FTP to the
IFileSystemLeaf and IFileSystemDirectory interfaces of VFS.
"""
| """Adapters for twisted.vfs.
This package provides adapters to hook up systems SFTP and FTP to the
IFileSystemLeaf and IFileSystemDirectory interfaces of VFS.
""" |
class WebEncoderException(Exception):
pass
class InvalidEncodingErrors(WebEncoderException):
"""Exception raised for errors in the input value of encoding_errors attribute of WebEncoder class.
Args:
message: explanation of the error
"""
def __init__(self, message=None):
self.mess... | class Webencoderexception(Exception):
pass
class Invalidencodingerrors(WebEncoderException):
"""Exception raised for errors in the input value of encoding_errors attribute of WebEncoder class.
Args:
message: explanation of the error
"""
def __init__(self, message=None):
self.messa... |
class Node():
def __init__(self, value="", frequency=0.0):
self.frequency = frequency
self.value = value
self.children = {}
self.stop = False
def __getitem__(self, key):
if key in self.children:
return self.children[key]
return None
def __set... | class Node:
def __init__(self, value='', frequency=0.0):
self.frequency = frequency
self.value = value
self.children = {}
self.stop = False
def __getitem__(self, key):
if key in self.children:
return self.children[key]
return None
def __setitem_... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"PairwiseDistance": "00_distance.ipynb",
"pairwise_dist_gram": "00_distance.ipynb",
"stackoverflow_pairwise_distance": "00_distance.ipynb",
"PairwiseDistance.stackoverflow_pairwise_... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'PairwiseDistance': '00_distance.ipynb', 'pairwise_dist_gram': '00_distance.ipynb', 'stackoverflow_pairwise_distance': '00_distance.ipynb', 'PairwiseDistance.stackoverflow_pairwise_distance': '00_distance.ipynb', 'torch_pairwise_distance': '00_dista... |
class AppUserProfile:
types = {
'username': str,
'password': str
}
def __init__(self):
self.username = None # str
self.password = None # str
| class Appuserprofile:
types = {'username': str, 'password': str}
def __init__(self):
self.username = None
self.password = None |
"""Hydra Library Tools & Applications.
"""
__all__ = (
"app", "hy", "log", "rpc", "test", "util"
)
VERSION = "2.6.5"
| """Hydra Library Tools & Applications.
"""
__all__ = ('app', 'hy', 'log', 'rpc', 'test', 'util')
version = '2.6.5' |
class Container:
def __init__(self, container=None):
if container == None or type(container) != dict:
self._container = dict()
else:
self._container = container
def __iter__(self):
return iter(self._container.items())
def addObject(self, name, object_:ob... | class Container:
def __init__(self, container=None):
if container == None or type(container) != dict:
self._container = dict()
else:
self._container = container
def __iter__(self):
return iter(self._container.items())
def add_object(self, name, object_: obj... |
# Numeral System Converter
"""
TODO
1. Convert from any system to decimal
"""
def binary_to_decimal(bin_string:str) -> int:
bin_string = str(bin_string).strip()
if not bin_string:
raise ValueError("Empty string was passed to the function")
is_negative = bin_string[0] == "-"
if is_negative:
... | """
TODO
1. Convert from any system to decimal
"""
def binary_to_decimal(bin_string: str) -> int:
bin_string = str(bin_string).strip()
if not bin_string:
raise value_error('Empty string was passed to the function')
is_negative = bin_string[0] == '-'
if is_negative:
bin_string = bin_stri... |
class AcousticParam(object):
def __init__(
self,
sampling_rate: int = 24000,
pad_second: float = 0,
threshold_db: float = None,
frame_period: int = 5,
order: int = 8,
alpha: float = 0.466,
f0_floor: float = 71,
... | class Acousticparam(object):
def __init__(self, sampling_rate: int=24000, pad_second: float=0, threshold_db: float=None, frame_period: int=5, order: int=8, alpha: float=0.466, f0_floor: float=71, f0_ceil: float=800, fft_length: int=1024, dtype: str='float32') -> None:
self.sampling_rate = sampling_rate
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 11 12:52:32 2018
@author: cyril-kubu
"""
| """
Created on Tue Sep 11 12:52:32 2018
@author: cyril-kubu
""" |
def print_vars(obj):
"""
Prints all non-private attributes variables (does not start with '_' and not method)
:param obj:
:return:
"""
for attr in dir(obj):
if attr[0] is "_" or callable(getattr(obj,attr)):
continue
print(attr, ":", getattr(obj, attr))
def print_met... | def print_vars(obj):
"""
Prints all non-private attributes variables (does not start with '_' and not method)
:param obj:
:return:
"""
for attr in dir(obj):
if attr[0] is '_' or callable(getattr(obj, attr)):
continue
print(attr, ':', getattr(obj, attr))
def print_met... |
"""
Class for storing method parameters.
"""
class JavaMethodParameter:
def __init__(self, identifier, parameter_type):
self.__identifier = identifier
self.__type = parameter_type
@property
def identifier(self):
return self.__identifier
@property
def parameter_type(self):... | """
Class for storing method parameters.
"""
class Javamethodparameter:
def __init__(self, identifier, parameter_type):
self.__identifier = identifier
self.__type = parameter_type
@property
def identifier(self):
return self.__identifier
@property
def parameter_type(self):... |
def get_headers(text):
list_a = text.split("\n")[1:]
list_headers = []
for i in list_a:
if not i:
break
list_headers.append(i.split(": "))
return dict(list_headers)
| def get_headers(text):
list_a = text.split('\n')[1:]
list_headers = []
for i in list_a:
if not i:
break
list_headers.append(i.split(': '))
return dict(list_headers) |
#WAP to find, a given number is prime or not
num = int(input("enter number"))
if num>1:
#check for factors
for i in range(2,num):
if(num / i) == 0:
print(num," is not prime number")
break
else:
print(num," is not a prime number") | num = int(input('enter number'))
if num > 1:
for i in range(2, num):
if num / i == 0:
print(num, ' is not prime number')
break
else:
print(num, ' is not a prime number') |
# Description: Print the B-factors of a residue.
# Source: placeHolder
"""
cmd.do('remove element h; iterate resi ${1: 1:13}, print(resi, name,b);')
"""
cmd.do('remove element h; iterate resi 1:13, print(resi, name,b);')
| """
cmd.do('remove element h; iterate resi ${1: 1:13}, print(resi, name,b);')
"""
cmd.do('remove element h; iterate resi 1:13, print(resi, name,b);') |
def Scenario_Generation():
# first restricting the data to April 2020 when we are predicting six weeks out from april 2020
popularity_germany = np.load("./popularity_germany.npy")
popularity_germany = np.copy(popularity_germany[:,0:63,:]) # april 20th is the 63rd index in the popularity number
#... | def scenario__generation():
popularity_germany = np.load('./popularity_germany.npy')
popularity_germany = np.copy(popularity_germany[:, 0:63, :])
one = np.multiply(np.ones((16, 42, 6)), popularity_germany[:, 62:63, :])
popularity_germany = np.append(popularity_germany, one, axis=1)
bus_movement = np... |
def L1(y_output, y_input):
""" L1 Loss Function calculates the sum of the absolute difference between the predicted and the input"""
return sum(abs(y_input - y_output)) | def l1(y_output, y_input):
""" L1 Loss Function calculates the sum of the absolute difference between the predicted and the input"""
return sum(abs(y_input - y_output)) |
# loendur dictionary
counter_dict = {}
# loe failist ridade kaupa ja loendab dictionarisse erinevad nimed
with open('/Users/mikksillaste/Downloads/aima-python/nameslist.txt') as f:
line = f.readline()
while line:
line = line.strip()
if line in counter_dict:
counter_dict[line] += 1
... | counter_dict = {}
with open('/Users/mikksillaste/Downloads/aima-python/nameslist.txt') as f:
line = f.readline()
while line:
line = line.strip()
if line in counter_dict:
counter_dict[line] += 1
else:
counter_dict[line] = 1
line = f.readline()
counter_dict2... |
def eight_is_great(a, b):
if a == 8 or b == 8:
print(":)")
elif (a + b) == 8:
print(":)")
else:
print(":(")
| def eight_is_great(a, b):
if a == 8 or b == 8:
print(':)')
elif a + b == 8:
print(':)')
else:
print(':(') |
#ChangeRenderSetting.py
##This only use in the maya software render , not in arnold
#Three main Node of Maya Render:
# ->defaultRenderGlobals, defaultRenderQuality and defaultResolution
# ->those are separate nodes in maya
'''
import maya.cmds as cmds
#Function : getRenderGlobals()
#Usage : get the Value of Rend... | """
import maya.cmds as cmds
#Function : getRenderGlobals()
#Usage : get the Value of Render Globals and print it
def getRenderGlobals() :
render_glob = "defaultRenderGlobals"
list_Attr = cmds.listAttr(render_glob,r = True,s = True)
#loop the list
print 'defaultRenderSetting As follows :'
for at... |
x = int(input())
y = int(input())
if (2 * y + 1 - x) % (y - x + 1) == 0:
print("YES")
else:
print("NO")
| x = int(input())
y = int(input())
if (2 * y + 1 - x) % (y - x + 1) == 0:
print('YES')
else:
print('NO') |
# Description
# Count how many nodes in a linked list.
# Example
# Example 1:
# Input: 1->3->5->null
# Output: 3
# Explanation:
# return the length of the list.
# Example 2:
# Input: null
# Output: 0
# Explanation:
# return the length of list.
"""
Definition of ListNode
class ListNode(object):
def... | """
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: the first node of linked list.
@return: An integer
"""
def count_nodes(self, head):
counter = 0
current = ... |
class Solution:
def longestPalindrome(self, s: str) -> str:
result = ''
pal_s = set(s)
if len(pal_s) == 1:
return s
for ind_c in range(len(s)):
pal = ''
ind_l = ind_c
ind_r = ind_c + 1
while ind_l > -1 and ind_r < len(s):
... | class Solution:
def longest_palindrome(self, s: str) -> str:
result = ''
pal_s = set(s)
if len(pal_s) == 1:
return s
for ind_c in range(len(s)):
pal = ''
ind_l = ind_c
ind_r = ind_c + 1
while ind_l > -1 and ind_r < len(s):
... |
print("@function from_script:thing")
for i in range(10):
print(f"say {i}")
| print('@function from_script:thing')
for i in range(10):
print(f'say {i}') |
nombre = input("Nombre: ")
apellido = input("Apellido: ")
edad_nac = input("Edad de nacimiento: ")
correo1 = nombre[0] + "." + apellido + edad_nac[-2:] + "@uma.es"
correo2 = nombre[:3] + apellido[:3] + edad_nac[-2:] + "@uma.es"
print("Correos:", correo1, "y", correo2)
| nombre = input('Nombre: ')
apellido = input('Apellido: ')
edad_nac = input('Edad de nacimiento: ')
correo1 = nombre[0] + '.' + apellido + edad_nac[-2:] + '@uma.es'
correo2 = nombre[:3] + apellido[:3] + edad_nac[-2:] + '@uma.es'
print('Correos:', correo1, 'y', correo2) |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param head, a ListNode
# @return a ListNode
def sortList(self, head):
if head is None or head.next is None:
return head
fast... | class Solution:
def sort_list(self, head):
if head is None or head.next is None:
return head
(fast, slow) = (head, head)
while fast.next and fast.next.next:
slow = slow.next
fast = fast.next.next
(slow.next, slow) = (None, slow.next)
(slow... |
class DiscreteActionWrapper:
def __init__(self, env, n):
self.env = env
self.action_cont = [
# [l + (_+0.5)*(h-l)/n for _ in range(n)]
# [l + _*(h-l)/(n+1) for _ in range(n)]
[l + _*(h-l)/(n-1) for _ in range(n)]
for h, l in zip(self.env.action_space.h... | class Discreteactionwrapper:
def __init__(self, env, n):
self.env = env
self.action_cont = [[l + _ * (h - l) / (n - 1) for _ in range(n)] for (h, l) in zip(self.env.action_space.high, self.env.action_space.low)]
self.env.action_space.shape = [n] * len(self.env.action_space.high)
del... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def compare(self, lleft, rright):
if (not lleft) and (not rright):
return True
elif (not lleft) or (not rrig... | class Solution:
def compare(self, lleft, rright):
if not lleft and (not rright):
return True
elif not lleft or not rright:
return False
elif lleft.val != rright.val:
return False
else:
return self.compare(lleft.left, rright.right) and ... |
class AbstractObserver(object):
"""Abstract Observer"""
def __init__(self):
self.is_stopped = False
def next(self, value):
raise NotImplementedError
def error(self, error):
raise NotImplementedError
def completed(self):
raise NotImplementedError
def on_next(... | class Abstractobserver(object):
"""Abstract Observer"""
def __init__(self):
self.is_stopped = False
def next(self, value):
raise NotImplementedError
def error(self, error):
raise NotImplementedError
def completed(self):
raise NotImplementedError
def on_next(s... |
# -*- coding: utf-8 -*-
def main():
n = int(input())
if n == 1:
print("Hello World")
else:
a = int(input())
b = int(input())
print(a + b)
if __name__ == '__main__':
main()
| def main():
n = int(input())
if n == 1:
print('Hello World')
else:
a = int(input())
b = int(input())
print(a + b)
if __name__ == '__main__':
main() |
class Message:
def __init__(self, response, type_):
self.response = response
self.type = type_
| class Message:
def __init__(self, response, type_):
self.response = response
self.type = type_ |
#!/usr/bin/python3
MAXIMIZE = 1
MINIMIZE = 2
| maximize = 1
minimize = 2 |
class StyleMapping:
def __init__(self, opts):
self._opts = opts
def __getitem__(self, key):
return getattr(self._opts, "style_{}".format(key), "").encode().decode("unicode_escape")
def apply_styles(opts, command):
return command.format_map(StyleMapping(opts))
| class Stylemapping:
def __init__(self, opts):
self._opts = opts
def __getitem__(self, key):
return getattr(self._opts, 'style_{}'.format(key), '').encode().decode('unicode_escape')
def apply_styles(opts, command):
return command.format_map(style_mapping(opts)) |
class Calculation:
def __init__(cls, a, b, op):
cls.a = float(a)
cls.b = float(b)
cls.op = op
def getResult(cls):
return cls.op(cls.a, cls.b) | class Calculation:
def __init__(cls, a, b, op):
cls.a = float(a)
cls.b = float(b)
cls.op = op
def get_result(cls):
return cls.op(cls.a, cls.b) |
"""Find the nth root of a number with the bisection method."""
__author__ = 'Nicola Moretto'
__license__ = "MIT"
def rootBisection(x, power, precision):
'''
Find the nth root of a number with the bisection method.
:param x: Number
:param power: Root
:param precision: Precision
:return: power-t... | """Find the nth root of a number with the bisection method."""
__author__ = 'Nicola Moretto'
__license__ = 'MIT'
def root_bisection(x, power, precision):
"""
Find the nth root of a number with the bisection method.
:param x: Number
:param power: Root
:param precision: Precision
:return: power-t... |
a = type('a_fyerr', (Exception,), {})
try:
raise a('aa')
except Exception as e:
print(type(e)) | a = type('a_fyerr', (Exception,), {})
try:
raise a('aa')
except Exception as e:
print(type(e)) |
expected_output = {
"Tunnel0": {
"nhs_ip": {
"111.0.0.100": {
"nhs_state": "E",
"nbma_address": "111.1.1.1",
"priority": 0,
"cluster": 0,
"req_sent": 0,
"req_failed": 0,
"reply_recv": ... | expected_output = {'Tunnel0': {'nhs_ip': {'111.0.0.100': {'nhs_state': 'E', 'nbma_address': '111.1.1.1', 'priority': 0, 'cluster': 0, 'req_sent': 0, 'req_failed': 0, 'reply_recv': 0, 'current_request_id': 94, 'protection_socket_requested': 'FALSE'}}}, 'Tunnel100': {'nhs_ip': {'100.0.0.100': {'nhs_state': 'RE', 'nbma_ad... |
def main():
with open("emotions.txt", "r") as f:
count = set(f.readlines())
print(count)
print(len(count))
if __name__ == '__main__':
main()
| def main():
with open('emotions.txt', 'r') as f:
count = set(f.readlines())
print(count)
print(len(count))
if __name__ == '__main__':
main() |
environmentdefs = {
"local": ["localhost"],
"other": ["localhost"]
}
roledefs = {
"role": ["localhost"]
}
componentdefs = {
"role": ["component"]
}
| environmentdefs = {'local': ['localhost'], 'other': ['localhost']}
roledefs = {'role': ['localhost']}
componentdefs = {'role': ['component']} |
class QueryUser:
CREATE_TABLE_USERS: str = """
CREATE TABLE IF NOT EXISTS users (
user_id INTEGER PRIMARY KEY NOT NULL,
name TEXT NOT NULL,
email TEXT NOT NULL,
phone TEXT NOT NULL,
address TEXT NOT NULL,
country TEX... | class Queryuser:
create_table_users: str = '\n CREATE TABLE IF NOT EXISTS users (\n user_id INTEGER PRIMARY KEY NOT NULL,\n name TEXT NOT NULL,\n email TEXT NOT NULL,\n phone TEXT NOT NULL,\n address TEXT NOT NULL,\n countr... |
# https://leetcode.com/problems/palindrome-linked-list/submissions/
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def isPalindrome(self, head):
"""
:type head: Lis... | class Solution(object):
def is_palindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
stack = []
temp = head
while temp:
stack.append(temp.val)
temp = temp.next
curr = head
counter = 0
while curr:
... |
class Solution:
def XXX(self, nums: List[int]) -> List[List[int]]:
res = [[]]
for num in nums:
res.append([num])
for temp in res[1:-1]:
res.append(temp+[num])
return res
| class Solution:
def xxx(self, nums: List[int]) -> List[List[int]]:
res = [[]]
for num in nums:
res.append([num])
for temp in res[1:-1]:
res.append(temp + [num])
return res |
class LCRecommendation:
TURN_LEFT = -1
TURN_RIGHT = 1
STRAIGHT_AHEAD = 0
CHANGE_TO_EITHER_WAY = 2
change_lane = True
change_to_either_way = False
recommendation = 0
def __init__(self, lane, recommendation):
self.lane = lane
self.recommendation = recommendation
... | class Lcrecommendation:
turn_left = -1
turn_right = 1
straight_ahead = 0
change_to_either_way = 2
change_lane = True
change_to_either_way = False
recommendation = 0
def __init__(self, lane, recommendation):
self.lane = lane
self.recommendation = recommendation
if... |
##
## this file autogenerated
## 8.4(6)5
##
jmp_esp_offset = "125.63.32.8"
saferet_offset = "166.11.228.8"
fix_ebp = "72"
pmcheck_bounds = "0.176.88.9"
pmcheck_offset = "96.186.88.9"
pmcheck_code = "85.49.192.137"
admauth_bounds = "0.32.8.8"
admauth_offset = "240.33.8.8"
admauth_code = "85.137.229.87"
# "8.4(6)5" = ... | jmp_esp_offset = '125.63.32.8'
saferet_offset = '166.11.228.8'
fix_ebp = '72'
pmcheck_bounds = '0.176.88.9'
pmcheck_offset = '96.186.88.9'
pmcheck_code = '85.49.192.137'
admauth_bounds = '0.32.8.8'
admauth_offset = '240.33.8.8'
admauth_code = '85.137.229.87' |
# -*- encoding: utf-8 -*-
"""
KERI
keri.vdr Package
"""
__all__ = ["issuing", "eventing", "registering", "viring", "verifying"]
| """
KERI
keri.vdr Package
"""
__all__ = ['issuing', 'eventing', 'registering', 'viring', 'verifying'] |
# class with __init__
class C1:
def __init__(self):
self.x = 1
c1 = C1()
print(type(c1) == C1)
print(c1.x)
class C2:
def __init__(self, x):
self.x = x
c2 = C2(4)
print(type(c2) == C2)
print(c2.x)
| class C1:
def __init__(self):
self.x = 1
c1 = c1()
print(type(c1) == C1)
print(c1.x)
class C2:
def __init__(self, x):
self.x = x
c2 = c2(4)
print(type(c2) == C2)
print(c2.x) |
class Fail_AuthUwU(Exception):
"""Thrown when when authentication fails
Attrs: objName
"""
def __init__(self, objName, message='sowwy {self.objName} has failed auwthenication..'):
self.objName = objName
self.message = message
super().__init__(message)
def __st... | class Fail_Authuwu(Exception):
"""Thrown when when authentication fails
Attrs: objName
"""
def __init__(self, objName, message='sowwy {self.objName} has failed auwthenication..'):
self.objName = objName
self.message = message
super().__init__(message)
def __str__(self):... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.