content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def swapPairs(self, head: ListNode) -> ListNode:
pre, pre.next = self, head
while pre.next and pre.next.next:
a = pre.next
b ... | class Solution:
def swap_pairs(self, head: ListNode) -> ListNode:
(pre, pre.next) = (self, head)
while pre.next and pre.next.next:
a = pre.next
b = a.next
(pre.next, b.next, a.next) = (b, a, b.next)
pre = a
return self.next |
class layerClass():
"""Class describing single layer of the bundle"""
def __init__(self, residues):
self.res = residues
def __str__(self):
return " ".join(["%s:%s" % (r.chain_name, r.res.id[1]) for r in self.res])
def get_layer_CA(self):
return [ [res.Ca[0], res.Ca[1], res.Ca[2] ] for res in self.res ]
d... | class Layerclass:
"""Class describing single layer of the bundle"""
def __init__(self, residues):
self.res = residues
def __str__(self):
return ' '.join(['%s:%s' % (r.chain_name, r.res.id[1]) for r in self.res])
def get_layer_ca(self):
return [[res.Ca[0], res.Ca[1], res.Ca[2]]... |
#!/usr/bin/env python3
passphrases = []
try:
while True:
passphrases.append(input())
except EOFError:
pass
s1 = 0
for passphrase in passphrases:
words = set()
for word in passphrase.split():
if word in words:
break
words.add(word)
else:
s1 += 1
s2=0
fo... | passphrases = []
try:
while True:
passphrases.append(input())
except EOFError:
pass
s1 = 0
for passphrase in passphrases:
words = set()
for word in passphrase.split():
if word in words:
break
words.add(word)
else:
s1 += 1
s2 = 0
for passphrase in passphras... |
#!/usr/bin/env python3
# coding: utf-8
def save_vtk(fn: str, vtkn: str, dtn: str, pts, seg):
"""
save geometry as vtk file
args:
fn(str) : file name
vtkn (str) : vtk global name
dtn(str): data name
pts (list) : points
seg (list) : segments
"""
with open(fn,... | def save_vtk(fn: str, vtkn: str, dtn: str, pts, seg):
"""
save geometry as vtk file
args:
fn(str) : file name
vtkn (str) : vtk global name
dtn(str): data name
pts (list) : points
seg (list) : segments
"""
with open(fn, 'w') as f:
f.write('# vtk DataFi... |
a3 = int(input("a3="))
a2 = int(input("a2="))
a1 = int(input("a1="))
b2 = int(input("b2="))
b1 = int(input("b1="))
c3 = a3
c2 = a2 + b2
c1 = a1 + b1
print("????? ????? ?????: {0} {1} {2}. ".format(c3 , c2 , c1)) | a3 = int(input('a3='))
a2 = int(input('a2='))
a1 = int(input('a1='))
b2 = int(input('b2='))
b1 = int(input('b1='))
c3 = a3
c2 = a2 + b2
c1 = a1 + b1
print('????? ????? ?????: {0} {1} {2}. '.format(c3, c2, c1)) |
def main(filepath):
#file input
with open(filepath) as file:
rows = [x.strip().split("contain") for x in file.readlines()]
#####---start of input parsing---#####
#hash = {bag: list of contained bags}
#numberhash = {bag: list of cardinalities of contained bags}
#numberhash maps o... | def main(filepath):
with open(filepath) as file:
rows = [x.strip().split('contain') for x in file.readlines()]
numbershash = {}
for i in range(len(rows)):
rows[i][0] = rows[i][0].split(' bags')[0]
rows[i][1] = rows[i][1].split(',')
numbershash[rows[i][0]] = []
for j i... |
class TaskException(Exception):
def __init__(self, message):
self.message = message
class TaskDelayResource(TaskException):
def __init__(self, message=None, resource=None, delay=60*60):
self.message = message
self.resource = resource
self.delay = delay
class TaskError(TaskExcep... | class Taskexception(Exception):
def __init__(self, message):
self.message = message
class Taskdelayresource(TaskException):
def __init__(self, message=None, resource=None, delay=60 * 60):
self.message = message
self.resource = resource
self.delay = delay
class Taskerror(TaskE... |
def sum_triangular_numbers(n):
sum_trian = 0
if n < 0:
return 0
for i in range(n+1):
sum_trian += i*(i+1) // 2
return sum_trian
print(sum_triangular_numbers(4)) | def sum_triangular_numbers(n):
sum_trian = 0
if n < 0:
return 0
for i in range(n + 1):
sum_trian += i * (i + 1) // 2
return sum_trian
print(sum_triangular_numbers(4)) |
class Cat:
def __init__(self, name):
self.name = name
self.fed = False
self.sleepy = False
self.size = 0
def eat(self):
if self.fed:
raise Exception('Already fed.')
self.fed = True
self.sleepy = True
self.size += 1
def sleep(self):
if not self.fed:
raise Excepti... | class Cat:
def __init__(self, name):
self.name = name
self.fed = False
self.sleepy = False
self.size = 0
def eat(self):
if self.fed:
raise exception('Already fed.')
self.fed = True
self.sleepy = True
self.size += 1
def sleep(self... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class VolatileCookie(dict):
def __reduce__(self):
return (VolatileCookie.__new__, (VolatileCookie,))
def __deepcopy__(self, memo):
'''Deep copy of a volatile cookie is intentionally nullified.'''
return type(self)()
| class Volatilecookie(dict):
def __reduce__(self):
return (VolatileCookie.__new__, (VolatileCookie,))
def __deepcopy__(self, memo):
"""Deep copy of a volatile cookie is intentionally nullified."""
return type(self)() |
# -*- coding: UTF-8 -*-
defaults = dict(
BACKEND='django_datawatch.backends.synchronous',
RUN_SIGNALS=True,
SHOW_ADMIN_DEBUG=True)
| defaults = dict(BACKEND='django_datawatch.backends.synchronous', RUN_SIGNALS=True, SHOW_ADMIN_DEBUG=True) |
"These are constants used for Toolbox testing."
# 'name', 'state', 'end_user_registration_required', 'backend_version',
# 'deployment_option', 'buyer_can_select_plan',
# 'buyer_key_regenerate_enabled', 'buyer_plan_change_permission',
# 'buyers_manage_apps', 'buyers_manage_keys', 'custom_keys_enabled','intentions_requi... | """These are constants used for Toolbox testing."""
service_cmp_attrs = {'created_at', 'id', 'links', 'system_name', 'support_email', 'updated_at'}
proxy_config_content_cmp_attrs = {'account_id', 'backend_authentication_value', 'created_at', 'id', 'proxy', 'support_email', 'tenant_id', 'updated_at'}
proxy_config_conten... |
code_to_state = {
'AK': {'name': 'ALASKA', 'fips': '02'},
'AL': {'name': 'ALABAMA', 'fips': '01'},
'AR': {'name': 'ARKANSAS', 'fips': '05'},
'AS': {'name': 'AMERICAN SAMOA', 'fips': '60'},
'AZ': {'name': 'ARIZONA', 'fips': '04'},
'CA': {'name': 'CALIFORNIA', 'fips': '06'},
'CO': {'name': 'CO... | code_to_state = {'AK': {'name': 'ALASKA', 'fips': '02'}, 'AL': {'name': 'ALABAMA', 'fips': '01'}, 'AR': {'name': 'ARKANSAS', 'fips': '05'}, 'AS': {'name': 'AMERICAN SAMOA', 'fips': '60'}, 'AZ': {'name': 'ARIZONA', 'fips': '04'}, 'CA': {'name': 'CALIFORNIA', 'fips': '06'}, 'CO': {'name': 'COLORADO', 'fips': '08'}, 'CT':... |
class TestGames(object):
def __init__(self, game_id):
self.game_id = game_id
@classmethod
def create(self, game_id, highScoreNames=None, maxEntries=None,
onlyKeepBestEntry=None, socialNetwork=None):
return True
@classmethod
def delete(self, game_id):
return ... | class Testgames(object):
def __init__(self, game_id):
self.game_id = game_id
@classmethod
def create(self, game_id, highScoreNames=None, maxEntries=None, onlyKeepBestEntry=None, socialNetwork=None):
return True
@classmethod
def delete(self, game_id):
return True
def g... |
# _ __ _ ___ _ ___ _ _
# | |/ /_ _ __ _| |_ ___ __/ __| __ _| |___ _ __ ___| _ \ |_ _ __ _(_)_ _
# | ' <| '_/ _` | _/ _ (_-<__ \/ _` | / _ \ ' \/ -_) _/ | || / _` | | ' \
# |_|\_\_| \__,_|\__\___/__/___/\__,_|_\___/_|_|_\___|_| |_|\_,_\__, |_|_||_|
# ... | """
This file defines the custom exceptions used in the plugin
"""
class Userinputerror(Exception):
pass |
# Copyright (c) 2021 by Cisco Systems, Inc.
# All rights reserved.
expected_output = {
'evi': {
1: {
'bd_id': {
11: {
'eth_tag': {
0 : {
'mac_addr':{
'0050.56a9.f5af': {
... | expected_output = {'evi': {1: {'bd_id': {11: {'eth_tag': {0: {'mac_addr': {'0050.56a9.f5af': {'esi': '0000.0000.0000.0000.0000', 'next_hops': ['11.11.11.2']}, 'b4a8.b902.32d6': {'esi': '0000.0000.0000.0000.0000', 'next_hops': ['Gi1/0/3:11']}}}}}}}}} |
# Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Hooks specific to the CSCS GPU microbenchmark tests.
#
def set_gpu_arch(self):
'''Set the compile options for the gp... | def set_gpu_arch(self):
"""Set the compile options for the gpu microbenchmarks."""
cs = self.current_system.name
cp = self.current_partition.fullname
self.gpu_arch = None
self.gpu_build = 'cuda'
if cs in {'dom', 'daint'}:
self.gpu_arch = '60'
if self.current_environ.name not in {... |
HTML_VOID_TAGS = [
'area',
'base',
'br',
'col',
'command',
'embed',
'hr',
'img',
'keygen',
'link',
'meta',
'param',
'source',
'track',
'wbr',
]
HTML_TAGS = [
'a',
'address',
'applet',
'area',
'article',
'aside',
'b',
'base',
... | html_void_tags = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']
html_tags = ['a', 'address', 'applet', 'area', 'article', 'aside', 'b', 'base', 'basefont', 'bgsound', 'big', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'code', 'c... |
class BlessError(Exception):
"""
Base Exception for Bless
"""
| class Blesserror(Exception):
"""
Base Exception for Bless
""" |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# https://docs.python.org/3/library/functions.html#bool
# https://docs.python.org/3/library/stdtypes.html#truth
# class bool([x])
# Return a Boolean value, i.e. one of True or False.
def test1():
print(bool(0))
print(bool(0.0))
print(bool(''))
print(bo... | def test1():
print(bool(0))
print(bool(0.0))
print(bool(''))
print(bool(None))
print(bool([]))
print(bool({}))
print(bool(()))
print(bool(set()))
print(bool(range(0)))
print(bool(False))
def test2():
print(bool(100))
print(bool(100.99))
print(bool('huangjian'))
p... |
#!/usr/bin/env python3
# 7.1 Interconvert Strings and Integers
# Implement the atoi and itoa functions.
def atoi(s):
sum = 0
for c in s:
ordc = ord(c)
if 0x30 <= ordc <= 0x39:
n = ordc - 0x30
sum = (sum * 10) + n
if sum > 0 and s[0] == '-':
sum *= -1
... | def atoi(s):
sum = 0
for c in s:
ordc = ord(c)
if 48 <= ordc <= 57:
n = ordc - 48
sum = sum * 10 + n
if sum > 0 and s[0] == '-':
sum *= -1
return sum
def itoa(i):
if i == 0:
return '0'
rstr = ''
neg = i < 0
i = abs(i)
while i >... |
class DragoneyeException(Exception):
def __init__(self, message, error: str = None):
super().__init__(message)
self.error: str = error
| class Dragoneyeexception(Exception):
def __init__(self, message, error: str=None):
super().__init__(message)
self.error: str = error |
pkgname = "bsdpatch"
pkgver = "0.99.1"
pkgrel = 0
build_style = "makefile"
pkgdesc = "FreeBSD patch(1) utility"
maintainer = "q66 <q66@chimera-linux.org>"
license = "BSD-2-Clause"
url = "https://github.com/chimera-linux/bsdpatch"
source = f"https://github.com/chimera-linux/bsdpatch/archive/refs/tags/v{pkgver}.tar.gz"
s... | pkgname = 'bsdpatch'
pkgver = '0.99.1'
pkgrel = 0
build_style = 'makefile'
pkgdesc = 'FreeBSD patch(1) utility'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'BSD-2-Clause'
url = 'https://github.com/chimera-linux/bsdpatch'
source = f'https://github.com/chimera-linux/bsdpatch/archive/refs/tags/v{pkgver}.tar.gz'
s... |
""" Renderers for the template engine. """
__author__ = "Brian Allen Vanderburg II"
__copyright__ = "Copyright 2016"
__license__ = "Apache License 2.0"
class Renderer:
""" A renderer takes content and renders it in some fashion. """
def __init__(self):
""" Initialize the renderer. """
pass
... | """ Renderers for the template engine. """
__author__ = 'Brian Allen Vanderburg II'
__copyright__ = 'Copyright 2016'
__license__ = 'Apache License 2.0'
class Renderer:
""" A renderer takes content and renders it in some fashion. """
def __init__(self):
""" Initialize the renderer. """
pass
... |
"""This module manages the users"""
USERS = {}
class User(object):
"""This class manages the app users"""
def __init__(self, email=None, username=None, password=None):
"""Creates and instance of a user"""
self.email = email
self.username = username
self.password = password
... | """This module manages the users"""
users = {}
class User(object):
"""This class manages the app users"""
def __init__(self, email=None, username=None, password=None):
"""Creates and instance of a user"""
self.email = email
self.username = username
self.password = password
... |
class TestFlow:
def __init__(self, perceive, act, observe):
self.perceive = perceive
self.act = act
self.observe = observe
def __str__(self):
output = ""
if self.perceive and len(self.perceive) > 0:
output += str(self.perceive)
if self.act and len(s... | class Testflow:
def __init__(self, perceive, act, observe):
self.perceive = perceive
self.act = act
self.observe = observe
def __str__(self):
output = ''
if self.perceive and len(self.perceive) > 0:
output += str(self.perceive)
if self.act and len(se... |
objname = ""
subobj = 0
faces = 0
with open("model.obj",'r') as openfileobject:
lines = 0
for line in openfileobject:
lines = lines+1
if 'f' in line:
faces = faces+1
if 'o' in line:
subobj = 0
faces = 0
name = line.strip()
name = name.strip('o')
objname = name
#print(name)
if 'usemtl' i... | objname = ''
subobj = 0
faces = 0
with open('model.obj', 'r') as openfileobject:
lines = 0
for line in openfileobject:
lines = lines + 1
if 'f' in line:
faces = faces + 1
if 'o' in line:
subobj = 0
faces = 0
name = line.strip()
... |
INSTALLED_APPS = ["athanor_job"]
GLOBAL_SCRIPTS = dict()
GLOBAL_SCRIPTS['job'] = {
'typeclass': 'athanor_job.controllers.AthanorJobManager',
'repeats': -1, 'interval': 60, 'desc': 'Job API for Job System',
'locks': "admin:perm(Admin)",
}
| installed_apps = ['athanor_job']
global_scripts = dict()
GLOBAL_SCRIPTS['job'] = {'typeclass': 'athanor_job.controllers.AthanorJobManager', 'repeats': -1, 'interval': 60, 'desc': 'Job API for Job System', 'locks': 'admin:perm(Admin)'} |
def convertTimeToReqStr(timeObj):
dateStr = timeObj.strftime('%d/%m/%Y')
timeStr = "{0}/{1}:{2}:00".format(dateStr, makeTwoDigits(
timeObj.hour), makeTwoDigits(timeObj.minute))
return timeStr
def makeTwoDigits(num):
if(num < 10):
return "0"+str(num)
return num
| def convert_time_to_req_str(timeObj):
date_str = timeObj.strftime('%d/%m/%Y')
time_str = '{0}/{1}:{2}:00'.format(dateStr, make_two_digits(timeObj.hour), make_two_digits(timeObj.minute))
return timeStr
def make_two_digits(num):
if num < 10:
return '0' + str(num)
return num |
class ChannelNotFoundException(Exception):
""" This exception is raised if a channel isn't found """
pass
class OperationNotSupportedException(Exception):
""" This exception is raised if an operation isn't supported on an object/function for a parameter type """
pass
class FileSystemError(OperationNotSupportedE... | class Channelnotfoundexception(Exception):
""" This exception is raised if a channel isn't found """
pass
class Operationnotsupportedexception(Exception):
""" This exception is raised if an operation isn't supported on an object/function for a parameter type """
pass
class Filesystemerror(OperationNot... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
pointer = head
while pointer and pointer.next:
if pointer.val == ... | class Solution:
def delete_duplicates(self, head: ListNode) -> ListNode:
pointer = head
while pointer and pointer.next:
if pointer.val == pointer.next.val:
pointer.next = pointer.next.next
else:
pointer = pointer.next
return head |
# -*- coding: utf-8 -*-
'''
Author: Hannibal
Data:
Desc: local data config
NOTE: Don't modify this file, it's build by xml-to-python!!!
'''
buffinfo_map = {};
buffinfo_map[1] = {"id":1,"aid":30003,"icon":0,};
buffinfo_map[201] = {"id":201,"aid":30001,"icon":201,};
buffinfo_map[202] = {"id":202,"aid":30002,"icon":20... | """
Author: Hannibal
Data:
Desc: local data config
NOTE: Don't modify this file, it's build by xml-to-python!!!
"""
buffinfo_map = {}
buffinfo_map[1] = {'id': 1, 'aid': 30003, 'icon': 0}
buffinfo_map[201] = {'id': 201, 'aid': 30001, 'icon': 201}
buffinfo_map[202] = {'id': 202, 'aid': 30002, 'icon': 202}
buffinfo_map[1... |
'''
Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).
Follow up:
If this function is called many times, how would you optimize it?
'''
... | """
Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).
Follow up:
If this function is called many times, how would you optimize it?
"""
class Sol... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 19 14:17:26 2021
@author: user24
"""
colors = ['red', 'blue', 'green', 'yellow']
colors_iter = iter(colors)
print(type(colors_iter))
print(next(colors_iter))
print(next(colors_iter))
print(next(colors_iter))
print(next(colors_iter))
print(next(colors_it... | """
Created on Mon Jul 19 14:17:26 2021
@author: user24
"""
colors = ['red', 'blue', 'green', 'yellow']
colors_iter = iter(colors)
print(type(colors_iter))
print(next(colors_iter))
print(next(colors_iter))
print(next(colors_iter))
print(next(colors_iter))
print(next(colors_iter)) |
def dict2keys(d=dict()): return sorted(d.keys())
def dict2kvpairs(d=dict(), d2k=dict2keys): return map(lambda k: (k, d[k]), d2k(d))
def dict2str(d=dict(), s1=":", s2=";", d2k=dict2keys): return s2.join(
map(
lambda t: s1.join(map(str, t)),
dict2kvpairs(d, d2k)
)
)
def dict2csv(d=dict(), c=",", d2k=dict2k... | def dict2keys(d=dict()):
return sorted(d.keys())
def dict2kvpairs(d=dict(), d2k=dict2keys):
return map(lambda k: (k, d[k]), d2k(d))
def dict2str(d=dict(), s1=':', s2=';', d2k=dict2keys):
return s2.join(map(lambda t: s1.join(map(str, t)), dict2kvpairs(d, d2k)))
def dict2csv(d=dict(), c=',', d2k=dict2keys)... |
X = int(input())
Y = float(input())
consumo = X / Y
print("%.3f km/l" %consumo)
| x = int(input())
y = float(input())
consumo = X / Y
print('%.3f km/l' % consumo) |
valor = float(input("Digite o valor do premio:"))
imposto = valor- 7/100
valornovo = valor - imposto
primeiro= valornovo * 46/100
segundo = valornovo * 32/100
terceiro = valornovo - (primeiro + segundo)
print("o Premio foi de r$ {}, o valor desconto ficou R$ {} o imposto ficou R$ {}".format(valor, valornovo, imposto))
... | valor = float(input('Digite o valor do premio:'))
imposto = valor - 7 / 100
valornovo = valor - imposto
primeiro = valornovo * 46 / 100
segundo = valornovo * 32 / 100
terceiro = valornovo - (primeiro + segundo)
print('o Premio foi de r$ {}, o valor desconto ficou R$ {} o imposto ficou R$ {}'.format(valor, valornovo, im... |
def binary_search(a, target):
"""Your code goes here."""
first = 0
last = len(a)-1
while (first<=last):
i = (first+last)/2
if a[i]==target:
return i
elif a[i]<target:
first = i+1
else:
last = i -1
return -1 | def binary_search(a, target):
"""Your code goes here."""
first = 0
last = len(a) - 1
while first <= last:
i = (first + last) / 2
if a[i] == target:
return i
elif a[i] < target:
first = i + 1
else:
last = i - 1
return -1 |
pkgname = "libnma"
pkgver = "1.8.38"
pkgrel = 0
build_style = "meson"
configure_args = [
"-Dgtk_doc=false", "-Dlibnma_gtk4=true",
]
hostmakedepends = [
"meson", "pkgconf", "gobject-introspection", "vala", "glib-devel",
"gettext-tiny",
]
makedepends = [
"networkmanager-devel", "gcr-devel", "gtk+3-devel",... | pkgname = 'libnma'
pkgver = '1.8.38'
pkgrel = 0
build_style = 'meson'
configure_args = ['-Dgtk_doc=false', '-Dlibnma_gtk4=true']
hostmakedepends = ['meson', 'pkgconf', 'gobject-introspection', 'vala', 'glib-devel', 'gettext-tiny']
makedepends = ['networkmanager-devel', 'gcr-devel', 'gtk+3-devel', 'gtk4-devel', 'mobile-... |
class Settings():
def __init__(self):
self.screen_width = 800
self.screen_height = 500
self.bg_color = (29, 17, 53)
self.ship_speed_factor = 1.5
| class Settings:
def __init__(self):
self.screen_width = 800
self.screen_height = 500
self.bg_color = (29, 17, 53)
self.ship_speed_factor = 1.5 |
class Solution:
def solve(self, nums, k):
pq = []
for num in nums:
heappush(pq,-num)
for i in range(k):
num = heappop(pq)
heappush(pq,num+1)
return -pq[0]
| class Solution:
def solve(self, nums, k):
pq = []
for num in nums:
heappush(pq, -num)
for i in range(k):
num = heappop(pq)
heappush(pq, num + 1)
return -pq[0] |
# Copyright 2014 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.
{
'variables': {
'chromium_code': 1,
},
'targets': [{
'target_name': 'win_window',
'type': '<(component)',
'dependencies': [
'../... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'win_window', 'type': '<(component)', 'dependencies': ['../../../base/base.gyp:base', '../../../skia/skia.gyp:skia', '../../events/events.gyp:events', '../../gfx/gfx.gyp:gfx', '../../gfx/gfx.gyp:gfx_geometry', '../platform_window.gyp:platform_window'], 'de... |
class IWebProxy:
""" Provides the base interface for implementation of proxy access for the System.Net.WebRequest class. """
def GetProxy(self, destination):
"""
GetProxy(self: IWebProxy,destination: Uri) -> Uri
Returns the URI of a proxy.
destination: A System.Uri that s... | class Iwebproxy:
""" Provides the base interface for implementation of proxy access for the System.Net.WebRequest class. """
def get_proxy(self, destination):
"""
GetProxy(self: IWebProxy,destination: Uri) -> Uri
Returns the URI of a proxy.
destination: A System.Uri that specifies the... |
def wage_increase(group):
'''
Calculates a new wage given a 10% increase for each element in a list and return
a list of containing the new salaries and a list of the raise increases
Parameters
----------
group : list
a list containing a group of people's wages
Returns
... | def wage_increase(group):
"""
Calculates a new wage given a 10% increase for each element in a list and return
a list of containing the new salaries and a list of the raise increases
Parameters
----------
group : list
a list containing a group of people's wages
Returns
... |
class Solution:
def solve(self, blocks):
dp = defaultdict(int)
for a,b in blocks:
dp[b] = max(dp[b], dp[a]+1)
return max(dp.values(),default=0)
| class Solution:
def solve(self, blocks):
dp = defaultdict(int)
for (a, b) in blocks:
dp[b] = max(dp[b], dp[a] + 1)
return max(dp.values(), default=0) |
class GenericRequest(object):
# object represnting the generic request, do not use directly (unless on errors)!
# either use the EndpointRequest subclass for request invloving endpoint data or the DiscoveryRequest subclass for discovery requests
# do not use error responses for discovery requests, either return a... | class Genericrequest(object):
def __init__(self, request, init_namespace, init_name):
self._rawRequest = request
self._namespace = init_namespace
self._name = init_name
self._payloadVersion = request['directive']['header']['payloadVersion']
self._messageId = request['directi... |
__all__ = ['MalformedFileError', 'MalformedCaptionError', 'InvalidCaptionsError', 'MissingFilenameError']
class MalformedFileError(Exception):
"""Error raised when the file is not well formatted"""
class MalformedCaptionError(Exception):
"""Error raised when a caption is not well formatted"""
... | __all__ = ['MalformedFileError', 'MalformedCaptionError', 'InvalidCaptionsError', 'MissingFilenameError']
class Malformedfileerror(Exception):
"""Error raised when the file is not well formatted"""
class Malformedcaptionerror(Exception):
"""Error raised when a caption is not well formatted"""
class Invalidca... |
"""MicroPython tool: abstract connector"""
class ConnError(Exception):
"""General connection error"""
class Timeout(ConnError):
"""Timeout"""
class Conn():
def __init__(self, log=None):
self._log = log
@property
def fd(self):
"""Return file descriptor
"""
retur... | """MicroPython tool: abstract connector"""
class Connerror(Exception):
"""General connection error"""
class Timeout(ConnError):
"""Timeout"""
class Conn:
def __init__(self, log=None):
self._log = log
@property
def fd(self):
"""Return file descriptor
"""
return No... |
# https://leetcode.com/problems/find-peak-element/
class Solution:
def findPeakElement(self, nums: List[int]) -> int:
#use binary search to find peak element
def bin_search(nums, left, right):
if left == right:
return left
... | class Solution:
def find_peak_element(self, nums: List[int]) -> int:
def bin_search(nums, left, right):
if left == right:
return left
mid = (left + right) // 2
if nums[mid] > nums[mid + 1]:
return bin_search(nums, left, mid)
e... |
# Databricks notebook source
MDPSXIUUIQYSSW
VRVXHMDRNPKGDKNMLPZZRZMBPZYSWPUYULCTFVAFAOYCHIOLJLKDATHTIAHBGKLANOGGVIKKOYUIDZGKZARPBYIKTWWIVQVXOZKILOMZSUVXRZJNETULRTGWKJTNSIELVVOIWLCRXJMKALJKJOKRJHPKFGXCQDBPYDNBDJRUCCELIHMEWEZIVOZJZOPMUKKUPCMIBYNMRRZMVCJNNWATBBNKWMGRLRIBTZMDDBCBXLDCJBVNPBOVRXUXDQQKYRECIIGEEROPJSYLCLBRTWHD... | MDPSXIUUIQYSSW
VRVXHMDRNPKGDKNMLPZZRZMBPZYSWPUYULCTFVAFAOYCHIOLJLKDATHTIAHBGKLANOGGVIKKOYUIDZGKZARPBYIKTWWIVQVXOZKILOMZSUVXRZJNETULRTGWKJTNSIELVVOIWLCRXJMKALJKJOKRJHPKFGXCQDBPYDNBDJRUCCELIHMEWEZIVOZJZOPMUKKUPCMIBYNMRRZMVCJNNWATBBNKWMGRLRIBTZMDDBCBXLDCJBVNPBOVRXUXDQQKYRECIIGEEROPJSYLCLBRTWHDHLBJZOTEQZZYENWGEDYSBAXKCWLSL... |
wavelet_type = 'dmey'
reconstr_points = 50
model = dict(type='WLNet',
backbone=dict(type='mmdet.ResNet',
depth=50,
num_stages=4,
out_indices=(1, 2, 3),
frozen_stages=-1,
n... | wavelet_type = 'dmey'
reconstr_points = 50
model = dict(type='WLNet', backbone=dict(type='mmdet.ResNet', depth=50, num_stages=4, out_indices=(1, 2, 3), frozen_stages=-1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch', dcn=dict(type='DCNv2', deform_groups=2, fallback_on_stride=False), init... |
def quick_sort(arr):
#base case
if(len(arr) < 2):
return arr
pivot = arr[0]
less = [i for i in arr[1:] if i < pivot]
greater = [i for i in arr[1:] if i >= pivot]
return quick_sort(less) + [pivot] + quick_sort(greater)
test_list = [44, 2056, 2, 2, 41, 109, 33, 32, 22, 67]
result = quick_sort(test_list)
print(re... | def quick_sort(arr):
if len(arr) < 2:
return arr
pivot = arr[0]
less = [i for i in arr[1:] if i < pivot]
greater = [i for i in arr[1:] if i >= pivot]
return quick_sort(less) + [pivot] + quick_sort(greater)
test_list = [44, 2056, 2, 2, 41, 109, 33, 32, 22, 67]
result = quick_sort(test_list)
p... |
def Linear_Search(lst, x):
i = 0
n = len(lst)
while(i < n):
if lst[i] == x:
return i
i += 1
return -1
while True:
lst = [1,2,3,4,5,6,7,89,90,67,45,34]
x = int(input())
index = Linear_Search(lst, x)
print(index)
if index == -1:
print("Not Found")
else:
print("Found in ", index)
'''
......F... | def linear__search(lst, x):
i = 0
n = len(lst)
while i < n:
if lst[i] == x:
return i
i += 1
return -1
while True:
lst = [1, 2, 3, 4, 5, 6, 7, 89, 90, 67, 45, 34]
x = int(input())
index = linear__search(lst, x)
print(index)
if index == -1:
print('No... |
x = 1
print(x)
x = x+1
print(x)
x = 1
x += (x+1) #x = x + (x+1)
print(x)
x=2
for i in range(10):
x*=2
print(x) | x = 1
print(x)
x = x + 1
print(x)
x = 1
x += x + 1
print(x)
x = 2
for i in range(10):
x *= 2
print(x) |
T =int(input()) #number of tests case
if T in range (0,21):
for _ in range(T):
num_a = input() #number of elements' A set
A = set(input().split())
num_b = input()
B = set(input().split()) #number of elements' B set
if len(A)>0 and len(A)<1001:
if len(B) > 0 and le... | t = int(input())
if T in range(0, 21):
for _ in range(T):
num_a = input()
a = set(input().split())
num_b = input()
b = set(input().split())
if len(A) > 0 and len(A) < 1001:
if len(B) > 0 and len(B) < 1001:
print(A.issubset(B)) |
"""
File: __init__.py
Description:
Primary Author(s): Michael Clawar
Secondary Author(s):
Notes:
January 14, 2017
StratoDem Analytics, LLC
"""
| """
File: __init__.py
Description:
Primary Author(s): Michael Clawar
Secondary Author(s):
Notes:
January 14, 2017
StratoDem Analytics, LLC
""" |
number = 1 + 2 * 3 / 4.0
print(number)
remainder = 11 % 3
print(remainder)
squared = 7 ** 2
cubed = 2 ** 3
print(squared)
print(cubed)
helloworld = "hello" + " " + "world"
print(helloworld)
lotsofhellos = "hello" * 10
print(lotsofhellos)
even_numbers = [2,4,6,8]
odd_numbers = [1,3,5,7]
all_numbers = odd_numbers + ... | number = 1 + 2 * 3 / 4.0
print(number)
remainder = 11 % 3
print(remainder)
squared = 7 ** 2
cubed = 2 ** 3
print(squared)
print(cubed)
helloworld = 'hello' + ' ' + 'world'
print(helloworld)
lotsofhellos = 'hello' * 10
print(lotsofhellos)
even_numbers = [2, 4, 6, 8]
odd_numbers = [1, 3, 5, 7]
all_numbers = odd_numbers +... |
#!/usr/bin/env python3
ballot = {}
# TODO: Complete the "voting algorithm" to
# 1. Accept inputs one and a time, either:
# a. Incrementing candidate's vote count by 1 in ballot
# b. Setting the candidate's vote count to 1 in ballot for the first vote
# 2. Stop accepting inpus if the N ch... | ballot = {}
winner = None
max_votes = 0
print(f'The winner is {winner} -- with {max_votes} votes.') |
class StageDisplay:
def __init__(self, index, name, is_current_display=False, client=None):
self.index = index
self.name = name
self.is_current_display = is_current_display
self.client = client
def send_message(self, message):
if self.client:
command = {
... | class Stagedisplay:
def __init__(self, index, name, is_current_display=False, client=None):
self.index = index
self.name = name
self.is_current_display = is_current_display
self.client = client
def send_message(self, message):
if self.client:
command = {'act... |
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
"""
sent when the user clicks a Rich Presence spectate invite in chat to
spectate a game
"""
# TODO: Implement event
| """
sent when the user clicks a Rich Presence spectate invite in chat to
spectate a game
""" |
def solution(n):
answer = []
flag = True
while flag:
if n // 10 == 0:
answer.append(n % 10)
flag = False
else:
r = n % 10
d = n // 10
n = d
answer.append(r)
return answer
print(solution(12345)) | def solution(n):
answer = []
flag = True
while flag:
if n // 10 == 0:
answer.append(n % 10)
flag = False
else:
r = n % 10
d = n // 10
n = d
answer.append(r)
return answer
print(solution(12345)) |
'''
modifier: 03
eqtime: 10
'''
def main():
info("Jan Cocktail Pipette x1")
gosub('jan:WaitForMiniboneAccess')
gosub('jan:PrepareForAirShot')
open(name="Q", description="Quad Inlet")
gosub('jan:EvacPipette1')
gosub('common:FillPipette1')
gosub('jan:PrepareForAirShotExpansion')
gosub('co... | """
modifier: 03
eqtime: 10
"""
def main():
info('Jan Cocktail Pipette x1')
gosub('jan:WaitForMiniboneAccess')
gosub('jan:PrepareForAirShot')
open(name='Q', description='Quad Inlet')
gosub('jan:EvacPipette1')
gosub('common:FillPipette1')
gosub('jan:PrepareForAirShotExpansion')
gosub('co... |
d=int(input())
if d==61:
print("Brasilia")
elif d==71:
print("Salvador")
elif d==11:
print("Sao Paulo")
elif d==21:
print(" Rio de Janeiro")
elif d==32:
print(" Juiz de Fora")
elif d==19:
print("Campinas")
elif d==27:
print("Vitoria")
elif d==31:
print("Belo Horizonte")
else:
... | d = int(input())
if d == 61:
print('Brasilia')
elif d == 71:
print('Salvador')
elif d == 11:
print('Sao Paulo')
elif d == 21:
print(' Rio de Janeiro')
elif d == 32:
print(' Juiz de Fora')
elif d == 19:
print('Campinas')
elif d == 27:
print('Vitoria')
elif d == 31:
print('Belo Horizonte')... |
class ConfigException(Exception):
def __init__(self, text, trace=None):
super().__init__(text)
self.text = text
self.trace = trace
class InvalidValueException(ConfigException):
pass
class EnvironmentVarMissingException(ConfigException):
pass
class RequiredVarMissingException(ConfigException):
... | class Configexception(Exception):
def __init__(self, text, trace=None):
super().__init__(text)
self.text = text
self.trace = trace
class Invalidvalueexception(ConfigException):
pass
class Environmentvarmissingexception(ConfigException):
pass
class Requiredvarmissingexception(Conf... |
'''
On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions:
"G": go straight 1 unit;
"L": turn 90 degrees to the left;
"R": turn 90 degress to the right.
The robot performs the instructions given in order, and repeats them forever.
Return true if and... | """
On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions:
"G": go straight 1 unit;
"L": turn 90 degrees to the left;
"R": turn 90 degress to the right.
The robot performs the instructions given in order, and repeats them forever.
Return true if and... |
# Internet Archive
# https://archive.org/services/docs/api/index.html
# https://archive.org/account/s3.php
# Used for mirroring uploaded files to the Internet Archive.
IA_ACCESS = ""
IA_SECRET = ""
# Patreon
# Beta site credentials are displayed on user profiles for Patrons
# Password values are used for non-logged in... | ia_access = ''
ia_secret = ''
beta_username = ''
beta_password = ''
password2_dollars = ''
password5_dollars = ''
twitter_consumer_key = ''
twitter_consumer_secret = ''
twitter_oauth_token = ''
twitter_oauth_secret = ''
webhook_url = ''
new_upload_webhook_url = ''
banned_ips = ['']
unregistered_supporters = [{'name': '... |
GRANTS = """
SELECT cognition.createrole('tenant_admins', NULL, NULL);
GRANT USAGE ON SCHEMA cognition TO tenant_admins;
GRANT SELECT, INSERT, DELETE, UPDATE ON TABLE cognition.users TO tenant_admins;
GRANT SELECT, UPDATE (displayname) ON TABLE cognition.tenants to tenant_admins;
SELECT cognition.c... | grants = "\n SELECT cognition.createrole('tenant_admins', NULL, NULL);\n GRANT USAGE ON SCHEMA cognition TO tenant_admins;\n GRANT SELECT, INSERT, DELETE, UPDATE ON TABLE cognition.users TO tenant_admins;\n GRANT SELECT, UPDATE (displayname) ON TABLE cognition.tenants to tenant_admins;\n\n SELECT cogniti... |
arr = [6, 54, 5, 125, 222, 113, 0]
def insertionSort(arr):
# Traverse through 1 to len(arr)
for x in range(1, len(arr)):
key = arr[x]
j = x-1
while j >= 0 and key < arr[j] :
arr[j + 1] = arr[j]
j -= 1
arr[j + 1] = key
inse... | arr = [6, 54, 5, 125, 222, 113, 0]
def insertion_sort(arr):
for x in range(1, len(arr)):
key = arr[x]
j = x - 1
while j >= 0 and key < arr[j]:
arr[j + 1] = arr[j]
j -= 1
arr[j + 1] = key
insertion_sort(arr)
for x in range(len(arr)):
print('% d' % arr[x]) |
def get_package_data():
return {
_ASTROPY_PACKAGE_NAME_ + '.tests': ['coveragerc', 'data/*'],
_ASTROPY_PACKAGE_NAME_ + '.interpolation.tests': ['reference/*']
}
| def get_package_data():
return {_ASTROPY_PACKAGE_NAME_ + '.tests': ['coveragerc', 'data/*'], _ASTROPY_PACKAGE_NAME_ + '.interpolation.tests': ['reference/*']} |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyInferenceSchema(Package):
"""This package is intended to provide a uniform schema for common machine
lear... | class Pyinferenceschema(Package):
"""This package is intended to provide a uniform schema for common machine
learning applications, as well as a set of decorators that can be used to
aid in web based ML prediction applications."""
homepage = 'https://pypi.org/project/inference-schema/'
url = 'https:... |
"""bellman_value_iteration.py: Performs and prints Bellman Value Iteration on an MDP up to a certain depth."""
def printBoard(board):
"""Print a formatted board to console."""
for i in board:
print("[", end="")
for j in i:
print("{:5.2f}".format(j), end=",")
print("]")
... | """bellman_value_iteration.py: Performs and prints Bellman Value Iteration on an MDP up to a certain depth."""
def print_board(board):
"""Print a formatted board to console."""
for i in board:
print('[', end='')
for j in i:
print('{:5.2f}'.format(j), end=',')
print(']')
... |
# the model gets created
# in this file specific layers can be defined and changed
# the default data contains 40 x 1200 x 3 data as defined by the input dataformat
# if the data for test and validation is change the first layer format can change
# model contains a sequential keras model that can be applied with differ... | model.add(conv2_d(8, kernel_size=(3, 3), activation='relu', input_shape=(40, 1200, 3)))
model.add(max_pooling2_d(pool_size=(2, 2)))
model.add(conv2_d(16, kernel_size=(3, 3), activation='relu'))
model.add(max_pooling2_d(pool_size=(2, 2)))
model.add(conv2_d(24, kernel_size=(3, 3), activation='sigmoid'))
model.add(max_poo... |
size_set = int(input())
set0 = set(map(int, input().split()))
iteration_number = int(input())
for i in range(iteration_number):
set1 = input().split()
if set1[0] == "pop":
set0.pop()
elif set1[0] == "remove":
set0.remove(int(set1[1]))
elif set1[0] == "discard":
set0.d... | size_set = int(input())
set0 = set(map(int, input().split()))
iteration_number = int(input())
for i in range(iteration_number):
set1 = input().split()
if set1[0] == 'pop':
set0.pop()
elif set1[0] == 'remove':
set0.remove(int(set1[1]))
elif set1[0] == 'discard':
set0.discard(int(s... |
class School(object):
def __init__(self):
self.school_roster = {}
def add_student(self, name, grade):
if self.school_roster.get(grade):
self.school_roster[grade].append(name)
else:
self.school_roster[grade] = [name]
def roster(self):
students = []
... | class School(object):
def __init__(self):
self.school_roster = {}
def add_student(self, name, grade):
if self.school_roster.get(grade):
self.school_roster[grade].append(name)
else:
self.school_roster[grade] = [name]
def roster(self):
students = []
... |
class A:
def __init__(self, content):
self._content = content
@property
def content(self):
if not hasattr(self, '_content'):
return "content not exists"
return self._content
@content.setter
def content(self, value):
self._content = value
@content.de... | class A:
def __init__(self, content):
self._content = content
@property
def content(self):
if not hasattr(self, '_content'):
return 'content not exists'
return self._content
@content.setter
def content(self, value):
self._content = value
@content.d... |
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("//tools/build/bazel/rules_nim/internal:install_nix.bzl", "install_nim")
def nim_rules_dependencies():
"""Declares external repositories that rules_nim depends on. This
function should be loaded and called from WORKSPACE files."""
... | load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository')
load('//tools/build/bazel/rules_nim/internal:install_nix.bzl', 'install_nim')
def nim_rules_dependencies():
"""Declares external repositories that rules_nim depends on. This
function should be loaded and called from WORKSPACE files."""
_... |
"""
Hide tristate choice values with mod dependency in y choice.
If tristate choice values depend on symbols set to 'm', they should be
hidden when the choice containing them is changed from 'm' to 'y'
(i.e. exclusive choice).
Related Linux commit: fa64e5f6a35efd5e77d639125d973077ca506074
"""
def test(conf):
as... | """
Hide tristate choice values with mod dependency in y choice.
If tristate choice values depend on symbols set to 'm', they should be
hidden when the choice containing them is changed from 'm' to 'y'
(i.e. exclusive choice).
Related Linux commit: fa64e5f6a35efd5e77d639125d973077ca506074
"""
def test(conf):
ass... |
#
# PySNMP MIB module MICOM-56KCSU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MICOM-56KCSU-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:12:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_range_constraint, value_size_constraint, constraints_intersection) ... |
# Copyright 2014 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | load('//go/private:common.bzl', 'as_tuple', 'split_srcs')
load('//go/private:mode.bzl', 'LINKMODE_C_ARCHIVE', 'LINKMODE_C_SHARED', 'mode_string')
load('//go/private:providers.bzl', 'GoArchive', 'GoArchiveData', 'effective_importpath_pkgpath', 'get_archive')
load('//go/private/rules:cgo.bzl', 'cgo_configure')
load('//go... |
'''
Hi, here's your problem today. This problem was recently asked by AirBNB:
Given a sorted array, A, with possibly duplicated elements, find the indices of the first and last occurrences of a target element, x. Return -1 if the target is not found.
Example:
Input: A = [1,3,3,5,7,8,9,9,9,15], target = 9
Output: [6,8... | """
Hi, here's your problem today. This problem was recently asked by AirBNB:
Given a sorted array, A, with possibly duplicated elements, find the indices of the first and last occurrences of a target element, x. Return -1 if the target is not found.
Example:
Input: A = [1,3,3,5,7,8,9,9,9,15], target = 9
Output: [6,8... |
"""*****************************************************************************
* Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to ... | """*****************************************************************************
* Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to ... |
# Write a Python program to get a string which is n (non-negative integer) copies of a given string.
def copies(string, number):
ans = ""
for i in range(number):
ans += string
return ans
s = input("Enter a string: ")
n = int(input("Enter number of copies to do: "))
print(copies(s, n))
| def copies(string, number):
ans = ''
for i in range(number):
ans += string
return ans
s = input('Enter a string: ')
n = int(input('Enter number of copies to do: '))
print(copies(s, n)) |
class ManipulationBoundaryFeedbackEventArgs(InputEventArgs):
""" Provides data for the System.Windows.UIElement.ManipulationBoundaryFeedback event. """
BoundaryFeedback=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the unused portion of the direct manipulation.
Get: BoundaryFe... | class Manipulationboundaryfeedbackeventargs(InputEventArgs):
""" Provides data for the System.Windows.UIElement.ManipulationBoundaryFeedback event. """
boundary_feedback = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the unused portion of the direct manipulation.\n\n\n\nGet... |
"""This module serves as the entry point of MyCryptoKeys."""
def main():
"""The actual entry point."""
print('holi')
if __name__ == '__main__':
main()
| """This module serves as the entry point of MyCryptoKeys."""
def main():
"""The actual entry point."""
print('holi')
if __name__ == '__main__':
main() |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 13 23:57:31 2020
@author: abhi0
"""
class Solution:
def minimumAbsDifference(self, arr: List[int]) -> List[List[int]]:
temp=sorted(arr)
tempDiff=[]
for i in range(len(temp)-1):
tempDiff.append(abs(temp[i+1]-te... | """
Created on Thu Aug 13 23:57:31 2020
@author: abhi0
"""
class Solution:
def minimum_abs_difference(self, arr: List[int]) -> List[List[int]]:
temp = sorted(arr)
temp_diff = []
for i in range(len(temp) - 1):
tempDiff.append(abs(temp[i + 1] - temp[i]))
abs_diff = min(t... |
"""
# tag::example1[]
>>> from ecc import FieldElement
>>> a = FieldElement(7, 13)
>>> b = FieldElement(6, 13)
>>> print(a == b)
False
>>> print(a == a)
True
# end::example1[]
# tag::example2[]
>>> print(7 % 3)
1
# end::example2[]
# tag::example3[]
>>> print(-27 % 13)
12
# end::example3[]
# tag::example4[]
>>> from ... | """
# tag::example1[]
>>> from ecc import FieldElement
>>> a = FieldElement(7, 13)
>>> b = FieldElement(6, 13)
>>> print(a == b)
False
>>> print(a == a)
True
# end::example1[]
# tag::example2[]
>>> print(7 % 3)
1
# end::example2[]
# tag::example3[]
>>> print(-27 % 13)
12
# end::example3[]
# tag::example4[]
>>> from ... |
class spam:
def __init__(self):
self.msgtxt = "this is spam"
def msg(self):
print(self.msgtxt)
if __name__ == '__main__':
s = spam()
s.msg()
| class Spam:
def __init__(self):
self.msgtxt = 'this is spam'
def msg(self):
print(self.msgtxt)
if __name__ == '__main__':
s = spam()
s.msg() |
#! /Users/nsanthony/miniconda3/bin/python
def error():
"""Spits out that it doesnt work, needs definition"""
print('ERROR: ')
return | def error():
"""Spits out that it doesnt work, needs definition"""
print('ERROR: ')
return |
def run (autoTester):
b = b'bike'
s = bytes ('shop', 'utf8')
e = b''
bb = bytearray ([0, 1, 2, 3, 4])
bc = bytes ((5, 6, 7, 8, 9))
# __pragma__ ('opov')
bps = b + b'pump' + s
bps3 = 3 * bps + b'\0'
aBps3 = bps * 3 + b'\0'
l = [1, 2, 3] + [4, 5, 6]
# __pragma__ ('noopov')
... | def run(autoTester):
b = b'bike'
s = bytes('shop', 'utf8')
e = b''
bb = bytearray([0, 1, 2, 3, 4])
bc = bytes((5, 6, 7, 8, 9))
bps = b + b'pump' + s
bps3 = 3 * bps + b'\x00'
a_bps3 = bps * 3 + b'\x00'
l = [1, 2, 3] + [4, 5, 6]
def format_check(aBytes):
autoTester.check([... |
async def m001_initial(db):
"""
Initial rapaygo table.
"""
await db.execute(
f"""
CREATE TABLE rapaygo.lnurlposs (
id TEXT NOT NULL PRIMARY KEY,
key TEXT NOT NULL,
title TEXT NOT NULL,
wallet TEXT NOT NULL,
currency TEXT NOT NU... | async def m001_initial(db):
"""
Initial rapaygo table.
"""
await db.execute(f'\n CREATE TABLE rapaygo.lnurlposs (\n id TEXT NOT NULL PRIMARY KEY,\n key TEXT NOT NULL,\n title TEXT NOT NULL,\n wallet TEXT NOT NULL,\n currency TEXT NOT NULL,\n ... |
"""
Return file info as a dict.
[extended_summary]
"""
| """
Return file info as a dict.
[extended_summary]
""" |
UNICORN_MESSAGE_ERROR = "..for the love it bears to fair maidens forgets its ferocity and wildness.. "
GENERIC_ERROR = "Ooooops, it works on my machine. Please try again later."
NOT_FOUND_ERROR = "Not found!"
SERVER_ERROR = "Server problem"
UNSUPPORTED_SERVICE_ERROR = "Unsupported service"
KEY_TEMPLATE_ERROR = "Attenti... | unicorn_message_error = '..for the love it bears to fair maidens forgets its ferocity and wildness.. '
generic_error = 'Ooooops, it works on my machine. Please try again later.'
not_found_error = 'Not found!'
server_error = 'Server problem'
unsupported_service_error = 'Unsupported service'
key_template_error = 'Attenti... |
'''
Created on Jan 13, 2014
@author: Eugene Syriani
@version: 0.2.5
This module contains utility classes and functions.
'''
class Singleton(type):
"""
Meta-class to turn a class into a singleton.
"""
def __init__(self, name, bases, _dict):
super(Singleton, self).__init__(name, bases, _dict)
... | """
Created on Jan 13, 2014
@author: Eugene Syriani
@version: 0.2.5
This module contains utility classes and functions.
"""
class Singleton(type):
"""
Meta-class to turn a class into a singleton.
"""
def __init__(self, name, bases, _dict):
super(Singleton, self).__init__(name, bases, _dict)
... |
class ViewSetView(object):
'''
A mixin for views to make them compatible with ``ViewSet``.
'''
# The ``viewset`` will be filled during the instantiation of the
# ``NamedView`` (i.e. ``NamedView.as_view()`` is called with the
# kwarg ``viewset``).
viewset = None
| class Viewsetview(object):
"""
A mixin for views to make them compatible with ``ViewSet``.
"""
viewset = None |
# The following imports where disabled to prevent runtime errors caused by
# double imports with Python 3.6.x or higher. Since all listed classes are
# part of test_main.py - which is the file containing the program entry point -
# there is no need for these explicit imports.
# Details and recreation instructions:
# Th... | """
from .test_main import HappyBasicTestSuite
from .test_main import OneBodyTestSuite
from .test_main import TwoBodyTestSuite
from .test_main import TransmissionTestSuite
from .test_main import RatesTestSuite
from .test_main import MasterEquationTestSuite
""" |
# RUN: %S/../test.sh %s
def func():
return 1
print(func()) # CHECK: 1
| def func():
return 1
print(func()) |
print ("hello world")
print ("hello" ,"world" , "epic" , sep="##" )
variable = input ("enter your name ")
print("hello" , variable, sep=", ")
variable = input ( "enter your age:")
print("damn" , variable, sep=", ")
variable = input("enter your age ")
variable = int(variable)
difference = 100 - variable
print ("y... | print('hello world')
print('hello', 'world', 'epic', sep='##')
variable = input('enter your name ')
print('hello', variable, sep=', ')
variable = input('enter your age:')
print('damn', variable, sep=', ')
variable = input('enter your age ')
variable = int(variable)
difference = 100 - variable
print('you have ', diff... |
"""
Entradas: 4 entradas de valor flotante, 3 son las ventas de cada departamento y uno el sueldo de los vendedores
Departamento 1 --> float --> A
Departamento 2 --> float --> B
Departamento 3 --> float --> C
Sueldo --> float --> D
Salidas: 3 valores flotantes que es el sueldo de los vendedores de los departamentos
... | """
Entradas: 4 entradas de valor flotante, 3 son las ventas de cada departamento y uno el sueldo de los vendedores
Departamento 1 --> float --> A
Departamento 2 --> float --> B
Departamento 3 --> float --> C
Sueldo --> float --> D
Salidas: 3 valores flotantes que es el sueldo de los vendedores de los departamentos
... |
nuke.pluginAddPath("renderFinished")
nuke.pluginAddPath("revealInFinder")
nuke.pluginAddPath("edgeNode")
nuke.pluginAddPath("autoBackup")
nuke.pluginAddPath("exrSplit") | nuke.pluginAddPath('renderFinished')
nuke.pluginAddPath('revealInFinder')
nuke.pluginAddPath('edgeNode')
nuke.pluginAddPath('autoBackup')
nuke.pluginAddPath('exrSplit') |
mot = {
'A': '5A',
'L': '6A',
'ST': '7A'
}
pot = ['DS', 'DC', 'START', 'USING']
print(mot)
print(pot)
inputList = []
with open("ainput.txt", "r") as f:
for ip in f:
inputList.append(ip.strip("\n").strip("\r"))
print(inputList)
symtab = open("SymbolTable.txt", "w")
a = (inputList.pop(0)).split("... | mot = {'A': '5A', 'L': '6A', 'ST': '7A'}
pot = ['DS', 'DC', 'START', 'USING']
print(mot)
print(pot)
input_list = []
with open('ainput.txt', 'r') as f:
for ip in f:
inputList.append(ip.strip('\n').strip('\r'))
print(inputList)
symtab = open('SymbolTable.txt', 'w')
a = inputList.pop(0).split(' ')
symtab.write... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.