Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit167fc26

Browse files
committed
Hide implementation details
1 parent424345e commit167fc26

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

‎bpython/autocomplete.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ def from_string(cls, value: str) -> Optional["AutocompleteModes"]:
176176
KEYWORDS=frozenset(keyword.kwlist)
177177

178178

179-
defafter_last_dot(name:str)->str:
179+
def_after_last_dot(name:str)->str:
180180
returnname.rstrip(".").rsplit(".")[-1]
181181

182182

183-
deffew_enough_underscores(current:str,match:str)->bool:
183+
def_few_enough_underscores(current:str,match:str)->bool:
184184
"""Returns whether match should be shown based on current
185185
186186
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]:
340340
returnlineparts.current_word(cursor_offset,line)
341341

342342
defformat(self,word:str)->str:
343-
returnafter_last_dot(word)
343+
return_after_last_dot(word)
344344

345345

346346
def_safe_glob(pathname:str)->Iterator[str]:
@@ -409,14 +409,14 @@ def matches(
409409
return {
410410
m
411411
forminmatches
412-
iffew_enough_underscores(r.word.split(".")[-1],m.split(".")[-1])
412+
if_few_enough_underscores(r.word.split(".")[-1],m.split(".")[-1])
413413
}
414414

415415
deflocate(self,cursor_offset:int,line:str)->Optional[LinePart]:
416416
returnlineparts.current_dotted_attribute(cursor_offset,line)
417417

418418
defformat(self,word:str)->str:
419-
returnafter_last_dot(word)
419+
return_after_last_dot(word)
420420

421421
defattr_matches(self,text:str,namespace:Dict[str,Any])->List:
422422
"""Taken from rlcompleter.py and bent to my will."""
@@ -434,8 +434,7 @@ def attr_matches(self, text: str, namespace: Dict[str, Any]) -> List:
434434
obj=safe_eval(expr,namespace)
435435
exceptEvaluationError:
436436
return []
437-
matches=self.attr_lookup(obj,expr,attr)
438-
returnmatches
437+
returnself.attr_lookup(obj,expr,attr)
439438

440439
defattr_lookup(self,obj:Any,expr:str,attr:str)->List:
441440
"""Second half of attr_matches."""
@@ -631,7 +630,7 @@ def matches(
631630

632631
# strips leading dot
633632
matches= (m[1:]forminself.attr_lookup(obj,"",attr.word))
634-
return {mforminmatchesiffew_enough_underscores(attr.word,m)}
633+
return {mforminmatchesif_few_enough_underscores(attr.word,m)}
635634

636635

637636
try:

‎bpython/test/test_autocomplete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_filename(self):
3535
self.assertEqual(last_part_of_filename("ab.c/e.f.g/"),"e.f.g/")
3636

3737
deftest_attribute(self):
38-
self.assertEqual(autocomplete.after_last_dot("abc.edf"),"edf")
38+
self.assertEqual(autocomplete._after_last_dot("abc.edf"),"edf")
3939

4040

4141
defcompleter(matches):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp