robotcode-robot 0.95.0__tar.gz → 0.95.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/PKG-INFO +2 -2
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/pyproject.toml +1 -1
- robotcode_robot-0.95.2/src/robotcode/robot/__version__.py +1 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/entities.py +8 -8
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/imports_manager.py +3 -10
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/keyword_finder.py +40 -39
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/library_doc.py +197 -204
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/model_helper.py +3 -3
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/namespace.py +2 -7
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/namespace_analyzer.py +8 -5
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/utils/ast.py +42 -60
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/utils/markdownformatter.py +11 -11
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/utils/match.py +6 -5
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/utils/robot_path.py +2 -2
- robotcode_robot-0.95.2/src/robotcode/robot/utils/stubs.py +14 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/utils/variables.py +5 -5
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/utils/visitor.py +2 -28
- robotcode_robot-0.95.0/src/robotcode/robot/__version__.py +0 -1
- robotcode_robot-0.95.0/src/robotcode/robot/utils/stubs.py +0 -38
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/.gitignore +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/LICENSE.txt +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/README.md +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/__init__.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/config/__init__.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/config/loader.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/config/model.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/config/utils.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/__init__.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/data_cache.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/diagnostics_modifier.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/document_cache_helper.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/errors.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/workspace_config.py +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/py.typed +0 -0
- {robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/utils/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: robotcode-robot
|
3
|
-
Version: 0.95.
|
3
|
+
Version: 0.95.2
|
4
4
|
Summary: Support classes for RobotCode for handling Robot Framework projects.
|
5
5
|
Project-URL: Homepage, https://robotcode.io
|
6
6
|
Project-URL: Donate, https://opencollective.com/robotcode
|
@@ -26,7 +26,7 @@ Classifier: Topic :: Utilities
|
|
26
26
|
Classifier: Typing :: Typed
|
27
27
|
Requires-Python: >=3.8
|
28
28
|
Requires-Dist: platformdirs<4.2.0,>=3.2.0
|
29
|
-
Requires-Dist: robotcode-core==0.95.
|
29
|
+
Requires-Dist: robotcode-core==0.95.2
|
30
30
|
Requires-Dist: robotframework>=4.1.0
|
31
31
|
Requires-Dist: tomli>=1.1.0; python_version < '3.11'
|
32
32
|
Description-Content-Type: text/markdown
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.95.2"
|
{robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/entities.py
RENAMED
@@ -1,3 +1,4 @@
|
|
1
|
+
import functools
|
1
2
|
from dataclasses import dataclass, field
|
2
3
|
from enum import Enum
|
3
4
|
from typing import (
|
@@ -142,19 +143,19 @@ class VariableMatcher:
|
|
142
143
|
|
143
144
|
self.base = match.base
|
144
145
|
|
145
|
-
self.normalized_name =
|
146
|
+
self.normalized_name = normalize(self.base)
|
146
147
|
|
147
148
|
def __eq__(self, o: object) -> bool:
|
148
|
-
if
|
149
|
+
if type(o) is VariableMatcher:
|
149
150
|
return o.normalized_name == self.normalized_name
|
150
151
|
|
151
|
-
if
|
152
|
+
if type(o) is str:
|
152
153
|
match = search_variable(o, "$@&%", ignore_errors=True)
|
153
154
|
base = match.base
|
154
155
|
if base is None:
|
155
156
|
return False
|
156
157
|
|
157
|
-
normalized =
|
158
|
+
normalized = normalize(base)
|
158
159
|
return self.normalized_name == normalized
|
159
160
|
|
160
161
|
return False
|
@@ -194,10 +195,9 @@ class VariableDefinition(SourceEntity):
|
|
194
195
|
value: Any = field(default=None, compare=False)
|
195
196
|
value_is_native: bool = field(default=False, compare=False)
|
196
197
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
self.matcher = VariableMatcher(self.name)
|
198
|
+
@functools.cached_property
|
199
|
+
def matcher(self) -> VariableMatcher:
|
200
|
+
return VariableMatcher(self.name)
|
201
201
|
|
202
202
|
@single_call
|
203
203
|
def __hash__(self) -> int:
|
{robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/imports_manager.py
RENAMED
@@ -573,12 +573,10 @@ class ImportsManager:
|
|
573
573
|
self._resource_document_changed_timer_interval = 1
|
574
574
|
self._resource_document_changed_documents: Set[TextDocument] = set()
|
575
575
|
|
576
|
-
self._resource_libdoc_cache: "weakref.WeakKeyDictionary[ast.AST, Dict[
|
576
|
+
self._resource_libdoc_cache: "weakref.WeakKeyDictionary[ast.AST, Dict[str, LibraryDoc]]" = (
|
577
577
|
weakref.WeakKeyDictionary()
|
578
578
|
)
|
579
579
|
|
580
|
-
self._process_pool_executor: Optional[ProcessPoolExecutor] = None
|
581
|
-
|
582
580
|
def __del__(self) -> None:
|
583
581
|
try:
|
584
582
|
if self._executor is not None:
|
@@ -1302,9 +1300,8 @@ class ImportsManager:
|
|
1302
1300
|
self,
|
1303
1301
|
model: ast.AST,
|
1304
1302
|
source: str,
|
1305
|
-
append_model_errors: bool = True,
|
1306
1303
|
) -> LibraryDoc:
|
1307
|
-
key =
|
1304
|
+
key = source
|
1308
1305
|
|
1309
1306
|
entry = None
|
1310
1307
|
if model in self._resource_libdoc_cache:
|
@@ -1313,11 +1310,7 @@ class ImportsManager:
|
|
1313
1310
|
if entry and key in entry:
|
1314
1311
|
return entry[key]
|
1315
1312
|
|
1316
|
-
result = get_model_doc(
|
1317
|
-
model=model,
|
1318
|
-
source=source,
|
1319
|
-
append_model_errors=append_model_errors,
|
1320
|
-
)
|
1313
|
+
result = get_model_doc(model=model, source=source)
|
1321
1314
|
if entry is None:
|
1322
1315
|
entry = {}
|
1323
1316
|
self._resource_libdoc_cache[model] = entry
|
{robotcode_robot-0.95.0 → robotcode_robot-0.95.2}/src/robotcode/robot/diagnostics/keyword_finder.py
RENAMED
@@ -39,9 +39,8 @@ DEFAULT_BDD_PREFIXES = {"Given ", "When ", "Then ", "And ", "But "}
|
|
39
39
|
|
40
40
|
|
41
41
|
class KeywordFinder:
|
42
|
-
def __init__(self, namespace: "Namespace"
|
43
|
-
self.
|
44
|
-
self.self_library_doc = library_doc
|
42
|
+
def __init__(self, namespace: "Namespace") -> None:
|
43
|
+
self._namespace = namespace
|
45
44
|
|
46
45
|
self.diagnostics: List[DiagnosticsEntry] = []
|
47
46
|
self.result_bdd_prefix: Optional[str] = None
|
@@ -57,9 +56,9 @@ class KeywordFinder:
|
|
57
56
|
],
|
58
57
|
] = {}
|
59
58
|
|
60
|
-
|
61
|
-
|
62
|
-
self.
|
59
|
+
@functools.cached_property
|
60
|
+
def _library_doc(self) -> LibraryDoc:
|
61
|
+
return self._namespace.get_library_doc()
|
63
62
|
|
64
63
|
def reset_diagnostics(self) -> None:
|
65
64
|
self.diagnostics = []
|
@@ -162,7 +161,7 @@ class KeywordFinder:
|
|
162
161
|
def _get_keyword_from_self(self, name: str) -> Optional[KeywordDoc]:
|
163
162
|
if get_robot_version() >= (6, 0):
|
164
163
|
found: List[Tuple[Optional[LibraryEntry], KeywordDoc]] = [
|
165
|
-
(None, v) for v in self.
|
164
|
+
(None, v) for v in self._library_doc.keywords.iter_all(name)
|
166
165
|
]
|
167
166
|
if len(found) > 1:
|
168
167
|
found = self._select_best_matches(found)
|
@@ -183,7 +182,7 @@ class KeywordFinder:
|
|
183
182
|
return None
|
184
183
|
|
185
184
|
try:
|
186
|
-
return self.
|
185
|
+
return self._library_doc.keywords.get(name, None)
|
187
186
|
except KeywordError as e:
|
188
187
|
self.diagnostics.append(DiagnosticsEntry(str(e), DiagnosticSeverity.ERROR, Error.KEYWORD_ERROR))
|
189
188
|
raise CancelSearchError from e
|
@@ -213,15 +212,16 @@ class KeywordFinder:
|
|
213
212
|
|
214
213
|
return found[0][1] if found else None
|
215
214
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
)
|
215
|
+
@functools.cached_property
|
216
|
+
def _all_keywords(self) -> List[LibraryEntry]:
|
217
|
+
return list(
|
218
|
+
chain(
|
219
|
+
self._namespace._libraries.values(),
|
220
|
+
self._namespace._resources.values(),
|
223
221
|
)
|
222
|
+
)
|
224
223
|
|
224
|
+
def find_keywords(self, owner_name: str, name: str) -> List[Tuple[LibraryEntry, KeywordDoc]]:
|
225
225
|
if get_robot_version() >= (6, 0):
|
226
226
|
result: List[Tuple[LibraryEntry, KeywordDoc]] = []
|
227
227
|
for v in self._all_keywords:
|
@@ -271,11 +271,11 @@ class KeywordFinder:
|
|
271
271
|
def _prioritize_same_file_or_public(
|
272
272
|
self, entries: List[Tuple[Optional[LibraryEntry], KeywordDoc]]
|
273
273
|
) -> List[Tuple[Optional[LibraryEntry], KeywordDoc]]:
|
274
|
-
matches = [h for h in entries if h[1].source == self.
|
274
|
+
matches = [h for h in entries if h[1].source == self._namespace.source]
|
275
275
|
if matches:
|
276
276
|
return matches
|
277
277
|
|
278
|
-
matches = [handler for handler in entries if not handler[1].is_private
|
278
|
+
matches = [handler for handler in entries if not handler[1].is_private]
|
279
279
|
|
280
280
|
return matches or entries
|
281
281
|
|
@@ -312,23 +312,24 @@ class KeywordFinder:
|
|
312
312
|
other: Tuple[Optional[LibraryEntry], KeywordDoc],
|
313
313
|
) -> bool:
|
314
314
|
return (
|
315
|
-
other[1].matcher.embedded_arguments
|
315
|
+
other[1].matcher.embedded_arguments is not None
|
316
|
+
and candidate[1].matcher.embedded_arguments is not None
|
317
|
+
and other[1].matcher.embedded_arguments.match(candidate[1].name) is not None
|
316
318
|
and candidate[1].matcher.embedded_arguments.match(other[1].name) is None
|
317
319
|
)
|
318
320
|
|
319
|
-
|
320
|
-
|
321
|
-
|
321
|
+
@functools.cached_property
|
322
|
+
def _resource_imports(self) -> List[ResourceEntry]:
|
323
|
+
return list(chain(self._namespace._resources.values()))
|
322
324
|
|
325
|
+
def _get_keyword_from_resource_files(self, name: str) -> Optional[KeywordDoc]:
|
323
326
|
if get_robot_version() >= (6, 0):
|
324
|
-
found: List[Tuple[Optional[LibraryEntry], KeywordDoc]] = [
|
325
|
-
|
326
|
-
|
327
|
-
if r:
|
328
|
-
found.extend([(v, k) for k in r])
|
327
|
+
found: List[Tuple[Optional[LibraryEntry], KeywordDoc]] = [
|
328
|
+
(v, k) for v in self._resource_imports for k in v.library_doc.keywords.iter_all(name)
|
329
|
+
]
|
329
330
|
else:
|
330
331
|
found = []
|
331
|
-
for k in self.
|
332
|
+
for k in self._resource_imports:
|
332
333
|
s = k.library_doc.keywords.get(name, None)
|
333
334
|
if s is not None:
|
334
335
|
found.append((k, s))
|
@@ -365,27 +366,27 @@ class KeywordFinder:
|
|
365
366
|
def _get_keyword_based_on_search_order(
|
366
367
|
self, entries: List[Tuple[Optional[LibraryEntry], KeywordDoc]]
|
367
368
|
) -> List[Tuple[Optional[LibraryEntry], KeywordDoc]]:
|
368
|
-
for libname in self.
|
369
|
+
for libname in self._namespace.search_order:
|
369
370
|
for e in entries:
|
370
371
|
if e[0] is not None and eq_namespace(libname, e[0].alias or e[0].name):
|
371
372
|
return [e]
|
372
373
|
|
373
374
|
return entries
|
374
375
|
|
375
|
-
|
376
|
-
|
377
|
-
|
376
|
+
@functools.cached_property
|
377
|
+
def _library_imports(self) -> List[LibraryEntry]:
|
378
|
+
return list(chain(self._namespace._libraries.values()))
|
378
379
|
|
380
|
+
def _get_keyword_from_libraries(self, name: str) -> Optional[KeywordDoc]:
|
379
381
|
if get_robot_version() >= (6, 0):
|
380
|
-
found: List[Tuple[Optional[LibraryEntry], KeywordDoc]] = [
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
found.extend([(v, k) for k in r])
|
382
|
+
found: List[Tuple[Optional[LibraryEntry], KeywordDoc]] = [
|
383
|
+
(v, k) for v in self._library_imports for k in v.library_doc.keywords.iter_all(name)
|
384
|
+
]
|
385
|
+
|
385
386
|
else:
|
386
387
|
found = []
|
387
388
|
|
388
|
-
for k in self.
|
389
|
+
for k in self._library_imports:
|
389
390
|
s = k.library_doc.keywords.get(name, None)
|
390
391
|
if s is not None:
|
391
392
|
found.append((k, s))
|
@@ -463,8 +464,8 @@ class KeywordFinder:
|
|
463
464
|
def bdd_prefix_regexp(self) -> "re.Pattern[str]":
|
464
465
|
prefixes = (
|
465
466
|
"|".join(
|
466
|
-
self.
|
467
|
-
if self.
|
467
|
+
self._namespace.languages.bdd_prefixes
|
468
|
+
if self._namespace.languages is not None
|
468
469
|
else ["given", "when", "then", "and", "but"]
|
469
470
|
)
|
470
471
|
.replace(" ", r"\s")
|