Dummy Python Package

Math Utilities

math_utils.py - A dummy module for demonstration.

class py_pkg.math_utils.Calculator

Bases: object

A simple calculator class for basic arithmetic operations.

add(a, b)

Add two numbers.

Parameters:
  • a (float or int) – First number.

  • b (float or int) – Second number.

Returns:

The sum of a and b.

Return type:

float or int

divide(a, b)

Divide one number by another.

Parameters:
  • a (float or int) – Numerator.

  • b (float or int) – Denominator.

Returns:

The result of a / b.

Return type:

float

Raises:

ValueError – If b is zero.

multiply(a, b)

Multiply two numbers.

Parameters:
  • a (float or int) – First number.

  • b (float or int) – Second number.

Returns:

The product of a and b.

Return type:

float or int

subtract(a, b)

Subtract one number from another.

Parameters:
  • a (float or int) – First number.

  • b (float or int) – Second number to subtract from the first.

Returns:

The result of a - b.

Return type:

float or int

py_pkg.math_utils.square(x)

Calculate the square of a number.

Parameters:

x (float or int) – The number to be squared.

Returns:

The square of the input number.

Return type:

float or int

String Utilities

string_utils.py - A dummy module for demonstration.

class py_pkg.string_utils.Formatter

Bases: object

A class for formatting strings.

surround(text, symbol='*')

Surround text with a given symbol.

Parameters:
  • text (str) – The input string to surround.

  • symbol (str, optional) – The symbol to use for surrounding (default is ‘*’).

Returns:

The formatted string with symbols surrounding the text.

Return type:

str

py_pkg.string_utils.shout(text)

Convert text to uppercase.

Parameters:

text (str) – The input string to convert.

Returns:

The uppercase version of the input string.

Return type:

str