passphera-core 0.22.0__py3-none-any.whl → 0.23.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.
- passphera_core/application/generator.py +4 -4
- passphera_core/entities.py +13 -13
- {passphera_core-0.22.0.dist-info → passphera_core-0.23.0.dist-info}/METADATA +1 -1
- {passphera_core-0.22.0.dist-info → passphera_core-0.23.0.dist-info}/RECORD +6 -6
- {passphera_core-0.22.0.dist-info → passphera_core-0.23.0.dist-info}/WHEEL +0 -0
- {passphera_core-0.22.0.dist-info → passphera_core-0.23.0.dist-info}/top_level.txt +0 -0
@@ -22,9 +22,9 @@ class SetPropertyUseCase:
|
|
22
22
|
def __init__(self, generator_repository: GeneratorRepository):
|
23
23
|
self.generator_repository: GeneratorRepository = generator_repository
|
24
24
|
|
25
|
-
def __call__(self,
|
25
|
+
def __call__(self, prop: str, value: str) -> Generator:
|
26
26
|
generator_entity: Generator = self.generator_repository.get()
|
27
|
-
generator_entity.set_property(
|
27
|
+
generator_entity.set_property(prop, value)
|
28
28
|
self.generator_repository.update(generator_entity)
|
29
29
|
return generator_entity
|
30
30
|
|
@@ -33,9 +33,9 @@ class ResetPropertyUseCase:
|
|
33
33
|
def __init__(self, generator_repository: GeneratorRepository):
|
34
34
|
self.generator_repository: GeneratorRepository = generator_repository
|
35
35
|
|
36
|
-
def __call__(self,
|
36
|
+
def __call__(self, prop: str) -> Generator:
|
37
37
|
generator_entity: Generator = self.generator_repository.get()
|
38
|
-
generator_entity.reset_property(
|
38
|
+
generator_entity.reset_property(prop)
|
39
39
|
self.generator_repository.update(generator_entity)
|
40
40
|
return generator_entity
|
41
41
|
|
passphera_core/entities.py
CHANGED
@@ -103,35 +103,35 @@ class Generator:
|
|
103
103
|
"characters_replacements": self.characters_replacements,
|
104
104
|
}
|
105
105
|
|
106
|
-
def set_property(self,
|
106
|
+
def set_property(self, prop: str, value: str):
|
107
107
|
"""
|
108
108
|
Update a generator property with a new value
|
109
|
-
:param
|
109
|
+
:param prop: The property name to update; must be one of: shift, multiplier, key, algorithm, prefix, postfix
|
110
110
|
:param value: The new value to set for the property
|
111
111
|
:raises ValueError: If the property name is not one of the allowed properties
|
112
112
|
:return: None
|
113
113
|
"""
|
114
|
-
if
|
115
|
-
raise ValueError(f"Invalid property: {
|
116
|
-
if
|
114
|
+
if prop not in {"shift", "multiplier", "key", "algorithm", "prefix", "postfix"}:
|
115
|
+
raise ValueError(f"Invalid property: {prop}")
|
116
|
+
if prop in ["shift", "multiplier"]:
|
117
117
|
value = int(value)
|
118
|
-
setattr(self,
|
119
|
-
if
|
118
|
+
setattr(self, prop, value)
|
119
|
+
if prop == "algorithm":
|
120
120
|
self.get_algorithm()
|
121
121
|
self.updated_at = datetime.now(timezone.utc)
|
122
122
|
|
123
|
-
def reset_property(self,
|
123
|
+
def reset_property(self, prop: str):
|
124
124
|
"""
|
125
125
|
Reset a generator property to its default value
|
126
|
-
:param
|
126
|
+
:param prop: The property name to reset, it must be one of: shift, multiplier, key, algorithm, prefix, postfix
|
127
127
|
:raises ValueError: If the property name is not one of the allowed properties
|
128
128
|
:return: None
|
129
129
|
"""
|
130
|
-
if
|
131
|
-
raise ValueError(f"Invalid property: {
|
130
|
+
if prop not in {"shift", "multiplier", "key", "algorithm", "prefix", "postfix"}:
|
131
|
+
raise ValueError(f"Invalid property: {prop}")
|
132
132
|
|
133
|
-
setattr(self,
|
134
|
-
if
|
133
|
+
setattr(self, prop, self._default_properties[prop])
|
134
|
+
if prop == "algorithm":
|
135
135
|
self.get_algorithm()
|
136
136
|
self.updated_at = datetime.now(timezone.utc)
|
137
137
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
passphera_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
passphera_core/entities.py,sha256=
|
2
|
+
passphera_core/entities.py,sha256=ds0BfJPiUoZsv4Sd6mocLfO9cR7wAKvtjswusSe8-Nk,7222
|
3
3
|
passphera_core/exceptions.py,sha256=Xir2lYIH7QYHfjDQu8WJ9qIhCvP-mYcPWYN2LbbbDj8,640
|
4
4
|
passphera_core/interfaces.py,sha256=DpHFh_vnamORf69P1dwLrZ8AYZPcYIol0Lq_VKRBkXc,855
|
5
5
|
passphera_core/utilities.py,sha256=n7cAVox-yGd60595RjLvrGKSGqFQRm279YqKS3-R1X0,748
|
6
6
|
passphera_core/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
passphera_core/application/generator.py,sha256=
|
7
|
+
passphera_core/application/generator.py,sha256=WnMuv-zBPa6d_eCOKtbtsDl1CmZ_YcnXqH5bpVIXhgs,2452
|
8
8
|
passphera_core/application/password.py,sha256=9wsSz3uMWEZCgfnX5V7WYiWp2OqjSmsn6OSWK4HIIfo,2876
|
9
|
-
passphera_core-0.
|
10
|
-
passphera_core-0.
|
11
|
-
passphera_core-0.
|
12
|
-
passphera_core-0.
|
9
|
+
passphera_core-0.23.0.dist-info/METADATA,sha256=8ohLZ-JaOXGQMQW7hFhGbYCppJOPWCtyV8BvyUCdZQo,868
|
10
|
+
passphera_core-0.23.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
11
|
+
passphera_core-0.23.0.dist-info/top_level.txt,sha256=aDUX2iWGOyfzyf6XakLWTbgeWqNrypMHO074Qratyds,15
|
12
|
+
passphera_core-0.23.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|