package_name_to_import_with package#

Subpackages#

Submodules#

Module contents#

Expose selected package contents.

class BinaryArithmeticOperator(value)[source]#

Bases: str, enum.Enum

Define supported arithmetic operators.

ADDITION = '+'#
SUBTRACTION = '-'#
MULTIPLICATION = '*'#
DIVISION = '/'#
calculate_results(first_input, operator, second_input)[source]#

Perform basic binary arithmetic expressions.

Parameters:
  • first_input (float) -- left operand of binary arithmetic expression

  • operator (BinaryArithmeticOperator) -- kind of binary arithmetic expression

  • second_input (float) -- right operand of binary arithmetic expression

Returns:

result of binary arithmetic expression

Return type:

float

Examples

>>> from package_name_to_import_with import calculate_results
>>> calculate_results(1, "+", 2)
3.0
>>> calculate_results(1, "-", 2)
-1.0
>>> calculate_results(1, "*", 2)
2.0
>>> calculate_results(1, "/", 2)
0.5
define_garbage_collection_decorator(function_to_be_decorated)[source]#

Perform forcefully garbage collection after execution of provided function.

Parameters:

function_to_be_decorated (FunctionType) -- function whose execution may require forceful garbage collection

Returns:

decorated function

Return type:

FunctionType

solve_simplification(expression)[source]#

Evaluate arithmetic expression.

Parameters:

expression (str) -- standard arithmetic expression

Returns:

result of arithmetic expression

Return type:

float

Examples

>>> from package_name_to_import_with import solve_simplification
>>> solve_simplification("0 + 1 - 2 * 3 / 4")
-0.5
>>> solve_simplification("5 * 6 / (7 + 8) - 9")
-7.0