content stringlengths 7 1.05M |
|---|
#-*- coding:utf-8 -*-
class ParseException(Exception):
pass
class ThroughLoop(Exception):
pass
|
class LogManager:
def __init__():
pass
def getLogger(loggerName):
logger = log.setup_custom_logger(loggerName)
logger = logging.getLogger('root')
|
# Copyright (c) 2019 Cable Television Laboratories, 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 ... |
#
# See ../LICENSE
#
# This file is used to form a consistent base used by the specific field implementations.
# It was intended to, implementation might differ.
#
#
class Record:
def __init__(self, henk):
self.fields = {}
self.origin = 0 #in file location
self.raw_length = 0
sel... |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
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, p... |
'''
https://www.geeksforgeeks.org/calculate-square-of-a-number-without-using-and-pow/
Calculate square of a number without using *, / and pow()
Difficulty Level : Medium
Last Updated : 23 Feb, 2021
Geek Week
Given an integer n, calculate the square of a number without using *, / and pow().
Examples :
Input: n = 5
O... |
# DESAFIO 084
# Faça um programa que leia o nome e peso de várias pessoas, guardando tudo em uma lista. No final, mostre:
# A) Quantas pessoas foram cadastradas. B) Uma listagem com as pessoas mais pesadas. C) uma listagem
# com as pessoas mais leves.
info = []
coleta = []
peso = []
nome = []
while True:
coleta.ap... |
class Solution:
"""
@param s: a string
@return: it's index
@ Time: O(n) Space: O(n)
@ Use dict{},先将所有字符扫一遍,保存出现过的字符,然后再扫一遍,遇到第一个出现一次的字符就是答案。
"""
def firstUniqChar(self, s):
if not s:
return -1
dic = {}
for ch in s:
if ch not in dic:
... |
'''
* Estrutura Try Except
* Repositório: Lógica de Programação e Algoritmos em Python
* GitHub: @michelelozada
1 - Escreva um algoritmo que leia um número. Este número informado pelo usuário deve necessariamente estar compreendido
no intervalo de 1 a 50 (ambos inclusos). Além disso, você deve usar um tratament... |
"""
Function for evaluate OVAL operators.
"""
def oval_operator_and(result):
"""
The AND operator produces a true result if every argument is true. If one or more arguments
are false, the result of the AND is false. If one or more of the arguments are unknown, and
if none of the argume... |
#!/usr/bin/python
"""
@file callback_interface.py
@author Woong Gyu La a.k.a Chris. <juhgiyo@gmail.com>
<http://github.com/juhgiyo/pyserver>
@date March 10, 2016
@brief Callback Interfaces
@version 0.1
@section LICENSE
The MIT License (MIT)
Copyright (c) 2016 Woong Gyu La <juhgiyo@gmail.com>
Permission is h... |
if foo():
qu = 1
else:
qu = 2
y = qu
|
# -*- coding: utf-8 -*-
# write.text.test.py
with open("hello.txt", "w") as file:
file.write("hello world")
with open("hello.txt", "a") as file:
file.write("\ngood bye, world")
|
######################################################
## Global settings
class Config:
AMQP_HOST = 'localhost'
|
expected_output = {
'vrf': {
'default': {
'address': {
'10.4.1.1': {
'type': 'server'}
}
},
'management': {
'address': {
'10.4.1.1': {
'type': 'server'}
}
}
}... |
def makeAnagram(a, b):
countA = [0] * 26
countB = [0] * 26
index = 0
while index<len(a):
countA[ord(a[index]) - 97]+=1
index+=1
index = 0
while index<len(b):
countB[ord(b[index]) - 97]+=1
index+=1
res = 0
for i in range(len(countA)):
res += abs(countA[i] - countB[i])
return res
if __name__ == ... |
"""
constant
"""
# coding: UTF-8
NONE_STR = "---"
REGRESSION_MODELS = { # https://pycaret.readthedocs.io/en/latest/api/regression.html#pycaret.regression.create_model
"Linear Regression": "lr",
"Lasso Regression": "lasso",
"Ridge Regression": "ridge",
"Elastic Net": "en",
"Least Angle... |
'''
Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
For example,
Given the following matrix:
[
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
[
[ 1, 2, 3 , 4],
[ 5, 6, 7, 8],
[ 9, 10, 11, 12],
[13, 14, 15, 16]
]
You should return [1,2,3,6,9,8,7... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def maxPathSum(self, root: TreeNode) -> int:
self.ans = float(-inf)
def search(root):
... |
var1 = 2
var2 = '''hello
this is raj
i am dying'''
for num in range(0,3):
file = open(f"orders/file{num}.txt",'w')
file.write(f"hello x{num}"+'\n'+str(var1)+'\n'+var2)
file.close |
class FlockMessage:
__slots__ = ("type", "body")
# Acceptable types for a shepherd/sheep to send or sheep/shepherd to
# receive.
shepherd_types = ("bloot", "identify", "request")
sheep_types = ("bleet", "environment", "distress", "result")
def __init__(self, type, body):
self.type = ty... |
# link : https://www.codewars.com/kata/5390bac347d09b7da40006f6
def to_jaden_case(string):
new_string = ''
last_c = ' '
for c in string:
new_string += c.upper() if last_c == ' ' else c
last_c = c
return new_string
print(to_jaden_case("how can mirrors be real if our eyes aren't... |
#stripe patterns to follow
#ideal 400x400
pattern_one = [2,1,2,1,4,2,2,1,4,2,4,2,1,2,1,4,2,4,2,2,4,2,4,2,4,3,4,2,4,2,1,4,3,2]
pattern_one_width=[4,2,4,2,10,4,4,2,10,4,10,4,2,4,2,10,4,10,4,4,10,4,10,4,10,5,10,4,10,4,2,10,5,2]
pattern_two_width = [30, 30, 30, 30, 30] #5x30 + 2x30black #originalstyle
|
'''
from sys import *
q = int(stdin.readline())
while q:
q = q - 1
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
Hash = [0] * (n+1)
for i in a:
Hash[i] += 1
Hash.sort(reverse=True)
res = 0
now = int(1e9)
for i in Hash:
now = max(min(now-1, i),... |
def dtlayout(i, p, *rows): i["Layouts/SiStrip Layouts/" + p] = DQMItem(layout=rows)
dtlayout(dqmitems, "SiStrip_Digi_Summary",
["SiStrip/MechanicalView/TIB/Summary_NumberOfDigis_in_TIB"],
["SiStrip/MechanicalView/TOB/Summary_NumberOfDigis_in_TOB"],
["SiStrip/MechanicalView/TID/MINUS/Summary_NumberOfDigis_in_MINU... |
"""
Windows 2000 - List of Locale IDs and Language Groups
Original data table:
http://www.microsoft.com/globaldev/reference/win2k/setup/lcid.mspx
"""
LANGUAGE_ID = {
0x0436: u"Afrikaans",
0x041c: u"Albanian",
0x0401: u"Arabic Saudi Arabia",
0x0801: u"Arabic Iraq",
0x0c01: u"Arabic Egypt",
0x10... |
# python3
# https://www.cnblogs.com/zl1991/p/11820922.html
__all__ = [
"str_2_id"
]
# BKDRHash
# APHash
# BKDR Hash Function
# input string
# outpu uint32
def bkdr_hash(s):
seed = 131 # 31 131 1313 13131 131313 etc..
h = 0
for c in s:
h = h * seed + ord(c)
h = h & 0xffffffff
re... |
def sum7(n):
nums = list(range(1, n + 1))
return sum(nums)
N = int(input("숫자를 입력하세요"))
S = sum7(N)
print(S)
|
def make_bezier(xys):
# xys should be a sequence of 2-tuples (Bezier control points)
n = len(xys)
combinations = pascal_row(n-1)
def bezier(ts):
# This uses the generalized formula for bezier curves
# http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Generalization
result = []
... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... |
STD_ABBRVS = {
"jstak": "jostakin",
"jssak": "jossakin",
"jnak": "jonakin",
"jtak": "jotakin",
"jllak": "jollakin",
"jltak": "joltakin",
"jksta": "jostakusta",
"jllek": "jollekin",
"jkssa": "jossakussa",
"jkta": "jotakuta",
"jklla": "jollakulla",
"jklta": "joltakulta",
... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 18 12:22:28 2020
@author: aantao
"""
##0,1,1,2,3,5,8
##n = n-1 + n-2
def fibo_range(n = 10):
fibo_list = [0,1]
for i in range(2,n):
fibo_list.append(fibo_list[i-1]+fibo_list[i-2])
return(fibo_list,fibo_list[n-1])
#Why n-1 and not n in fi... |
STATS = [
{
"num_node_expansions": 159,
"plan_cost": 66,
"plan_length": 66,
"search_time": 0.89,
"total_time": 2.1
},
{
"num_node_expansions": 219,
"plan_cost": 67,
"plan_length": 67,
"search_time": 1.47,
"total_time": 2.1
}... |
#!/usr/bin/env python3
# añadir tantos pares item, url como sea necesarias
# item = elemento a buscar
# url = ulr donde encontrar la información
urls_dict = {}
urls_dict["contacto"]="https://sanvicentedelpalacio.ayuntamientosdevalladolid.es/contacto"
|
# Amazon interiew Question
def pascal_triangle(M):
a =[[] for i in range(M)]
for i in range(M):
for j in range(i+1):
if(j<i):
if(j==0):
a[i].append(1)
else:
a[i].append(a[i-1][j] + a[i-1][j-1])
... |
# Escreva um programa que receba um número e faça a tabuada de 0 a 10 do mesmo.
mult = 0
num = int(input('Digite um numero: '))
while (mult <= 10):
print('{} x {} = {}'.format(num, mult, mult*num))
mult = mult + 1 |
# https://leetcode.com/problems/add-two-numbers/
# Related Topics: Linked List, Math
# Difficulty: Easy
# Initial thoughts:
# Creating a new linked list, we need to loop over the given
# linked lists, adding their values and moving any remaining
# carry to the next digit.
# Keep in mind that some carry may remain ... |
for _ in range(int(input())):
n,k = list(map(int,input().split()))
ans = float('inf')
for i in range(int(n**0.5+1),0,-1):
if n%i==0 and i<=k:
if n/i<=k :
ans=min(ans,i)
elif i<=k :
ans=min(ans,n//i)
print(ans) |
a = float(input())
b = float(input())
plus = a + b
minus = a - b
multiple = a * b
divide = a / b
print(a, "+", b, "=", plus)
print(a, "-", b, "=", minus)
print(a, "*", b, "=", multiple)
print(a, "/", b, "=", divide) |
temp_less_than_40 = ['Make sure to button up!',
'It\'s a bit cold out, don\'t forget your gloves!',
'Layers, layers, layers!'
]
temp_above_40 = ['Enjoy your day!',
' ',
'Remember to smile :)',
... |
def getParent(i):
if parent[i] != i:
parent[i] = getParent(parent[i])
return parent[i]
N,M,D = map(int,input().split())
Edges = sorted([tuple(list(map(int,input().split()))+[1 if _ < N-1 else 0]) for _ in range(M)],key=lambda k:k[2])
#do kruskal
MST = set()
parent = [a for a in range(N+1)]
rank = [1 for b in ra... |
# To find the all the prime numbers between ( n and m )
n = int(input())
m = int(input())
for i in range(n, m+1):
isPrime=1;
for i in range(2, m/2):
if i%j == 0:
isPrime==0
if(isPrime == 1):
print(i, "is a prime number.")
|
def split_me(input_string):
input_string = input_string.strip(" ")
i = 0
split_me_list = []
while i < len(input_string):
if input_string[i] != " ":
word_start = i
while i < len(input_string) and input_string[i] != " ":
i += 1
split_me_list.appe... |
"""
recursive result
TC: O(n) --->n in no of nodes in tree
SC: O(h) --->h is height of tree
"""
class Node:
def __init__(self, key):
self.data = key
self.left = None
self.right = None
def print_nodes_at_k_dist(root, k):
if not root:
return
if k == 0:
print(f"{roo... |
class NumericInterval(object):
def __init__(self, size=1, offset=0):
self.size = size
self.offset = offset
def __eq__(self, other):
return all([isinstance(other, NumericInterval),
self.size == other.size,
self.offset == other.offset])
def __h... |
# Copyright 2021 Edoardo Riggio
#
# 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 writin... |
"""
4. Median of Two Sorted Arrays
Hard
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
You may assume nums1 and nums2 cannot be both empty.
Example 1:
nums1 = [1, 3]
nums2 = [2]
The median ... |
OAUTH2_SERVER_URL = 'http://localhost:8000/oauth2'
OAUTH2_CLIENT_ID = 'Qv6vn7hxGGNyGuLxOU7DHtvPAykevYe1fKwy0eEP'
OAUTH2_CLIENT_SECRET = '51SAwsXvhxjMTRUufxQdobMnqs2PrcmK4AEyajWTPfr2LCDt9ML7zeOWPirAhC5rvQW9hKfsjNPoraLV9meCHyLGomvM4H0y7eMXVS2eNFH1H3kJFekePBbbRBUFEsLt'
REDIRECT_URL = 'http://localhost:8000/consumer/'
|
def for_list():
for i in [0, 1, 2, 3]:
print(i)
for i in range(4):
print(i)
#for_list()
def seq(n):
x = [0 for i in range(n+1)]
x[0] = 11.0/2.0
x[1] = 61.0/11.0
for i in range(2,n+1):
x[i] = 111 - ( 1130 - 3000/x[i-2])/x[i-1]
print(x)
#seq(100)
def matrix_add(A, B, n, m):
ApB = [ [ 0 for... |
digits = 3
i = 0
for x in range(10 ** digits):
for y in range(10 ** digits):
p = str(x * y)
if p == p[::-1] and int(p) > i:
i = int(p)
print(i)
|
'''
For two strings to be permutations of each other, they must contain the same:
- characters
characters include all possible characters in Unicode char set (whitespace etc)
- number of characters
Constraints:
- case senstivity matters
As... |
lines = {
"what is that":"It's fabric from the uniform of an Army officer of Guilder.",
"who's guilder":"The country across the sea. The sworn enemy of Florin.",
"what's your plot":"Once the horse reaches the castle, the fabric will make the Prince suspect the Guilderians have abducted his love. When he finds her bo... |
__author__ = "Sailik Sengupta"
class MTD_Game(object):
def __init__(self):
self.S = [0, 1, 2, 3]
self.A = [
# Row player (Attacker) actions corresponding to each state
[
['success'], #exploit success
['no-op', 'exp-ipfire'], #Attacker outside n/w
... |
CREATES = [('YV8R5Z', {'id': 'YV8R5Zxj9Pe7Ud74zNHL8k3YHDGgDSVpMMK9utj5BMqFpuX8kAe7M5kW93trT6cB'}, '1001a831-ce4e-56c7-954b-43d740ea56f4'), ('ZwfQge7', {'id': 'ZwfQge7KcmwuEqV8v58p2nmESZKHdv6aB7SYL4F4ABUQWt9QfaaRfxjGc43pR4n4'}, '1001a032-691f-5158-bf4e-3e95eddcdd67')
]
REPLACES = [('YV8R5Z', {'id': 'YV8R5Zxj9Pe7Ud74zNH... |
x = 1
soma = 0
while x <= 5:
n = int(input(f'{x} Digite o número: '))
soma += n
x += 1
print(f'A média é: {soma / 5:5.2f}') |
def double_char(s):
new_list = ""
for i in s:
new_list += i + i
return new_list
str_double = input('enter the string - ')
print(double_char(str_double))
|
skiff = None
def setSkiff(s):
global skiff
skiff = s
class SkiffDomainRecord(object):
"""SkiffDomainRecord"""
def __init__(self, domain, options=None, **kwargs):
super(SkiffDomainRecord, self).__init__()
if not options:
options = kwargs
self.__dict__.update(optio... |
nums = [int(x) for x in input().split()[1:]]
prev = 0
total_time = 0
for i in range(len(nums)):
diff = nums[i]-prev
if diff >0:
total_time += diff * 6
else:
total_time -= diff * 4
prev = nums[i]
total_time += len(nums)*5
print(total_time)
|
'''
Удалить элемент
'''
def removeEl(a, k):
i = k
while(i < len(a) - 1):
a[i] = a[i + 1]
i += 1
a.pop()
a = list(map(int, input().split()))
k = int(input())
removeEl(a, k)
print(*a)
|
# Exercício Python 062: Melhore o DESAFIO 061, perguntando para o usuário se ele quer
# mostrar mais alguns termos. O programa encerrará quando ele disser que quer mostrar 0 termos.
term = int(input('Enter a first term: '))
reason = int(input('Enter a reason: '))
count = total = 0
more = 10
while more !=0:
total +... |
class Some:
def __init__(self):
self.__x = 0
self.__y = 0
@property
def x(self):
return self.__x
@property
def y(self):
return self.__y
@x.setter
def x(self, value):
self.__x = value
@x.getter
def x(self):
return self.__x + 2
|
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------
# Copyright Commvault Systems, 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
#
# ... |
""" Count Sort Algorithm: Not a comparison based algorithm, this is useful when elements are present in a small range
n to n + k where k is comparable or smaller than n"""
"""Implementation"""
def count_sort(arr, k) -> list:
n = len(arr)
count = [0] * k
for i in range(n):
count[arr[i]] += 1
... |
class IncorrectPasswordException(BaseException):
def __init__(self):
print('Incorrect password')
class ExistingUserException(BaseException):
def __init__(self):
print('Existing User')
class InvalidBookException(BaseException):
def __init__(self):
print('Invalid Book')
class ... |
class AgentType():
CONSUMER_TYPE = 1
PROVIDER_ISP = 2
PROVIDER_BACKHAUL = 3
PRESENTER_TYPE = 4
PROVIDER_SUP = 5
def __init__(self, type):
self.intfNames = {}
self.intfNames[AgentType.CONSUMER_TYPE] = 'consumer'
self.intfNames[AgentType.PROVIDER_ISP]... |
x, y, w, h = input().split()
x = int(x)
y = int(y)
w = int(w)
h = int(h)
bigger_x = x
bigger_y = y
if w-x < x:
bigger_x = w-x
if h-y < y:
bigger_y = h-y
if bigger_x > bigger_y:
print(bigger_y)
else:
print(bigger_x) |
#colectie de date ; neordonata ; elemente unice
"""
SETS
"""
my_set ={1,2,3,4,2,3,4,4}
print(my_set)
my_set.add(7)
print(my_set)
my_set.remove(4)
print(my_set)
my_set ={1,2,3,4,2,3,4,4}
my_list =[1,2,3,4,2,3,4,4]
#print(list(set(my_list)))
a =list(set(my_list))
print(a[1])
|
child_bags = {}
for _ in range(594):
outer_bag, inner_bags = input().split(' contain ')
inner_bags = inner_bags[:-1].split(', ')
if inner_bags[0] == 'no other bags':
continue
child_bags[outer_bag] = []
for bag in inner_bags:
amount = int(bag[0])
name = bag[2:] + ('s' * (a... |
soma =0
cont=0
for c in range(1,501,2):
if c % 3 == 0:
soma =soma+ c
cont = cont +1
print('a soma dos inpares multiplo de 3 que q sao {} é {}'.format(cont,soma))
|
VERSION='1.0.1'
RELEASE=VERSION
__all__ = ['VERSION', 'RELEASE']
|
# https://atcoder.jp/contests/abc143/tasks/abc143_b
N = int(input())
d_arr = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
for j in range(i + 1, N):
ans += d_arr[i] * d_arr[j]
print(ans)
|
def test_index(client):
response = client.get('/')
assert response.status_code == 200
assert response.content_type == 'text/html; charset=utf-8'
def test_book_views_get(client):
response = client.get('/book')
assert response.status_code == 200
assert response.content_type == 'text/html; char... |
#
# PySNMP MIB module HH3C-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-TRAP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:30:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
print("Mostra numeros do 1 ao 5")
n = 1
while n <= 5:
print(n)
n = n + 1
if n==3:
continue
#if n==4:
# break
else:
print("Laco terminou normalmente")
print("Fim do programa") |
"""
Mappings to translate URL arguments into kwargs
"""
# FUNCTIONS FOR CONVERTING URL STRING REPRESENTATIONS INTO
# PYTHON OBJECTS SUITABLE FOR CREATING PLOTS
# identity function
noop = lambda x: x
def str2num(value):
"""
Takes a string and returns its numeric representation.
ValueError will be raised ... |
###########################################
#### Please fill in EXACT column names ####
###########################################
################ Judges ################
# Judge hourly availability question column name format, where "{date_name}"
# will take on the date name values in JUDGE_AVAILABILITY_DATE_NAMES... |
#
# PySNMP MIB module QUANTUMBRIDGE-REG (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/QUANTUMBRIDGE-REG
# Produced by pysmi-0.3.4 at Mon Apr 29 20:34:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
#!/usr/bin/env python3
"""Project Euler - Problem 56 Module"""
def problem56(a_limit, b_limit):
"""Problem 56 - Powerful digit sum"""
max = 0
for a in range(1, a_limit):
for b in range(1, b_limit):
p_ab_sum_digits = sum(int(x) for x in str(a ** b))
if p_ab_sum_digits > max... |
class Target:
def __init__(self, Id, Athlete_Id, Content, Status, Week, Year):
self.Id = Id
self.Athlete_Id = Athlete_Id
self.Content = Content
self.Status = Status
self.Week = Week
self.Year = Year
|
class XenditError(Exception):
"""Error that will be given when status code != 200."""
def __init__(self, xendit_response):
try:
super(XenditError, self).__init__(xendit_response.body["message"])
except KeyError:
super(XenditError, self).__init__(
... |
class Person:
def __init__(self, firstname = "J.", lastname = "Doe", wage = 10.00, hours = 40.00):
self.firstname = firstname
self.lastname = lastname
self.wage = wage
self.hours = hours
def getPerson(self):
firstname, lastname = input("Hello! What is your full name?: ")... |
#somando até quando quiser
para = s = c = 0
while para != 1000:
n = int(input('Digite o numero a ser somado[999 para]: '))
if n == 1000:
para = n
else:
s += n
c += 1
print('A soma de todos os {} numeros digitados é {}'.format(c,s)) |
# /usr/bin/env python
# coding=utf-8
def disable_iptables():
pass
|
"""Various exception classes
"""
class ConversationSendError(Exception):
"""Raised if there are no tags available for a given conversation."""
|
"""
Class representing atom
"""
ResiduesCodes = {
'ALA': 'A',
'ARG': 'R',
'ASN': 'N',
'ASP': 'D',
'CYS': 'C',
'GLU': 'E',
'GLN': 'Q',
'GLY': 'G',
'HIS': 'H',
'ILE': 'I',
'LEU': 'L',
'LYS': 'K',
'MET': 'M',
'PHE': 'F',
'PRO': 'P',
'SER': ... |
#Source : https://leetcode.com/problems/reverse-string-ii/
#Author : Yuan Wang
#Date : 2018-06-29
'''
**********************************************************************************
*Given a string and an integer k, you need to reverse the first k characters for
*every 2k characters counting from the start of t... |
intensity_dict = {
"Dödsolycka": 4,
"Svår olycka": 3,
"Lindrig olycka": 2,
"Okänd svårhetsgrad": 1,
"Ej personskadeolycka": 0
}
weather_dict = {
"Dis/dimma": 0,
"Regn": 1,
"Snöblandat regn": 2,
"Snöfall": 3,
"Uppehållsväder": 4,
"Okänt": 5
}
locationType_dict = {
"Annan... |
input = """
a(1) v a(2).
a(3) v a(4).
ok :- not #count{T: a(T)} > 2, #count{V : a(V)} > 1.
"""
output = """
{a(1), a(3), ok}
{a(1), a(4), ok}
{a(2), a(3), ok}
{a(2), a(4), ok}
"""
|
class MCTS(object):
pass
class ParallelMCTS(MCTS):
pass |
#
# PySNMP MIB module NETSCREEN-SET-DHCP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-SET-DHCP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:10:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
class orders:
def __init__(self):
''' Order storage and build class '''
self.orders = {}
self._id = -1
def get_order(self, _id):
return self.orders[str(_id)]
def _close(self, _id=None):
self.orders.pop(str(_id))
def _open(self, price, side, size, fee):
... |
"""
Given a string text, you need to use the characters of text to form as many instances of the word "lambda" as possible.
You can use each character in text at most once.
Write a function that returns the maximum number of instances of "lambda" that can be formed.
Example 1:
Input: text = "mbxcdatlas"
Output: 1
E... |
#
# PySNMP MIB module HMPRIV-MGMT-SNMP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HMPRIV-MGMT-SNMP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:18:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
# FizzBuzz in python using nested if else
# Author - @hritikchaturvedi11
for i in range(1,100):
if(i % 3 == 0 and i % 5 == 0):
print('FizzBuzz')
elif(i % 3 == 0):
print('Fizz')
elif(i % 5 == 0):
print('Buzz')
else:
print(i)
|
class UserRepositoryError(Exception):
def __init__(self, message: str):
raise Exception(message)
class UserDoesNotExist(UserRepositoryError):
pass
class UsernameAlreadyTakenError(UserRepositoryError):
pass
class EmailAlreadyTakenError(UserRepositoryError):
pass
|
comec=input().split()
hCOMEC=input().split()
final=input().split()
hFINAL=input().split()
di,df=int(comec[1]),int(final[1])
hi,mi,si=int(hCOMEC[0]), int(hCOMEC[2]), int(hCOMEC[4])
hf,mf,sf=int(hFINAL[0]), int(hFINAL[2]), int(hFINAL[4])
mSEG=60
hSEG=mSEG*60
dSEG=hSEG*24
i,f=si+mi*mSEG+hi*hSEG+di*dSEG,sf+mf*mSEG+hf*hSEG+... |
num1=int(input("Enter the number1"))
num2=int(input("Enter the number2"))
print("Addition of the two numbers:",(num1+num2))
print("Subtraction of the two numbers:",(num1-num2))
print("Multiplication of the two numbers:",(num1*num2))
print("Division of the two number:",(num1/num2))
print("Remainder of the two number:",(... |
# You are climbing a staircase. It takes n steps to reach the top.
# Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
#
# Example 1:
# Input: n = 2
# Output: 2
# Explanation: There are two ways to climb to the top.
# 1. 1 step + 1 step
# 2. 2 steps
#
# Example 2:
# Input:... |
#
# PySNMP MIB module NOKIA-UNITTYPES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NOKIA-UNITTYPES-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:23:38 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
# region headers
# * author: salaheddine.gassim@nutanix.com
# * version: v1.0/10032020 - initial version
# task_name: F5CreateNode
# description: Create a node or nodes to be used inside a pool
# input vars: vm_name, vm_ip, f5_node_description, f5_partition
# output vars: n/a
# endregion
# region capture... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.