Skip to content

Commit

Permalink
Improve type annotations in amsphinxql
Browse files Browse the repository at this point in the history
  • Loading branch information
andreymal committed Aug 30, 2023
1 parent f053dce commit 634f2f2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mini_fiction/apis/amsphinxql.py
Expand Up @@ -2,8 +2,13 @@
from queue import Queue
from threading import Lock, local
from dataclasses import dataclass
import typing
from typing import Any, TypeVar, Union, Optional, Sequence, Tuple, List, Dict

if typing.TYPE_CHECKING:
from MySQLdb.cursors import Cursor


T = TypeVar("T", bound="SphinxConnection")


Expand Down Expand Up @@ -73,7 +78,7 @@ def _execute(
self,
sql: str,
args: Optional[Sequence[Union[str, bytes]]] = None,
):
) -> "Cursor":
cursor = self.mysql_conn.cursor()
cursor.execute(sql, args)
return cursor
Expand Down Expand Up @@ -389,7 +394,7 @@ def __init__(
self,
conn: Dict[str, Any],
max_conns: int = 5,
conn_queue: Optional[Queue] = None,
conn_queue: "Optional[Queue[SphinxConnection]]" = None,
):
self.conn = conn
self.max_conns = max_conns
Expand Down

0 comments on commit 634f2f2

Please sign in to comment.