content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""
This module contains the general settings used across modules.
"""
FPS = 60
WINDOW_WIDTH = 1100
WINDOW_HEIGHT = 600
TIME_MULTIPLIER = 1.0
| """
This module contains the general settings used across modules.
"""
fps = 60
window_width = 1100
window_height = 600
time_multiplier = 1.0 |
class Solution:
def longestSubarray(self, nums: List[int]) -> int:
k = 1
max_len, i = 0, 0
for j in range(len(nums)):
if nums[j] == 0:
k -= 1
if k < 0:
if nums[i] == 0:
k += 1
i += 1
max_... | class Solution:
def longest_subarray(self, nums: List[int]) -> int:
k = 1
(max_len, i) = (0, 0)
for j in range(len(nums)):
if nums[j] == 0:
k -= 1
if k < 0:
if nums[i] == 0:
k += 1
i += 1
... |
ROOT_WK_API_URL = "https://api.wanikani.com/v2/"
RESOURCES_WITHOUT_IDS = ["user", "collection", "report"]
SUBJECT_ENDPOINT = "subjects"
SINGLE_SUBJECT_ENPOINT = r"subjects/\d+"
ASSIGNMENT_ENDPOINT = "assignments"
REVIEW_STATS_ENDPOINT = "review_statistics"
STUDY_MATERIALS_ENDPOINT = "study_materials"
REVIEWS_ENDPOINT ... | root_wk_api_url = 'https://api.wanikani.com/v2/'
resources_without_ids = ['user', 'collection', 'report']
subject_endpoint = 'subjects'
single_subject_enpoint = 'subjects/\\d+'
assignment_endpoint = 'assignments'
review_stats_endpoint = 'review_statistics'
study_materials_endpoint = 'study_materials'
reviews_endpoint =... |
"""
Script testing 14.4.2 control from OWASP ASVS 4.0:
'Verify that all API responses contain a Content-Disposition: attachment;
filename="api.json" header (or other appropriate filename for the content
type).'
The script will raise an alert if 'Content-Disposition' header is present but not follow the format - Cont... | """
Script testing 14.4.2 control from OWASP ASVS 4.0:
'Verify that all API responses contain a Content-Disposition: attachment;
filename="api.json" header (or other appropriate filename for the content
type).'
The script will raise an alert if 'Content-Disposition' header is present but not follow the format - Cont... |
MAX_N = 10000 + 1
isprime = [True] * (MAX_N)
isprime[0] = False
isprime[1] = False
for i in range(2, MAX_N):
if not isprime[i]:
continue
for j in range(i+i, MAX_N, i):
isprime[j] = False
T = int(input())
for _ in range(T):
n = int(input())
for i in range(n//2, 1, -1):
if isprim... | max_n = 10000 + 1
isprime = [True] * MAX_N
isprime[0] = False
isprime[1] = False
for i in range(2, MAX_N):
if not isprime[i]:
continue
for j in range(i + i, MAX_N, i):
isprime[j] = False
t = int(input())
for _ in range(T):
n = int(input())
for i in range(n // 2, 1, -1):
if isprim... |
#
# PySNMP MIB module DOCS-LOADBALANCING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DOCS-LOADBALANCING-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:53:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, value_range_constraint, constraints_union, single_value_constraint) ... |
"""
Linear State Space Element Class
"""
class Element(object):
"""
State space member
"""
def __init__(self):
self.sys_id = str() # A string with the name of the element
self.sys = None # The actual object
self.ss = None # The state space object
self.settings = ... | """
Linear State Space Element Class
"""
class Element(object):
"""
State space member
"""
def __init__(self):
self.sys_id = str()
self.sys = None
self.ss = None
self.settings = dict()
def initialise(self, data, sys_id):
self.sys_id = sys_id
settin... |
"""Constants."""
# A ``None``-ish constant for use where ``None`` may be a valid value.
NOT_SET = type('NOT_SET', (), {
'__bool__': (lambda self: False),
'__str__': (lambda self: 'NOT_SET'),
'__repr__': (lambda self: 'NOT_SET'),
'__copy__': (lambda self: self),
})()
# An alias for NOT_SET that may be... | """Constants."""
not_set = type('NOT_SET', (), {'__bool__': lambda self: False, '__str__': lambda self: 'NOT_SET', '__repr__': lambda self: 'NOT_SET', '__copy__': lambda self: self})()
no_default = NOT_SET |
class Solution:
def minCut(self, s: str) -> int:
dp=self.isPal(s)
return self.bfs(s,dp)
def isPal(self,s):
dp=[[False for i in s] for i in s]
for i in range(len(s)):
dp[i][i]=True
if i+1<len(s):
dp[i][i+1]=True if s[i]==s[i+1] else False
... | class Solution:
def min_cut(self, s: str) -> int:
dp = self.isPal(s)
return self.bfs(s, dp)
def is_pal(self, s):
dp = [[False for i in s] for i in s]
for i in range(len(s)):
dp[i][i] = True
if i + 1 < len(s):
dp[i][i + 1] = True if s[i] =... |
def main(j, args, params, tags, tasklet):
params.merge(args)
doc = params.doc
tags = params.tags
out = ""
cmdstr = params.macrostr.split(":", 1)[1].replace("}}", "").strip()
md5 = j.base.byteprocessor.hashMd5(cmdstr)
j.system.fs.createDir(j.system.fs.joinPaths(j.core.portal.active.filesro... | def main(j, args, params, tags, tasklet):
params.merge(args)
doc = params.doc
tags = params.tags
out = ''
cmdstr = params.macrostr.split(':', 1)[1].replace('}}', '').strip()
md5 = j.base.byteprocessor.hashMd5(cmdstr)
j.system.fs.createDir(j.system.fs.joinPaths(j.core.portal.active.filesroot,... |
"""
Exceptions module
"""
class CuckooHashMapFullException(Exception):
"""
Exception raised when filter is full.
"""
pass
| """
Exceptions module
"""
class Cuckoohashmapfullexception(Exception):
"""
Exception raised when filter is full.
"""
pass |
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if needle == "":
return 0
for i in range(0, len(haystack) - len(needle) + 1):
print(haystack[i : i + len(needle)], needle)
if haystack[i : i + len(needle)] == needle:
return i
... | class Solution:
def str_str(self, haystack: str, needle: str) -> int:
if needle == '':
return 0
for i in range(0, len(haystack) - len(needle) + 1):
print(haystack[i:i + len(needle)], needle)
if haystack[i:i + len(needle)] == needle:
return i
... |
"""
499. Word Count (Map Reduce)
https://www.lintcode.com/problem/word-count-map-reduce/description
"""
class WordCount:
# @param {str} line a text, for example "Bye Bye see you next"
def mapper(self, _, line):
# Write your code here
# Please use 'yield key, value'
word_lists = line.spl... | """
499. Word Count (Map Reduce)
https://www.lintcode.com/problem/word-count-map-reduce/description
"""
class Wordcount:
def mapper(self, _, line):
word_lists = line.split(' ')
for word in word_lists:
yield (word, 1)
def reducer(self, key, values):
yield (key, sum(values)) |
class Solution:
def mergeTrees(self, t1, t2):
"""
:type t1: TreeNode
:type t2: TreeNode
:rtype: TreeNode
"""
# This method changes the existing tree instead of returning a new one
if t1 and t2:
t1.val += t2.val
t1.left = self.mergeTrees... | class Solution:
def merge_trees(self, t1, t2):
"""
:type t1: TreeNode
:type t2: TreeNode
:rtype: TreeNode
"""
if t1 and t2:
t1.val += t2.val
t1.left = self.mergeTrees(t1.left, t2.left)
t1.right = self.mergeTrees(t1.right, t2.right)... |
n = int(input())
m = int(input())
r = m
for i in range(n):
a, b = map(int, input().split())
m += a
m -= b
if m < 0:
print(0)
exit()
r = max(r, m)
print(r)
| n = int(input())
m = int(input())
r = m
for i in range(n):
(a, b) = map(int, input().split())
m += a
m -= b
if m < 0:
print(0)
exit()
r = max(r, m)
print(r) |
name = " alberT"
one = name.rsplit()
print("one:", one)
two = name.index('al', 0)
print("two:", two)
three = name.index('T', -1)
print("three:", three)
four = name.replace('l', 'p')
print("four:", four)
five = name.split('l')
print("five:", five)
six = name.upper()
print("six:", six)
seven = name.lower()
print("... | name = ' alberT'
one = name.rsplit()
print('one:', one)
two = name.index('al', 0)
print('two:', two)
three = name.index('T', -1)
print('three:', three)
four = name.replace('l', 'p')
print('four:', four)
five = name.split('l')
print('five:', five)
six = name.upper()
print('six:', six)
seven = name.lower()
print('seven:'... |
n = int(input())
s = [[0] * 10 for _ in range(n + 1)]
s[1] = [0] + [1] * 9
mod = 1000 ** 3
for i in range(2, n + 1):
for j in range(0, 9 + 1):
if j >= 1:
s[i][j] += s[i - 1][j - 1]
if j <= 8:
s[i][j] += s[i - 1][j + 1]
print(sum(s[n]) % mod) | n = int(input())
s = [[0] * 10 for _ in range(n + 1)]
s[1] = [0] + [1] * 9
mod = 1000 ** 3
for i in range(2, n + 1):
for j in range(0, 9 + 1):
if j >= 1:
s[i][j] += s[i - 1][j - 1]
if j <= 8:
s[i][j] += s[i - 1][j + 1]
print(sum(s[n]) % mod) |
class RpnCalcError(Exception):
"""Calculator Generic Exception"""
pass
class StackDepletedError(RpnCalcError):
""" Stack is out of items """
pass
| class Rpncalcerror(Exception):
"""Calculator Generic Exception"""
pass
class Stackdepletederror(RpnCalcError):
""" Stack is out of items """
pass |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Definition of all Rainman2 exceptions
"""
__author__ = 'Ari Saha (arisaha@icloud.com), Mingyang Liu(liux3941@umn.edu)'
__date__ = 'Wednesday, February 14th 2018, 11:38:08 am'
class FileOpenError(IOError):
"""
Exception raised when a file couldn't be opene... | """
Definition of all Rainman2 exceptions
"""
__author__ = 'Ari Saha (arisaha@icloud.com), Mingyang Liu(liux3941@umn.edu)'
__date__ = 'Wednesday, February 14th 2018, 11:38:08 am'
class Fileopenerror(IOError):
"""
Exception raised when a file couldn't be opened.
"""
pass
class Agentnotsupported(Excepti... |
__title__ = "FisherExactTest"
__version__ = "1.0.1"
__author__ = "Ae-Mc"
__author_email__ = "ae_mc@mail.ru"
__description__ = "Two tailed Fisher's exact test wrote in pure Python"
__url__ = "https://github.com/Ae-Mc/Fisher"
__classifiers__ = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language... | __title__ = 'FisherExactTest'
__version__ = '1.0.1'
__author__ = 'Ae-Mc'
__author_email__ = 'ae_mc@mail.ru'
__description__ = "Two tailed Fisher's exact test wrote in pure Python"
__url__ = 'https://github.com/Ae-Mc/Fisher'
__classifiers__ = ['Programming Language :: Python :: 3 :: Only', 'Programming Language :: Pytho... |
# -*- coding: utf-8 -*-
class Solution:
def sortSentence(self, s: str) -> str:
tokens = s.split()
result = [None] * len(tokens)
for token in tokens:
word, index = token[:-1], int(token[-1])
result[index - 1] = word
return ' '.join(result)
if __name__ == '... | class Solution:
def sort_sentence(self, s: str) -> str:
tokens = s.split()
result = [None] * len(tokens)
for token in tokens:
(word, index) = (token[:-1], int(token[-1]))
result[index - 1] = word
return ' '.join(result)
if __name__ == '__main__':
solution... |
"""Specifies the supported Bazel versions."""
CURRENT_BAZEL_VERSION = "5.0.0"
OTHER_BAZEL_VERSIONS = [
"6.0.0-pre.20220223.1",
]
SUPPORTED_BAZEL_VERSIONS = [
CURRENT_BAZEL_VERSION,
] + OTHER_BAZEL_VERSIONS
| """Specifies the supported Bazel versions."""
current_bazel_version = '5.0.0'
other_bazel_versions = ['6.0.0-pre.20220223.1']
supported_bazel_versions = [CURRENT_BAZEL_VERSION] + OTHER_BAZEL_VERSIONS |
def _compile(words):
if not len(words):
return None, ''
num = None
if words[0].isdigit():
num = int(words[0])
words = words[1:]
return num, ' '.join(words)
def _split_out_colons(terms):
newterms = []
for term in terms:
if ':' in term:
subterms = term... | def _compile(words):
if not len(words):
return (None, '')
num = None
if words[0].isdigit():
num = int(words[0])
words = words[1:]
return (num, ' '.join(words))
def _split_out_colons(terms):
newterms = []
for term in terms:
if ':' in term:
subterms = t... |
class BankAccount:
def __init__(self, checking = None, savings = None):
self._checking = checking
self._savings = savings
def get_checking(self):
return self._checking
def set_checking(self, new_checking):
self._checking = new_checking
def get_savings(self):
return self._savings
def s... | class Bankaccount:
def __init__(self, checking=None, savings=None):
self._checking = checking
self._savings = savings
def get_checking(self):
return self._checking
def set_checking(self, new_checking):
self._checking = new_checking
def get_savings(self):
retur... |
"""
LeetCode Problem: 344. Reverse String
Link: https://leetcode.com/problems/reverse-string/
Language: Python
Written by: Mostofa Adib Shakib
Time Complexity: O(n)
Space Complexity: O(1)
"""
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-pla... | """
LeetCode Problem: 344. Reverse String
Link: https://leetcode.com/problems/reverse-string/
Language: Python
Written by: Mostofa Adib Shakib
Time Complexity: O(n)
Space Complexity: O(1)
"""
class Solution:
def reverse_string(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-p... |
# abba
# foo bar bar foo
text1 = list(input())
text2 = input().split()
# text1 = set(text1)
print(text1)
print(text2)
for i in range(len(text1)):
if text1[i] == "a":
text1[i] = 1
else:
text1[i] = 0
for i in range(len(text2)):
if text2[i] == "foo":
text2[i] = 1
else:
te... | text1 = list(input())
text2 = input().split()
print(text1)
print(text2)
for i in range(len(text1)):
if text1[i] == 'a':
text1[i] = 1
else:
text1[i] = 0
for i in range(len(text2)):
if text2[i] == 'foo':
text2[i] = 1
else:
text2[i] = 0
print(text1)
print(text2)
if text1 == ... |
#!/usr/bin/env python3
'''
The MIT License (MIT)
Copyright (c) 2014 Mark Haines
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without... | """
The MIT License (MIT)
Copyright (c) 2014 Mark Haines
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
... |
class Solution:
def isIdealPermutation(self, A: List[int]) -> bool:
n = len(A)
g = local = 0
for i in range(1, n):
if A[i] < A[i-1]:
local += 1
if A[i] < i:
diff = i - A[i]
... | class Solution:
def is_ideal_permutation(self, A: List[int]) -> bool:
n = len(A)
g = local = 0
for i in range(1, n):
if A[i] < A[i - 1]:
local += 1
if A[i] < i:
diff = i - A[i]
g += diff * (diff + 1) // 2
return... |
xval = 0
xvalue1 = 1
xvalue2 = 2
print(xvalue1 + xvalue2)
| xval = 0
xvalue1 = 1
xvalue2 = 2
print(xvalue1 + xvalue2) |
class Order():
def __init__(self, exchCode, sym_, _sym, orderType, price, side, qty, stopPrice=''):
self.odid = None
self.status = None
self.tempOdid = None
self.sym_ = sym_
self._sym = _sym
self.symbol = sym_ + _sym
self.exchCode = exchCode.upper()
se... | class Order:
def __init__(self, exchCode, sym_, _sym, orderType, price, side, qty, stopPrice=''):
self.odid = None
self.status = None
self.tempOdid = None
self.sym_ = sym_
self._sym = _sym
self.symbol = sym_ + _sym
self.exchCode = exchCode.upper()
sel... |
def add_native_methods(clazz):
def initProto____():
raise NotImplementedError()
def socketCreate__boolean__(a0, a1):
raise NotImplementedError()
def socketConnect__java_net_InetAddress__int__int__(a0, a1, a2, a3):
raise NotImplementedError()
def socketBind__java_net_InetAddres... | def add_native_methods(clazz):
def init_proto____():
raise not_implemented_error()
def socket_create__boolean__(a0, a1):
raise not_implemented_error()
def socket_connect__java_net__inet_address__int__int__(a0, a1, a2, a3):
raise not_implemented_error()
def socket_bind__java_n... |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 8 09:45:29 2018
@author: abaena
"""
DATATYPE_AGENT = 'agent'
DATATYPE_PATH_METRICS = 'pathmet'
DATATYPE_LOG_EVENTS = 'logeve'
DATATYPE_LOG_METRICS = 'logmet'
DATATYPE_MONITOR_HOST = 'host'
DATATYPE_MONITOR_MICROSERVICE = 'ms'
DATATYPE_MONITOR_TOMCAT = 'tomc'
DATATYPE_... | """
Created on Sun Apr 8 09:45:29 2018
@author: abaena
"""
datatype_agent = 'agent'
datatype_path_metrics = 'pathmet'
datatype_log_events = 'logeve'
datatype_log_metrics = 'logmet'
datatype_monitor_host = 'host'
datatype_monitor_microservice = 'ms'
datatype_monitor_tomcat = 'tomc'
datatype_monitor_postgres = 'psql'
s... |
''' This can be solved using the slicing method used in list. We have to modify the list by take moving the
last part of the array in reverse order and joining it with the remaining part of the list to its right'''
class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return... | """ This can be solved using the slicing method used in list. We have to modify the list by take moving the
last part of the array in reverse order and joining it with the remaining part of the list to its right"""
class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not retur... |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/viki/catkin_ws/src/beginner_tutorials/msg/Num.msg"
services_str = "/home/viki/catkin_ws/src/beginner_tutorials/srv/ResetCount.srv;/home/viki/catkin_ws/src/beginner_tutorials/srv/AddTwoInts.srv"
pkg_name = "beginner_tutorials"
dependencies_str = ... | messages_str = '/home/viki/catkin_ws/src/beginner_tutorials/msg/Num.msg'
services_str = '/home/viki/catkin_ws/src/beginner_tutorials/srv/ResetCount.srv;/home/viki/catkin_ws/src/beginner_tutorials/srv/AddTwoInts.srv'
pkg_name = 'beginner_tutorials'
dependencies_str = 'std_msgs'
langs = 'gencpp;genlisp;genpy'
dep_include... |
x=int(input("no 1 "))
y=int(input("no 2 "))
def pow(x,y):
if y!=0:
return(x*pow(x,y-1))
else:
return 1
print(pow(x,y))
| x = int(input('no 1 '))
y = int(input('no 2 '))
def pow(x, y):
if y != 0:
return x * pow(x, y - 1)
else:
return 1
print(pow(x, y)) |
#!/usr/bin/python
hamming_threshold = [50, 60]
pattern_scale = [4.0, 6.0, 8.0, 10.0]
fp_runscript = open("/mnt/ssd/kivan/cv-stereo/scripts/eval_batch/run_batch_validation.sh", 'w')
fp_runscript.write("#!/bin/bash\n\n")
cnt = 0
for i in range(len(hamming_threshold)):
for j in range(len(pattern_scale)):
cn... | hamming_threshold = [50, 60]
pattern_scale = [4.0, 6.0, 8.0, 10.0]
fp_runscript = open('/mnt/ssd/kivan/cv-stereo/scripts/eval_batch/run_batch_validation.sh', 'w')
fp_runscript.write('#!/bin/bash\n\n')
cnt = 0
for i in range(len(hamming_threshold)):
for j in range(len(pattern_scale)):
cnt += 1
filepa... |
#!/usr/bin/env python
colors = ['white', 'black']
sizes = ['S', 'M', 'L']
tshirts = [(color, size) for size in sizes
for color in colors ]
print(tshirts)
tshirts = [(color, size) for color in colors
for size in sizes ]
print(tshirts)
| colors = ['white', 'black']
sizes = ['S', 'M', 'L']
tshirts = [(color, size) for size in sizes for color in colors]
print(tshirts)
tshirts = [(color, size) for color in colors for size in sizes]
print(tshirts) |
if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
max = -9999999
max2 = -9999999
for i in arr:
if(i>max):
max2=max
max=i
elif i>max2 and max>i:
max2=i
print(max2) | if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
max = -9999999
max2 = -9999999
for i in arr:
if i > max:
max2 = max
max = i
elif i > max2 and max > i:
max2 = i
print(max2) |
class Stack:
def __init__(self):
self.stack = []
def add(self, dataval):
# Use list append method to add element
if dataval not in self.stack:
self.stack.append(dataval)
return True
else:
return False
# Use peek to look at the top of the stack
d... | class Stack:
def __init__(self):
self.stack = []
def add(self, dataval):
if dataval not in self.stack:
self.stack.append(dataval)
return True
else:
return False
def peek(self):
return self.stack[-1] |
class KataResult:
def __init__(self, revenue, ipa, cost_of_kata, net_income, cost_of_goods, kata_penalty):
self.revenue = revenue
self.ipa = ipa
self.cost_of_kata = cost_of_kata
self.net_income = net_income
self.cost_of_goods = cost_of_goods
self.kata_penalty = kata... | class Kataresult:
def __init__(self, revenue, ipa, cost_of_kata, net_income, cost_of_goods, kata_penalty):
self.revenue = revenue
self.ipa = ipa
self.cost_of_kata = cost_of_kata
self.net_income = net_income
self.cost_of_goods = cost_of_goods
self.kata_penalty = kata_... |
su = 0
a = [3,5,6,2,7,1]
print(sum(a))
x, y = input("Enter a two value: ").split()
x = int(x)
y = int(y)
su = a[y] + sum(a[:y])
print(su) | su = 0
a = [3, 5, 6, 2, 7, 1]
print(sum(a))
(x, y) = input('Enter a two value: ').split()
x = int(x)
y = int(y)
su = a[y] + sum(a[:y])
print(su) |
def test_topic_regexp_matching(dequeuer):
msg = {'company_name': 'test_company'}
actions_1 = tuple(dequeuer.get_actions_for_topic('object__created', msg))
actions_2 = tuple(dequeuer.get_actions_for_topic('object__deleted', msg))
actions_3 = tuple(dequeuer.get_actions_for_topic('otherthing__created', msg... | def test_topic_regexp_matching(dequeuer):
msg = {'company_name': 'test_company'}
actions_1 = tuple(dequeuer.get_actions_for_topic('object__created', msg))
actions_2 = tuple(dequeuer.get_actions_for_topic('object__deleted', msg))
actions_3 = tuple(dequeuer.get_actions_for_topic('otherthing__created', msg... |
# -*- coding: utf-8 -*-
VERSION = (1, 0, 4)
__version__ = "1.0.4"
__authors__ = ["Stefan Foulis <stefan.foulis@gmail.com>", ]
| version = (1, 0, 4)
__version__ = '1.0.4'
__authors__ = ['Stefan Foulis <stefan.foulis@gmail.com>'] |
'''
This is the exceptions module:
'''
'''
Exception of when user do not have the access to certain pages.
'''
class CannotAccessPageException(Exception):
pass
'''
Exception of the first password and the second password does not match during registration.
'''
class PasswordsNotMatchingException(Exception):
p... | """
This is the exceptions module:
"""
'\nException of when user do not have the access to certain pages.\n'
class Cannotaccesspageexception(Exception):
pass
'\nException of the first password and the second password does not match during registration.\n'
class Passwordsnotmatchingexception(Exception):
pass
'... |
class TransportContext(object):
""" The System.Net.TransportContext class provides additional context about the underlying transport layer. """
def GetChannelBinding(self,kind):
"""
GetChannelBinding(self: TransportContext,kind: ChannelBindingKind) -> ChannelBinding
Retrieves the requested channel... | class Transportcontext(object):
""" The System.Net.TransportContext class provides additional context about the underlying transport layer. """
def get_channel_binding(self, kind):
"""
GetChannelBinding(self: TransportContext,kind: ChannelBindingKind) -> ChannelBinding
Retrieves the requested... |
# Copyright 2016-2022 The FEAGI 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 applic... | def utf_detection_logic(detection_list):
highest_ranked_item = '-'
second_highest_ranked_item = '-'
for item in detection_list:
if highest_ranked_item == '-':
highest_ranked_item = item
elif detection_list[item]['rank'] > detection_list[highest_ranked_item]['rank']:
s... |
def is_triangle(func):
def wrapped(sides):
if any(i <= 0 for i in sides):
return False
sum_ = sum(sides)
if any(sides[i] > sum_ - sides[i] for i in range(3)):
return False
return func(sides)
return wrapped
@is_triangle
def is_equilateral(sides):
retu... | def is_triangle(func):
def wrapped(sides):
if any((i <= 0 for i in sides)):
return False
sum_ = sum(sides)
if any((sides[i] > sum_ - sides[i] for i in range(3))):
return False
return func(sides)
return wrapped
@is_triangle
def is_equilateral(sides):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
BOT_NAME = 'book'
SPIDER_MODULES = ['book.spiders']
NEWSPIDER_MODULE = 'book.spiders'
IMAGES_STORE = '../storage/book/'
COOKIES_ENABLED = True
COOKIE_DEBUG = True
LOG_LEVEL = 'INFO'
# LOG_LEVEL = 'DEBUG'
CONCURRENT_REQUESTS = 100
CONCURRENT_REQUESTS_PER_DOMAIN = 1000
U... | bot_name = 'book'
spider_modules = ['book.spiders']
newspider_module = 'book.spiders'
images_store = '../storage/book/'
cookies_enabled = True
cookie_debug = True
log_level = 'INFO'
concurrent_requests = 100
concurrent_requests_per_domain = 1000
user_agent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHT... |
AP = "AP"
BP = "BP"
ARRIVE = "ARRIVE"
NEUROMODULATORS = "NEUROMODULATORS"
TARGET = "TARGET"
OBSERVE = "OBSERVE"
SET_FREQUENCY = "SET_FREQUENCY"
DEACTIVATE = "DEACTIVATE"
ENCODE_INFORMATION = "ENCODE_INFORMATION"
| ap = 'AP'
bp = 'BP'
arrive = 'ARRIVE'
neuromodulators = 'NEUROMODULATORS'
target = 'TARGET'
observe = 'OBSERVE'
set_frequency = 'SET_FREQUENCY'
deactivate = 'DEACTIVATE'
encode_information = 'ENCODE_INFORMATION' |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 9 00:00:43 2018
@author: joy
"""
print(5 + 3)
print(9 - 1)
print(2 * 4)
print(16//2) | """
Created on Tue Jan 9 00:00:43 2018
@author: joy
"""
print(5 + 3)
print(9 - 1)
print(2 * 4)
print(16 // 2) |
#! /usr/bin/python3
print("HELLO PYTHON")
| print('HELLO PYTHON') |
try:
with open('proxies.txt', 'r') as file:
proxy = [ line.rstrip() for line in file.readlines()]
except FileNotFoundError:
raise Exception('Proxies.txt not found.') | try:
with open('proxies.txt', 'r') as file:
proxy = [line.rstrip() for line in file.readlines()]
except FileNotFoundError:
raise exception('Proxies.txt not found.') |
"""
Fragments of project version mutations
"""
PROJECT_VERSION_FRAGMENT = '''
content
id
name
projectId
'''
| """
Fragments of project version mutations
"""
project_version_fragment = '\ncontent\nid\nname\nprojectId\n' |
text = input()
punc_remove = [",", ".", "!", "?"]
for i in punc_remove:
text = text.replace(i, "")
print(text.lower()) | text = input()
punc_remove = [',', '.', '!', '?']
for i in punc_remove:
text = text.replace(i, '')
print(text.lower()) |
'''
Student: Dan Grecoe
Assignment: Homework 1
Submission of the first homework assignment. The assignment
was to create a python file with 2 functions
multiply - Takes two parameters x and y and returns the product
of the values provided.
noop - Takes 0 parameters and returns... | """
Student: Dan Grecoe
Assignment: Homework 1
Submission of the first homework assignment. The assignment
was to create a python file with 2 functions
multiply - Takes two parameters x and y and returns the product
of the values provided.
noop - Takes 0 parameters and returns... |
# `name` is the name of the package as used for `pip install package`
name = "package-name"
# `path` is the name of the package for `import package`
path = name.lower().replace("-", "_").replace(" ", "_")
version = "0.1.0"
author = "Author Name"
author_email = ""
description = "" # summary
license = "MIT"
| name = 'package-name'
path = name.lower().replace('-', '_').replace(' ', '_')
version = '0.1.0'
author = 'Author Name'
author_email = ''
description = ''
license = 'MIT' |
class TestClient:
"""
Test before_request and after_request decorators in __init__.py.
"""
def test_1(self, client): # disallowed methods
res = client.put("/")
assert res.status_code == 405
assert b"Method Not Allowed" in res.content
res = client.options("/api/post/add... | class Testclient:
"""
Test before_request and after_request decorators in __init__.py.
"""
def test_1(self, client):
res = client.put('/')
assert res.status_code == 405
assert b'Method Not Allowed' in res.content
res = client.options('/api/post/add')
assert res.s... |
class Graph(object):
"""
A simple undirected, weighted graph
"""
def __init__(self):
self.nodes = set()
self.edges = {}
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
... | class Graph(object):
"""
A simple undirected, weighted graph
"""
def __init__(self):
self.nodes = set()
self.edges = {}
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
self._add_edge... |
class Config(object):
"""Configuration primitives.
Inherit from or instantiate this class and call configure() when you've got
a dictionary of configuration values you want to process and query.
Would be nice to have _expand_cidrlist() so blacklists can specify ranges.
"""
def __init__(self, ... | class Config(object):
"""Configuration primitives.
Inherit from or instantiate this class and call configure() when you've got
a dictionary of configuration values you want to process and query.
Would be nice to have _expand_cidrlist() so blacklists can specify ranges.
"""
def __init__(self, ... |
__title__ = 'cisco_support'
__description__ = 'Cisco Support APIs'
__version__ = '0.1.0'
__author__ = 'Dennis Roth'
__license__ = 'MIT'
| __title__ = 'cisco_support'
__description__ = 'Cisco Support APIs'
__version__ = '0.1.0'
__author__ = 'Dennis Roth'
__license__ = 'MIT' |
elements = [int(x) for x in input().split(', ')]
even_numbers = [x for x in elements if x % 2 == 0]
odd_numbers = [x for x in elements if x % 2 != 0]
positive = [x for x in elements if x >= 0]
negative = [x for x in elements if x < 0]
print(f"Positive: {', '.join(str(x) for x in positive)}")
print(f"Negative: {', '.j... | elements = [int(x) for x in input().split(', ')]
even_numbers = [x for x in elements if x % 2 == 0]
odd_numbers = [x for x in elements if x % 2 != 0]
positive = [x for x in elements if x >= 0]
negative = [x for x in elements if x < 0]
print(f"Positive: {', '.join((str(x) for x in positive))}")
print(f"Negative: {', '.j... |
vals = {
"yes" : 0,
"residential" : 1,
"service" : 2,
"unclassified" : 3,
"stream" : 4,
"track" : 5,
"water" : 6,
"footway" : 7,
"tertiary" : 8,
"private" : 9,
"tree" : 10,
"path" : 11,
"forest" : 12,
"secondary" : 13,
"house" : 14,
"no" : 15,
"asphalt" : 16,
"wood" : 17,
"grass" : 18,
"paved" : 19,
"primary" : 20,
"un... | vals = {'yes': 0, 'residential': 1, 'service': 2, 'unclassified': 3, 'stream': 4, 'track': 5, 'water': 6, 'footway': 7, 'tertiary': 8, 'private': 9, 'tree': 10, 'path': 11, 'forest': 12, 'secondary': 13, 'house': 14, 'no': 15, 'asphalt': 16, 'wood': 17, 'grass': 18, 'paved': 19, 'primary': 20, 'unpaved': 21, 'bus_stop'... |
def write_file(filess, T):
f = open(filess, "w")
for o in T:
f.write("[\n")
for l in o:
f.write(str(l)+"\n")
f.write("]\n")
f.close()
def save_hidden_weight(nb_hidden, hiddenw):
for i in range(nb_hidden):
write_file("save/base_nn_hid_" + str(i+1) + "w.nn", hiddenw[i])
def load_hiddenw(filess, hi... | def write_file(filess, T):
f = open(filess, 'w')
for o in T:
f.write('[\n')
for l in o:
f.write(str(l) + '\n')
f.write(']\n')
f.close()
def save_hidden_weight(nb_hidden, hiddenw):
for i in range(nb_hidden):
write_file('save/base_nn_hid_' + str(i + 1) + 'w.nn'... |
class Config(object):
embedding_size = 300
n_layers = 1
hidden_size = 128
drop_prob = 0.2 | class Config(object):
embedding_size = 300
n_layers = 1
hidden_size = 128
drop_prob = 0.2 |
begin_unit
comment|'#!/usr/bin/env python'
nl|'\n'
nl|'\n'
comment|'# Copyright 2013 OpenStack Foundation'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License");'
nl|'\n'
comment|'# you may not use this file except in compliance with the License.'
nl|'\n'
comment|'# You m... | begin_unit
comment | '#!/usr/bin/env python'
nl | '\n'
nl | '\n'
comment | '# Copyright 2013 OpenStack Foundation'
nl | '\n'
comment | '#'
nl | '\n'
comment | '# Licensed under the Apache License, Version 2.0 (the "License");'
nl | '\n'
comment | '# you may not use this file except in compliance with the License.'
nl |... |
class BrainfuckException(Exception):
pass
class BLexer:
""" Static class encapsulating functionality for lexing Brainfuck programs. """
symbols = [
'>', '<', '+', '-',
'.', ',', '[', ']'
]
@staticmethod
def lex(code):
""" Return a generator for tokens in... | class Brainfuckexception(Exception):
pass
class Blexer:
""" Static class encapsulating functionality for lexing Brainfuck programs. """
symbols = ['>', '<', '+', '-', '.', ',', '[', ']']
@staticmethod
def lex(code):
""" Return a generator for tokens in some Brainfuck code. """
retu... |
load("@fbcode_macros//build_defs:config.bzl", "config")
load("@fbcode_macros//build_defs/config:read_configs.bzl", "read_int")
load("@fbcode_macros//build_defs:core_tools.bzl", "core_tools")
def _create_build_info(
build_mode,
buck_package,
name,
rule_type,
platform,
epochtime=0,
host="",
... | load('@fbcode_macros//build_defs:config.bzl', 'config')
load('@fbcode_macros//build_defs/config:read_configs.bzl', 'read_int')
load('@fbcode_macros//build_defs:core_tools.bzl', 'core_tools')
def _create_build_info(build_mode, buck_package, name, rule_type, platform, epochtime=0, host='', package_name='', package_versi... |
sm.setSpeakerID(1013000)
sm.sendNext("Ugh. This isn't going to work. I need something else. No plants. No meat. What, you have no idea? But you're the master, and you're older than me, too. You must know what'd be good for me!")
sm.setPlayerAsSpeaker()
sm.sendSay("#bBut I don't. It's not like age has anything to do wi... | sm.setSpeakerID(1013000)
sm.sendNext("Ugh. This isn't going to work. I need something else. No plants. No meat. What, you have no idea? But you're the master, and you're older than me, too. You must know what'd be good for me!")
sm.setPlayerAsSpeaker()
sm.sendSay("#bBut I don't. It's not like age has anything to do wit... |
class Solution:
def chooseandswap (self, A):
opt = 'a'
fir = A[0]
arr = [0]*26
for s in A :
arr[ord(s)-97] += 1
i = 0
while i < len(A) :
if opt > 'z' :
break
while opt < fir :
if o... | class Solution:
def chooseandswap(self, A):
opt = 'a'
fir = A[0]
arr = [0] * 26
for s in A:
arr[ord(s) - 97] += 1
i = 0
while i < len(A):
if opt > 'z':
break
while opt < fir:
if opt in A:
... |
class AccountManager(object):
def __init__(self, balance = 0):
self.balance = balance
def getBalance(self):
return self.balance
def withdraw(self, value):
if self.balance >= value:
self.balance = self.balance - value
print('Successful Withdrawal.')
... | class Accountmanager(object):
def __init__(self, balance=0):
self.balance = balance
def get_balance(self):
return self.balance
def withdraw(self, value):
if self.balance >= value:
self.balance = self.balance - value
print('Successful Withdrawal.')
e... |
class Response(object):
"""
"""
def __init__(self, status_code, text):
self.content = text
self.cached = False
self.status_code = status_code
self.ok = self.status_code < 400
@property
def text(self):
return self.content
def __repr__(self):
retu... | class Response(object):
"""
"""
def __init__(self, status_code, text):
self.content = text
self.cached = False
self.status_code = status_code
self.ok = self.status_code < 400
@property
def text(self):
return self.content
def __repr__(self):
ret... |
# Exercicio 01 Tuplas
x = int(input('Digite o primeiro numero: '))
y = int(input('Digite o segundo numero: '))
cont = 1
soma = x
while cont < y:
soma = soma + x
cont = cont + 1
print('O resultado eh: {}' .format(soma))
| x = int(input('Digite o primeiro numero: '))
y = int(input('Digite o segundo numero: '))
cont = 1
soma = x
while cont < y:
soma = soma + x
cont = cont + 1
print('O resultado eh: {}'.format(soma)) |
'''
To have a error free way of accessing and updating private variables, we create specific methods for this.
Those methods which are meant to set a value to a private variable are called setter methods and methods
meant to access private variable values are called getter methods.
The below code is an example of g... | """
To have a error free way of accessing and updating private variables, we create specific methods for this.
Those methods which are meant to set a value to a private variable are called setter methods and methods
meant to access private variable values are called getter methods.
The below code is an example of g... |
class Solution:
def isMatch(self, s: str, p: str) -> bool:
# this is a dynamic programming solution fot this
matrix = [[False for x in range(len(p) + 1)] for x in range(len(s) + 1)]
matrix[0][0] = True
for i in range(1, len(matrix[0])):
if p[i - 1] == "*":
... | class Solution:
def is_match(self, s: str, p: str) -> bool:
matrix = [[False for x in range(len(p) + 1)] for x in range(len(s) + 1)]
matrix[0][0] = True
for i in range(1, len(matrix[0])):
if p[i - 1] == '*':
matrix[0][i] = matrix[0][i - 1]
for i in range(... |
# https://open.kattis.com/problems/luhnchecksum
for _ in range(int(input())):
count = 0
for i, d in enumerate(reversed(input())):
if i % 2 == 0:
count += int(d)
continue
x = 2 * int(d)
if x < 10:
count += x
else:
x = str(x)
... | for _ in range(int(input())):
count = 0
for (i, d) in enumerate(reversed(input())):
if i % 2 == 0:
count += int(d)
continue
x = 2 * int(d)
if x < 10:
count += x
else:
x = str(x)
count += int(x[0]) + int(x[1])
print('... |
inputFile = "3-input"
outputFile = "3-output"
dir = {'L': [-1,0],'R': [1,0],'U': [0,1],'D': [0,-1]}
def readFile():
file = open(inputFile, "r")
A,B = file.readlines()
A,B = [line.split(",") for line in [A,B]]
file.close()
return A,B
def writeFile(a, b):
file = open(outputFile, "w+")
fil... | input_file = '3-input'
output_file = '3-output'
dir = {'L': [-1, 0], 'R': [1, 0], 'U': [0, 1], 'D': [0, -1]}
def read_file():
file = open(inputFile, 'r')
(a, b) = file.readlines()
(a, b) = [line.split(',') for line in [A, B]]
file.close()
return (A, B)
def write_file(a, b):
file = open(outputF... |
name = 'Urban Dictionary Therapy'
__all__ = ['UDTherapy',
'helper']
| name = 'Urban Dictionary Therapy'
__all__ = ['UDTherapy', 'helper'] |
# -*- coding: utf-8 -*-
"""
Solution to Project Euler problem 179 - Consecutive positive divisors
Author: Jaime Liew
https://github.com/jaimeliew1/Project_Euler_Solutions
"""
def run():
N = int(1e7)
n_factors = [1 for _ in range(N + 1)]
# can start at 2 because 1 is a divisor for all numbers and wont c... | """
Solution to Project Euler problem 179 - Consecutive positive divisors
Author: Jaime Liew
https://github.com/jaimeliew1/Project_Euler_Solutions
"""
def run():
n = int(10000000.0)
n_factors = [1 for _ in range(N + 1)]
for i in range(2, N + 1):
n = i
while n < N:
n_factors[n]... |
"""
Problem:
--------
Design a data structure that supports the following two operations:
- `void addNum(int num)`: Add a integer number from the data stream to the data structure.
- `double findMedian()`: Return the median of all elements so far.
"""
class MedianFinder:
def __init__(self):
"""
... | """
Problem:
--------
Design a data structure that supports the following two operations:
- `void addNum(int num)`: Add a integer number from the data stream to the data structure.
- `double findMedian()`: Return the median of all elements so far.
"""
class Medianfinder:
def __init__(self):
"""
... |
class SimulateMode:
@staticmethod
def start_simulation(device, guide=None):
return
| class Simulatemode:
@staticmethod
def start_simulation(device, guide=None):
return |
# Uses python3
n = int(input())
if n == 1:
print(1)
print(1)
quit()
W = n
prizes = []
for i in range(1, n):
if W>2*i:
prizes.append(i)
W -= i
else:
prizes.append(W)
break
print(len(prizes))
print(' '.join([str(i) for i in prizes])) | n = int(input())
if n == 1:
print(1)
print(1)
quit()
w = n
prizes = []
for i in range(1, n):
if W > 2 * i:
prizes.append(i)
w -= i
else:
prizes.append(W)
break
print(len(prizes))
print(' '.join([str(i) for i in prizes])) |
# Question 8
# Print even numbers in a list, stop printing when the number is 237
numbers = [
386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345,
399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217,
815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 8... | numbers = [386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958, 743, 527]
for i in range(len(numbers)):
if numbers[i] % 2 ==... |
requested_toppings = ['mushrooms', 'extra cheese']
if 'mushrooms' in requested_toppings:
print("Adding mushrooms.")
if 'pepperoni' in requested_toppings:
print("Adding pepperoni.")
if 'extra cheese' in requested_toppings:
print("Adding extra cheese.")
print("\nFinished making your first pizza!")
if 'mush... | requested_toppings = ['mushrooms', 'extra cheese']
if 'mushrooms' in requested_toppings:
print('Adding mushrooms.')
if 'pepperoni' in requested_toppings:
print('Adding pepperoni.')
if 'extra cheese' in requested_toppings:
print('Adding extra cheese.')
print('\nFinished making your first pizza!')
if 'mushroo... |
# markdownv2 python-telegram-bot specific
joined = '{} joined group `{}`'
not_joined = '{} is already in group `{}`'
left = '{} left group `{}`'
not_left = '{} did not join group `{}` before'
mention_failed = 'There are no users to mention'
no_groups = 'There are no groups for this chat'
# html python-telegram-bot spe... | joined = '{} joined group `{}`'
not_joined = '{} is already in group `{}`'
left = '{} left group `{}`'
not_left = '{} did not join group `{}` before'
mention_failed = 'There are no users to mention'
no_groups = 'There are no groups for this chat'
start_text = '\nHello!\n@everyone_mention_bot here.\nI am here to help yo... |
"""Defines a rule for runsc test targets."""
load("@io_bazel_rules_go//go:def.bzl", _go_test = "go_test")
# runtime_test is a macro that will create targets to run the given test target
# with different runtime options.
def runtime_test(**kwargs):
"""Runs the given test target with different runtime options."""
... | """Defines a rule for runsc test targets."""
load('@io_bazel_rules_go//go:def.bzl', _go_test='go_test')
def runtime_test(**kwargs):
"""Runs the given test target with different runtime options."""
name = kwargs['name']
_go_test(**kwargs)
kwargs['name'] = name + '_hostnet'
kwargs['args'] = ['--runti... |
# Copyright 2019-2021 Huawei Technologies Co., Ltd
#
# 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 agre... | """utils"""
default = 'DefaultFormat'
nchw = 'NCHW'
nhwc = 'NHWC'
hwcn = 'HWCN'
nc1_hwc0 = 'NC1HWC0'
frac_z = 'FracZ'
elemwise = 'ELEMWISE'
convlution = 'CONVLUTION'
commreduce = 'COMMREDUCE'
segment = 'SEGMENT'
opaque = 'OPAQUE'
binds = 'binds' |
# -*- coding: utf-8 -*-
MNIST_DATASET_PATH = 'raw_data/mnist.pkl.gz'
TEST_FOLDER = 'test/'
TRAIN_FOLDER = 'train/'
MODEL_FILE_PATH = 'model/recognizer.pickle'
LABEL_ENCODER_FILE_PATH = 'model/label_encoder.pickle'
# Manual
DEMO_HELP_MSG = '\n' + \
'Input parameter is incorrect\n' + \
'Display ... | mnist_dataset_path = 'raw_data/mnist.pkl.gz'
test_folder = 'test/'
train_folder = 'train/'
model_file_path = 'model/recognizer.pickle'
label_encoder_file_path = 'model/label_encoder.pickle'
demo_help_msg = '\n' + 'Input parameter is incorrect\n' + "Display help: 'python demo.py -h'"
trainer_help_msg = '\n' + 'Input par... |
#! /usr/bin/env python
def cut_the_sticks(a):
cuts = []
while len(a) > 0:
cutter = a.pop()
if cutter == 0:
continue
for i in range(len(a)):
a[i] -= cutter
cuts.append(len(a) + 1)
return cuts
if __name__ == '__main__':
_ = input()
value = map... | def cut_the_sticks(a):
cuts = []
while len(a) > 0:
cutter = a.pop()
if cutter == 0:
continue
for i in range(len(a)):
a[i] -= cutter
cuts.append(len(a) + 1)
return cuts
if __name__ == '__main__':
_ = input()
value = map(int, input().split(' '))
... |
"""
Configuration for docs
"""
# source_link = "https://github.com/[org_name]/pos_multie_print"
# docs_base_url = "https://[org_name].github.io/pos_multie_print"
# headline = "App that does everything"
# sub_heading = "Yes, you got that right the first time, everything"
def get_context(context):
context.brand_html =... | """
Configuration for docs
"""
def get_context(context):
context.brand_html = 'POS Multiple Print' |
n, k, v = int(input()), int(input()), []
for i in range(n): v.append(int(input()))
v = sorted(v, reverse=True)
print(k + v[k:].count(v[k-1]))
| (n, k, v) = (int(input()), int(input()), [])
for i in range(n):
v.append(int(input()))
v = sorted(v, reverse=True)
print(k + v[k:].count(v[k - 1])) |
#! python3
# __author__ = "YangJiaHao"
# date: 2018/1/26
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
d = dict()
l, r = 0, 0
res = 0
while r < len(s):
if s[r] not in d:
d[s[r]] = None
r += 1
res = max(... | class Solution:
def length_of_longest_substring(self, s: str) -> int:
d = dict()
(l, r) = (0, 0)
res = 0
while r < len(s):
if s[r] not in d:
d[s[r]] = None
r += 1
res = max(res, r - l)
else:
del ... |
def get_field_name_from_line(line):
return line.split(':')[1].strip()
def remove_description(line):
if '-' in line:
return line.split('-')[0].strip()
else:
return line
def split_multiple_field_names(line):
if ',' in line:
field_names = line.split(',')
return map(lambda ... | def get_field_name_from_line(line):
return line.split(':')[1].strip()
def remove_description(line):
if '-' in line:
return line.split('-')[0].strip()
else:
return line
def split_multiple_field_names(line):
if ',' in line:
field_names = line.split(',')
return map(lambda ... |
class Circle:
def __init__(self, radius):
self.radius = radius
def compute_area(self):
return self.radius ** 2 * 3.14
circle = Circle(2)
print("Area of circuit: " + str(circle.compute_area()))
| class Circle:
def __init__(self, radius):
self.radius = radius
def compute_area(self):
return self.radius ** 2 * 3.14
circle = circle(2)
print('Area of circuit: ' + str(circle.compute_area())) |
class Solution:
def addStrings(self, num1: str, num2: str) -> str:
i, j, result, carry = len(num1) - 1, len(num2) - 1, '', 0
while i >= 0 or j >= 0:
if i >= 0:
carry += ord(num1[i]) - ord('0')
if j >= 0:
carry += ord(num2[j]) - ord('0')
... | class Solution:
def add_strings(self, num1: str, num2: str) -> str:
(i, j, result, carry) = (len(num1) - 1, len(num2) - 1, '', 0)
while i >= 0 or j >= 0:
if i >= 0:
carry += ord(num1[i]) - ord('0')
if j >= 0:
carry += ord(num2[j]) - ord('0')
... |
word = input('Enter a word')
len = len(word)
for i in range(len-1, -1, -1):
print(word[i], end='')
| word = input('Enter a word')
len = len(word)
for i in range(len - 1, -1, -1):
print(word[i], end='') |
ss = input('Please give me a string: ')
if ss == ss[::-1]:
print("Yes, %s is a palindrome." % ss)
else:
print('Nevermind, %s isn\'t a palindrome.' % ss)
| ss = input('Please give me a string: ')
if ss == ss[::-1]:
print('Yes, %s is a palindrome.' % ss)
else:
print("Nevermind, %s isn't a palindrome." % ss) |
class AbridgerError(Exception):
pass
class ConfigFileLoaderError(AbridgerError):
pass
class IncludeError(ConfigFileLoaderError):
pass
class DataError(ConfigFileLoaderError):
pass
class FileNotFoundError(ConfigFileLoaderError):
pass
class DatabaseUrlError(AbridgerError):
pass
class Ex... | class Abridgererror(Exception):
pass
class Configfileloadererror(AbridgerError):
pass
class Includeerror(ConfigFileLoaderError):
pass
class Dataerror(ConfigFileLoaderError):
pass
class Filenotfounderror(ConfigFileLoaderError):
pass
class Databaseurlerror(AbridgerError):
pass
class Extracti... |
def aumentar(preco, taxa):
p = preco + (preco * taxa/100)
return p
def diminuir(preco, taxa):
p = preco - (preco * taxa/100)
return p
def dobro(preco):
p = preco * 2
return p
def metade(preco):
p = preco / 2
return p
| def aumentar(preco, taxa):
p = preco + preco * taxa / 100
return p
def diminuir(preco, taxa):
p = preco - preco * taxa / 100
return p
def dobro(preco):
p = preco * 2
return p
def metade(preco):
p = preco / 2
return p |
DOMAIN = "fitx"
ICON = "mdi:weight-lifter"
CONF_LOCATIONS = 'locations'
CONF_ID = 'id'
ATTR_ADDRESS = "address"
ATTR_STUDIO_NAME = "studioName"
ATTR_ID = CONF_ID
ATTR_URL = "url"
DEFAULT_ENDPOINT = "https://www.fitx.de/fitnessstudios/{id}"
REQUEST_METHOD = "GET"
REQUEST_AUTH = None
REQUEST_HEADERS = None
REQUEST_PAYLOA... | domain = 'fitx'
icon = 'mdi:weight-lifter'
conf_locations = 'locations'
conf_id = 'id'
attr_address = 'address'
attr_studio_name = 'studioName'
attr_id = CONF_ID
attr_url = 'url'
default_endpoint = 'https://www.fitx.de/fitnessstudios/{id}'
request_method = 'GET'
request_auth = None
request_headers = None
request_payloa... |
#!/usr/bin/env python3
# coding: UTF-8
'''!
module description
@author <A href="email:fulkgl@gmail.com">George L Fulk</A>
'''
__version__ = 0.01
def main():
'''!
main description
'''
print("Hello world")
return 0
if __name__ == "__main__":
# command line entry point
main()
# END #
| """!
module description
@author <A href="email:fulkgl@gmail.com">George L Fulk</A>
"""
__version__ = 0.01
def main():
"""!
main description
"""
print('Hello world')
return 0
if __name__ == '__main__':
main() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.