diplomat.processing.type_casters.RangedInteger

class diplomat.processing.type_casters.RangedInteger(minimum: float, maximum: float)[source]

Bases: ConvertibleTypeCaster

Represents an integer with a restricted range of values it can take on.

__init__(minimum: float, maximum: float)[source]

Create a ranged integer type.

Parameters:
  • minimum – The minimum allowed value of this integer, a float, inclusive.

  • maximum – The maximum allowed value of this type, a float, inclusive.

Methods

__init__(minimum, maximum)

Create a ranged integer type.

to_metavar()

Convert this type to a CLI-Friendly format for display on the command line as a metavar.

to_type_hint()

Abstract method: Convert this typecaster instance to a regular type hint.

to_metavar() str[source]

Convert this type to a CLI-Friendly format for display on the command line as a metavar.

Returns:

A string, the CLI Friendly format for this type.

to_type_hint() Type[source]

Abstract method: Convert this typecaster instance to a regular type hint.

Returns:

A type from the typing module or primitive, being the underlying type this typecaster converts values to and represents.