From 7d22039c2ae0aef6abc575008f11b95e555e3e9a Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Sat, 10 Jul 2021 09:24:41 +0300 Subject: gn3: db: Use correct type for columns arg in fetch functions --- gn3/db/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gn3/db') diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py index afc8897..5ab9f3c 100644 --- a/gn3/db/__init__.py +++ b/gn3/db/__init__.py @@ -1,7 +1,7 @@ # pylint: disable=[R0902, R0903] """Module that exposes common db operations""" from dataclasses import asdict, astuple -from typing import Any, Dict, List, Optional, Generator +from typing import Any, Dict, List, Optional, Generator, Union from typing_extensions import Protocol from gn3.db.metadata_audit import MetadataAudit @@ -67,7 +67,7 @@ def update(conn: Any, def fetchone(conn: Any, table: str, where: Optional[Dataclass], - columns: Optional[List[str]] = "*") -> Optional[Dataclass]: + columns: Union[str, List[str]] = "*") -> Optional[Dataclass]: """Run a SELECT on a table. Returns only one result!""" if not any(astuple(where)): return None @@ -90,7 +90,7 @@ def fetchone(conn: Any, def fetchall(conn: Any, table: str, where: Optional[Dataclass], - columns: Optional[List[str]] = "*") -> Optional[Generator]: + columns: Union[str, List[str]] = "*") -> Optional[Generator]: """Run a SELECT on a table. Returns all the results as a tuple!""" if not any(astuple(where)): return None -- cgit v1.2.3