Weight

rupantaran.weight.weight.from_chatak(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from chatak to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘pau’, ‘dharni’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_chatak
result = from_chatak(value=5, to_unit="kg", precision=2)
print(result)
rupantaran.weight.weight.from_dharni(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from dharni to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘lal’, ‘chatak’,’tola’, ‘pau’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_dharni
result = from_dharni(value=5, to_unit="kg", precision=2)
print(result)
rupantaran.weight.weight.from_g(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from grams to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘kg’, ‘lb’, ‘oz’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_g
result = from_g(value=5, to_unit="lb", precision=2)
print(result)
rupantaran.weight.weight.from_kg(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from kilograms to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘g’, ‘lb’, ‘oz’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_kg
result = from_kg(value=5, to_unit="lb", precision=2)
print(result)
rupantaran.weight.weight.from_lal(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from lal to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_lal
result = from_lal(value=5, to_unit="tola", precision=2)
print(result)
rupantaran.weight.weight.from_lb(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from pounds to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘g’, ‘kg’, ‘oz’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_lb
result = from_lb(value=5, to_unit="lb", precision=2)
print(result)
rupantaran.weight.weight.from_oz(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from ounces to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘g’, ‘lb’, ‘kg’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_oz
result = from_oz(value=5, to_unit="lb", precision=2)
print(result)
rupantaran.weight.weight.from_pau(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from pau to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘lal’, ‘chatak’, ‘tola’, ‘dharni’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_pau
result = from_pau(value=5, to_unit="kg", precision=2)
print(result)
rupantaran.weight.weight.from_sher(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from sher to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘lal’, ‘chatak’,’tola’, ‘pau’, ‘dharni’, ‘kg’, ‘g’, ‘lb’, ‘oz’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_sher
result = from_sher(value=5, to_unit="kg", precision=2)
print(result)
rupantaran.weight.weight.from_tola(value: float, to_unit: str, precision: int = 4) float[source]

Converts a value from tola to other weight units.

Parameters:
  • value (float) – The numeric amount to convert (must be non-negative).

  • to_unit (str) – The target weight unit (e.g., ‘lal’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).

  • precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.

Returns:

Equivalent weight in the target unit, rounded to the specified precision.

Return type:

float

Raises:

ValueError

  • If value is negative or not a number.

  • If precision is negative.

  • If to_unit is not a recognized weight unit.

Example
from rupantaran.weight import from_tola
result = from_tola(value=5, to_unit="kg", precision=2)
print(result)
rupantaran.weight.weight.weight_converter(conversion_map: dict) Callable[source]

Decorator that creates a weight conversion function using the provided conversion map.