content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Source:
'''
this is a class that defines the source objects
'''
def __init__(self,id,name,url,description):
self.id = id
self.name = name
self.url = url
self.description = description | class Source:
"""
this is a class that defines the source objects
"""
def __init__(self, id, name, url, description):
self.id = id
self.name = name
self.url = url
self.description = description |
# -*- coding: utf-8 -*-
def production_volume(dataset, default=None):
"""Get production volume of reference product exchange.
Returns ``default`` (default value is ``None``) if no or multiple
reference products, or if reference product doesn't have a production
volume amount."""
exchanges = [x fo... | def production_volume(dataset, default=None):
"""Get production volume of reference product exchange.
Returns ``default`` (default value is ``None``) if no or multiple
reference products, or if reference product doesn't have a production
volume amount."""
exchanges = [x for x in dataset['exchanges'... |
# Warning : Keep this file private
# replace the values of the variables with yours
ckey = 'SaMpLe-C0nSuMeR-Key'
csecret = 'Y0uR-C0nSuMeR-SecRet'
atoken = 'Y0Ur-@cCeSs-T0Ken'
asecret = 'Y0uR-@cCesS-SeCrEt'
| ckey = 'SaMpLe-C0nSuMeR-Key'
csecret = 'Y0uR-C0nSuMeR-SecRet'
atoken = 'Y0Ur-@cCeSs-T0Ken'
asecret = 'Y0uR-@cCesS-SeCrEt' |
def filtering_results(results, book_type, number):
"""
results = list of dictionnary
Filter the results to getspecific type trade / issue
include omnibus and compendium in trades
and number
Based on comic title
"""
assert book_type in ["trade", "issue", None] , "Choose between ... | def filtering_results(results, book_type, number):
"""
results = list of dictionnary
Filter the results to getspecific type trade / issue
include omnibus and compendium in trades
and number
Based on comic title
"""
assert book_type in ['trade', 'issue', None], "Choose between 'trade' or... |
def shallow_copy(x):
return type(x)(x)
class ToggleFilter(object):
"""
This class provides a "sticky" filter, that works by "toggling" items of the original database on and off.
"""
def __init__(self, db_ref, show_by_default=True):
"""
Instantiate a ToggleFilter object
:p... | def shallow_copy(x):
return type(x)(x)
class Togglefilter(object):
"""
This class provides a "sticky" filter, that works by "toggling" items of the original database on and off.
"""
def __init__(self, db_ref, show_by_default=True):
"""
Instantiate a ToggleFilter object
:pa... |
"""
Specializer to support generating Python libraries from swig sources.
"""
load("@fbcode_macros//build_defs/lib/swig:lang_converter_info.bzl", "LangConverterInfo")
load(
"@fbcode_macros//build_defs/lib:python_typing.bzl",
"gen_typing_config",
"get_typing_config_target",
)
load("@fbcode_macros//build_def... | """
Specializer to support generating Python libraries from swig sources.
"""
load('@fbcode_macros//build_defs/lib/swig:lang_converter_info.bzl', 'LangConverterInfo')
load('@fbcode_macros//build_defs/lib:python_typing.bzl', 'gen_typing_config', 'get_typing_config_target')
load('@fbcode_macros//build_defs/lib:src_and_de... |
def main():
def expand(code,times):
return times * code
def expandString(code):
lbi = 0
rbi = 0
for i in range(len(code)):
if(code[i] == "["):
lbi = i
if(code[i] == "]"):
rbi = i
break
count = 1
while code[lbi-count].isdigit():
if(count == 1):
... | def main():
def expand(code, times):
return times * code
def expand_string(code):
lbi = 0
rbi = 0
for i in range(len(code)):
if code[i] == '[':
lbi = i
if code[i] == ']':
rbi = i
break
count = 1
... |
class MyDictSubclass(dict):
def __init__(self):
dict.__init__(self)
self.var1 = 10
self['in_dct'] = 20
def __str__(self):
ret = []
for key, val in sorted(self.items()):
ret.append('%s: %s' % (key, val))
ret.append('self.var1: %s' % (self.var1,))
... | class Mydictsubclass(dict):
def __init__(self):
dict.__init__(self)
self.var1 = 10
self['in_dct'] = 20
def __str__(self):
ret = []
for (key, val) in sorted(self.items()):
ret.append('%s: %s' % (key, val))
ret.append('self.var1: %s' % (self.var1,))
... |
class MessageParsingError(Exception):
"""Message format is not compliant with the wire format"""
def __init__(self, message: str, error: Exception = None):
self.error = error
self.message = message
class SchemaParsingError(Exception):
"""Error while parsing a JSON schema descriptor."""
... | class Messageparsingerror(Exception):
"""Message format is not compliant with the wire format"""
def __init__(self, message: str, error: Exception=None):
self.error = error
self.message = message
class Schemaparsingerror(Exception):
"""Error while parsing a JSON schema descriptor."""
clas... |
class QueryFileHandler:
@staticmethod
def load_queries(file_name: str):
file = open(file_name, 'r')
query = file.read()
file.close()
query_list = [s and s.strip() for s in query.split(';')]
return list(filter(None, query_list))
| class Queryfilehandler:
@staticmethod
def load_queries(file_name: str):
file = open(file_name, 'r')
query = file.read()
file.close()
query_list = [s and s.strip() for s in query.split(';')]
return list(filter(None, query_list)) |
K = int(input())
result = 0
for A in range(1, K + 1):
for B in range(1, K + 1):
if A * B > K:
break
result += K // (A * B)
print(result)
| k = int(input())
result = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
if A * B > K:
break
result += K // (A * B)
print(result) |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | class Toscagraph(object):
"""Graph of Tosca Node Templates."""
def __init__(self, nodetemplates):
self.nodetemplates = nodetemplates
self.vertices = {}
self._create()
def _create_vertex(self, node):
if node not in self.vertices:
self.vertices[node.name] = node
... |
"""
Simple module for calculating and displaying the time an algorithm for
a given Euler problem took to run
Author: Miguel Rentes
"""
def elapsed_time(elapsed):
"""
Computes the amount of time spent by the algorithm and outputs the time
"""
hours = int(elapsed / 3600) # hours
minutes = int((elap... | """
Simple module for calculating and displaying the time an algorithm for
a given Euler problem took to run
Author: Miguel Rentes
"""
def elapsed_time(elapsed):
"""
Computes the amount of time spent by the algorithm and outputs the time
"""
hours = int(elapsed / 3600)
minutes = int(elapsed % 3600 ... |
# import requests
# from bs4 import BeautifulSoup
# with open('file:///home/shubham/fridaybeautifulsoup.html','r')
# def table(a,b):
# if a==1 :
# return 1
# return b*table(a-1,b)
# print(table(10,5))
# def pow(n) :
# if n==1 :
# return 2**n
# return 2*pow(n-1)
# # print(pow(3))
# d... | d = ''
a = ['saikira', 'bhopland', 'petland', 'bhatland']
f = []
for i in a[::-1]:
f.append(i[::-1])
print(f) |
class NetworkException(Exception):
pass
class SecretException(Exception):
pass
| class Networkexception(Exception):
pass
class Secretexception(Exception):
pass |
# -*- coding: utf-8 -*-
"""
A sample of kay settings.
:Copyright: (c) 2009 Accense Technology, Inc.
Takashi Matsuo <tmatsuo@candit.jp>,
All rights reserved.
:license: BSD, see LICENSE for more details.
"""
DEBUG = False
ROOT_URL_MODULE = 'kay.tests.globalurls'
INSTALLED_AP... | """
A sample of kay settings.
:Copyright: (c) 2009 Accense Technology, Inc.
Takashi Matsuo <tmatsuo@candit.jp>,
All rights reserved.
:license: BSD, see LICENSE for more details.
"""
debug = False
root_url_module = 'kay.tests.globalurls'
installed_apps = ('kay.tests',)
app_mou... |
# -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description:
"""
class NgramUtil(object):
@staticmethod
def unigrams(words):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of unigram
"""
assert type(words) == list
return wor... | """
@author:XuMing(xuming624@qq.com)
@description:
"""
class Ngramutil(object):
@staticmethod
def unigrams(words):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of unigram
"""
assert type(words) == list
return words
@staticmethod
... |
st=input("Enter the binary string\n")
l=len(st)
a=[]
for i in range(l-1,-1,-1):
if a==[]:
a.append(st[i])
else:
p=a.pop()
if st[i] != p:
a.append(p)
a.append(st[i])
if len(a)==0:
print(-1)
else:
for i in range(len(a)):
print(a.pop(),end="")
| st = input('Enter the binary string\n')
l = len(st)
a = []
for i in range(l - 1, -1, -1):
if a == []:
a.append(st[i])
else:
p = a.pop()
if st[i] != p:
a.append(p)
a.append(st[i])
if len(a) == 0:
print(-1)
else:
for i in range(len(a)):
print(a.pop()... |
# Project Euler #6: Sum square difference
n = 1
s = 0
s2 = 0
while n <= 100:
s += n
s2 += n * n
n += 1
print(s * s - s2)
| n = 1
s = 0
s2 = 0
while n <= 100:
s += n
s2 += n * n
n += 1
print(s * s - s2) |
# https://www.hackerrank.com/challenges/ctci-queue-using-two-stacks/problem
class MyQueue(object):
def __init__(self):
self.one = []
self.two = []
def peek(self): return self.two[-1]
def pop(self): return self.two.pop()
def put(self, value): self.one.append(value)
def check(sel... | class Myqueue(object):
def __init__(self):
self.one = []
self.two = []
def peek(self):
return self.two[-1]
def pop(self):
return self.two.pop()
def put(self, value):
self.one.append(value)
def check(self):
if not len(self.two):
while s... |
line = input()
while not line == "Stop":
print(line)
line = input()
| line = input()
while not line == 'Stop':
print(line)
line = input() |
# coding=utf-8
class App:
DEBUG = False
TESTING = False
| class App:
debug = False
testing = False |
total_cost = input("Enter the cost of your dream house: ")
total_cost = float(total_cost)
annual_salary = input("Enter your annual income: ")
annual_salary = float(annual_salary)
portion_saved = input("Enter the percent of your income you will save: ")
if portion_saved.find("%") or portion_saved.startswith("%") :
... | total_cost = input('Enter the cost of your dream house: ')
total_cost = float(total_cost)
annual_salary = input('Enter your annual income: ')
annual_salary = float(annual_salary)
portion_saved = input('Enter the percent of your income you will save: ')
if portion_saved.find('%') or portion_saved.startswith('%'):
po... |
def metade(p):
r = p / 2
return r
def dobro(p):
r = p * 2
return r
def aumentar(p, taxa):
r = p + ((p * taxa) / 100)
return r
def diminuir(p, taxa):
r = p - ((p * taxa) / 100)
return r
| def metade(p):
r = p / 2
return r
def dobro(p):
r = p * 2
return r
def aumentar(p, taxa):
r = p + p * taxa / 100
return r
def diminuir(p, taxa):
r = p - p * taxa / 100
return r |
# Copyright (c) 2019 The Bazel Utils 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 function is taken from
# LICENSE: BSD
# URL: https://github.com/RobotLocomotion/drake/blob/47987499486349ba47ece6f30519aaf8f868bbe9/tools/skyla... | def dsym_command(name):
"""Returns the command to produce .dSYM on macOS, or a no-op on elsewhere."""
return select({'@com_chokobole_bazel_utils//:apple_debug': 'dsymutil -f $(location :' + name + ') -o $@ 2> /dev/null', '//conditions:default': 'touch $@'})
def dsym(name, tags=['dsym'], visibility=['//visibili... |
"""
You're given a string consisting solely of (, ), and *. * can represent either a (, ),
or an empty string. Determine whether the parentheses are balanced.
For example, (()* and (*) are balanced. )*( is not balanced.
"""
def is_balanced(text: str) -> bool:
size = len(text)
index = 0
stack = []
whi... | """
You're given a string consisting solely of (, ), and *. * can represent either a (, ),
or an empty string. Determine whether the parentheses are balanced.
For example, (()* and (*) are balanced. )*( is not balanced.
"""
def is_balanced(text: str) -> bool:
size = len(text)
index = 0
stack = []
while... |
# Copyright 2009-2017 Ram Rachum.
# This program is distributed under the MIT license.
class ReasonedBool:
'''
A variation on `bool` that also gives a `.reason`.
This is useful when you want to say "This is False because... (reason.)"
Unfortunately this class is not a subclass of `bool`, since Pytho... | class Reasonedbool:
"""
A variation on `bool` that also gives a `.reason`.
This is useful when you want to say "This is False because... (reason.)"
Unfortunately this class is not a subclass of `bool`, since Python doesn't
allow subclassing `bool`.
"""
def __init__(self, value, reason=Non... |
form = 'form.signin'
form_username = 'form.signin [name="session[username_or_email]"]'
form_password = 'form.signin [name="session[password]"]'
form_phone = '#challenge_response'
def login(browser, username, password):
browser.fill(form_username, username)
# For some reason filling of the password is flaky a... | form = 'form.signin'
form_username = 'form.signin [name="session[username_or_email]"]'
form_password = 'form.signin [name="session[password]"]'
form_phone = '#challenge_response'
def login(browser, username, password):
browser.fill(form_username, username)
while not browser.value(form_password):
browse... |
while True:
try:
n = int(input())
if ((n >= 0 and n < 90) or n == 360):
print('Bom Dia!!')
elif (n >=90 and n < 180):
print('Boa Tarde!!')
elif (n >= 180 and n < 270):
print('Boa Noite!!')
elif (n >= 270 and n < 360):
print('De ... | while True:
try:
n = int(input())
if n >= 0 and n < 90 or n == 360:
print('Bom Dia!!')
elif n >= 90 and n < 180:
print('Boa Tarde!!')
elif n >= 180 and n < 270:
print('Boa Noite!!')
elif n >= 270 and n < 360:
print('De Madrugada... |
class PytraitError(RuntimeError):
pass
class DisallowedInitError(PytraitError):
pass
class NonMethodAttrError(PytraitError):
pass
class MultipleImplementationError(PytraitError):
pass
class InheritanceError(PytraitError):
pass
class NamingConventionError(PytraitError):
pass
| class Pytraiterror(RuntimeError):
pass
class Disallowediniterror(PytraitError):
pass
class Nonmethodattrerror(PytraitError):
pass
class Multipleimplementationerror(PytraitError):
pass
class Inheritanceerror(PytraitError):
pass
class Namingconventionerror(PytraitError):
pass |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"URL": "00_downloading_pdfs.ipynb",
"PDF_PATH": "00_downloading_pdfs.ipynb",
"identify_links_for_pdfs": "00_downloading_pdfs.ipynb",
"download_file": "00_downloading_pdfs.ipynb",
... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'URL': '00_downloading_pdfs.ipynb', 'PDF_PATH': '00_downloading_pdfs.ipynb', 'identify_links_for_pdfs': '00_downloading_pdfs.ipynb', 'download_file': '00_downloading_pdfs.ipynb', 'collect_multiple_files': '00_downloading_pdfs.ipynb', 'get_ix': '01_p... |
SD_COMMENT="This is for local development"
SHELTERLUV_SECRET_TOKEN=""
APP_SECRET_KEY="ASKASK"
JWT_SECRET="JWTSECRET"
POSTGRES_PASSWORD="thispasswordisverysecure"
BASEUSER_PW="basepw"
BASEEDITOR_PW="editorpw"
BASEADMIN_PW="basepw"
DROPBOX_APP="DBAPPPW"
| sd_comment = 'This is for local development'
shelterluv_secret_token = ''
app_secret_key = 'ASKASK'
jwt_secret = 'JWTSECRET'
postgres_password = 'thispasswordisverysecure'
baseuser_pw = 'basepw'
baseeditor_pw = 'editorpw'
baseadmin_pw = 'basepw'
dropbox_app = 'DBAPPPW' |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
'''
def _jupyter_server_extension_paths():
return [{
'module':'nbtemplate'
}];
def _jupyter_nbextension_paths():
return [
dict(
section='notebook',
src='static', # path is relative to `nbtemplate` directo... | """
"""
def _jupyter_server_extension_paths():
return [{'module': 'nbtemplate'}]
def _jupyter_nbextension_paths():
return [dict(section='notebook', src='static', dest='nbtemplate', require='nbtemplate/main'), dict(section='notebook', src='static', dest='nbtemplate', require='nbtemplate/templateSelector'), dic... |
def loadLinux_X86_64bit(visibility=None):
native.new_local_repository(
name = "system_include_x86_64_linux",
path = "/usr/include",
build_file_content = """
cc_library(
name = "soundcard",
hdrs = ["soundcard.h"],
visibility = ["//visibility:public"],
)
cc_library(
name = "ioc... | def load_linux_x86_64bit(visibility=None):
native.new_local_repository(name='system_include_x86_64_linux', path='/usr/include', build_file_content='\ncc_library(\n name = "soundcard",\n hdrs = ["soundcard.h"],\n visibility = ["//visibility:public"],\n)\ncc_library(\n name = "ioctl",\n hdrs = ["ioctl.... |
"""
PERIODS
"""
numPeriods = 180
"""
STOPS
"""
numStations = 13
station_names = (
"Hamburg Hbf", # 0
"Landwehr", # 1
"Hasselbrook", # 2
"Wansbeker Chaussee*", # 3
"Friedrichsberg*", # 4
"Barmbek*", # 5
"Alte Woehr (Stadtpark)", # 6
"Ruebenkamp (City Nord)", # 7
"Ohlsdorf*", # 8
"Kornweg", # 9
... | """
PERIODS
"""
num_periods = 180
'\nSTOPS\n'
num_stations = 13
station_names = ('Hamburg Hbf', 'Landwehr', 'Hasselbrook', 'Wansbeker Chaussee*', 'Friedrichsberg*', 'Barmbek*', 'Alte Woehr (Stadtpark)', 'Ruebenkamp (City Nord)', 'Ohlsdorf*', 'Kornweg', 'Hoheneichen', 'Wellingsbuettel', 'Poppenbuettel*')
num_stops = 26
... |
S = input()
T = input()
i = 0
for s, t in zip(S, T):
if s!=t:
i += 1
print(i)
| s = input()
t = input()
i = 0
for (s, t) in zip(S, T):
if s != t:
i += 1
print(i) |
# Soccer field easy
soccer_easy_gate_pose_dicts = [ { 'orientation': { 'w_val': 1.0,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.0},
'position': { 'x_val': 0.0,
'y_val': 2.0,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.9659256935119629,
'x_val': 0.0,
'y_val': -... | soccer_easy_gate_pose_dicts = [{'orientation': {'w_val': 1.0, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.0}, 'position': {'x_val': 0.0, 'y_val': 2.0, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.9659256935119629, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.2588196396827698}, 'position': {'x_val': 1.599999904632... |
print ('WELCOME TO THE COLLATZ SEQUENCER: ALWAYS NUMBER 1')
print ('ENTER YOUR NUMBER AND PREPARE TO GET SEQUENCED')
numberToSequence = input()
def tryCollatz(numberToSequence):
collatzCalled = False
while(collatzCalled == False):
try:
numberToSequence = int(numberToSequence)
... | print('WELCOME TO THE COLLATZ SEQUENCER: ALWAYS NUMBER 1')
print('ENTER YOUR NUMBER AND PREPARE TO GET SEQUENCED')
number_to_sequence = input()
def try_collatz(numberToSequence):
collatz_called = False
while collatzCalled == False:
try:
number_to_sequence = int(numberToSequence)
... |
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def example():
# Computer 2 + 3 * 0.1
code = [
('const', 2),
('const', 3),
('const', 0.1),
... | class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def example():
code = [('const', 2), ('const', 3), ('const', 0.1), ('mul',), ('add',)]
m = machine() |
def formulUygula(derece, liste):
mat = []
xDeg = 0
for i in range(derece + 1):
mat1 = []
for j in range(derece + 1):
gecici = 0
for k in range(1, len(liste) + 1):
gecici += k ** xDeg
mat1.append(gecici)
xDeg += 1
mat.app... | def formul_uygula(derece, liste):
mat = []
x_deg = 0
for i in range(derece + 1):
mat1 = []
for j in range(derece + 1):
gecici = 0
for k in range(1, len(liste) + 1):
gecici += k ** xDeg
mat1.append(gecici)
x_deg += 1
mat.... |
# TODO: un-subclass dict in favor of something more explicit, once all regular
# dict-like access has been factored out into methods
class LineManager(dict):
"""
Manages multiple release lines/families as well as related config state.
"""
def __init__(self, app):
"""
Initialize new line... | class Linemanager(dict):
"""
Manages multiple release lines/families as well as related config state.
"""
def __init__(self, app):
"""
Initialize new line manager dict.
:param app: The core Sphinx app object. Mostly used for config.
"""
super(LineManager, self).... |
def LeiaDinheiro(msg):
valido = False
while not valido:
mens = str(input(msg)).replace(',', '.')
if mens.isalpha() or mens.strip() == '':
print("\033[31mERRO! tente algo valido\033[m")
else:
valido = True
return float(mens) | def leia_dinheiro(msg):
valido = False
while not valido:
mens = str(input(msg)).replace(',', '.')
if mens.isalpha() or mens.strip() == '':
print('\x1b[31mERRO! tente algo valido\x1b[m')
else:
valido = True
return float(mens) |
"""
Problem 5 - https://adventofcode.com/2021/day/5
Part 1 -
Given a list of lines on a 2D graph, find the number of integral points where at least 2 horizontal or vertical
lines intersect
Part 2 -
Given the same set up, find the number of integral points where at least 2 horizontal, vertical, or diagonal... | """
Problem 5 - https://adventofcode.com/2021/day/5
Part 1 -
Given a list of lines on a 2D graph, find the number of integral points where at least 2 horizontal or vertical
lines intersect
Part 2 -
Given the same set up, find the number of integral points where at least 2 horizontal, vertical, or diagonal... |
#
# PySNMP MIB module AT-DS3-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-DS3-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:13:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ... |
# closures
def make_averagr():
series = []
def averager(new_value):
series.append(new_value) # free variable
total = sum(series) / len(series)
return total
return averager
# print(locals())
av = make_averagr()
print(av(10))
print(av(11))
print(av.__code__.co_varnames)
# ('n... | def make_averagr():
series = []
def averager(new_value):
series.append(new_value)
total = sum(series) / len(series)
return total
return averager
av = make_averagr()
print(av(10))
print(av(11))
print(av.__code__.co_varnames)
print(av.__code__.co_freevars)
print(av.__closure__, type(a... |
# Public Key
PK = "fubotong"
# Push request actively
PUSH = 0
# Secret Key
SK = "(*^%]@XUNLEI`12f&^"
# procotol type
HTTP = 1
ED2K = 2
BT = 3
TASK_SERVER = "http://open.lixian.vip.xunlei.com/download_to_clouds"
#TASK_SERVER = "http://t33093.sandai.net:8028/download_to_clouds"
CREATE_SERVER = "%s/create" % TASK_SE... | pk = 'fubotong'
push = 0
sk = '(*^%]@XUNLEI`12f&^'
http = 1
ed2_k = 2
bt = 3
task_server = 'http://open.lixian.vip.xunlei.com/download_to_clouds'
create_server = '%s/create' % TASK_SERVER
create_bt_server = '%s/create_bt' % TASK_SERVER
create_ed2_k_server = '%s/create_ed2k' % TASK_SERVER
query_server = '%s/query' %... |
def kth_common_divisor(a, b, k):
min_ = min(a, b)
divisors = []
for i in range(1, min_+1):
if a % i == 0 and b % i == 0:
divisors.append(i)
return divisors[-k]
if __name__ == "__main__":
a, b, k = map(int, input().split())
print(kth_common_divisor(a, b, k))
| def kth_common_divisor(a, b, k):
min_ = min(a, b)
divisors = []
for i in range(1, min_ + 1):
if a % i == 0 and b % i == 0:
divisors.append(i)
return divisors[-k]
if __name__ == '__main__':
(a, b, k) = map(int, input().split())
print(kth_common_divisor(a, b, k)) |
"""
SYSTEM_PARAMETERS
"""
EPSILON = 1E-12
#DEFAULT_STREAM_SIZE = 2**24
DEFAULT_STREAM_SIZE = 2**12
DEFAULT_BUFFER_SIZE_FOR_STREAM = DEFAULT_STREAM_SIZE / 4
| """
SYSTEM_PARAMETERS
"""
epsilon = 1e-12
default_stream_size = 2 ** 12
default_buffer_size_for_stream = DEFAULT_STREAM_SIZE / 4 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
class Foo:
def __init__(self, arg1: str, arg2: int) -> None:
self.arg1 = arg1
self.arg2 = arg2
| class Foo:
def __init__(self, arg1: str, arg2: int) -> None:
self.arg1 = arg1
self.arg2 = arg2 |
class Solution:
def sequentialDigits(self, low: int, high: int) -> List[int]:
nlow, nhigh = len(str(low)), len(str(high))
s = '123456789'
result = []
for n in range(nlow, nhigh+1):
for i in range(9-n+1):
num = int(s[i:i+n])
... | class Solution:
def sequential_digits(self, low: int, high: int) -> List[int]:
(nlow, nhigh) = (len(str(low)), len(str(high)))
s = '123456789'
result = []
for n in range(nlow, nhigh + 1):
for i in range(9 - n + 1):
num = int(s[i:i + n])
if... |
"""
This module defines a utility interface called WMInterface
which defines a standard interface for adding and removing things from working memory
"""
class WMInterface(object):
""" An interface standardizing how to add/remove items from working memory """
def __init__(self):
self.added = False
... | """
This module defines a utility interface called WMInterface
which defines a standard interface for adding and removing things from working memory
"""
class Wminterface(object):
""" An interface standardizing how to add/remove items from working memory """
def __init__(self):
self.added = False
... |
no = int(input('How many Natural Numbers do You Want?? '))
output = 0
i = 0
while i <= no:
output = output + i*i
i += 1
print(output)
| no = int(input('How many Natural Numbers do You Want?? '))
output = 0
i = 0
while i <= no:
output = output + i * i
i += 1
print(output) |
class Log():
def log(self,text):
pass
def force_p(self,text):
print(text)
class Print(Log):
def log(self,text):
print(text)
class NoLog(Log) :
def log(self,text):
pass
class MessageLog(Log):
def set_channel(self,channel):
self.channel = channel
async def log(self,text):
await self.channel.sen... | class Log:
def log(self, text):
pass
def force_p(self, text):
print(text)
class Print(Log):
def log(self, text):
print(text)
class Nolog(Log):
def log(self, text):
pass
class Messagelog(Log):
def set_channel(self, channel):
self.channel = channel
... |
class Solution(object):
def update(self, board, row, col):
living = 0
for i in range(max(row-1, 0), min(row+2, len(board))):
for j in range(max(col-1, 0), min(col+2, len(board[0]))):
living += board[i][j] & 1
if living == 3 or (living == 4 and board[row][col]):
... | class Solution(object):
def update(self, board, row, col):
living = 0
for i in range(max(row - 1, 0), min(row + 2, len(board))):
for j in range(max(col - 1, 0), min(col + 2, len(board[0]))):
living += board[i][j] & 1
if living == 3 or (living == 4 and board[row][... |
__all__ = ["State"]
class State:
def __init__(self, value: str):
self.value = value
def __eq__(self, other):
if not isinstance(other, State):
return False
else:
return self.value == other.value
def __hash__(self):
return hash(self.value)
| __all__ = ['State']
class State:
def __init__(self, value: str):
self.value = value
def __eq__(self, other):
if not isinstance(other, State):
return False
else:
return self.value == other.value
def __hash__(self):
return hash(self.value) |
counts = {
"FAMILY|ID": 3,
"PARTICIPANT|ID": 3,
"BIOSPECIMEN|ID": 3,
"GENOMIC_FILE|URL_LIST": 3,
}
validation = {}
| counts = {'FAMILY|ID': 3, 'PARTICIPANT|ID': 3, 'BIOSPECIMEN|ID': 3, 'GENOMIC_FILE|URL_LIST': 3}
validation = {} |
# Create a global variable.
my_value = 10
# The show_value function prints
# the value of the global variable.
def show_value():
print(my_value)
# Call the show_value function
show_value()
| my_value = 10
def show_value():
print(my_value)
show_value() |
headers = 'id,text,filename__v,format__v,size__v,charsize,pages__v'
id_ = '31011'
text = """Investigational Product Accountability Log
"""
filename__v = 'foo.docx'
format__v = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
size__v = '16290'
charsize = '768'
pages__v = '1'
row = ','.join([... | headers = 'id,text,filename__v,format__v,size__v,charsize,pages__v'
id_ = '31011'
text = 'Investigational Product Accountability Log\n\n\n'
filename__v = 'foo.docx'
format__v = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
size__v = '16290'
charsize = '768'
pages__v = '1'
row = ','.join([id_... |
N = int(input())
h = N // 3600 % 24
min = N % 3600 // 60
sec = N % 60
print(h, '%02d' % (min), '%02d' % (sec), sep=':')
| n = int(input())
h = N // 3600 % 24
min = N % 3600 // 60
sec = N % 60
print(h, '%02d' % min, '%02d' % sec, sep=':') |
"""
Implementation of an edge, as used in graphs
"""
################################################################################
# #
# Undirected #
# ... | """
Implementation of an edge, as used in graphs
"""
class Undirectededge(object):
def __init__(self, vertices, attrs=None):
self._vertices = frozenset(vertices)
self._attrs = attrs or {}
self._is_self_edge = vertices[0] == vertices[1]
def __repr__(self):
vertices = tuple(self... |
#
# PySNMP MIB module CTRON-SFPS-PATH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SFPS-PATH-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:31:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, value_range_constraint, single_value_constraint, constraints_intersection) ... |
spec = {
'name' : "a 4-node liberty cluster",
# 'external network name' : "exnet3",
'keypair' : "openstack_rsa",
'controller' : "r720",
'dns' : "10.30.65.200",
'credentials' : { 'user' : "nic", 'password' : "nic", 'project' : "nic" },
'Networks' : [
# { 'name' : "liberty" , "start":... | spec = {'name': 'a 4-node liberty cluster', 'keypair': 'openstack_rsa', 'controller': 'r720', 'dns': '10.30.65.200', 'credentials': {'user': 'nic', 'password': 'nic', 'project': 'nic'}, 'Networks': [{'name': 'liberty-dataplane', 'subnet': ' 172.16.0.0/24'}, {'name': 'liberty-provider', 'subnet': ' 172.16.1.0/24', 'star... |
COM_SLEEP = 0x00
COM_QUIT = 0x01
COM_INIT_DB = 0x02
COM_QUERY = 0x03
COM_FIELD_LIST = 0x04
COM_CREATE_DB = 0x05
COM_DROP_DB = 0x06
COM_REFRESH = 0x07
COM_SHUTDOWN = 0x08
COM_STATISTICS = 0x09
COM_PROCESS_INFO = 0x0a
COM_CONNECT = 0x0b
COM_PROCESS_KILL = 0x0c
COM_DEBUG = 0x0d
COM_PING = 0x0e
COM_TIME = 0x0f
COM_DELAYED_... | com_sleep = 0
com_quit = 1
com_init_db = 2
com_query = 3
com_field_list = 4
com_create_db = 5
com_drop_db = 6
com_refresh = 7
com_shutdown = 8
com_statistics = 9
com_process_info = 10
com_connect = 11
com_process_kill = 12
com_debug = 13
com_ping = 14
com_time = 15
com_delayed_insert = 16
com_change_user = 17
com_binlo... |
name, age = "Sharwan27", 16
username = "Sharwan27"
print ('Hello!')
print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
| (name, age) = ('Sharwan27', 16)
username = 'Sharwan27'
print('Hello!')
print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username)) |
# count = 10
# while count>0:
# print("Sandip")
# count-=1
# name="Sandip"
# for char in name:
# print(char)
# for item in name:
# print(item, end=" ")
# print("")
# print("My name is",name)
# print("My name is",name,sep="=")
# for item in range(5):
# print(item,end=" ")
# print("")
# for item ... | name = 'Sandip Dhakal!'
lenth = len(name)
print("Wo'w'")
print('Wo"w"')
print("Wo'w'")
print('San\\dip\\')
print('sand\ndip')
print('sand\tdip')
print('sand\x08dip')
check = 'H' not in name
print(check)
print(type(check)) |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | """Helper functions to expand "make" variables of form $(VAR)
"""
def expand_variables(ctx, s, outs=[], output_dir=False, attribute_name='args'):
"""This function is the same as ctx.expand_make_variables with the additional
genrule-like substitutions of:
- $@: The output file if it is a single file. Els... |
def potencia(base, inicio=1, fin=10):
while inicio < fin:
resul=base**inicio
yield resul
inicio=inicio+1
print(list(potencia(3,1,50))) | def potencia(base, inicio=1, fin=10):
while inicio < fin:
resul = base ** inicio
yield resul
inicio = inicio + 1
print(list(potencia(3, 1, 50))) |
class CFApiException(Exception):
"""Base exception for all custom exceptions raise by the cfapi module."""
class InvalidIdentifierException(CFApiException, ValueError):
"""Raised when trying to load data from an invalid URL (probably because the
data doesn't exist or isn't public)."""
class InvalidURL(C... | class Cfapiexception(Exception):
"""Base exception for all custom exceptions raise by the cfapi module."""
class Invalididentifierexception(CFApiException, ValueError):
"""Raised when trying to load data from an invalid URL (probably because the
data doesn't exist or isn't public)."""
class Invalidurl(CFA... |
N_L = input().split()
Number_lights = int(N_L[0])
Length = int(N_L[1])
time = 0
last_distance = 0
for x in range(Number_lights):
information = input().split()
time += int(information[0]) - last_distance
remainder = time % (int(information[1]) + int(information[2]))
if remainder < int(inform... | n_l = input().split()
number_lights = int(N_L[0])
length = int(N_L[1])
time = 0
last_distance = 0
for x in range(Number_lights):
information = input().split()
time += int(information[0]) - last_distance
remainder = time % (int(information[1]) + int(information[2]))
if remainder < int(information[1]):
... |
PATH_TO_STANFORD_CORENLP = '/local/cfwelch/stanford-corenlp-full-2018-02-27/*'
NUM_SPLITS = 1
TRAIN_SIZE = 0.67 # two thirds of the total data
# Define entity types here
# Each type must have a list of identifiers that do not contain the '_' token
# Example of an annotation:
#
# Kathe Halverson was the only aspec... | path_to_stanford_corenlp = '/local/cfwelch/stanford-corenlp-full-2018-02-27/*'
num_splits = 1
train_size = 0.67
ent_types = {'instructor': ['name'], 'class': ['name', 'department', 'id']}
all_ids = list(set([i for j in ENT_TYPES for i in ENT_TYPES[j]])) |
# -*- coding: utf-8 -*-
"""DSM 5 SYNO.DSM.Network data."""
DSM_5_DSM_NETWORK = {
"data": {
"dns": ["192.168.1.1"],
"gateway": "192.168.1.1",
"hostname": "HOME-NAS",
"interfaces": [
{
"id": "eth0",
"ip": [{"address": "192.168.1.10", "netmas... | """DSM 5 SYNO.DSM.Network data."""
dsm_5_dsm_network = {'data': {'dns': ['192.168.1.1'], 'gateway': '192.168.1.1', 'hostname': 'HOME-NAS', 'interfaces': [{'id': 'eth0', 'ip': [{'address': '192.168.1.10', 'netmask': '255.255.255.0'}], 'mac': 'XX-XX-XX-XX-XX-XX', 'type': 'lan'}], 'workgroup': 'WORKGROUP'}, 'success': Tru... |
#!/usr/bin/env python
#===================================================================================
#description : Methods for features exploration =
#author : Shashi Narayan, shashi.narayan(at){ed.ac.uk,loria.fr,gmail.com})=
#date ... | class Feature_Nov27:
def get_split_feature(self, split_tuple, parent_sentence, children_sentence_list, boxer_graph):
split_pattern = boxer_graph.get_pattern_4_split_candidate(split_tuple)
split_feature = split_pattern
return split_feature
def get_drop_ood_feature(self, ood_node, nodese... |
"""
The :py:mod:`.io` module provides functions which can be used to parse external
data formats used by Psephology.
"""
def parse_result_line(line):
"""Take a line consisting of a constituency name and vote count, party id
pairs all separated by commas and return the constituency name and a list of
resul... | """
The :py:mod:`.io` module provides functions which can be used to parse external
data formats used by Psephology.
"""
def parse_result_line(line):
"""Take a line consisting of a constituency name and vote count, party id
pairs all separated by commas and return the constituency name and a list of
resul... |
n = int(input())
while(n > 0):
n -= 1
a, b = input().split()
if(len(a) < len(b)):
print('nao encaixa')
else:
if(a[len(a)-len(b)::] == b):
print('encaixa')
else:
print('nao encaixa') | n = int(input())
while n > 0:
n -= 1
(a, b) = input().split()
if len(a) < len(b):
print('nao encaixa')
elif a[len(a) - len(b):] == b:
print('encaixa')
else:
print('nao encaixa') |
#1) Multiples of 3 and 5
#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
#Find the sum of all the multiples of 3 or 5 below 1000.
# Solution A
def multiples(n):
num = 1
while num < n:
if num % 3 == 0 or num % 5 == 0:
... | def multiples(n):
num = 1
while num < n:
if num % 3 == 0 or num % 5 == 0:
yield num
num += 1
sum(multiples(1000))
sum([x for x in range(1000) if x % 3 == 0 or x % 5 == 0]) |
""" Advent of Code, 2020: Day 07, a """
with open(__file__[:-5] + "_input") as f:
inputs = [line.strip() for line in f]
bags = dict()
def search(bag):
""" Recursively search bags """
if bag not in bags:
return False
return any(b == "shiny gold" or search(b) for b in bags[bag])
def run():
... | """ Advent of Code, 2020: Day 07, a """
with open(__file__[:-5] + '_input') as f:
inputs = [line.strip() for line in f]
bags = dict()
def search(bag):
""" Recursively search bags """
if bag not in bags:
return False
return any((b == 'shiny gold' or search(b) for b in bags[bag]))
def run():
... |
class Kettle(object):
def __init__(self, make, price):
self.make = make
self.price = price
self.on = False
kenwood = Kettle("kenwood", 8.99)
print(kenwood.make)
print(kenwood.price)
kenwood.price = 12.75
print(kenwood.price)
hamilton = Kettle("hamilton", 14.00)
print(hamilton.price) | class Kettle(object):
def __init__(self, make, price):
self.make = make
self.price = price
self.on = False
kenwood = kettle('kenwood', 8.99)
print(kenwood.make)
print(kenwood.price)
kenwood.price = 12.75
print(kenwood.price)
hamilton = kettle('hamilton', 14.0)
print(hamilton.price) |
# Font: https://realpython.com/python-recursion/
#Traverse a Nested List Recursively
names = [
"Adam",
[
"Bob",
[
"Chet",
"Cat",
],
"Barb",
"Bert"
],
"Alex",
[
"Bea",
"Bill"
],
"Ann"
]
print(len(names))
for i... | names = ['Adam', ['Bob', ['Chet', 'Cat'], 'Barb', 'Bert'], 'Alex', ['Bea', 'Bill'], 'Ann']
print(len(names))
for (index, item) in enumerate(names):
print(index, item)
def count_leaf_items(item_list):
"""Recursively counts and returns the
number of leaf items in a (potentially
nested) list.
""... |
#
# CodeFragment
# |
# +-- Ann
# | |
# | +-- LeaderAnn
# | +-- TrailerAnn
# |
# +-- NonAnn
# |
# +-- AnnCodeRegion
#
# -----------------------------------------
class CodeFragment:
def __init__(self):
"""Instantiate a code fragment"""
self.id = "None"
pass
# ---------... | class Codefragment:
def __init__(self):
"""Instantiate a code fragment"""
self.id = 'None'
pass
class Ann(CodeFragment):
def __init__(self, code, line_no, indent_size):
"""Instantiate an annotation"""
CodeFragment.__init__(self)
self.code = code
self.li... |
HAND1 = """
Full Tilt Poker Game #33286946295: MiniFTOPS Main Event (255707037), Table 179 - NL Hold'em - 10/20 - 19:26:50 CET - 2013/09/22 [13:26:50 ET - 2013/09/22]
Seat 1: Popp1987 (13,587)
Seat 2: Luckytobgood (10,110)
Seat 3: FatalRevange (9,970)
Seat 4: IgaziFerfi (10,000)
Seat 5: egis25 (6,873)
Seat 6: gamblie (... | hand1 = "\nFull Tilt Poker Game #33286946295: MiniFTOPS Main Event (255707037), Table 179 - NL Hold'em - 10/20 - 19:26:50 CET - 2013/09/22 [13:26:50 ET - 2013/09/22]\nSeat 1: Popp1987 (13,587)\nSeat 2: Luckytobgood (10,110)\nSeat 3: FatalRevange (9,970)\nSeat 4: IgaziFerfi (10,000)\nSeat 5: egis25 (6,873)\nSeat 6: gamb... |
# Calculate paycheck
xh = input("Enter Hors: ")
xr = input("Enter Rate: ")
xp = float(xh) * float(xr)
print("Pay:", xp)
| xh = input('Enter Hors: ')
xr = input('Enter Rate: ')
xp = float(xh) * float(xr)
print('Pay:', xp) |
input_s = ['3[abc]4[ab]c', '2[3[a]b]c']
# if '[' not in comp[l+1:r]:
# return int(comp[0:l]) * comp[l+1:r]
a = '10[a]b'
b = '2[2[3[a]b]c]'
c = '3[abc]4[ab]c'
def findnth(haystack, needle, n):
parts= haystack.split(needle, n+1)
if len(parts)<=n+1:
return -1
return len(haystack)-len(parts[-... | input_s = ['3[abc]4[ab]c', '2[3[a]b]c']
a = '10[a]b'
b = '2[2[3[a]b]c]'
c = '3[abc]4[ab]c'
def findnth(haystack, needle, n):
parts = haystack.split(needle, n + 1)
if len(parts) <= n + 1:
return -1
return len(haystack) - len(parts[-1]) - len(needle)
def decomp(comp):
l = comp.find('[')
r = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'shen.bas'
__time__ = '2018-02-03'
"""
| """
__title__ = ''
__author__ = 'shen.bas'
__time__ = '2018-02-03'
""" |
class CodegenError(Exception):
pass
class NoOperationProvidedError(CodegenError):
pass
class NoOperationNameProvidedError(CodegenError):
pass
class MultipleOperationsProvidedError(CodegenError):
pass
| class Codegenerror(Exception):
pass
class Nooperationprovidederror(CodegenError):
pass
class Nooperationnameprovidederror(CodegenError):
pass
class Multipleoperationsprovidederror(CodegenError):
pass |
# coding: utf-8
class Item(object):
def __init__(self, name, price, description, image_url, major, minor, priority):
self.name = name
self.price = price
self.description = description
self.image_url = image_url
self.minor = minor
self.major = major
self.prior... | class Item(object):
def __init__(self, name, price, description, image_url, major, minor, priority):
self.name = name
self.price = price
self.description = description
self.image_url = image_url
self.minor = minor
self.major = major
self.priority = priority
... |
# class and object (oops concept)
class class_8:
print()
name = 'amar'
# class class_9:
# name = 'rahul'
# age = 23
# def welcome(self):
# print("welcome to teckat")
# # a = class_9() # create object of class abc
# # b = class_8()
# # c = class_9()
# # # print(abc.name) # accessi... | class Class_8:
print()
name = 'amar'
class Student:
def __init__(self):
self.name = ''
self.age = 0
def input_details(self):
self.name = input('Enter name')
self.num1 = int(input('Enter 1st marks'))
self.num2 = int(input('Enter 2nd marks'))
def add(self):
... |
with open('iso_list/valid_list.txt') as i:
names = i.readlines()
with open('iso_list/valid.prediction') as i:
p = i.readlines()
out = open('iso_list/valid_prediction.txt', 'w')
assert len(names) == len(p)
for i, n in enumerate(names):
n = n[:-1]
result = n + ' ' + p[i]
out.write(result)
| with open('iso_list/valid_list.txt') as i:
names = i.readlines()
with open('iso_list/valid.prediction') as i:
p = i.readlines()
out = open('iso_list/valid_prediction.txt', 'w')
assert len(names) == len(p)
for (i, n) in enumerate(names):
n = n[:-1]
result = n + ' ' + p[i]
out.write(result) |
# '''
# Linked List hash table key/value pair
# '''
class LinkedPair:
def __init__(self, key, value):
self.key = key
self.value = value
self.next = None
# '''
# Resizing hash table
# '''
class HashTable:
def __init__(self, capacity):
self.capacity = capacity
self.stor... | class Linkedpair:
def __init__(self, key, value):
self.key = key
self.value = value
self.next = None
class Hashtable:
def __init__(self, capacity):
self.capacity = capacity
self.storage = [None] * capacity
def hash(string, max):
hash = 5381
for char in string:... |
class Solution:
def plusOne(self, digits):
i = len(digits) - 1
while i >= 0:
if digits[i] == 9:
digits[i] = 0
i = i - 1
else:
digits[i] += 1
break
if i == -1 and digits[0] == 0:
digits.append(... | class Solution:
def plus_one(self, digits):
i = len(digits) - 1
while i >= 0:
if digits[i] == 9:
digits[i] = 0
i = i - 1
else:
digits[i] += 1
break
if i == -1 and digits[0] == 0:
digits.appen... |
class A:
name="Default"
def __init__(self, n = None):
self.name = n
print(self.name)
def m(self):
print("m of A called")
class B(A):
# def m(self):
# print("m of B called")
pass
class C(A):
def m(self):
print("m of C called")
class D(B, C):
def __init__(self):
self.objB =... | class A:
name = 'Default'
def __init__(self, n=None):
self.name = n
print(self.name)
def m(self):
print('m of A called')
class B(A):
pass
class C(A):
def m(self):
print('m of C called')
class D(B, C):
def __init__(self):
self.objB = b()
self... |
"""
Copyright (c) 2015 Frank Lamar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, s... | """
Copyright (c) 2015 Frank Lamar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, s... |
'''
Created on 1.12.2016
@author: Darren
''''''
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
"
'''
| """
Created on 1.12.2016
@author: Darren
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
"
""" |
command = '/usr/bin/gunicorn'
pythonpath = '/opt/netbox/netbox'
bind = '0.0.0.0:{{ .Values.service.internalPort }}'
workers = 3
errorlog = '-'
accesslog = '-'
capture_output = False
loglevel = 'debug'
| command = '/usr/bin/gunicorn'
pythonpath = '/opt/netbox/netbox'
bind = '0.0.0.0:{{ .Values.service.internalPort }}'
workers = 3
errorlog = '-'
accesslog = '-'
capture_output = False
loglevel = 'debug' |
if __name__ == '__main__':
n, x = map(int, input().split())
sheet = []
[sheet.append(map(float, input().split())) for i in range(x)]
for i in zip(*sheet):
print(sum(i)/len(i))
| if __name__ == '__main__':
(n, x) = map(int, input().split())
sheet = []
[sheet.append(map(float, input().split())) for i in range(x)]
for i in zip(*sheet):
print(sum(i) / len(i)) |
class ListaProduto(object):
lista_produtos = [
{
"id":1,
"nome":"pao sete graos"
},
{
"id":2,
"nome":"pao original"
},
{
"id":3,
"nome":"pao integral"
},
{
"id":4,
... | class Listaproduto(object):
lista_produtos = [{'id': 1, 'nome': 'pao sete graos'}, {'id': 2, 'nome': 'pao original'}, {'id': 3, 'nome': 'pao integral'}, {'id': 4, 'nome': 'pao light'}, {'id': 5, 'nome': 'pao recheado'}, {'id': 6, 'nome': 'pao doce'}, {'id': 7, 'nome': 'pao sem casca'}, {'id': 8, 'nome': 'pao caseir... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 24 19:59:10 2021
@author: sshir
"""
def rec(df, item_col, user_col, user, user_rating_col, avg_rating_col, sep=None):
'''
Recommending items for a specific existing user based on user rating
and average rating per item. Returns only the items which... | """
Created on Sat Apr 24 19:59:10 2021
@author: sshir
"""
def rec(df, item_col, user_col, user, user_rating_col, avg_rating_col, sep=None):
"""
Recommending items for a specific existing user based on user rating
and average rating per item. Returns only the items which are not consumed
by the user.... |
apiAttachAvailable = u'\u0648\u0627\u062c\u0647\u0629 \u0628\u0631\u0645\u062c\u0629 \u0627\u0644\u062a\u0637\u0628\u064a\u0642 (API) \u0645\u062a\u0627\u062d\u0629'
apiAttachNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d'
apiAttachPendingAuthorization = u'\u062a\u0639\u0644\u064a\u0642 \u0627\u0644\u06... | api_attach_available = u'واجهة برمجة التطبيق (API) متاحة'
api_attach_not_available = u'غير متاح'
api_attach_pending_authorization = u'تعليق التصريح'
api_attach_refused = u'رفض'
api_attach_success = u'نجاح'
api_attach_unknown = u'غير معروفة'
bud_deleted_friend = u'تم حذفه من قائمة الأصدقاء'
bud_friend = u'صديق'
bud_neve... |
def go():
with open('input.txt', 'r') as f:
ids = [item for item in f.read().split('\n') if item]
for i in range(len(ids)):
for j in range(i + 1, len(ids)):
diff_count = 0
for k in range(len(ids[i])):
if ids[i][k] != ids[j][k]:
... | def go():
with open('input.txt', 'r') as f:
ids = [item for item in f.read().split('\n') if item]
for i in range(len(ids)):
for j in range(i + 1, len(ids)):
diff_count = 0
for k in range(len(ids[i])):
if ids[i][k] != ids[j][k]:
... |
# Copyright 2013-2022 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 PyNvidiaMlPy(PythonPackage):
"""Python Bindings for the NVIDIA Management Library."""
homepage = "https://... | class Pynvidiamlpy(PythonPackage):
"""Python Bindings for the NVIDIA Management Library."""
homepage = 'https://www.nvidia.com/'
pypi = 'nvidia-ml-py/nvidia-ml-py-11.450.51.tar.gz'
version('11.450.51', sha256='5aa6dd23a140b1ef2314eee5ca154a45397b03e68fd9ebc4f72005979f511c73')
depends_on('py-setuptoo... |
# -*- coding: utf-8 -*-
def main():
abcd = sorted([int(input()) for _ in range(4)])
ef = sorted([int(input()) for _ in range(2)])
print(sum(abcd[1:] + ef[1:]))
if __name__ == '__main__':
main()
| def main():
abcd = sorted([int(input()) for _ in range(4)])
ef = sorted([int(input()) for _ in range(2)])
print(sum(abcd[1:] + ef[1:]))
if __name__ == '__main__':
main() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.