content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class JSONRefParseError(Exception):
"""Base exception for failures when parsing."""
class DocumentParseError(JSONRefParseError):
"""Failed to parse a document."""
class ReferenceParseError(JSONRefParseError):
"""Failed to parse a reference."""
| class Jsonrefparseerror(Exception):
"""Base exception for failures when parsing."""
class Documentparseerror(JSONRefParseError):
"""Failed to parse a document."""
class Referenceparseerror(JSONRefParseError):
"""Failed to parse a reference.""" |
def number_increment(numbers):
def increase():
increased = [x + 1 for x in numbers]
return increased
return increase()
print(number_increment([1, 2, 3]))
| def number_increment(numbers):
def increase():
increased = [x + 1 for x in numbers]
return increased
return increase()
print(number_increment([1, 2, 3])) |
def part_1() -> None:
height_map: list[list[int]] = []
lowest_truths: list[list[bool]] = []
with open("../data/day9.txt") as dFile:
for row in dFile.readlines():
if (row := row.strip()) != "":
height_map.append([])
lowest_truths.append([])
... | def part_1() -> None:
height_map: list[list[int]] = []
lowest_truths: list[list[bool]] = []
with open('../data/day9.txt') as d_file:
for row in dFile.readlines():
if (row := row.strip()) != '':
height_map.append([])
lowest_truths.append([])
... |
"""
58. 4Sum
time limit exceeded
"""
class Solution:
"""
@param numbers: Give an array
@param target: An integer
@return: Find all unique quadruplets in the array which gives the sum of zero
"""
def fourSum(self, numbers, target):
# write your code here
numbers = sorted(numbers)
... | """
58. 4Sum
time limit exceeded
"""
class Solution:
"""
@param numbers: Give an array
@param target: An integer
@return: Find all unique quadruplets in the array which gives the sum of zero
"""
def four_sum(self, numbers, target):
numbers = sorted(numbers)
n = len(numbers)
... |
#!/usr/bin/env python3
# https://abc071.contest.atcoder.jp/tasks/arc081_a
d = {}
_ = input()
for x in input().split():
x = int(x)
d[x] = d.get(x, 0) + 1
p = []
for k, v in d.items():
if v >= 4: p.append(k)
if v >= 2: p.append(k)
if len(p) < 2: print(0)
else:
p.sort(reverse=True)
print(p[0] * p[1... | d = {}
_ = input()
for x in input().split():
x = int(x)
d[x] = d.get(x, 0) + 1
p = []
for (k, v) in d.items():
if v >= 4:
p.append(k)
if v >= 2:
p.append(k)
if len(p) < 2:
print(0)
else:
p.sort(reverse=True)
print(p[0] * p[1]) |
class Solution:
def solveNQueens(self, n: int) -> List[List[str]]:
ans = []
def dfs(row,tmp,cols,sums,subs):
if row==n:
ans.append(tmp)
return
for j in range(n):
if j not in cols and row+j not in sums and row-j not in subs:
... | class Solution:
def solve_n_queens(self, n: int) -> List[List[str]]:
ans = []
def dfs(row, tmp, cols, sums, subs):
if row == n:
ans.append(tmp)
return
for j in range(n):
if j not in cols and row + j not in sums and (row - j no... |
#
# PySNMP MIB module TELESYN-ATI-TC (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TELESYN-ATI-TC
# Produced by pysmi-0.3.4 at Wed May 1 12:37:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint, constraints_union) ... |
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | wpan_state = 'NCP:State'
wpan_name = 'Network:Name'
wpan_panid = 'Network:PANID'
wpan_xpanid = 'Network:XPANID'
wpan_key = 'Network:Key'
wpan_key_index = 'Network:KeyIndex'
wpan_channel = 'NCP:Channel'
wpan_hw_address = 'NCP:HardwareAddress'
wpan_ext_address = 'NCP:ExtendedAddress'
wpan_poll_interval = 'NCP:SleepyPollI... |
default_app_config = "rest_live.apps.RestLiveConfig"
DEFAULT_GROUP_BY_FIELD = "pk"
def get_group_name(model_label) -> str:
return f"RESOURCE-{model_label}"
CREATED = "CREATED"
UPDATED = "UPDATED"
DELETED = "DELETED"
| default_app_config = 'rest_live.apps.RestLiveConfig'
default_group_by_field = 'pk'
def get_group_name(model_label) -> str:
return f'RESOURCE-{model_label}'
created = 'CREATED'
updated = 'UPDATED'
deleted = 'DELETED' |
def _filter(fn, arr):
idx = 0
length = len(arr)
result = []
while idx < length:
if fn(arr[idx]):
result.append(arr[idx])
idx += 1
return result
| def _filter(fn, arr):
idx = 0
length = len(arr)
result = []
while idx < length:
if fn(arr[idx]):
result.append(arr[idx])
idx += 1
return result |
class InvalidCredentialsError(Exception):
pass
class NotAuthorisedError(Exception):
pass
class InvalidRouteUUIDError(Exception):
pass
class RouteLinkNotFound(Exception):
pass
class InvalidURLError(Exception):
pass
class InvalidRouteTokenError(Exception):
pass | class Invalidcredentialserror(Exception):
pass
class Notauthorisederror(Exception):
pass
class Invalidrouteuuiderror(Exception):
pass
class Routelinknotfound(Exception):
pass
class Invalidurlerror(Exception):
pass
class Invalidroutetokenerror(Exception):
pass |
fout = open('Street_Centrelines.csv','r') #It will open and perform read operation in file StreetCenterlines.csv
# update file
def tuple_func():
for i in fout:
i = i.split(",")
string = (i[2],i[4],i[6],i[7]) # A tuple of (STR_NAME,FULL_NAME,FROM_STR,TO_STR)
print(tuple(string))
tuple_func... | fout = open('Street_Centrelines.csv', 'r')
def tuple_func():
for i in fout:
i = i.split(',')
string = (i[2], i[4], i[6], i[7])
print(tuple(string))
tuple_func() |
verbose = False
class Controller():
name = 'WS2801'
color = [0, 255, 0]
def change_color(self, color):
print(self.name + ' - Change color to: ' + str(color))
def change_brightness(self, brightness):
print(self.name + ' - Set brightmess to : ' + str(brightness))
def set_pixels(sel... | verbose = False
class Controller:
name = 'WS2801'
color = [0, 255, 0]
def change_color(self, color):
print(self.name + ' - Change color to: ' + str(color))
def change_brightness(self, brightness):
print(self.name + ' - Set brightmess to : ' + str(brightness))
def set_pixels(self,... |
"""
Python has built-in string validation methods for basic data. It can check if a string is composed of alphabetical characters, alphanumeric characters, digits, etc.
str.isalnum()
This method checks if all the characters of a string are alphanumeric (a-z, A-Z and 0-9).
>>> print 'ab123'.isalnum()
True
>>> print 'a... | """
Python has built-in string validation methods for basic data. It can check if a string is composed of alphabetical characters, alphanumeric characters, digits, etc.
str.isalnum()
This method checks if all the characters of a string are alphanumeric (a-z, A-Z and 0-9).
>>> print 'ab123'.isalnum()
True
>>> print 'a... |
#
# PySNMP MIB module Fore-TCM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-TCM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:17:35 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
# FINDING ARE OF TRIANGLE
N = list(map(int, input().split(' ')[:2]))
print(0.5*N[0]*N[1])
| n = list(map(int, input().split(' ')[:2]))
print(0.5 * N[0] * N[1]) |
def missing_ranges(nums):
LOW, HIGH = 0, 100
nums.append(HIGH)
ranges = []
low = LOW
for num in nums:
if num == low + 1:
ranges.append(str(num - 1))
elif num > low + 1:
ranges.append("{}->{}".format(low, num - 1))
low = num + 1
return ranges
if __... | def missing_ranges(nums):
(low, high) = (0, 100)
nums.append(HIGH)
ranges = []
low = LOW
for num in nums:
if num == low + 1:
ranges.append(str(num - 1))
elif num > low + 1:
ranges.append('{}->{}'.format(low, num - 1))
low = num + 1
return ranges
if... |
while True:
num = int(input())
if num == 0:
break
a = 0
b = 0
turn_a = True
i = 0
while num != 0:
bit = num & 1
num = num >> 1
if bit == 1:
if turn_a:
a ^= (1 << i)
else:
b ^= (1 << i)
turn_a = not turn_a
i += 1
print ("{} {}".format(a, ... | while True:
num = int(input())
if num == 0:
break
a = 0
b = 0
turn_a = True
i = 0
while num != 0:
bit = num & 1
num = num >> 1
if bit == 1:
if turn_a:
a ^= 1 << i
else:
b ^= 1 << i
turn_a = no... |
N, T = map(int, input().split())
c = [0 for i in range(N)]
t = [0 for i in range(N)]
for i in range(N):
c[i], t[i] = map(int, input().split())
ans = float('inf')
flag = False
for i in range(N):
if t[i] <= T:
flag = True
if ans > c[i]:
ans = c[i]
if flag:
print(ans)
else:
print('TLE') | (n, t) = map(int, input().split())
c = [0 for i in range(N)]
t = [0 for i in range(N)]
for i in range(N):
(c[i], t[i]) = map(int, input().split())
ans = float('inf')
flag = False
for i in range(N):
if t[i] <= T:
flag = True
if ans > c[i]:
ans = c[i]
if flag:
print(ans)
else:
... |
class ArrayError(Exception):
pass
class IndexOutOfBoundsError(ArrayError):
pass
class ValueNotFoundError(Exception):
pass
| class Arrayerror(Exception):
pass
class Indexoutofboundserror(ArrayError):
pass
class Valuenotfounderror(Exception):
pass |
"""
This files originate from the "New-Empty-Python-Project-Base" template:
https://github.com/guillaume-chevalier/New-Empty-Python-Project-Base
Created by Guillaume Chevalier:
https://github.com/guillaume-chevalier
License: CC0-1.0 (Public Domain)
"""
| """
This files originate from the "New-Empty-Python-Project-Base" template:
https://github.com/guillaume-chevalier/New-Empty-Python-Project-Base
Created by Guillaume Chevalier:
https://github.com/guillaume-chevalier
License: CC0-1.0 (Public Domain)
""" |
n=int(input())
p=[]
k=0
l=list(map(int,input().split()))
l=sorted(l)
for i in range(len(l)):
c=l.count(l[i])
if(c>1):
if(l[i] not in p):
p.append(l[i])
i=i+c-1
k=k+1
if(k==0):
print("unique")
else:
for i in p:
print(i,end=" ")
... | n = int(input())
p = []
k = 0
l = list(map(int, input().split()))
l = sorted(l)
for i in range(len(l)):
c = l.count(l[i])
if c > 1:
if l[i] not in p:
p.append(l[i])
i = i + c - 1
k = k + 1
if k == 0:
print('unique')
else:
for i in p:
print(i, end=' ') |
#!/usr/bin/env python3
PIECE_SIZE = 4096
LOCALHOST = '127.0.0.1'
SERVER_PORT = 5000
CIPHER_MATRIX = [
[-3, -3, -4],
[0, 1, 1],
[4, 3, 4]
]
INVERSE_CIPHER = [
[1, 0, 1],
[4, 4, 3],
[-4, -3, -3]
]
CIPHER_ROW_LENGTH = 3
CIPHER_COL_LENGTH = 3
POLY_LENGTH = 4
CRC_POLYNOMIAL = '1011' # x^3 + x + ... | piece_size = 4096
localhost = '127.0.0.1'
server_port = 5000
cipher_matrix = [[-3, -3, -4], [0, 1, 1], [4, 3, 4]]
inverse_cipher = [[1, 0, 1], [4, 4, 3], [-4, -3, -3]]
cipher_row_length = 3
cipher_col_length = 3
poly_length = 4
crc_polynomial = '1011' |
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/1159/A
n = int(input())
ol = list(input())
ol.reverse()
c = 0
pc = 0
for o in ol:
if o=='+':
if pc==0:
c += 1
else:
pc -= 1
if o=='-':
pc += 1
print(c)
| n = int(input())
ol = list(input())
ol.reverse()
c = 0
pc = 0
for o in ol:
if o == '+':
if pc == 0:
c += 1
else:
pc -= 1
if o == '-':
pc += 1
print(c) |
_base_ = [
'./pipelines/semisl_pipeline.py'
]
__train_pipeline = {{_base_.train_pipeline}}
__train_pipeline_strong = {{_base_.train_pipeline_strong}}
__test_pipeline = {{_base_.test_pipeline}}
data = dict(
samples_per_gpu=64,
workers_per_gpu=4,
num_classes=10,
train=dict(
type='ClsTVDatase... | _base_ = ['./pipelines/semisl_pipeline.py']
__train_pipeline = {{_base_.train_pipeline}}
__train_pipeline_strong = {{_base_.train_pipeline_strong}}
__test_pipeline = {{_base_.test_pipeline}}
data = dict(samples_per_gpu=64, workers_per_gpu=4, num_classes=10, train=dict(type='ClsTVDataset', base='SVHN', data_prefix='data... |
i = 0 #defines the integer
while (i<119): #i is less than 119
print(i) #prints current value of 1
i += 10 #adds 10 to i | i = 0
while i < 119:
print(i)
i += 10 |
#
# PySNMP MIB module CISCO-DMN-DSG-VIDEO-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DMN-DSG-VIDEO-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:55:19 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, constraints_union, value_size_constraint, single_value_constraint) ... |
class DistanceMeasureBase(object):
@staticmethod
def distances(fixed_x, fixed_y, x_vec, y_vec):
'''
:param fixed_x: float
:param fixed_y: float
:param x_vec: np.array[float]
:param y_vec: np.array[float]
:return: np.array[float]
'''
raise NotImple... | class Distancemeasurebase(object):
@staticmethod
def distances(fixed_x, fixed_y, x_vec, y_vec):
"""
:param fixed_x: float
:param fixed_y: float
:param x_vec: np.array[float]
:param y_vec: np.array[float]
:return: np.array[float]
"""
raise not_imp... |
'''
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water.
Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water,
and there is exactly one island (i.e., one or more connected land cells). The island doesn't ... | """
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water.
Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water,
and there is exactly one island (i.e., one or more connected land cells). The island doesn't ... |
"""
https://leetcode.com/problems/decode-ways/
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given a non-empty string containing only digits, determine the total number of ways to decode it.
Example 1:
Input: "12"
Output: 2
Explanation:... | """
https://leetcode.com/problems/decode-ways/
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given a non-empty string containing only digits, determine the total number of ways to decode it.
Example 1:
Input: "12"
Output: 2
Explanation:... |
# -*- coding: utf-8 -*-
class SpellingDict(dict):
"""Simple dict from regex -> normalized form.
Reads from file in resource folder.
"""
def __init__(self, path):
f = open(path, 'r')
for line in f:
split = line.split('\t')
self[split[0]] = split[1].strip("\n")
... | class Spellingdict(dict):
"""Simple dict from regex -> normalized form.
Reads from file in resource folder.
"""
def __init__(self, path):
f = open(path, 'r')
for line in f:
split = line.split('\t')
self[split[0]] = split[1].strip('\n')
f.close() |
# -*- coding: utf-8 -*-
"""
Created on Sat May 29 18:48:59 2021
@author: Manuel
This code implements the Fully Convolutional DenseNetproposed by
Jegou et al. (2017) in the following publication
https://arxiv.org/abs/1611.09326 using tf.Keras.
The original implementation using Theano and Lasagne was made public on
http... | """
Created on Sat May 29 18:48:59 2021
@author: Manuel
This code implements the Fully Convolutional DenseNetproposed by
Jegou et al. (2017) in the following publication
https://arxiv.org/abs/1611.09326 using tf.Keras.
The original implementation using Theano and Lasagne was made public on
https://github.com/SimJeg/FC... |
valid_codes = (
"01",
"0101",
"010110",
"010111",
"010119",
"010120",
"010121",
"010129",
"010130",
"010190",
"0102",
"010210",
"010221",
"010229",
"010231",
"010239",
"010290",
"0103",
"010310",
"010391",
"010392",
"0104",
"010... | valid_codes = ('01', '0101', '010110', '010111', '010119', '010120', '010121', '010129', '010130', '010190', '0102', '010210', '010221', '010229', '010231', '010239', '010290', '0103', '010310', '010391', '010392', '0104', '010410', '010420', '0105', '010511', '010512', '010513', '010514', '010515', '010519', '010591',... |
# https://leetcode.com/problems/plus-one/
def plusOne(digits: list[int]) -> list[int]:
carry = 1
for i in reversed(range(len(digits))):
if carry == 0:
break
n = digits[i] + carry
carry = n//10
n = n%10
digits[i] = ... | def plus_one(digits: list[int]) -> list[int]:
carry = 1
for i in reversed(range(len(digits))):
if carry == 0:
break
n = digits[i] + carry
carry = n // 10
n = n % 10
digits[i] = n
if carry == 1:
digits.insert(0, 1)
print(digits)
plus_one([2, 9, ... |
""" common module parameters
"""
class FilePrefix():
""" file prefixes for different types of information
"""
RUN = 'run'
INFO = 'info'
GEOM = 'geom'
GRAD = 'grad'
HESS = 'hess'
CONF = 'conf'
# these may need to change downt the road
LJ = 'lj'
BATH = 'bath'
class Directo... | """ common module parameters
"""
class Fileprefix:
""" file prefixes for different types of information
"""
run = 'run'
info = 'info'
geom = 'geom'
grad = 'grad'
hess = 'hess'
conf = 'conf'
lj = 'lj'
bath = 'bath'
class Directoryname:
""" names for different types of direct... |
"""
https://leetcode.com/problems/defanging-an-ip-address/
Given a valid (IPv4) IP address, return a defanged version of that IP address.
A defanged IP address replaces every period "." with "[.]".
Example 1:
Input: address = "1.1.1.1"
Output: "1[.]1[.]1[.]1"
Example 2:
Input: address = "255.100.50.0"
Output: "25... | """
https://leetcode.com/problems/defanging-an-ip-address/
Given a valid (IPv4) IP address, return a defanged version of that IP address.
A defanged IP address replaces every period "." with "[.]".
Example 1:
Input: address = "1.1.1.1"
Output: "1[.]1[.]1[.]1"
Example 2:
Input: address = "255.100.50.0"
Output: "25... |
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | """Unit tests for partial.bzl."""
load('//lib:partial.bzl', 'partial')
load('//lib:unittest.bzl', 'asserts', 'unittest')
def _make_noargs_nokwargs():
"""Test utility for no args no kwargs case"""
return 1
def _make_args_nokwargs(arg1, arg2, arg3):
"""Test utility for args no kwargs case"""
return arg1... |
'''3. Write a Python program to find the first repeated character in a given string.'''
def first_repeated_char(str1):
for index,c in enumerate(str1):
if str1[:index+1].count(c) > 1:
return c
return "None"
print(first_repeated_char("abcdabcd"))
print(first_repeated_char("abcd"))
#Reference: w3resource | """3. Write a Python program to find the first repeated character in a given string."""
def first_repeated_char(str1):
for (index, c) in enumerate(str1):
if str1[:index + 1].count(c) > 1:
return c
return 'None'
print(first_repeated_char('abcdabcd'))
print(first_repeated_char('abcd')) |
# model settings
model = dict(
type='BYOL',
base_momentum=0.99,
backbone=dict(
type='ResNet',
depth=18,
num_stages=4,
out_indices=(3,), # no conv-1, x-1: stage-x
norm_cfg=dict(type='SyncBN'),
style='pytorch'),
neck=dict(
type='NonLinearNeck',
... | model = dict(type='BYOL', base_momentum=0.99, backbone=dict(type='ResNet', depth=18, num_stages=4, out_indices=(3,), norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict(type='NonLinearNeck', in_channels=512, hid_channels=4096, out_channels=256, num_layers=2, with_bias=True, with_last_bn=False, with_avg_pool=True)... |
# This variable stores the next DeliveryExecutiveID integer
next_deliveryexecutive_id = None
# This variable indicates whether the next_deliveryexecutive_id has been initialized
next_deliveryexecutive_id_read = 0
# @brief This class is used to handle the Delivery Executive data in ODS
# @note There is not need to cre... | next_deliveryexecutive_id = None
next_deliveryexecutive_id_read = 0
class Deliveryexecutive:
@staticmethod
def check_deliveryexecutive_signin(pysql, email, password):
sql_stmt = 'SELECT ID, Email, Password FROM DeliveryExecutive'
pysql.run(sql_stmt)
data = pysql.result
for i in... |
"""
import collections
from timeit import timeit
Pessoa = collections.namedtuple('Pessoa', 'nome email')
# criar uma class Pessoa, com atributos nome e email
felicity = Pessoa('Felicity Jones', 'felicity@gmail.com')
print(timeit('felicity.email', globals=globals()))
"""
| """
import collections
from timeit import timeit
Pessoa = collections.namedtuple('Pessoa', 'nome email')
# criar uma class Pessoa, com atributos nome e email
felicity = Pessoa('Felicity Jones', 'felicity@gmail.com')
print(timeit('felicity.email', globals=globals()))
""" |
try:
num1= int(input(" Enter the first number: "))
num2= int(input(" Enter the second number: "))
total = num1 / num2
print("The division is ", total)
except (ArithmeticError,ValueError) as msg1:
print(f"The type of exception is {type(msg1)}")
print(f"The exception class name is {msg1.__class__.... | try:
num1 = int(input(' Enter the first number: '))
num2 = int(input(' Enter the second number: '))
total = num1 / num2
print('The division is ', total)
except (ArithmeticError, ValueError) as msg1:
print(f'The type of exception is {type(msg1)}')
print(f'The exception class name is {msg1.__class... |
class FrameData():
def __init__(self):
self.rows = []
self.average_row = None
self.is_fork = False
self.is_join = False
self.veer_left = False
self.veer_right = False
self.is_straight = True
self.frame_speed = 0
self.speedL = 0
self.s... | class Framedata:
def __init__(self):
self.rows = []
self.average_row = None
self.is_fork = False
self.is_join = False
self.veer_left = False
self.veer_right = False
self.is_straight = True
self.frame_speed = 0
self.speedL = 0
self.spee... |
#
# PySNMP MIB module ALCATEL-IND1-APP-FINGERPRINT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-APP-FINGERPRINT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:16:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pyt... | (softent_ind1_app_finger_print_mib,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'softentIND1AppFingerPrintMIB')
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(... |
global errors
errors = {
}
| global errors
errors = {} |
# -*- coding: utf-8 -*-
JS_VAR_NAME = 'Urls'
JS_MINIFY = False
JS_EXCLUDE_NAMESPACES = []
JS_SCRIPT_PREFIX = None
JS_GLOBAL_OBJECT_NAME = 'this'
JS_REVERSE_USE_BACKBONE = False
| js_var_name = 'Urls'
js_minify = False
js_exclude_namespaces = []
js_script_prefix = None
js_global_object_name = 'this'
js_reverse_use_backbone = False |
class IsPangram:
def pangram(self, word):
abc = list("abcdefghijklmnopqrstuvwxyz")
w = list(word.lower())
temp = list()
for x in w:
if x in abc:
temp += x
temp = list(set(temp))
temp.sort()
if temp == abc:
return 'To... | class Ispangram:
def pangram(self, word):
abc = list('abcdefghijklmnopqrstuvwxyz')
w = list(word.lower())
temp = list()
for x in w:
if x in abc:
temp += x
temp = list(set(temp))
temp.sort()
if temp == abc:
return 'To pa... |
n=int(input())
numbers=[]; filtered=[]
for k in range(1,n+1):
num=int(input())
numbers.append(num)
command=input()
if command=="even":
for k in range(0,len(numbers)):
if abs(numbers[k])%2==0 or numbers[k]==0:
filtered.append(numbers[k])
elif command=="odd":
for k in range(... | n = int(input())
numbers = []
filtered = []
for k in range(1, n + 1):
num = int(input())
numbers.append(num)
command = input()
if command == 'even':
for k in range(0, len(numbers)):
if abs(numbers[k]) % 2 == 0 or numbers[k] == 0:
filtered.append(numbers[k])
elif command == 'odd':
for... |
class RTMValidatorError(Exception):
pass
class RTMValidatorFileError(RTMValidatorError):
"""
Raise this for any errors related to the excel file itself.
Examples:
wrong file extension
file missing
missing worksheet
"""
pass
| class Rtmvalidatorerror(Exception):
pass
class Rtmvalidatorfileerror(RTMValidatorError):
"""
Raise this for any errors related to the excel file itself.
Examples:
wrong file extension
file missing
missing worksheet
"""
pass |
class BoundingBoxNormalizationHelper:
def __init__(self, interval, range_):
assert interval in ('[)', '[]')
self.right_open = (interval == '[)')
assert range_[1] > range_[0]
self.scale = range_[1] - range_[0]
self.offset = range_[0]
def normalize(self, bbox, image_size):... | class Boundingboxnormalizationhelper:
def __init__(self, interval, range_):
assert interval in ('[)', '[]')
self.right_open = interval == '[)'
assert range_[1] > range_[0]
self.scale = range_[1] - range_[0]
self.offset = range_[0]
def normalize(self, bbox, image_size):
... |
cmapdefs = {
'bold': 'bold.json',
'boldSans': 'bold-sans.json',
'boldItalic': 'bold-italic.json', # Note: The h character is missing
'boldItalicSans': 'bold-italic-sans.json',
'italic': 'italic.json',
'italicSans': 'italic-sans.json',
'subscript': 'subscripts.json',
'superscript': 'super... | cmapdefs = {'bold': 'bold.json', 'boldSans': 'bold-sans.json', 'boldItalic': 'bold-italic.json', 'boldItalicSans': 'bold-italic-sans.json', 'italic': 'italic.json', 'italicSans': 'italic-sans.json', 'subscript': 'subscripts.json', 'superscript': 'superscripts.json', 'doubleStruck': 'doublestruck.json', 'oldEnglish': 'o... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | """Build rules for Syntaxnet."""
load('@org_tensorflow//tensorflow/core:platform/default/build_config.bzl', orig_tf_proto_library_cc='tf_proto_library_cc')
load('@org_tensorflow//tensorflow/core:platform/default/build_config.bzl', orig_tf_proto_library_py='tf_proto_library_py')
def tf_proto_library_cc(name, visibility... |
class BaseError(Exception):
def __init__(self, message, *args, **kwargs):
self.message = message
self.details = kwargs
def __str__(self):
return repr(self.message)
class InstructionError(BaseError):
def __init__(self, *args, **kwargs):
super(InstructionError, self).__init_... | class Baseerror(Exception):
def __init__(self, message, *args, **kwargs):
self.message = message
self.details = kwargs
def __str__(self):
return repr(self.message)
class Instructionerror(BaseError):
def __init__(self, *args, **kwargs):
super(InstructionError, self).__init... |
'''6. Write a Python program to compute the summation of the absolute difference of all distinct pairs in an given array (non-decreasing order).
Sample array: [1, 2, 3]
Then all the distinct pairs will be:
1 2
1 3
2 3''' | """6. Write a Python program to compute the summation of the absolute difference of all distinct pairs in an given array (non-decreasing order).
Sample array: [1, 2, 3]
Then all the distinct pairs will be:
1 2
1 3
2 3""" |
n=int(input())
matrix=[]
for k in range(0,n):
row=input()
row=row.split(" ")
matrix.append([int(e) for e in row])
while True:
command=input()
if command!="END":
if "Add" in command:
command=command.split(" ")
row=int(command[1]); col=int(command[2]); val=int(comman... | n = int(input())
matrix = []
for k in range(0, n):
row = input()
row = row.split(' ')
matrix.append([int(e) for e in row])
while True:
command = input()
if command != 'END':
if 'Add' in command:
command = command.split(' ')
row = int(command[1])
col = int(... |
""" Set of exceptions related to domain errors """
class DomainError(Exception):
""" Generic exception thrown by the domain on business logic errors """
pass
| """ Set of exceptions related to domain errors """
class Domainerror(Exception):
""" Generic exception thrown by the domain on business logic errors """
pass |
class APIError(Exception):
pass
class BadRequest(APIError):
pass
class QuotaError(APIError):
pass
class NotFoundError(APIError):
pass
class MethodNotAllowed(APIError):
pass
class ForbiddenError(APIError):
pass
class TooManyRequestsError(APIError):
pass
class InternalServerError... | class Apierror(Exception):
pass
class Badrequest(APIError):
pass
class Quotaerror(APIError):
pass
class Notfounderror(APIError):
pass
class Methodnotallowed(APIError):
pass
class Forbiddenerror(APIError):
pass
class Toomanyrequestserror(APIError):
pass
class Internalservererror(APIErr... |
class Event:
def __init__(self, target, name, data):
self.target = target
self.name = name
self.data = data | class Event:
def __init__(self, target, name, data):
self.target = target
self.name = name
self.data = data |
class DefaultableEntityEndpointsMixin(object):
"""
Defaultable entity endpoints.
"""
def set_default(self, id_):
"""
Sets a entity with given ID as default.
Args:
id_ (str): entity ID.
Returns:
dict: new entity.
"""
self.request... | class Defaultableentityendpointsmixin(object):
"""
Defaultable entity endpoints.
"""
def set_default(self, id_):
"""
Sets a entity with given ID as default.
Args:
id_ (str): entity ID.
Returns:
dict: new entity.
"""
self.request... |
img_rows, img_cols, img_chns = 128, 128, 3
latent_dim = 64
intermediate_dim = 256
epsilon_std = 1.0
epochs = 300
filters = 64
num_conv = 3
batch_size = 256
| (img_rows, img_cols, img_chns) = (128, 128, 3)
latent_dim = 64
intermediate_dim = 256
epsilon_std = 1.0
epochs = 300
filters = 64
num_conv = 3
batch_size = 256 |
LOG_URL = 'http://www.almhuette-raith.at/apache-log/access.log'
LOG_FILE_PATH = 'media'
CHUNK_SIZE = 10240
# TODO details regex group
LOG_COMPILE = r'(?P<ip_address>[\d\.]+)\s+(?P<other_1>\S+)\s+(?P<other_2>\S+)\s+' \
r'\[(?P<datetime>\S+)\s+.*\]\s+"(?P<method>\S+)\s+(?P<uri>\S+) HTTP.*"\s+' \
... | log_url = 'http://www.almhuette-raith.at/apache-log/access.log'
log_file_path = 'media'
chunk_size = 10240
log_compile = '(?P<ip_address>[\\d\\.]+)\\s+(?P<other_1>\\S+)\\s+(?P<other_2>\\S+)\\s+\\[(?P<datetime>\\S+)\\s+.*\\]\\s+"(?P<method>\\S+)\\s+(?P<uri>\\S+) HTTP.*"\\s+(?P<response_code>\\d+)\\s+(?P<response_size>\\... |
#!/usr/bin/python3
def printinfo( arg1, *vartuple ):
print("output: ")
print(arg1)
for var in vartuple:
print(var)
return
# call printinfo method
printinfo(10)
printinfo(70, 60, 50) | def printinfo(arg1, *vartuple):
print('output: ')
print(arg1)
for var in vartuple:
print(var)
return
printinfo(10)
printinfo(70, 60, 50) |
"""
Ex 03 - Create a program that reads two numbers and shows the sum between them
"""
# ---------- Header ----------
print('Sum two integers')
print('-' * 30)
# ---------- Input zone ----------
n1 = int(input('enter the first number: '))
n2 = int(input('Enter the second number: '))
# ---------- Output zone ---------... | """
Ex 03 - Create a program that reads two numbers and shows the sum between them
"""
print('Sum two integers')
print('-' * 30)
n1 = int(input('enter the first number: '))
n2 = int(input('Enter the second number: '))
s = n1 + n2
print(f'The total is: {s}')
input('Enter to exit') |
class Solution(object):
def maximalRectangle(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
t=[0 for i in range(len(matrix[0])+2)]
mxt=0
for i in range(len(matrix)):
for j in range(len(matrix[i])):
if mat... | class Solution(object):
def maximal_rectangle(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
t = [0 for i in range(len(matrix[0]) + 2)]
mxt = 0
for i in range(len(matrix)):
for j in range(len(matrix[i])):
if matri... |
def numbers_searching(*args):
duplicates = set()
missing_number = 0
nums = [int(x) for x in args]
for num in range(min(nums), max(nums) + 1):
if num not in nums:
missing_number = num
if nums.count(num) > 1:
duplicates.add(num)
return [missing_number, list(sort... | def numbers_searching(*args):
duplicates = set()
missing_number = 0
nums = [int(x) for x in args]
for num in range(min(nums), max(nums) + 1):
if num not in nums:
missing_number = num
if nums.count(num) > 1:
duplicates.add(num)
return [missing_number, list(sort... |
# -*- coding: utf-8 -*-
"""
VariableData module
This module represents the DTO that holds the params the user passes in.
We use this DTO to build the variable request
"""
# pylint: disable=too-few-public-methods
class VariableData:
"""
Used for organizing the params the user passed in to execute the variable... | """
VariableData module
This module represents the DTO that holds the params the user passes in.
We use this DTO to build the variable request
"""
class Variabledata:
"""
Used for organizing the params the user passed in to execute the variable command
"""
def __init__(self, **arg_params):
se... |
# Copyright (c) 2020 Continental Automotive GmbH
"""Functions and handles to analyse and enforce embeddings of
visual semantic concepts in DNN latent spaces."""
| """Functions and handles to analyse and enforce embeddings of
visual semantic concepts in DNN latent spaces.""" |
def part1(ins):
h = 0
v = 0
for a, b in ins:
match a:
case "forward":
h += b
case "down":
v += b
case "up":
v -= b
return h * v
def part2(ins):
h = 0
v = 0
aim = 0
for a, b in ins:
match... | def part1(ins):
h = 0
v = 0
for (a, b) in ins:
match a:
case 'forward':
h += b
case 'down':
v += b
case 'up':
v -= b
return h * v
def part2(ins):
h = 0
v = 0
aim = 0
for (a, b) in ins:
ma... |
#!/usr/bin/env python
"""
simple_tsp/helpers.py
"""
def route2cost(route, dist):
assert route[0] == 0
assert route[-1] == 0
return dist[(route[:-1], route[1:])].sum()
| """
simple_tsp/helpers.py
"""
def route2cost(route, dist):
assert route[0] == 0
assert route[-1] == 0
return dist[route[:-1], route[1:]].sum() |
def decorate_lowercase(function):
def lowerfy():
funcaa = function()
string_lower = funcaa.lower()
return string_lower
return lowerfy
def splitfy(function):
def splitt():
s_value = function()
str_list = s_value.split()
return str_list
return splitt
@splitfy
@decorate_lowercase
def hello():
return "... | def decorate_lowercase(function):
def lowerfy():
funcaa = function()
string_lower = funcaa.lower()
return string_lower
return lowerfy
def splitfy(function):
def splitt():
s_value = function()
str_list = s_value.split()
return str_list
return splitt
@sp... |
# WebDriver specification ID: dfn-error-response-data
errors = {
"element click intercepted": 400,
"element not selectable": 400,
"element not interactable": 400,
"insecure certificate": 400,
"invalid argument": 400,
"invalid cookie domain": 400,
"invalid coordinates": 400,
"invalid elem... | errors = {'element click intercepted': 400, 'element not selectable': 400, 'element not interactable': 400, 'insecure certificate': 400, 'invalid argument': 400, 'invalid cookie domain': 400, 'invalid coordinates': 400, 'invalid element state': 400, 'invalid selector': 400, 'invalid session id': 404, 'javascript error'... |
"""
Q062
Unique Paths
Medium
A robot is located at the top-left corner of a m x n grid
(marked 'Start' in the diagram below).
The robot can only move either down or right at any point
in time. The robot is trying to reach the bottom-right
corner of the grid (marked 'Finish' in the diagram below).
How many possible u... | """
Q062
Unique Paths
Medium
A robot is located at the top-left corner of a m x n grid
(marked 'Start' in the diagram below).
The robot can only move either down or right at any point
in time. The robot is trying to reach the bottom-right
corner of the grid (marked 'Finish' in the diagram below).
How many possible u... |
# ITERACTION BY ITEM
numbers = [0,1,2,3,4,5]
for number in numbers: # For Loops, number is the index and numbers is the lenght of the loops
print(number)
# EXAMPLE
for number in numbers:
if number > 1 and number < 4:
print(number) | numbers = [0, 1, 2, 3, 4, 5]
for number in numbers:
print(number)
for number in numbers:
if number > 1 and number < 4:
print(number) |
class Solution:
# Time complexity: O(n) where n the length of pushed is
# Space complexity: O(n)
def validateStackSequences(self, pushed, popped):
j = 0
stack = []
for x in pushed:
stack.append(x)
while stack and j < len(popped) and stack[-1] == popped[j]:
... | class Solution:
def validate_stack_sequences(self, pushed, popped):
j = 0
stack = []
for x in pushed:
stack.append(x)
while stack and j < len(popped) and (stack[-1] == popped[j]):
stack.pop()
j += 1
return j == len(popped) |
def main() -> None:
a, b = map(int, input().split())
print("Yes" if a <= b <= 6 * a else "No")
main()
| def main() -> None:
(a, b) = map(int, input().split())
print('Yes' if a <= b <= 6 * a else 'No')
main() |
def load(h):
return ({'abbr': 'ERS-1', 'code': 1, 'title': 'ERS 1'},
{'abbr': 'ERS-2', 'code': 2, 'title': 'ERS 2'},
{'abbr': 'METOP-B', 'code': 3, 'title': 'METOP-B'},
{'abbr': 'METOP-A', 'code': 4, 'title': 'METOP-A'},
{'abbr': 'CHAMP', 'code': 41, 'title': 'CHAMP'}... | def load(h):
return ({'abbr': 'ERS-1', 'code': 1, 'title': 'ERS 1'}, {'abbr': 'ERS-2', 'code': 2, 'title': 'ERS 2'}, {'abbr': 'METOP-B', 'code': 3, 'title': 'METOP-B'}, {'abbr': 'METOP-A', 'code': 4, 'title': 'METOP-A'}, {'abbr': 'CHAMP', 'code': 41, 'title': 'CHAMP'}, {'abbr': 'TERRA-SAR-X', 'code': 42, 'title': '... |
# All of these resources have been gathered from:
# https://github.com/privacycloud/consent-manager-web-ext/
# Published under the MIT license
def getrules():
rules = {
'google.com':
'#epbar, #cnsh, #pushdown, #consent-bump, #taw ._pei, #cnsi ~ [jsaction*="dismiss"], g-dialog, g-bottom-sheet, .gb_bd... | def getrules():
rules = {'google.com': '#epbar, #cnsh, #pushdown, #consent-bump, #taw ._pei, #cnsi ~ [jsaction*="dismiss"], g-dialog, g-bottom-sheet, .gb_bd[aria-label][role="dialog"][style*="#default#userData"]', 'facebook.com': '#page > #header-notices', 'gmail.com': '#epbar, #cnsh, #pushdown, #consent-bump, #taw... |
messages = { '2021-03-18':"<b>@all</b>, Comment reviewers for next week are- Rahul and Rohan J." ,
'2021-03-26':"<b>@all</b>, Comment reviewers for next week are- Akkul and Rohan D.",
'2021-04-01':"<b>@all</b>, Comment reviewers for next week are- Annapoorani and Shivahari.",
'2021-0... | messages = {'2021-03-18': '<b>@all</b>, Comment reviewers for next week are- Rahul and Rohan J.', '2021-03-26': '<b>@all</b>, Comment reviewers for next week are- Akkul and Rohan D.', '2021-04-01': '<b>@all</b>, Comment reviewers for next week are- Annapoorani and Shivahari.', '2021-04-08': '<b>@all</b>, Comment review... |
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
if m1 != m2:
print(1)
else:
print(0)
| (m1, d1) = map(int, input().split())
(m2, d2) = map(int, input().split())
if m1 != m2:
print(1)
else:
print(0) |
"""
Warmup-1 > diff21
Find this problem at:
https://codingbat.com/prob/p197466
"""
def diff21(n):
if n > 21:
return abs(2*(n-21))
return 21 - n
| """
Warmup-1 > diff21
Find this problem at:
https://codingbat.com/prob/p197466
"""
def diff21(n):
if n > 21:
return abs(2 * (n - 21))
return 21 - n |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: MNN
class BinaryOpOperation(object):
ADD = 0
SUB = 1
MUL = 2
DIV = 3
MAX_TEMP = 4
MIN_TEMP = 5
POW = 6
REALDIV = 7
MINIMUM = 8
MAXIMUM = 9
GREATER = 10
GREATER_EQUAL = 11
LESS = 12
... | class Binaryopoperation(object):
add = 0
sub = 1
mul = 2
div = 3
max_temp = 4
min_temp = 5
pow = 6
realdiv = 7
minimum = 8
maximum = 9
greater = 10
greater_equal = 11
less = 12
floordiv = 13
squared_difference = 14
equal = 15
less_equal = 16
floorm... |
class Pessoa:
def __init__(self,nome,idade,cpf,salario):
self.nome = nome
self.idade = idade
self.cpf = cpf
self.salario = salario
def Aumento(self):
return self.salario *0.05
class Gerente(Pessoa):
def __init__(self,nome,idade,cpf,salario,senha):
... | class Pessoa:
def __init__(self, nome, idade, cpf, salario):
self.nome = nome
self.idade = idade
self.cpf = cpf
self.salario = salario
def aumento(self):
return self.salario * 0.05
class Gerente(Pessoa):
def __init__(self, nome, idade, cpf, salario, senha):
... |
"""Top-level package for Tinned Python."""
__author__ = """Tom Finill"""
__email__ = 'tomfinill@gmail.com'
__version__ = '0.1.0'
| """Top-level package for Tinned Python."""
__author__ = 'Tom Finill'
__email__ = 'tomfinill@gmail.com'
__version__ = '0.1.0' |
#Reverse the input array
# input : {5,4,3,2,1}
# output : {1,2,3,4,5}
arr = list(map(int,input().split()))
for i in range(len(arr)):
arr.push(a[-1])
arr.remove(a[-1])
print(arr) | arr = list(map(int, input().split()))
for i in range(len(arr)):
arr.push(a[-1])
arr.remove(a[-1])
print(arr) |
def mergesort(items):
if len(items) <= 1:
return items
mid = len(items) // 2
left = items[:mid]
right = items[mid:]
left = mergesort(left)
right = mergesort(right)
return merge(left, right)
def merge(left, right):
merged = []
left_index = 0
right_index... | def mergesort(items):
if len(items) <= 1:
return items
mid = len(items) // 2
left = items[:mid]
right = items[mid:]
left = mergesort(left)
right = mergesort(right)
return merge(left, right)
def merge(left, right):
merged = []
left_index = 0
right_index = 0
while left... |
#Se crean los inputs
rate = input("Enter Rate:")
hrs = input("Enter Hours:")
#Se toman los valores y se convierten en float ambos por que string y float no se pueden multiplicar directamente
pay = float(rate) * float(hrs)
#Se imprime el resultado de pay
print("Pay:",pay) | rate = input('Enter Rate:')
hrs = input('Enter Hours:')
pay = float(rate) * float(hrs)
print('Pay:', pay) |
class response():
def __init__(self) -> None:
self.num = 5
def call_result(self):
return(self.num) | class Response:
def __init__(self) -> None:
self.num = 5
def call_result(self):
return self.num |
n = int(input())
if n == 7 or n == 5 or n== 3:
print("YES")
else:
print("NO") | n = int(input())
if n == 7 or n == 5 or n == 3:
print('YES')
else:
print('NO') |
# Sample program illustrating programmer-defined functions
# along with code that calls the functions
#
# The 'cube_root' function uses a 'return' statement. Its
# only job is to calculate and "return" the cube root of a
# number. It does not print anything. Notice that statements
# that "call" the 'cube_root' func... | def cube_root(x):
if x < 0:
result = -(-x) ** (1.0 / 3.0)
else:
result = x ** (1.0 / 3.0)
return result
def main():
print("Let's examine the cube roots of some numbers.\n")
num = 27
root = cube_root(num)
print('Cube root of ' + str(num) + ' is ' + format(root, '.1f'))
ro... |
class Wallet:
def __init__(self, stocks, initial_account=3000):
self.stocks_amount = 0
for stock in stocks:
self.stocks_amount += stock.getCostPrice()
self.available_cash = initial_account - \
self.stocks_amount # argent disponible en cash
self.virtual_acco... | class Wallet:
def __init__(self, stocks, initial_account=3000):
self.stocks_amount = 0
for stock in stocks:
self.stocks_amount += stock.getCostPrice()
self.available_cash = initial_account - self.stocks_amount
self.virtual_account = initial_account
self.total_com... |
class Node:
def __init__(self, parent, rank=0, size=1):
self.parent = parent
self.rank = rank
self.size = size
def __repr__(self):
return '(parent=%s, rank=%s, size=%s)' % (self.parent, self.rank, self.size)
class Forest:
def __init__(self, num_nodes):
self.nodes = ... | class Node:
def __init__(self, parent, rank=0, size=1):
self.parent = parent
self.rank = rank
self.size = size
def __repr__(self):
return '(parent=%s, rank=%s, size=%s)' % (self.parent, self.rank, self.size)
class Forest:
def __init__(self, num_nodes):
self.nodes ... |
"""
Temperature Scale Converter
- Converts celsius sclae to fahrenheit and vice-versa
Author : (Niyoj Oli)[https://github.com/niyoj]
Date : 24/09/21
"""
temp = input("Input the temperature you would like to convert? (e.g., 45F, 102C etc.) : ")
degree = int(temp[:-1])
i_convention = temp[-1]
if i_convention.upper() =... | """
Temperature Scale Converter
- Converts celsius sclae to fahrenheit and vice-versa
Author : (Niyoj Oli)[https://github.com/niyoj]
Date : 24/09/21
"""
temp = input('Input the temperature you would like to convert? (e.g., 45F, 102C etc.) : ')
degree = int(temp[:-1])
i_convention = temp[-1]
if i_convention.upper() == ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Irreversible Lock Date',
'version': '1.0',
'category': 'Accounting/Accounting',
'description': """
Make the lock date irreversible:
* You cannot set stricter restrictions on advisors th... | {'name': 'Irreversible Lock Date', 'version': '1.0', 'category': 'Accounting/Accounting', 'description': '\n Make the lock date irreversible:\n\n * You cannot set stricter restrictions on advisors than on users. Therefore, the All Users Lock Date must be anterior (or equal) to the Invoice/Bills Lock Date.\n * ... |
load("@rules_pmd//pmd:dependencies.bzl", "rules_pmd_dependencies")
load("@bazelrio//:defs.bzl", "setup_bazelrio")
load("@bazelrio//:deps.bzl", "setup_bazelrio_dependencies")
def setup_dependencies():
rules_pmd_dependencies()
setup_bazelrio_dependencies(
toolchain_versions = "2022-1",
wpilib_ver... | load('@rules_pmd//pmd:dependencies.bzl', 'rules_pmd_dependencies')
load('@bazelrio//:defs.bzl', 'setup_bazelrio')
load('@bazelrio//:deps.bzl', 'setup_bazelrio_dependencies')
def setup_dependencies():
rules_pmd_dependencies()
setup_bazelrio_dependencies(toolchain_versions='2022-1', wpilib_version='2022.4.1', ni... |
class Selectors(object):
def setup_bot(self, settings, spec, items, extractors, logger):
self.logger = logger
self.selectors = {} # { template_id: { field_name: {..} }
for template in spec['templates']:
template_id = template.get('page_id')
self.selectors[template_i... | class Selectors(object):
def setup_bot(self, settings, spec, items, extractors, logger):
self.logger = logger
self.selectors = {}
for template in spec['templates']:
template_id = template.get('page_id')
self.selectors[template_id] = template.get('selectors', {})
... |
# Daniel Mc Callion
# function yo takes one parameter
def yo(a):
return a * 2
# here we are calling the function yo
# and are passingin an argument, 3
yo(3)
# a. nothing no print but returns 6
# b. print(yo(3))
| def yo(a):
return a * 2
yo(3) |
result = [0, 0, 0]
diff = 22
for a in range(int(200/21.99) + 1):
for b in range(int((200 - 21.99*a)//18.05)+1):
c = int((200 - 21.99 * a - 18.05 * b)//15.99) + 1
if diff > (21.99 * a + 18.05 * b + 15.99 * c - 200):
diff = 21.99 * a + 18.05 * b + 15.99 * c - 200
result = [a, b... | result = [0, 0, 0]
diff = 22
for a in range(int(200 / 21.99) + 1):
for b in range(int((200 - 21.99 * a) // 18.05) + 1):
c = int((200 - 21.99 * a - 18.05 * b) // 15.99) + 1
if diff > 21.99 * a + 18.05 * b + 15.99 * c - 200:
diff = 21.99 * a + 18.05 * b + 15.99 * c - 200
result... |
# question can be found on leetcode.com/problems/count-odd-numbers-in-an-interval-range/
class Solution:
def countOdds(self, low: int, high: int) -> int:
number = (high - low + 1) // 2
if low % 2 != 0 and high % 2 != 0:
return number + 1
else:
return number
| class Solution:
def count_odds(self, low: int, high: int) -> int:
number = (high - low + 1) // 2
if low % 2 != 0 and high % 2 != 0:
return number + 1
else:
return number |
# -*- coding: utf-8 -*-
__all__ = [
'BASE',
'LB',
'TOPOLOGY_MAP'
]
BASE = {
# can be overriden by a configuration file
'SHARED_MEM_HOSTNAME': '127.0.0.1',
'SHARED_MEM_STATE_TIMESTAMP_KEY': 'polaris_health:state_timestamp',
'SHARED_MEM_GENERIC_STATE_KEY': 'polaris_health:generic_state',
... | __all__ = ['BASE', 'LB', 'TOPOLOGY_MAP']
base = {'SHARED_MEM_HOSTNAME': '127.0.0.1', 'SHARED_MEM_STATE_TIMESTAMP_KEY': 'polaris_health:state_timestamp', 'SHARED_MEM_GENERIC_STATE_KEY': 'polaris_health:generic_state', 'SHARED_MEM_PPDNS_STATE_KEY': 'polaris_health:ppdns_state', 'SHARED_MEM_HEARTBEAT_KEY': 'polaris_health... |
def subtract(a,b):
c=a-b
return c
def summate(a,b):
c=a+b
return c
def sumKM(a,b):
c=(a+b)/1000.
return c
def minusX10(a,b):
c = (a-b)*10
return c
def divAdd5(a,b):
c = (a/b)+5
return c
if __name__ == "__main__":
print("Run from import") | def subtract(a, b):
c = a - b
return c
def summate(a, b):
c = a + b
return c
def sum_km(a, b):
c = (a + b) / 1000.0
return c
def minus_x10(a, b):
c = (a - b) * 10
return c
def div_add5(a, b):
c = a / b + 5
return c
if __name__ == '__main__':
print('Run from import') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.