| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 424345e commit 167fc26
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -176,11 +176,11 @@ def from_string(cls, value: str) -> Optional["AutocompleteModes"]: | |||
| 176 | 176 | KEYWORDS = frozenset(keyword.kwlist) | |
| 177 | 177 | ||
| 178 | 178 | ||
| 179 | - def after_last_dot(name: str) -> str: | ||
| 179 | + def _after_last_dot(name: str) -> str: | ||
| 180 | 180 | return name.rstrip(".").rsplit(".")[-1] | |
| 181 | 181 | ||
| 182 | 182 | ||
| 183 | - def few_enough_underscores(current: str, match: str) -> bool: | ||
| 183 | + def _few_enough_underscores(current: str, match: str) -> bool: | ||
| 184 | 184 | """Returns whether match should be shown based on current | |
| 185 | 185 | ||
| 186 | 186 | if current is _, True if match starts with 0 or 1 underscore | |
@@ -340,7 +340,7 @@ def locate(self, cursor_offset: int, line: str) -> Optional[LinePart]: | |||
| 340 | 340 | return lineparts.current_word(cursor_offset, line) | |
| 341 | 341 | ||
| 342 | 342 | def format(self, word: str) -> str: | |
| 343 | - return after_last_dot(word) | ||
| 343 | + return _after_last_dot(word) | ||
| 344 | 344 | ||
| 345 | 345 | ||
| 346 | 346 | def _safe_glob(pathname: str) -> Iterator[str]: | |
@@ -409,14 +409,14 @@ def matches( | |||
| 409 | 409 | return { | |
| 410 | 410 | m | |
| 411 | 411 | for m in matches | |
| 412 | - if few_enough_underscores(r.word.split(".")[-1], m.split(".")[-1]) | ||
| 412 | + if _few_enough_underscores(r.word.split(".")[-1], m.split(".")[-1]) | ||
| 413 | 413 | } | |
| 414 | 414 | ||
| 415 | 415 | def locate(self, cursor_offset: int, line: str) -> Optional[LinePart]: | |
| 416 | 416 | return lineparts.current_dotted_attribute(cursor_offset, line) | |
| 417 | 417 | ||
| 418 | 418 | def format(self, word: str) -> str: | |
| 419 | - return after_last_dot(word) | ||
| 419 | + return _after_last_dot(word) | ||
| 420 | 420 | ||
| 421 | 421 | def attr_matches(self, text: str, namespace: Dict[str, Any]) -> List: | |
| 422 | 422 | """Taken from rlcompleter.py and bent to my will.""" | |
@@ -434,8 +434,7 @@ def attr_matches(self, text: str, namespace: Dict[str, Any]) -> List: | |||
| 434 | 434 | obj = safe_eval(expr, namespace) | |
| 435 | 435 | except EvaluationError: | |
| 436 | 436 | return [] | |
| 437 | - matches = self.attr_lookup(obj, expr, attr) | ||
| 438 | - return matches | ||
| 437 | + return self.attr_lookup(obj, expr, attr) | ||
| 439 | 438 | ||
| 440 | 439 | def attr_lookup(self, obj: Any, expr: str, attr: str) -> List: | |
| 441 | 440 | """Second half of attr_matches.""" | |
@@ -631,7 +630,7 @@ def matches( | |||
| 631 | 630 | ||
| 632 | 631 | # strips leading dot | |
| 633 | 632 | matches = (m[1:] for m in self.attr_lookup(obj, "", attr.word)) | |
| 634 | - return {m for m in matches if few_enough_underscores(attr.word, m)} | ||
| 633 | + return {m for m in matches if _few_enough_underscores(attr.word, m)} | ||
| 635 | 634 | ||
| 636 | 635 | ||
| 637 | 636 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,7 @@ def test_filename(self): | |||
| 35 | 35 | self.assertEqual(last_part_of_filename("ab.c/e.f.g/"), "e.f.g/") | |
| 36 | 36 | ||
| 37 | 37 | def test_attribute(self): | |
| 38 | - self.assertEqual(autocomplete.after_last_dot("abc.edf"), "edf") | ||
| 38 | + self.assertEqual(autocomplete._after_last_dot("abc.edf"), "edf") | ||
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | 41 | def completer(matches): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments