ats_utilities.splasher.splash_center_bundle module

Module

splash_center_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

Encapsulates runtime parameters for centering console output.

class ats_utilities.splasher.splash_center_bundle.SplashCenterBundle(*, columns: int = 0, additional_shifter: int = 0, text: str | None = None)[source]

Bases: object

Encapsulates runtime parameters for console output centering.

It defines:

attributes:
columns - Column count for console session (default 0).
additional_shifter - Additional shifters (default 0).
text - Text for console session (default None).
methods:
__post_init__ - Post initialization of the SplashCenterBundle.
validate - Validates that SplashCenterBundle is valid (can be called after merge).
merge - Merges non-None values from another bundle into this one.
to_dict - Converts the SplashCenterBundle instance to a dictionary.
additional_shifter: int
columns: int
merge(other: SplashCenterBundle) None[source]

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

Parameters:

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

Exceptions:
ATSTypeError: Other must be a SplashCenterBundle instance.
text: str | None
to_dict() dict[str, Any][source]

Converts the SplashCenterBundle instance to a dictionary.

Returns:

Dictionary representation of the SplashCenterBundle instance.

Return type:

<dict[str, Any]>

Exceptions:

None.

validate() None[source]

Validates that SplashCenterBundle is valid (can be called after merge). Performs validation of columns, additional_shifter and text attributes. Columns must be non-None and an instance of integer. Additional_shifter must be non-None and an instance of integer. Text must be non-None and an instance of string.

Exceptions:
ATSTypeError: Columns count ‘columns’ is not an integer.
ATSValueError: Columns count ‘columns’ cannot be negative.
ATSTypeError: Additional shifter ‘additional_shifter’ is not an integer.
ATSValueError: Additional shifter ‘additional_shifter’ cannot be negative.
ATSTypeError: Text ‘text’ must be a string.
ATSValueError: Text ‘text’ cannot be empty.