content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# First, we collect a url from users:
url = input("Enter the URL you'd like to clean up:\n")
remove_query_strings = input("Should we remove query strings (y/n/yes/no)?\n")
if remove_query_strings == "y" or remove_query_strings == "yes":
remove_query_strings = True
else:
remove_query_strings = False
# Remove ... | url = input("Enter the URL you'd like to clean up:\n")
remove_query_strings = input('Should we remove query strings (y/n/yes/no)?\n')
if remove_query_strings == 'y' or remove_query_strings == 'yes':
remove_query_strings = True
else:
remove_query_strings = False
if remove_query_strings:
url = url.split('?')[... |
envs = [
'dm.acrobot.swingup',
'dm.cheetah.run',
'dm.finger.turn_hard',
'dm.walker.run',
'dm.quadruped.run',
'dm.quadruped.walk',
'dm.hopper.hop',
]
times = [
1e6, 1e6, 1e6, 1e6, 2e6, 2e6, 1e6
]
sigma = 0.001
f_dims = [1024, 512, 256, 128, 64]
lr = '1e-4'
count = 0
for i, env in enume... | envs = ['dm.acrobot.swingup', 'dm.cheetah.run', 'dm.finger.turn_hard', 'dm.walker.run', 'dm.quadruped.run', 'dm.quadruped.walk', 'dm.hopper.hop']
times = [1000000.0, 1000000.0, 1000000.0, 1000000.0, 2000000.0, 2000000.0, 1000000.0]
sigma = 0.001
f_dims = [1024, 512, 256, 128, 64]
lr = '1e-4'
count = 0
for (i, env) in e... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 16 15:39:58 2022
@author: jced0001
"""
class Bias:
"""
Nanonis Bias Module
"""
def __init__(self, nanonisTCP):
self.nanonisTCP = nanonisTCP
def Set(self, bias):
"""
Set the tip voltage bias
Parameters
bias... | """
Created on Sat Apr 16 15:39:58 2022
@author: jced0001
"""
class Bias:
"""
Nanonis Bias Module
"""
def __init__(self, nanonisTCP):
self.nanonisTCP = nanonisTCP
def set(self, bias):
"""
Set the tip voltage bias
Parameters
bias (float32): bias (V)
... |
def foo():
return "foo 1"
def bar():
return "bar 1"
if __name__ == "__main__":
print(foo())
print(bar()) | def foo():
return 'foo 1'
def bar():
return 'bar 1'
if __name__ == '__main__':
print(foo())
print(bar()) |
class Comparable(object):
"""
https://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/
"""
def _compare(self, other, method):
try:
if type(other) is type(self):
return method(self._cmpkey, other._cmpkey)
return NotImplemen... | class Comparable(object):
"""
https://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/
"""
def _compare(self, other, method):
try:
if type(other) is type(self):
return method(self._cmpkey, other._cmpkey)
return NotImplemen... |
def find_node_in_list(name, l):
for i in l:
if i.name == name:
return i
return False
def remove_bag(string):
string = string.replace('bags', '') if 'bags' in string else string
string = string.replace('bag', '') if 'bag' in string else string
return string.strip()
class Link... | def find_node_in_list(name, l):
for i in l:
if i.name == name:
return i
return False
def remove_bag(string):
string = string.replace('bags', '') if 'bags' in string else string
string = string.replace('bag', '') if 'bag' in string else string
return string.strip()
class Linkedl... |
n = int(input())
ans = 0
for a in range(10 ** 5):
if a ** 2 <= n:
ans = a
else:
break
print(ans) | n = int(input())
ans = 0
for a in range(10 ** 5):
if a ** 2 <= n:
ans = a
else:
break
print(ans) |
dict = {
'apples': 7,
'oranges': 12,
'grapes': 5
}
# to get an item from a dictionary
apples = dict.get('apples') # option 1
apples1 = dict['apples'] # option 2
print(apples1)
# add items to the dict
dict['banana'] = 4
print(dict)
# remove items from the dict
dict.popitem() # removes last item fro... | dict = {'apples': 7, 'oranges': 12, 'grapes': 5}
apples = dict.get('apples')
apples1 = dict['apples']
print(apples1)
dict['banana'] = 4
print(dict)
dict.popitem()
print(dict)
dict.pop('oranges')
print(dict) |
A, B = map(int, input().split())
while A != 0 and B != 0:
X = set(map(int, input().split()))
Y = set(map(int, input().split()))
print(min(len(X-Y), len(Y-X)))
A, B = map(int, input().split())
| (a, b) = map(int, input().split())
while A != 0 and B != 0:
x = set(map(int, input().split()))
y = set(map(int, input().split()))
print(min(len(X - Y), len(Y - X)))
(a, b) = map(int, input().split()) |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'array_data_model',
'dependencies': [
'../../compiled_resources2.gyp:cr',
'../compiled_resou... | {'targets': [{'target_name': 'array_data_model', 'dependencies': ['../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:event_target'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'autocomplete_list', 'dependencies': ['list', 'list_single_selection_model',... |
class MutualExclusionRule(object):
"""Mutual exclusion rules indicate that a group of directives
probably aren't going to show up in the same date string.
('%H','%I') would be an example of mutually-exclusive directives.
MutualExclusionRule objects that are elements in the format_rules
attribute of ... | class Mutualexclusionrule(object):
"""Mutual exclusion rules indicate that a group of directives
probably aren't going to show up in the same date string.
('%H','%I') would be an example of mutually-exclusive directives.
MutualExclusionRule objects that are elements in the format_rules
attribute of ... |
########################################
# QUESTION
########################################
# Create a function (or write a script in Shell) that takes an integer as an argument
# and returns "Even" for even numbers or "Odd" for odd numbers.
###################################
# SOLUTION
############################... | def even_or_odd(number):
if number % 2 == 0:
return 'Even'
else:
return 'Odd' |
# -*- coding: utf-8 -*-
VERSION_MAJOR = '0'
VERSION_MINOR = '1'
VERSION_PATCH = '1'
VERSION_DEV = 'dev'
def version():
dev = ''
if VERSION_DEV:
dev = '-' + VERSION_DEV
return VERSION_MAJOR + '.' + VERSION_MINOR + '.' + VERSION_PATCH + dev
| version_major = '0'
version_minor = '1'
version_patch = '1'
version_dev = 'dev'
def version():
dev = ''
if VERSION_DEV:
dev = '-' + VERSION_DEV
return VERSION_MAJOR + '.' + VERSION_MINOR + '.' + VERSION_PATCH + dev |
# coding: utf-8
default_app_config = 'modernrpc.apps.ModernRpcConfig'
__version__ = '0.11.1'
| default_app_config = 'modernrpc.apps.ModernRpcConfig'
__version__ = '0.11.1' |
x = 0
if x < 2 :
print('small')
elif x < 10 :
print('Medium')
else :
print('LARGE')
print('All done')
| x = 0
if x < 2:
print('small')
elif x < 10:
print('Medium')
else:
print('LARGE')
print('All done') |
CONTENT_OPERATIONS_RESOURCES_NAMESPACE = \
'bclearer_boson_1_1_source.resources.content_universes'
ADJUSTMENT_OPERATIONS_RESOURCES_NAMESPACE = \
'bclearer_boson_1_1_source.resources.adjustment_universes'
| content_operations_resources_namespace = 'bclearer_boson_1_1_source.resources.content_universes'
adjustment_operations_resources_namespace = 'bclearer_boson_1_1_source.resources.adjustment_universes' |
class UserSource(object):
""" Generalized UserSource to facilitate ldap sync """
def __init__(self, name, bases, org=None, filters=None, user_type=None,
default_filter='(objectClass=*)',
verbose=False):
self.name = name.lower()
self._bases = bases
self... | class Usersource(object):
""" Generalized UserSource to facilitate ldap sync """
def __init__(self, name, bases, org=None, filters=None, user_type=None, default_filter='(objectClass=*)', verbose=False):
self.name = name.lower()
self._bases = bases
self.default_filter = default_filter
... |
# More About the print Function (Title)
# Reading
# Suppressing the Print Function's Ending Newline
print('one')
print('two')
print('three')
# To print space instead of newline character (new line of output)
print('one', end=' ')
print('two', end=' ')
print('three')
# To print nothing at the end of its output
print... | print('one')
print('two')
print('three')
print('one', end=' ')
print('two', end=' ')
print('three')
print('one', end='')
print('two', end='')
print('three', end='')
print('One', 'Two', 'Three')
print('One', 'Two', 'Three', sep='')
print('One', 'Two', 'Three', sep='*')
print('One', 'Two', 'Three', sep='~~~')
print('One/... |
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
PYTHON_VERSION_COMPATIBILITY = "PY2+3"
DEPS = [
'provenance',
'recipe_engine/path',
]
def RunSteps(api):
api.provenance.generate(
'projects/PROJ... | python_version_compatibility = 'PY2+3'
deps = ['provenance', 'recipe_engine/path']
def run_steps(api):
api.provenance.generate('projects/PROJECT/locations/global/keyRings/KEYRING/cryptoKeys/KEY', api.path['start_dir'].join('input.json'), api.path['cleanup'].join('output.attestation'))
api.provenance.generate('... |
class Solution:
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
d = {}
d['I'] = 1
d['IV'] = 4
d['V'] = 5
d['IX'] = 9
d['X'] = 10
d['XL'] = 40
d['L'] = 50
d['XC'] = 90
d['C'] = 100
d['CD'... | class Solution:
def roman_to_int(self, s):
"""
:type s: str
:rtype: int
"""
d = {}
d['I'] = 1
d['IV'] = 4
d['V'] = 5
d['IX'] = 9
d['X'] = 10
d['XL'] = 40
d['L'] = 50
d['XC'] = 90
d['C'] = 100
d['... |
#
# PySNMP MIB module BASIS-GENERIC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BASIS-GENERIC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:34:35 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint, constraints_union) ... |
# -*- coding: utf-8 -*-
"""
In this module will be defined all constanst about Beauty & Pics
"""
class project_constants(object):
# contest status {{{
CONTEST_OPENING = "opening"
CONTEST_ACTIVE = "active"
CONTEST_CLOSED = "closed"
# contest status }}}
# contest types {{{
MAN_CONTEST = "man... | """
In this module will be defined all constanst about Beauty & Pics
"""
class Project_Constants(object):
contest_opening = 'opening'
contest_active = 'active'
contest_closed = 'closed'
man_contest = 'man-contest'
woman_contest = 'woman-contest'
man_gender = 'man'
woman_gender = 'woman'
... |
def sort_012(input_arr):
"""
Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal.
Time Complexity O(n)
Space Complexity O(n)
Where n is the array size.
Args:
input_arr(array): Array to be sorted
Returns:
sorted_arr(array): ... | def sort_012(input_arr):
"""
Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal.
Time Complexity O(n)
Space Complexity O(n)
Where n is the array size.
Args:
input_arr(array): Array to be sorted
Returns:
sorted_arr(array): ... |
class Solution:
def XXX(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
temp = 0
for i in range(len(nums)):
if temp:
i -= temp
if nums[i] == 0:
nums.pop(i)
nu... | class Solution:
def xxx(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
temp = 0
for i in range(len(nums)):
if temp:
i -= temp
if nums[i] == 0:
nums.pop(i)
n... |
"""
#!/usr/bin/python
#Author: Suraj Patil
#Version: 2.0
#Date: 27th March 2014
input:
1. this is a dummy text
2. another dummy text
3. this is dummy
4. this is also dummy
output:
this is a dummy text
another dummy text
this is dummy
this is also dummy
"""
f = open('text', 'r')
f1= open('textModified', ... | """
#!/usr/bin/python
#Author: Suraj Patil
#Version: 2.0
#Date: 27th March 2014
input:
1. this is a dummy text
2. another dummy text
3. this is dummy
4. this is also dummy
output:
this is a dummy text
another dummy text
this is dummy
this is also dummy
"""
f = open('text', 'r')
f1 = open('textModified',... |
class MinStack(object):
def __init__(self):
self.stack = []
def push(self, x):
self.stack.append((x, min(self.getMin(), x)))
def pop(self):
self.stack.pop()
def top(self):
return self.stack[-1][0]
def getMin(self):
return self.stack[-1][1] if self.stack e... | class Minstack(object):
def __init__(self):
self.stack = []
def push(self, x):
self.stack.append((x, min(self.getMin(), x)))
def pop(self):
self.stack.pop()
def top(self):
return self.stack[-1][0]
def get_min(self):
return self.stack[-1][1] if self.stack ... |
graph = {"A": ["B", "C"], "B": ["D", "E"], "C": ["F"], "D": [], "E": ["F"], "F": []}
visited = set()
def dfs(visited, graph, node):
if node not in visited:
print(node)
visited.add(node)
for neighbour in graph[node]:
dfs(visited, graph, neighbour)
if __name__ == "__main__":
... | graph = {'A': ['B', 'C'], 'B': ['D', 'E'], 'C': ['F'], 'D': [], 'E': ['F'], 'F': []}
visited = set()
def dfs(visited, graph, node):
if node not in visited:
print(node)
visited.add(node)
for neighbour in graph[node]:
dfs(visited, graph, neighbour)
if __name__ == '__main__':
'... |
# Definition for an interval.
# class Interval:
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution:
# @param intervals, a list of Intervals
# @param newInterval, a Interval
# @return a list of Interval
def insert(self, intervals, newInterval):
re... | class Solution:
def insert(self, intervals, newInterval):
res = []
if len(intervals) == 0:
res.append(newInterval)
return res
intervals.append(newInterval)
intervals.sort(key=lambda x: x.start)
res.append(intervals[0])
for i in range(1, len(in... |
class dotIFC2X3_Application_t(object):
# no doc
ApplicationFullName=None
ApplicationIdentifier=None
Version=None
| class Dotifc2X3_Application_T(object):
application_full_name = None
application_identifier = None
version = None |
class LaunchAPIException(Exception):
def __init__(self, message, status_code):
super(Exception, self).__init__(message)
self.status_code = status_code
class ClientException(LaunchAPIException):
pass
| class Launchapiexception(Exception):
def __init__(self, message, status_code):
super(Exception, self).__init__(message)
self.status_code = status_code
class Clientexception(LaunchAPIException):
pass |
def main():
OnFwd(OUT_AB, 80)
TextOut(0, LCD_LINE1, 20)
Wait(2000)
| def main():
on_fwd(OUT_AB, 80)
text_out(0, LCD_LINE1, 20)
wait(2000) |
FreeMonoOblique9pt7bBitmaps = [
0x11, 0x22, 0x24, 0x40, 0x00, 0xC0, 0xDE, 0xE5, 0x29, 0x00, 0x09, 0x05,
0x02, 0x82, 0x47, 0xF8, 0xA0, 0x51, 0xFE, 0x28, 0x14, 0x0A, 0x09, 0x00,
0x08, 0x1D, 0x23, 0x40, 0x70, 0x1C, 0x02, 0x82, 0x84, 0x78, 0x20, 0x20,
0x1C, 0x11, 0x08, 0x83, 0x80, 0x18, 0x71, 0xC0, 0x1C, 0x... | free_mono_oblique9pt7b_bitmaps = [17, 34, 36, 64, 0, 192, 222, 229, 41, 0, 9, 5, 2, 130, 71, 248, 160, 81, 254, 40, 20, 10, 9, 0, 8, 29, 35, 64, 112, 28, 2, 130, 132, 120, 32, 32, 28, 17, 8, 131, 128, 24, 113, 192, 28, 17, 8, 131, 128, 30, 96, 129, 3, 10, 101, 70, 136, 232, 250, 128, 18, 36, 72, 136, 136, 136, 128, 1, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of easy-drf.
# https://github.com/talp101/easy-drf.git
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2015, Tal Peretz <13@1500.co.il>
__version__ = '0.1.2' # NOQA
| __version__ = '0.1.2' |
class Solution:
# @param dictionary: a list of strings
# @return: a list of strings
def longestWords(self, dictionary):
def word_len_list(dictionary):
wd_list =[]
for word in dictionary:
wd_list.append(len(word))
return max(wd_list)
def fi... | class Solution:
def longest_words(self, dictionary):
def word_len_list(dictionary):
wd_list = []
for word in dictionary:
wd_list.append(len(word))
return max(wd_list)
def find_word(dictionary):
result = []
for word in dic... |
def normalize(s: str) -> str:
"""
Filter out '\n' and translate multiple ' ' into one ' '
:param s: String to normalize
:return: normalized str
"""
s = list(filter(lambda x: x != '\n', s))
ret_s = ""
i = 0
while i < len(s):
ret_s += s[i]
if s[i] == ' ':
... | def normalize(s: str) -> str:
"""
Filter out '
' and translate multiple ' ' into one ' '
:param s: String to normalize
:return: normalized str
"""
s = list(filter(lambda x: x != '\n', s))
ret_s = ''
i = 0
while i < len(s):
ret_s += s[i]
if s[i] == ' ':
... |
@jit(nopython=True)
def pressure_poisson(p, b, l2_target):
I, J = b.shape
iter_diff = l2_target + 1
n = 0
while iter_diff > l2_target and n <= 500:
pn = p.copy()
for i in range(1, I - 1):
for j in range(1, J - 1):
p[i, j] = (.25 * (pn[i, j + 1] +
... | @jit(nopython=True)
def pressure_poisson(p, b, l2_target):
(i, j) = b.shape
iter_diff = l2_target + 1
n = 0
while iter_diff > l2_target and n <= 500:
pn = p.copy()
for i in range(1, I - 1):
for j in range(1, J - 1):
p[i, j] = 0.25 * (pn[i, j + 1] + pn[i, j - 1... |
'''
The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both indicate a que... | """
The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both indicate a que... |
def findAllDuplicates(nums):
d = dict()
for i in nums:
d[i] = d.get(i, 0) + 1
dup = list()
print(d)
for i in d:
if d[i] == 2:
dup.append(i)
return dup
nums = [4, 3, 2, 7, 8, 2, 3, 1]
dup = findAllDuplicates(nums)
print(dup) | def find_all_duplicates(nums):
d = dict()
for i in nums:
d[i] = d.get(i, 0) + 1
dup = list()
print(d)
for i in d:
if d[i] == 2:
dup.append(i)
return dup
nums = [4, 3, 2, 7, 8, 2, 3, 1]
dup = find_all_duplicates(nums)
print(dup) |
##sq=lambda x:x**2
##res=sq(5)
##print("square is:",res)
##
##
##
##add=lambda x,y,z:x+y+z
##
##
##print("sum is:",add(2,3,4))
##
##l=[1,2,3,4,5]
##li=list(map(lambda x:x**3,l))
##print(li)
t=(1,2,3,4,5)
def sum(x):
return x+10
a=list(map(sum,t))
print(a)
| t = (1, 2, 3, 4, 5)
def sum(x):
return x + 10
a = list(map(sum, t))
print(a) |
def iterative(array, element, sort=False):
"""
Perform Binary Search by Iterative Method.
:param array: Iterable of elements.
:param element: element to search.
:param sort: True will sort the array first then search. By default = False.
:return: returns value of index of element (if found) else... | def iterative(array, element, sort=False):
"""
Perform Binary Search by Iterative Method.
:param array: Iterable of elements.
:param element: element to search.
:param sort: True will sort the array first then search. By default = False.
:return: returns value of index of element (if found) else... |
class WordDistanceFinder:
"""
This class will be given a list of words (such as might be tokenized
from a paragraph of text), and will provide a method that takes two
words and returns the shortest distance (in words) between those two
words in the provided text.
::
finder = WordDistance... | class Worddistancefinder:
"""
This class will be given a list of words (such as might be tokenized
from a paragraph of text), and will provide a method that takes two
words and returns the shortest distance (in words) between those two
words in the provided text.
::
finder = WordDistance... |
# Title : TODO
# Objective : TODO
# Created by: Wenzurk
# Created on: 2018/2/3
transportation = ['bicycle', 'motorcycle', 'car', 'airplane']
message = 'I would like to own a '
print(message + transportation[0] + ".")
print(message + transportation[1] + ".")
print(message + transportation[2] + ".")
print(message + ... | transportation = ['bicycle', 'motorcycle', 'car', 'airplane']
message = 'I would like to own a '
print(message + transportation[0] + '.')
print(message + transportation[1] + '.')
print(message + transportation[2] + '.')
print(message + transportation[3] + '.') |
def solution(x, y):
x = int(x)
y = int(y)
numCycles = 0
while (x > 1 or y > 1):
if (x == y or x < 1 or y < 1):
return "impossible"
elif (x > y):
factor = int(x/y)
numCycles+=factor
if (y == 1):
numCycles-=1
... | def solution(x, y):
x = int(x)
y = int(y)
num_cycles = 0
while x > 1 or y > 1:
if x == y or x < 1 or y < 1:
return 'impossible'
elif x > y:
factor = int(x / y)
num_cycles += factor
if y == 1:
num_cycles -= 1
... |
valores = [1, 2, 3, 4, 5, 6, 7, 8, 9]
pares = list(filter(lambda x : x % 2 == 0, valores))
impares = list(filter(lambda x : x % 2 != 0, valores))
print(pares)
print(impares)
| valores = [1, 2, 3, 4, 5, 6, 7, 8, 9]
pares = list(filter(lambda x: x % 2 == 0, valores))
impares = list(filter(lambda x: x % 2 != 0, valores))
print(pares)
print(impares) |
# -*- coding: utf-8 -*-
"""Library for components to support modularity."""
MESSAGE_CLASSES = {}
SEGMENT_CLASSES = {}
| """Library for components to support modularity."""
message_classes = {}
segment_classes = {} |
cpf = '04045683941'
novo_cpf = cpf[:-2]#selecionando os 9 primeiros e deixando os dois ultimos #040456839
reverso = 10
total = 0
for index in range(19):
if index > 8:
index -= 9
total += int(novo_cpf[index]) * reverso
print(cpf [index], index), reverso
reverso -= 1
if reverso < 2:
... | cpf = '04045683941'
novo_cpf = cpf[:-2]
reverso = 10
total = 0
for index in range(19):
if index > 8:
index -= 9
total += int(novo_cpf[index]) * reverso
(print(cpf[index], index), reverso)
reverso -= 1
if reverso < 2:
reverso = 11 |
# -*- coding: utf-8 -*-
""" Manifest App Information
Some codes used in this project is collected
from several open source projects, such as;
Django: https://github.com/django/django
django-rest-framework: https://github.com/encode/django-rest-framework
django-rest-auth: https://github.com/Tivix/django-rest-auth
djang... | """ Manifest App Information
Some codes used in this project is collected
from several open source projects, such as;
Django: https://github.com/django/django
django-rest-framework: https://github.com/encode/django-rest-framework
django-rest-auth: https://github.com/Tivix/django-rest-auth
django-userena-ce: https://gi... |
# Angold4 20200620 4.1
def normal_max(S):
Max = S[0]
for i in S:
if i > Max:
Max = i
return Max
def find_max(S):
"""answer"""
if len(S) == 1:
return S[0]
Max = S.pop()
return max(Max, find_max(S))
if __name__ == "__main__":
s = [1, 4, 4, 7, 3, 2, 20, 34, 9... | def normal_max(S):
max = S[0]
for i in S:
if i > Max:
max = i
return Max
def find_max(S):
"""answer"""
if len(S) == 1:
return S[0]
max = S.pop()
return max(Max, find_max(S))
if __name__ == '__main__':
s = [1, 4, 4, 7, 3, 2, 20, 34, 90, 133, 113, 123, 5, 9, 29... |
class StubSoundPlayer:
def __init__(self):
pass
def play_once(self, filename):
pass
def set_music_volume(self, new_volume):
pass
def change_music(self):
pass
def play_sound_event(self, sound_event):
pass
def process_events(self, sound_event_list):... | class Stubsoundplayer:
def __init__(self):
pass
def play_once(self, filename):
pass
def set_music_volume(self, new_volume):
pass
def change_music(self):
pass
def play_sound_event(self, sound_event):
pass
def process_events(self, sound_event_list):
... |
t = int(input())
for i in range(t):
n, m = input().split()
n = int(n)
m = int(m)
print((n-1)*(m-1)) | t = int(input())
for i in range(t):
(n, m) = input().split()
n = int(n)
m = int(m)
print((n - 1) * (m - 1)) |
class Solution:
def maximalSquare(self, matrix: List[List[str]]) -> int:
if len(matrix)<1:
return 0
dp=[[0 for i in range(len(matrix[0])+1)] for j in range(len(matrix)+1)]
max1=0
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if m... | class Solution:
def maximal_square(self, matrix: List[List[str]]) -> int:
if len(matrix) < 1:
return 0
dp = [[0 for i in range(len(matrix[0]) + 1)] for j in range(len(matrix) + 1)]
max1 = 0
for i in range(len(matrix)):
for j in range(len(matrix[0])):
... |
#
# Common constants
#
APP_NAME = 'autonom'
DEFAULT_CONFIG_FILE = 'autonom.ini'
DEFAULT_SESSMGR = 'ticket'
# We do this to convert run-time errors into compile time errors
CF_DEFAULT = 'DEFAULT'
CF_LISTEN = 'listen'
CF_PORT = 'port'
CF_PROVIDERS = 'providers'
CF_FIXED_IP_LIST = 'fixed_ip_list'
CF_LOG = 'log'
CF_LOG_... | app_name = 'autonom'
default_config_file = 'autonom.ini'
default_sessmgr = 'ticket'
cf_default = 'DEFAULT'
cf_listen = 'listen'
cf_port = 'port'
cf_providers = 'providers'
cf_fixed_ip_list = 'fixed_ip_list'
cf_log = 'log'
cf_log_ex = 'log_data'
cf_provider = 'provider'
cf_id = 'id'
cf_href = 'href'
cf_desc = 'desc'
cf_... |
class BudgetNotFound(Exception):
pass
class WrongPushException(Exception):
def __init__(self, expected_delta, delta):
self.expected_delta = expected_delta
self.delta = delta
string = 'tried to push a changed_entities with %d entities while we expected %d entities'
@property
def m... | class Budgetnotfound(Exception):
pass
class Wrongpushexception(Exception):
def __init__(self, expected_delta, delta):
self.expected_delta = expected_delta
self.delta = delta
string = 'tried to push a changed_entities with %d entities while we expected %d entities'
@property
def ms... |
#Source : https://leetcode.com/problems/insertion-sort-list/
#Author : Yuan Wang
#Date : 2021-02-01
'''
**********************************************************************************
*Sort a linked list using insertion sort.
*
*Example1 :
*Input: 4->2->1->3
*Output: 1->2->3->4
***********************************... | """
**********************************************************************************
*Sort a linked list using insertion sort.
*
*Example1 :
*Input: 4->2->1->3
*Output: 1->2->3->4
**********************************************************************************/
"""
def insertion_sort_list(self, head: ListNode) ->... |
class ScoreCache:
def __init__(self):
self.parent_cache = dict()
self.child_cache = dict()
self.joint_cache = dict()
def print(self):
print("____CACHE_____")
print("parents->(parent_states,parent_states_counts)")
print(self.parent_cache)
print("child->child_states_counts")
print(self.child... | class Scorecache:
def __init__(self):
self.parent_cache = dict()
self.child_cache = dict()
self.joint_cache = dict()
def print(self):
print('____CACHE_____')
print('parents->(parent_states,parent_states_counts)')
print(self.parent_cache)
print('child->ch... |
Config = {
'game': {
'height': 640,
'width': 800,
'tile_width': 32
},
'resources': {
'sprites': {
'player': "src/res/char.png"
}
}
}
| config = {'game': {'height': 640, 'width': 800, 'tile_width': 32}, 'resources': {'sprites': {'player': 'src/res/char.png'}}} |
def find_binary_partitioned_seat(seat_range, input_text):
for letter in input_text:
difference = abs(seat_range[0] - seat_range[1]) // 2
if (letter == "F") or (letter == "L"):
seat_range = [seat_range[0], seat_range[0] + difference]
else:
seat_range = [seat_range[1] -... | def find_binary_partitioned_seat(seat_range, input_text):
for letter in input_text:
difference = abs(seat_range[0] - seat_range[1]) // 2
if letter == 'F' or letter == 'L':
seat_range = [seat_range[0], seat_range[0] + difference]
else:
seat_range = [seat_range[1] - dif... |
f = open('input.txt', 'r')
row = f.read()
data = row.split()
result = 0
children = {0: 1}
metadata = {}
deep = 1
slot = 2
for i in data:
i = int(i)
if slot == 2 and children[deep - 1] > 0 and (deep not in metadata or metadata[deep] == 0):
children[deep] = i
children[deep - 1] -= 1
slot ... | f = open('input.txt', 'r')
row = f.read()
data = row.split()
result = 0
children = {0: 1}
metadata = {}
deep = 1
slot = 2
for i in data:
i = int(i)
if slot == 2 and children[deep - 1] > 0 and (deep not in metadata or metadata[deep] == 0):
children[deep] = i
children[deep - 1] -= 1
slot =... |
class Event:
def __init__(self, time):
self.time = time
def __lt__(self, other):
return self.time < other.time
def __le__(self, other):
return self < other or self.time == other.time
class InjectEvent(Event):
def __init__(self, time, packet):
super(InjectEvent, self).__init__(time)
self.packet = packet... | class Event:
def __init__(self, time):
self.time = time
def __lt__(self, other):
return self.time < other.time
def __le__(self, other):
return self < other or self.time == other.time
class Injectevent(Event):
def __init__(self, time, packet):
super(InjectEvent, self)... |
problems = input().split(";")
count = 0
for problem in problems:
if "-" in problem:
upper = problem.split("-")[1]
lower = problem.split("-")[0]
count += int(upper) - int(lower) + 1
else:
count += 1
print(count)
| problems = input().split(';')
count = 0
for problem in problems:
if '-' in problem:
upper = problem.split('-')[1]
lower = problem.split('-')[0]
count += int(upper) - int(lower) + 1
else:
count += 1
print(count) |
# game states
IN_PROGRESS = 0
PLAYER1 = 1
PLAYER2 = 2
DRAW = 3
GAME_STATES = {"IN_PROGRESS": IN_PROGRESS,
"PLAYER1": PLAYER1,
"PLAYER2": PLAYER2,
"DRAW": DRAW}
| in_progress = 0
player1 = 1
player2 = 2
draw = 3
game_states = {'IN_PROGRESS': IN_PROGRESS, 'PLAYER1': PLAYER1, 'PLAYER2': PLAYER2, 'DRAW': DRAW} |
# Do not edit. bazel-deps autogenerates this file from maven_deps.yaml.
def declare_maven(hash):
native.maven_jar(
name = hash["name"],
artifact = hash["artifact"],
sha1 = hash["sha1"],
repository = hash["repository"]
)
native.bind(
name = hash["bind"],
actua... | def declare_maven(hash):
native.maven_jar(name=hash['name'], artifact=hash['artifact'], sha1=hash['sha1'], repository=hash['repository'])
native.bind(name=hash['bind'], actual=hash['actual'])
def maven_dependencies(callback=declare_maven):
callback({'artifact': 'args4j:args4j:2.33', 'lang': 'java', 'sha1':... |
# Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place.
# Example 1:
# Input:
# [
# [1,1,1],
# [1,0,1],
# [1,1,1]
# ]
# Output:
# [
# [1,0,1],
# [0,0,0],
# [1,0,1]
# ]
class Solution:
def setZeroes(self, matrix):
"""
:type matrix: List[List[in... | class Solution:
def set_zeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
(n, m) = (len(matrix), len(matrix[0]))
(row, col) = (set(), set())
for i in range(n):
for j in... |
class Function(object):
"""Data-class to hold meta information about a registered back-end function.
"""
def __init__(self, rule, f):
self.rule = rule
self.f = f
| class Function(object):
"""Data-class to hold meta information about a registered back-end function.
"""
def __init__(self, rule, f):
self.rule = rule
self.f = f |
class Location(object):
"""docstring for Location"""
def __init__(self, lat=0, lon=0):
self._lat = lat
self._lon = lon
def __str__(self):
return "Location(%s,%s)" % (self._lat, self._lon)
def __unicode__(self):
return u"Location(%s,%s)" % (self._lat, self._lon)
@property
def lat(self):
return self._l... | class Location(object):
"""docstring for Location"""
def __init__(self, lat=0, lon=0):
self._lat = lat
self._lon = lon
def __str__(self):
return 'Location(%s,%s)' % (self._lat, self._lon)
def __unicode__(self):
return u'Location(%s,%s)' % (self._lat, self._lon)
@p... |
A_COMMA = ","
A_QUOTE = "'"
DOUBLE_QUOTES = '"'
A_TAB = " "
AN_ESCAPED_TAB = "\t"
NEWLINE = """
"""
AN_ESCAPED_NEWLINE = "\n"
| a_comma = ','
a_quote = "'"
double_quotes = '"'
a_tab = '\t'
an_escaped_tab = '\t'
newline = '\n'
an_escaped_newline = '\n' |
"""
[4/14/2014] Challenge #158 [Easy] The Torn Number
https://www.reddit.com/r/dailyprogrammer/comments/230m05/4142014_challenge_158_easy_the_torn_number/
#Description:
I had the other day in my possession a label bearing the number 3 0 2 5 in large figures. This got accidentally torn in
half, so that 3 0 was on one ... | """
[4/14/2014] Challenge #158 [Easy] The Torn Number
https://www.reddit.com/r/dailyprogrammer/comments/230m05/4142014_challenge_158_easy_the_torn_number/
#Description:
I had the other day in my possession a label bearing the number 3 0 2 5 in large figures. This got accidentally torn in
half, so that 3 0 was on one ... |
def zebra_2(x,y):
pattern=["/","/","/","-","-","-"]
z=0
while z<y:
for i in range(0,x):
print(pattern[i % len(pattern)], end='')
z+=1
print("\n")
x=int(input("give me a number of charcters in the row:" ))
y=int(input("give me a number of rows:" ))
zebra_2(x,y)
| def zebra_2(x, y):
pattern = ['/', '/', '/', '-', '-', '-']
z = 0
while z < y:
for i in range(0, x):
print(pattern[i % len(pattern)], end='')
z += 1
print('\n')
x = int(input('give me a number of charcters in the row:'))
y = int(input('give me a number of rows:'))
zebra_2... |
weather_appid = "12345678"
weather_appsecret = "abcdefg"
baidu_map_ak = "dfjkal;fjalskf;as"
| weather_appid = '12345678'
weather_appsecret = 'abcdefg'
baidu_map_ak = 'dfjkal;fjalskf;as' |
class FailedRunException(Exception):
"""
raised when an a run has not succeeded
"""
class BackendNotAvailableException(Exception):
"""
raise when a Backend is ill-configured
"""
| class Failedrunexception(Exception):
"""
raised when an a run has not succeeded
"""
class Backendnotavailableexception(Exception):
"""
raise when a Backend is ill-configured
""" |
first, second, year = map(int, input().split())
if first == second:
print(1)
elif first < 13 and second < 13:
print(0)
else:
print(1) | (first, second, year) = map(int, input().split())
if first == second:
print(1)
elif first < 13 and second < 13:
print(0)
else:
print(1) |
# Converts the rows of data, with the specified
# headers, into an easily human readable csv string.
def readable_csv(rows, headers, digits=None):
if digits is not None:
for i, row in enumerate(rows):
for j, col in enumerate(row):
if isinstance(col, float):
rows[i][j] = round(col, digits)
# First, stri... | def readable_csv(rows, headers, digits=None):
if digits is not None:
for (i, row) in enumerate(rows):
for (j, col) in enumerate(row):
if isinstance(col, float):
rows[i][j] = round(col, digits)
rows = [[str(c) for c in row] for row in rows]
widths = [ma... |
# Short help
def display_summary():
print("{:<13}{}".format( 'mount', "Creates a semi-tracked/local copy of a SCM Repository" ))
# DOCOPT command line definition
USAGE = """
Creates a semi-tracked/local copy of the specified repository/branch/reference
==============================================================... | def display_summary():
print('{:<13}{}'.format('mount', 'Creates a semi-tracked/local copy of a SCM Repository'))
usage = "\nCreates a semi-tracked/local copy of the specified repository/branch/reference\n===============================================================================\nusage: evie [common-opts] moun... |
class PLSR_SSS_Helper(object):
def __init__(self,train_data,X,mse,msemin,component,y,y_c,y_cv,attribute,importance,
prediction,dir_path,reportpath,prediction_map,modelsavepath,img_path,tran_path):
self.train_data = train_data
self.X = X
self.mse = mse
self.msemin = ... | class Plsr_Sss_Helper(object):
def __init__(self, train_data, X, mse, msemin, component, y, y_c, y_cv, attribute, importance, prediction, dir_path, reportpath, prediction_map, modelsavepath, img_path, tran_path):
self.train_data = train_data
self.X = X
self.mse = mse
self.msemin = m... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 20 07:12:02 2018
@author: vishn
"""
| """
Created on Tue Nov 20 07:12:02 2018
@author: vishn
""" |
# Symmetric Difference
# Problem Link: https://www.hackerrank.com/challenges/symmetric-difference/problem
m = int(input())
marr = set(map(int, input().split()))
n = int(input())
narr = set(map(int, input().split()))
for x in sorted(marr ^ narr):
print(x)
| m = int(input())
marr = set(map(int, input().split()))
n = int(input())
narr = set(map(int, input().split()))
for x in sorted(marr ^ narr):
print(x) |
class Scene:
def __init__(self, camera, shapes, materials, lights):
self.camera = camera
self.shapes = shapes
self.materials = materials
self.lights = lights
| class Scene:
def __init__(self, camera, shapes, materials, lights):
self.camera = camera
self.shapes = shapes
self.materials = materials
self.lights = lights |
"""
entradas
salario-->int-->s
categoria-->int-->c
Salidas
aumento-->str-->au
salario nuevo-->str-->sn
"""
s = int(input("Digite el salario $"))
c = int(input("Digite una categoria del 1 al 5: "))
if (c == 1):
a = s*0.10
if (c == 2):
a = s*0.15
if (c == 3):
a = s*0.20
if (c == 4):
a = s*0.40
if (c == 5):
a = ... | """
entradas
salario-->int-->s
categoria-->int-->c
Salidas
aumento-->str-->au
salario nuevo-->str-->sn
"""
s = int(input('Digite el salario $'))
c = int(input('Digite una categoria del 1 al 5: '))
if c == 1:
a = s * 0.1
if c == 2:
a = s * 0.15
if c == 3:
a = s * 0.2
if c == 4:
a = s * 0.4
if c == 5:... |
"""
Set of processes for being in mult-processor mode within spatial package
# Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry)
# Date: 11.01.17
"""
__author__ = 'martinez'
####### HELPING FUNCTIONS
####### PROCESSES
# Radial Averaged Fourier Transform alone process
# points: array with poi... | """
Set of processes for being in mult-processor mode within spatial package
# Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry)
# Date: 11.01.17
"""
__author__ = 'martinez'
def pr_uni_raft(points, ids, dense, mask, mpa):
pass |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | """Utils to process outputs to output_base in rbe_autoconf."""
load('//rules/rbe_repo:util.bzl', 'CC_CONFIG_DIR', 'JAVA_CONFIG_DIR', 'PLATFORM_DIR', 'print_exec_results')
def expand_outputs(ctx, bazel_version, project_root):
"""
Copies all outputs of the autoconfig rule to a directory in the project.
Also... |
# https://leetcode.com/problems/climbing-stairs/
class Solution:
# def climbStairs(self, n: int) -> int:
# array = [1, 2]
# for i in range(2, n+1):
# array.append(array[i-1] + array[i-2])
# return array[n-1]
def climbStairs(self, n: int) -> int:
if n <= 2:
... | class Solution:
def climb_stairs(self, n: int) -> int:
if n <= 2:
return n
(f1, f2, f3) = (1, 2, 3)
for i in range(3, n + 1):
f3 = f1 + f2
f1 = f2
f2 = f3
return f3
print(solution().climbStairs(1))
print(solution().climbStairs(2))
prin... |
"""
The ska_tmc_cdm.messages.mccssubarray contains code that models the structured
command arguments, command responses, and attribute values for the
MCCSSubarray Tango device.
"""
| """
The ska_tmc_cdm.messages.mccssubarray contains code that models the structured
command arguments, command responses, and attribute values for the
MCCSSubarray Tango device.
""" |
def filter_data(data):
"""
Front function to filter data to perform a train
Args:
data (pd.DataFrame): a pandas dataframe with the non-filtered data
Returns:
filtered_data (pd.DataFrame): a pandas dataframe with the filtered data
"""
filtered_data = data.copy()
... | def filter_data(data):
"""
Front function to filter data to perform a train
Args:
data (pd.DataFrame): a pandas dataframe with the non-filtered data
Returns:
filtered_data (pd.DataFrame): a pandas dataframe with the filtered data
"""
filtered_data = data.copy()
... |
# HAUL Resources
def get(i):
return None
def use(filename):
# Do nothing, it is overridden when testing; in order to load resources at runtime
return -1 | def get(i):
return None
def use(filename):
return -1 |
def failure_message(message=None, user=None, user_group=None):
resp = '''Message failed to send, please try again later or contact administrator
from: Broadcast Admin
- Only you can see this message
'''
return resp
| def failure_message(message=None, user=None, user_group=None):
resp = 'Message failed to send, please try again later or contact administrator\n from: Broadcast Admin\n - Only you can see this message\n '
return resp |
n_str = input()
n = int(n_str)
if (n == 1):
print(1.000000000000)
else:
sum = 0.000000000000
for i in range(1, n+1):
sum += round((1.000000000000)/i, 12)
print(sum)
| n_str = input()
n = int(n_str)
if n == 1:
print(1.0)
else:
sum = 0.0
for i in range(1, n + 1):
sum += round(1.0 / i, 12)
print(sum) |
def is_rotation(s, t):
"""
Returns True iff s is a rotated version of t.
"""
return len(s) == len(t) and s in t + t
if __name__ == "__main__":
testStringPairs = [
("", ""),
("stackoverflow", "flowstackover"),
("12345", "5xy1234"),
("stackoverflaw", "overflowstack")
... | def is_rotation(s, t):
"""
Returns True iff s is a rotated version of t.
"""
return len(s) == len(t) and s in t + t
if __name__ == '__main__':
test_string_pairs = [('', ''), ('stackoverflow', 'flowstackover'), ('12345', '5xy1234'), ('stackoverflaw', 'overflowstack')]
for (index, pair) in enumera... |
class Redirect:
def __init__(self, url: str = ""):
self.redirect_url = url
def to_dict(self):
tmp_dict = {
"redirect_url": self.redirect_url,
}
return tmp_dict | class Redirect:
def __init__(self, url: str=''):
self.redirect_url = url
def to_dict(self):
tmp_dict = {'redirect_url': self.redirect_url}
return tmp_dict |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | """Rules for auto-generating the Paths_* module needed in third-party.
Some third-party Haskell packages use a Paths_{package_name}.hs file
which is auto-generated by Cabal. That file lets them
- Get the package's current version number
- Find useful data file
This file exports the "cabal_paths" rule for auto-genera... |
#!/usr/bin/python
array = [0] * 43
Top = 1
Bottom = 2
Far = 4
Near = 8
Left = 16
Right = 32
scopeName = 'FDataConstants::'
#Edge map
array[Top + Far] = 'TopFar'
array[Top + Near] = 'TopNear'
array[Top + Left] = 'FTopLeft'
array[Top + Right] = 'TopRigh... | array = [0] * 43
top = 1
bottom = 2
far = 4
near = 8
left = 16
right = 32
scope_name = 'FDataConstants::'
array[Top + Far] = 'TopFar'
array[Top + Near] = 'TopNear'
array[Top + Left] = 'FTopLeft'
array[Top + Right] = 'TopRight'
array[Bottom + Far] = 'BottomFar'
array[Bottom + Near] = 'BottomNear'
array[Bottom + Left] = ... |
class Website(object):
def __init__(self, site):
self.URL = site
class Internet(object):
def __init__(self):
self.url_list = dict()
def add_url(self, website):
if website.URL in self.url_list:
self.url_list[website.URL] += 1
else:
self.url_list[webs... | class Website(object):
def __init__(self, site):
self.URL = site
class Internet(object):
def __init__(self):
self.url_list = dict()
def add_url(self, website):
if website.URL in self.url_list:
self.url_list[website.URL] += 1
else:
self.url_list[web... |
max= 0
a = 2
b = 3
if a < b: max= b
if b < a: max= a
assert (max == a or max == b) and max >= a and max >= b
| max = 0
a = 2
b = 3
if a < b:
max = b
if b < a:
max = a
assert (max == a or max == b) and max >= a and (max >= b) |
def rotateLeft(array_list , num_rotate ):
alist = list(array_list)
rotated_list = alist[num_rotate :]+alist[:num_rotate ]
return rotated_list
array_list = []
n = int(input("Enter number of elements in array list : "))
for i in range(0, n):
elem = int(input())
array_list.append(elem)
num_rotate=int... | def rotate_left(array_list, num_rotate):
alist = list(array_list)
rotated_list = alist[num_rotate:] + alist[:num_rotate]
return rotated_list
array_list = []
n = int(input('Enter number of elements in array list : '))
for i in range(0, n):
elem = int(input())
array_list.append(elem)
num_rotate = int(... |
"""Module describes keys and types of nodes
for an internal structure which is used
to render the difference using formatters"""
# left part of the dictionary
KEY = 'KEY'
VALUE = 'VALUE'
STATE = 'STATE'
# if the type is CHANGED then the left part consists
# of these two keys instead of VALUE
VALUE_LEFT = 'VALUE_LEFT'... | """Module describes keys and types of nodes
for an internal structure which is used
to render the difference using formatters"""
key = 'KEY'
value = 'VALUE'
state = 'STATE'
value_left = 'VALUE_LEFT'
value_right = 'VALUE_RIGHT'
added = 'ADDED'
deleted = 'DELETED'
unchanged = 'UNCHANGED'
children = 'CHILDREN'
changed = '... |
class RefBuilderBackend:
def __init__(self, ref_name):
self.ref_name = ref_name
def resolve_attr(self, attr):
return getattr(RefBuilder(self.ref_name), attr)
def resolve_item(self, item):
return RefBuilder(self.ref_name)[item]
class DataBackend:
def __init__(self, data):... | class Refbuilderbackend:
def __init__(self, ref_name):
self.ref_name = ref_name
def resolve_attr(self, attr):
return getattr(ref_builder(self.ref_name), attr)
def resolve_item(self, item):
return ref_builder(self.ref_name)[item]
class Databackend:
def __init__(self, data):
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
class MyClass(object):
pass
def unpredictable(obj):
"""Returns a new list containing obj.
>>> unpredictable(MyClass())
<doctest_unpredictable.MyClass object at 0x10055a2d0>
"""
return obj
| class Myclass(object):
pass
def unpredictable(obj):
"""Returns a new list containing obj.
>>> unpredictable(MyClass())
<doctest_unpredictable.MyClass object at 0x10055a2d0>
"""
return obj |
#createMinMaxFunction.py
def minimum_value(lst):
#check if any ints or floats are in the list
type_list = check_list_types(lst)
#if not, return error
if float not in type_list and int not in type_list:
return "error"
# if not create check every value in list against the value assigned to mi... | def minimum_value(lst):
type_list = check_list_types(lst)
if float not in type_list and int not in type_list:
return 'error'
minimum = float('inf')
for val in lst:
try:
if val < minimum:
minimum = val
except:
return_operator_error(val)
... |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
primes = [2, 3, 5, 7]
def is_prime(n):
"""
A function that checks if a given number n is a prime looping
through it and, possibly, expanding the array/list of known
primes only if/when necessary... | primes = [2, 3, 5, 7]
def is_prime(n):
"""
A function that checks if a given number n is a prime looping
through it and, possibly, expanding the array/list of known
primes only if/when necessary (ie: as soon as you check for a
potential prime which is greater than a given threshold for each n, stop).
:param n... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 9 01:37:45 2018
@author: 51667
"""
qzMoneyCnsmpt = [0 for i in range(41)]
qzMoneyCnsmpt[1] = 43
for i in range(1,40):
qzMoneyCnsmpt[i + 1] = qzMoneyCnsmpt[i] + i + 5.5
qzCumMoneyCnsmpt = [0 for i in range(41)]
for i in range(40):
qzCumMoneyCnsmpt[i + 1] = ... | """
Created on Mon Jul 9 01:37:45 2018
@author: 51667
"""
qz_money_cnsmpt = [0 for i in range(41)]
qzMoneyCnsmpt[1] = 43
for i in range(1, 40):
qzMoneyCnsmpt[i + 1] = qzMoneyCnsmpt[i] + i + 5.5
qz_cum_money_cnsmpt = [0 for i in range(41)]
for i in range(40):
qzCumMoneyCnsmpt[i + 1] = qzCumMoneyCnsmpt[i] + qzM... |
def main():
n = int(input())
p = []
for _ in range(n):
p.append(input())
k = p.copy()
k.sort()
# print(k, p)
if k == p:
print("INCREASING")
return
# print(reversed(k), p, reversed(k) == p)
if list(reversed(k)) == p:
print("DECREASING")... | def main():
n = int(input())
p = []
for _ in range(n):
p.append(input())
k = p.copy()
k.sort()
if k == p:
print('INCREASING')
return
if list(reversed(k)) == p:
print('DECREASING')
else:
print('NEITHER')
return
if __name__ == '__main__':
mai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.