module_that_can_be_invoked_from_cli module#
Calculate arithmetic expressions from command line.
- class CalculatorType(value)[source]#
-
Define supported calculator types.
- BINARY = 'binary'#
- GENERAL = 'general'#
- class BinaryInputs(*, calculator_type, first_number, operator, second_number)[source]#
Bases:
pydantic.main.BaseModel
Define arguments for binary calculator.
- calculator_type#
kind of calculator
- Type:
typing.Literal[CalculatorType.BINARY]
- operator#
arithmetic operator to be used
- Type:
BinaryArithmeticOperator
- calculator_type: Literal[module_that_can_be_invoked_from_cli.CalculatorType.BINARY]#
- operator: package_name_to_import_with.calculator_sub_package.wrapper_module.BinaryArithmeticOperator#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'calculator_type': FieldInfo(annotation=Literal[<CalculatorType.BINARY: 'binary'>], required=True), 'first_number': FieldInfo(annotation=float, required=True), 'operator': FieldInfo(annotation=BinaryArithmeticOperator, required=True), 'second_number': FieldInfo(annotation=float, required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class GeneralInputs(*, calculator_type, expression)[source]#
Bases:
pydantic.main.BaseModel
Define arguments of general calculator.
- calculator_type#
kind of calculator
- Type:
typing.Literal[CalculatorType.GENERAL]
- calculator_type: Literal[module_that_can_be_invoked_from_cli.CalculatorType.GENERAL]#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'calculator_type': FieldInfo(annotation=Literal[<CalculatorType.GENERAL: 'general'>], required=True), 'expression': FieldInfo(annotation=str, required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class UserInputs(*, inputs)[source]#
Bases:
pydantic.main.BaseModel
Define sub-commands and arguments of CLI calculator.
- inputs#
inputs for the calculator
- Type:
BinaryInputs | GeneralInputs
- inputs: module_that_can_be_invoked_from_cli.BinaryInputs | module_that_can_be_invoked_from_cli.GeneralInputs#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'inputs': FieldInfo(annotation=Union[BinaryInputs, GeneralInputs], required=True, discriminator='calculator_type')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.