@@ -489,7 +489,7 @@ def upper(value):
489489 """
490490
491491 def register (fn : Callable ) -> Callable :
492- fn_name = name or fn .__name__
492+ fn_name = name or fn .__name__ # type: ignore
493493 arity = len (inspect .signature (fn ).parameters )
494494 if not replace and (fn_name , arity ) in self ._registered_functions :
495495 return fn
@@ -1450,11 +1450,11 @@ def rows_where(
14501450 def pks_and_rows_where (
14511451 self ,
14521452 where : Optional [str ] = None ,
1453- where_args : Optional [Union [Iterable , dict ]] = None ,
1453+ where_args : Optional [Union [Sequence , Dict [ str , Any ] ]] = None ,
14541454 order_by : Optional [str ] = None ,
14551455 limit : Optional [int ] = None ,
14561456 offset : Optional [int ] = None ,
1457- ) -> Generator [Tuple [Any , Dict ], None , None ]:
1457+ ) -> Generator [Tuple [Any , Dict [ str , Any ] ], None , None ]:
14581458 """
14591459 Like ``.rows_where()`` but returns ``(pk, row)`` pairs - ``pk`` can be a single value or tuple.
14601460
@@ -1848,7 +1848,7 @@ def duplicate(self, new_name: str) -> "Table":
18481848 quote_identifier (self .name ),
18491849 )
18501850 self .db .execute (sql )
1851- return self .db [ new_name ]
1851+ return self .db . table ( new_name )
18521852
18531853 def transform (
18541854 self ,
@@ -2153,7 +2153,7 @@ def extract(
21532153 )
21542154 )
21552155 table = table or "_" .join (columns )
2156- lookup_table = self .db [ table ]
2156+ lookup_table = self .db . table ( table )
21572157 fk_column = fk_column or "{}_id" .format (table )
21582158 magic_lookup_column = "{}_{}" .format (fk_column , os .urandom (6 ).hex ())
21592159
@@ -2680,7 +2680,7 @@ def disable_fts(self) -> "Table":
26802680 )
26812681 return self
26822682
2683- def rebuild_fts (self ) -> None :
2683+ def rebuild_fts (self ) -> "Table" :
26842684 "Run the ``rebuild`` operation against the associated full-text search index table."
26852685 fts_table = self .detect_fts ()
26862686 if fts_table is None :
@@ -2767,7 +2767,7 @@ def search_sql(
27672767 self .name
27682768 )
27692769 fts_table_quoted = quote_identifier (fts_table )
2770- virtual_table_using = self .db [ fts_table ] .virtual_table_using
2770+ virtual_table_using = self .db . table ( fts_table ) .virtual_table_using
27712771 sql = textwrap .dedent (
27722772 """
27732773 with {original} as (
@@ -2887,7 +2887,7 @@ def delete(self, pk_values: Union[list, tuple, str, int, float]) -> "Table":
28872887 def delete_where (
28882888 self ,
28892889 where : Optional [str ] = None ,
2890- where_args : Optional [Union [Iterable , dict ]] = None ,
2890+ where_args : Optional [Union [Sequence , Dict [ str , Any ] ]] = None ,
28912891 analyze : bool = False ,
28922892 ) -> "Table" :
28932893 """
@@ -2978,9 +2978,9 @@ def convert(
29782978 drop : bool = False ,
29792979 multi : bool = False ,
29802980 where : Optional [str ] = None ,
2981- where_args : Optional [Union [Iterable , dict ]] = None ,
2981+ where_args : Optional [Union [Sequence , Dict [ str , Any ] ]] = None ,
29822982 show_progress : bool = False ,
2983- ):
2983+ ) -> "Table" :
29842984 """
29852985 Apply conversion function ``fn`` to every value in the specified columns.
29862986
@@ -3143,7 +3143,7 @@ def build_insert_queries_and_params(
31433143 if has_extracts :
31443144 for i , key in enumerate (all_columns ):
31453145 if key in extracts :
3146- record_values [i ] = self .db [ extracts [key ]] .lookup (
3146+ record_values [i ] = self .db . table ( extracts [key ]) .lookup (
31473147 {"value" : record_values [i ]}
31483148 )
31493149 values .append (record_values )
@@ -3164,7 +3164,7 @@ def build_insert_queries_and_params(
31643164 )
31653165 if key in extracts :
31663166 extract_table = extracts [key ]
3167- value = self .db [ extract_table ] .lookup ({"value" : value })
3167+ value = self .db . table ( extract_table ) .lookup ({"value" : value })
31683168 record_values .append (value )
31693169 values .append (record_values )
31703170
@@ -3874,7 +3874,7 @@ def m2m(
38743874 already exists.
38753875 """
38763876 if isinstance (other_table , str ):
3877- other_table = cast ( Table , self .db .table (other_table , pk = pk ) )
3877+ other_table = self .db .table (other_table , pk = pk )
38783878 our_id = self .last_pk
38793879 if lookup is not None :
38803880 assert record_or_iterable is None , "Provide lookup= or record, not both"
0 commit comments