orionis 0.436.0__py3-none-any.whl → 0.437.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/console/contracts/kernel.py +16 -3
- orionis/console/dumper/contracts/dump.py +8 -9
- orionis/console/dynamic/progress_bar.py +21 -29
- orionis/console/output/console.py +12 -0
- orionis/container/context/manager.py +27 -17
- orionis/container/context/scope.py +8 -7
- orionis/container/contracts/service_provider.py +12 -8
- orionis/container/providers/service_provider.py +9 -16
- orionis/container/resolver/resolver.py +29 -22
- orionis/foundation/contracts/application.py +437 -47
- orionis/foundation/contracts/config.py +14 -6
- orionis/foundation/providers/console_provider.py +16 -15
- orionis/foundation/providers/dumper_provider.py +20 -8
- orionis/foundation/providers/logger_provider.py +19 -14
- orionis/foundation/providers/path_resolver_provider.py +17 -14
- orionis/foundation/providers/progress_bar_provider.py +15 -14
- orionis/foundation/providers/testing_provider.py +20 -14
- orionis/foundation/providers/workers_provider.py +19 -14
- orionis/metadata/framework.py +1 -1
- orionis/services/asynchrony/contracts/coroutines.py +1 -0
- orionis/services/asynchrony/coroutines.py +2 -0
- orionis/services/asynchrony/exceptions/exception.py +2 -0
- orionis/services/environment/core/dot_env.py +9 -0
- orionis/services/environment/dynamic/caster.py +31 -2
- orionis/services/environment/key/key_generator.py +1 -0
- orionis/services/environment/validators/key_name.py +1 -0
- orionis/services/environment/validators/types.py +5 -1
- orionis/services/introspection/abstract/contracts/reflection.py +188 -221
- orionis/services/introspection/abstract/reflection.py +311 -178
- orionis/services/introspection/callables/contracts/reflection.py +64 -21
- orionis/services/introspection/callables/reflection.py +98 -23
- orionis/services/introspection/concretes/reflection.py +278 -181
- orionis/services/introspection/dependencies/contracts/reflection.py +21 -18
- orionis/services/introspection/dependencies/entities/callable_dependencies.py +15 -16
- orionis/services/introspection/dependencies/entities/class_dependencies.py +24 -16
- orionis/services/introspection/dependencies/entities/known_dependencies.py +19 -13
- orionis/services/introspection/dependencies/entities/method_dependencies.py +22 -16
- orionis/services/introspection/dependencies/reflection.py +0 -3
- orionis/services/introspection/instances/reflection.py +16 -6
- orionis/services/log/contracts/log_service.py +4 -0
- orionis/services/log/handlers/filename.py +2 -0
- orionis/services/paths/contracts/resolver.py +0 -3
- orionis/services/paths/resolver.py +0 -3
- {orionis-0.436.0.dist-info → orionis-0.437.0.dist-info}/METADATA +1 -1
- {orionis-0.436.0.dist-info → orionis-0.437.0.dist-info}/RECORD +50 -50
- /orionis/services/introspection/concretes/contracts/{concrete.py → reflection.py} +0 -0
- {orionis-0.436.0.dist-info → orionis-0.437.0.dist-info}/WHEEL +0 -0
- {orionis-0.436.0.dist-info → orionis-0.437.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.436.0.dist-info → orionis-0.437.0.dist-info}/top_level.txt +0 -0
- {orionis-0.436.0.dist-info → orionis-0.437.0.dist-info}/zip-safe +0 -0
|
@@ -4,46 +4,49 @@ from orionis.services.introspection.dependencies.entities.method_dependencies im
|
|
|
4
4
|
|
|
5
5
|
class IReflectDependencies(ABC):
|
|
6
6
|
"""
|
|
7
|
-
|
|
7
|
+
Abstract interface for reflecting on class and method dependencies.
|
|
8
8
|
|
|
9
|
-
This interface
|
|
10
|
-
|
|
9
|
+
This interface defines methods for retrieving dependency information from
|
|
10
|
+
the constructor and methods of a class, distinguishing between resolved and
|
|
11
|
+
unresolved dependencies.
|
|
11
12
|
"""
|
|
12
13
|
|
|
13
14
|
@abstractmethod
|
|
14
15
|
def getConstructorDependencies(self) -> ClassDependency:
|
|
15
16
|
"""
|
|
16
|
-
Retrieve
|
|
17
|
+
Retrieve dependency information from the class constructor.
|
|
17
18
|
|
|
18
19
|
Returns
|
|
19
20
|
-------
|
|
20
21
|
ClassDependency
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
An object containing details about the constructor's dependencies.
|
|
23
|
+
The object includes:
|
|
24
|
+
- resolved : dict
|
|
25
|
+
Mapping of dependency names to their resolved values.
|
|
26
|
+
- unresolved : list
|
|
27
|
+
List of dependency names that are unresolved (i.e., lacking
|
|
28
|
+
default values or type annotations).
|
|
27
29
|
"""
|
|
28
30
|
pass
|
|
29
31
|
|
|
30
32
|
def getMethodDependencies(self, method_name: str) -> MethodDependency:
|
|
31
33
|
"""
|
|
32
|
-
Retrieve
|
|
34
|
+
Retrieve dependency information from a specified method.
|
|
33
35
|
|
|
34
36
|
Parameters
|
|
35
37
|
----------
|
|
36
38
|
method_name : str
|
|
37
|
-
|
|
39
|
+
The name of the method whose dependencies are to be inspected.
|
|
38
40
|
|
|
39
41
|
Returns
|
|
40
42
|
-------
|
|
41
43
|
MethodDependency
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
An object containing details about the method's dependencies.
|
|
45
|
+
The object includes:
|
|
46
|
+
- resolved : dict
|
|
47
|
+
Mapping of dependency names to their resolved values.
|
|
48
|
+
- unresolved : list
|
|
49
|
+
List of dependency names that are unresolved (i.e., lacking
|
|
50
|
+
default values or type annotations).
|
|
48
51
|
"""
|
|
49
52
|
pass
|
|
@@ -6,42 +6,41 @@ from orionis.services.introspection.exceptions import ReflectionTypeError
|
|
|
6
6
|
@dataclass(frozen=True, kw_only=True)
|
|
7
7
|
class CallableDependency:
|
|
8
8
|
"""
|
|
9
|
-
Represents the dependencies of a callable
|
|
9
|
+
Represents the resolved and unresolved dependencies of a callable.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Attributes
|
|
12
12
|
----------
|
|
13
13
|
resolved : Dict[KnownDependency, Any]
|
|
14
|
-
|
|
15
|
-
resolved instances or values for the method. All keys must be KnownDependency instances.
|
|
14
|
+
Dictionary mapping KnownDependency instances to their resolved values.
|
|
16
15
|
unresolved : List[str]
|
|
17
|
-
|
|
18
|
-
Must contain only non-empty strings.
|
|
16
|
+
List of parameter names or dependency identifiers that could not be resolved.
|
|
19
17
|
|
|
20
18
|
Raises
|
|
21
19
|
------
|
|
22
20
|
ReflectionTypeError
|
|
23
|
-
If
|
|
24
|
-
- resolved: Dict[KnownDependency, Any]
|
|
25
|
-
- unresolved: List[str]
|
|
21
|
+
If `resolved` is not a dictionary or `unresolved` is not a list.
|
|
26
22
|
ValueError
|
|
27
|
-
If resolved contains None keys or unresolved contains empty strings
|
|
23
|
+
If `resolved` contains None keys or `unresolved` contains empty strings.
|
|
28
24
|
"""
|
|
25
|
+
|
|
26
|
+
# Resolved dependencies mapped to their values
|
|
29
27
|
resolved: Dict[KnownDependency, Any]
|
|
28
|
+
|
|
29
|
+
# Unresolved dependencies as a list of parameter names
|
|
30
30
|
unresolved: List[str]
|
|
31
31
|
|
|
32
32
|
def __post_init__(self):
|
|
33
33
|
"""
|
|
34
|
-
Validates types and values of attributes
|
|
34
|
+
Validates the types and values of the attributes after initialization.
|
|
35
35
|
|
|
36
36
|
Raises
|
|
37
37
|
------
|
|
38
38
|
ReflectionTypeError
|
|
39
|
-
If
|
|
40
|
-
- resolved: Dict[KnownDependency, Any]
|
|
41
|
-
- unresolved: List[str]
|
|
39
|
+
If `resolved` is not a dictionary or `unresolved` is not a list.
|
|
42
40
|
ValueError
|
|
43
|
-
If resolved contains None keys or unresolved contains empty strings
|
|
41
|
+
If `resolved` contains None keys or `unresolved` contains empty strings.
|
|
44
42
|
"""
|
|
43
|
+
|
|
45
44
|
# Validate 'resolved' is a dict with proper key types
|
|
46
45
|
if not isinstance(self.resolved, dict):
|
|
47
46
|
raise ReflectionTypeError(
|
|
@@ -52,4 +51,4 @@ class CallableDependency:
|
|
|
52
51
|
if not isinstance(self.unresolved, list):
|
|
53
52
|
raise ReflectionTypeError(
|
|
54
53
|
f"'unresolved' must be a list, got {type(self.unresolved).__name__}"
|
|
55
|
-
)
|
|
54
|
+
)
|
|
@@ -6,40 +6,48 @@ from orionis.services.introspection.exceptions import ReflectionTypeError
|
|
|
6
6
|
@dataclass(frozen=True, kw_only=True)
|
|
7
7
|
class ClassDependency:
|
|
8
8
|
"""
|
|
9
|
-
Represents the dependencies of a class,
|
|
9
|
+
Represents the dependencies of a class, distinguishing between resolved and unresolved dependencies.
|
|
10
10
|
|
|
11
11
|
Parameters
|
|
12
12
|
----------
|
|
13
|
-
resolved :
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
A list of dependency names or identifiers that could not be resolved.
|
|
18
|
-
Must contain only strings.
|
|
13
|
+
resolved : dict of KnownDependency to Any
|
|
14
|
+
Dictionary mapping KnownDependency instances to their resolved values or instances.
|
|
15
|
+
unresolved : list of str
|
|
16
|
+
List of dependency names or identifiers that could not be resolved.
|
|
19
17
|
|
|
20
18
|
Attributes
|
|
21
19
|
----------
|
|
22
|
-
resolved :
|
|
23
|
-
|
|
24
|
-
unresolved :
|
|
25
|
-
|
|
20
|
+
resolved : dict of KnownDependency to Any
|
|
21
|
+
The resolved dependencies for the class.
|
|
22
|
+
unresolved : list of str
|
|
23
|
+
The unresolved dependency names or identifiers.
|
|
24
|
+
|
|
25
|
+
Raises
|
|
26
|
+
------
|
|
27
|
+
ReflectionTypeError
|
|
28
|
+
If 'resolved' is not a dictionary with KnownDependency keys or 'unresolved' is not a list.
|
|
29
|
+
ValueError
|
|
30
|
+
If 'resolved' contains None keys or 'unresolved' contains empty strings.
|
|
26
31
|
"""
|
|
32
|
+
|
|
33
|
+
# Resolved dependencies mapped to their values
|
|
27
34
|
resolved: Dict[KnownDependency, Any]
|
|
35
|
+
|
|
36
|
+
# Unresolved dependencies as a list of parameter names
|
|
28
37
|
unresolved: List[str]
|
|
29
38
|
|
|
30
39
|
def __post_init__(self):
|
|
31
40
|
"""
|
|
32
|
-
Validates types of attributes
|
|
41
|
+
Validates the types of the 'resolved' and 'unresolved' attributes after initialization.
|
|
33
42
|
|
|
34
43
|
Raises
|
|
35
44
|
------
|
|
36
45
|
ReflectionTypeError
|
|
37
|
-
If
|
|
38
|
-
- resolved: Dict[KnownDependency, Any]
|
|
39
|
-
- unresolved: List[str]
|
|
46
|
+
If 'resolved' is not a dict or 'unresolved' is not a list.
|
|
40
47
|
ValueError
|
|
41
|
-
If resolved contains None keys or unresolved contains empty strings.
|
|
48
|
+
If 'resolved' contains None keys or 'unresolved' contains empty strings.
|
|
42
49
|
"""
|
|
50
|
+
|
|
43
51
|
# Validate 'resolved' is a dict with KnownDependency keys
|
|
44
52
|
if not isinstance(self.resolved, dict):
|
|
45
53
|
raise ReflectionTypeError(
|
|
@@ -10,27 +10,32 @@ class KnownDependency:
|
|
|
10
10
|
Parameters
|
|
11
11
|
----------
|
|
12
12
|
module_name : str
|
|
13
|
-
|
|
14
|
-
Must be a non-empty string without spaces.
|
|
13
|
+
Name of the module where the dependency is defined. Must be a non-empty string without spaces.
|
|
15
14
|
class_name : str
|
|
16
|
-
|
|
17
|
-
Must be a valid Python identifier.
|
|
15
|
+
Name of the class or type being resolved. Must be a valid Python identifier.
|
|
18
16
|
type : Type
|
|
19
|
-
The actual Python type object of the resolved dependency.
|
|
17
|
+
The actual Python type object of the resolved dependency. Must not be None.
|
|
20
18
|
full_class_path : str
|
|
21
|
-
|
|
22
|
-
Must match 'module_name.class_name' pattern.
|
|
19
|
+
Full import path to the class (e.g., 'package.module.ClassName'). Must match the 'module_name.class_name' pattern.
|
|
23
20
|
|
|
24
21
|
Raises
|
|
25
22
|
------
|
|
26
23
|
ReflectionTypeError
|
|
27
|
-
If any
|
|
24
|
+
If any of the fields have an incorrect type.
|
|
28
25
|
ValueError
|
|
29
|
-
If string fields are empty or
|
|
26
|
+
If string fields are empty or do not meet format requirements, or if 'type' is None.
|
|
30
27
|
"""
|
|
28
|
+
|
|
29
|
+
# Module name where the dependency is defined
|
|
31
30
|
module_name: str
|
|
31
|
+
|
|
32
|
+
# Class name or type being resolved
|
|
32
33
|
class_name: str
|
|
34
|
+
|
|
35
|
+
# The actual Python type object of the resolved dependency
|
|
33
36
|
type: Type[Any]
|
|
37
|
+
|
|
38
|
+
# Full import path to the class
|
|
34
39
|
full_class_path: str
|
|
35
40
|
|
|
36
41
|
def __post_init__(self):
|
|
@@ -40,10 +45,11 @@ class KnownDependency:
|
|
|
40
45
|
Raises
|
|
41
46
|
------
|
|
42
47
|
ReflectionTypeError
|
|
43
|
-
If any field has incorrect type.
|
|
48
|
+
If any field has an incorrect type.
|
|
44
49
|
ValueError
|
|
45
|
-
If string fields are empty or
|
|
50
|
+
If string fields are empty or do not meet format requirements, or if 'type' is None.
|
|
46
51
|
"""
|
|
52
|
+
|
|
47
53
|
# Validate module_name
|
|
48
54
|
if not isinstance(self.module_name, str):
|
|
49
55
|
raise ReflectionTypeError(f"module_name must be str, got {type(self.module_name).__name__}")
|
|
@@ -52,10 +58,10 @@ class KnownDependency:
|
|
|
52
58
|
if not isinstance(self.class_name, str):
|
|
53
59
|
raise ReflectionTypeError(f"class_name must be str, got {type(self.class_name).__name__}")
|
|
54
60
|
|
|
55
|
-
# Validate type
|
|
61
|
+
# Validate type is not None
|
|
56
62
|
if self.type is None:
|
|
57
63
|
raise ValueError("The 'type' field must not be None. Please provide a valid Python type object for the dependency.")
|
|
58
64
|
|
|
59
65
|
# Validate full_class_path
|
|
60
66
|
if not isinstance(self.full_class_path, str):
|
|
61
|
-
raise ReflectionTypeError(f"full_class_path must be str, got {type(self.full_class_path).__name__}")
|
|
67
|
+
raise ReflectionTypeError(f"full_class_path must be str, got {type(self.full_class_path).__name__}")
|
|
@@ -6,42 +6,48 @@ from orionis.services.introspection.exceptions import ReflectionTypeError
|
|
|
6
6
|
@dataclass(frozen=True, kw_only=True)
|
|
7
7
|
class MethodDependency:
|
|
8
8
|
"""
|
|
9
|
-
Represents the dependencies of a method,
|
|
9
|
+
Represents the dependencies of a method, distinguishing between resolved and unresolved dependencies.
|
|
10
10
|
|
|
11
11
|
Parameters
|
|
12
12
|
----------
|
|
13
|
-
resolved :
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
A list of method parameter names or dependency identifiers that could not be resolved.
|
|
18
|
-
Must contain only non-empty strings.
|
|
13
|
+
resolved : dict of KnownDependency to Any
|
|
14
|
+
Dictionary mapping each resolved KnownDependency to its corresponding instance or value.
|
|
15
|
+
unresolved : list of str
|
|
16
|
+
List of parameter names or dependency identifiers that could not be resolved.
|
|
19
17
|
|
|
20
18
|
Raises
|
|
21
19
|
------
|
|
22
20
|
ReflectionTypeError
|
|
23
|
-
If
|
|
24
|
-
- resolved: Dict[KnownDependency, Any]
|
|
25
|
-
- unresolved: List[str]
|
|
21
|
+
If `resolved` is not a dictionary with KnownDependency keys, or if `unresolved` is not a list of strings.
|
|
26
22
|
ValueError
|
|
27
|
-
If resolved contains None keys or unresolved contains empty strings
|
|
23
|
+
If `resolved` contains None keys or `unresolved` contains empty strings.
|
|
24
|
+
|
|
25
|
+
Attributes
|
|
26
|
+
----------
|
|
27
|
+
resolved : dict of KnownDependency to Any
|
|
28
|
+
The resolved dependencies for the method.
|
|
29
|
+
unresolved : list of str
|
|
30
|
+
The unresolved dependencies for the method.
|
|
28
31
|
"""
|
|
32
|
+
|
|
33
|
+
# Resolved dependencies mapped to their values
|
|
29
34
|
resolved: Dict[KnownDependency, Any]
|
|
35
|
+
|
|
36
|
+
# Unresolved dependencies as a list of parameter names
|
|
30
37
|
unresolved: List[str]
|
|
31
38
|
|
|
32
39
|
def __post_init__(self):
|
|
33
40
|
"""
|
|
34
|
-
Validates types and values of attributes
|
|
41
|
+
Validates the types and values of the attributes after initialization.
|
|
35
42
|
|
|
36
43
|
Raises
|
|
37
44
|
------
|
|
38
45
|
ReflectionTypeError
|
|
39
|
-
If
|
|
40
|
-
- resolved: Dict[KnownDependency, Any]
|
|
41
|
-
- unresolved: List[str]
|
|
46
|
+
If `resolved` is not a dictionary or `unresolved` is not a list.
|
|
42
47
|
ValueError
|
|
43
|
-
If resolved contains None keys or unresolved contains empty strings
|
|
48
|
+
If `resolved` contains None keys or `unresolved` contains empty strings.
|
|
44
49
|
"""
|
|
50
|
+
|
|
45
51
|
# Validate 'resolved' is a dict with proper key types
|
|
46
52
|
if not isinstance(self.resolved, dict):
|
|
47
53
|
raise ReflectionTypeError(
|
|
@@ -8,9 +8,6 @@ from orionis.services.introspection.dependencies.entities.known_dependencies imp
|
|
|
8
8
|
from orionis.services.introspection.exceptions import ReflectionValueError
|
|
9
9
|
|
|
10
10
|
class ReflectDependencies(IReflectDependencies):
|
|
11
|
-
"""
|
|
12
|
-
This class is used to reflect dependencies of a given object.
|
|
13
|
-
"""
|
|
14
11
|
|
|
15
12
|
def __init__(self, target = None):
|
|
16
13
|
"""
|
|
@@ -524,6 +524,7 @@ class ReflectionInstance(IReflectionInstance):
|
|
|
524
524
|
ReflectionAttributeError
|
|
525
525
|
If the attribute is not callable or already exists as a method
|
|
526
526
|
"""
|
|
527
|
+
|
|
527
528
|
# Ensure the name is a valid method name with regular expression
|
|
528
529
|
if not isinstance(name, str) or not name.isidentifier() or keyword.iskeyword(name):
|
|
529
530
|
raise ReflectionAttributeError(f"Invalid method name '{name}'. Must be a valid Python identifier and not a keyword.")
|
|
@@ -577,8 +578,12 @@ class ReflectionInstance(IReflectionInstance):
|
|
|
577
578
|
ReflectionAttributeError
|
|
578
579
|
If the method does not exist or is not callable
|
|
579
580
|
"""
|
|
581
|
+
|
|
582
|
+
# Handle private method name mangling
|
|
580
583
|
if not self.hasMethod(name):
|
|
581
584
|
raise ReflectionAttributeError(f"Method '{name}' does not exist on '{self.getClassName()}'.")
|
|
585
|
+
|
|
586
|
+
# Delete the method from the instance's class
|
|
582
587
|
delattr(self._instance.__class__, name)
|
|
583
588
|
|
|
584
589
|
def getMethodSignature(self, name: str) -> inspect.Signature:
|
|
@@ -1558,16 +1563,21 @@ class ReflectionInstance(IReflectionInstance):
|
|
|
1558
1563
|
|
|
1559
1564
|
def getConstructorDependencies(self) -> ClassDependency:
|
|
1560
1565
|
"""
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1566
|
+
Retrieves the resolved and unresolved dependencies from the constructor (__init__) of the instance's class.
|
|
1564
1567
|
|
|
1565
1568
|
Returns
|
|
1566
1569
|
-------
|
|
1567
1570
|
ClassDependency
|
|
1568
|
-
|
|
1569
|
-
- resolved:
|
|
1570
|
-
|
|
1571
|
+
An object representing the constructor dependencies, including:
|
|
1572
|
+
- resolved : dict
|
|
1573
|
+
Dictionary of resolved dependencies with their names and values.
|
|
1574
|
+
- unresolved : list
|
|
1575
|
+
List of unresolved dependencies (parameter names without default values or annotations).
|
|
1576
|
+
|
|
1577
|
+
Notes
|
|
1578
|
+
-----
|
|
1579
|
+
This method uses the ReflectDependencies utility to analyze the constructor of the class
|
|
1580
|
+
associated with the current instance and extract its dependencies.
|
|
1571
1581
|
"""
|
|
1572
1582
|
return ReflectDependencies(self._instance.__class__).getConstructorDependencies()
|
|
1573
1583
|
|
|
@@ -17,6 +17,7 @@ class ILoggerService(ABC):
|
|
|
17
17
|
None
|
|
18
18
|
This method does not return any value.
|
|
19
19
|
"""
|
|
20
|
+
|
|
20
21
|
# To be implemented by subclasses
|
|
21
22
|
pass
|
|
22
23
|
|
|
@@ -35,6 +36,7 @@ class ILoggerService(ABC):
|
|
|
35
36
|
None
|
|
36
37
|
This method does not return any value.
|
|
37
38
|
"""
|
|
39
|
+
|
|
38
40
|
# To be implemented by subclasses
|
|
39
41
|
pass
|
|
40
42
|
|
|
@@ -53,6 +55,7 @@ class ILoggerService(ABC):
|
|
|
53
55
|
None
|
|
54
56
|
This method does not return any value.
|
|
55
57
|
"""
|
|
58
|
+
|
|
56
59
|
# To be implemented by subclasses
|
|
57
60
|
pass
|
|
58
61
|
|
|
@@ -71,5 +74,6 @@ class ILoggerService(ABC):
|
|
|
71
74
|
None
|
|
72
75
|
This method does not return any value.
|
|
73
76
|
"""
|
|
77
|
+
|
|
74
78
|
# To be implemented by subclasses
|
|
75
79
|
pass
|
|
@@ -18,6 +18,7 @@ class FileNameLogger:
|
|
|
18
18
|
ValueError
|
|
19
19
|
If the provided path is not a non-empty string.
|
|
20
20
|
"""
|
|
21
|
+
|
|
21
22
|
# Validate that the path is a non-empty string
|
|
22
23
|
if not isinstance(path, str) or not path:
|
|
23
24
|
raise ValueError("The 'path' parameter must be a non-empty string.")
|
|
@@ -43,6 +44,7 @@ class FileNameLogger:
|
|
|
43
44
|
- The timestamp is generated using the current date and time.
|
|
44
45
|
- The directory for the log file is created if it does not exist.
|
|
45
46
|
"""
|
|
47
|
+
|
|
46
48
|
# Split the original path into components based on the separator
|
|
47
49
|
if '/' in self.__path:
|
|
48
50
|
parts = self.__path.split('/')
|