content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
## https://leetcode.com/problems/implement-strstr/
## problem is to find where the needle occurs in the haystack.
## do this in O(n) by looping over the characters in the haystack
## and checking if the string started by that index (and as long
## as the needle) is equal to the needle.
## return -1 if we get to the ... | class Solution:
def str_str(self, haystack: str, needle: str) -> int:
nlen = len(needle)
if not nlen:
return 0
if not len(haystack):
return -1
for ii in range(len(haystack) - nlen + 1):
if haystack[ii:ii + nlen] == needle:
return i... |
text = """
//------------------------------------------------------------------------------
// Explicit instantiation.
//------------------------------------------------------------------------------
#include "Geometry/Dimension.hh"
#include "FSISPH/FSISpecificThermalEnergyPolicy.cc"
namespace Spheral {
template cla... | text = '\n//------------------------------------------------------------------------------\n// Explicit instantiation.\n//------------------------------------------------------------------------------\n#include "Geometry/Dimension.hh"\n#include "FSISPH/FSISpecificThermalEnergyPolicy.cc"\n\nnamespace Spheral {\n templa... |
value = '16b87ecc17e3568c83d2d55d8c0d7260'
# https://md5.gromweb.com/?md5=16b87ecc17e3568c83d2d55d8c0d7260
print('flippit')
| value = '16b87ecc17e3568c83d2d55d8c0d7260'
print('flippit') |
class Storage(dict):
"""
A Storage object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`, and setting obj.foo = None deletes item foo.
>>> o = Storage(a=1)
>>> print o.a
1
>>> o['a']
1
>>> o.a = 2
>>> print o['a']
... | class Storage(dict):
"""
A Storage object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`, and setting obj.foo = None deletes item foo.
>>> o = Storage(a=1)
>>> print o.a
1
>>> o['a']
1
>>> o.a = 2
>>> print o['a']
... |
def paint(x, y):
global a
global pic
if not (0 <= x < a and 0 <= y < a):
return
if pic[x][y] == '+':
return
pic[x][y] = '+'
paint(x+1, y)
paint(x-1, y)
paint(x, y+1)
paint(x, y-1)
output = []
a = int(input())
pic = []
for i in range(a):
pic.append(list(input()))... | def paint(x, y):
global a
global pic
if not (0 <= x < a and 0 <= y < a):
return
if pic[x][y] == '+':
return
pic[x][y] = '+'
paint(x + 1, y)
paint(x - 1, y)
paint(x, y + 1)
paint(x, y - 1)
output = []
a = int(input())
pic = []
for i in range(a):
pic.append(list(inp... |
"""
TODO:
- QualifiedName visitability.. somewhere
- CreateOrReplaceTable (w/ prefixes)
- batching for snowflake...
- helper against sqla inserts with nonexisting columns :/
"""
| """
TODO:
- QualifiedName visitability.. somewhere
- CreateOrReplaceTable (w/ prefixes)
- batching for snowflake...
- helper against sqla inserts with nonexisting columns :/
""" |
OCTICON_MARK_GITHUB = """
<svg class="octicon octicon-mark-github" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.2... | octicon_mark_github = '\n<svg class="octicon octicon-mark-github" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-... |
COMMANDS = [
# OP Level 0-2
"placefeature"
"advancement",
"attribute",
"bossbar",
"clear",
"clone",
"data",
"datapack",
"debug",
"defaultgamemode",
"difficulty",
"effect",
"enchant",
"execute",
"experience",
"fill",
"forceload",
"function",
... | commands = ['placefeatureadvancement', 'attribute', 'bossbar', 'clear', 'clone', 'data', 'datapack', 'debug', 'defaultgamemode', 'difficulty', 'effect', 'enchant', 'execute', 'experience', 'fill', 'forceload', 'function', 'gamemode', 'gamerule', 'give', 'help', 'item', 'kill', 'list', 'locate', 'locatebiome', 'loot', '... |
str1 = input("Enter the postfix expression:")
list1 = str1.split()
stack = list()
print(list1)
# 2 3 1 * + 9 - here the ans is -4
def isOperator(a):
if a == '+' or a == '-' or a == '/' or a == '*':
return 1
else:
return 0
def evaluate(a, b, c):
if a == '+':
return b + c
elif... | str1 = input('Enter the postfix expression:')
list1 = str1.split()
stack = list()
print(list1)
def is_operator(a):
if a == '+' or a == '-' or a == '/' or (a == '*'):
return 1
else:
return 0
def evaluate(a, b, c):
if a == '+':
return b + c
elif a == '-':
return b - c
... |
# fruits = {}
#
# fruits["apple"] = "A sweet red fruit"
#
# fruits["mango"] = "King of all"
#
# print(fruits["apple"])
line = input()
letter = {}
for ch in line:
if ch in letter:
letter[ch] += 1
else:
letter[ch] = 1
print(letter)
print(letter.keys())
| line = input()
letter = {}
for ch in line:
if ch in letter:
letter[ch] += 1
else:
letter[ch] = 1
print(letter)
print(letter.keys()) |
# from .initial_values import initial_values
#----------STATE VARIABLE Genesis DICTIONARY---------------------------
genesis_states = {
'player_200' : False,
'player_250' : False,
'player_300' : False,
'player_350' : False,
'player_400' : False,
'game_200' : False,
'game_250' : F... | genesis_states = {'player_200': False, 'player_250': False, 'player_300': False, 'player_350': False, 'player_400': False, 'game_200': False, 'game_250': False, 'game_300': False, 'game_350': False, 'game_400': False, 'timestamp': '2018-10-01 15:16:24'} |
#!/usr/bin/env vpython3
def onefile(fname):
data = open(fname, 'rt').read()
data = data.replace('FPDF_EXPORT', 'extern')
data = data.replace('FPDF_CALLCONV', '')
open(fname, 'wt').write(data)
onefile('pdfium/include/fpdf_annot.h')
onefile('pdfium/include/fpdf_attachment.h')
onefile('pdfium/include/fpd... | def onefile(fname):
data = open(fname, 'rt').read()
data = data.replace('FPDF_EXPORT', 'extern')
data = data.replace('FPDF_CALLCONV', '')
open(fname, 'wt').write(data)
onefile('pdfium/include/fpdf_annot.h')
onefile('pdfium/include/fpdf_attachment.h')
onefile('pdfium/include/fpdf_catalog.h')
onefile('pdf... |
def inequality(value):
# Complete the if statement on the next line using value, the inequality operator (!=), and the number 13.
if value != 13:
### Your code goes above this line ###
return "Not Equal to 13"
else:
return "Equal to 13"
print(inequality(100))
| def inequality(value):
if value != 13:
return 'Not Equal to 13'
else:
return 'Equal to 13'
print(inequality(100)) |
# -*- Mode: Python; test-case-name: test.test_pychecker_CodeChecks -*-
# vi:si:et:sw=4:sts=4:ts=4
# trigger opcode 99, DUP_TOPX
def duptopx():
d = {}
for i in range(0, 9):
d[i] = i
for k in d:
# the += on a dict member triggers DUP_TOPX
d[k] += 1
| def duptopx():
d = {}
for i in range(0, 9):
d[i] = i
for k in d:
d[k] += 1 |
#######################################################
#
# track.py
# Python implementation of the Class track
# Generated by Enterprise Architect
# Created on: 11-Feb-2020 11:08:09 AM
# Original author: Corvo
#
#######################################################
class track:
# default constructor d... | class Track:
speed = '0.00000000'
def getspeed(self):
return self.speed
def setspeed(self, speed=0):
self.speed = speed
__course = '0.00000000'
def getcourse(self):
return self.course
def setcourse(self, course=0):
self.course = course |
mylist=['hello',[2,3,4],[40,50,60],['hi'],'how',"bye"]
print(mylist)
print(mylist[1][1])
mylist=['hello',[2,3,4]]
print(mylist[1][0])
num1=[0,32,444,4453,[23,43,54,12,3]]
print(num1)
num2=[0,32,444,4453]
num2.extend([23,43,54,12,3])
print(num2)
| mylist = ['hello', [2, 3, 4], [40, 50, 60], ['hi'], 'how', 'bye']
print(mylist)
print(mylist[1][1])
mylist = ['hello', [2, 3, 4]]
print(mylist[1][0])
num1 = [0, 32, 444, 4453, [23, 43, 54, 12, 3]]
print(num1)
num2 = [0, 32, 444, 4453]
num2.extend([23, 43, 54, 12, 3])
print(num2) |
def test(x, y):
x + y
test(
11111111,
test(11111111, 1111111),
test(11111111, 1111111),
222,
222,
test(11111111, 1111111),
test(11111111, 1111111),
222,
test(11111111, 1111111),
test(11111111, 1111111),
test(11111111, 1111111),
test(11111111, 1111111),
test(1111... | def test(x, y):
x + y
test(11111111, test(11111111, 1111111), test(11111111, 1111111), 222, 222, test(11111111, 1111111), test(11111111, 1111111), 222, test(11111111, 1111111), test(11111111, 1111111), test(11111111, 1111111), test(11111111, 1111111), test(11111111, 1111111)) |
"""Define library wise constants"""
__version__: str = '0.0.7'
__author__: str = 'Igor Morgado'
__author_email__: str = 'morgado.igor@gmail.com'
| """Define library wise constants"""
__version__: str = '0.0.7'
__author__: str = 'Igor Morgado'
__author_email__: str = 'morgado.igor@gmail.com' |
#
# PySNMP MIB module CISCOTRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOTRAP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:24:33 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... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ... |
data_s3_path = "riskified-research-files/research analysts/DO/representment/win_rate_prediction/exploration"
data_file_name = "disputed_chbs_targil_6.csv"
cat_features = [
# 'dispute_status',
'domestic_international',
'order_submission_type',
'bill_ship_mismatch',
'is_proxy',
'order_external_st... | data_s3_path = 'riskified-research-files/research analysts/DO/representment/win_rate_prediction/exploration'
data_file_name = 'disputed_chbs_targil_6.csv'
cat_features = ['domestic_international', 'order_submission_type', 'bill_ship_mismatch', 'is_proxy', 'order_external_status', 'cvv_result', 'avs_result', 'mapped_sou... |
#
# PySNMP MIB module GMS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GMS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:06:21 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:15)... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_size_constraint, constraints_intersection, value_range_constraint) ... |
# Copyright (c) 2015 Vivaldi Technologies AS. All rights reserved
{
'targets': [
{
'target_name': 'vivaldi_api_registration',
'type': 'static_library',
'msvs_disabled_warnings': [ 4267 ],
'includes': [
'../../chromium/build/json_schema_bundle_registration_compile.gypi',
'.... | {'targets': [{'target_name': 'vivaldi_api_registration', 'type': 'static_library', 'msvs_disabled_warnings': [4267], 'includes': ['../../chromium/build/json_schema_bundle_registration_compile.gypi', '../schema/vivaldi_schemas.gypi'], 'dependencies': ['../schema/vivaldi_api.gyp:vivaldi_chrome_api', '<(DEPTH)/content/con... |
class Solution:
def solve(self, nums, a, b, c):
q = lambda x: a*(x**2)+b*x+c
if not nums: return []
if len(nums) == 1:
return list(map(q,nums))
if a == 0:
if b > 0:
return list(map(q,nums))
else:
return list(map(q,re... | class Solution:
def solve(self, nums, a, b, c):
q = lambda x: a * x ** 2 + b * x + c
if not nums:
return []
if len(nums) == 1:
return list(map(q, nums))
if a == 0:
if b > 0:
return list(map(q, nums))
else:
... |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 21 12:03:38 2020
@author: Ravi
"""
def CountSort(arr,n):
count = [0]*100
for i in arr:
count[i]+=1
i=0
for a in range(100):
for c in range(count[a]):
arr[i] = a
i+=1
return arr | """
Created on Sat Mar 21 12:03:38 2020
@author: Ravi
"""
def count_sort(arr, n):
count = [0] * 100
for i in arr:
count[i] += 1
i = 0
for a in range(100):
for c in range(count[a]):
arr[i] = a
i += 1
return arr |
def Vertical_Concatenation(Test_list):
Result = []
n = 0
while n != len(Test_list):
temp = ''
for indexes in Test_list:
try:
temp += indexes[n]
except IndexError:
pass
n += 1
Result.append(temp)
return Re... | def vertical__concatenation(Test_list):
result = []
n = 0
while n != len(Test_list):
temp = ''
for indexes in Test_list:
try:
temp += indexes[n]
except IndexError:
pass
n += 1
Result.append(temp)
return Result
test_l... |
#!/usr/bin/env python3
class UserError(Exception):
pass
| class Usererror(Exception):
pass |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def createList(self, list):
h = head = ListNode(None)
for l in list:
head.next = ListNode(l)
head = head.next
return h.next
... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def create_list(self, list):
h = head = list_node(None)
for l in list:
head.next = list_node(l)
head = head.next
return h.next
def show_list(self, head):
... |
self.description = "check file type without mtree"
self.filesystem = [ "bar/", "foo -> bar/" ]
pkg = pmpkg("dummy")
pkg.files = [ "foo/" ]
self.addpkg2db("local",pkg)
self.args = "-Qk"
self.addrule("PACMAN_RETCODE=1")
self.addrule("PACMAN_OUTPUT=warning.*(File type mismatch)")
| self.description = 'check file type without mtree'
self.filesystem = ['bar/', 'foo -> bar/']
pkg = pmpkg('dummy')
pkg.files = ['foo/']
self.addpkg2db('local', pkg)
self.args = '-Qk'
self.addrule('PACMAN_RETCODE=1')
self.addrule('PACMAN_OUTPUT=warning.*(File type mismatch)') |
#Solution-7 Lisa Murray
# User needs to input number that they want to calculate the square root of:
num = float(input("Please enter a positive number: "))
#square root is found by raising the number to the power of a half
sqroot = num**(1/2)
# round the square root number to one decimal place and cast as a string
a... | num = float(input('Please enter a positive number: '))
sqroot = num ** (1 / 2)
ans = str(round(sqroot, 1))
print(f'The square root of {num} is approx. {ans}.') |
# MadLib.py
adjective = input("Please enter an adjective: ")
noun = input("Please enter a noun: ")
verb = input("Please enter a verb ending in -ed: ")
print("Your MadLib:")
print("The", adjective, noun, verb, "over the lazy brown dog.")
| adjective = input('Please enter an adjective: ')
noun = input('Please enter a noun: ')
verb = input('Please enter a verb ending in -ed: ')
print('Your MadLib:')
print('The', adjective, noun, verb, 'over the lazy brown dog.') |
"""
None
"""
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""
Initialize your data structure here.
@param width - screen width
@param height - screen height
@param food - A list of food positions
E.g food = [[1,1], [1,0]] m... | """
None
"""
class Snakegame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""
Initialize your data structure here.
@param width - screen width
@param height - screen height
@param food - A list of food positions
E.g food = [[1,1], [1,0]] me... |
"""
Handling of options passed to the decorator to generate more rows of data.
"""
def _copy_rows(data, num_rows, base_row_index=0):
"""
Copies one list from a list of lists and adds it to the same list n times.
Parameters
----------
data: [][]
Dataset to apply the function to. This will ... | """
Handling of options passed to the decorator to generate more rows of data.
"""
def _copy_rows(data, num_rows, base_row_index=0):
"""
Copies one list from a list of lists and adds it to the same list n times.
Parameters
----------
data: [][]
Dataset to apply the function to. This will b... |
class Node:
def __init__(self,cargo,left=None,right=None):
self.cargo = cargo
self.left = left
self.right = right
def __str__(self) -> str:
return str(self.cargo)
def insert(root,key):
if root is None:
return Node(key)
if root.cargo>key:
if root.left is ... | class Node:
def __init__(self, cargo, left=None, right=None):
self.cargo = cargo
self.left = left
self.right = right
def __str__(self) -> str:
return str(self.cargo)
def insert(root, key):
if root is None:
return node(key)
if root.cargo > key:
if root.l... |
num1 = 1
num2 = 2
num3 = 3
num4 = 33
num6 = 66
| num1 = 1
num2 = 2
num3 = 3
num4 = 33
num6 = 66 |
class input_format():
def __init__(self,format_tag):
self.tag = format_tag
def print_sample_input(self):
if self.tag =='FCC_BCC_Edge_Ternary':
print('''
Sample JSON for using pseudo-ternary predictions of solid solution strength by Curtin edge dislocation model.
--... | class Input_Format:
def __init__(self, format_tag):
self.tag = format_tag
def print_sample_input(self):
if self.tag == 'FCC_BCC_Edge_Ternary':
print('\nSample JSON for using pseudo-ternary predictions of solid solution strength by Curtin edge dislocation model. \n------------------... |
def main():
a = float(input("Number a: "))
b = float(input("Number b: "))
if a > b:
print("A > b")
elif a < b:
print("A < B")
else:
print("A = B")
if __name__ == '__main__':
main()
| def main():
a = float(input('Number a: '))
b = float(input('Number b: '))
if a > b:
print('A > b')
elif a < b:
print('A < B')
else:
print('A = B')
if __name__ == '__main__':
main() |
class AuthSigner(object):
"""Signer for use with authenticated ADB, introduced in 4.4.x/KitKat."""
def sign(self, data):
"""Signs given data using a private key."""
raise NotImplementedError()
def get_public_key(self):
"""Returns the public key in PEM format without headers or newl... | class Authsigner(object):
"""Signer for use with authenticated ADB, introduced in 4.4.x/KitKat."""
def sign(self, data):
"""Signs given data using a private key."""
raise not_implemented_error()
def get_public_key(self):
"""Returns the public key in PEM format without headers or ne... |
# MYSQL CREDENTIALS
mysql_user = "root"
mysql_pass = "clickhouse"
# MYSQL8 CREDENTIALS
mysql8_user = "root"
mysql8_pass = "clickhouse"
# POSTGRES CREDENTIALS
pg_user = "postgres"
pg_pass = "mysecretpassword"
pg_db = "postgres"
# MINIO CREDENTIALS
minio_access_key = "minio"
minio_secret_key = "minio123"
# MONGODB ... | mysql_user = 'root'
mysql_pass = 'clickhouse'
mysql8_user = 'root'
mysql8_pass = 'clickhouse'
pg_user = 'postgres'
pg_pass = 'mysecretpassword'
pg_db = 'postgres'
minio_access_key = 'minio'
minio_secret_key = 'minio123'
mongo_user = 'root'
mongo_pass = 'clickhouse'
odbc_mysql_uid = 'root'
odbc_mysql_pass = 'clickhouse'... |
# Find cure root using bisection search
num = 43
eps = 1e-6
iteration = 0
croot = num/2
_high = num
_low = 1
while abs(croot**3-num)>eps:
iteration+=1
cube = croot**3
if cube==num:
print(f'At Iteration {iteration} : Found It!, the cube root for {num} is {croot}')
break
elif cube>num:
... | num = 43
eps = 1e-06
iteration = 0
croot = num / 2
_high = num
_low = 1
while abs(croot ** 3 - num) > eps:
iteration += 1
cube = croot ** 3
if cube == num:
print(f'At Iteration {iteration} : Found It!, the cube root for {num} is {croot}')
break
elif cube > num:
_high = croot
... |
level = 3
name = 'Kertasari'
capital = 'Cibeureum'
area = 152.07
| level = 3
name = 'Kertasari'
capital = 'Cibeureum'
area = 152.07 |
#!/bin/python3
"""
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
def multiples_of_3_5(stop):
"""Compute sum numbers in range(1, stop) if numbers are divided by 3 or 5.""... | """
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
def multiples_of_3_5(stop):
"""Compute sum numbers in range(1, stop) if numbers are divided by 3 or 5."""
frames = (... |
class IllegalValueException(Exception):
def __init__(self, message):
super().__init__(message)
class IllegalCurrencyException(Exception):
def __init__(self, message):
super().__init__(message)
class IllegalCoinException(Exception):
def __init__(self, message):
super().__init__(m... | class Illegalvalueexception(Exception):
def __init__(self, message):
super().__init__(message)
class Illegalcurrencyexception(Exception):
def __init__(self, message):
super().__init__(message)
class Illegalcoinexception(Exception):
def __init__(self, message):
super().__init__(m... |
class Solution(object):
def maxProfit(self, k, prices):
"""
:type k: int
:type prices: List[int]
:rtype: int
"""
n = len(prices)
if k >= n/2:
ret = 0
for i in xrange(1, n):
ret += max(prices[i]-prices[i-1], 0)
... | class Solution(object):
def max_profit(self, k, prices):
"""
:type k: int
:type prices: List[int]
:rtype: int
"""
n = len(prices)
if k >= n / 2:
ret = 0
for i in xrange(1, n):
ret += max(prices[i] - prices[i - 1], 0)
... |
class Solution:
@lru_cache(None)
def numRollsToTarget(self, d: int, f: int, target: int) -> int:
if d==1:
if f>=target:return 1
return 0
count=0
for i in range(1,f+1):
if i<target:
count += self.numRollsToTarget(d-1,f,target-i)
... | class Solution:
@lru_cache(None)
def num_rolls_to_target(self, d: int, f: int, target: int) -> int:
if d == 1:
if f >= target:
return 1
return 0
count = 0
for i in range(1, f + 1):
if i < target:
count += self.numRollsT... |
# Tags: Implementation
# Difficulty: 1.5
# Priority: 5
# Date: 08-06-2017
hh, mm = map(int, input().split(':'))
a = int( input() ) % ( 60 * 24 )
mm += a
hh += mm // 60
mm %= 60
hh %= 24
print('%0.2d:%0.2d' %(hh, mm))
| (hh, mm) = map(int, input().split(':'))
a = int(input()) % (60 * 24)
mm += a
hh += mm // 60
mm %= 60
hh %= 24
print('%0.2d:%0.2d' % (hh, mm)) |
#
# PySNMP MIB module HUAWEI-BRAS-SRVCFG-DEVICE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-BRAS-SRVCFG-DEVICE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:43:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) ... |
class Solution:
def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]:
child = collections.defaultdict(set)
parent = collections.defaultdict(int)
for c, p in prerequisites:
child[p].add(c)
parent[c] +=1
q = collections.dequ... | class Solution:
def find_order(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]:
child = collections.defaultdict(set)
parent = collections.defaultdict(int)
for (c, p) in prerequisites:
child[p].add(c)
parent[c] += 1
q = collections.deque()
... |
'''
URL: https://leetcode.com/problems/monotonic-array/
Difficulty: Easy
Title: Monotonic Array
'''
################### Code ###################
class Solution:
def isMonotonic(self, A: List[int]) -> bool:
if len(A) in [1, 2]:
return True
cmp = None
... | """
URL: https://leetcode.com/problems/monotonic-array/
Difficulty: Easy
Title: Monotonic Array
"""
class Solution:
def is_monotonic(self, A: List[int]) -> bool:
if len(A) in [1, 2]:
return True
cmp = None
for i in range(len(A) - 1):
diff = A[i + 1] - A[i]
... |
#NUMBERS
10 #Numero Entero (integer)
10.4 #Numero Flotante (float)
print(type(10))
print(type(10.4))
#INPUT
age = input('Coloque su edad: ')
print(type(age))
new_age = int(age) + 5
print(new_age)
| 10
10.4
print(type(10))
print(type(10.4))
age = input('Coloque su edad: ')
print(type(age))
new_age = int(age) + 5
print(new_age) |
'''
In this problem, we should define dummy and cur as a listNode(0).
Let dummy points to the start of cur.
Everytime when we update cur.next, cur will move to cur.next.
And if the length of l1 and l2 is not equal, cur.next points to the left list l1 or l2.
Tips:
It is like two pointers. But it is done with node.
'... | """
In this problem, we should define dummy and cur as a listNode(0).
Let dummy points to the start of cur.
Everytime when we update cur.next, cur will move to cur.next.
And if the length of l1 and l2 is not equal, cur.next points to the left list l1 or l2.
Tips:
It is like two pointers. But it is done with node.
"... |
transactions_count = int(input('Enter number of transactions: '))
total = 0
while True:
if transactions_count <= 0:
break
transactions_cash = float(input('Enter transactions amount: '))
if transactions_cash >= 1:
total += transactions_cash
transactions_count -= 1
continue... | transactions_count = int(input('Enter number of transactions: '))
total = 0
while True:
if transactions_count <= 0:
break
transactions_cash = float(input('Enter transactions amount: '))
if transactions_cash >= 1:
total += transactions_cash
transactions_count -= 1
continue
... |
class dotRebarSplice_t(object):
# no doc
BarPositions=None
Clearance=None
LapLength=None
ModelObject=None
Offset=None
Reinforcement1=None
Reinforcement2=None
Type=None
| class Dotrebarsplice_T(object):
bar_positions = None
clearance = None
lap_length = None
model_object = None
offset = None
reinforcement1 = None
reinforcement2 = None
type = None |
# coding: utf-8
MAX_INT = 2147483647
MIN_INT = -2147483648
class Solution(object):
def myAtoi(self, input_string):
"""
:type input_string: str
:rtype: int
"""
number = 0
sign = 1
i = 0
length = len(input_string)
while i < length and input_s... | max_int = 2147483647
min_int = -2147483648
class Solution(object):
def my_atoi(self, input_string):
"""
:type input_string: str
:rtype: int
"""
number = 0
sign = 1
i = 0
length = len(input_string)
while i < length and input_string[i].isspace(... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
dummy = l3 = ListNode(0)
while l1 and l2:
if l1.val > l2.val:
... | class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
dummy = l3 = list_node(0)
while l1 and l2:
if l1.val > l2.val:
l3.next = list_node(l2.val)
l3 = l3.next
l2 = l2.next
else:
l3.ne... |
'''https://leetcode.com/problems/remove-duplicates-from-sorted-array/'''
# class Solution:
# def removeDuplicates(self, nums: List[int]) -> int:
# l = len(nums)
# ans = 0
# for i in range(1, l):
# if nums[i]!=nums[ans]:
# ans+=1
# nums[i], nums[an... | """https://leetcode.com/problems/remove-duplicates-from-sorted-array/"""
class Solution:
def remove_duplicates(self, nums: List[int]) -> int:
if len(nums) < 2:
return len(nums)
(p1, p2) = (0, 1)
while p2 < len(nums):
if nums[p2] != nums[p1]:
p1 += 1
... |
#!/usr/bin/env python3
def lst_intersection(lst1:list, lst2:list):
'''
Source: https://www.geeksforgeeks.org/python-intersection-two-lists/
'''
return [value for value in lst1 if value in set(lst2)]
def main():
return lst_intersection(lst1, lst2)
if __name__ == "__main__":
main()
| def lst_intersection(lst1: list, lst2: list):
"""
Source: https://www.geeksforgeeks.org/python-intersection-two-lists/
"""
return [value for value in lst1 if value in set(lst2)]
def main():
return lst_intersection(lst1, lst2)
if __name__ == '__main__':
main() |
__author__ = 'huanpc'
########################################################################################################################
HOST = "25.22.28.94"
PORT = 3307
USER = "root"
PASSWORD = "root"
DB = "opencart"
TABLE_ADDRESS = 'oc_address'
TABLE_CUSTOMER= 'oc_customer'
#####################################... | __author__ = 'huanpc'
host = '25.22.28.94'
port = 3307
user = 'root'
password = 'root'
db = 'opencart'
table_address = 'oc_address'
table_customer = 'oc_customer'
dir_output_path = './Test_plan'
num_of_threads = 10
opencart_port = 10000
ram_up = 10
config_file_path = DIR_OUTPUT_PATH + '/config.csv'
test_plan_file_path_... |
def abort_if_false(ctx, param, value):
if not value:
ctx.abort()
| def abort_if_false(ctx, param, value):
if not value:
ctx.abort() |
HOST = "irc.twitch.tv"
PORT = 6667
OAUTH = "" # generate from http://www.twitchapps.com/tmi/
IDENT = "" # twitch account for which you used the oauth
CHANNEL = "" | host = 'irc.twitch.tv'
port = 6667
oauth = ''
ident = ''
channel = '' |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
capacity = 5000-A[0]
apples = sorted(A[1:])
sum = 0
total = 0
for idx,a in enumerate(apples):
if a+sum > capacity:
total = idx
... | def solution(A):
capacity = 5000 - A[0]
apples = sorted(A[1:])
sum = 0
total = 0
for (idx, a) in enumerate(apples):
if a + sum > capacity:
total = idx
break
else:
sum += a
return total
if __name__ == '__main__':
print(solution([4650, 150, 1... |
whole_clinit = [
'\n'
'.method static constructor <clinit>()V\n'
' .locals 1\n'
'\n'
' :try_start_0\n'
' const-string v0, "nc"\n'
'\n'
' invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V\n'
' :try_end_0\n'
' .catch Ljava/lang/UnsatisfiedLi... | whole_clinit = ['\n.method static constructor <clinit>()V\n .locals 1\n\n :try_start_0\n const-string v0, "nc"\n\n invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V\n :try_end_0\n .catch Ljava/lang/UnsatisfiedLinkError; {:try_start_0 .. :try_end_0} :catch_0\n\n goto :goto_0\n... |
class ValidBlockNetException(Exception):
pass
| class Validblocknetexception(Exception):
pass |
'''
Given two integer arrays startTime and endTime and given an integer queryTime.
The ith student started doing their homework at the time startTime[i] and finished it at time endTime[i].
Return the number of students doing their homework at time queryTime. More formally, return the number of students where queryTim... | """
Given two integer arrays startTime and endTime and given an integer queryTime.
The ith student started doing their homework at the time startTime[i] and finished it at time endTime[i].
Return the number of students doing their homework at time queryTime. More formally, return the number of students where queryTim... |
# -*- coding:utf-8 -*-
"""
@author:SiriYang
@file: __init__.py
@time: 2019.12.24 20:33
"""
| """
@author:SiriYang
@file: __init__.py
@time: 2019.12.24 20:33
""" |
def as_div(form):
"""This formatter arranges label, widget, help text and error messages by
using divs. Apply to custom form classes, or use to monkey patch form
classes not under our direct control."""
# Yes, evil but the easiest way to set this property for all forms.
form.required_css_class = 'r... | def as_div(form):
"""This formatter arranges label, widget, help text and error messages by
using divs. Apply to custom form classes, or use to monkey patch form
classes not under our direct control."""
form.required_css_class = 'required'
return form._html_output(normal_row=u'<div class="field"><d... |
numbers = input('Enter a list of numbers (csv): ').replace(' ','').split(',')
numbers = [int(i) for i in numbers]
def sum_of_three(numbers):
summ = 0
for i in numbers:
summ += i
return summ
print('Sum:', sum_of_three(numbers)) | numbers = input('Enter a list of numbers (csv): ').replace(' ', '').split(',')
numbers = [int(i) for i in numbers]
def sum_of_three(numbers):
summ = 0
for i in numbers:
summ += i
return summ
print('Sum:', sum_of_three(numbers)) |
{
"targets": [{
"target_name" : "test",
"defines": [ "V8_DEPRECATION_WARNINGS=1" ],
"sources" : [ "test.cpp" ],
"include_dirs": ["<!(node -e \"require('..')\")"]
}]
}
| {'targets': [{'target_name': 'test', 'defines': ['V8_DEPRECATION_WARNINGS=1'], 'sources': ['test.cpp'], 'include_dirs': ['<!(node -e "require(\'..\')")']}]} |
class QualifierList:
def __init__(self, qualifiers):
self.qualifiers = qualifiers
def insert_qualifier(self, qualifier):
self.qualifiers.insert(0, qualifier)
def __len__(self):
return len(self.qualifiers)
def __iter__(self):
return self.qualifiers
def __str__(se... | class Qualifierlist:
def __init__(self, qualifiers):
self.qualifiers = qualifiers
def insert_qualifier(self, qualifier):
self.qualifiers.insert(0, qualifier)
def __len__(self):
return len(self.qualifiers)
def __iter__(self):
return self.qualifiers
def __str__(sel... |
st = input("enter the string")
upCount=0
lowCount=0
vowels=0
# for i in range (0,len(st)):
# print(st[i])
for i in range (0,len(st)):
# print(st[i])
if(st[i].isupper()):
upCount+=1
else:
lowCount+=1
for i in range(0,len(st)):
if(st[i]=='a') or (st[i]=='A') or (st[i]=='e') or (st[i]==... | st = input('enter the string')
up_count = 0
low_count = 0
vowels = 0
for i in range(0, len(st)):
if st[i].isupper():
up_count += 1
else:
low_count += 1
for i in range(0, len(st)):
if st[i] == 'a' or st[i] == 'A' or st[i] == 'e' or (st[i] == 'E') or (st[i] == 'i') or (st[i] == 'I') or (st[i] ... |
class Solution:
def scoreOfParentheses(self, S):
"""
:type S: str
:rtype: int
"""
cnt, layer = 0, 0
for a, b in zip(S, S[1:]):
layer += (1 if a == '(' else -1)
if a + b == '()':
cnt += 2 ** (layer - 1)
return cnt | class Solution:
def score_of_parentheses(self, S):
"""
:type S: str
:rtype: int
"""
(cnt, layer) = (0, 0)
for (a, b) in zip(S, S[1:]):
layer += 1 if a == '(' else -1
if a + b == '()':
cnt += 2 ** (layer - 1)
return cnt |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Gender, obj[4]: Age, obj[5]: Children, obj[6]: Education, obj[7]: Occupation, obj[8]: Income, obj[9]: Bar, obj[10]: Coffeehouse, obj[11]: Restaurant20to50, obj[12]: Direction_same, obj[13]: Distance
# {"feature": "Income", "instances": 34... | def find_decision(obj):
if obj[8] <= 5:
if obj[6] <= 3:
if obj[7] > 2:
if obj[4] <= 5:
if obj[11] > 0.0:
if obj[10] > 0.0:
if obj[2] > 2:
if obj[9] <= 2.0:
... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2013 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | class Singlelist(object):
""" single list module for mini-stl(Python)
it just same as std::slist<T> in C++ sgi stl
"""
class Listnode(object):
def __init__(self):
self.next = None
self.data = None
def __del__(self):
self.next = None
self... |
# (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved.
# Validate that incident name does not contain 'X'
if 'X' in incident.name:
helper.fail("The name must not contain 'X'.")
# Validate length of the incident name
if len(incident.name) > 100:
helper.fail("The name must be less than 100 characters.")
| if 'X' in incident.name:
helper.fail("The name must not contain 'X'.")
if len(incident.name) > 100:
helper.fail('The name must be less than 100 characters.') |
class VerifierError(Exception):
pass
class VerifierTranslatorError(Exception):
pass
__all__ = ["VerifierError", "VerifierTranslatorError"]
| class Verifiererror(Exception):
pass
class Verifiertranslatorerror(Exception):
pass
__all__ = ['VerifierError', 'VerifierTranslatorError'] |
a = input()
a = int(a)
b = input()
set1 = set()
b.lower()
for x in b:
set1.add(x.lower())
if len(set1) == 26:
print("YES")
else:
print("NO")
| a = input()
a = int(a)
b = input()
set1 = set()
b.lower()
for x in b:
set1.add(x.lower())
if len(set1) == 26:
print('YES')
else:
print('NO') |
"""
def elevator_distance(array):
return sum(abs(array[i+1] - array[i]) for i in range(len(array)-1))
"""
def elevator_distance(array):
d = 0
for i in range(0, len(array) -1):
d += abs(array[i] - array[i+1])
return d
| """
def elevator_distance(array):
return sum(abs(array[i+1] - array[i]) for i in range(len(array)-1))
"""
def elevator_distance(array):
d = 0
for i in range(0, len(array) - 1):
d += abs(array[i] - array[i + 1])
return d |
# https://leetcode.com/problems/counting-bits/
#Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i.
class Solution(object):
def countBits(self, n):
"""
:type n: int
:rtype: List[int]
... | class Solution(object):
def count_bits(self, n):
"""
:type n: int
:rtype: List[int]
"""
ans = [0] * (n + 1)
for i in range(1, n + 1):
ans[i] = ans[i >> 1] + (i & 1)
return ans |
vfx = None
##
# Init midi module
#
# @param: vfx object
# @return: void
##
def init(vfx_obj):
global vfx
vfx = vfx_obj
def debug():
global vfx
if(vfx.usb_midi_connected == False):
print('Midi not connected')
pass
print("Midi trig: %s | id: %s | name: %s |active ch: %s | midi new... | vfx = None
def init(vfx_obj):
global vfx
vfx = vfx_obj
def debug():
global vfx
if vfx.usb_midi_connected == False:
print('Midi not connected')
pass
print('Midi trig: %s | id: %s | name: %s |active ch: %s | midi new: %s | clock: %s | pgm: %s | cc: %s | note: %s ' % (str(vfx.usb_midi... |
"""Preset GridWorlds module
Are used by the :obj:`~smartexploration.environments.gridworld.GridWorld` to
generate the gridworld.
"""
def easy():
"""Easy GridWorld
Returns
-------
:obj:`str`
name
double :obj:`list` of `int`
layout
:obj:`int`
scale
"""
name = "E... | """Preset GridWorlds module
Are used by the :obj:`~smartexploration.environments.gridworld.GridWorld` to
generate the gridworld.
"""
def easy():
"""Easy GridWorld
Returns
-------
:obj:`str`
name
double :obj:`list` of `int`
layout
:obj:`int`
scale
"""
name = 'Ea... |
def mail_send(to, subject, content):
print(to)
print(subject)
print(content)
| def mail_send(to, subject, content):
print(to)
print(subject)
print(content) |
SAFE_METHODS = ("GET", "HEAD", "OPTIONS")
class BasePermission(object):
"""
A base class from which all permission classes should inherit.
"""
def has_permission(self, request, view):
"""
Return `True` if permission is granted, `False` otherwise.
"""
return True
d... | safe_methods = ('GET', 'HEAD', 'OPTIONS')
class Basepermission(object):
"""
A base class from which all permission classes should inherit.
"""
def has_permission(self, request, view):
"""
Return `True` if permission is granted, `False` otherwise.
"""
return True
de... |
a = 1
b = 0
c = 0
i = 0
while True:
c = a + b
b = a
a = c
if i % 100000 == 0:
print(c)
i += 1
| a = 1
b = 0
c = 0
i = 0
while True:
c = a + b
b = a
a = c
if i % 100000 == 0:
print(c)
i += 1 |
def create_sensorinfo_file(directory):
pass
def create_metadata_file(directory):
pass
def create_delivery_note_file(directory):
pass
def create_data_delivery(directory):
pass
| def create_sensorinfo_file(directory):
pass
def create_metadata_file(directory):
pass
def create_delivery_note_file(directory):
pass
def create_data_delivery(directory):
pass |
class Plugin_OBJ():
def __init__(self, plugin_utils):
self.plugin_utils = plugin_utils
self.channels_json_url = "https://iptv-org.github.io/iptv/channels.json"
self.filter_dict = {}
self.setup_filters()
self.unfiltered_chan_json = None
self.filtered_chan_json = ... | class Plugin_Obj:
def __init__(self, plugin_utils):
self.plugin_utils = plugin_utils
self.channels_json_url = 'https://iptv-org.github.io/iptv/channels.json'
self.filter_dict = {}
self.setup_filters()
self.unfiltered_chan_json = None
self.filtered_chan_json = None
... |
# Chicago 106 problem
# try https://e-maxx.ru/algo/levit_algorithm
places, streets = list(map(int, input().split()))
graph = dict()
# dynamic = [-1 for i in range(places)]
for i in range(streets):
start, end, prob = list(map(int, input().split()))
if start not in graph:
graph[start] = list()
if end... | (places, streets) = list(map(int, input().split()))
graph = dict()
for i in range(streets):
(start, end, prob) = list(map(int, input().split()))
if start not in graph:
graph[start] = list()
if end not in graph:
graph[end] = list()
graph[start].append(end)
graph[end].append(start) |
line = input()
while line != "0 0 0 0":
line = list(map(int, line.split()))
starting = line[0]
for i in range(4):
line[i] = ((line[i] + 40 - starting) % 40) * 9
res = 360 * 3 + (360 - line[1]) % 360 + (360 + line[2] - line[1]) % 360 + (360 + line[2] - line[3]) % 360
print(res)
line ... | line = input()
while line != '0 0 0 0':
line = list(map(int, line.split()))
starting = line[0]
for i in range(4):
line[i] = (line[i] + 40 - starting) % 40 * 9
res = 360 * 3 + (360 - line[1]) % 360 + (360 + line[2] - line[1]) % 360 + (360 + line[2] - line[3]) % 360
print(res)
line = input... |
#
# PySNMP MIB module CISCO-DOT11-WIDS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-WIDS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:55:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
SETTING_SERVER_CLOCK = "RAZBERRY_CLOCK"
SETTING_SERVER_TIME = "RAZBERRY_TIME"
SETTING_LAST_UPDATE = "LAST_UPDATED"
SETTING_SERVER_ADDRRESS = "RAZBERRY_SERVER"
SETTING_SERVICE_TIMEOUT = "SERVICE_TIMEOUT" | setting_server_clock = 'RAZBERRY_CLOCK'
setting_server_time = 'RAZBERRY_TIME'
setting_last_update = 'LAST_UPDATED'
setting_server_addrress = 'RAZBERRY_SERVER'
setting_service_timeout = 'SERVICE_TIMEOUT' |
# Example 1
i = 0
while i <= 10:
print(i)
i += 1
# Example 2
available_fruits = ["Apple", "Pearl", "Banana", "Grapes"]
chosen_fruit = ''
print("We have the following available fruits: Apple, Pearl, Banana, Grapes")
while chosen_fruit not in available_fruits:
chosen_fruit = input("Please choose one of the ... | i = 0
while i <= 10:
print(i)
i += 1
available_fruits = ['Apple', 'Pearl', 'Banana', 'Grapes']
chosen_fruit = ''
print('We have the following available fruits: Apple, Pearl, Banana, Grapes')
while chosen_fruit not in available_fruits:
chosen_fruit = input('Please choose one of the options above: ')
if ... |
class PaymentError(Exception):
pass
class MpesaError(PaymentError):
pass
class InvalidTransactionAmount(MpesaError):
pass
| class Paymenterror(Exception):
pass
class Mpesaerror(PaymentError):
pass
class Invalidtransactionamount(MpesaError):
pass |
def balancedStringSplit(self, s: str) -> int:
l, r = 0, 0
c = 0
for i in range(len(s)):
if s[i] == "L":
l += 1
if s[i] == "R":
r+=1
if l == r:
c+=1
return c | def balanced_string_split(self, s: str) -> int:
(l, r) = (0, 0)
c = 0
for i in range(len(s)):
if s[i] == 'L':
l += 1
if s[i] == 'R':
r += 1
if l == r:
c += 1
return c |
def fail():
raise Exception("Ooops")
def main():
fail()
print("We will never reach here")
try:
main()
except Exception as exc:
print("Some kind of exception happened")
print(exc)
| def fail():
raise exception('Ooops')
def main():
fail()
print('We will never reach here')
try:
main()
except Exception as exc:
print('Some kind of exception happened')
print(exc) |
PREPROD_ENV = 'UAT'
PROD_ENV = 'PROD'
PREPROD_URL = "https://mercury-uat.phonepe.com"
PROD_URL = "https://mercury.phonepe.com"
URLS = {PREPROD_ENV:PREPROD_URL,PROD_ENV:PROD_URL} | preprod_env = 'UAT'
prod_env = 'PROD'
preprod_url = 'https://mercury-uat.phonepe.com'
prod_url = 'https://mercury.phonepe.com'
urls = {PREPROD_ENV: PREPROD_URL, PROD_ENV: PROD_URL} |
"""\
Bunch.py: Generic collection that can be accessed as a class. This can
be easily overrided and used as container for a variety of objects.
This program is part of the PyQuante quantum chemistry program suite
Copyright (c) 2004, Richard P. Muller. All Rights Reserved.
PyQuante version 1.2 and later is cov... | """ Bunch.py: Generic collection that can be accessed as a class. This can
be easily overrided and used as container for a variety of objects.
This program is part of the PyQuante quantum chemistry program suite
Copyright (c) 2004, Richard P. Muller. All Rights Reserved.
PyQuante version 1.2 and later is cover... |
class FanHealthStatus(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_fan_health_status(idx_name)
class FanHealthStatusColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_fans()
| class Fanhealthstatus(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_fan_health_status(idx_name)
class Fanhealthstatuscolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_fans() |
# Time: O(26 * n)
# Space: O(26 * n)
class UnionFind(object): # Time: O(n * alpha(n)), Space: O(n)
def __init__(self, n):
self.set = range(n)
self.rank = [0]*n
self.size = [1]*n
self.total = n
def find_set(self, x):
stk = []
while self.set[x] != x: # path com... | class Unionfind(object):
def __init__(self, n):
self.set = range(n)
self.rank = [0] * n
self.size = [1] * n
self.total = n
def find_set(self, x):
stk = []
while self.set[x] != x:
stk.append(x)
x = self.set[x]
while stk:
... |
__all__ = ['authorize',
'config',
'interactive',
'process']
| __all__ = ['authorize', 'config', 'interactive', 'process'] |
XM_OFF = 649.900675
YM_OFF = -25400.296854
ZM_OFF = 15786.311942
MM_00 = 0.990902
MM_01 = 0.006561
MM_02 = 0.006433
MM_10 = 0.006561
MM_11 = 0.978122
MM_12 = 0.006076
MM_20 = 0.006433
MM_21 = 0.006076
MM_22 = 0.914589
XA_OFF = 0.141424
YA_OFF = 0.380157
ZA_OFF = -0.192037
AC_00 = 100.154822
AC_01 = 0.327... | xm_off = 649.900675
ym_off = -25400.296854
zm_off = 15786.311942
mm_00 = 0.990902
mm_01 = 0.006561
mm_02 = 0.006433
mm_10 = 0.006561
mm_11 = 0.978122
mm_12 = 0.006076
mm_20 = 0.006433
mm_21 = 0.006076
mm_22 = 0.914589
xa_off = 0.141424
ya_off = 0.380157
za_off = -0.192037
ac_00 = 100.154822
ac_01 = 0.327635
ac_02 = -0.... |
# The mathematical modulo is used to calculate the remainder of the
# integer division. As an example, 102%25 is 2.
# Write a function that takes two values as parameters and returns
# the calculation of a modulo from the two values.
def mathematical_modulo(a, b):
''' divide a by b, return the remainder '''
re... | def mathematical_modulo(a, b):
""" divide a by b, return the remainder """
return a % b
print('Divide 100 by 25, remainder is: ', mathematical_modulo(100, 25))
print('Divide 102 by 25, remainder is: ', mathematical_modulo(102, 25)) |
class CohereError(Exception):
def __init__(
self,
message=None,
http_status=None,
headers=None,
) -> None:
super(CohereError, self).__init__(message)
self.message = message
self.http_status = http_status
self.headers = headers or {}
def __str... | class Cohereerror(Exception):
def __init__(self, message=None, http_status=None, headers=None) -> None:
super(CohereError, self).__init__(message)
self.message = message
self.http_status = http_status
self.headers = headers or {}
def __str__(self) -> str:
msg = self.mes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.