liminal-orm 2.0.2__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.2 → liminal_orm-2.0.3}/PKG-INFO +1 -1
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/validation/__init__.py +25 -38
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/pyproject.toml +1 -1
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/LICENSE.md +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/README.md +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/__init__.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/base/base_dropdown.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/base/base_operation.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/base/base_validation_filters.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/base/compare_operation.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/base/name_template_parts.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/base/properties/base_field_properties.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/base/properties/base_name_template.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/base/properties/base_schema_properties.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/base/str_enum.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/cli/cli.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/cli/controller.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/cli/live_test_dropdown_migration.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/cli/live_test_entity_schema_migration.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/connection/__init__.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/connection/benchling_connection.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/connection/benchling_service.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/dropdowns/api.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/dropdowns/compare.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/dropdowns/generate_files.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/dropdowns/operations.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/dropdowns/utils.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/entity_schemas/api.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/entity_schemas/compare.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/entity_schemas/entity_schema_models.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/entity_schemas/generate_files.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/entity_schemas/operations.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/entity_schemas/tag_schema_models.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/entity_schemas/utils.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/enums/__init__.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/enums/benchling_api_field_type.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/enums/benchling_entity_type.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/enums/benchling_field_type.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/enums/benchling_folder_item_type.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/enums/benchling_naming_strategy.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/enums/benchling_sequence_type.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/enums/name_template_part_type.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/external/__init__.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/mappers.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/migrate/components.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/migrate/revision.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/migrate/revisions_timeline.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/migrate/utils.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/base.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/base_model.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/base_tables/registry_entity.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/base_tables/schema.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/base_tables/user.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/column.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/mixins.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/name_template.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/name_template_parts.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/relationship.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/orm/schema_properties.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/py.typed +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/tests/__init__.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/tests/conftest.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/tests/from benchling_sdk.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/tests/test_dropdown_compare.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/tests/test_entity_schema_compare.py +0 -0
- {liminal_orm-2.0.2 → liminal_orm-2.0.3}/liminal/utils.py +0 -0
- {liminal_orm-2.0.2 → 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
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import inspect
|
2
1
|
from datetime import datetime
|
3
2
|
from functools import partial, wraps
|
4
3
|
from typing import TYPE_CHECKING, Any, Callable
|
@@ -101,24 +100,33 @@ class BenchlingValidatorReport(BaseModel):
|
|
101
100
|
)
|
102
101
|
|
103
102
|
|
104
|
-
def
|
105
|
-
func: Callable[[
|
106
|
-
|
107
|
-
|
103
|
+
def liminal_validator(
|
104
|
+
func: Callable[["BenchlingBaseModel"], BenchlingValidatorReport | None]
|
105
|
+
| None = None,
|
106
|
+
*,
|
107
|
+
validator_level: ValidationSeverity = ValidationSeverity.LOW,
|
108
|
+
validator_name: str | None = None,
|
108
109
|
) -> Callable:
|
109
|
-
"""
|
110
|
-
|
111
|
-
|
112
|
-
if not params or params[0].name != "self" or len(params) > 1:
|
113
|
-
raise TypeError(
|
114
|
-
"Validator must be defined in a schema class, where the only argument to this validator must be 'self'."
|
115
|
-
)
|
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.
|
116
113
|
|
117
|
-
|
118
|
-
|
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.
|
120
|
+
"""
|
121
|
+
if func is None:
|
122
|
+
return partial(
|
123
|
+
liminal_validator,
|
124
|
+
validator_level=validator_level,
|
125
|
+
validator_name=validator_name,
|
126
|
+
)
|
119
127
|
|
120
128
|
@wraps(func)
|
121
|
-
def wrapper(self:
|
129
|
+
def wrapper(self: "BenchlingBaseModel") -> BenchlingValidatorReport:
|
122
130
|
"""Wrapper that runs the validator function and returns a BenchlingValidatorReport."""
|
123
131
|
try:
|
124
132
|
ret_val = func(self)
|
@@ -129,36 +137,15 @@ def _liminal_decorator(
|
|
129
137
|
valid=False,
|
130
138
|
level=validator_level,
|
131
139
|
entity=self,
|
132
|
-
validator_name=validator_name,
|
140
|
+
validator_name=validator_name or pascalize(func.__name__),
|
133
141
|
message=str(e),
|
134
142
|
)
|
135
143
|
return BenchlingValidatorReport.create_validation_report(
|
136
144
|
valid=True,
|
137
145
|
level=validator_level,
|
138
146
|
entity=self,
|
139
|
-
validator_name=validator_name,
|
147
|
+
validator_name=validator_name or pascalize(func.__name__),
|
140
148
|
)
|
141
149
|
|
142
150
|
setattr(wrapper, "_is_liminal_validator", True)
|
143
151
|
return wrapper
|
144
|
-
|
145
|
-
|
146
|
-
def liminal_validator(
|
147
|
-
validator_level: ValidationSeverity = ValidationSeverity.LOW,
|
148
|
-
validator_name: str | None = None,
|
149
|
-
) -> Callable:
|
150
|
-
"""A decorator for a function that validates a Benchling entity, defined on a schema class.
|
151
|
-
Wraps around any exceptions raised by the validator function, and returns a BenchlingValidatorReport.
|
152
|
-
|
153
|
-
Parameters
|
154
|
-
----------
|
155
|
-
validator_level: ValidationSeverity
|
156
|
-
The severity level of the validation report. Defaults to ValidationSeverity.LOW.
|
157
|
-
validator_name: str | None =
|
158
|
-
The name of the validator. Defaults to the PascalCase version of the function name.
|
159
|
-
"""
|
160
|
-
return partial(
|
161
|
-
_liminal_decorator,
|
162
|
-
validator_level=validator_level,
|
163
|
-
validator_name=validator_name,
|
164
|
-
)
|
@@ -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
|
File without changes
|