MCPcopy Create free account
hub / github.com/bpython/bpython / _few_enough_underscores

Function _few_enough_underscores

bpython/autocomplete.py:182–193  ·  view source on GitHub ↗

Returns whether match should be shown based on current if current is _, True if match starts with 0 or 1 underscore if current is __, True regardless of match otherwise True if match does not start with any underscore

(current: str, match: str)

Source from the content-addressed store, hash-verified

180
181
182def _few_enough_underscores(current: str, match: str) -> bool:
183 """Returns whether match should be shown based on current
184
185 if current is _, True if match starts with 0 or 1 underscore
186 if current is __, True regardless of match
187 otherwise True if match does not start with any underscore
188 """
189 if current.startswith("__"):
190 return True
191 elif current.startswith("_") and not match.startswith("__"):
192 return True
193 return not match.startswith("_")
194
195
196def _method_match_none(word: str, size: int, text: str) -> bool:

Callers 2

matchesMethod · 0.85
matchesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected