robotcode-robot 0.108.0__py3-none-any.whl → 0.109.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- robotcode/robot/__version__.py +1 -1
- robotcode/robot/diagnostics/data_cache.py +12 -5
- robotcode/robot/diagnostics/entities.py +36 -0
- robotcode/robot/diagnostics/imports_manager.py +2 -1
- robotcode/robot/diagnostics/library_doc.py +26 -14
- {robotcode_robot-0.108.0.dist-info → robotcode_robot-0.109.0.dist-info}/METADATA +2 -2
- {robotcode_robot-0.108.0.dist-info → robotcode_robot-0.109.0.dist-info}/RECORD +9 -9
- {robotcode_robot-0.108.0.dist-info → robotcode_robot-0.109.0.dist-info}/WHEEL +0 -0
- {robotcode_robot-0.108.0.dist-info → robotcode_robot-0.109.0.dist-info}/licenses/LICENSE.txt +0 -0
robotcode/robot/__version__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.
|
1
|
+
__version__ = "0.109.0"
|
@@ -27,10 +27,20 @@ class DataCache(ABC):
|
|
27
27
|
def save_cache_data(self, section: CacheSection, entry_name: str, data: Any) -> None: ...
|
28
28
|
|
29
29
|
|
30
|
-
class
|
30
|
+
class FileCacheDataBase(DataCache, ABC):
|
31
31
|
def __init__(self, cache_dir: Path) -> None:
|
32
32
|
self.cache_dir = cache_dir
|
33
33
|
|
34
|
+
if not Path.exists(self.cache_dir):
|
35
|
+
Path.mkdir(self.cache_dir, parents=True)
|
36
|
+
Path(self.cache_dir / ".gitignore").write_text(
|
37
|
+
"# Created by robotcode\n*\n",
|
38
|
+
"utf-8",
|
39
|
+
)
|
40
|
+
|
41
|
+
|
42
|
+
class JsonDataCache(FileCacheDataBase):
|
43
|
+
|
34
44
|
def build_cache_data_filename(self, section: CacheSection, entry_name: str) -> Path:
|
35
45
|
return self.cache_dir / section.value / (entry_name + ".json")
|
36
46
|
|
@@ -51,10 +61,7 @@ class JsonDataCache(DataCache):
|
|
51
61
|
cached_file.write_text(as_json(data), "utf-8")
|
52
62
|
|
53
63
|
|
54
|
-
class PickleDataCache(
|
55
|
-
def __init__(self, cache_dir: Path) -> None:
|
56
|
-
self.cache_dir = cache_dir
|
57
|
-
|
64
|
+
class PickleDataCache(FileCacheDataBase):
|
58
65
|
def build_cache_data_filename(self, section: CacheSection, entry_name: str) -> Path:
|
59
66
|
return self.cache_dir / section.value / (entry_name + ".pkl")
|
60
67
|
|
@@ -5,6 +5,7 @@ from typing import (
|
|
5
5
|
TYPE_CHECKING,
|
6
6
|
Any,
|
7
7
|
Callable,
|
8
|
+
Generic,
|
8
9
|
List,
|
9
10
|
Optional,
|
10
11
|
Tuple,
|
@@ -12,6 +13,8 @@ from typing import (
|
|
12
13
|
cast,
|
13
14
|
)
|
14
15
|
|
16
|
+
from typing_extensions import Concatenate, ParamSpec
|
17
|
+
|
15
18
|
from robot.parsing.lexer.tokens import Token
|
16
19
|
from robotcode.core.lsp.types import Position, Range
|
17
20
|
from robotcode.robot.utils.match import normalize
|
@@ -41,6 +44,39 @@ def single_call(func: _F) -> _F:
|
|
41
44
|
return cast(_F, wrapper)
|
42
45
|
|
43
46
|
|
47
|
+
P = ParamSpec("P")
|
48
|
+
R = TypeVar("R")
|
49
|
+
|
50
|
+
|
51
|
+
class cached_method(Generic[P, R]): # noqa: N801
|
52
|
+
def __init__(
|
53
|
+
self, func: Optional[Callable[Concatenate[Any, P], R]] = None, *, maxsize: Optional[int] = None
|
54
|
+
) -> None:
|
55
|
+
self.func: Optional[Callable[Concatenate[Any, P], R]] = func
|
56
|
+
self._maxsize = maxsize
|
57
|
+
self.cache_name: Optional[str] = None
|
58
|
+
if func is not None:
|
59
|
+
functools.update_wrapper(self, func)
|
60
|
+
|
61
|
+
def __set_name__(self, owner: type, name: str) -> None:
|
62
|
+
self.cache_name = f"__cached_{owner.__name__}_{name}"
|
63
|
+
|
64
|
+
def __call__(self, func: Callable[Concatenate[Any, P], R]) -> "cached_method[P, R]":
|
65
|
+
self.func = func
|
66
|
+
functools.update_wrapper(self, func)
|
67
|
+
return self
|
68
|
+
|
69
|
+
def __get__(self, instance: Any, owner: Optional[type] = None) -> Callable[P, R]:
|
70
|
+
cached = instance.__dict__.get(self.cache_name, _NOT_SET)
|
71
|
+
if cached is _NOT_SET:
|
72
|
+
assert self.func is not None
|
73
|
+
|
74
|
+
bound_method = self.func.__get__(instance, owner)
|
75
|
+
cached = functools.lru_cache(maxsize=self._maxsize)(bound_method)
|
76
|
+
instance.__dict__[self.cache_name] = cached
|
77
|
+
return cast(Callable[P, R], cached)
|
78
|
+
|
79
|
+
|
44
80
|
@dataclass
|
45
81
|
class SourceEntity:
|
46
82
|
line_no: int
|
@@ -610,7 +610,8 @@ class ImportsManager:
|
|
610
610
|
|
611
611
|
def clear_cache(self) -> None:
|
612
612
|
if self.cache_path.exists():
|
613
|
-
shutil.rmtree(self.cache_path)
|
613
|
+
shutil.rmtree(self.cache_path, ignore_errors=True)
|
614
|
+
|
614
615
|
self._logger.debug(lambda: f"Cleared cache {self.cache_path}")
|
615
616
|
|
616
617
|
@_logger.call
|
@@ -80,6 +80,7 @@ from .entities import (
|
|
80
80
|
LibraryArgumentDefinition,
|
81
81
|
NativeValue,
|
82
82
|
SourceEntity,
|
83
|
+
cached_method,
|
83
84
|
single_call,
|
84
85
|
)
|
85
86
|
|
@@ -362,7 +363,8 @@ class TypeDoc:
|
|
362
363
|
)
|
363
364
|
)
|
364
365
|
|
365
|
-
|
366
|
+
@cached_method
|
367
|
+
def to_markdown(self, header_level: int = 2, only_doc: bool = False) -> str:
|
366
368
|
result = ""
|
367
369
|
|
368
370
|
result += f"##{'#' * header_level} {self.name} ({self.type})\n\n"
|
@@ -378,19 +380,22 @@ class TypeDoc:
|
|
378
380
|
else:
|
379
381
|
result += self.doc
|
380
382
|
|
381
|
-
if
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
383
|
+
if not only_doc:
|
384
|
+
if self.members:
|
385
|
+
result += f"\n\n###{'#' * header_level} Allowed Values:\n\n"
|
386
|
+
result += "- " + "\n- ".join(f"`{m.name}`" for m in self.members)
|
387
|
+
|
388
|
+
if self.items:
|
389
|
+
result += f"\n\n###{'#' * header_level} Dictionary Structure:\n\n"
|
390
|
+
result += "```\n{"
|
391
|
+
result += "\n ".join(
|
392
|
+
f"'{m.key}': <{m.type}> {'# optional' if not m.required else ''}" for m in self.items
|
393
|
+
)
|
394
|
+
result += "\n}\n```"
|
390
395
|
|
391
|
-
|
392
|
-
|
393
|
-
|
396
|
+
if self.accepts:
|
397
|
+
result += f"\n\n###{'#' * header_level} Converted Types:\n\n"
|
398
|
+
result += "- " + "\n- ".join(self.accepts)
|
394
399
|
|
395
400
|
return result
|
396
401
|
|
@@ -475,6 +480,7 @@ class ArgumentInfo:
|
|
475
480
|
def __str__(self) -> str:
|
476
481
|
return self.signature()
|
477
482
|
|
483
|
+
@cached_method
|
478
484
|
def signature(self, add_types: bool = True) -> str:
|
479
485
|
prefix = ""
|
480
486
|
if self.kind == KeywordArgumentKind.POSITIONAL_ONLY_MARKER:
|
@@ -721,6 +727,7 @@ class KeywordDoc(SourceEntity):
|
|
721
727
|
),
|
722
728
|
)
|
723
729
|
|
730
|
+
@cached_method
|
724
731
|
def to_markdown(
|
725
732
|
self,
|
726
733
|
add_signature: bool = True,
|
@@ -796,7 +803,7 @@ class KeywordDoc(SourceEntity):
|
|
796
803
|
|
797
804
|
result += (
|
798
805
|
f"\n| `{prefix}{a.name!s}`"
|
799
|
-
f
|
806
|
+
f"| {': ' if a.types else ' '}"
|
800
807
|
f"{escaped_pipe.join(f'`{escape_pipe(s)}`' for s in a.types) if a.types else ''} "
|
801
808
|
f"| {'=' if a.default_value is not None else ''} "
|
802
809
|
f"| {f'`{a.default_value!s}`' if a.default_value else ''} |"
|
@@ -832,6 +839,7 @@ class KeywordDoc(SourceEntity):
|
|
832
839
|
+ ")"
|
833
840
|
)
|
834
841
|
|
842
|
+
@cached_method
|
835
843
|
def parameter_signature(self, full_signatures: Optional[Sequence[int]] = None) -> str:
|
836
844
|
return (
|
837
845
|
"("
|
@@ -1094,6 +1102,7 @@ class LibraryDoc:
|
|
1094
1102
|
),
|
1095
1103
|
)
|
1096
1104
|
|
1105
|
+
@cached_method
|
1097
1106
|
def to_markdown(
|
1098
1107
|
self,
|
1099
1108
|
add_signature: bool = True,
|
@@ -1250,6 +1259,7 @@ class VariablesDoc(LibraryDoc):
|
|
1250
1259
|
|
1251
1260
|
variables: List[ImportedVariableDefinition] = field(default_factory=list)
|
1252
1261
|
|
1262
|
+
@cached_method
|
1253
1263
|
def to_markdown(
|
1254
1264
|
self,
|
1255
1265
|
add_signature: bool = True,
|
@@ -2081,6 +2091,7 @@ def get_library_doc(
|
|
2081
2091
|
td.usages,
|
2082
2092
|
[EnumMember(m.name, m.value) for m in td.members] if td.members else None,
|
2083
2093
|
[TypedDictItem(i.key, i.type, i.required) for i in td.items] if td.items else None,
|
2094
|
+
# TODO nested types like Literals
|
2084
2095
|
libname=libdoc.name,
|
2085
2096
|
libtype=libdoc.type,
|
2086
2097
|
doc_format=libdoc.doc_format,
|
@@ -2453,6 +2464,7 @@ class CompleteResultKind(Enum):
|
|
2453
2464
|
VARIABLES_MODULE = "Variables Module"
|
2454
2465
|
FOLDER = "Directory"
|
2455
2466
|
KEYWORD = "Keyword"
|
2467
|
+
DOC_CACHE = "DOC_CACHE"
|
2456
2468
|
|
2457
2469
|
|
2458
2470
|
class CompleteResult(NamedTuple):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: robotcode-robot
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.109.0
|
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.4.0,>=3.2.0
|
29
|
-
Requires-Dist: robotcode-core==0.
|
29
|
+
Requires-Dist: robotcode-core==0.109.0
|
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
|
@@ -1,19 +1,19 @@
|
|
1
1
|
robotcode/robot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
robotcode/robot/__version__.py,sha256=
|
2
|
+
robotcode/robot/__version__.py,sha256=To2Wkjt2rR7FNc5nbafXdKVV4Iy6AR0OLu5SmjOkGxs,24
|
3
3
|
robotcode/robot/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
|
4
4
|
robotcode/robot/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
robotcode/robot/config/loader.py,sha256=qrP810HNMDpqhXopWa0dOa0Wq_zQfVctsNYKY6sLKGI,8654
|
6
6
|
robotcode/robot/config/model.py,sha256=sgr6-4_E06g-yIXW41Z-NtIXZ_7JMmR5WvUD7kTUqu4,89106
|
7
7
|
robotcode/robot/config/utils.py,sha256=xY-LH31BidWzonpvSrle-4HvKrp02I7IRqU2JwlL4Ls,2931
|
8
8
|
robotcode/robot/diagnostics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
robotcode/robot/diagnostics/data_cache.py,sha256=
|
9
|
+
robotcode/robot/diagnostics/data_cache.py,sha256=rUh-LGkfxLYBLh3GmiJVGJi1JNP5GLiYnI1aVO0Pwqc,3187
|
10
10
|
robotcode/robot/diagnostics/diagnostics_modifier.py,sha256=6zJdXBd6g1QM12XJbsHd8gNNysECMnWlne3q8XNgBDo,9797
|
11
11
|
robotcode/robot/diagnostics/document_cache_helper.py,sha256=5H0S7qDCeoEmqjMLUE7EQy9iZcZTYIUl5H1Pdvn5s5I,23886
|
12
|
-
robotcode/robot/diagnostics/entities.py,sha256=
|
12
|
+
robotcode/robot/diagnostics/entities.py,sha256=I55YMxXpl7C1Sx6GgxRqb7vWMK7uWIoB7GhR1X9b66c,12983
|
13
13
|
robotcode/robot/diagnostics/errors.py,sha256=RGnE4KCgNxQ58hNMBuAD3Q-qWqZVWZSZsCnhBGtQScw,1975
|
14
|
-
robotcode/robot/diagnostics/imports_manager.py,sha256=
|
14
|
+
robotcode/robot/diagnostics/imports_manager.py,sha256=aJbVZ9OyhpdFMtDRMJT2orKHQc3ad3UeJ7TPycTM6GI,61167
|
15
15
|
robotcode/robot/diagnostics/keyword_finder.py,sha256=dm4BA0ccp5V4C65CkSYUJUNXegSmvG24uu09T3eL6a4,17319
|
16
|
-
robotcode/robot/diagnostics/library_doc.py,sha256=
|
16
|
+
robotcode/robot/diagnostics/library_doc.py,sha256=Mz4Y2w00qHTx42xZMznnMwOWn5SY2utJAciRLaqyY00,100341
|
17
17
|
robotcode/robot/diagnostics/model_helper.py,sha256=nq78e6TQ9Anvz_VSLW560lRTKrRjBsh7NoWttEvJ2hw,30973
|
18
18
|
robotcode/robot/diagnostics/namespace.py,sha256=oLBXJkj-JEX--OMh9hIDfzpZxKvDOwH6Sle-SZG9s-Y,78653
|
19
19
|
robotcode/robot/diagnostics/namespace_analyzer.py,sha256=tZQOvPIsgrgLcynx_IRH4G7vXN0M_vZEtxBMC0ZMmO8,75653
|
@@ -26,7 +26,7 @@ robotcode/robot/utils/robot_path.py,sha256=Z-GVBOPA_xeD20bCJi4_AWaU0eQWvCym-YFty
|
|
26
26
|
robotcode/robot/utils/stubs.py,sha256=umugZYAyneFNgqRJBRMJPzm0u0B_TH8Sx_y-ykXnxpw,351
|
27
27
|
robotcode/robot/utils/variables.py,sha256=-ldL8mRRSYYW2pwlm8IpoDeQcG6LYBqaYyV_7U3xsIc,2174
|
28
28
|
robotcode/robot/utils/visitor.py,sha256=nP3O0qh3YYuxR6S8wYJRBFfNwIVgsgohURBlrnFkRYQ,2299
|
29
|
-
robotcode_robot-0.
|
30
|
-
robotcode_robot-0.
|
31
|
-
robotcode_robot-0.
|
32
|
-
robotcode_robot-0.
|
29
|
+
robotcode_robot-0.109.0.dist-info/METADATA,sha256=dWkp3IGYkd68LNyCB5VRJOx42oBRunhzmmbRV9XhquI,2242
|
30
|
+
robotcode_robot-0.109.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
31
|
+
robotcode_robot-0.109.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
|
32
|
+
robotcode_robot-0.109.0.dist-info/RECORD,,
|
File without changes
|
{robotcode_robot-0.108.0.dist-info → robotcode_robot-0.109.0.dist-info}/licenses/LICENSE.txt
RENAMED
File without changes
|