Show More
@@ -754,7 +754,7 b' def get__all__entries(obj):' | |||||
754 |
|
754 | |||
755 |
|
755 | |||
756 | def match_dict_keys(keys: List[Union[str, bytes, Tuple[Union[str, bytes]]]], prefix: str, delims: str, |
|
756 | def match_dict_keys(keys: List[Union[str, bytes, Tuple[Union[str, bytes]]]], prefix: str, delims: str, | |
757 |
prefix |
|
757 | extra_prefix: Optional[Tuple[str, bytes]]=None) -> Tuple[str, int, List[str]]: | |
758 | """Used by dict_key_matches, matching the prefix to a list of keys |
|
758 | """Used by dict_key_matches, matching the prefix to a list of keys | |
759 |
|
759 | |||
760 | Parameters |
|
760 | Parameters | |
@@ -765,7 +765,7 b' def match_dict_keys(keys: List[Union[str, bytes, Tuple[Union[str, bytes]]]], pre' | |||||
765 | Part of the text already typed by the user. E.g. `mydict[b'fo` |
|
765 | Part of the text already typed by the user. E.g. `mydict[b'fo` | |
766 | delims: |
|
766 | delims: | |
767 | String of delimiters to consider when finding the current key. |
|
767 | String of delimiters to consider when finding the current key. | |
768 |
prefix |
|
768 | extra_prefix: optional | |
769 | Part of the text already typed in multi-key index cases. E.g. for |
|
769 | Part of the text already typed in multi-key index cases. E.g. for | |
770 | `mydict['foo', "bar", 'b`, this would be `('foo', 'bar')`. |
|
770 | `mydict['foo', "bar", 'b`, this would be `('foo', 'bar')`. | |
771 |
|
771 | |||
@@ -778,6 +778,7 b' def match_dict_keys(keys: List[Union[str, bytes, Tuple[Union[str, bytes]]]], pre' | |||||
778 | ``matches`` a list of replacement/completion |
|
778 | ``matches`` a list of replacement/completion | |
779 |
|
779 | |||
780 | """ |
|
780 | """ | |
|
781 | prefix_tuple = extra_prefix if extra_prefix else () | |||
781 | Nprefix = len(prefix_tuple) |
|
782 | Nprefix = len(prefix_tuple) | |
782 | def filter_by_prefix_tuple(key): |
|
783 | def filter_by_prefix_tuple(key): | |
783 | if len(key) < Nprefix: |
|
784 | if len(key) < Nprefix: | |
@@ -1708,12 +1709,9 b' class IPCompleter(Completer):' | |||||
1708 | if not keys: |
|
1709 | if not keys: | |
1709 | return keys |
|
1710 | return keys | |
1710 |
|
1711 | |||
1711 | if prefix0 != '': |
|
1712 | extra_prefix = eval(prefix0) if prefix0 != '' else None | |
1712 | tuple_prefix = eval(prefix0) |
|
|||
1713 | else: |
|
|||
1714 | tuple_prefix = tuple() |
|
|||
1715 |
|
1713 | |||
1716 |
closing_quote, token_offset, matches = match_dict_keys(keys, |
|
1714 | closing_quote, token_offset, matches = match_dict_keys(keys, prefix, self.splitter.delims, extra_prefix=extra_prefix) | |
1717 | if not matches: |
|
1715 | if not matches: | |
1718 | return matches |
|
1716 | return matches | |
1719 |
|
1717 |
General Comments 0
You need to be logged in to leave comments.
Login now