Skip to content

Commit 59848e2

Browse files
committed
refactor: fix some PIE810 errors
1 parent 033fae7 commit 59848e2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

robotcode/language_server/robotframework/diagnostics/library_doc.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,9 +1644,7 @@ class CompleteResult(NamedTuple):
16441644

16451645

16461646
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)
16501648

16511649

16521650
def iter_module_names(name: Optional[str] = None) -> Iterator[str]:
@@ -1731,7 +1729,7 @@ def complete_library_import(
17311729
if name is None or not name.startswith((".", "/", os.sep)):
17321730
result += list(iter_modules_from_python_path(name))
17331731

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)))):
17351733
name_path = Path(name if name else base_dir)
17361734
if name_path.is_absolute():
17371735
path = name_path.resolve()
@@ -1789,7 +1787,7 @@ def complete_resource_import(
17891787
if name is None or not name.startswith(".") and not name.startswith("/") and not name.startswith(os.sep):
17901788
result += list(iter_resources_from_python_path(name))
17911789

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)):
17931791
name_path = Path(name if name else base_dir)
17941792
if name_path.is_absolute():
17951793
path = name_path.resolve()
@@ -1876,7 +1874,7 @@ def complete_variables_import(
18761874
if name is None or not name.startswith(".") and not name.startswith("/") and not name.startswith(os.sep):
18771875
result += list(iter_variables_from_python_path(name))
18781876

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)):
18801878
name_path = Path(name if name else base_dir)
18811879
if name_path.is_absolute():
18821880
path = name_path.resolve()

0 commit comments

Comments
 (0)