Skip to content

Commit

Permalink
chore: fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
art049 committed Dec 12, 2023
1 parent 4341d2f commit cb9b9ed
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 32 deletions.
11 changes: 1 addition & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ repos:
hooks:
- id: prettier
exclude: "^docs/.*"
- repo: https://github.com/psf/black
rev: "23.3.0"
hooks:
- id: black
exclude: "^docs/.*|.github/release.py"
- repo: https://github.com/PyCQA/isort.git
rev: "5.12.0"
hooks:
- id: isort
exclude: "^docs/.*"
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
hooks:
Expand All @@ -51,6 +41,7 @@ repos:
files: "^odmantic/"
additional_dependencies:
- toml

- repo: https://github.com/terrencepreilly/darglint
rev: v1.8.1
hooks:
Expand Down
4 changes: 2 additions & 2 deletions odmantic/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def is_classvar(ann_type: Type[Any]) -> bool:
if _check_classvar(ann_type) or _check_classvar(get_origin(ann_type)):
return True

# this is an ugly workaround for class vars that contain forward references and are therefore themselves
# forward references, see #3679
# this is an ugly workaround for class vars that contain forward references and are
# therefore themselves forward references, see #3679
if ann_type.__class__ == ForwardRef and ann_type.__forward_arg__.startswith(
"ClassVar["
):
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ dependencies = [
]
[project.optional-dependencies]
test = [
"black ~= 23.3.0",
"isort ~=5.8.0",
"ruff ~= 0.0.277",
"mypy ~= 1.4.1",
"pytest ~= 7.0",
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ class M(Model):
1 validation error for M
field
Key 'field' not found in document [type=odmantic::key_not_found_in_document, input_value={'_id': ObjectId('<ObjectId>')}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -1208,7 +1208,7 @@ class M(Model):
1 validation error for M
field
Key 'field' not found in document [type=odmantic::key_not_found_in_document, input_value={'_id': ObjectId('<ObjectId>')}, input_type=dict]\
"""
""" # noqa: E501
)


Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_engine_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class M(Model):
1 validation error for M
r
Referenced document not found for foreign key 'r' [type=odmantic::referenced_document_not_found, input_value={'_id': ObjectId('<ObjectId>')}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -294,7 +294,7 @@ class M(Model):
1 validation error for M
r
Referenced document not found for foreign key 'r' [type=odmantic::referenced_document_not_found, input_value={'_id': ObjectId('<ObjectId>')}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -319,7 +319,7 @@ class M(Model):
1 validation error for M
r.field
Key 'field' not found in document [type=odmantic::key_not_found_in_document, input_value={'_id': ObjectId('<ObjectId>')}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -344,5 +344,5 @@ class M(Model):
1 validation error for M
r.field
Key 'field' not found in document [type=odmantic::key_not_found_in_document, input_value={'_id': ObjectId('<ObjectId>')}, input_type=dict]\
"""
""" # noqa: E501
)
2 changes: 1 addition & 1 deletion tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class M(Model):
model_config = {"validate_assignment": True}

assert str(exc_info.value) == snapshot(
"'M': configuration attribute 'validate_assignment' is enforced to True by ODMantic and cannot be changed"
"'M': configuration attribute 'validate_assignment' is enforced to True by ODMantic and cannot be changed" # noqa: E501
)


Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_field.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Optional

import pytest

from odmantic.field import Field
Expand Down
18 changes: 9 additions & 9 deletions tests/unit/test_model_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class M(Model):
1 validation error for M
field
Key 'custom' not found in document [type=odmantic::key_not_found_in_document, input_value={'_id': ObjectId('<ObjectId>')}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -139,7 +139,7 @@ class M(Model):
1 validation error for M
e.f.a
Key 'a' not found in document [type=odmantic::key_not_found_in_document, input_value={}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -154,7 +154,7 @@ class E(EmbeddedModel):
1 validation error for E
f
Key 'f' not found in document [type=odmantic::key_not_found_in_document, input_value={}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -168,7 +168,7 @@ class E(EmbeddedModel):
[
"1 validation error for E",
"f",
" Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='aa', input_type=str]",
" Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='aa', input_type=str]", # noqa: E501
]
)

Expand Down Expand Up @@ -256,7 +256,7 @@ class M(Model):
1 validation error for M
f
Incorrect generic embedded model value '{1: {'name': 'Jack'}}' [type=odmantic::incorrect_generic_embedded_model_value, input_value={'_id': 1, 'f': {1: {'name': 'Jack'}}}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -276,7 +276,7 @@ class M(Model):
1 validation error for M
f
Key 'f' not found in document [type=odmantic::key_not_found_in_document, input_value={'_id': 1}, input_type=dict]\
"""
""" # noqa: E501
)


Expand Down Expand Up @@ -305,7 +305,7 @@ class M(Model):
1 validation error for M
f
Incorrect generic embedded model value '[]' [type=odmantic::incorrect_generic_embedded_model_value, input_value={'_id': 1, 'f': []}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -323,7 +323,7 @@ class M(Model):
1 validation error for M
f.["key"].e
Key 'e' not found in document [type=odmantic::key_not_found_in_document, input_value={'not_there': 'a'}, input_type=dict]\
"""
""" # noqa: E501
)


Expand All @@ -341,7 +341,7 @@ class M(Model):
1 validation error for M
f.[0].e
Key 'e' not found in document [type=odmantic::key_not_found_in_document, input_value={'not_there': 'a'}, input_type=dict]\
"""
""" # noqa: E501
)


Expand Down

0 comments on commit cb9b9ed

Please sign in to comment.