Skip to content

Commit

Permalink
Merge branch 'v3.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
pedropaulofb committed Aug 18, 2024
2 parents af9370f + 1209782 commit ae2d63f
Show file tree
Hide file tree
Showing 56 changed files with 19,213 additions and 7,637 deletions.
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: d74b1af419f1b6c355129eff5349b502
config: 2f7777097fb29ca068f2f86a2a7e7a34
tags: 645f666f9bcd5a90fca523b33c5a78b7
119 changes: 59 additions & 60 deletions docs/_sources/autoapi/langstring/controller/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@ langstring.controller
.. autoapi-nested-parse::

The `controller` module provides the `Controller` class, a non-instantiable class designed to manage and manipulate configuration flags for the `LangString`, `SetLangString`, and `MultiLangString` classes.
The `controller` module provides the `Controller` class.

This class is a non-instantiable class designed to manage and manipulate configuration flags for the `LangString`,
`SetLangString`, and `MultiLangString` classes.

This module defines the `Controller` class, which offers class methods to set, retrieve, print, and reset configuration
flags. These flags influence the behavior and validation rules of the multilingual text handling classes within the
application. By centralizing flag management, the `Controller` ensures consistent configuration and behavior across
the system.

Key Features:
- **Global Configuration**: The `Controller` manages flags globally, allowing uniform behavior across different
multilingual text classes.
- **Non-Instantiable Design**: The `Controller` class uses the `NonInstantiable` metaclass to prevent instantiation,
emphasizing its role as a static configuration manager.
- **Flexible Flag Management**: Methods are provided to set, retrieve, print, and reset individual or all flags,
enabling dynamic configuration during runtime.
- **Global Configuration**: The `Controller` manages flags globally, allowing uniform behavior across different
multilingual text classes.
- **Non-Instantiable Design**: The `Controller` class uses the `NonInstantiable` metaclass to prevent instantiation,
emphasizing its role as a static configuration manager.
- **Flexible Flag Management**: Methods are provided to set, retrieve, print, and reset individual or all flags,
enabling dynamic configuration during runtime.

Enums Utilized:
- **GlobalFlag**: Flags affecting the behavior of all classes.
- **LangStringFlag**: Flags specific to the `LangString` class.
- **SetLangStringFlag**: Flags specific to the `SetLangString` class.
- **MultiLangStringFlag**: Flags specific to the `MultiLangString` class.
- **GlobalFlag**: Flags affecting the behavior of all classes.
- **LangStringFlag**: Flags specific to the `LangString` class.
- **SetLangStringFlag**: Flags specific to the `SetLangString` class.
- **MultiLangStringFlag**: Flags specific to the `MultiLangString` class.

The `Controller` class ensures that the multilingual text handling classes adhere to specified rules and constraints,
enhancing the robustness and reliability of multilingual content management.
Expand Down Expand Up @@ -56,36 +59,32 @@ Module Contents
:cvar flags: Stores the current state of each flag.
:vartype flags: dict[Union[GlobalFlag, LangStringFlag, SetLangStringFlag, MultiLangStringFlag], bool]

:Example:

Set a flag:
>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
**Example**::

Get a flag:
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG))
# Output: True
Set a flag:
>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)

Reset a flag to its default value:
>>> Controller.reset_flag(GlobalFlag.LOWERCASE_LANG)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG))
# Output: False
Get a flag:
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG))
# Output: True

Print the state of a specific flag:
>>> Controller.print_flag(GlobalFlag.LOWERCASE_LANG)
# Output: GlobalFlag.LOWERCASE_LANG = False
Reset a flag to its default value:
>>> Controller.reset_flag(GlobalFlag.LOWERCASE_LANG)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG))
# Output: False

Print the states of all flags:
>>> Controller.print_flags()
# Output: (Output of all flags with their states)
Print the state of a specific flag:
>>> Controller.print_flag(GlobalFlag.LOWERCASE_LANG)
# Output: GlobalFlag.LOWERCASE_LANG = False

