Skip to content

Commit 5eef60c

Browse files
committed
correct some code quality quirks
1 parent bd7de6d commit 5eef60c

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

robotcode/language_server/robotframework/diagnostics/imports_manager.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
from robotcode.language_server.robotframework.utils.robot_path import find_file_ex
2727

28-
from ..utils.version import get_robot_version
29-
3028
from ....utils.async_tools import Lock, async_tasking_event, create_sub_task
3129
from ....utils.logging import LoggingDescriptor
3230
from ....utils.path import path_is_relative_to
@@ -37,6 +35,7 @@
3735
from ...common.text_document import TextDocument
3836
from ..configuration import RobotConfig
3937
from ..utils.async_ast import walk
38+
from ..utils.version import get_robot_version
4039
from .entities import CommandLineVariableDefinition, VariableDefinition
4140

4241
if TYPE_CHECKING:
@@ -657,9 +656,8 @@ async def remove(k: _VariablesEntryKey, e: _VariablesEntry) -> None:
657656

658657
@_logger.call
659658
async def find_library(self, name: str, base_dir: str, variables: Optional[Dict[str, Any]] = None) -> str:
660-
from robot.variables.search import contains_variable
661-
662659
from robot.libraries import STDLIBS
660+
from robot.variables.search import contains_variable
663661

664662
if contains_variable(name, "$@&%"):
665663
return await asyncio.wait_for(

robotcode/language_server/robotframework/diagnostics/namespace.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,20 +1247,21 @@ async def get_keywords(self) -> List[KeywordDoc]:
12471247
result: Dict[KeywordMatcher, KeywordDoc] = {}
12481248
libdoc = await self.get_library_doc()
12491249

1250-
i=0
1250+
i = 0
12511251
for name, doc in itertools.chain(
12521252
*(e.library_doc.keywords.items() for e in self._libraries.values()),
12531253
*(e.library_doc.keywords.items() for e in self._resources.values()),
12541254
libdoc.keywords.items() if libdoc is not None else [],
12551255
):
1256-
i+=1
1256+
i += 1
12571257
# if not any(k for k in result.keys() if k == name):
12581258
result[KeywordMatcher(name)] = doc
12591259

12601260
self._keywords = list(result.values())
12611261
finally:
12621262
self._logger.debug(
1263-
lambda: f"end collecting {len(self._keywords)} keywords in {time.time()-current_time}s analyse {i} keywords"
1263+
lambda: f"end collecting {len(self._keywords) if self._keywords else 0}"
1264+
f" keywords in {time.time()-current_time}s analyse {i} keywords"
12641265
)
12651266

12661267
return self._keywords

robotcode/language_server/robotframework/parts/completion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ async def complete_ResourceImport( # noqa: N802
13811381
)
13821382

13831383
try:
1384-
list = await self.namespace.imports_manger.complete_resource_import(
1384+
list = await self.namespace.imports_manager.complete_resource_import(
13851385
first_part if first_part else None,
13861386
str(self.document.uri.to_path().parent),
13871387
await self.namespace.get_resolvable_variables(nodes_at_position, position),
@@ -1482,7 +1482,7 @@ async def complete_VariablesImport( # noqa: N802
14821482
)
14831483

14841484
try:
1485-
list = await self.namespace.imports_manger.complete_variables_import(
1485+
list = await self.namespace.imports_manager.complete_variables_import(
14861486
first_part if first_part else None,
14871487
str(self.document.uri.to_path().parent),
14881488
await self.namespace.get_resolvable_variables(nodes_at_position, position),

robotcode/language_server/robotframework/utils/robot_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import annotations
22

3+
import sys
34
from os import PathLike
45
from pathlib import Path
5-
import sys
66
from typing import List, Optional, Union
77

88

0 commit comments

Comments
 (0)