content stringlengths 7 1.05M |
|---|
SEED_LIMIT = 20
MAX_PAGES_PER_SITE = 35
MAX_LOGICAL_DEPTH = 3
MAX_PHYSICAL_DEPTH = 3
TOTAL_MAX_PAGES = 500 |
formdata = {
'deposittype': "",
'dates': {},
'dissertation': {
'degreename': {
'Doctor of Musical Arts (DMA)',
'Doctor of Education (EDD)',
'Doctor of Philosophy (PhD)'
},
'degreetype': {
'dissertation': 'Dissertation',
... |
def txttolist(filename):
"""Takes a txt file and makes a list with each line being an element"""
return [line.split("\n")[0] for line in open(filename, "r")]
def isstrlessthan(string, length):
"""Checks if string is below length"""
return len(string) < length
def errormsg(e):
"""Generates an error... |
# Copyright (c) 2018 Gennadii Donchyts. All rights reserved.
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Contributors:
# * 2018-08-01: Fedor Baart (f.baart@gmail.com) - added cmocean
# * 2019-01-18: Justin Braaten (jstnbraaten@gmail.com) - ... |
class Script(object):
START_MSG = """Hy {}, ഞാൻ മൂവി ഹട്ട് മലയാളത്തിനുവേണ്ടി പണിയെടുക്കുന്ന ഒരു ഫിൽറ്റർ ബോട്ടാണ് എന്നെ നോക്കി നടത്തുന്നത് <a href="https://t.me/THOMAS_MOVIE_HUT">ഇദ്ദേഹമാണ്</a>
"""
HELP_MSG = """
ഈ ബോട്ട് നിങ്ങൾക്ക് help ഒന്നും ചെയ്യില്ല 🤧
"""
ABOUT_MSG ... |
valor = input().split(" ")
a, b, c = valor
maiorAB = ((int(a) + int(b)) + abs(int(a) - int(b)))/2
maiorAC = ((int(a) + int(c)) + abs(int(a) - int(c)))/2
maior = ((maiorAB + maiorAC) + abs(maiorAB - maiorAC))/2
print("%d eh o maior" % maior) |
'''
Dutch National Flag Problem
Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal. You're not allowed to use any sorting function that Python provides.
Note: O(n) does not necessarily mean single-traversal. For e.g. if you traverse the array twice, that would still be an O(n) so... |
"""
Copyright (c) 2020, The Decred developers
See LICENSE for details.
mainnet holds mainnet parameters. Any values should mirror exactly
https://github.com/btcsuite/btcd/blob/master/chaincfg/params.go
"""
Name = "mainnet"
DefaultPort = "8333"
DNSSeeds = [
("seed.bitcoin.sipa.be", True),
("dnsseed.bluematt.me... |
class Solution:
def productExceptSelf(self, nums: list[int]) -> list[int]:
products, it = [1] * len(nums), 1
for i in range(len(nums) - 1, -1, -1):
products[i] = it
it *= nums[i]
it = 1
for i in range(len(products)):
products[i] *= it
i... |
# Misc functions
def CountCombinations(n, m=1):
"""Number of ways to partition a number e.g 1+1+1, 2+1"""
ans = 1
if n <= 1:
return 1
for i in xrange(m, int(ceil(n/2.))):
ans += comb(n-i, i)
return ans
def quicksort(r):
return r if len(r)<2 else qs([i for i in r[1:] if i<r[0... |
#
# PySNMP MIB module APEX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APEX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:23: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, 09:23:1... |
class ResultObject:
def __init__(self, title: str, animeid: str):
self.title = title
self.animeid = animeid
class MediaInfoObject:
def __init__(self,
title: str,
year: int,
other_names: str,
season: str,
status... |
#!/usr/bin/env python3
processors = 0
with open('/proc/cpuinfo') as cpufile:
for line in cpufile:
if line.find('core id') != -1:
processors += 1
print("No. of processors are : %d " %processors)
|
files = {
'amy':{'num_1':5, 'num_2':2},
'bob':{'num_1':6, 'num_2':8},
'candy':{'num_1':9, 'num_2':6},
'doby':{'num_1':1, 'num_2':5},
'john':{'num_1':7, 'num_2':1},
}
for name,num in files.items():
print('\nName: ' + name)
favo_num = num['num_1'] + num['num_2']
print("Numb... |
napis = str(input("Podaj napis:"))
ilosc = 1
for i in napis:
if i == " ":
print()
ilosc = ilosc + 1
else:
print(i, end="")
print()
print("Ilość słów:",ilosc) |
#Faça um programa que leia três números e mostre qual é o maior e qual é o menor
n1 = int(input('Digite um número: '))
n2 = int(input('Digite outro número:'))
n3 = int(input('Digite outro número: '))
#print('O maior número é {}'.format(max(n1, n2, n3)))
#print('O menor número é {}'.format(min(n1, n2, n3)))
if (n1 < n2)... |
"""
Exception Payloads
-> Exceptions can carry payload data.
-> Most exceptions accept a single string in their constructor call.
-> The most common exception you'll likely raise is ValueError.
-> Most exception payloads are strings containing a helpful message.
"""
|
class Solution:
def getLastMoment(self, n: int, left: List[int], right: List[int]) -> int:
left=sorted(left)
right=sorted(right)
answer=0
if len(right)>0:
answer=max(answer, n-right[0])
if len(left)>0:
answer=max(answer, left[-1])
retu... |
# -*- coding: utf-8 -*-
description = 'Sampletable complete'
includes = ['system']
group = 'lowlevel'
devices = dict(
stt_step = device('nicos.devices.generic.VirtualMotor',
unit = 'deg',
abslimits = (-100, 130),
speed = 4,
lowlevel = True,
),
stt_enc = device('nicos.dev... |
#Variables for drop, create, insert, and selection statements
# DROP TABLES
songplay_table_drop = "DROP TABLE IF EXISTS songplays"
user_table_drop = "DROP TABLE IF EXISTS users"
song_table_drop = "DROP TABLE IF EXISTS songs"
artist_table_drop = "DROP TABLE IF EXISTS artists"
time_table_drop = "DROP TABLE IF EXISTS ti... |
"""
0071. Simplify Path
Medium
Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path.
In a Unix-style file system, a period '.' refers to the current directory, a double period '..' refers to the direc... |
# Integers in Python can be as big as the bytes in your machine's memory. There is no limit in size as there is:
# 2^31-1 (c++ int) or 2^63-1 (C++ long long int).
#
# As we know, the result of a^b grows really fast with increasing b.
#
# Let's do some calculations on very large integers.
#
# Task
# Read four numbers, a... |
class Node:
def __init__(self, value, next = None):
self.value = value
self.next = next
class LinkedQ:
def __init__(self):
self.__first = None
self.__last = None
def __str__(self):
end_of_row = ""
while not self.isEmpty():
char = sel... |
{
'targets': [
{
'target_name': 'webaudio',
'sources': [
'main.cpp',
"<!@(node -p \"require('fs').readdirSync('./lib/src').map(f=>'lib/src/'+f).join(' ')\")"
],
'include_dirs': [
"<!(node -e \"require('nan')\")",
'<(module_root_dir)/lib/include',
'<(... |
def isPalind_string(str):
temp = str
if str[::-1] == temp:
return True
else:
return False
|
class Degree:
def __init__(self,
title,
subject,
institution,
year):
self.title = title;
self.subject = subject;
self.institution = institution;
self.year = year;
bs = Degree(title = "B.S.",
subject = ... |
"""
This module just defines the current jaraf version.
"""
VERSION = "0.2.2"
|
# -*- coding: iso-8859-15 -*-
def indicative_present_perfect(root_verb, pronoun):
if pronoun == "yo":
if root_verb[-2:] == "ar":
conjugation = root_verb[:-2] + "ado"
return "he " + conjugation
if root_verb[-2:] == "er" or "ir":
conjugation = root_verb[:-2] + "ido"... |
class Pet:
def __init__(self, name):
self.name = 'unknown'
self._age = 10
def speak(self):
self.bark()
def _reset_age(self):
self._age = 10
class Dog(Pet):
def __init__(self):
Pet.__init__(self,'')
def bark(self):
print ('barking')
def se... |
__author__ = "Gawen Arab, Wes Mason"
__copyright__ = "Copyright 2012, Gawen Arab"
__credits__ = ["Gawen Arab", "Wes Mason"]
__license__ = "Apache License, Version 2.0"
__version__ = "1.0.2"
__maintainer__ = "Gawen Arab"
__email__ = "g@wenarab.com"
__status__ = "Production"
|
# -*- coding: utf-8 -*-
"""Storage time range objects."""
class TimeRange(object):
"""A class that defines a date and time range.
The timestamp are integers containing the number of micro seconds
since January 1, 1970, 00:00:00 UTC.
Attributes:
start_timestamp: integer containing the timestamp that marks... |
sLabNew = {
"cdc": "cdc",
"cnic": "cnic",
"melb": "vidrl",
"vidrl": "vidrl",
"niid": "niid",
"nimr": "crick",
"crick": "crick",
}
sLabOld = {
"cdc": "cdc",
"cnic": "cnic",
"melb": "melb",
"vidrl": "melb",
"niid": "niid",
"nimr": "nimr",
"crick": "nimr",
}... |
# -*- coding: utf-8 -*-
host = "127.0.0.1";
port = 3306;
user = "root";
pwd = "root";
db = "test";
charset = "utf8";
if __name__ == '__main__':
pass;
#end |
"""General utilities"""
class BadRequestError(Exception):
pass
class NotAuthorizedError(Exception):
pass |
# 2020.03.25
# Problem Statement:
# https://leetcode.com/problems/sort-list/
# I hate linked list!
# https://leetcode.com/problems/sort-list/discuss/46714/Java-merge-sort-solution
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.... |
# GYP file to build pdfviewer.
#
# To build on Linux:
# ./gyp_skia pdfviewer.gyp && make pdfviewer
#
{
'includes': [
'apptype_console.gypi',
],
'targets': [
{
'target_name': 'libpdfviewer',
'type': 'static_library',
'sources': [
'../experimental/PdfViewer/SkPdfBasics.cpp',
... |
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`micropython` - MicroPython Specific Decorator Functions
========================================================
* Author(s): cefn
"""
def const(x):
"Emulate making a constant"
return x
def... |
class Utilities:
# Thanks, Wikipedia!
def inverse(self, a, n):
t = 0
r = n
newt = 1
newr = a
while newr != 0:
quot = r / newr
t, newt = newt, t - quot * newt
r, newr = newr, r - quot * newr
if (r > 1):
return "a not... |
# dataset settings
dataset_type = 'ImageNetC'
data_prefix = '/home/sjtu/scratch/zltan/datasets/imagenet-c'
corruption = 'snow'
severity = 5
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='Normalize... |
"""
global application configuration parameters passed to Flask
"""
S3_BUCKET_NAME = 'ankur6ue-dev-ocr-data'
REGION_NAME = 'us-east-1'
ACL = 'private'
LOCAL = 1
LOCAL_BASE_PATH = "/tmp/OCR/"
MYSQL_DBNAME = "jobs" |
description = "neutronguide, leadblock"
group = 'lowlevel'
includes = ['nok_ref', 'zz_absoluts']
instrument_values = configdata('instrument.values')
showcase_values = configdata('cf_showcase.showcase_values')
tango_base = instrument_values['tango_base']
code_base = instrument_values['code_base']
devices = dict(
... |
__author__ = 'Haarm-Pieter Duiker'
__copyright__ = 'Copyright (C) 2016 - Duiker Research Corp'
__license__ = ''
__maintainer__ = 'Haarm-Pieter Duiker'
__email__ = 'support@duikerresearch.org'
__status__ = 'Production'
__major_version__ = '1'
__minor_version__ = '0'
__change_version__ = '0'
__version__ = '.'.join((__ma... |
# Copyright 2016 Google Inc.
#
# 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,... |
n = int(input("Quantos elementos vai ter o verto? "))
vet = [0 for x in range(n)]
for i in range(n):
vet[i] = int(input("Digite um numero: "))
soma = 0
pares = 0
for i in range(n):
if vet[i] % 2 == 0:
soma = soma + vet[i]
pares = pares + 1
if pares == 0:
print("NENHUM NUMERO PAR")
else:... |
"""
Dayliopy module.
This exists to let the linter run.
"""
|
# Script to redirect from long-obsolete URLs to current static-blog ones
redirects = {
"2010/11/From-Baselayout-to-Systemd-setup-on-Exherbo": "2010/11/05/from-baselayout-to-systemd-setup-on-exherbo.html",
"2010/11/Moar-free-time": "2010/11/12/moar-free-time.html",
"2010/12/Commandline-pulseaudio-mixer-tool": "2010/... |
def test_setup_legacy_bus0(gpio, smbus, sn3218):
gpio.RPI_REVISION = 1
sn3218.channel_gamma(0, [int(pow(255, float(i - 1) / 255)) for i in range(256)])
assert smbus.SMBus.called_once_with(0)
sn3218.enable()
def test_setup_legacy_bus1(gpio, smbus, sn3218):
gpio.RPI_REVISION = 3
sn3218.channel_g... |
colors = ['darkred', 'darkmagenta', 'darkolivegreen',
'darkorange',
'darkorchid',
'darkseagreen',
'darksalmon',
'darkslateblue',
'crimson', 'antiquewhite',
'aqua', 'aquamarine', 'azure',
'beige', 'bisque', 'blanchedalmond',
'blue','blueviolet', 'brown',
'burlywood', 'cadetblue', 'chartreuse',
'chocol... |
def del_rep():
n=int(input("Enter the no of elements"))
print("Enter the list elements")
l=[]
for i in range(n):
l.append(input())
print(l)
for i in l:
c=int(l.count(i))
for j in l:
if(i==j) and c >1:
l.remove(j)
c-=1
... |
class Ecosystem:
def __init__(self, deer_0=1.5, wolves_0=1.5, deer_growth=2/3, deer_predation=4/3, wolves_predation=1.0, wolves_decay=1.0, dt=0.0):
self.initialDeer = deer_0
self.initialWolves = wolves_0
self.currentDeer = deer_0
self.currentWolves = wolves_0
self.maxWolves =... |
class Seating:
def __init__(self, layout: str):
self.seats = [list(line) for line in layout.splitlines()]
self.width = len(self.seats[0])
self.height = len(self.seats)
def nr_neigbors(self, row: int, col: int) -> int:
count = 0
for i in range(max(row - 1, 0), min(row+2, ... |
"""Exceptions for Sleepi."""
class SleepiError(Exception):
"""Generic Sleepi exception."""
class SleepiConnectionError(SleepiError):
"""Sleepi connection exception."""
class SleepiGenericError(Exception):
"""Generic Sleepi exception.""" |
string = [1, 2, 'ASD', 4, (1, 2, 3), '1', 'PY']
def get_string_list(lst):
if type(lst) == str:
return True
else:
return False
only_string = filter(get_string_list, string)
print(list(only_string))
|
_base_ = [
'../_base_/models/ocrnet_hr18.py', '../_base_/datasets/cityscapes_bs2x.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_40k_lr2x.py'
]
|
#pylint: disable=bad-continuation,invalid-name,missing-docstring
# Basic test with a list
TEST_LIST1 = ['a' 'b'] # [implicit-str-concat-in-sequence]
# Testing with unicode strings in a tuple, with a comma AFTER concatenation
TEST_LIST2 = (u"a" u"b", u"c") # [implicit-str-concat-in-sequence]
# Testing with raw string... |
# Python allows empty class
class EmptyClass:
pass
# Create an instance of the class
obj_1 = EmptyClass()
# Attrubutes can be added to an object dynamically
obj_1.attribute1 = "The attribute 1"
obj_1.attribute2 = "The attribute 2"
print(obj_1.attribute1 + ' - ' + obj_1.attribute2)
# The __dict__ has all the infor... |
"""
MIT License
Copyright (c) 2019 Sylte
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, distrib... |
# This sample tests type annotations on variables.
array1 = [1, 2, 3]
# This should generate an error because the LHS can't
# have a declared type.
array1[2] = 4 # type: int
dict1 = {}
# This should generate an error because the LHS can't
# have a declared type.
dict1["hello"] = 4 # type: int
def... |
a = 1 # Variable global
b = "global"
def fun():
global b
a = 2 # Variables locales
a += 1
print("En la función a =", a)
print("variable b =", b)
b = " modificado local"
fun()
print("Fuera de la función a =", a)
print("Fuera de la función b =", b)
|
"""
__init__.py
This init script will initialize any needed logic for this package.
This package will control parsing and access to the sqlite master schema files.
"""
|
threePow19 = 1162261467 # 3**19
class Solution:
def isPowerOfThree(self, n: int) -> bool:
return n>0 and not (threePow19 % n)
|
__all__ = ["CLUSTER_ARGS", "EXAMPLE_DIRS", "EXTRA_ARGS"]
################################################################################
# Arguments used on the cluster
# Any set to None are ignored and only used for getting the key names in _update_cluster_args
CLUSTER_ARGS = {
'submit_cluster': None,
'submi... |
expected_output = {
'eigrp_instance': {
'100': {
'vrf': {
'default': {
'address_family': {
'ipv6': {
'name': 'test',
'named_mode': True,
'eigrp_interf... |
"""
Get the difference between a given number and 17,
if the number is greater than 17 return double the absolute difference
"""
number = int(input("please input the number : "))
new_number = 17 - number
print(new_number)
def ashi():
if number > 17:
return (17 - number)*2
print(ashi())
... |
class APIError(Exception):
"""Error raised for non-200 API return codes
Args:
status_code(int): HTTP status code returned by the API
message(str): Potential error message returned by the API
Attributes:
status_code(int): HTTP status code returned by the API
message(str)... |
def ols(y, X):
"""
This is THE BEST ols.
Parameters
----------
y :
N by 1 response vector
X :
N by K covariate matrix
Returns
--------
beta :
OLS coefficients
se :
standard errors of the coefficients
"""
X... |
size=int(input("enter size="))
numbers=[]
for i in range(1,size+1):
a=int(input("enter a="))
numbers.append(a)
count=numbers.count(4)
print(numbers)
print("numbers of 4s in list=",count)
|
"""Constants for the Kuler Sky integration."""
DOMAIN = "kulersky"
DATA_ADDRESSES = "addresses"
DATA_DISCOVERY_SUBSCRIPTION = "discovery_subscription"
|
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# Author: illuz <iilluzen[at]gmail.com>
# File: AC_mod_1.py
# Create Date: 2015-08-17 00:44:30
# Usage: AC_mod_1.py
# Descripton:
class Solution:
# @param {integer} num
# @return {integer}
def addDigits(self, num):
return num % 9... |
"""
Set of Nagios probes for testing LFC grid service.
Contains the following Nagios probe:
LFC-probe.
- The probes can run in active and/or passives modes (in Nagios sense).
Publication of passive test results from inside of probes can be done
via Nagios command file or NSCA.
- On worker nodes Nagios is used as ... |
class Obj:
def __init__(self, filename, swapyz=True, flipy=True):
"""Loads a Wavefront OBJ file. """
self.vertices = []
self.normals = []
self.texcoords = []
self.faces = []
self.plain_vertecies = []
self.plain_normals = []
self.plain_texcoords = []
... |
# An object that will hold the type of current input with its respective value
class Token:
# type_ -> a type of token (from the list in constants)
# value -> the actual value
# pos_start -> Position of start of token (optional)
# pos_end -> Position of end of token (optional)
def __init__(self, typ... |
class Student:
# class initialization method
def __init__(self, name, birthday, courses):
# class public attributes
self.full_name = name
self.first_name = name.split(' ')[0]
self.birthday = birthday
self.courses = courses
self.attendance = []
# class public ... |
class Schedule():
r"""Base class for all schedules.
Your schedules should also subclass this class.
"""
def __init__(self):
pass
def reset(self):
r"""Resets the schedule."""
raise NotImplementedError
def update(self):
r"""Updates the schedule."""
ra... |
PV = int(input('Primeiro valor:'))
SV = int(input('Segundo valor:'))
TV = int(input('Terceiro valor:'))
menor = PV
if SV < PV and SV < TV:
menor = SV
if TV < PV and TV < SV:
menor = TV
maior = PV
if SV > PV and SV > TV:
maior = SV
if TV > PV and TV > SV:
maior = TV
print(f'O menor valor digitado foi {m... |
a=int(input("Enter a number "))
while(a>0):
print(a)
a=a-1
|
conf_file = open("./online_exam_bot.config","r")
lines = conf_file.readlines()
data = []
conf = {}
i = 0
for line in lines:
if i <= 10:
extracted = line.split("'")
data.append(extracted)
if i != 5:
conf[data[i][1]] = data[i][3]
else:
pass
i += 1
|
#Comparado números
#Escreva um programa que leia dois numeros inteiros e compare - os mostrando na tela uma mensagem:
#Oprimeiro valor é maior
#O Segundo valor e maior
#Não existe valor maior, os dois são iguais
n1 = int(input('\033[1;34mPrimeiro número:\033[m'))
n2 = int(input('\033[1;33mSegundo número:\033[m'))
if n1... |
base_number = 10
digit_grouping = 3
negative_word = 'minus'
default_separator = ''
default_ordering = 'hst'
unit_names = [
'null',
'eins',
'zwei',
'drei',
'vier',
'fünf',
'sechs',
'sieben',
'acht',
'neun',
]
suffixes = [
['zig', 'hundert'],
'tausend... |
def CloseGump(serial: int):
"""
Close a specified gump serial
:param serial: An entity serial such as 0xf00ff00f.
"""
pass
def ConfirmPrompt(str9: str, bool4: bool):
"""
Displays an ingame prompt with the specified message, returns True if Okay was pressed, False if not.
:param str9: ... |
class ServerConfig:
port = 8888
notifications = {
"max_volume": 0.05,
}
do_not_disturb = {
"begin": [19, 30],
"end": [7, 30]
}
audio_file = "DBSE.ogg"
cookie_secret = None
password_hash = None
def __init__(self, *,
debug, cookie_secret, pass... |
def encryptRailFence(text, key):
rail = [['\n' for i in range(len(text))]
for j in range(key)]
dir_down = False
row, col = 0, 0
for i in range(len(text)):
if (row == 0) or (row == key - 1):
dir_down = not dir_down
rail[row][col] = text[i]
c... |
# Не используя библиотеки для парсинга, распарсить
# (получить определённые данные) файл логов web-сервера
# nginx_logs.txt
# — получить список кортежей вида:
# (<remote_addr>, <request_type>, <requested_resource>).
# Например:
# [
# ...
# ('141.138.90.60', 'GET', '/downloads/product_2'),
# ('141.138.9... |
valores = list()
for cont in range(0, 5):
valores.append(str(input('Procure o seu Alvo ')))
for c, v in enumerate(valores):
print(f'\033[32mNa posicao {c} encontrei {v}\033[m')
if valores[c] == 'netcha':
print(f'\033[36mSucesso. Encontrei o alvo na posisao {c}\033[m')
break
else:
print('\033[31mSEM SUCES... |
def func():
print("Hello")
def func2():
print("world")
l = [1,2,3,func, lambda x: x+1]
print(l)
print(l[3]())
print(l[4](2))
l2 = [func, func2]
for i in l2:
i() |
def time_to_text(time, maximal = 1):
days = ((time/60)/60)//24
hours = (time/60)//60 - days*24
minuts = time//60 - (days*24 + hours)*60
secunds = time//1 - ((days*24 + hours)*60 + minuts)*60
ret = ''
if days != 0 and maximal <= 4:
if days == 1:
ret += 'day '
else:
... |
# see http://python4astronomers.github.com/contest/bounce.html
figure(1)
clf()
axis([-10, 10, -10, 10])
# Define properties of the "bouncing balls"
n = 10
pos = (20 * random_sample(n*2) - 10).reshape(n, 2)
vel = (0.3 * normal(size=n*2)).reshape(n, 2)
sizes = 100 * random_sample(n) + 100
# Colors where each row is (Re... |
# Employee class
class Employee:
"""A sample employee class"""
raise_amt = 1.05
def __init__(self, first, last, pay):
"""Initialize employee class"""
self.first = first
self.last = last
self.pay = pay
#@property
def email(self):
"""Return employee emai... |
#
# PySNMP MIB module TIARA-NETWORKS-CONFIG-MGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIARA-NETWORKS-CONFIG-MGMT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:16:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... |
# -*- coding: utf-8 -*-
# 16/12/15
# create by: snower
FORMATER = "watoee.formaters.formater.Formater"
SERIALIZE = "watoee.serializes.jsonserialize.JsonSerialize" |
"""
Good morning! Here's your coding interview problem for today.
This problem was asked by Uber.
Given a binary tree and an integer k, return whether there exists a root-to-leaf path that sums up to k.
For example, given k = 18 and the following binary tree:
8
/ \
4 13
/ \ \
2 6 19
Return True s... |
def deci_func_logger(_func=None, *, name: str = 'abstract_decorator'):
"""
This decorator is used to wrap our functions with logs.
It will log every enter and exit of the functon with the equivalent parameters as extras.
It will also log exceptions that raises in the function.
It will also log the e... |
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2017, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... |
#Get the number at a specified row and column in Pascal's triangle
def getNumber(row, column):
if (column == 0) or (row == 0) or (column == row):
return 1
else:
return getNumber(row - 1, column - 1) + getNumber(row - 1, column)
if __name__ == "__main__":
row = int(input())
col = int(i... |
class Today:
def __init__(self, cases, deaths, recoveries):
self.cases = cases
self.deaths = deaths
self.recoveries = recoveries
class PerMillion:
def __init__(self, cases, deaths, tests, active, recoveries, critical):
self.cases = cases
self.deaths = deaths
sel... |
# @Title: 数组中数字出现的次数 (数组中数字出现的次数 LCOF)
# @Author: 18015528893
# @Date: 2021-01-27 22:13:09
# @Runtime: 60 ms
# @Memory: 15.6 MB
class Solution:
def singleNumbers(self, nums: List[int]) -> List[int]:
x, y, n, m = 0, 0, 0, 1
for num in nums:
n ^= num
while n & m == 0:
... |
CHARMAP = [bytes([x]) for x in b'BCDFGHJKMPQRTVWXY2346789']
def b24encode(data):
enc = b''
for c in data:
enc += CHARMAP[c >> 4]
enc += CHARMAP[-(c & 0x0f) - 1]
return enc
def b24decode(data):
dec = b''
hi = -1
for c in data:
if hi < 0:
hi = CH... |
amd = [
{
"Codename": "Tahiti",
"IDs": [
{ "Vendor": "0x1002", "Device": "0x6780" },
{ "Vendor": "0x1002", "Device": "0x6784" },
{ "Vendor": "0x1002", "Device": "0x6788" },
{ "Vendor": "0x1002", "Device": "0x678a" },
{ "Vendor": "0x1002", "Device": "0x6790" },
{ "Vendor": "... |
# %%
#######################################
def scapypayload_joinall(packet_list: scapy.plist.PacketList):
allpayloads_onestring = b''.join([ p.load for p in packet_list if p.haslayer(Raw) ])
return allpayloads_onestring
|
class tile:
def __init__(self) -> None:
self.owner = None
self.population = None
class board:
def __init__(self,size) -> None:
self.size = size
class game:
def __init__(self,players) -> None:
self.players = players
self.playercount = len(players)
def newGame(se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.