Reset all flags to their default values:
>>> Controller.reset_flags()
>>> Controller.print_flags()
# Output: (Output of all flags reset to their default states)
Print the states of all flags:
>>> Controller.print_flags()
# Output: (Output of all flags with their states)


.. py:attribute:: _DEFAULT_FLAGS
:type: dict[Union[langstring.flags.GlobalFlag, langstring.flags.LangStringFlag, langstring.flags.SetLangStringFlag, langstring.flags.MultiLangStringFlag], bool]
Reset all flags to their default values:
>>> Controller.reset_flags()
>>> Controller.print_flags()
# Output: (Output of all flags reset to their default states)


.. py:attribute:: flags
Expand All @@ -107,10 +106,10 @@ Module Contents
:type state: bool
:raises TypeError: If 'flag' is not an instance of one of the flag enums, or if 'state' is not a boolean.

:Example:
**Example**::

>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG)) # Output: True
>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG)) # Output: True



Expand All @@ -133,10 +132,10 @@ Module Contents
:raises TypeError: If 'flag' is not a member of GlobalFlag, LangStringFlag, SetLangStringFlag,
or MultiLangStringFlag.

:Example:
**Example**::

>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG)) # Output: True
>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG)) # Output: True



Expand All @@ -153,11 +152,11 @@ Module Contents
:return: A dictionary mapping each flag to its boolean state.
:rtype: dict[Union[GlobalFlag, LangStringFlag, SetLangStringFlag, MultiLangStringFlag], bool]

:Example:
**Example**::

>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> flags = Controller.get_flags()
>>> print(flags[GlobalFlag.LOWERCASE_LANG]) # Output: True
>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> flags = Controller.get_flags()
>>> print(flags[GlobalFlag.LOWERCASE_LANG]) # Output: True



Expand All @@ -174,10 +173,10 @@ Module Contents
:type flag: Union[GlobalFlag, LangStringFlag, SetLangStringFlag, MultiLangStringFlag]
:raises TypeError: If 'flag' is not an instance of one of the flag enums.

:Example:
**Example**::

>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> Controller.print_flag(GlobalFlag.LOWERCASE_LANG) # Output: GlobalFlag.LOWERCASE_LANG = True
>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> Controller.print_flag(GlobalFlag.LOWERCASE_LANG) # Output: GlobalFlag.LOWERCASE_LANG = True



Expand All @@ -194,11 +193,11 @@ Module Contents
:type flag_type: Optional[type]
:raises TypeError: If 'flag_type' is not a valid flag type.

:Example:
**Example**::

>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> Controller.print_flags()
# Output: Prints all flags and their current state.
>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> Controller.print_flags()
# Output: Prints all flags and their current state.



Expand All @@ -216,11 +215,11 @@ Module Contents
:type flag: Union[GlobalFlag, LangStringFlag, SetLangStringFlag, MultiLangStringFlag]
:raises TypeError: If 'flag' is not an instance of one of the flag enums.

:Example:
**Example**::

>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> Controller.reset_flag(GlobalFlag.LOWERCASE_LANG)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG)) # Output: False
>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> Controller.reset_flag(GlobalFlag.LOWERCASE_LANG)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG)) # Output: False



Expand All @@ -234,11 +233,11 @@ Module Contents
:type flag_type: Optional[type]
:raises TypeError: If 'flag_type' is not a valid flag type.

:Example:
**Example**::

>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> Controller.reset_flags(GlobalFlag)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG)) # Output: False
>>> Controller.set_flag(GlobalFlag.LOWERCASE_LANG, True)
>>> Controller.reset_flags(GlobalFlag)
>>> print(Controller.get_flag(GlobalFlag.LOWERCASE_LANG)) # Output: False



Loading

0 comments on commit ae2d63f

Please sign in to comment.