@@ -1644,9 +1644,7 @@ class CompleteResult(NamedTuple):
1644
1644
1645
1645
1646
1646
def is_file_like (name : Optional [str ]) -> bool :
1647
- return name is not None and (
1648
- name .startswith ("." ) or name .startswith ("/" ) or name .startswith (os .sep ) or "/" in name or os .sep in name
1649
- )
1647
+ return name is not None and (name .startswith (("." , "/" , os .sep )) or "/" in name or os .sep in name )
1650
1648
1651
1649
1652
1650
def iter_module_names (name : Optional [str ] = None ) -> Iterator [str ]:
@@ -1731,7 +1729,7 @@ def complete_library_import(
1731
1729
if name is None or not name .startswith (("." , "/" , os .sep )):
1732
1730
result += list (iter_modules_from_python_path (name ))
1733
1731
1734
- if name is None or (is_file_like (name ) and (name .endswith ("/" ) or name . endswith ( os .sep ))):
1732
+ if name is None or (is_file_like (name ) and (name .endswith (( "/" , os .sep ) ))):
1735
1733
name_path = Path (name if name else base_dir )
1736
1734
if name_path .is_absolute ():
1737
1735
path = name_path .resolve ()
@@ -1789,7 +1787,7 @@ def complete_resource_import(
1789
1787
if name is None or not name .startswith ("." ) and not name .startswith ("/" ) and not name .startswith (os .sep ):
1790
1788
result += list (iter_resources_from_python_path (name ))
1791
1789
1792
- if name is None or name .startswith ("." ) or name . startswith ( "/" ) or name . startswith ( os .sep ):
1790
+ if name is None or name .startswith (( "." , "/" , os .sep ) ):
1793
1791
name_path = Path (name if name else base_dir )
1794
1792
if name_path .is_absolute ():
1795
1793
path = name_path .resolve ()
@@ -1876,7 +1874,7 @@ def complete_variables_import(
1876
1874
if name is None or not name .startswith ("." ) and not name .startswith ("/" ) and not name .startswith (os .sep ):
1877
1875
result += list (iter_variables_from_python_path (name ))
1878
1876
1879
- if name is None or name .startswith ("." ) or name . startswith ( "/" ) or name . startswith ( os .sep ):
1877
+ if name is None or name .startswith (( "." , "/" , os .sep ) ):
1880
1878
name_path = Path (name if name else base_dir )
1881
1879
if name_path .is_absolute ():
1882
1880
path = name_path .resolve ()
0 commit comments