prefect-client 2.16.5__py3-none-any.whl → 2.16.7__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.
- prefect/_internal/pydantic/__init__.py +21 -1
- prefect/_internal/pydantic/_base_model.py +16 -0
- prefect/_internal/pydantic/_compat.py +352 -68
- prefect/_internal/pydantic/_flags.py +15 -0
- prefect/_internal/pydantic/v1_schema.py +48 -0
- prefect/_internal/pydantic/v2_schema.py +6 -2
- prefect/_internal/schemas/validators.py +582 -9
- prefect/artifacts.py +179 -70
- prefect/client/cloud.py +4 -1
- prefect/client/orchestration.py +1 -1
- prefect/client/schemas/actions.py +2 -2
- prefect/client/schemas/objects.py +13 -24
- prefect/client/schemas/schedules.py +18 -80
- prefect/deployments/deployments.py +22 -86
- prefect/deployments/runner.py +8 -11
- prefect/events/__init__.py +40 -1
- prefect/events/clients.py +17 -20
- prefect/events/filters.py +5 -6
- prefect/events/related.py +1 -1
- prefect/events/schemas/__init__.py +5 -0
- prefect/events/schemas/automations.py +303 -0
- prefect/events/{schemas.py → schemas/deployment_triggers.py} +146 -270
- prefect/events/schemas/events.py +285 -0
- prefect/events/schemas/labelling.py +106 -0
- prefect/events/utilities.py +2 -2
- prefect/events/worker.py +1 -1
- prefect/filesystems.py +8 -37
- prefect/flows.py +4 -4
- prefect/infrastructure/kubernetes.py +12 -56
- prefect/infrastructure/provisioners/__init__.py +1 -0
- prefect/pydantic/__init__.py +4 -0
- prefect/pydantic/main.py +15 -0
- prefect/runner/runner.py +2 -2
- prefect/runner/server.py +1 -1
- prefect/serializers.py +13 -61
- prefect/settings.py +35 -13
- prefect/task_server.py +21 -7
- prefect/utilities/asyncutils.py +1 -1
- prefect/utilities/callables.py +2 -2
- prefect/utilities/context.py +33 -1
- prefect/utilities/schema_tools/hydration.py +14 -6
- prefect/workers/base.py +1 -2
- prefect/workers/block.py +3 -7
- {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/METADATA +2 -2
- {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/RECORD +48 -40
- prefect/utilities/validation.py +0 -63
- {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/LICENSE +0 -0
- {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/WHEEL +0 -0
- {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/top_level.txt +0 -0
prefect/utilities/validation.py
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
import jsonschema
|
2
|
-
|
3
|
-
from prefect.utilities.collections import remove_nested_keys
|
4
|
-
|
5
|
-
|
6
|
-
def validate_schema(schema: dict):
|
7
|
-
"""
|
8
|
-
Validate that the provided schema is a valid json schema.
|
9
|
-
|
10
|
-
Args:
|
11
|
-
schema: The schema to validate.
|
12
|
-
|
13
|
-
Raises:
|
14
|
-
ValueError: If the provided schema is not a valid json schema.
|
15
|
-
|
16
|
-
"""
|
17
|
-
try:
|
18
|
-
if schema is not None:
|
19
|
-
# Most closely matches the schemas generated by pydantic
|
20
|
-
jsonschema.Draft4Validator.check_schema(schema)
|
21
|
-
except jsonschema.SchemaError as exc:
|
22
|
-
raise ValueError(
|
23
|
-
"The provided schema is not a valid json schema. Schema error:"
|
24
|
-
f" {exc.message}"
|
25
|
-
) from exc
|
26
|
-
|
27
|
-
|
28
|
-
def validate_values_conform_to_schema(
|
29
|
-
values: dict, schema: dict, ignore_required: bool = False
|
30
|
-
):
|
31
|
-
"""
|
32
|
-
Validate that the provided values conform to the provided json schema.
|
33
|
-
|
34
|
-
Args:
|
35
|
-
values: The values to validate.
|
36
|
-
schema: The schema to validate against.
|
37
|
-
ignore_required: Whether to ignore the required fields in the schema. Should be
|
38
|
-
used when a partial set of values is acceptable.
|
39
|
-
|
40
|
-
Raises:
|
41
|
-
ValueError: If the parameters do not conform to the schema.
|
42
|
-
|
43
|
-
"""
|
44
|
-
if ignore_required:
|
45
|
-
schema = remove_nested_keys(["required"], schema)
|
46
|
-
|
47
|
-
try:
|
48
|
-
if schema is not None and values is not None:
|
49
|
-
jsonschema.validate(values, schema)
|
50
|
-
except jsonschema.ValidationError as exc:
|
51
|
-
if exc.json_path == "$":
|
52
|
-
error_message = "Validation failed."
|
53
|
-
else:
|
54
|
-
error_message = (
|
55
|
-
f"Validation failed for field {exc.json_path.replace('$.', '')!r}."
|
56
|
-
)
|
57
|
-
error_message += f" Failure reason: {exc.message}"
|
58
|
-
raise ValueError(error_message) from exc
|
59
|
-
except jsonschema.SchemaError as exc:
|
60
|
-
raise ValueError(
|
61
|
-
"The provided schema is not a valid json schema. Schema error:"
|
62
|
-
f" {exc.message}"
|
63
|
-
) from exc
|
File without changes
|
File without changes
|
File without changes
|