66import re
77from typing import (
88 Any ,
9- AnyStr ,
109 Dict ,
1110 Iterable ,
1211 List ,
2625 __copyright__ ,
2726 __credits__ ,
2827 __license__ ,
29- __version__ ,
30- )
28+ __version__ )
29+ from ._util import (
30+ SqlStr )
3131
3232_BYTES_ENCODING = 'latin1'
3333"""
@@ -471,14 +471,15 @@ def expand_tuples(self) -> bool:
471471
472472 def format (
473473 self ,
474- sql : AnyStr ,
474+ sql : SqlStr ,
475475 params : Union [Dict [Union [str , int ], Any ], Sequence [Any ]],
476- ) -> Tuple [AnyStr , Union [Dict [Union [ str , int ] , Any ], Sequence [Any ]]]:
476+ ) -> Tuple [SqlStr , Union [Dict [str , Any ], Sequence [Any ]]]:
477477 """
478478 Convert the SQL query to use the out-style parameters instead of
479479 the in-style parameters.
480480
481- *sql* (:class:`str` or :class:`bytes`) is the SQL query.
481+ *sql* (:class:`LiteralString`, :class:`str`, or :class:`bytes`) is
482+ the SQL query.
482483
483484 *params* (:class:`~collections.abc.Mapping` or :class:`~collections.abc.Sequence`)
484485 contains the set of in-style parameters. It maps each parameter
@@ -489,7 +490,8 @@ def format(
489490
490491 Returns a :class:`tuple` containing:
491492
492- - The formatted SQL query (:class:`str` or :class:`bytes`).
493+ - The formatted SQL query (:class:`LiteralString`, :class:`str` or
494+ :class:`bytes`).
493495
494496 - The set of converted out-style parameters (:class:`dict` or
495497 :class:`list`).
@@ -521,14 +523,15 @@ def format(
521523
522524 def formatmany (
523525 self ,
524- sql : AnyStr ,
526+ sql : SqlStr ,
525527 many_params : Union [Iterable [Dict [Union [str , int ], Any ]], Iterable [Sequence [Any ]]],
526- ) -> Tuple [AnyStr , Union [List [Dict [Union [ str , int ] , Any ]], List [Sequence [Any ]]]]:
528+ ) -> Tuple [SqlStr , Union [List [Dict [str , Any ]], List [Sequence [Any ]]]]:
527529 """
528530 Convert the SQL query to use the out-style parameters instead of the
529531 in-style parameters.
530532
531- *sql* (:class:`str` or :class:`bytes`) is the SQL query.
533+ *sql* (:class:`LiteralString`, :class:`str` or :class:`bytes`) is
534+ the SQL query.
532535
533536 *many_params* (:class:`~collections.abc.Iterable`) contains each set
534537 of in-style parameters (*params*).
@@ -542,7 +545,8 @@ def formatmany(
542545
543546 Returns a :class:`tuple` containing:
544547
545- - The formatted SQL query (:class:`str` or :class:`bytes`).
548+ - The formatted SQL query (:class:`LiteralString`, :class:`str` or
549+ :class:`bytes`).
546550
547551 - A :class:`list` containing each set of converted out-style
548552 parameters (:class:`dict` or :class:`list`).
0 commit comments