4040from typing import (
4141 Any ,
4242 Dict ,
43- Iterator ,
4443 List ,
4544 Optional ,
46- Sequence ,
4745 Set ,
4846 Tuple ,
4947)
48+ from collections .abc import Iterator , Sequence
49+
5050from . import inspection
5151from . import line as lineparts
5252from .line import LinePart
@@ -236,7 +236,7 @@ def __init__(
236236 @abc .abstractmethod
237237 def matches (
238238 self , cursor_offset : int , line : str , ** kwargs : Any
239- ) -> Optional [Set [str ]]:
239+ ) -> Optional [set [str ]]:
240240 """Returns a list of possible matches given a line and cursor, or None
241241 if this completion type isn't applicable.
242242
@@ -268,7 +268,7 @@ def format(self, word: str) -> str:
268268
269269 def substitute (
270270 self , cursor_offset : int , line : str , match : str
271- ) -> Tuple [int , str ]:
271+ ) -> tuple [int , str ]:
272272 """Returns a cursor offset and line with match swapped in"""
273273 lpart = self .locate (cursor_offset , line )
274274 assert lpart
@@ -311,7 +311,7 @@ def format(self, word: str) -> str:
311311
312312 def matches (
313313 self , cursor_offset : int , line : str , ** kwargs : Any
314- ) -> Optional [Set [str ]]:
314+ ) -> Optional [set [str ]]:
315315 return_value = None
316316 all_matches = set ()
317317 for completer in self ._completers :
@@ -336,7 +336,7 @@ def __init__(
336336
337337 def matches (
338338 self , cursor_offset : int , line : str , ** kwargs : Any
339- ) -> Optional [Set [str ]]:
339+ ) -> Optional [set [str ]]:
340340 return self .module_gatherer .complete (cursor_offset , line )
341341
342342 def locate (self , cursor_offset : int , line : str ) -> Optional [LinePart ]:
@@ -356,7 +356,7 @@ def __init__(self, mode: AutocompleteModes = AutocompleteModes.SIMPLE):
356356
357357 def matches (
358358 self , cursor_offset : int , line : str , ** kwargs : Any
359- ) -> Optional [Set [str ]]:
359+ ) -> Optional [set [str ]]:
360360 cs = lineparts .current_string (cursor_offset , line )
361361 if cs is None :
362362 return None
@@ -389,9 +389,9 @@ def matches(
389389 cursor_offset : int ,
390390 line : str ,
391391 * ,
392- locals_ : Optional [Dict [str , Any ]] = None ,
392+ locals_ : Optional [dict [str , Any ]] = None ,
393393 ** kwargs : Any ,
394- ) -> Optional [Set [str ]]:
394+ ) -> Optional [set [str ]]:
395395 r = self .locate (cursor_offset , line )
396396 if r is None :
397397 return None
@@ -421,7 +421,7 @@ def format(self, word: str) -> str:
421421 return _after_last_dot (word )
422422
423423 def attr_matches (
424- self , text : str , namespace : Dict [str , Any ]
424+ self , text : str , namespace : dict [str , Any ]
425425 ) -> Iterator [str ]:
426426 """Taken from rlcompleter.py and bent to my will."""
427427
@@ -460,7 +460,7 @@ def attr_lookup(self, obj: Any, expr: str, attr: str) -> Iterator[str]:
460460 if self .method_match (word , n , attr ) and word != "__builtins__"
461461 )
462462
463- def list_attributes (self , obj : Any ) -> List [str ]:
463+ def list_attributes (self , obj : Any ) -> list [str ]:
464464 # TODO: re-implement dir without AttrCleaner here
465465 #
466466 # Note: accessing `obj.__dir__` via `getattr_static` is not side-effect free.
@@ -474,9 +474,9 @@ def matches(
474474 cursor_offset : int ,
475475 line : str ,
476476 * ,
477- locals_ : Optional [Dict [str , Any ]] = None ,
477+ locals_ : Optional [dict [str , Any ]] = None ,
478478 ** kwargs : Any ,
479- ) -> Optional [Set [str ]]:
479+ ) -> Optional [set [str ]]:
480480 if locals_ is None :
481481 return None
482482
@@ -516,7 +516,7 @@ def matches(
516516 current_block : Optional [str ] = None ,
517517 complete_magic_methods : Optional [bool ] = None ,
518518 ** kwargs : Any ,
519- ) -> Optional [Set [str ]]:
519+ ) -> Optional [set [str ]]:
520520 if (
521521 current_block is None
522522 or complete_magic_methods is None
@@ -541,9 +541,9 @@ def matches(
541541 cursor_offset : int ,
542542 line : str ,
543543 * ,
544- locals_ : Optional [Dict [str , Any ]] = None ,
544+ locals_ : Optional [dict [str , Any ]] = None ,
545545 ** kwargs : Any ,
546- ) -> Optional [Set [str ]]:
546+ ) -> Optional [set [str ]]:
547547 """Compute matches when text is a simple name.
548548 Return a list of all keywords, built-in functions and names currently
549549 defined in self.namespace that match.
@@ -583,7 +583,7 @@ def matches(
583583 * ,
584584 funcprops : Optional [inspection .FuncProps ] = None ,
585585 ** kwargs : Any ,
586- ) -> Optional [Set [str ]]:
586+ ) -> Optional [set [str ]]:
587587 if funcprops is None :
588588 return None
589589
@@ -622,9 +622,9 @@ def matches(
622622 cursor_offset : int ,
623623 line : str ,
624624 * ,
625- locals_ : Optional [Dict [str , Any ]] = None ,
625+ locals_ : Optional [dict [str , Any ]] = None ,
626626 ** kwargs : Any ,
627- ) -> Optional [Set [str ]]:
627+ ) -> Optional [set [str ]]:
628628 if locals_ is None :
629629 locals_ = __main__ .__dict__
630630
@@ -648,7 +648,7 @@ def matches(
648648 class MultilineJediCompletion (BaseCompletionType ): # type: ignore [no-redef]
649649 def matches (
650650 self , cursor_offset : int , line : str , ** kwargs : Any
651- ) -> Optional [Set [str ]]:
651+ ) -> Optional [set [str ]]:
652652 return None
653653
654654 def locate (self , cursor_offset : int , line : str ) -> Optional [LinePart ]:
@@ -665,9 +665,9 @@ def matches(
665665 line : str ,
666666 * ,
667667 current_block : Optional [str ] = None ,
668- history : Optional [List [str ]] = None ,
668+ history : Optional [list [str ]] = None ,
669669 ** kwargs : Any ,
670- ) -> Optional [Set [str ]]:
670+ ) -> Optional [set [str ]]:
671671 if (
672672 current_block is None
673673 or history is None
@@ -725,12 +725,12 @@ def get_completer(
725725 cursor_offset : int ,
726726 line : str ,
727727 * ,
728- locals_ : Optional [Dict [str , Any ]] = None ,
728+ locals_ : Optional [dict [str , Any ]] = None ,
729729 argspec : Optional [inspection .FuncProps ] = None ,
730- history : Optional [List [str ]] = None ,
730+ history : Optional [list [str ]] = None ,
731731 current_block : Optional [str ] = None ,
732732 complete_magic_methods : Optional [bool ] = None ,
733- ) -> Tuple [ List [str ], Optional [BaseCompletionType ]]:
733+ ) -> tuple [ list [str ], Optional [BaseCompletionType ]]:
734734 """Returns a list of matches and an applicable completer
735735
736736 If no matches available, returns a tuple of an empty list and None
@@ -747,7 +747,7 @@ def get_completer(
747747 double underscore methods like __len__ in method signatures
748748 """
749749
750- def _cmpl_sort (x : str ) -> Tuple [bool , str ]:
750+ def _cmpl_sort (x : str ) -> tuple [bool , str ]:
751751 """
752752 Function used to sort the matches.
753753 """
@@ -784,7 +784,7 @@ def _cmpl_sort(x: str) -> Tuple[bool, str]:
784784
785785def get_default_completer (
786786 mode : AutocompleteModes , module_gatherer : ModuleGatherer
787- ) -> Tuple [BaseCompletionType , ...]:
787+ ) -> tuple [BaseCompletionType , ...]:
788788 return (
789789 (
790790 DictKeyCompletion (mode = mode ),
0 commit comments