content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"Github API v2 library for Python"
VERSION = (0, 2, 0)
__author__ = "Ask Solem"
__contact__ = "askh@opera.com"
__homepage__ = "http://github.com/ask/python-github2"
__version__ = ".".join(map(str, VERSION))
| """Github API v2 library for Python"""
version = (0, 2, 0)
__author__ = 'Ask Solem'
__contact__ = 'askh@opera.com'
__homepage__ = 'http://github.com/ask/python-github2'
__version__ = '.'.join(map(str, VERSION)) |
N = 6
edge_list = [(0, 1, 30), (1, 0, 30), (0, 2, 25), (2, 0, 20), (1, 2, 40),
(2, 1, 35), (1, 3, 35), (2, 4, 15), (3, 1, 25), (3, 2, 20),
(3, 5, 45), (4, 3, 10), (4, 5, 40), (5, 3, 50), (5, 4, 50)]
dij = [[float('inf') for i in range(N)] for j in range(N)]
for i in range(N):
dij[i][i] = 0... | n = 6
edge_list = [(0, 1, 30), (1, 0, 30), (0, 2, 25), (2, 0, 20), (1, 2, 40), (2, 1, 35), (1, 3, 35), (2, 4, 15), (3, 1, 25), (3, 2, 20), (3, 5, 45), (4, 3, 10), (4, 5, 40), (5, 3, 50), (5, 4, 50)]
dij = [[float('inf') for i in range(N)] for j in range(N)]
for i in range(N):
dij[i][i] = 0.0
for e in edge_list:
... |
#list
list = [1,2,3,4,8]
print(list)
list.append(6)
print(list)
list.pop(2)
print(list)
list.insert(1,7)
print(list)
list.extend([1,2,4,7])
print(list)
print(list.count(2))
print(1 in list)
list.sort()
print(list)
list.reverse()
print(list)
#dictionary
dict = {
1:'yasser',
'h':'honey',
... | list = [1, 2, 3, 4, 8]
print(list)
list.append(6)
print(list)
list.pop(2)
print(list)
list.insert(1, 7)
print(list)
list.extend([1, 2, 4, 7])
print(list)
print(list.count(2))
print(1 in list)
list.sort()
print(list)
list.reverse()
print(list)
dict = {1: 'yasser', 'h': 'honey', 'l': 3}
tuple = (1, 2, 4, 5, 8, 8)
set = {... |
class Card:
values = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]
suits = ["Hearts", "Diamonds", "Clubs", "Spades"]
def __init__(self, value, suit):
self.set_value(value)
self.set_suit(suit)
def __repr__(self):
return f"{self.value} of {self.suit}"
... | class Card:
values = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
suits = ['Hearts', 'Diamonds', 'Clubs', 'Spades']
def __init__(self, value, suit):
self.set_value(value)
self.set_suit(suit)
def __repr__(self):
return f'{self.value} of {self.suit}'
de... |
def running_sum(numbers, start=0):
if len(numbers) == 0:
print()
return
total = numbers[0] + start
print(total,end="")
running_sum(numbers[1:],total)
| def running_sum(numbers, start=0):
if len(numbers) == 0:
print()
return
total = numbers[0] + start
print(total, end='')
running_sum(numbers[1:], total) |
class MyClass:
var = "hello"
def say(a,b):
print("hello"+a.var+b) | class Myclass:
var = 'hello'
def say(a, b):
print('hello' + a.var + b) |
def parse_iteration(s):
if s[-1] == 'k':
return int(s[:-1])*1000
elif s[-1] == 'm':
return int(s[:-1])*1000000
else:
return int(s)
| def parse_iteration(s):
if s[-1] == 'k':
return int(s[:-1]) * 1000
elif s[-1] == 'm':
return int(s[:-1]) * 1000000
else:
return int(s) |
#ALGORITHM USED FOR GENERATING A MAGIC SQUARE USING FORMULA IS AS FOLLOWS:
#Step 1: Start in the middle of the top row, and let n=1
#Step 2: Insert n into the current grid position;
#Step 3: If n=N2 the grid is complete so stop. Otherwise increment n
#Step 4: Move diagonally up and right, wrapping to the first colu... | def generate_square(n):
magic_square = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
i = n / 2
j = n - 1
temp = 1
while temp <= n * n:
if i == -1 and j == n:
j = n - 2
i = 0
else:
if j == n:
j = 0
if i < 0:
i = n - 1... |
# this module is a place to store stuff that is used in multiple modules
# valorant client object
client = None
# websocket connections
sockets = []
# user configuration
config = None
# onboarding state
onboarding = False
# asyncio loop
loop = None | client = None
sockets = []
config = None
onboarding = False
loop = None |
def print_hello_world(n):
while n > 0:
print('Hello, world!')
n = n - 1
print_hello_world(3)
| def print_hello_world(n):
while n > 0:
print('Hello, world!')
n = n - 1
print_hello_world(3) |
class DataErrorsChangedEventArgs(EventArgs):
""" DataErrorsChangedEventArgs(propertyName: str) """
@staticmethod
def __new__(self, propertyName):
""" __new__(cls: type,propertyName: str) """
pass
PropertyName = property(
lambda self: object(), lambda self, v: None, lam... | class Dataerrorschangedeventargs(EventArgs):
""" DataErrorsChangedEventArgs(propertyName: str) """
@staticmethod
def __new__(self, propertyName):
""" __new__(cls: type,propertyName: str) """
pass
property_name = property(lambda self: object(), lambda self, v: None, lambda self: None)
... |
class ReturnValuesWrapper(object):
"""
Wraps a return specification and a set of corresponding return values.
Enables comparison between value sets.
"""
def __init__(self, return_spec, values):
self.return_spec = return_spec
self.values = values
# TODO: Use something like funct... | class Returnvalueswrapper(object):
"""
Wraps a return specification and a set of corresponding return values.
Enables comparison between value sets.
"""
def __init__(self, return_spec, values):
self.return_spec = return_spec
self.values = values
def __lt__(self, other):
... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2017-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Configuration for Invenio-Theme."""
BASE_TEMPLATE = 'invenio_theme/page.html'
"""... | """Configuration for Invenio-Theme."""
base_template = 'invenio_theme/page.html'
'Base template for user facing pages.\n\nThe template provides a basic skeleton which takes care of loading assets,\nembedding header metadata and define basic template blocks. All other user\nfacing templates usually extends from this tem... |
our_set = set()
our_set2 = {0}
print(our_set, type(our_set))
print(our_set2, type(our_set2))
our_set.add('tomato')
our_set2.add("potato")
print(our_set)
print(our_set2)
x = "tomato"
print(x in our_set)
print(x in our_set2)
print(our_set.isdisjoint(our_set2))
our_set3 = our_set.union(our_set2)
print(our_set3)
our_set.up... | our_set = set()
our_set2 = {0}
print(our_set, type(our_set))
print(our_set2, type(our_set2))
our_set.add('tomato')
our_set2.add('potato')
print(our_set)
print(our_set2)
x = 'tomato'
print(x in our_set)
print(x in our_set2)
print(our_set.isdisjoint(our_set2))
our_set3 = our_set.union(our_set2)
print(our_set3)
our_set.up... |
#
# PySNMP MIB module CISCO-XGCP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-XGCP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:21:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) ... |
#Given an array of integers, find the sum of its elements.
#Input Format
#The first line contains an integer, n, denoting the size of the array.
#The second line contains n space-separated integers representing the array's elements.
#Output Format
#Print the sum of the array's elements as a single integer.
#Sampl... | def simple_array_sum(ar):
n = len(ar)
i = 0
p = 0
while i < n:
p = p + ar[i]
i += 1
return p |
"""
Organisation theme for CEDA Services web components.
"""
__author__ = "Matt Pritchard"
__copyright__ = "Copyright 2018 UK Science and Technology Facilities Council"
__version__ = "0.5"
| """
Organisation theme for CEDA Services web components.
"""
__author__ = 'Matt Pritchard'
__copyright__ = 'Copyright 2018 UK Science and Technology Facilities Council'
__version__ = '0.5' |
AUTH_LDAP_GLOBAL_OPTIONS = {
ldap.OPT_X_TLS_REQUIRE_CERT: True,
ldap.OPT_X_TLS_CACERTFILE: "/etc/certs/ldap.pem"
}
| auth_ldap_global_options = {ldap.OPT_X_TLS_REQUIRE_CERT: True, ldap.OPT_X_TLS_CACERTFILE: '/etc/certs/ldap.pem'} |
class Worker:
def __init__(self, number, name, age, salary):
self.number = number,
self.name = name,
self.age = age,
self.salary = salary
| class Worker:
def __init__(self, number, name, age, salary):
self.number = (number,)
self.name = (name,)
self.age = (age,)
self.salary = salary |
class SessionTimeOut(Exception):
pass
class InvalidFormat(Exception):
pass
class UserExists(Exception):
pass
class EmailAlreadyUsed(Exception):
pass
class SQLInjectionAlert(Exception):
pass
| class Sessiontimeout(Exception):
pass
class Invalidformat(Exception):
pass
class Userexists(Exception):
pass
class Emailalreadyused(Exception):
pass
class Sqlinjectionalert(Exception):
pass |
class Button:
def __init__(self, label, _x, _y, _w, _h):
self.label = label
self.position = PVector(_x, _y)
self.WIDTH = _w
self.HEIGHT = _h
def display(self):
fill(218)
stroke(0)
rect(self.position.x, self.position.y... | class Button:
def __init__(self, label, _x, _y, _w, _h):
self.label = label
self.position = p_vector(_x, _y)
self.WIDTH = _w
self.HEIGHT = _h
def display(self):
fill(218)
stroke(0)
rect(self.position.x, self.position.y, self.WIDTH, self.HEIGHT, 10)
... |
test = {
'name': 'Problem 9',
'points': 3,
'suites': [
{
'cases': [
{
'answer': 'A TankAnt does damage to all Bees in its place each turn',
'choices': [
'A TankAnt does damage to all Bees in its place each turn',
'A TankAnt has greater health than a Bo... | test = {'name': 'Problem 9', 'points': 3, 'suites': [{'cases': [{'answer': 'A TankAnt does damage to all Bees in its place each turn', 'choices': ['A TankAnt does damage to all Bees in its place each turn', 'A TankAnt has greater health than a BodyguardAnt', 'A TankAnt can contain multiple ants', 'A TankAnt increases t... |
EXPECTED = {'X680': {'extensibility-implied': False,
'imports': {},
'object-classes': {'ATTRIBUTE-E-2-15': {'members': [{'name': '&AttributeType',
'type': 'OpenType'},
{'name'... | expected = {'X680': {'extensibility-implied': False, 'imports': {}, 'object-classes': {'ATTRIBUTE-E-2-15': {'members': [{'name': '&AttributeType', 'type': 'OpenType'}, {'name': '&attributeId', 'type': 'OBJECT IDENTIFIER'}]}}, 'object-sets': {}, 'tags': 'AUTOMATIC', 'types': {'A': {'type': 'NULL'}, 'A-19-5': {'type': 'E... |
def pairs(array: list) -> int:
""" This function returns the count of pairs that have consecutive numbers. """
pairs_from_array = list(zip(array[::2], array[1::2]))
count = 0
for i, j in pairs_from_array:
if (i - j == 1) or (i - j == -1):
count += 1
return count | def pairs(array: list) -> int:
""" This function returns the count of pairs that have consecutive numbers. """
pairs_from_array = list(zip(array[::2], array[1::2]))
count = 0
for (i, j) in pairs_from_array:
if i - j == 1 or i - j == -1:
count += 1
return count |
output_name = "test"
config = {
"_description": "Test configuration",
"gpu": [0],
# data
"dataset": "Lsun_church",
"data_path": "/home/yct/data/church_outdoor_train_lmdb/Lsun_church_unlabeled_64",
"data_size": 2000,
"use_image_generator": False,
# model & training
"model": ... | output_name = 'test'
config = {'_description': 'Test configuration', 'gpu': [0], 'dataset': 'Lsun_church', 'data_path': '/home/yct/data/church_outdoor_train_lmdb/Lsun_church_unlabeled_64', 'data_size': 2000, 'use_image_generator': False, 'model': 'vanilla', 'z_dim': 128, 'gf_dim': 16, 'df_dim': 16, 'lr_g': 0.0002, 'lr_... |
#/usr/bin/python3
GPIO_NUM = 23
COLUMN_LEN = 16
COLUMN_GAP = 30
def read_file():
file = open("line")
count = 0
while 1:
for i in range(GPIO_NUM):
count = count + 1
if count > GPIO_NUM * COLUMN_LEN:
return
line = file.readline()
if not... | gpio_num = 23
column_len = 16
column_gap = 30
def read_file():
file = open('line')
count = 0
while 1:
for i in range(GPIO_NUM):
count = count + 1
if count > GPIO_NUM * COLUMN_LEN:
return
line = file.readline()
if not line:
... |
class MangaDexException(Exception):
"""Base exception for MangaDex errors"""
pass
class HTTPException(MangaDexException):
"""HTTP errors"""
def __init__(self, *args: object, resp=None) -> None:
self.response = resp
super().__init__(*args)
class InvalidManga(MangaDexException):
"""R... | class Mangadexexception(Exception):
"""Base exception for MangaDex errors"""
pass
class Httpexception(MangaDexException):
"""HTTP errors"""
def __init__(self, *args: object, resp=None) -> None:
self.response = resp
super().__init__(*args)
class Invalidmanga(MangaDexException):
"""... |
n, k = map(int, input().split())
a = list(sorted(map(int, input().split()), reverse=True))
s = set()
for i in range(len(a)):
if a[i] * k not in s:
s.add(a[i])
print(len(s)) | (n, k) = map(int, input().split())
a = list(sorted(map(int, input().split()), reverse=True))
s = set()
for i in range(len(a)):
if a[i] * k not in s:
s.add(a[i])
print(len(s)) |
def smile():
return ":)"
def frown():
return ":("
| def smile():
return ':)'
def frown():
return ':(' |
# coding=utf-8
DEBUG = True
SITE_ID = 1
SECRET_KEY = 'blabla'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
}
}
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'south',
'contacts'... | debug = True
site_id = 1
secret_key = 'blabla'
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3'}}
installed_apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sites', 'south', 'contacts', 'contacts.tests']
use_i18_n = True
use_l10_n = True |
__author__ = ['Tom Van Mele', ]
__copyright__ = 'Copyright 2016 - Block Research Group, ETH Zurich'
__license__ = 'MIT License'
__email__ = 'vanmelet@ethz.ch'
__all__ = [
'get_axes_dimension',
'assert_axes_dimension',
'width_to_dict',
'size_to_sizedict',
]
def get_axes_dimension(axes):
... | __author__ = ['Tom Van Mele']
__copyright__ = 'Copyright 2016 - Block Research Group, ETH Zurich'
__license__ = 'MIT License'
__email__ = 'vanmelet@ethz.ch'
__all__ = ['get_axes_dimension', 'assert_axes_dimension', 'width_to_dict', 'size_to_sizedict']
def get_axes_dimension(axes):
"""Returns the number of dimensio... |
# pylint: disable=missing-docstring, invalid-name
MY_DICTIONARY = {"key_one": 1, "key_two": 2, "key_three": 3}
try: # [max-try-statements]
value = MY_DICTIONARY["key_one"]
value += 1
except KeyError:
pass
try:
value = MY_DICTIONARY["key_one"]
except KeyError:
value = 0
| my_dictionary = {'key_one': 1, 'key_two': 2, 'key_three': 3}
try:
value = MY_DICTIONARY['key_one']
value += 1
except KeyError:
pass
try:
value = MY_DICTIONARY['key_one']
except KeyError:
value = 0 |
# Jupyter Extension points
def _jupyter_nbextension_paths():
return [
dict(
section="notebook",
src="static",
# directory in the `nbextension/` namespace
dest="imjoy_jupyter_extension",
# _also_ in the `nbextension/` namespace
require="... | def _jupyter_nbextension_paths():
return [dict(section='notebook', src='static', dest='imjoy_jupyter_extension', require='imjoy_jupyter_extension/imjoy-rpc')] |
#!/usr/bin/env python
"""
List of APIs supported by Gurunudi
"""
API_CHAT ='chatbot' #real time conversation and knowledge q&a - ideal for chatbots
"""
Fields returned in response JSON by Gurunudi API calls and Fields sent in request JSON to Gurunudi API calls
"""
FIELD_LANG='lang'
FIELD_TARGET_LANG='target'
FIELD_C... | """
List of APIs supported by Gurunudi
"""
api_chat = 'chatbot'
'\nFields returned in response JSON by Gurunudi API calls and Fields sent in request JSON to Gurunudi API calls\n'
field_lang = 'lang'
field_target_lang = 'target'
field_context = 'context'
field_text = 'text'
field_error = 'error'
field_list = 'list'
fiel... |
COLOR_CANVAS_DARK = 'rgb(33,33,33)'
COLOR_CANVAS_LIGHT = 'rgb(252, 252, 252)'
COLOR_PLOT_TEXT_LIGHT = 'rgb(52, 49, 49)'
COLOR_PLOT_TEXT_DARK = 'rgb(252, 252, 252)'
COLOR_ZERO_LINE_LIGHT = "green"
COLOR_ZERO_LINE_DARK = "limegreen"
COLOR_BEAM = "red"
COLOR_DETECTOR = "#D3D3D3"
COLOR_PAD = "slateblue"
COLOR_PATIENT = "#C... | color_canvas_dark = 'rgb(33,33,33)'
color_canvas_light = 'rgb(252, 252, 252)'
color_plot_text_light = 'rgb(52, 49, 49)'
color_plot_text_dark = 'rgb(252, 252, 252)'
color_zero_line_light = 'green'
color_zero_line_dark = 'limegreen'
color_beam = 'red'
color_detector = '#D3D3D3'
color_pad = 'slateblue'
color_patient = '#C... |
#3) Largest prime factor
#The prime factors of 13195 are 5, 7, 13 and 29.
#What is the largest prime factor of the number 600851475143 ?
# Solution
def primes_naive(n):
if n < 2: return []
sieve = [True] * n
for i in range(3,int(n**0.5)+1,2):
if sieve[i]:
sieve[i*i::2*i]=[False]*((n-i*i... | def primes_naive(n):
if n < 2:
return []
sieve = [True] * n
for i in range(3, int(n ** 0.5) + 1, 2):
if sieve[i]:
sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
return [2] + [i for i in range(3, n, 2) if sieve[i]]
def primes(n):
sieve = [True] * (n // 2... |
f = open("twentyfive.txt", "r")
lines = [x.strip() for x in f.readlines()]
width = len(lines[0])
height = len(lines)
left = {}
down = {}
for y in range(len(lines)):
left[y] = []
down[y] = []
for x in range(len(lines[y])):
if lines[y][x] == ">":
left[y].append(x)
elif lines[y][... | f = open('twentyfive.txt', 'r')
lines = [x.strip() for x in f.readlines()]
width = len(lines[0])
height = len(lines)
left = {}
down = {}
for y in range(len(lines)):
left[y] = []
down[y] = []
for x in range(len(lines[y])):
if lines[y][x] == '>':
left[y].append(x)
elif lines[y][x] ... |
class dotPolymeshValidateInvalidInfo_t(object):
# no doc
ClientId=None
nInvalidFaces=None
| class Dotpolymeshvalidateinvalidinfo_T(object):
client_id = None
n_invalid_faces = None |
def parse_svg(txt):
txt = txt.split('<path d="')[-1]
txt = txt.split('z"/>')[0]
txt = txt.replace('\n', ' ')
txt = txt.split(' ')
# Take out the initial M x y instruction
txt = txt[2:]
# Take out the initial c instruction
txt[0] = txt[0][1:]
txt = [int(num) for num in txt]
curves = []
cur_pos = (0, 0)
... | def parse_svg(txt):
txt = txt.split('<path d="')[-1]
txt = txt.split('z"/>')[0]
txt = txt.replace('\n', ' ')
txt = txt.split(' ')
txt = txt[2:]
txt[0] = txt[0][1:]
txt = [int(num) for num in txt]
curves = []
cur_pos = (0, 0)
for i in range(0, len(txt) - 2, 6):
c = []
... |
# -*- coding: utf-8 -*-
"""Top-level package for tmrwppk."""
__author__ = """Nick Hobart"""
__email__ = 'nick@hobart.io'
__version__ = '0.0.6'
| """Top-level package for tmrwppk."""
__author__ = 'Nick Hobart'
__email__ = 'nick@hobart.io'
__version__ = '0.0.6' |
class LinkedList:
class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
def __init__(self):
self.head = None
def append(self, data):
"""Add a new node to the end of the list."""
node = self.head
if node is ... | class Linkedlist:
class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
def __init__(self):
self.head = None
def append(self, data):
"""Add a new node to the end of the list."""
node = self.head
if node is None:... |
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
seen = set() # visited cells here
res = 0
for r, row in enumerate(grid):
for c, val in enumerate(row): # val is basically grid[r, c]
if val and (r,c) not in seen: # if val is 1 and not visi... | class Solution:
def max_area_of_island(self, grid: List[List[int]]) -> int:
seen = set()
res = 0
for (r, row) in enumerate(grid):
for (c, val) in enumerate(row):
if val and (r, c) not in seen:
stack = [(r, c)]
curr_area = 0... |
# -*- coding: utf-8 -*-
'''
Generate baseline proxy minion grains
'''
__proxyenabled__ = ['rest_sample']
__virtualname__ = 'rest_sample'
def __virtual__():
if 'proxy' not in __opts__:
return False
else:
return __virtualname__
def kernel():
return {'kernel': 'proxy'}
def os():
retu... | """
Generate baseline proxy minion grains
"""
__proxyenabled__ = ['rest_sample']
__virtualname__ = 'rest_sample'
def __virtual__():
if 'proxy' not in __opts__:
return False
else:
return __virtualname__
def kernel():
return {'kernel': 'proxy'}
def os():
return {'os': 'proxy'}
def loca... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Tests that custom auth works & is not impaired by CORS',
'category': 'Hidden',
'data': [],
}
| {'name': 'Tests that custom auth works & is not impaired by CORS', 'category': 'Hidden', 'data': []} |
#String unpack example
testString = '0xL08$#$john18:jcTeam01_@#@_https://docs.google.com/spreadsheetExampleUrl'
commandData, data = testString.split('_@#@_')
print(commandData)
print(data)
command, cData = commandData.split('$#$')
print(command)
print(cData)
username, fileName = cData.split(':')
print(username)
print(... | test_string = '0xL08$#$john18:jcTeam01_@#@_https://docs.google.com/spreadsheetExampleUrl'
(command_data, data) = testString.split('_@#@_')
print(commandData)
print(data)
(command, c_data) = commandData.split('$#$')
print(command)
print(cData)
(username, file_name) = cData.split(':')
print(username)
print(fileName) |
def format_bytes(n):
"""Format bytes as text
Copied from dask to avoid dependency.
"""
if n > 1e15:
return "%0.2f PB" % (n / 1e15)
if n > 1e12:
return "%0.2f TB" % (n / 1e12)
if n > 1e9:
return "%0.2f GB" % (n / 1e9)
if n > 1e6:
return "%0.2f MB" % (n / 1e6)... | def format_bytes(n):
"""Format bytes as text
Copied from dask to avoid dependency.
"""
if n > 1000000000000000.0:
return '%0.2f PB' % (n / 1000000000000000.0)
if n > 1000000000000.0:
return '%0.2f TB' % (n / 1000000000000.0)
if n > 1000000000.0:
return '%0.2f GB' % (n /... |
def canConstruct(target, word_bank):
tab = [False for _ in range(len(target)+1)]
# seed
tab[0] = True # creating an empty string is always possible
for i in range(len(target)+1):
if tab[i] is True:
for word in word_bank:
# If the word matches the characters starting at position i
if target[i:].start... | def can_construct(target, word_bank):
tab = [False for _ in range(len(target) + 1)]
tab[0] = True
for i in range(len(target) + 1):
if tab[i] is True:
for word in word_bank:
if target[i:].startswith(word):
tab[i + len(word)] = True
return tab[-1]
pr... |
#The urllib module has a function called urljoin which might be able to improve how I put together these urls.
DefaultBaseUrl = "https://api.idfy.io"
DefaultOAuthBaseUrl = DefaultBaseUrl #Could this lead to problems where the DefaultOAuthBaseUrl resets unexpectedly?
TestBaseUrl = "http://localhost:5000" #testing on... | default_base_url = 'https://api.idfy.io'
default_o_auth_base_url = DefaultBaseUrl
test_base_url = 'http://localhost:5000'
o_auth_tokens = '/oauth/connect/token'
signature = '/signature'
signature_documents = Signature + '/documents'
notification = '/notification'
identification = '/identification'
identification_sessio... |
# APIs for Windows 32-bit user32 library.
# Format: retval, rettype, callconv, exactname, arglist(type, name)
# arglist type is one of ['int', 'void *']
# arglist name is one of [None, 'funcptr', 'obj', 'ptr']
api_defs = {
'user32.main_entry':( 'int', None, 'stdcall', 'user32.main_entry', (('int... | api_defs = {'user32.main_entry': ('int', None, 'stdcall', 'user32.main_entry', (('int', None), ('int', None), ('int', None))), 'user32.activatekeyboardlayout': ('int', None, 'stdcall', 'user32.ActivateKeyboardLayout', (('int', None), ('int', None))), 'user32.adjustwindowrect': ('int', None, 'stdcall', 'user32.AdjustWin... |
class Solution:
def minFallingPathSum(self, matrix: List[List[int]]) -> int:
# dp[i][j] means minimum falling path ended with matrix[i][j]
# dp[i][j] = min(dp[i-1][j],dp[i-1][j-1], dp[i-1][j+1])
dp = [[0 for _ in range(len(matrix[0]))] for _ in range(len(matrix))]
for i in range(le... | class Solution:
def min_falling_path_sum(self, matrix: List[List[int]]) -> int:
dp = [[0 for _ in range(len(matrix[0]))] for _ in range(len(matrix))]
for i in range(len(matrix[0])):
dp[0][i] = matrix[0][i]
for i in range(1, len(matrix)):
for j in range(len(matrix[0])... |
# A number of options exist when aiming to review how many components to include to reduce the dimensionality complexity
# Let PCA select 90% of the variance
pipe = Pipeline([('scaler', StandardScaler()),
('reducer', PCA(n_components=0.9))]) # By providing a percent ratio value this means the algorithm aims ... | pipe = pipeline([('scaler', standard_scaler()), ('reducer', pca(n_components=0.9))])
pipe.fit(ansur_df)
print('{} components selected'.format(len(pipe.steps[1][1].components_)))
pipe = pipeline([('scaler', standard_scaler()), ('reducer', pca(n_components=10))])
pipe.fit(ansur_df)
plt.plot(pipe.steps[1][1].explained_var... |
# ### Trees
# A tree is a widely used abstract data type that simulates a hierarchical tree structure, with a `root` value and subtrees of `children` with a `parent` node, represented as a set of linked nodes.
#
# A tree data structure can be defined recursively as a collection of nodes (starting at a root node), wher... | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
class Tree:
def __init__(self):
self.root = None
def preorder(self, root):
if root:
print(root.data, end=' ')
self.preorder(root.left)
sel... |
"""
Get the editions per year.
"""
def do_query(archives, config_file=None, logger=None, context=None):
"""
Iterate through archives and get the title and editions per year
Returns result of form:
{ <YEAR>: [ (title, edition), (title, edition)] }
:param archives: RDD of defoe.nls.archive.Archive... | """
Get the editions per year.
"""
def do_query(archives, config_file=None, logger=None, context=None):
"""
Iterate through archives and get the title and editions per year
Returns result of form:
{ <YEAR>: [ (title, edition), (title, edition)] }
:param archives: RDD of defoe.nls.archive.Archive
... |
"""Monkey patch the Django admin site to also allow a permission check"""
# I feel SO dirty doing this, but admin autodiscover doesn't work if I have a custom admin site,
# and all I want to do is allow you to get into the admin site if you have either the is_staff flag or
# a custom permission as defined on the accou... | """Monkey patch the Django admin site to also allow a permission check"""
def patched_has_permission(request) -> bool:
"""
Patched version of admin site has_permission,
to allow for the accounts:admin_login permission
"""
if request.user.is_active:
if request.user.is_staff:
retu... |
#Not finished yet
# intervals = [[1,3],[2,6],[8,10],[15,18]]
# intervals = [[1,4],[4,5]]
intervals = [[2,3],[4,5],[6,7],[8,9],[1,10]]
intervals.sort(key = lambda it : it[0])
myList = [intervals[0]]
for i in range(1,len(intervals)):
# print(myList)
comp1i, comp1j = myList.pop()
comp2i, comp2j = intervals[i... | intervals = [[2, 3], [4, 5], [6, 7], [8, 9], [1, 10]]
intervals.sort(key=lambda it: it[0])
my_list = [intervals[0]]
for i in range(1, len(intervals)):
(comp1i, comp1j) = myList.pop()
(comp2i, comp2j) = intervals[i]
if comp2i > comp1j:
myList.append([comp1i, comp1j])
myList.append(intervals[i... |
"""
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.
Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.
Note: If the number is a multiple of both 3 and 5, only count it once.
Also, i... | """
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.
Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.
Note: If the number is a multiple of both 3 and 5, only count it once.
Also, i... |
# -------------------------------------------------------
#
#
#
# -------------------------------------------------------
class ServiceCategory():
inpatient = 'inpatient'
other_services = 'other_services'
long_term = 'long_term'
prescription = 'prescription'
# -------------------------------------... | class Servicecategory:
inpatient = 'inpatient'
other_services = 'other_services'
long_term = 'long_term'
prescription = 'prescription' |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"make_session": "00_scrapers.ipynb",
"make_browser": "00_scrapers.ipynb",
"s": "00_scrapers.ipynb",
"browsers": "00_scrapers.ipynb",
"cache_db": "00_scrapers.ipynb",
... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'make_session': '00_scrapers.ipynb', 'make_browser': '00_scrapers.ipynb', 's': '00_scrapers.ipynb', 'browsers': '00_scrapers.ipynb', 'cache_db': '00_scrapers.ipynb', 'RS_URLS': '00_scrapers.ipynb', 'ITEM_FORM': '00_scrapers.ipynb', 'KW_OPTIONS': '00... |
'''HashMap class to keep track of key value pairs'''
class HashMap:
'''HashMap class to keep track of key value pairs'''
def __init__(self):
'''initializes key val pair'''
self.inner_size = 7
self.array = [None] * self.inner_size
self.count = 0
def get(self, key):
''... | """HashMap class to keep track of key value pairs"""
class Hashmap:
"""HashMap class to keep track of key value pairs"""
def __init__(self):
"""initializes key val pair"""
self.inner_size = 7
self.array = [None] * self.inner_size
self.count = 0
def get(self, key):
... |
def split_and_join(line):
# write your code here
line_splitted = line.split(' ')
return ('-').join(line_splitted)
# Or in one line:
# return ('-').join(line.split(' ')
| def split_and_join(line):
line_splitted = line.split(' ')
return '-'.join(line_splitted) |
""" Unit Test """
def main():
""" Main function """
root = "coco_dataset/train2017"
ann_file = "coco_dataset/annotations/captions_train2017.json"
dataset = Dataset(root, ann_file)
dataloader = DataLoader(dataset, batch_size=10, collate_fn=collate_fn)
vocab_size = dataset.tokenizer.vocab_size
... | """ Unit Test """
def main():
""" Main function """
root = 'coco_dataset/train2017'
ann_file = 'coco_dataset/annotations/captions_train2017.json'
dataset = dataset(root, ann_file)
dataloader = data_loader(dataset, batch_size=10, collate_fn=collate_fn)
vocab_size = dataset.tokenizer.vocab_size
... |
def multiplication(a, b):
a = float(a)
b = float(b)
value = a * b
return value | def multiplication(a, b):
a = float(a)
b = float(b)
value = a * b
return value |
level = 3
name = 'Pamengpeuk'
capital = 'Sukasari'
area = 14.62
| level = 3
name = 'Pamengpeuk'
capital = 'Sukasari'
area = 14.62 |
def get_repo_path(path):
path = path.replace('\\\\', '/').replace('\\', '/')
url_array = path.split("/")
del url_array[len(url_array) - 1]
repo_path = ""
for word in url_array:
if word != url_array[len(url_array) - 1]:
repo_path += word + "/"
return repo_path + url_array[len(... | def get_repo_path(path):
path = path.replace('\\\\', '/').replace('\\', '/')
url_array = path.split('/')
del url_array[len(url_array) - 1]
repo_path = ''
for word in url_array:
if word != url_array[len(url_array) - 1]:
repo_path += word + '/'
return repo_path + url_array[len(... |
"""
Problem Statement
Given an integer array, find and return all the subsets of the array.
The order of subsets in the output array is not important.
However the order of elements in a particular subset should remain the same as in the input array.
Note:
An empty set will be represented by an empty list.
If there are... | """
Problem Statement
Given an integer array, find and return all the subsets of the array.
The order of subsets in the output array is not important.
However the order of elements in a particular subset should remain the same as in the input array.
Note:
An empty set will be represented by an empty list.
If there are... |
class Solution:
def generateTrees(self, n: int) -> List[TreeNode]:
if n == 0:
return []
def generateTrees(mini: int, maxi: int) -> List[Optional[int]]:
if mini > maxi:
return [None]
ans = []
for i in range(mini, maxi + 1):
for left in generateTrees(mini, i - 1):
... | class Solution:
def generate_trees(self, n: int) -> List[TreeNode]:
if n == 0:
return []
def generate_trees(mini: int, maxi: int) -> List[Optional[int]]:
if mini > maxi:
return [None]
ans = []
for i in range(mini, maxi + 1):
... |
input = """
up(L,0) | -up(L,0) :- latch(L).
latch(a).
latch(b).
latch(c).
"""
output = """
up(L,0) | -up(L,0) :- latch(L).
latch(a).
latch(b).
latch(c).
"""
| input = '\nup(L,0) | -up(L,0) :- latch(L).\n\nlatch(a).\nlatch(b).\nlatch(c).\n'
output = '\nup(L,0) | -up(L,0) :- latch(L).\n\nlatch(a).\nlatch(b).\nlatch(c).\n' |
def taskA(data):
difference = ord('a') - ord('A')
stack = []
for c in data:
if len(stack) == 0:
stack.append(c)
elif c != stack[-1] and (ord(c)+difference == ord(stack[-1]) or ord(c) == ord(stack[-1]) + difference):
stack.pop()
else:
stack.appen... | def task_a(data):
difference = ord('a') - ord('A')
stack = []
for c in data:
if len(stack) == 0:
stack.append(c)
elif c != stack[-1] and (ord(c) + difference == ord(stack[-1]) or ord(c) == ord(stack[-1]) + difference):
stack.pop()
else:
stack.appen... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def rightSideView(self, root: TreeNode) -> List[int]:
res = []
if not root:
return res
level... | class Solution:
def right_side_view(self, root: TreeNode) -> List[int]:
res = []
if not root:
return res
level_node = [root]
while levelNode:
res.append(levelNode[-1].val)
level_node_num = len(levelNode)
for i in range(levelNodeNum):
... |
print(True)
print(False, "\n\n") #booleans have to be capitalized or they return false
a =3
b =5
print(a==b) #a is equal to b equal False
print(a!=b) #a is not equal to b equal True
print(a<b) #less than
print(a>b, "\n") #greater than
print(bool(28))
print(bool(-2.1562))
print(bool(0), "\n")
#with strings, trivial ... | print(True)
print(False, '\n\n')
a = 3
b = 5
print(a == b)
print(a != b)
print(a < b)
print(a > b, '\n')
print(bool(28))
print(bool(-2.1562))
print(bool(0), '\n')
print(bool('turing'))
print(bool(' '))
print(bool(''), '\n')
print(str(True))
print(str(False), '\n')
print(int(True))
print(int(False))
print(10 * False) |
#!/usr/bin/env python3
# https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-terminal-in-python
class Terminal:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[... | class Terminal:
header = '\x1b[95m'
okblue = '\x1b[94m'
okgreen = '\x1b[92m'
warning = '\x1b[93m'
fail = '\x1b[91m'
endc = '\x1b[0m'
bold = '\x1b[1m'
underline = '\x1b[4m'
@staticmethod
def warning(message):
print(Terminal.WARNING + message + Terminal.ENDC)
@staticm... |
A = [[2, 5, 11],
[-9, 4, 6],
[4, 7, 12]]
soma=0
for linha in range(len(A)): # linhas
for coluna in range(len(A[0])): #colunas
#soma+=A[linha][coluna]
soma = soma + A[linha][coluna]
print ("Soma:", soma) | a = [[2, 5, 11], [-9, 4, 6], [4, 7, 12]]
soma = 0
for linha in range(len(A)):
for coluna in range(len(A[0])):
soma = soma + A[linha][coluna]
print('Soma:', soma) |
class PostprocessingPattern:
def __init__(self, condition, success_value=True, condition_args=None):
"""A PostprocessingPattern defines a single condition to check against an entity.
condition (function): A function to call on an entity. If the result of
the function call equals success... | class Postprocessingpattern:
def __init__(self, condition, success_value=True, condition_args=None):
"""A PostprocessingPattern defines a single condition to check against an entity.
condition (function): A function to call on an entity. If the result of
the function call equals success... |
service_broadcast_settings_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Set a services broadcast settings",
"type": "object",
"title": "Set a services broadcast settings",
"properties": {
"broadcast_channel": {"enum": ["operator", "test", "severe", "govern... | service_broadcast_settings_schema = {'$schema': 'http://json-schema.org/draft-04/schema#', 'description': 'Set a services broadcast settings', 'type': 'object', 'title': 'Set a services broadcast settings', 'properties': {'broadcast_channel': {'enum': ['operator', 'test', 'severe', 'government']}, 'service_mode': {'enu... |
sims_pre = []
with open('lpips_sim_waymo.txt') as f:
data = f.read()
sims_pre = data.split('(')[1:]
sims_post = []
for sim in sims_pre:
sim = sim.split('): ')
img1 = sim[0].split(', ')[0]
img2 = sim[0].split(', ')[1]
val = sim[1]
sims_post.append(img1+','+img2+','+val)
with open('lpip... | sims_pre = []
with open('lpips_sim_waymo.txt') as f:
data = f.read()
sims_pre = data.split('(')[1:]
sims_post = []
for sim in sims_pre:
sim = sim.split('): ')
img1 = sim[0].split(', ')[0]
img2 = sim[0].split(', ')[1]
val = sim[1]
sims_post.append(img1 + ',' + img2 + ',' + val)
with open('lpi... |
class Solution:
# @param head, a ListNode
# @return a boolean
def hasCycle(self, head):
if head == None or head.next == None:
return False
slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if slow == fa... | class Solution:
def has_cycle(self, head):
if head == None or head.next == None:
return False
slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if slow == fast:
return True
return False |
LIGHT = "#"
DARK = "."
iterations = 50
padding = iterations * 2
with open('day20/input.txt') as f:
lines = f.readlines()
map = lines[0].strip()
lines.pop(0)
lines.pop(0)
image = []
h = len(lines)
w = len(lines[0].strip())
def blank():
q = []
for i in range(2 * padding + h):
qq = []
... | light = '#'
dark = '.'
iterations = 50
padding = iterations * 2
with open('day20/input.txt') as f:
lines = f.readlines()
map = lines[0].strip()
lines.pop(0)
lines.pop(0)
image = []
h = len(lines)
w = len(lines[0].strip())
def blank():
q = []
for i in range(2 * padding + h):
qq = []
... |
print('Hello World')
def circum(r):
""" a docstring for circum but also not... """
return 2*3.14*r
def area(r):
"""een conflicterende docstring MIJN CODE IS BELANGRIJKER"""
return 3.14*r**2
print('Lets kill this code')
| print('Hello World')
def circum(r):
""" a docstring for circum but also not... """
return 2 * 3.14 * r
def area(r):
"""een conflicterende docstring MIJN CODE IS BELANGRIJKER"""
return 3.14 * r ** 2
print('Lets kill this code') |
def proteins(strand):
seq = []
codon_map = {
"AUG": "Methionine",
"UUU": "Phenylalanine",
"UUC": "Phenylalanine",
"UUA": "Leucine",
"UUG": "Leucine",
"UCU": "Serine",
"UCC": "Serine",
"UCA": "Serine",
"UCG": "Serine",
"UAU": "Tyrosi... | def proteins(strand):
seq = []
codon_map = {'AUG': 'Methionine', 'UUU': 'Phenylalanine', 'UUC': 'Phenylalanine', 'UUA': 'Leucine', 'UUG': 'Leucine', 'UCU': 'Serine', 'UCC': 'Serine', 'UCA': 'Serine', 'UCG': 'Serine', 'UAU': 'Tyrosine', 'UAC': 'Tyrosine', 'UGU': 'Cysteine', 'UGC': 'Cysteine', 'UGG': 'Tryptophan'... |
s=input()
d={}
if s in d:
print(s+str(d[s]))
d[s] += 1 | s = input()
d = {}
if s in d:
print(s + str(d[s]))
d[s] += 1 |
# This problem was recently asked by Twitter:
# Given a Roman numeral, find the corresponding decimal value. Inputs will be between 1 and 3999.
# Numbers are strings of these symbols in descending order. In some cases, subtractive notation is used to avoid repeated characters.
# The rules are as follows:
# 1.) I place... | class Solution:
def value(self, r):
if r == 'I':
return 1
if r == 'V':
return 5
if r == 'X':
return 10
if r == 'L':
return 50
if r == 'C':
return 100
if r == 'D':
return 500
if r == 'M':
... |
class Relationship(object):
"""Class to represent an relationship between tables
See Also:
:class:`.TableSet`, :class:`.Table`, :class:`.Column`
"""
def __init__(self, parent_column, child_column):
""" Create a relationship
Args:
parent_column (:class:`.Discrete`):... | class Relationship(object):
"""Class to represent an relationship between tables
See Also:
:class:`.TableSet`, :class:`.Table`, :class:`.Column`
"""
def __init__(self, parent_column, child_column):
""" Create a relationship
Args:
parent_column (:class:`.Discrete`):... |
class Solution:
def findDuplicate(self, paths):
"""
:type paths: List[str]
:rtype: List[List[str]]
"""
ans = collections.defaultdict(list)
for path in paths:
dir_path, *files = path.split()
dir_path += '/'
for file in files:
... | class Solution:
def find_duplicate(self, paths):
"""
:type paths: List[str]
:rtype: List[List[str]]
"""
ans = collections.defaultdict(list)
for path in paths:
(dir_path, *files) = path.split()
dir_path += '/'
for file in files:
... |
class NoComponentForEntityError(Exception):
"""Exception raised when an Entity does not have this Component"""
def __init__(self, entity, component_type):
super().__init__("{entity} has no {component_type}".format(
entity=entity, component_type=component_type))
class NotAComponentError(E... | class Nocomponentforentityerror(Exception):
"""Exception raised when an Entity does not have this Component"""
def __init__(self, entity, component_type):
super().__init__('{entity} has no {component_type}'.format(entity=entity, component_type=component_type))
class Notacomponenterror(Exception):
... |
class Pizza:
name = "Unknown"
def __init__(self) -> None:
pass
def __str__(self) -> str:
return f"{self.name} Pizza"
class NormalPizza(Pizza):
def __init__(self) -> None:
super().__init__()
self.name = "Normal"
class CheesePizza(Pizza):
def __init__(self) -> Non... | class Pizza:
name = 'Unknown'
def __init__(self) -> None:
pass
def __str__(self) -> str:
return f'{self.name} Pizza'
class Normalpizza(Pizza):
def __init__(self) -> None:
super().__init__()
self.name = 'Normal'
class Cheesepizza(Pizza):
def __init__(self) -> Non... |
# -*- coding: UTF-8 -*-
logger.info("Loading 1 objects to table cal_calendar...")
# fields: id, name, description, color
loader.save(create_cal_calendar(1,['General', 'Allgemein', 'G\xe9n\xe9ral'],u'',1))
loader.flush_deferred_objects()
| logger.info('Loading 1 objects to table cal_calendar...')
loader.save(create_cal_calendar(1, ['General', 'Allgemein', 'Général'], u'', 1))
loader.flush_deferred_objects() |
class Solution:
def isValid(self, s: str) -> bool:
pairs = {'(': ')', '[': ']', '{': '}'}
stack = []
for p in s:
if p in pairs:
stack.append(p)
else:
if not stack or p != pairs[stack.pop()]:
return False
re... | class Solution:
def is_valid(self, s: str) -> bool:
pairs = {'(': ')', '[': ']', '{': '}'}
stack = []
for p in s:
if p in pairs:
stack.append(p)
elif not stack or p != pairs[stack.pop()]:
return False
return stack == [] |
"""Apschedular config file."""
class Config(object):
"""Schedular config."""
JOBS = [
{
'id': 'cronjob',
'func': 'app:cron_job',
'trigger': 'cron',
'minute': '*/30',
}
]
SCHEDULER_TIMEZONE = 'UTC'
SCHEDULER_API_ENABLED = True
| """Apschedular config file."""
class Config(object):
"""Schedular config."""
jobs = [{'id': 'cronjob', 'func': 'app:cron_job', 'trigger': 'cron', 'minute': '*/30'}]
scheduler_timezone = 'UTC'
scheduler_api_enabled = True |
# :information_source: Already implemented via statistics.mean. statistics.mean takes an array as an argument whereas this function takes variadic arguments.
# Returns the average of two or more numbers.
#Takes the sum of all the args and divides it by len(args). The second argument 0.0 in sum is to handle floating p... | def average(*args):
return sum(args, 0.0) / len(args) |
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class AttributeError(Error):
"""Exception raised when the arguments of GeoCAT-comp functions argument
has a mismatch of attributes with other arguments."""
pass
class ChunkError(Error):
"""Exception raised when a Da... | class Error(Exception):
"""Base class for exceptions in this module."""
pass
class Attributeerror(Error):
"""Exception raised when the arguments of GeoCAT-comp functions argument
has a mismatch of attributes with other arguments."""
pass
class Chunkerror(Error):
"""Exception raised when a Dask... |
vl=input().split()
A=int(vl[0])
B=int(vl[1])
if A==B:
print("Nao sao Multiplos")
elif A%B==0 or B%A==0:
print("Sao Multiplos")
else:
print("Nao sao Multiplos")
| vl = input().split()
a = int(vl[0])
b = int(vl[1])
if A == B:
print('Nao sao Multiplos')
elif A % B == 0 or B % A == 0:
print('Sao Multiplos')
else:
print('Nao sao Multiplos') |
configs = {
'debug': True,
'db': {
'host': '127.0.0.1',
'port': 3306,
'user': 'www',
'password': 'www',
'db': 'router_scan'
},
'session': {
'secret': 'RouterScan'
}
} | configs = {'debug': True, 'db': {'host': '127.0.0.1', 'port': 3306, 'user': 'www', 'password': 'www', 'db': 'router_scan'}, 'session': {'secret': 'RouterScan'}} |
def print_formatted(number):
l = len(str(bin(number)[2:]))
for i in range(1,number+1):
print(str(i).rjust(l) + ' ' + oct(i)[2:].rjust(l) + ' '
+ hex(i)[2:].upper().rjust(l) + ' ' + bin(i)[2:].rjust(l))
| def print_formatted(number):
l = len(str(bin(number)[2:]))
for i in range(1, number + 1):
print(str(i).rjust(l) + ' ' + oct(i)[2:].rjust(l) + ' ' + hex(i)[2:].upper().rjust(l) + ' ' + bin(i)[2:].rjust(l)) |
# -*- coding: utf-8 -*-
class Main:
LIST_OF_IDS = []
RANDOM_MUSIC_LIST = []
SONG_TIME_NOW = "00:00"
LIST_OF_PLAY = {"classes": []}
PLAYER_SETTINGS = {"play": 0, "cycle": False, "random_song": False}
PAST_SONG = {"class": None, "song_id": None, "past_lib": None, "lib_now": None}
S... | class Main:
list_of_ids = []
random_music_list = []
song_time_now = '00:00'
list_of_play = {'classes': []}
player_settings = {'play': 0, 'cycle': False, 'random_song': False}
past_song = {'class': None, 'song_id': None, 'past_lib': None, 'lib_now': None}
song_play_now = {'name': '', 'author'... |
#this file provides a list of file names for mini examples
miniExamplesFileList = ['ObjectMassPoint.py',
'ObjectMassPoint2D.py',
'ObjectMass1D.py',
'ObjectRotationalMass1D.py',
'ObjectRigidBody2D.py',
'ObjectGenericODE2.py',
'ObjectConnectorSpringDamper.py',
'ObjectConnectorCartesianSpringDamper.py',
'ObjectConnectorC... | mini_examples_file_list = ['ObjectMassPoint.py', 'ObjectMassPoint2D.py', 'ObjectMass1D.py', 'ObjectRotationalMass1D.py', 'ObjectRigidBody2D.py', 'ObjectGenericODE2.py', 'ObjectConnectorSpringDamper.py', 'ObjectConnectorCartesianSpringDamper.py', 'ObjectConnectorCoordinateSpringDamper.py', 'ObjectConnectorDistance.py', ... |
pkgname = "qrencode"
pkgver = "4.1.1"
pkgrel = 0
build_style = "gnu_configure"
configure_args = ["--with-tests"]
hostmakedepends = ["pkgconf"]
makedepends = ["libpng-devel"]
pkgdesc = "Library for encoding QR codes"
maintainer = "q66 <q66@chimera-linux.org>"
license = "LGPL-2.1-or-later"
url = "https://fukuchi.org/work... | pkgname = 'qrencode'
pkgver = '4.1.1'
pkgrel = 0
build_style = 'gnu_configure'
configure_args = ['--with-tests']
hostmakedepends = ['pkgconf']
makedepends = ['libpng-devel']
pkgdesc = 'Library for encoding QR codes'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'LGPL-2.1-or-later'
url = 'https://fukuchi.org/work... |
#
# PySNMP MIB module CISCO-NS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-NS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:37:23 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,... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) ... |
s = "abacaba"
length = 1
while s[0:length] != s:
length = length + 1
length == 7
| s = 'abacaba'
length = 1
while s[0:length] != s:
length = length + 1
length == 7 |
class GenericMeta(type):
def __getitem__(self, args):
pass
class Generic(object):
__metaclass__ = GenericMeta
| class Genericmeta(type):
def __getitem__(self, args):
pass
class Generic(object):
__metaclass__ = GenericMeta |
"""
This file contains triangle vertex coordinates of a font
called "Dutch-Blunt" (c) 2015 by Abraham Stolk, commit e1b0044a
The font 'Dutch-Blunt' is licensed under the SIL OPEN FONT LICENSE.
See: https://github.com/stolk/dutch-blunt
"""
widths = [
5.0,
0.55555556,
3.0,
3.54,
2.00065051,
5.0,
5.0,
5.0,
5.0,
5.0,
5... | """
This file contains triangle vertex coordinates of a font
called "Dutch-Blunt" (c) 2015 by Abraham Stolk, commit e1b0044a
The font 'Dutch-Blunt' is licensed under the SIL OPEN FONT LICENSE.
See: https://github.com/stolk/dutch-blunt
"""
widths = [5.0, 0.55555556, 3.0, 3.54, 2.00065051, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.