Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
collerek committed Apr 23, 2021
1 parent ecd613d commit 638af9a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ jobs:
uses: codecov/codecov-action@v1
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v2.7.5
if: github.event.pull_request.head.repo.full_name == 'collerek/ormar'
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_COVERAGE_TOKEN }}
8 changes: 8 additions & 0 deletions docs/releases.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.10.5

## 🐛 Fixes

* Fix bug in `fastapi-pagination` [#73](https://github.com/uriyyo/fastapi-pagination/issues/73)
* Remove unnecessary `Optional` in `List[Optional[T]]` in return value for `QuerySet.all()` and `Querysetproxy.all()` return values [#174](https://github.com/collerek/ormar/issues/174)
* Run tests coverage publish only on internal prs instead of all in github action.

# 0.10.4

## ✨ Features
Expand Down
2 changes: 1 addition & 1 deletion ormar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __repr__(self) -> str:

Undefined = UndefinedType()

__version__ = "0.10.4"
__version__ = "0.10.5"
__all__ = [
"Integer",
"BigInteger",
Expand Down
2 changes: 1 addition & 1 deletion ormar/models/newbasemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ def dict( # type: ignore # noqa A003
if relation_map is not None
else translate_list_to_dict(self._iterate_related_models())
)
pk_only = object.__getattribute__(self, "__pk_only__")
pk_only = getattr(self, "__pk_only__", False)
if relation_map and not pk_only:
dict_instance = self._extract_nested_models(
relation_map=relation_map,
Expand Down
1 change: 1 addition & 0 deletions ormar/models/quick_access_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"__fields__",
"__fields_set__",
"__json_encoder__",
"__pk_only__",
"__post_root_validators__",
"__pre_root_validators__",
"__private_attributes__",
Expand Down
10 changes: 5 additions & 5 deletions ormar/queryset/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ def replace_if_none(arg_name: str) -> Any:
)

async def _prefetch_related_models(
self, models: List[Optional["T"]], rows: List
) -> List[Optional["T"]]:
self, models: List["T"], rows: List
) -> List["T"]:
"""
Performs prefetch query for selected models names.
Expand All @@ -158,7 +158,7 @@ async def _prefetch_related_models(
)
return await query.prefetch_related(models=models, rows=rows) # type: ignore

def _process_query_result_rows(self, rows: List) -> List[Optional["T"]]:
def _process_query_result_rows(self, rows: List) -> List["T"]:
"""
Process database rows and initialize ormar Model from each of the rows.
Expand All @@ -179,7 +179,7 @@ def _process_query_result_rows(self, rows: List) -> List[Optional["T"]]:
]
if result_rows:
return self.model.merge_instances_list(result_rows) # type: ignore
return cast(List[Optional["T"]], result_rows)
return cast(List["T"], result_rows)

def _resolve_filter_groups(
self, groups: Any
Expand Down Expand Up @@ -884,7 +884,7 @@ async def update_or_create(self, **kwargs: Any) -> "T":
model = await self.get(pk=kwargs[pk_name])
return await model.update(**kwargs)

async def all(self, *args: Any, **kwargs: Any) -> List[Optional["T"]]: # noqa: A003
async def all(self, *args: Any, **kwargs: Any) -> List["T"]: # noqa: A003
"""
Returns all rows from a database for given model for set filter options.
Expand Down
2 changes: 1 addition & 1 deletion ormar/relations/querysetproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ async def get(self, *args: Any, **kwargs: Any) -> "T":
self._register_related(get)
return get

async def all(self, *args: Any, **kwargs: Any) -> List[Optional["T"]]: # noqa: A003
async def all(self, *args: Any, **kwargs: Any) -> List["T"]: # noqa: A003
"""
Returns all rows from a database for given model for set filter options.
Expand Down

0 comments on commit 638af9a

Please sign in to comment.