aind_metadata_mapper package#

Subpackages#

Submodules#

aind_metadata_mapper.core module#

aind_metadata_mapper.core_models module#

Module to define core generic models

class aind_metadata_mapper.core_models.BaseJobSettings(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_nested_max_split: int | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_flag_prefix_char: str | None = None, _cli_implicit_flags: bool | None = None, _cli_ignore_unknown_args: bool | None = None, _cli_kebab_case: bool | None = None, _secrets_dir: PathType | None = None, *, job_settings_name: str, input_source: Optional[Union[Path, str, List[str], List[Path]]] = None, output_directory: Optional[Union[Path, str]] = None, user_settings_config_file: Optional[Union[Path, str]] = None, **values: Any)#

Bases: BaseSettings

Parent class for generating settings from a config file.

class Config#

Bases: object

Pydantic config to exclude field from displaying

exclude = {'user_settings_config_file'}#
extra = 'allow'#
classmethod from_args(args: list)#

Adds ability to construct settings from a list of arguments. :param args: :type args: list :param A list of command line arguments to parse.:

input_source: Optional[Union[Path, str, List[str], List[Path]]]#
job_settings_name: str#
model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': '', 'exclude': {'user_settings_config_file'}, 'extra': 'allow', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_file': None, 'yaml_file_encoding': None}#

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

output_directory: Optional[Union[Path, str]]#
classmethod settings_customise_sources(settings_cls: Type[BaseSettings], init_settings: InitSettingsSource, env_settings: EnvSettingsSource, dotenv_settings: PydanticBaseSettingsSource, file_secret_settings: PydanticBaseSettingsSource) Tuple[PydanticBaseSettingsSource, ...]#

Customize the order of settings sources, including JSON file.

user_settings_config_file: Optional[Union[Path, str]]#
class aind_metadata_mapper.core_models.JobResponse(*, status_code: int, message: Optional[str] = None, data: Optional[str] = None)#

Bases: BaseModel

Standard model of a JobResponse.

data: Optional[str]#
message: Optional[str]#
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#

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

status_code: int#
class aind_metadata_mapper.core_models.JsonConfigSettingsSource(settings_cls, config_file_location: Path)#

Bases: PydanticBaseSettingsSource

Base class for settings that parse JSON from various sources.

get_field_value(field: FieldInfo, field_name: str) Tuple[Any, str, bool]#

Gets the value, the key for model creation, and a flag to determine whether value is complex. :param field: The field :type field: FieldInfo :param field_name: The field name :type field_name: str

Returns:

A tuple contains the key, value and a flag to determine whether value is complex.

Return type:

Tuple[Any, str, bool]

prepare_field_value(field_name: str, field: FieldInfo, value: Any, value_is_complex: bool) Any#

Prepares the value of a field. :param field_name: The field name :type field_name: str :param field: The field :type field: FieldInfo :param value: The value of the field that has to be prepared :type value: Any :param value_is_complex: A flag to determine whether value is complex :type value_is_complex: bool

Returns:

The prepared value

Return type:

Any

aind_metadata_mapper.gather_metadata module#

aind_metadata_mapper.models module#

Module contents#

Init package