Skip to content

Commit 5696868

Browse files
committed
perf(diagnostics): remove redundant exists() check in get_resource_meta
1 parent a0cb4c6 commit 5696868

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

packages/robot/src/robotcode/robot/diagnostics/imports_manager.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,15 +1677,11 @@ def get_libdoc_from_model(
16771677
@staticmethod
16781678
def get_resource_meta(source: str) -> Optional[RobotFileMeta]:
16791679
try:
1680-
source_path = normalized_path(source)
1681-
if source_path.exists():
1682-
return RobotFileMeta(
1683-
str(source_path),
1684-
os.stat(source_path, follow_symlinks=False).st_mtime_ns,
1685-
)
1680+
normalized = str(normalized_path(source))
1681+
mtime_ns = os.stat(normalized, follow_symlinks=False).st_mtime_ns
1682+
return RobotFileMeta(normalized, mtime_ns)
16861683
except OSError:
1687-
pass
1688-
return None
1684+
return None
16891685

16901686
def _get_model_doc_cached(self, source: str) -> Tuple[Optional[ResourceDoc], Optional["RobotFileMeta"]]:
16911687
meta = self.get_resource_meta(source)

0 commit comments

Comments
 (0)