content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
format = "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
minimal_format = "%(message)s"
def _get_formatter_and_handler(use_minimal_format: bool = False):
logging_dict = {
"version": 1,
"disable_existing_loggers": True,
"formatters": {
"colored": {
"()": "... | format = '%(asctime)s - %(levelname)s - %(name)s - %(message)s'
minimal_format = '%(message)s'
def _get_formatter_and_handler(use_minimal_format: bool=False):
logging_dict = {'version': 1, 'disable_existing_loggers': True, 'formatters': {'colored': {'()': 'coloredlogs.ColoredFormatter', 'format': minimal_format if... |
#!/bin/python3
# Set .union() Operation
# https://www.hackerrank.com/challenges/py-set-union/problem
if __name__ == '__main__':
n = int(input())
students_n = set(map(int, input().split()))
b = int(input())
students_b = set(map(int, input().split()))
print(len(students_n | students_b)) | if __name__ == '__main__':
n = int(input())
students_n = set(map(int, input().split()))
b = int(input())
students_b = set(map(int, input().split()))
print(len(students_n | students_b)) |
def ddd():
for i in 'fasdffghdfghjhfgj':
yield i
a = ddd()
print(next(a))
print(next(a))
print(next(a))
print(next(a))
print(next(a))
| def ddd():
for i in 'fasdffghdfghjhfgj':
yield i
a = ddd()
print(next(a))
print(next(a))
print(next(a))
print(next(a))
print(next(a)) |
# Customer States
C_CALLING = 0
C_WAITING = 1
C_IN_VEHICLE = 2
C_ARRIVED = 3
C_DISAPPEARED = 4
# Vehicle States
V_IDLE = 0
V_CRUISING = 1
V_OCCUPIED = 2
V_ASSIGNED = 3
V_OFF_DUTY = 4 | c_calling = 0
c_waiting = 1
c_in_vehicle = 2
c_arrived = 3
c_disappeared = 4
v_idle = 0
v_cruising = 1
v_occupied = 2
v_assigned = 3
v_off_duty = 4 |
# app seettings
EC2_ACCESS_ID = 'A***Q'
EC2_ACCESS_KEY = 'R***I'
YCSB_SIZE =0
MCROUTER_NOISE = 0
MEMCACHED_OD_SIZE = 1
MEMCACHED_SPOT_SIZE = 0
G_M_MIN = 7.5*1024
G_M_MAX = 7.5*1024
G_C_MIN = 2
G_C_MAX = 2
M_DEFAULT = 7.5*1024
C_DEFAULT = 2
G_M_MIN_2 = 7.5*1024
G_M_MAX_2 = 7.5*1024
G_C_MIN_2 = 2
G_C_MAX_2 = 2
M_... | ec2_access_id = 'A***Q'
ec2_access_key = 'R***I'
ycsb_size = 0
mcrouter_noise = 0
memcached_od_size = 1
memcached_spot_size = 0
g_m_min = 7.5 * 1024
g_m_max = 7.5 * 1024
g_c_min = 2
g_c_max = 2
m_default = 7.5 * 1024
c_default = 2
g_m_min_2 = 7.5 * 1024
g_m_max_2 = 7.5 * 1024
g_c_min_2 = 2
g_c_max_2 = 2
m_default_2 = 7... |
def read_input():
n = int(input())
return (
[input() for _ in range(n)],
input()
)
def find_position(matrix, symbol):
for i in range(len(matrix)):
line = matrix[i]
if symbol in line:
return (i, line.index(symbol))
return None
(matrix, symbol) = read_in... | def read_input():
n = int(input())
return ([input() for _ in range(n)], input())
def find_position(matrix, symbol):
for i in range(len(matrix)):
line = matrix[i]
if symbol in line:
return (i, line.index(symbol))
return None
(matrix, symbol) = read_input()
result = find_posit... |
#string: temperatura
Gc = float(input("Digite grados Centigrados: "))
Gk = (Gc + 273.15)
print("el valor de los grados kelvin es el siguiente: ",Gk)
| gc = float(input('Digite grados Centigrados: '))
gk = Gc + 273.15
print('el valor de los grados kelvin es el siguiente: ', Gk) |
class Triangular:
### Constructor ###
def __init__(self, init, end, center=None, peak=1, floor=0):
# initialize attributes
self._init = init
self._end = end
if center:
#using property to test if its bewtween init and end
self.center = center
else:
... | class Triangular:
def __init__(self, init, end, center=None, peak=1, floor=0):
self._init = init
self._end = end
if center:
self.center = center
else:
self._center = (end + init) / 2
self._peak = peak
self._floor = floor
def __close__(sel... |
# Python - 3.6.0
test.describe('Fixed tests')
test.assert_equals(whatday(1), 'Sunday')
test.assert_equals(whatday(2), 'Monday')
test.assert_equals(whatday(3), 'Tuesday')
test.assert_equals(whatday(8), 'Wrong, please enter a number between 1 and 7')
test.assert_equals(whatday(20), 'Wrong, please enter a number between ... | test.describe('Fixed tests')
test.assert_equals(whatday(1), 'Sunday')
test.assert_equals(whatday(2), 'Monday')
test.assert_equals(whatday(3), 'Tuesday')
test.assert_equals(whatday(8), 'Wrong, please enter a number between 1 and 7')
test.assert_equals(whatday(20), 'Wrong, please enter a number between 1 and 7') |
#
# PySNMP MIB module TPLINK-PORTMIRROR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-PORTMIRROR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:25:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
File = open("File PROTEK/Data2.txt", "w")
while True:
nim = input('Masukan NIM:')
nama = input('Masukan Nama:')
alamat = input('Masukan Alamat:')
print('')
File.write(nim + '|' + nama + '|' + alamat + '\n')
repeat = input('Apakah ingin memasukan data lagi?(y/n):')
print('')
... | file = open('File PROTEK/Data2.txt', 'w')
while True:
nim = input('Masukan NIM:')
nama = input('Masukan Nama:')
alamat = input('Masukan Alamat:')
print('')
File.write(nim + '|' + nama + '|' + alamat + '\n')
repeat = input('Apakah ingin memasukan data lagi?(y/n):')
print('')
if repeat in ... |
# Lv-677_Ivan_Vaulin
# Task2. Write a script that checks the login that the user enters.
# If the login is "First", then greet the users. If the login is different, send an error message.
# (need to use loop while)
user_name = input('Hello, please input your Log in:')
while user_name != 'First':
user_name = inpu... | user_name = input('Hello, please input your Log in:')
while user_name != 'First':
user_name = input('Error: wrong username, please try one more time. Username:')
else:
print('Greeting. Access granted!!!', user_name) |
# -*- coding: UTF-8 -*-
# Copyright 2013 Felix Friedrich, Felix Schwarz
# Copyright 2015, 2019 Felix Schwarz
# The source code in this file is licensed under the MIT license.
# SPDX-License-Identifier: MIT
__all__ = ['Result']
class Result(object):
def __init__(self, value, **data):
self.value = value
... | __all__ = ['Result']
class Result(object):
def __init__(self, value, **data):
self.value = value
self.data = data
def __repr__(self):
klassname = self.__class__.__name__
extra_data = [repr(self.value)]
for (key, value) in sorted(self.data.items()):
extra_da... |
# Test that systemctl will accept service names both with or without suffix.
def test_dot_service(sysvenv):
service = sysvenv.create_service("foo")
service.will_do("status", 3)
service.direct_enable()
out, err, status = sysvenv.systemctl("status", "foo.service")
assert status == 3
assert service... | def test_dot_service(sysvenv):
service = sysvenv.create_service('foo')
service.will_do('status', 3)
service.direct_enable()
(out, err, status) = sysvenv.systemctl('status', 'foo.service')
assert status == 3
assert service.did('status') |
num_list = []
num_list.append(1)
num_list.append(2)
num_list.append(3)
print(num_list[1]) | num_list = []
num_list.append(1)
num_list.append(2)
num_list.append(3)
print(num_list[1]) |
#!/usr/bin/env python
# Paths
VIDEOS_PATH = '~/Desktop/Downloaded Youtube Videos'
VIDEOS_PATH_WIN = '/mnt/e/Alex/Videos/Youtube'
| videos_path = '~/Desktop/Downloaded Youtube Videos'
videos_path_win = '/mnt/e/Alex/Videos/Youtube' |
# Variables that contain the user credentials to access Twitter API
ACCESS_TOKEN ="< Enter your Twitter Access Token >"
ACCESS_TOKEN_SECRET ="< Enter your Access Token Secret >"
CONSUMER_KEY = "< Enter Consumer Key >"
CONSUMER_SECRET = "< Enter Consumer Key Secret >" | access_token = '< Enter your Twitter Access Token >'
access_token_secret = '< Enter your Access Token Secret >'
consumer_key = '< Enter Consumer Key >'
consumer_secret = '< Enter Consumer Key Secret >' |
ft_name = 'points'
featuretype_api = datastore_api.featuretype(name=ft_name, data={
"featureType": {
"circularArcPresent": False,
"enabled": True,
"forcedDecimal": False,
"maxFeatures": 0,
"name": ft_name,
"nativeName": ft_name,
"numDecimals": 0,
"over... | ft_name = 'points'
featuretype_api = datastore_api.featuretype(name=ft_name, data={'featureType': {'circularArcPresent': False, 'enabled': True, 'forcedDecimal': False, 'maxFeatures': 0, 'name': ft_name, 'nativeName': ft_name, 'numDecimals': 0, 'overridingServiceSRS': False, 'padWithZeros': False, 'projectionPolicy': '... |
class Solution:
def spiralMatrixIII(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]:
step = sign = 1
result = [[r0, c0]]
r, c = r0, c0
while len(result) < R*C:
for _ in range(step):
c += sign
if 0 <= r < R and 0 <= c < C:
... | class Solution:
def spiral_matrix_iii(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]:
step = sign = 1
result = [[r0, c0]]
(r, c) = (r0, c0)
while len(result) < R * C:
for _ in range(step):
c += sign
if 0 <= r < R and 0 <= c < C... |
# -*- coding: utf-8 -*-
def includeme(config):
config.register_service_factory('.services.user.rename_user_factory', name='rename_user')
config.include('.views')
config.add_route('admin_index', '/')
config.add_route('admin_admins', '/admins')
config.add_route('admin_badge', '/badge')
config.... | def includeme(config):
config.register_service_factory('.services.user.rename_user_factory', name='rename_user')
config.include('.views')
config.add_route('admin_index', '/')
config.add_route('admin_admins', '/admins')
config.add_route('admin_badge', '/badge')
config.add_route('admin_features', ... |
## Iterative approach - BFS - Using Queue
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def invertTree(self, root: TreeNode) -> TreeNode:
... | class Solution:
def invert_tree(self, root: TreeNode) -> TreeNode:
if root is None:
return None
queue = deque([root])
while queue:
current = queue.popleft()
(current.left, current.right) = (current.right, current.left)
if current.left:
... |
motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
motorcycles[0] = 'ducati'
print(motorcycles)
motorcycles.append('honda')
print(motorcycles)
motorcycles = []
motorcycles.append('suzuki')
motorcycles.append('honda')
motorcycles.append('bmw')
print(motorcycles)
motorcycles.insert(0, 'ducati')
print(mot... | motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
motorcycles[0] = 'ducati'
print(motorcycles)
motorcycles.append('honda')
print(motorcycles)
motorcycles = []
motorcycles.append('suzuki')
motorcycles.append('honda')
motorcycles.append('bmw')
print(motorcycles)
motorcycles.insert(0, 'ducati')
print(motorcyc... |
#
# PySNMP MIB module HP-ICF-LAYER3VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-LAYER3VLAN-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:21:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) ... |
class BaseClient(object):
def __init__(self, username, password, randsalt):
## password = {MD5(pwrd) for old clients, SHA256(pwrd + salt) for new clients}
## randsalt = {"" for old clients, random 16-byte binary string for new clients}
## (here "old" means user was registered over an unencrypted link, without sa... | class Baseclient(object):
def __init__(self, username, password, randsalt):
self.set_user_pwrd_salt(username, (password, randsalt))
def has_legacy_password(self):
return len(self.randsalt) == 0
def set_user_pwrd_salt(self, user_name='', pwrd_hash_salt=('', '')):
assert type(pwrd_h... |
TITLE = "Metadata extractor"
SAVE = "Save"
OPEN = "Open"
EXTRACT = "Extract"
DELETE = "Delete"
META_TITLE = "title"
META_NAMES = "names"
META_CONTENT = "content"
META_LOCATIONS = "locations"
META_KEYWORD = "keyword"
META_REF = "reference"
TYPE_TXT = "txt"
TYPE_ISO19115v2 = "iso19115v2"
TYPE_FGDC = "fgdc"
LABLE_NAME... | title = 'Metadata extractor'
save = 'Save'
open = 'Open'
extract = 'Extract'
delete = 'Delete'
meta_title = 'title'
meta_names = 'names'
meta_content = 'content'
meta_locations = 'locations'
meta_keyword = 'keyword'
meta_ref = 'reference'
type_txt = 'txt'
type_iso19115v2 = 'iso19115v2'
type_fgdc = 'fgdc'
lable_name = '... |
class SpaceAge(object):
def __init__(self, seconds):
self.seconds = seconds
def on_earth(self):
return round(self.seconds / 31557600, 2)
def on_mercury(self):
earth = self.on_earth()
return round(earth / 0.2408467, 2)
def on_venus(self):
return round(self.s... | class Spaceage(object):
def __init__(self, seconds):
self.seconds = seconds
def on_earth(self):
return round(self.seconds / 31557600, 2)
def on_mercury(self):
earth = self.on_earth()
return round(earth / 0.2408467, 2)
def on_venus(self):
return round(self.seco... |
class Tester(object):
def __init__(self):
self.results = dict()
self.params = dict()
self.problem_data = dict()
def set_params(self, params):
self.params = params | class Tester(object):
def __init__(self):
self.results = dict()
self.params = dict()
self.problem_data = dict()
def set_params(self, params):
self.params = params |
class SlackResponseTool:
@classmethod
def response2is_ok(cls, response):
return response["ok"] is True
@classmethod
def response2j_resopnse(cls, response):
return response.data
| class Slackresponsetool:
@classmethod
def response2is_ok(cls, response):
return response['ok'] is True
@classmethod
def response2j_resopnse(cls, response):
return response.data |
#!/usr/bin/env python
NAME = 'Cloudflare (Cloudflare Inc.)'
def is_waf(self):
# This should be given first priority (most reliable)
if self.matchcookie('__cfduid'):
return True
# Not all servers return cloudflare-nginx, only nginx ones
if self.matchheader(('server', 'cloudflare-nginx')) or s... | name = 'Cloudflare (Cloudflare Inc.)'
def is_waf(self):
if self.matchcookie('__cfduid'):
return True
if self.matchheader(('server', 'cloudflare-nginx')) or self.matchheader(('server', 'cloudflare')):
return True
if self.matchheader(('cf-ray', '.*')):
return True
return False |
s = input()
K = int(input())
n = len(s)
substr = set()
for i in range(n):
for j in range(i + 1, i + 1 + K):
if j <= n:
substr.add(s[i:j])
substr = sorted(list(substr))
print(substr[K - 1])
| s = input()
k = int(input())
n = len(s)
substr = set()
for i in range(n):
for j in range(i + 1, i + 1 + K):
if j <= n:
substr.add(s[i:j])
substr = sorted(list(substr))
print(substr[K - 1]) |
def exc():
a=10
b=0
try:
c=a/b
except(ZeroDivisionError ):
print("Divide by zero")
exc()
| def exc():
a = 10
b = 0
try:
c = a / b
except ZeroDivisionError:
print('Divide by zero')
exc() |
A, B, K = map(int, input().split())
for i, num in enumerate(range(A, B + 1)):
if i + 1 > K:
break
print(num)
x = []
for i, num in enumerate(range(B, A-1, -1)):
if i + 1 > K:
break
x.append(num)
x.sort()
k = B - A +1
for i in x:
if k < 2 * K:
k += 1
else:
print(i... | (a, b, k) = map(int, input().split())
for (i, num) in enumerate(range(A, B + 1)):
if i + 1 > K:
break
print(num)
x = []
for (i, num) in enumerate(range(B, A - 1, -1)):
if i + 1 > K:
break
x.append(num)
x.sort()
k = B - A + 1
for i in x:
if k < 2 * K:
k += 1
else:
... |
s = sum(range(1, 101)) ** 2
ss = sum(list(map(lambda x: x ** 2, range(1, 101))))
print(s - ss)
| s = sum(range(1, 101)) ** 2
ss = sum(list(map(lambda x: x ** 2, range(1, 101))))
print(s - ss) |
class Solution(object):
def generateParenthesis(self, n):
# corner case
if n == 0:
return []
# level: tree level
# openCount: open bracket count
def dfs(level, n1, n2, n, stack, ret, openCount):
if level == 2 * n:
ret.append("".join(... | class Solution(object):
def generate_parenthesis(self, n):
if n == 0:
return []
def dfs(level, n1, n2, n, stack, ret, openCount):
if level == 2 * n:
ret.append(''.join(stack[:]))
if n1 < n:
stack.append('(')
dfs(le... |
def find(n: int):
for i in range(1, 1000001):
total = 0
for j in str(i):
total += int(j)
total += i
if total == n:
print(i)
return
print(0)
find(int(input()))
| def find(n: int):
for i in range(1, 1000001):
total = 0
for j in str(i):
total += int(j)
total += i
if total == n:
print(i)
return
print(0)
find(int(input())) |
if True:
pass
else:
x = 3
| if True:
pass
else:
x = 3 |
print("Welcome to the Band Name Generator.")
city_name =input("What's name of the city you grew up in?\n")
pet_name =input("What's your pet's name?\n")
print("Your band name could be Bristole Rabbit")
| print('Welcome to the Band Name Generator.')
city_name = input("What's name of the city you grew up in?\n")
pet_name = input("What's your pet's name?\n")
print('Your band name could be Bristole Rabbit') |
class Settings:
info = {
"version": "0.2.0",
"description": "Python library which allows to read, modify, create and run EnergyPlus files and simulations."
}
groups = {
'simulation_parameters': [
'Timestep',
'Version',
'SimulationControl',
... | class Settings:
info = {'version': '0.2.0', 'description': 'Python library which allows to read, modify, create and run EnergyPlus files and simulations.'}
groups = {'simulation_parameters': ['Timestep', 'Version', 'SimulationControl', 'ShadowCalculations', 'SurfaceConvectionAlgorithm:Outside', 'SurfaceConvecti... |
DEBUG = False
SECRET_KEY = '3tJhmR0XFbSOUG02Wpp7'
CSRF_ENABLED = True
CSRF_SESSION_LKEY = 'e8uXRmxo701QarZiXxGf'
| debug = False
secret_key = '3tJhmR0XFbSOUG02Wpp7'
csrf_enabled = True
csrf_session_lkey = 'e8uXRmxo701QarZiXxGf' |
'''
Statement
Given a month - an integer from 1 to 12, print the number of days in it in the year 2017.
Example input #1
1
(January)
Example output #1
31
Example input #2
2
(February)
Example output #2
28
'''
month = int(input())
if month == 2:
print(28)
elif month < 8:
if month % 2 == 0:
print(30... | """
Statement
Given a month - an integer from 1 to 12, print the number of days in it in the year 2017.
Example input #1
1
(January)
Example output #1
31
Example input #2
2
(February)
Example output #2
28
"""
month = int(input())
if month == 2:
print(28)
elif month < 8:
if month % 2 == 0:
print(30)
... |
# Challenge No 9 Intermediate
# https://www.reddit.com/r/dailyprogrammer/comments/pu1y6/2172012_challenge_9_intermediate/
# Take a string, scan file for string, and replace with another string
def main():
pass
def f_r():
fn = input('Please input filename: ')
sstring = input('Please input string t... | def main():
pass
def f_r():
fn = input('Please input filename: ')
sstring = input('Please input string to search: ')
rstring = input('Please input string to replace: ')
with open(fn, 'r') as f:
filedata = f.read()
filedata = filedata.replace(sstring, rstring)
with open(fn, 'w') ... |
list1=[2,3,8,5,9,2,7,4]
i=0
print("before list",list1)
while i<len(list1):
j=0
while j<i:
if list1[i]<list1[j]:
temp=list1[i]
list1[i]=list1[j]
list1[j]=temp
j+=1
i+=1
print("after",list1) | list1 = [2, 3, 8, 5, 9, 2, 7, 4]
i = 0
print('before list', list1)
while i < len(list1):
j = 0
while j < i:
if list1[i] < list1[j]:
temp = list1[i]
list1[i] = list1[j]
list1[j] = temp
j += 1
i += 1
print('after', list1) |
class TimezoneTool:
@classmethod
def tzdb2abbreviation(cls, tzdb):
if tzdb == "Asia/Seoul":
return "KST"
if tzdb == "America/Los_Angeles":
return "ET"
raise NotImplementedError({"tzdb":tzdb})
| class Timezonetool:
@classmethod
def tzdb2abbreviation(cls, tzdb):
if tzdb == 'Asia/Seoul':
return 'KST'
if tzdb == 'America/Los_Angeles':
return 'ET'
raise not_implemented_error({'tzdb': tzdb}) |
def shortest_path(sx, sy, maze):
w = len(maze[0])
h = len(maze)
board = [[None for i in range(w)] for i in range(h)]
board[sx][sy] = 1
arr = [(sx, sy)]
while arr:
x, y = arr.pop(0)
for i in [[1, 0], [-1, 0], [0, -1], [0, 1]]:
nx, ny = x + i[0], y + i[1]
... | def shortest_path(sx, sy, maze):
w = len(maze[0])
h = len(maze)
board = [[None for i in range(w)] for i in range(h)]
board[sx][sy] = 1
arr = [(sx, sy)]
while arr:
(x, y) = arr.pop(0)
for i in [[1, 0], [-1, 0], [0, -1], [0, 1]]:
(nx, ny) = (x + i[0], y + i[1])
... |
# -----------------------------------------------------------------------------
# Copyright (c) 2013-2022, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.tx... | excludedimports = ['pytest'] |
# 1
# Answer: Programming language
# 2
# Answer: B
# 3
print("Hi")
# 4
# Answer: quit()
# 5
# Answer: 6
# 6
# Answer: B
# 7
# Answer: - 10 +
# 8
# Answer: >>> 1 / 0
# 9
# Answer: A
# 10
# Answer: 15.0
# 11
# Answer: 3
# 12
# Answer: A
# 13
# Answer: \"something\"
# 14
# Answer: input
# 15
# Answer: "World... | print('Hi') |
#!/usr/bin/env python
NAME = 'BIG-IP Local Traffic Manager (F5 Networks)'
def is_waf(self):
if self.matchcookie(r'^BIGipServer'):
return True
elif self.matchheader(('X-Cnection', r'^close$'), attack=True):
return True
else:
return False
| name = 'BIG-IP Local Traffic Manager (F5 Networks)'
def is_waf(self):
if self.matchcookie('^BIGipServer'):
return True
elif self.matchheader(('X-Cnection', '^close$'), attack=True):
return True
else:
return False |
print("ma petite chaine en or", end='')
| print('ma petite chaine en or', end='') |
# function for insertion sort
def Insertion_Sort(list):
for i in range(1, len(list)):
temp = list[i]
j = i - 1
while j >= 0 and list[j] > temp:
list[j + 1] = list[j]
j -= 1
list[j + 1] = temp
# function to print list
def Print_list(list):
for i in range(... | def insertion__sort(list):
for i in range(1, len(list)):
temp = list[i]
j = i - 1
while j >= 0 and list[j] > temp:
list[j + 1] = list[j]
j -= 1
list[j + 1] = temp
def print_list(list):
for i in range(0, len(list)):
print(list[i], end=' ')
prin... |
def cleanupFile(file_path):
with open(file_path,'r') as f:
with open("data/transactions.csv",'w') as f1:
next(f) # skip header line
for line in f:
f1.write(line)
def getDateParts(date_string):
year = ''
month = ''
day = ''
date_parts = date_string.split('-')
if (len(date_parts) > 2):
year = date_... | def cleanup_file(file_path):
with open(file_path, 'r') as f:
with open('data/transactions.csv', 'w') as f1:
next(f)
for line in f:
f1.write(line)
def get_date_parts(date_string):
year = ''
month = ''
day = ''
date_parts = date_string.split('-')
if... |
#calculation of power using recursion
def exponentOfNumber(base,power):
if power == 0:
return 1
else:
return base * exponentOfNumber(base,power-1)
print("Enter only positive numbers below: ",)
print("Enter a base: ")
number = int(input())
print("Enter a power: ")
exponent = int(input())
re... | def exponent_of_number(base, power):
if power == 0:
return 1
else:
return base * exponent_of_number(base, power - 1)
print('Enter only positive numbers below: ')
print('Enter a base: ')
number = int(input())
print('Enter a power: ')
exponent = int(input())
result = exponent_of_number(number, exp... |
def sma():
pass
def ema():
pass
| def sma():
pass
def ema():
pass |
dict1={'Influenza':['Relenza','B 0 D'],'Swine Flu':['Symmetrel','B L D'],'Cholera':['Ciprofloxacin','B 0 D'],'Typhoid':['Azithromycin','B L D'],'Sunstroke':['Barbiturates','0 0 D'],'Common cold':['Ibuprufen','B 0 D'],'Whooping Cough':['Erthromycin','B 0 D'],'Gastroentritis':['Gelusil','B 0 D'],'Conjunctivitus':['Romyci... | dict1 = {'Influenza': ['Relenza', 'B 0 D'], 'Swine Flu': ['Symmetrel', 'B L D'], 'Cholera': ['Ciprofloxacin', 'B 0 D'], 'Typhoid': ['Azithromycin', 'B L D'], 'Sunstroke': ['Barbiturates', '0 0 D'], 'Common cold': ['Ibuprufen', 'B 0 D'], 'Whooping Cough': ['Erthromycin', 'B 0 D'], 'Gastroentritis': ['Gelusil', 'B 0 D'],... |
def solve(captcha, step):
result = 0
for i in range(len(captcha)):
if captcha[i] == captcha[(i + step) % len(captcha)]:
result += int(captcha[i])
return result
if __name__ == '__main__':
solve_part1 = lambda captcha: solve(captcha, 1)
solve_part2 = lambda captcha: solve(captcha,... | def solve(captcha, step):
result = 0
for i in range(len(captcha)):
if captcha[i] == captcha[(i + step) % len(captcha)]:
result += int(captcha[i])
return result
if __name__ == '__main__':
solve_part1 = lambda captcha: solve(captcha, 1)
solve_part2 = lambda captcha: solve(captcha, ... |
print ('{0:.3f}'.format(1.0/3))
print('{0} / {1} = {2:.3f}'.format(3, 4,3/4 ))
# fill with underscores (_) with the text centered
# (^) to 11 width '___hello___'
print ('{0:_^9}'.format('hello'))
def variable(name=''):
print('{0:*^12}'.format(name))
variable()
print('{0:*^12}'.format('sendra'))
variable()
# keyword... | print('{0:.3f}'.format(1.0 / 3))
print('{0} / {1} = {2:.3f}'.format(3, 4, 3 / 4))
print('{0:_^9}'.format('hello'))
def variable(name=''):
print('{0:*^12}'.format(name))
variable()
print('{0:*^12}'.format('sendra'))
variable()
print('{name} read {book} now.'.format(name='My Lovely Friend Sendra', book='A Byte of Py... |
INH = "Inherent" # The 'address' is inherent in the opcode. e.g. ABX
INT = "Interregister" # An pseudo-addressing for an immediate operand which specified registers for the EXG and TFR instructions
IMM = "Immediate" # Operand immediately follows the opcode. A literal. Could be 8-bit (LDA), 16-bi... | inh = 'Inherent'
int = 'Interregister'
imm = 'Immediate'
dir = 'PageDirect'
idx = 'Indexed'
ext = 'ExtendedDirect'
rel8 = 'Relative8 8-bit'
rel16 = 'Relative8 16-bit' |
'''
Given a number A. Find the fatorial of the number.
Problem Constraints
1 <= A <= 100
'''
def factorial(A: int) -> int:
if A <= 1:
return 1
return (A * factorial(A-1))
if __name__ == "__main__":
A = 3
print(factorial(A)) | """
Given a number A. Find the fatorial of the number.
Problem Constraints
1 <= A <= 100
"""
def factorial(A: int) -> int:
if A <= 1:
return 1
return A * factorial(A - 1)
if __name__ == '__main__':
a = 3
print(factorial(A)) |
i = 125874
while True:
if sorted(str(i)) == sorted(str(i * 2)) == sorted(str(i * 3)) == sorted(str(i * 4)) == sorted(str(i * 5)) == sorted(str(i * 6)):
break
else:
i += 1
print(i) | i = 125874
while True:
if sorted(str(i)) == sorted(str(i * 2)) == sorted(str(i * 3)) == sorted(str(i * 4)) == sorted(str(i * 5)) == sorted(str(i * 6)):
break
else:
i += 1
print(i) |
#!/usr/bin/env python3
a = ["uno", "dos", "tres"]
b = [f"{i:#04d} {e}" for i,e in enumerate(a)]
print(b)
| a = ['uno', 'dos', 'tres']
b = [f'{i:#04d} {e}' for (i, e) in enumerate(a)]
print(b) |
def test_app_is_created(app):
assert app.name == 'care_api.app'
def test_request_returns_404(client):
assert client.get('/url_not_found').status_code == 404 | def test_app_is_created(app):
assert app.name == 'care_api.app'
def test_request_returns_404(client):
assert client.get('/url_not_found').status_code == 404 |
def pi_nks(limit: int) -> float:
pi: float = 3.0
s: int = 1
for i in range(2, limit, 2):
pi += (s*4/(i*(i+1)*(i+2)))
s = s*(-1)
return pi
def pi_gls(limit: int) -> float:
pi: float = 0.0
s: int = 1
for i in range(1, limit, 2):
pi += (s*(4/i))
s = s*(-1)
... | def pi_nks(limit: int) -> float:
pi: float = 3.0
s: int = 1
for i in range(2, limit, 2):
pi += s * 4 / (i * (i + 1) * (i + 2))
s = s * -1
return pi
def pi_gls(limit: int) -> float:
pi: float = 0.0
s: int = 1
for i in range(1, limit, 2):
pi += s * (4 / i)
s = ... |
#
# Script for converting collected NR data into
# the format for comparison with the simulations
#
def clean_and_save(file1, file2, cx, cy, ech):
''' Remove rows with character ech from
the data in file1 column cy and corresponding
rows in cx, then save to file2. Column numbering
starts with 0. '''
with... | def clean_and_save(file1, file2, cx, cy, ech):
""" Remove rows with character ech from
the data in file1 column cy and corresponding
rows in cx, then save to file2. Column numbering
starts with 0. """
with open(file1, 'r') as fin, open(file2, 'w') as fout:
next(fin)
for line in fin:
... |
# Set to 1 or 2 to show what we send and receive from the SMTP server
SMTP_DEBUG = 0
SMTP_HOST = ''
SMTP_PORT = 465
SMTP_FROM_ADDRESSES = ()
SMTP_TO_ADDRESS = ''
# these two can also be set by the environment variables with the same name
SMTP_USERNAME = ''
SMTP_PASSWORD = ''
IMAP_HOSTNAME = ''
IMAP_USERNAME = ''
IMA... | smtp_debug = 0
smtp_host = ''
smtp_port = 465
smtp_from_addresses = ()
smtp_to_address = ''
smtp_username = ''
smtp_password = ''
imap_hostname = ''
imap_username = ''
imap_password = ''
imap_list_folder = 'INBOX'
check_accept_age_seconds = 3600 |
class Memorability_Prediction:
def mem_calculation(frame1):
#print ("Inside mem_calculation function")
start_time1 = time.time()
resized_image = caffe.io.resize_image(frame1,[227,227])
net1.blobs['data'].data[...] = transformer1.preprocess('data', resized_image)
... | class Memorability_Prediction:
def mem_calculation(frame1):
start_time1 = time.time()
resized_image = caffe.io.resize_image(frame1, [227, 227])
net1.blobs['data'].data[...] = transformer1.preprocess('data', resized_image)
value = net1.forward()
value = value['fc8-euclidean']... |
#
# PySNMP MIB module ZYXEL-OAM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-OAM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:45:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, constraints_intersection, single_value_constraint, value_range_constraint) ... |
class ToolVariables:
@classmethod
def ExcheckUpdate(cls):
cls.INTAG = "ExCheck"
return cls
| class Toolvariables:
@classmethod
def excheck_update(cls):
cls.INTAG = 'ExCheck'
return cls |
class ScheduleItem:
def __init__(item, task):
item.task = task
item.start_time = None
item.end_time = None
item.child_start_time = None
item.pred_task = None
item.duration = task.duration
item.total_effort = None
item.who = ''
class Schedule:
def ... | class Scheduleitem:
def __init__(item, task):
item.task = task
item.start_time = None
item.end_time = None
item.child_start_time = None
item.pred_task = None
item.duration = task.duration
item.total_effort = None
item.who = ''
class Schedule:
de... |
#%%
class Book:
def __init__(self,author,name,pageNum):
self.__author = author
self.__name = name
self.__pageNum = pageNum
def getAuthor(self):
return self.__author
def getName(self):
return self.__name
def getPageNum(self):
return self.__pageNu... | class Book:
def __init__(self, author, name, pageNum):
self.__author = author
self.__name = name
self.__pageNum = pageNum
def get_author(self):
return self.__author
def get_name(self):
return self.__name
def get_page_num(self):
return self.__pageNum
... |
# ---------------------------------------------------------------------------------------------
# Copyright (c) Akash Nag. All rights reserved.
# Licensed under the MIT License. See LICENSE.md in the project root for license information.
# ------------------------------------------------------------------------------... | class Cursorposition:
def __init__(self, y, x):
self.y = y
self.x = x
def __str__(self):
return '(' + str(self.y + 1) + ',' + str(self.x + 1) + ')'
def __repr__(self):
return '(' + str(self.y) + ',' + str(self.x) + ')' |
N = int(input())
M = int(input())
res = list()
for x in range(N, M+1):
cnt = 0
if x > 1:
for i in range(2, x):
if x % i == 0:
cnt += 1
break
if cnt == 0:
res.append(x)
if len(res) > 0:
print(sum(res))
print(min(res))
else:
... | n = int(input())
m = int(input())
res = list()
for x in range(N, M + 1):
cnt = 0
if x > 1:
for i in range(2, x):
if x % i == 0:
cnt += 1
break
if cnt == 0:
res.append(x)
if len(res) > 0:
print(sum(res))
print(min(res))
else:
pri... |
# Application settings
# Flask settings
DEBUG = False
# Flask-restplus settings
RESTPLUS_MASK_SWAGGER = False
SWAGGER_UI_DOC_EXPANSION = 'none'
# API metadata
API_TITLE = 'MAX Breast Cancer Mitosis Detector'
API_DESC = 'Predict the probability of the input image containing mitosis.'
API_VERSION = '0.1'
# default mo... | debug = False
restplus_mask_swagger = False
swagger_ui_doc_expansion = 'none'
api_title = 'MAX Breast Cancer Mitosis Detector'
api_desc = 'Predict the probability of the input image containing mitosis.'
api_version = '0.1'
model_name = 'MAX Breast Cancer Mitosis Detector'
default_model_path = 'assets/deep_histopath_mod... |
#
# @lc app=leetcode id=1431 lang=python3
#
# [1431] Kids With the Greatest Number of Candies
#
# @lc code=start
class Solution:
def kidsWithCandies(self, candies: List[int], extra_candies: int) -> List[bool]:
max_candies = max(candies)
return [i + extra_candies >= max_candies for i in candies]
# @... | class Solution:
def kids_with_candies(self, candies: List[int], extra_candies: int) -> List[bool]:
max_candies = max(candies)
return [i + extra_candies >= max_candies for i in candies] |
def repeated_n_times(nums):
# nums.length == 2 * n
n = len(nums) // 2
for num in nums:
if nums.count(num) == n:
return num
print(repeated_n_times([1, 2, 3, 3]))
print(repeated_n_times([2, 1, 2, 5, 3, 2]))
print(repeated_n_times([5, 1, 5, 2, 5, 3, 5, 4]))
| def repeated_n_times(nums):
n = len(nums) // 2
for num in nums:
if nums.count(num) == n:
return num
print(repeated_n_times([1, 2, 3, 3]))
print(repeated_n_times([2, 1, 2, 5, 3, 2]))
print(repeated_n_times([5, 1, 5, 2, 5, 3, 5, 4])) |
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
# See:
# https://docs.microsoft.com/en-us/windows/win32/eventlog/event-types
# https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-reporteventa#parameters
# https://docs.microsoft.com/en... | event_types = {'success': 4, 'error': 2, 'warning': 3, 'information': 4, 'success audit': 4, 'failure audit': 2} |
@outputSchema('vals: {(val:chararray)}')
def convert(the_input):
# This converts the indeterminate number of vals into a bag.
out = []
for map in the_input:
out.append(map)
return out
| @output_schema('vals: {(val:chararray)}')
def convert(the_input):
out = []
for map in the_input:
out.append(map)
return out |
class Solution:
def recurse(self, n, stack, cur_open) :
if n == 0 :
self.ans.append(stack+')'*cur_open)
return
for i in range(cur_open+1) :
self.recurse(n-1, stack+(')'*i)+'(', cur_open-i+1)
# @param A : integer
# @return a list of strings
def g... | class Solution:
def recurse(self, n, stack, cur_open):
if n == 0:
self.ans.append(stack + ')' * cur_open)
return
for i in range(cur_open + 1):
self.recurse(n - 1, stack + ')' * i + '(', cur_open - i + 1)
def generate_parenthesis(self, A):
if A <= 0:
... |
class Solution:
def rangeBitwiseAnd(self, left: int, right: int) -> int:
i = 0 # how many bit right shifted
while left != right:
left >>= 1
right >>= 1
i += 1
return left << i
# TESTS
for left, right, expected in [
(5, 7, 4),
(0, 1, 0),
(26,... | class Solution:
def range_bitwise_and(self, left: int, right: int) -> int:
i = 0
while left != right:
left >>= 1
right >>= 1
i += 1
return left << i
for (left, right, expected) in [(5, 7, 4), (0, 1, 0), (26, 30, 24)]:
sol = solution()
actual = sol... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"plot_sequence": "10_core_overview.ipynb",
"plot_sequence_1d": "10_core_overview.ipynb",
"get_alphabet": "11_core_elements.ipynb",
"get_element_counts": "11_core_elements.ipynb",
... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'plot_sequence': '10_core_overview.ipynb', 'plot_sequence_1d': '10_core_overview.ipynb', 'get_alphabet': '11_core_elements.ipynb', 'get_element_counts': '11_core_elements.ipynb', 'get_first_positions': '11_core_elements.ipynb', 'get_element_frequenc... |
print("Challenges 38: WAF program to print the number of prime numbers which are less than or equal to a given integer.")
n = 7
nums = range(2, n+1)
num_of_divisors = 0
counter = 0
for x in nums:
for i in range(1, x+1):
if x % i == 0:
num_of_divisors += 1
if num_of_divisors == 2:
counter ... | print('Challenges 38: WAF program to print the number of prime numbers which are less than or equal to a given integer.')
n = 7
nums = range(2, n + 1)
num_of_divisors = 0
counter = 0
for x in nums:
for i in range(1, x + 1):
if x % i == 0:
num_of_divisors += 1
if num_of_divisors == 2:
counter... |
def n_to_triangularno_stevilo(n):
stevilo = 0
a = 1
for i in range(n):
stevilo += a
a += 1
return stevilo
def prvo_triangularno_stevilo_Z_vec_kot_k_delitelji(k):
j = 0
n = 0
stevilo_deliteljev = 0
while stevilo_deliteljev <= k:
stevilo_deliteljev = 0
... | def n_to_triangularno_stevilo(n):
stevilo = 0
a = 1
for i in range(n):
stevilo += a
a += 1
return stevilo
def prvo_triangularno_stevilo_z_vec_kot_k_delitelji(k):
j = 0
n = 0
stevilo_deliteljev = 0
while stevilo_deliteljev <= k:
stevilo_deliteljev = 0
j +=... |
# mock.py
# Test tools for mocking and patching.
# Copyright (C) 2007 Michael Foord
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# mock 0.3.1
# http://www.voidspace.org.uk/python/mock.html
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml
# Scripts maintained at ht... | __all__ = ('Mock', 'patch', 'sentinel', '__version__')
__version__ = '0.3.1'
class Mock(object):
def __init__(self, methods=None, spec=None, name=None, parent=None):
self._parent = parent
self._name = name
if spec is not None and methods is None:
methods = [member for member in... |
a = 10
def f():
global a
a = 100
def ober():
b = 100
def unter():
nonlocal b
b = 1000
def unterunter():
nonlocal b
b = 10000
unterunter()
unter()
print(b)
ober()
def xyz(x):
return x * x
z = lambda x: x * x
print(z(... | a = 10
def f():
global a
a = 100
def ober():
b = 100
def unter():
nonlocal b
b = 1000
def unterunter():
nonlocal b
b = 10000
unterunter()
unter()
print(b)
ober()
def xyz(x):
return x * x
z = lambda x: x * x
print(z(3))
my_list = [1... |
# Responsible for giving targets to the Quadrocopter control lopp
class HighLevelLogic:
def __init__(self, control_loop, state_provider):
self.controllers
self.flightmode = FlightModeLanded()
self.control_loop = control_loop
state_provider.registerListener(self)
# Tells all sy... | class Highlevellogic:
def __init__(self, control_loop, state_provider):
self.controllers
self.flightmode = flight_mode_landed()
self.control_loop = control_loop
state_provider.registerListener(self)
def update(self, timedelta):
newmode = self.flightmode.update(timedelta... |
keyb = '`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;\'ZXCVBNM,./'
while True:
try:
frase = input()
decod = ''
for c in frase:
if c == ' ':
decod += c
else:
decod += keyb[keyb.index(c)-1]
print(decod)
except EOFError:
break | keyb = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"
while True:
try:
frase = input()
decod = ''
for c in frase:
if c == ' ':
decod += c
else:
decod += keyb[keyb.index(c) - 1]
print(decod)
except EOFError:
break |
def fun(n):
fact = 1
for i in range(1,n+1):
fact = fact * i
return fact
n= int(input())
k = fun(n)
j = fun(n//2)
l = j//(n//2)
print(((k//(j**2))*(l**2))//2) | def fun(n):
fact = 1
for i in range(1, n + 1):
fact = fact * i
return fact
n = int(input())
k = fun(n)
j = fun(n // 2)
l = j // (n // 2)
print(k // j ** 2 * l ** 2 // 2) |
palavras = ("Aprender", "Programar", "Linguagem", "Python", "Curso", "Gratis", "Estudar", "Praticar", "Trabalhar ", "Mercado", "Programar", "Futuro")
for vol in palavras:
print(f"\nNa palavra {vol.upper()} temos", end=" ")
for letra in vol:
if letra.lower() in "aeiou":
print(letra, end=" ")
| palavras = ('Aprender', 'Programar', 'Linguagem', 'Python', 'Curso', 'Gratis', 'Estudar', 'Praticar', 'Trabalhar ', 'Mercado', 'Programar', 'Futuro')
for vol in palavras:
print(f'\nNa palavra {vol.upper()} temos', end=' ')
for letra in vol:
if letra.lower() in 'aeiou':
print(letra, end=' ') |
# a = int(input('Numerador: ')) # se tentarmos colocar uma letra aqui vai da erro de valor ValueError
# b = int(input('Denominador: ')) # se colocar 0 aqui vai acontecer uma excecao ZeroDivisionError - divisao por zero
# r = a/b
# print(f'A divisao de {a} por {b} vale = {r}')
# para tratar erros a gente usa o com... | try:
a = int(input('Numerador: '))
b = int(input('Denominador: '))
r = a / b
except Exception as erro:
print(f'Erro encontrado = {erro.__class__}')
else:
print(f'O resultado foi = {r}')
finally:
print('Volte sempre! Obrigado!') |
class Solution:
def numTilings(self, n: int) -> int:
mod = 1_000_000_000 + 7
f = [[0 for i in range(1 << 2)] for i in range(2)]
f[0][(1 << 2) - 1] = 1
o0 = 0
o1 = 1
for i in range(n):
f[o1][0] = f[o0][(1 << 2) - 1]
f[o1][1] = (f[o0][0] + f[o0][... | class Solution:
def num_tilings(self, n: int) -> int:
mod = 1000000000 + 7
f = [[0 for i in range(1 << 2)] for i in range(2)]
f[0][(1 << 2) - 1] = 1
o0 = 0
o1 = 1
for i in range(n):
f[o1][0] = f[o0][(1 << 2) - 1]
f[o1][1] = (f[o0][0] + f[o0][2... |
def escreva(texto):
tam = len(texto) + 4
print('~' * tam)
print(f' {texto}')
print('~' * tam)
escreva(str(input('Digite um texto: '))) | def escreva(texto):
tam = len(texto) + 4
print('~' * tam)
print(f' {texto}')
print('~' * tam)
escreva(str(input('Digite um texto: '))) |
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# normal recursive solution
# this recursive solution will call more methods which cause Time Limit Exceed
class Solution1:
# @param {TreeNode} root
# @return... | class Solution1:
def max_depth(self, root):
if root is None:
return 0
if self.left is None and self.right is None:
return 1
elif self.left is not None and self.right is not None:
return self.maxDepth(self.left) + 1 if self.maxDepth(self.left) > self.maxDe... |
url = 'http://127.0.0.1:3001/post'
dapr_url = "http://localhost:3500/v1.0/invoke/dp-61c2cb20562850d49d47d1c7-executorapp/method/health"
# dapr_url = "http://localhost:3500/v1.0/healthz"
# res = requests.post(dapr_url, json.dumps({'a': random.random() * 1000}))
# res = requests.get(dapr_url, )
#
#
#
# print(res.text)
... | url = 'http://127.0.0.1:3001/post'
dapr_url = 'http://localhost:3500/v1.0/invoke/dp-61c2cb20562850d49d47d1c7-executorapp/method/health' |
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_v_floatarray.tif test_splineinverse_c_flo... | command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_v_floatarray.tif test_splineinverse_c_float_v_floatarray')
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_u_floatarray.tif test_splineinverse_c_float_u_floatarray')
command += testshade('-t 1 -g 64... |
'''
Example:
import dk
cfg = dk.load_config(config_path='~/donkeycar/donkeycar/parts/RLConfig.py')
print(cfg.CAMERA_RESOLUTION)
'''
MODE_COMPLEX_LANE_FOLLOW = 0
MODE_SIMPLE_LINE_FOLLOW = 1
MODE_STEER_THROTTLE = MODE_COMPLEX_LANE_FOLLOW
# MODE_STEER_THROTTLE = MODE_SIMPLE_LINE_FOLLOW
PARTIAL_NN_CNT = 45000
#... | """
Example:
import dk
cfg = dk.load_config(config_path='~/donkeycar/donkeycar/parts/RLConfig.py')
print(cfg.CAMERA_RESOLUTION)
"""
mode_complex_lane_follow = 0
mode_simple_line_follow = 1
mode_steer_throttle = MODE_COMPLEX_LANE_FOLLOW
partial_nn_cnt = 45000
switch_to_nn = 1000
update_nn = 1000
save_nn = 1000
thr... |
def build_filter(args):
return Filter(args)
class Filter:
def __init__(self, args):
pass
def file_data_filter(self, file_data):
file_ctx = file_data["file_ctx"]
if not file_ctx.isbinary():
file_data["data"] = file_data["data"].replace(b"\r\n", b"\n")
| def build_filter(args):
return filter(args)
class Filter:
def __init__(self, args):
pass
def file_data_filter(self, file_data):
file_ctx = file_data['file_ctx']
if not file_ctx.isbinary():
file_data['data'] = file_data['data'].replace(b'\r\n', b'\n') |
print(round(1.23,1))
print(round(1.2345, 3))
# Negative numbers round the ones, tens, hundreds and so on..
print(round(123124123, -1))
print(round(54213, -2))
# Round is not neccessary for display reasons. use format instead
x = 1.8913479812313
print("value is {:0.3f}".format(x)) | print(round(1.23, 1))
print(round(1.2345, 3))
print(round(123124123, -1))
print(round(54213, -2))
x = 1.8913479812313
print('value is {:0.3f}'.format(x)) |
def get_emails():
while True:
email_info = input().split(' ')
if email_info[0] == 'Stop':
break
sender, receiver, content = email_info
email = Email(sender, receiver, content)
emails.append(email)
class Email:
def __init__(self, sender, receiver, content):... | def get_emails():
while True:
email_info = input().split(' ')
if email_info[0] == 'Stop':
break
(sender, receiver, content) = email_info
email = email(sender, receiver, content)
emails.append(email)
class Email:
def __init__(self, sender, receiver, content):... |
pattern_zero=[0.0, 0.017538265306, 0.03443877551, 0.035714285714, 0.050701530612, 0.05325255102, 0.066326530612, 0.070153061224, 0.071428571429, 0.08131377551, 0.086415816327, 0.088966836735, 0.095663265306, 0.102040816327, 0.105867346939, 0.107142857143, 0.109375, 0.117028061224, 0.122130102041, 0.122448979592, 0.1246... | pattern_zero = [0.0, 0.017538265306, 0.03443877551, 0.035714285714, 0.050701530612, 0.05325255102, 0.066326530612, 0.070153061224, 0.071428571429, 0.08131377551, 0.086415816327, 0.088966836735, 0.095663265306, 0.102040816327, 0.105867346939, 0.107142857143, 0.109375, 0.117028061224, 0.122130102041, 0.122448979592, 0.12... |
def main() -> None:
x0, y0, x1, y1 = map(int, input().split())
for dx in range(-2, 3):
for dy in range(-2, 3):
if abs(dx) + abs(dy) != 3:
continue
if abs(dx) == 0 or abs(dy) == 0:
continue
x = x0 + dx
y = y0 + dy
... | def main() -> None:
(x0, y0, x1, y1) = map(int, input().split())
for dx in range(-2, 3):
for dy in range(-2, 3):
if abs(dx) + abs(dy) != 3:
continue
if abs(dx) == 0 or abs(dy) == 0:
continue
x = x0 + dx
y = y0 + dy
... |
# Copyright (c) 2010 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.
# This file was split off from ppapi.gyp to prevent PPAPI users from
# needing to DEPS in ~10K files due to mesa.
{
'includes': [
'../../../third... | {'includes': ['../../../third_party/mesa/mesa.gypi'], 'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'ppapi_egl', 'type': 'static_library', 'dependencies': ['<(DEPTH)/ppapi/ppapi.gyp:ppapi_c'], 'include_dirs': ['include'], 'defines': ['PUBLIC=', '_EGL_PLATFORM_PPAPI=_EGL_NUM_PLATFORMS', '_EGL_NATIVE_PLA... |
# 5658. Maximum Absolute Sum of Any Subarray
# Biweekly contest 45
class Solution:
def maxAbsoluteSum(self, nums: List[int]) -> int:
currentmax = globalmax = currentmin = nums[0]
for i in range(1, len(nums)):
x, y = nums[i] + currentmax, nums[i] + currentmin
currentmax = max... | class Solution:
def max_absolute_sum(self, nums: List[int]) -> int:
currentmax = globalmax = currentmin = nums[0]
for i in range(1, len(nums)):
(x, y) = (nums[i] + currentmax, nums[i] + currentmin)
currentmax = max(nums[i], x, y)
currentmin = min(nums[i], x, y)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.