ats_utilities.generator.generator_bundle module

Module

generator_bundle.py

Copyright

Copyright (C) 2017 - 2026 Vladimir Roncevic <elektron.ronca@gmail.com> ats_utilities is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ats_utilities is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Info

Defines parameter bundle dataclass for template generation. Encapsulates template generation parameters for simplifcation.

class ats_utilities.generator.generator_bundle.GeneratorBundle(archive_path: str, target_dir: str, template_key: str, scheme: dict[str, Any] | str, template_values: dict[str, str])[source]

Bases: object

Defines class GeneratorBundle with method(s). Encapsulates template generation parameters for simplifcation.

It defines:

attributes:
archive_path - Path to the .tgz archive.
target_dir - Directory where the project will be generated.
template_key - Key for the template configuration.
scheme - Scheme configuration.
template_values - Template values for name case variations.
methods:
validate - Validates that essential components are set.
merge - Merges non-None values from another bundle into this one.
to_dict - Converts the bundle attributes to a dictionary.
archive_path: str
merge(other: GeneratorBundle) None[source]

Merges non-None values from another bundle into this one.

Parameters:

other (<GeneratorBundle>) – Another bundle to merge into this one.

Exceptions:

None.

scheme: dict[str, Any] | str
target_dir: str
template_key: str
template_values: dict[str, str]
to_dict() dict[str, Any][source]

Converts the bundle attributes to a dictionary.

Returns:

Dictionary representation of the bundle attributes.

Return type:

<dict[str, Any]>

Exceptions:

None.

validate() None[source]

Validates that essential components are set.

Exceptions:
ATSValueError: Archive_path must be set.
ATSValueError: Target_dir must be set.
ATSValueError: Template_key must be set.
ATSValueError: Scheme must be set.
ATSValueError: Template_values must be set.
ATSTypeError: Types of fields must be correct.