Skip to content

Commit e12fbef

Browse files
committed
doc(global): add documentations code on modules to describes utilities and functions of these and update python declarations on python top file
1 parent 980b974 commit e12fbef

File tree

11 files changed

+106
-22
lines changed

11 files changed

+106
-22
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
/WSLBuilder/
2-
__pycache__/
1+
.vscode/
32

3+
__pycache__/
44
*.pyc
5+
6+
/WSLBuilder/
57
*.vhdx

core/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
#!/bin/python3
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4+
r""" Package initialization for `core`.
5+
6+
This module initializes the `core` package by defining essential functions and variables,
7+
such as `get_config()` for loading configurations and `initialize_logger()` for setting up logging.
8+
It ensures that the core components are ready for use when the package is imported.
9+
10+
Constants:
11+
- INFO: Contains application information such as version, git commit hash, and other metadata.
12+
- REGEX_ARGS: A regular expression pattern used to parse and split argument strings into lists.
13+
- UNITS: Units of measurement for bytes, including KB, MB, GB, TB, etc., to facilitate size conversions.
14+
15+
"""
16+
417
from time import sleep
518
from traceback import format_exc
619

core/colors.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
#!/bin/python3
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4+
r""" Abstract base class for color handling.
5+
6+
Defines abstract classes and interfaces to standardize color management
7+
across tools. It provides a foundation for implementing color schemes
8+
and palettes compatible with different output formats.
9+
10+
"""
11+
412
from platform import system
513

614
class Colors:

core/config.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
#!/bin/python3
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4+
r""" Configuration management for tools.
5+
6+
This module provides functions to load, validate, and access configuration parameters essential
7+
for the proper operation of tools. It supports various configuration formats and allows centralized
8+
management of settings.
9+
10+
"""
11+
412
from json import dump, load
513
from os.path import abspath
614

@@ -47,9 +55,15 @@ def __save(self) -> bool:
4755
return(True)
4856

4957
def getEncoding(self) -> str:
58+
""" Returns the encoding state, e.g. "ascii", "utf-8", "utf-16" or "utf-32"
59+
"""
60+
5061
return(self.__encoding)
5162

5263
def getSplash(self) -> bool:
64+
""" Returns the splash display state, e.g. True or False.
65+
"""
66+
5367
return(self.__splash)
5468

5569
def setEncoding(self, encoding: str = "utf-8") -> bool:

core/icons.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
#!/bin/python3
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4+
r""" Abstract base class for icon handling.
5+
6+
Defines abstract classes to represent icons used in tools.
7+
Provides a structure for consistent icon management and allows
8+
extension for various icon sets or formats.
9+
10+
"""
11+
412
from core.colors import Colors
513

614
class Icons:

core/tool.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
#!/bin/python3
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4+
r""" Base class for tool objects.
5+
6+
Defines the `Tool` class which serves as the foundational object for
7+
creating individual tools compatible with the tools registry.
8+
Provides core functionalities and interface methods to ensure
9+
integration with the overall tool management system.
10+
11+
"""
12+
413
from traceback import format_exc
514

615
from core.icons import Icons

main.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
1-
#!/bin/python3
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
from os import system as shell
5-
from platform import system
6-
from sys import argv, version_info
4+
try:
5+
# --- Importation des dépendances internes ---
6+
from os import system as shell
7+
from platform import system
8+
from sys import argv, version_info
79

8-
import re
10+
if(version_info.major < 3):
11+
raise(SystemError)
912

10-
if(system() == "Linux"):
11-
import readline
13+
import re
1214

13-
if(version_info.major < 3):
15+
if(system() == "Linux"): # Dépendances pour Linux
16+
import readline
17+
18+
# --- Importation des dépendances internes ---
19+
from core import INFO, REGEX_ARGS
20+
from core import Colors, Config, Icons
21+
from core import helper, launch, sortTools, splash, version
22+
23+
from tools import TOOLS
24+
25+
except(SystemError):
1426
print("/!\\ - Program must be run with Python 3")
1527
exit()
1628

17-
# Importation des dépendances internes
18-
from core import INFO, REGEX_ARGS, Colors, Config, Icons, helper, launch, sortTools, splash, version
19-
from tools import TOOLS
29+
except(ModuleNotFoundError) as e:
30+
print(e)
31+
exit()
2032

2133
def arg() -> bool:
2234
args = dict({

tools/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
#!/bin/python3
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4+
r""" Tool registry for `tools`.
5+
6+
This module registers the available tools by importing them and adding them to a central registry.
7+
It ensures that all tools are accessible through the `tools` package.
8+
9+
Constants:
10+
- TOOLS: A list of `Tool` instances representing all registered tools available in the package.
11+
12+
"""
13+
414
from core.tool import Tool
515

616
from tools.matrix import Matrix

tools/matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/python3
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
from os import system as shell

tools/shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/python3
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
from os import system as shell

0 commit comments

Comments
 (0)