Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Hints #25

Merged
merged 18 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1395b35
[003_type_hints], issuee #3, Added type hints to gui_configuration mo…
lelaus Jul 7, 2024
fd4a1cf
[003_type_hints], issue #3, Added type hints to CustomNotebbok class …
lelaus Jul 7, 2024
101208d
[003_type_hints], issue #3, Merged current version of master
lelaus Jul 23, 2024
973fd03
[003_type_hints], issue #3, Added type hints to gui_configuration.py …
lelaus Jul 23, 2024
1d7784e
[003_type_hints], issue #3, Modified the workflow managing the automa…
lelaus Jul 23, 2024
1146bf4
[003_type_hints], issue #3, Applied type hints to gui_widgets.py modu…
lelaus Jul 24, 2024
1b675ba
[003_type_hints], issue #3,Removed function type from SquareButton co…
lelaus Jul 24, 2024
bc549a4
[003_type_hints], issue #3, Solved previous issue with function type …
lelaus Jul 25, 2024
3cc8b8e
[003_type_hints], issue #3, Completed type hints for gui_widgets.py m…
lelaus Jul 25, 2024
963694a
[003_type_hints], issue #3, Added type hints to main.py module
lelaus Jul 25, 2024
2162c10
[003_type_hints], issue #3, Added type hints to plot_builder.py module
lelaus Jul 25, 2024
2009c55
[003_type_hints], issue #3, Removed ArrayLike type since discouraged …
lelaus Jul 25, 2024
01278c4
[003_type_hints], issue #3, Corrected ArrayLike type hint into plot_b…
lelaus Jul 26, 2024
40a80f7
[003_type_hints], issue #3, Added type hints to plot_settings.py module
lelaus Jul 26, 2024
115670e
[003_type_hints], issue #3, Added type hints to support.py module
lelaus Jul 26, 2024
d9c9109
[003_type_hints], issue #3, Added type hints to tab_builder.py module
lelaus Jul 27, 2024
0d5e5ba
[003_type_hints], issue #3, Added type hints to module tu_interface.py
lelaus Jul 27, 2024
398672a
[003_type_hints], issue #3, Corrected type hints typos on List and Di…
lelaus Jul 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- run: pip install ttkthemes
- run: pip install pandas
- run: pip install matplotlib
- run: pip install typing-extensions
- run: python3 -m unittest tests/test_gui_window_basic.py -v

test_documentation:
Expand Down
19 changes: 10 additions & 9 deletions tugui/gui_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from dataclasses import dataclass, field
from typing import Dict, Tuple, List
from typing_extensions import Self

from plot_settings import GroupType
from support import IDGA
Expand All @@ -22,7 +23,7 @@ class DiagramCharacteristics():
idga: str = ''

@staticmethod
def init_tuplot_DiagramCharacteristics(number: str, idga: str):
def init_tuplot_DiagramCharacteristics(number: str, idga: str) -> Self:
"""
Method that, given the plot number and idga values, builds an instance
of the 'DiagramCharacteristics' dataclass and evaluates the group value
Expand Down Expand Up @@ -50,9 +51,9 @@ def init_tuplot_DiagramCharacteristics(number: str, idga: str):
@dataclass
class GuiPlotFieldsConfigurator():
"""
Dataclass providing a record storing all the needed information for filling up
the plot configuration fields into the GUI, as well as for enabling the plotting
functionalities.
Dataclass providing a record storing all the needed information for filling
up the plot configuration fields into the GUI, as well as for enabling the
plotting functionalities.
To do so, some support dictionaries are stored as well.
"""
diagr_path: str = ''
Expand All @@ -71,7 +72,7 @@ class GuiPlotFieldsConfigurator():
tustat_path: str = ''

@staticmethod
def init_GuiPlotFieldsConfigurator_attrs():
def init_GuiPlotFieldsConfigurator_attrs() -> Self:
"""
Method that builds and configure the attributes of an instance of the
'GuiPlotFieldsConfigurator' class.
Expand Down Expand Up @@ -209,7 +210,7 @@ def init_GuiPlotFieldsConfigurator_attrs():
# Return the configured 'GuiPlotFieldsConfigurator' dataclass
return gui_config

def __check_config_file_existence(self, path2check: str, filename: str):
def __check_config_file_existence(self, path2check: str, filename: str) -> None:
"""
Function that raises an exception if the given path does not correspond to an
existing file.
Expand All @@ -218,7 +219,7 @@ def __check_config_file_existence(self, path2check: str, filename: str):
# Raise an exception
raise FileNotFoundError("Error: missing \"" + filename + "\" configuration file")

def __check_exe_file_existence(self, path2check: str, filename: str):
def __check_exe_file_existence(self, path2check: str, filename: str) -> None:
"""
Function that raises an exception if the given path does not correspond to an
existing executable file with right permission.
Expand All @@ -230,7 +231,7 @@ def __check_exe_file_existence(self, path2check: str, filename: str):
# Raise an exception
raise PermissionError("Error: the \"" + filename + "\" does not have execution permission")

def __build_nVsKn(self, group_file: str, group_dict: dict, search_num: str):
def __build_nVsKn(self, group_file: str, group_dict: Dict[str, List[str]], search_num: str) -> None:
"""
Function that, given the 'Group' file to read (its path), it fills up the input dictionary with:
. keys, being the line indicating the plot 'Number'
Expand Down Expand Up @@ -262,7 +263,7 @@ def __build_nVsKn(self, group_file: str, group_dict: dict, search_num: str):

if __name__ == "__main__":
# Instantiate and configure the dataclass storing the GUI configuration
gui_config = GuiPlotFieldsConfigurator.init_GuiPlotFieldsConfigurator_attrs()
gui_config: GuiPlotFieldsConfigurator = GuiPlotFieldsConfigurator.init_GuiPlotFieldsConfigurator_attrs()

# Print the built dictionaries
print(gui_config.groupVSnumVsKn)
Expand Down
Loading
Loading