liminal-orm 2.0.1__tar.gz → 2.0.3__tar.gz
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.
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/PKG-INFO +2 -2
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/README.md +1 -1
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/validation/__init__.py +41 -44
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/pyproject.toml +1 -1
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/LICENSE.md +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/__init__.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/base/base_dropdown.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/base/base_operation.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/base/base_validation_filters.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/base/compare_operation.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/base/name_template_parts.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/base/properties/base_field_properties.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/base/properties/base_name_template.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/base/properties/base_schema_properties.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/base/str_enum.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/cli/cli.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/cli/controller.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/cli/live_test_dropdown_migration.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/cli/live_test_entity_schema_migration.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/connection/__init__.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/connection/benchling_connection.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/connection/benchling_service.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/dropdowns/api.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/dropdowns/compare.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/dropdowns/generate_files.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/dropdowns/operations.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/dropdowns/utils.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/entity_schemas/api.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/entity_schemas/compare.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/entity_schemas/entity_schema_models.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/entity_schemas/generate_files.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/entity_schemas/operations.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/entity_schemas/tag_schema_models.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/entity_schemas/utils.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/enums/__init__.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/enums/benchling_api_field_type.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/enums/benchling_entity_type.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/enums/benchling_field_type.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/enums/benchling_folder_item_type.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/enums/benchling_naming_strategy.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/enums/benchling_sequence_type.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/enums/name_template_part_type.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/external/__init__.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/mappers.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/migrate/components.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/migrate/revision.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/migrate/revisions_timeline.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/migrate/utils.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/base.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/base_model.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/base_tables/registry_entity.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/base_tables/schema.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/base_tables/user.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/column.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/mixins.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/name_template.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/name_template_parts.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/relationship.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/orm/schema_properties.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/py.typed +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/tests/__init__.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/tests/conftest.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/tests/from benchling_sdk.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/tests/test_dropdown_compare.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/tests/test_entity_schema_compare.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/utils.py +0 -0
- {liminal_orm-2.0.1 → liminal_orm-2.0.3}/liminal/validation/validation_severity.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: liminal-orm
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.3
|
4
4
|
Summary: An ORM and toolkit that builds on top of Benchling's platform to keep your schemas and downstream code dependencies in sync.
|
5
5
|
Home-page: https://github.com/dynotx/liminal-orm
|
6
6
|
Author: DynoTx Open Source
|
@@ -88,7 +88,7 @@ With your schemas defined in code, you can now take advantage of the additional
|
|
88
88
|
class Pizza(BaseModel, CustomEntityMixin):
|
89
89
|
...
|
90
90
|
|
91
|
-
@liminal_validator
|
91
|
+
@liminal_validator
|
92
92
|
def cook_time_and_temp_validator(self) -> None:
|
93
93
|
if self.cook_time is not None and self.cook_temp is None:
|
94
94
|
raise ValueError("Cook temp is required if cook time is set")
|
@@ -57,7 +57,7 @@ With your schemas defined in code, you can now take advantage of the additional
|
|
57
57
|
class Pizza(BaseModel, CustomEntityMixin):
|
58
58
|
...
|
59
59
|
|
60
|
-
@liminal_validator
|
60
|
+
@liminal_validator
|
61
61
|
def cook_time_and_temp_validator(self) -> None:
|
62
62
|
if self.cook_time is not None and self.cook_temp is None:
|
63
63
|
raise ValueError("Cook temp is required if cook time is set")
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import inspect
|
2
1
|
from datetime import datetime
|
3
|
-
from functools import wraps
|
4
|
-
from typing import TYPE_CHECKING, Callable
|
2
|
+
from functools import partial, wraps
|
3
|
+
from typing import TYPE_CHECKING, Any, Callable
|
5
4
|
|
6
5
|
from pydantic import BaseModel, ConfigDict
|
7
6
|
|
@@ -67,6 +66,7 @@ class BenchlingValidatorReport(BaseModel):
|
|
67
66
|
entity: type["BenchlingBaseModel"],
|
68
67
|
validator_name: str,
|
69
68
|
message: str | None = None,
|
69
|
+
**kwargs: Any,
|
70
70
|
) -> "BenchlingValidatorReport":
|
71
71
|
"""Creates a BenchlingValidatorReport with the given parameters.
|
72
72
|
|
@@ -96,59 +96,56 @@ class BenchlingValidatorReport(BaseModel):
|
|
96
96
|
creator_email=entity.creator.email if entity.creator else None,
|
97
97
|
updated_date=entity.modified_at,
|
98
98
|
message=message,
|
99
|
+
**kwargs,
|
99
100
|
)
|
100
101
|
|
101
102
|
|
102
103
|
def liminal_validator(
|
104
|
+
func: Callable[["BenchlingBaseModel"], BenchlingValidatorReport | None]
|
105
|
+
| None = None,
|
106
|
+
*,
|
103
107
|
validator_level: ValidationSeverity = ValidationSeverity.LOW,
|
104
108
|
validator_name: str | None = None,
|
105
109
|
) -> Callable:
|
106
|
-
"""A decorator
|
110
|
+
"""A decorator for a function that validates a Benchling entity, defined on a schema class.
|
111
|
+
Can be used with or without parameters. Wraps around any exceptions raised by the validator function,
|
112
|
+
and returns a BenchlingValidatorReport.
|
107
113
|
|
108
|
-
Parameters
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
114
|
+
Parameters
|
115
|
+
----------
|
116
|
+
validator_level: ValidationSeverity
|
117
|
+
The severity level of the validation report. Defaults to ValidationSeverity.LOW.
|
118
|
+
validator_name: str | None
|
119
|
+
The name of the validator. Defaults to the PascalCase version of the function name.
|
113
120
|
"""
|
121
|
+
if func is None:
|
122
|
+
return partial(
|
123
|
+
liminal_validator,
|
124
|
+
validator_level=validator_level,
|
125
|
+
validator_name=validator_name,
|
126
|
+
)
|
114
127
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
if sig.return_annotation is not None:
|
125
|
-
raise TypeError("The return type must be None.")
|
126
|
-
|
127
|
-
nonlocal validator_name
|
128
|
-
if validator_name is None:
|
129
|
-
validator_name = pascalize(func.__name__)
|
130
|
-
|
131
|
-
@wraps(func)
|
132
|
-
def wrapper(self: type["BenchlingBaseModel"]) -> BenchlingValidatorReport:
|
133
|
-
"""Wrapper that runs the validator function and returns a BenchlingValidatorReport."""
|
134
|
-
try:
|
135
|
-
func(self)
|
136
|
-
except Exception as e:
|
137
|
-
return BenchlingValidatorReport.create_validation_report(
|
138
|
-
valid=False,
|
139
|
-
level=validator_level,
|
140
|
-
entity=self,
|
141
|
-
validator_name=validator_name,
|
142
|
-
message=str(e),
|
143
|
-
)
|
128
|
+
@wraps(func)
|
129
|
+
def wrapper(self: "BenchlingBaseModel") -> BenchlingValidatorReport:
|
130
|
+
"""Wrapper that runs the validator function and returns a BenchlingValidatorReport."""
|
131
|
+
try:
|
132
|
+
ret_val = func(self)
|
133
|
+
if type(ret_val) is BenchlingValidatorReport:
|
134
|
+
return ret_val
|
135
|
+
except Exception as e:
|
144
136
|
return BenchlingValidatorReport.create_validation_report(
|
145
|
-
valid=
|
137
|
+
valid=False,
|
146
138
|
level=validator_level,
|
147
139
|
entity=self,
|
148
|
-
validator_name=validator_name,
|
140
|
+
validator_name=validator_name or pascalize(func.__name__),
|
141
|
+
message=str(e),
|
149
142
|
)
|
143
|
+
return BenchlingValidatorReport.create_validation_report(
|
144
|
+
valid=True,
|
145
|
+
level=validator_level,
|
146
|
+
entity=self,
|
147
|
+
validator_name=validator_name or pascalize(func.__name__),
|
148
|
+
)
|
150
149
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
return decorator
|
150
|
+
setattr(wrapper, "_is_liminal_validator", True)
|
151
|
+
return wrapper
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "liminal-orm"
|
3
|
-
version = "2.0.
|
3
|
+
version = "2.0.3"
|
4
4
|
description = "An ORM and toolkit that builds on top of Benchling's platform to keep your schemas and downstream code dependencies in sync."
|
5
5
|
authors = ["DynoTx Open Source <opensource@dynotx.com>"]
|
6
6
|
readme = "README.md"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|