From c3a600b4498c4b12f4ede1350e5c862c296850a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Jan 2023 07:10:21 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E2=AC=86=20Update=20sqlalchemy[asyncio]=20?= =?UTF-8?q?requirement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updates the requirements on [sqlalchemy[asyncio]](https://github.com/sqlalchemy/sqlalchemy) to permit the latest version. - [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases) - [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst) - [Commits](https://github.com/sqlalchemy/sqlalchemy/commits) --- updated-dependencies: - dependency-name: sqlalchemy[asyncio] dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2447eae..4eea167 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ dependencies = [ "typing-extensions >=3.7.4,<4.5.0", "pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0", - "sqlalchemy[asyncio] >=1.3.18,<1.5.0", + "sqlalchemy[asyncio] >=1.3.18,<2.1.0", "PyPika ==0.48.9" ] From dcdfb1d2be97eeebfd440d3034c32b63fe4a10bb Mon Sep 17 00:00:00 2001 From: Yasser Tahiri Date: Sat, 28 Jan 2023 21:16:20 +0400 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A6=8B=20Update=20`pre-commit`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e36f59e..5a67ae9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,22 +19,16 @@ repos: - --py3-plus - --keep-runtime-typing - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.227 + rev: v0.0.236 hooks: - id: ruff args: - --fix - repo: https://github.com/pycqa/isort - rev: 5.11.4 + rev: 5.12.0 hooks: - id: isort name: isort (python) - - id: isort - name: isort (cython) - types: [cython] - - id: isort - name: isort (pyi) - types: [pyi] - repo: https://github.com/psf/black rev: 22.12.0 hooks: From 0d3bf89e406fd369074dd13abb6864097070474f Mon Sep 17 00:00:00 2001 From: Yasser Tahiri Date: Sat, 28 Jan 2023 21:16:42 +0400 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9E=95=20Add=20`pytest-pretty`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 667dc4b..3999b5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,6 +60,7 @@ test = [ "codecov==2.1.12", "pytest-cov==4.0.0", "python-decouple", + "pytest-pretty==1.0.1" ] docs = [ "mkdocs >=1.1.2,<2.0.0", From db885c94c2c66923487b246c4ba5f7db9c958152 Mon Sep 17 00:00:00 2001 From: Yasser Tahiri Date: Sat, 28 Jan 2023 21:17:08 +0400 Subject: [PATCH 4/4] :snake: ignore some `mypy` issue --- ormdantic/generator/_crud.py | 2 +- ormdantic/generator/_serializer.py | 5 +++-- ormdantic/generator/_table.py | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ormdantic/generator/_crud.py b/ormdantic/generator/_crud.py index bac9451..8cf71c8 100644 --- a/ormdantic/generator/_crud.py +++ b/ormdantic/generator/_crud.py @@ -133,7 +133,7 @@ async def count(self, where: dict[str, Any] | None = None, depth: int = 0) -> in async def _execute_query(self, query: QueryBuilder) -> Any: async_session = sessionmaker( self._engine, expire_on_commit=False, class_=AsyncSession - ) + ) # type: ignore async with async_session() as session: async with session.begin(): result = await session.execute(text(str(query))) diff --git a/ormdantic/generator/_serializer.py b/ormdantic/generator/_serializer.py index 1329742..19bfb9f 100644 --- a/ormdantic/generator/_serializer.py +++ b/ormdantic/generator/_serializer.py @@ -24,7 +24,8 @@ def __init__( self, table_data: OrmTable, # type: ignore table_map: Map, - result_set: CursorResult, + # TODO: Missing type parameters for generic type "CursorResult". + result_set: CursorResult, # type: ignore is_array: bool, depth: int, ) -> None: @@ -49,7 +50,7 @@ def __init__( ) }, ) - self._columns = [it[0] for it in self._result_set.cursor.description] + self._columns = [it[0] for it in self._result_set.cursor.description] # type: ignore self._return_dict: dict[str, Any] = {} def deserialize(self) -> SerializedType: diff --git a/ormdantic/generator/_table.py b/ormdantic/generator/_table.py index eb9fbd7..dff9ddc 100644 --- a/ormdantic/generator/_table.py +++ b/ormdantic/generator/_table.py @@ -59,7 +59,7 @@ async def init(self) -> None: def _get_columns( self, table_data: OrmTable # type: ignore - ) -> tuple[Column[Any] | Column, ...]: + ) -> tuple[Column[Any] | Column, ...]: # type: ignore columns = [] for field_name, field in table_data.model.__fields__.items(): kwargs = { @@ -77,7 +77,7 @@ def _get_columns( def _get_column( self, field_name: str, field: ModelField, **kwargs: Any - ) -> Column | None: + ) -> Column | None: # type: ignore outer_origin = get_origin(field.outer_type_) origin = get_origin(field.type_) if outer_origin and outer_origin == list: @@ -95,7 +95,7 @@ def _get_column( col_type = ( postgresql.UUID if self._engine.name == "postgres" else String(36) ) - return Column(field_name, col_type, **kwargs) + return Column(field_name, col_type, **kwargs) # type: ignore if issubclass(field.type_, BaseModel): return Column(field_name, JSON, **kwargs) if issubclass(field.type_, str): @@ -118,7 +118,7 @@ def _get_column( def _get_column_from_type_args( self, field_name: str, field: ModelField, **kwargs: Any - ) -> Column | None: + ) -> Column | None: # type: ignore for arg in get_args(field.type_): if arg in [it.model for it in self._table_map.name_to_data.values()]: foreign_table = TableName_From_Model(arg, self._table_map)