haiway 0.10.0__py3-none-any.whl → 0.10.1__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.
- haiway/state/attributes.py +4 -1
- haiway/state/validation.py +13 -4
- {haiway-0.10.0.dist-info → haiway-0.10.1.dist-info}/METADATA +1 -1
- {haiway-0.10.0.dist-info → haiway-0.10.1.dist-info}/RECORD +7 -7
- {haiway-0.10.0.dist-info → haiway-0.10.1.dist-info}/LICENSE +0 -0
- {haiway-0.10.0.dist-info → haiway-0.10.1.dist-info}/WHEEL +0 -0
- {haiway-0.10.0.dist-info → haiway-0.10.1.dist-info}/top_level.txt +0 -0
haiway/state/attributes.py
CHANGED
@@ -509,7 +509,10 @@ def _resolve_type_typeddict(
|
|
509
509
|
self_annotation=resolved_attribute,
|
510
510
|
recursion_guard=recursion_guard,
|
511
511
|
).update_required(key in annotation.__required_keys__)
|
512
|
-
resolved_attribute.extra =
|
512
|
+
resolved_attribute.extra = {
|
513
|
+
"attributes": attributes,
|
514
|
+
"required": annotation.__required_keys__,
|
515
|
+
}
|
513
516
|
return resolved_attribute
|
514
517
|
|
515
518
|
|
haiway/state/validation.py
CHANGED
@@ -86,6 +86,12 @@ class AttributeValidator[Type]:
|
|
86
86
|
assert self.validation is not MISSING # nosec: B101
|
87
87
|
return self.validation(value) # pyright: ignore[reportCallIssue, reportUnknownVariableType]
|
88
88
|
|
89
|
+
def __str__(self) -> str:
|
90
|
+
return f"Validator[{self.annotation}]"
|
91
|
+
|
92
|
+
def __repr__(self) -> str:
|
93
|
+
return f"Validator[{self.annotation}]"
|
94
|
+
|
89
95
|
|
90
96
|
def _prepare_validator_of_any(
|
91
97
|
annotation: AttributeAnnotation,
|
@@ -391,11 +397,12 @@ def _prepare_validator_of_typed_dict(
|
|
391
397
|
case _:
|
392
398
|
raise TypeError(f"'{value}' is not matching expected type of 'str'")
|
393
399
|
|
400
|
+
formatted_type: str = str(annotation)
|
394
401
|
values_validators: dict[str, AttributeValidation[Any]] = {
|
395
402
|
key: AttributeValidator.of(element, recursion_guard=recursion_guard)
|
396
|
-
for key, element in annotation.extra.items()
|
403
|
+
for key, element in annotation.extra["attributes"].items()
|
397
404
|
}
|
398
|
-
|
405
|
+
required_values: Set[str] = annotation.extra["required"]
|
399
406
|
|
400
407
|
def validator(
|
401
408
|
value: Any,
|
@@ -406,8 +413,10 @@ def _prepare_validator_of_typed_dict(
|
|
406
413
|
validated: MutableMapping[str, Any] = {}
|
407
414
|
for key, validator in values_validators.items():
|
408
415
|
element: Any = elements.get(key, MISSING)
|
409
|
-
if element is not
|
410
|
-
|
416
|
+
if element is MISSING and key not in required_values:
|
417
|
+
continue # skip missing and not required
|
418
|
+
|
419
|
+
validated[key_validator(key)] = validator(element)
|
411
420
|
|
412
421
|
# TODO: make sure dict is not mutable with MappingProxyType?
|
413
422
|
return validated
|
@@ -18,11 +18,11 @@ haiway/helpers/throttling.py,sha256=zo0OwFq64si5KUwhd58cFHLmGAmYwRbFRJMbv9suhPs,
|
|
18
18
|
haiway/helpers/timeouted.py,sha256=1xU09hQnFdj6p48BwZl5xUvtIr3zC0ZUXehkdrduCjs,3074
|
19
19
|
haiway/helpers/tracing.py,sha256=eQpkIoGSB51jRF8RcLaihvHX3VzJIRdyRxTx3I14Pzg,3346
|
20
20
|
haiway/state/__init__.py,sha256=emTuwGFn7HyjyTJ_ass69J5jQIA7_WHO4teZz_dR05Y,355
|
21
|
-
haiway/state/attributes.py,sha256=
|
21
|
+
haiway/state/attributes.py,sha256=0gJbgOKiH79RNM9IW66NNWSWM29037yGTTpoln6vPvU,22984
|
22
22
|
haiway/state/path.py,sha256=4vh-fYQv8_xRWjS0ErMQslKDWRI6-KVECAr8JhYk0UY,17503
|
23
23
|
haiway/state/requirement.py,sha256=3iQqzp5Q7w6y5uClamJGH7S5Hib9pciuTAV27PP5lS8,6161
|
24
24
|
haiway/state/structure.py,sha256=bSIj0S_HG-F1Z5GxSlY6VpGtrtiwG82-AIL_PL1lRLo,12465
|
25
|
-
haiway/state/validation.py,sha256=
|
25
|
+
haiway/state/validation.py,sha256=r0EMIs-nvoXsmSA74oGu6Lrbw8lkzmseaY82_-E8ous,13814
|
26
26
|
haiway/types/__init__.py,sha256=-j4uDN6ix3GBXLBqXC-k_QOJSDlO6zvNCxDej8vVzek,342
|
27
27
|
haiway/types/default.py,sha256=IVQsNzDnfukL3-XlScYv2PgTcJ1x_BNP9i5UlS5oEbg,2179
|
28
28
|
haiway/types/frozen.py,sha256=CZhFCXnWAKEhuWSfILxA8smfdpMd5Ku694ycfLh98R8,76
|
@@ -36,8 +36,8 @@ haiway/utils/logs.py,sha256=oDsc1ZdqKDjlTlctLbDcp9iX98Acr-1tdw-Pyg3DElo,1577
|
|
36
36
|
haiway/utils/mimic.py,sha256=BkVjTVP2TxxC8GChPGyDV6UXVwJmiRiSWeOYZNZFHxs,1828
|
37
37
|
haiway/utils/noop.py,sha256=qgbZlOKWY6_23Zs43OLukK2HagIQKRyR04zrFVm5rWI,344
|
38
38
|
haiway/utils/queue.py,sha256=oQ3GXCJ-PGNtMEr6EPdgqAvYZoj8lAa7Z2drBKBEoBM,2345
|
39
|
-
haiway-0.10.
|
40
|
-
haiway-0.10.
|
41
|
-
haiway-0.10.
|
42
|
-
haiway-0.10.
|
43
|
-
haiway-0.10.
|
39
|
+
haiway-0.10.1.dist-info/LICENSE,sha256=GehQEW_I1pkmxkkj3NEa7rCTQKYBn7vTPabpDYJlRuo,1063
|
40
|
+
haiway-0.10.1.dist-info/METADATA,sha256=0m2_QdvBq_XiPN3GiIYFIE0cXf8cVw5esT8kA6_K_5Y,3895
|
41
|
+
haiway-0.10.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
42
|
+
haiway-0.10.1.dist-info/top_level.txt,sha256=_LdXVLzUzgkvAGQnQJj5kQfoFhpPW6EF4Kj9NapniLg,7
|
43
|
+
haiway-0.10.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|