Integer

class Integer

Bases: CommonBaseModel

Represents an integer data type with enhanced attributes for engineering applications.

value

The actual integer value.

Type:

int

units

Units of the variable, allowing for dimensional analysis.

Type:

str

description

A brief description of the variable.

Type:

Optional[str]

default

Default integer value of the variable, if any.

Type:

Optional[int]

metadata

Optional[Metadata]): Additional metadata for the variable.

Type:

Optional[Metadata]

Raises:

ValidationError – If the input value does not meet the validation criteria.

Attributes Summary

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Summary

validate_default(value, values)

Validate and convert the default value to an integer if it's provided as a string.

Attributes Documentation

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'protected_namespaces': (), 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Documentation

classmethod validate_default(value, values)

Validate and convert the default value to an integer if it’s provided as a string.

Parameters:
  • value (int | None) – The default value being validated.

  • values (dict) – The dictionary containing the field values.

Returns:

The validated default value.

Raises:

ValueError – If the default value is a string that cannot be converted to an integer.

Return type:

int | None

Methods:

validate_default(value, values)

Validate and convert the default value to an integer if it's provided as a string.

Attributes:

__pydantic_setattr_handlers__

__setattr__ handlers.

classmethod validate_default(value, values)

Validate and convert the default value to an integer if it’s provided as a string.

Parameters:
  • value (int | None) – The default value being validated.

  • values (dict) – The dictionary containing the field values.

Returns:

The validated default value.

Raises:

ValueError – If the default value is a string that cannot be converted to an integer.

Return type:

int | None

__pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}

__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__