package_name_to_import_with package#
Subpackages#
Submodules#
- package_name_to_import_with.data_using_module module
PackageMetadataPackageMetadata.NamePackageMetadata.VersionPackageMetadata.DescriptionPackageMetadata.KeywordsPackageMetadata.LicensePackageMetadata.MaintainersPackageMetadata.AuthorsPackageMetadata.LinksPackageMetadata.NamePackageMetadata.VersionPackageMetadata.DescriptionPackageMetadata.KeywordsPackageMetadata.LicensePackageMetadata.MaintainersPackageMetadata.AuthorsPackageMetadata.LinksPackageMetadata.validate_versionPackageMetadata.model_computed_fields
- package_name_to_import_with.garbage_collection_module module
- package_name_to_import_with.simplify module
- package_name_to_import_with.utils module
Module contents#
Expose selected package contents.
- class BinaryArithmeticOperator(value)[source]#
Bases:
CustomStrEnumDefine supported arithmetic operators.
- ADDITION = '+'#
- SUBTRACTION = '-'#
- MULTIPLICATION = '*'#
- DIVISION = '/'#
- pydantic model CustomPydanticBaseModel[source]#
Bases:
BaseModelInherit pydantic.BaseModel and change behaviour to handle undefined attributes.
Show JSON schema
{ "title": "CustomPydanticBaseModel", "description": "Inherit `pydantic.BaseModel` and change behaviour to handle undefined attributes.", "type": "object", "properties": {}, "additionalProperties": false }
- Config:
extra: str = forbid
- calculate_results(first_input: float, operator: BinaryArithmeticOperator, second_input: float) float[source]#
Perform basic binary arithmetic expressions.
- Parameters:
first_input (
float) -- left operand of binary arithmetic expressionoperator (
BinaryArithmeticOperator) -- kind of binary arithmetic expressionsecond_input (
float) -- right operand of binary arithmetic expression
- Returns:
result of binary arithmetic expression
- Return type:
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: Callable[[...], Any]) Callable[[...], Any][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: str) float[source]#
Evaluate arithmetic expression.
- Parameters:
expression (
str) -- standard arithmetic expression- Returns:
result of arithmetic expression
- Return type:
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