Documentation du module Maths

Fonctions principales

Business logic module containing basic mathematical operations.

This module provides functions to perform simple mathematical operations (addition, subtraction, square) and utilities for working with pandas DataFrames.

It also exposes a helper function to compute an operation dynamically based on its name.

app_api.maths.mon_module.add(a: int | float, b: int | float) int | float[source]

Add two numbers.

Parameters:
  • a (Number) – First number.

  • b (Number) – Second number.

Returns:

Sum of a and b.

Return type:

Number

app_api.maths.mon_module.compute_result(operation: str, a: int | float, b: int | float | None = None) int | float[source]

Compute the result of a mathematical operation.

This function acts as a dispatcher that selects the correct mathematical function depending on the operation name.

Supported operations:
  • “add”

  • “sub”

  • “square”

Parameters:
  • operation (str) – Name of the operation to execute.

  • a (Number) – First operand.

  • b (Number | None) – Second operand (optional for square).

Returns:

Result of the operation.

Return type:

Number

Raises:

ValueError – If the operation name is not supported.

app_api.maths.mon_module.print_data(df: DataFrame) int[source]

Print a DataFrame and return the number of rows.

Parameters:

df (pd.DataFrame) – Input DataFrame.

Returns:

Number of rows in the DataFrame.

Return type:

int

app_api.maths.mon_module.square(a: int | float) int | float[source]

Return the square of a number.

Parameters:

a (Number) – Input number.

Returns:

Square of a.

Return type:

Number

app_api.maths.mon_module.sub(a: int | float, b: int | float) int | float[source]

Subtract two numbers.

Parameters:
  • a (Number) – First number.

  • b (Number) – Second number.

Returns:

Result of a minus b.

Return type:

Number