Skip to content

Commit

Permalink
Merge branch 'collerek:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cadlagtrader authored Aug 28, 2024
2 parents ecd50e3 + 1cd9204 commit fb6c67f
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
python-version: "3.11"

- name: Install Poetry
uses: snok/install-poetry@v1.3.3
uses: snok/install-poetry@v1.4
with:
version: 1.4.2
virtualenvs-create: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python-version: 3.11

- name: Install Poetry
uses: snok/install-poetry@v1.3.3
uses: snok/install-poetry@v1.4
with:
version: 1.4.2
virtualenvs-create: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python-version: '3.x'

- name: Install Poetry
uses: snok/install-poetry@v1.3
uses: snok/install-poetry@v1.4
with:
version: 1.4.1
virtualenvs-create: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1.3.3
uses: snok/install-poetry@v1.4
with:
version: 1.4.2
virtualenvs-create: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python-version: 3.11

- name: Install Poetry
uses: snok/install-poetry@v1.3.3
uses: snok/install-poetry@v1.4
with:
version: 1.4.2
virtualenvs-create: false
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type_check:
mkdir -p .mypy_cache && poetry run python -m mypy ormar tests --ignore-missing-imports --install-types --non-interactive

lint:
poetry run python -m ruff . --fix
poetry run python -m ruff check . --fix

fmt:
poetry run python -m black .
Expand Down
2 changes: 1 addition & 1 deletion ormar/models/helpers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def populate_default_options_values( # noqa: CCR001
name for name, field in model_fields.items() if field.__type__ == pydantic.Json
}
new_model._bytes_fields = {
name for name, field in model_fields.items() if field.__type__ == bytes
name for name, field in model_fields.items() if field.__type__ is bytes
}

new_model.__relation_map__ = None
Expand Down
2 changes: 1 addition & 1 deletion ormar/models/helpers/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def replace_models_with_copy(
if inspect.isclass(annotation) and issubclass(annotation, ormar.Model):
return create_copy_to_avoid_circular_references(model=annotation)
elif hasattr(annotation, "__origin__") and annotation.__origin__ in {list, Union}:
if annotation.__origin__ == list:
if annotation.__origin__ is list:
return List[ # type: ignore
replace_models_with_copy(
annotation=annotation.__args__[0],
Expand Down
4 changes: 2 additions & 2 deletions ormar/models/helpers/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def populates_sample_fields_values(
:type relation_map: Optional[Dict]
"""
if not field.is_relation:
is_bytes_str = field.__type__ == bytes and field.represent_as_base64_str
is_bytes_str = field.__type__ is bytes and field.represent_as_base64_str
example[name] = field.__sample__ if not is_bytes_str else "string"
elif isinstance(relation_map, dict) and name in relation_map:
example[name] = get_nested_model_example(
Expand Down Expand Up @@ -153,7 +153,7 @@ def generate_example_for_nested_types(type_: Any) -> Any:
"""
if type_.__origin__ == Union:
return generate_example_for_union(type_=type_)
if type_.__origin__ == list:
if type_.__origin__ is list:
return [get_pydantic_example_repr(type_.__args__[0])]


Expand Down
2 changes: 1 addition & 1 deletion ormar/models/metaclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def add_field_descriptor(
setattr(new_model, name, RelationDescriptor(name=name))
elif field.__type__ == pydantic.Json:
setattr(new_model, name, JsonDescriptor(name=name))
elif field.__type__ == bytes:
elif field.__type__ is bytes:
setattr(new_model, name, BytesDescriptor(name=name))
else:
setattr(new_model, name, PydanticDescriptor(name=name))
Expand Down
2 changes: 1 addition & 1 deletion ormar/queryset/actions/order_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def is_postgres_bool(self) -> bool:
field_type = self.target_model.ormar_config.model_fields[
self.field_name
].__type__
return dialect == "postgresql" and field_type == bool
return dialect == "postgresql" and field_type is bool

def get_field_name_text(self) -> str:
"""
Expand Down
3 changes: 1 addition & 2 deletions ormar/relations/querysetproxy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _weakref import CallableProxyType
from typing import ( # noqa: I100, I201
TYPE_CHECKING,
Any,
Expand All @@ -16,8 +17,6 @@
cast,
)

from _weakref import CallableProxyType

import ormar # noqa: I100, I202
from ormar.exceptions import ModelPersistenceError, NoMatch, QueryDefinitionError

Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fb6c67f

Please sign in to comment.