(
self,
namespace=None,
*,
use_colors='auto',
consider_getitems=True,
)
| 17 | depending on the type. |
| 18 | """ |
| 19 | def __init__( |
| 20 | self, |
| 21 | namespace=None, |
| 22 | *, |
| 23 | use_colors='auto', |
| 24 | consider_getitems=True, |
| 25 | ): |
| 26 | from _pyrepl import readline |
| 27 | rlcompleter.Completer.__init__(self, namespace) |
| 28 | if use_colors == 'auto': |
| 29 | # use colors only if we can |
| 30 | use_colors = get_colors().RED != "" |
| 31 | self.use_colors = use_colors |
| 32 | self.consider_getitems = consider_getitems |
| 33 | |
| 34 | if self.use_colors: |
| 35 | # In GNU readline, this prevents escaping of ANSI control |
| 36 | # characters in completion results. pyrepl's parse_and_bind() |
| 37 | # is a no-op, but pyrepl handles ANSI sequences natively |
| 38 | # via real_len()/stripcolor(). |
| 39 | readline.parse_and_bind('set dont-escape-ctrl-chars on') |
| 40 | self.theme = get_theme() |
| 41 | else: |
| 42 | self.theme = None |
| 43 | |
| 44 | if self.consider_getitems: |
| 45 | delims = readline.get_completer_delims() |
| 46 | delims = delims.replace('[', '') |
| 47 | delims = delims.replace(']', '') |
| 48 | readline.set_completer_delims(delims) |
| 49 | |
| 50 | def complete(self, text, state): |
| 51 | # if you press <tab> at the beginning of a line, insert an actual |
nothing calls this directly
no test coverage detected