robotcode-robot 1.1.0__py3-none-any.whl → 1.3.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/config/model.py +2 -2
- robotcode/robot/diagnostics/entities.py +18 -45
- robotcode/robot/diagnostics/errors.py +1 -0
- robotcode/robot/diagnostics/imports_manager.py +3 -3
- robotcode/robot/diagnostics/keyword_finder.py +43 -12
- robotcode/robot/diagnostics/library_doc.py +11 -5
- robotcode/robot/diagnostics/model_helper.py +4 -4
- robotcode/robot/diagnostics/namespace.py +227 -196
- robotcode/robot/diagnostics/namespace_analyzer.py +194 -136
- robotcode/robot/utils/__init__.py +4 -7
- robotcode/robot/utils/ast.py +21 -19
- robotcode/robot/utils/variables.py +159 -4
- {robotcode_robot-1.1.0.dist-info → robotcode_robot-1.3.0.dist-info}/METADATA +2 -2
- robotcode_robot-1.3.0.dist-info/RECORD +32 -0
- robotcode_robot-1.1.0.dist-info/RECORD +0 -32
- {robotcode_robot-1.1.0.dist-info → robotcode_robot-1.3.0.dist-info}/WHEEL +0 -0
- {robotcode_robot-1.1.0.dist-info → robotcode_robot-1.3.0.dist-info}/licenses/LICENSE.txt +0 -0
@@ -1,12 +1,165 @@
|
|
1
1
|
import functools
|
2
|
-
from typing import Optional, Tuple, cast
|
2
|
+
from typing import Any, Optional, Tuple, cast
|
3
3
|
|
4
4
|
from robot.utils.escaping import split_from_equals as robot_split_from_equals
|
5
|
-
from robot.variables.search import VariableMatch as RobotVariableMatch
|
6
5
|
from robot.variables.search import contains_variable as robot_contains_variable
|
7
6
|
from robot.variables.search import is_scalar_assign as robot_is_scalar_assign
|
8
7
|
from robot.variables.search import is_variable as robot_is_variable
|
9
8
|
from robot.variables.search import search_variable as robot_search_variable
|
9
|
+
from robotcode.robot.utils.match import normalize
|
10
|
+
|
11
|
+
from . import get_robot_version
|
12
|
+
|
13
|
+
|
14
|
+
class InvalidVariableError(Exception):
|
15
|
+
pass
|
16
|
+
|
17
|
+
|
18
|
+
class VariableMatcher:
|
19
|
+
if get_robot_version() >= (7, 3):
|
20
|
+
|
21
|
+
def __init__(
|
22
|
+
self, string: str, identifiers: str = "$@&%", parse_type: bool = False, ignore_errors: bool = True
|
23
|
+
) -> None:
|
24
|
+
self.string = string
|
25
|
+
|
26
|
+
self.match = robot_search_variable(
|
27
|
+
string, identifiers=identifiers, parse_type=parse_type, ignore_errors=ignore_errors
|
28
|
+
)
|
29
|
+
|
30
|
+
if not ignore_errors and self.match.base is None:
|
31
|
+
raise InvalidVariableError(f"Invalid variable '{string}'")
|
32
|
+
|
33
|
+
self.base = self.match.base
|
34
|
+
self.identifier = self.match.identifier
|
35
|
+
self.name = "%s{%s}" % (self.identifier, self.base.strip()) if self.base else None
|
36
|
+
self.type = self.match.type
|
37
|
+
self.items = self.match.items
|
38
|
+
self.start = self.match.start
|
39
|
+
self.end = self.match.end
|
40
|
+
self.after = self.match.after
|
41
|
+
self.before = self.match.before
|
42
|
+
|
43
|
+
self.normalized_name = normalize(self.base) if self.base else None
|
44
|
+
|
45
|
+
else:
|
46
|
+
|
47
|
+
def __init__(
|
48
|
+
self, string: str, identifiers: str = "$@&%", parse_type: bool = False, ignore_errors: bool = True
|
49
|
+
) -> None:
|
50
|
+
self.string = string
|
51
|
+
|
52
|
+
self.match = robot_search_variable(string, identifiers=identifiers, ignore_errors=ignore_errors)
|
53
|
+
|
54
|
+
if not ignore_errors and self.match.base is None:
|
55
|
+
raise InvalidVariableError(f"Invalid variable '{string}'")
|
56
|
+
|
57
|
+
self.base = self.match.base
|
58
|
+
self.identifier = self.match.identifier
|
59
|
+
self.name = "%s{%s}" % (self.identifier, self.base.strip()) if self.base else None
|
60
|
+
self.type = None
|
61
|
+
self.items = self.match.items
|
62
|
+
self.start = self.match.start
|
63
|
+
self.end = self.match.end
|
64
|
+
self.after = self.match.after
|
65
|
+
self.before = self.match.before
|
66
|
+
|
67
|
+
self.normalized_name = normalize(self.base) if self.base else None
|
68
|
+
|
69
|
+
def __eq__(self, o: object) -> bool:
|
70
|
+
if self.normalized_name is None:
|
71
|
+
return False
|
72
|
+
|
73
|
+
if type(o) is VariableMatcher:
|
74
|
+
return o.normalized_name == self.normalized_name
|
75
|
+
|
76
|
+
if type(o) is str:
|
77
|
+
match = search_variable(o, "$@&%", ignore_errors=True)
|
78
|
+
base = match.base
|
79
|
+
if base is None:
|
80
|
+
return False
|
81
|
+
|
82
|
+
normalized = normalize(base)
|
83
|
+
return self.normalized_name == normalized
|
84
|
+
|
85
|
+
return False
|
86
|
+
|
87
|
+
def __hash__(self) -> int:
|
88
|
+
return hash(self.normalized_name)
|
89
|
+
|
90
|
+
def __str__(self) -> str:
|
91
|
+
return self.string
|
92
|
+
|
93
|
+
def __repr__(self) -> str:
|
94
|
+
return f"{type(self).__name__}(name={self.string!r})"
|
95
|
+
|
96
|
+
def resolve_base(self, variables: Any, ignore_errors: bool = False) -> None:
|
97
|
+
self.match.resolve_base(variables, ignore_errors)
|
98
|
+
|
99
|
+
def is_variable(self) -> bool:
|
100
|
+
return bool(self.match.is_variable())
|
101
|
+
|
102
|
+
def is_scalar_variable(self) -> bool:
|
103
|
+
return bool(self.match.is_scalar_variable())
|
104
|
+
|
105
|
+
def is_list_variable(self) -> bool:
|
106
|
+
return bool(self.match.is_list_variable())
|
107
|
+
|
108
|
+
def is_dict_variable(self) -> bool:
|
109
|
+
return bool(self.match.is_dict_variable())
|
110
|
+
|
111
|
+
if get_robot_version() >= (6, 1):
|
112
|
+
|
113
|
+
def is_assign(
|
114
|
+
self, allow_assign_mark: bool = False, allow_nested: bool = False, allow_items: bool = False
|
115
|
+
) -> bool:
|
116
|
+
return bool(
|
117
|
+
self.match.is_assign(
|
118
|
+
allow_assign_mark=allow_assign_mark, allow_nested=allow_nested, allow_items=allow_items
|
119
|
+
)
|
120
|
+
)
|
121
|
+
else:
|
122
|
+
|
123
|
+
def is_assign(
|
124
|
+
self, allow_assign_mark: bool = False, allow_nested: bool = False, allow_items: bool = False
|
125
|
+
) -> bool:
|
126
|
+
return bool(self.match.is_assign(allow_assign_mark=allow_assign_mark))
|
127
|
+
|
128
|
+
if get_robot_version() >= (6, 1):
|
129
|
+
|
130
|
+
def is_scalar_assign(self, allow_assign_mark: bool = False, allow_nested: bool = False) -> bool:
|
131
|
+
return bool(self.match.is_scalar_assign(allow_assign_mark=allow_assign_mark, allow_nested=allow_nested))
|
132
|
+
else:
|
133
|
+
|
134
|
+
def is_scalar_assign(self, allow_assign_mark: bool = False, allow_nested: bool = False) -> bool:
|
135
|
+
return bool(self.match.is_scalar_assign(allow_assign_mark=allow_assign_mark))
|
136
|
+
|
137
|
+
if get_robot_version() >= (6, 1):
|
138
|
+
|
139
|
+
def is_list_assign(
|
140
|
+
self,
|
141
|
+
allow_assign_mark: bool = False,
|
142
|
+
allow_nested: bool = False,
|
143
|
+
) -> bool:
|
144
|
+
return bool(self.match.is_list_assign(allow_assign_mark=allow_assign_mark, allow_nested=allow_nested))
|
145
|
+
else:
|
146
|
+
|
147
|
+
def is_list_assign(
|
148
|
+
self,
|
149
|
+
allow_assign_mark: bool = False,
|
150
|
+
allow_nested: bool = False,
|
151
|
+
) -> bool:
|
152
|
+
return bool(self.match.is_list_assign(allow_assign_mark=allow_assign_mark))
|
153
|
+
|
154
|
+
if get_robot_version() >= (6, 1):
|
155
|
+
|
156
|
+
def is_dict_assign(self, allow_assign_mark: bool = False, allow_nested: bool = False) -> bool:
|
157
|
+
return bool(self.match.is_dict_assign(allow_assign_mark=allow_assign_mark, allow_nested=allow_nested))
|
158
|
+
else:
|
159
|
+
|
160
|
+
def is_dict_assign(self, allow_assign_mark: bool = False, allow_nested: bool = False) -> bool:
|
161
|
+
return bool(self.match.is_dict_assign(allow_assign_mark=allow_assign_mark))
|
162
|
+
|
10
163
|
|
11
164
|
BUILTIN_VARIABLES = [
|
12
165
|
"${CURDIR}",
|
@@ -63,8 +216,10 @@ def is_variable(string: str, identifiers: str = "$@&") -> bool:
|
|
63
216
|
|
64
217
|
|
65
218
|
@functools.lru_cache(maxsize=8192)
|
66
|
-
def search_variable(
|
67
|
-
|
219
|
+
def search_variable(
|
220
|
+
string: str, identifiers: str = "$@&%*", parse_type: bool = False, ignore_errors: bool = False
|
221
|
+
) -> VariableMatcher:
|
222
|
+
return VariableMatcher(string, identifiers, parse_type, ignore_errors)
|
68
223
|
|
69
224
|
|
70
225
|
@functools.lru_cache(maxsize=8192)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: robotcode-robot
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.3.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==1.
|
29
|
+
Requires-Dist: robotcode-core==1.3.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
|
@@ -0,0 +1,32 @@
|
|
1
|
+
robotcode/robot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
robotcode/robot/__version__.py,sha256=F5mW07pSyGrqDNY2Ehr-UpDzpBtN-FsYU0QGZWf6PJE,22
|
3
|
+
robotcode/robot/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
|
4
|
+
robotcode/robot/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
robotcode/robot/config/loader.py,sha256=qrP810HNMDpqhXopWa0dOa0Wq_zQfVctsNYKY6sLKGI,8654
|
6
|
+
robotcode/robot/config/model.py,sha256=lN12CbUh_t0tMfMQpCi2Clcnpf8YTrh4KD1pbl6vpks,89106
|
7
|
+
robotcode/robot/config/utils.py,sha256=xY-LH31BidWzonpvSrle-4HvKrp02I7IRqU2JwlL4Ls,2931
|
8
|
+
robotcode/robot/diagnostics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
+
robotcode/robot/diagnostics/data_cache.py,sha256=duLbcKzwqlCC1tBvJY8ASYh2LcIoCSs8_NgQ8NUQ7VU,3186
|
10
|
+
robotcode/robot/diagnostics/diagnostics_modifier.py,sha256=6zJdXBd6g1QM12XJbsHd8gNNysECMnWlne3q8XNgBDo,9797
|
11
|
+
robotcode/robot/diagnostics/document_cache_helper.py,sha256=5H0S7qDCeoEmqjMLUE7EQy9iZcZTYIUl5H1Pdvn5s5I,23886
|
12
|
+
robotcode/robot/diagnostics/entities.py,sha256=ubjARNPP4fNGoOfv0Mm1RrbdpPfF3GC0Qn7Sz5Zeoc0,12449
|
13
|
+
robotcode/robot/diagnostics/errors.py,sha256=irVOZIcnpf611c9BdWXWpRu2esEl6SSN0EvZjA7p3bY,2060
|
14
|
+
robotcode/robot/diagnostics/imports_manager.py,sha256=X7ZEMaLzplrVt_880NyxFnbKlTNKpvNHWQxZeMoaQd0,61167
|
15
|
+
robotcode/robot/diagnostics/keyword_finder.py,sha256=TRYnbliYe0LPwqzdzABZawJEafksAsZBQ3pF3zYMdaA,18763
|
16
|
+
robotcode/robot/diagnostics/library_doc.py,sha256=Bq38jak6MK6S_J_mMyF3taPZkDKtxE0kN7aP-Ld2QPs,100780
|
17
|
+
robotcode/robot/diagnostics/model_helper.py,sha256=RmKg1t5qsbSbW5uiehpFzJt157gDSQ1ayzXlur26AGI,31000
|
18
|
+
robotcode/robot/diagnostics/namespace.py,sha256=dS8_1JZj-Vk-zX8JswkLJ5cKIg2J0FgEvnXRcnUCeZg,80960
|
19
|
+
robotcode/robot/diagnostics/namespace_analyzer.py,sha256=Tv5Pje9WQkUG3LAgJER4eYhiLxXg8molmCvm0LlOro4,78849
|
20
|
+
robotcode/robot/diagnostics/workspace_config.py,sha256=gyKR5z-HpnjxPAui3YujgeZqXX7RYBO_ErGVlk7vnGc,2689
|
21
|
+
robotcode/robot/utils/__init__.py,sha256=HETwRb7y8SJSehSxygixKwkUGdiTKNgS4NjXVOUrUzE,361
|
22
|
+
robotcode/robot/utils/ast.py,sha256=IdihPbvY2ERwm763mwPcDUZlS-si6AgNdF3ROqX48Pk,11417
|
23
|
+
robotcode/robot/utils/markdownformatter.py,sha256=v2p4T-d0wc0SuUJ4iLJJg1pHjgIA6dZX4l_XnZIXjXM,11690
|
24
|
+
robotcode/robot/utils/match.py,sha256=9tG1OD9KS1v9ocWgsERSf6z_w9gAeE5LourNUYHzvTM,653
|
25
|
+
robotcode/robot/utils/robot_path.py,sha256=Z-GVBOPA_xeD20bCJi4_AWaU0eQWvCym-YFtyRpXARE,1767
|
26
|
+
robotcode/robot/utils/stubs.py,sha256=umugZYAyneFNgqRJBRMJPzm0u0B_TH8Sx_y-ykXnxpw,351
|
27
|
+
robotcode/robot/utils/variables.py,sha256=RCmBdVWtwVkB058QCBE_Bj3_28H1sXmYs0lJF9bVc0w,7644
|
28
|
+
robotcode/robot/utils/visitor.py,sha256=nP3O0qh3YYuxR6S8wYJRBFfNwIVgsgohURBlrnFkRYQ,2299
|
29
|
+
robotcode_robot-1.3.0.dist-info/METADATA,sha256=oZcIGZXyNKACn2QUb_QohhNobvuaHF2EQoy3itTkjBc,2238
|
30
|
+
robotcode_robot-1.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
31
|
+
robotcode_robot-1.3.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
|
32
|
+
robotcode_robot-1.3.0.dist-info/RECORD,,
|
@@ -1,32 +0,0 @@
|
|
1
|
-
robotcode/robot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
robotcode/robot/__version__.py,sha256=LGVQyDsWifdACo7qztwb8RWWHds1E7uQ-ZqD8SAjyw4,22
|
3
|
-
robotcode/robot/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
|
4
|
-
robotcode/robot/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
robotcode/robot/config/loader.py,sha256=qrP810HNMDpqhXopWa0dOa0Wq_zQfVctsNYKY6sLKGI,8654
|
6
|
-
robotcode/robot/config/model.py,sha256=sgr6-4_E06g-yIXW41Z-NtIXZ_7JMmR5WvUD7kTUqu4,89106
|
7
|
-
robotcode/robot/config/utils.py,sha256=xY-LH31BidWzonpvSrle-4HvKrp02I7IRqU2JwlL4Ls,2931
|
8
|
-
robotcode/robot/diagnostics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
robotcode/robot/diagnostics/data_cache.py,sha256=duLbcKzwqlCC1tBvJY8ASYh2LcIoCSs8_NgQ8NUQ7VU,3186
|
10
|
-
robotcode/robot/diagnostics/diagnostics_modifier.py,sha256=6zJdXBd6g1QM12XJbsHd8gNNysECMnWlne3q8XNgBDo,9797
|
11
|
-
robotcode/robot/diagnostics/document_cache_helper.py,sha256=5H0S7qDCeoEmqjMLUE7EQy9iZcZTYIUl5H1Pdvn5s5I,23886
|
12
|
-
robotcode/robot/diagnostics/entities.py,sha256=I55YMxXpl7C1Sx6GgxRqb7vWMK7uWIoB7GhR1X9b66c,12983
|
13
|
-
robotcode/robot/diagnostics/errors.py,sha256=RGnE4KCgNxQ58hNMBuAD3Q-qWqZVWZSZsCnhBGtQScw,1975
|
14
|
-
robotcode/robot/diagnostics/imports_manager.py,sha256=hu4Wp9b8J1jk55-NBqK2teQieWQF5D8LKxM5fyaxI1U,61156
|
15
|
-
robotcode/robot/diagnostics/keyword_finder.py,sha256=dm4BA0ccp5V4C65CkSYUJUNXegSmvG24uu09T3eL6a4,17319
|
16
|
-
robotcode/robot/diagnostics/library_doc.py,sha256=ruHS1bjOae0v4HQ2zH-B0baP_zs8BFa7mjsIb8tyvp4,100541
|
17
|
-
robotcode/robot/diagnostics/model_helper.py,sha256=nq78e6TQ9Anvz_VSLW560lRTKrRjBsh7NoWttEvJ2hw,30973
|
18
|
-
robotcode/robot/diagnostics/namespace.py,sha256=qSE-1z8U8AoE7HyY-cUMLgaEETjMB3gQr3IHLVdgFSU,78941
|
19
|
-
robotcode/robot/diagnostics/namespace_analyzer.py,sha256=ksa9Mmexnvo8XWscm-OLqG9jd2lxetYLtmVx0KgCkj4,76047
|
20
|
-
robotcode/robot/diagnostics/workspace_config.py,sha256=gyKR5z-HpnjxPAui3YujgeZqXX7RYBO_ErGVlk7vnGc,2689
|
21
|
-
robotcode/robot/utils/__init__.py,sha256=OjNPMn_XSnfaMCyKd8Kmq6vlRt6mIGlzW4qiiD3ykUg,447
|
22
|
-
robotcode/robot/utils/ast.py,sha256=m5pNr2m84lmPP4yIstq5RHjLrj0u8RsSmy6iCXBnV4g,11092
|
23
|
-
robotcode/robot/utils/markdownformatter.py,sha256=v2p4T-d0wc0SuUJ4iLJJg1pHjgIA6dZX4l_XnZIXjXM,11690
|
24
|
-
robotcode/robot/utils/match.py,sha256=9tG1OD9KS1v9ocWgsERSf6z_w9gAeE5LourNUYHzvTM,653
|
25
|
-
robotcode/robot/utils/robot_path.py,sha256=Z-GVBOPA_xeD20bCJi4_AWaU0eQWvCym-YFtyRpXARE,1767
|
26
|
-
robotcode/robot/utils/stubs.py,sha256=umugZYAyneFNgqRJBRMJPzm0u0B_TH8Sx_y-ykXnxpw,351
|
27
|
-
robotcode/robot/utils/variables.py,sha256=-ldL8mRRSYYW2pwlm8IpoDeQcG6LYBqaYyV_7U3xsIc,2174
|
28
|
-
robotcode/robot/utils/visitor.py,sha256=nP3O0qh3YYuxR6S8wYJRBFfNwIVgsgohURBlrnFkRYQ,2299
|
29
|
-
robotcode_robot-1.1.0.dist-info/METADATA,sha256=9clEMI2FUOz5qd4N8VmYxi5qc24c0zdMzr7zh9I0XWg,2238
|
30
|
-
robotcode_robot-1.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
31
|
-
robotcode_robot-1.1.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
|
32
|
-
robotcode_robot-1.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|