robotcode-robot 1.3.0.dev4__py3-none-any.whl → 1.3.0.dev5__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.
@@ -8,30 +8,63 @@ from robot.variables.search import is_variable as robot_is_variable
8
8
  from robot.variables.search import search_variable as robot_search_variable
9
9
  from robotcode.robot.utils.match import normalize
10
10
 
11
+ from . import get_robot_version
12
+
11
13
 
12
14
  class InvalidVariableError(Exception):
13
15
  pass
14
16
 
15
17
 
16
18
  class VariableMatcher:
17
- def __init__(self, string: str, identifiers: str = "$@&%", ignore_errors: bool = True) -> None:
18
- self.string = string
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
19
51
 
20
- self.match = robot_search_variable(string, identifiers=identifiers, ignore_errors=ignore_errors)
52
+ self.match = robot_search_variable(string, identifiers=identifiers, ignore_errors=ignore_errors)
21
53
 
22
- if not ignore_errors and self.match.base is None:
23
- raise InvalidVariableError(f"Invalid variable '{string}'")
54
+ if not ignore_errors and self.match.base is None:
55
+ raise InvalidVariableError(f"Invalid variable '{string}'")
24
56
 
25
- self.base = self.match.base
26
- self.identifier = self.match.identifier
27
- self.name = "%s{%s}" % (self.identifier, self.base.strip()) if self.base else None
28
- self.items = self.match.items
29
- self.start = self.match.start
30
- self.end = self.match.end
31
- self.after = self.match.after
32
- self.before = self.match.before
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
33
66
 
34
- self.normalized_name = normalize(self.base) if self.base else None
67
+ self.normalized_name = normalize(self.base) if self.base else None
35
68
 
36
69
  def __eq__(self, o: object) -> bool:
37
70
  if self.normalized_name is None:
@@ -75,17 +108,57 @@ class VariableMatcher:
75
108
  def is_dict_variable(self) -> bool:
76
109
  return bool(self.match.is_dict_variable())
77
110
 
78
- def is_assign(self, allow_assign_mark: bool = False) -> bool:
79
- return bool(self.match.is_assign(allow_assign_mark))
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))
80
153
 
81
- def is_scalar_assign(self, allow_assign_mark: bool = False) -> bool:
82
- return bool(self.match.is_scalar_assign(allow_assign_mark))
154
+ if get_robot_version() >= (6, 1):
83
155
 
84
- def is_list_assign(self, allow_assign_mark: bool = False) -> bool:
85
- return bool(self.match.is_list_assign(allow_assign_mark))
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:
86
159
 
87
- def is_dict_assign(self, allow_assign_mark: bool = False) -> bool:
88
- return bool(self.match.is_dict_assign(allow_assign_mark))
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))
89
162
 
90
163
 
91
164
  BUILTIN_VARIABLES = [
@@ -143,8 +216,10 @@ def is_variable(string: str, identifiers: str = "$@&") -> bool:
143
216
 
144
217
 
145
218
  @functools.lru_cache(maxsize=8192)
146
- def search_variable(string: str, identifiers: str = "$@&%*", ignore_errors: bool = False) -> VariableMatcher:
147
- return VariableMatcher(string, identifiers, ignore_errors)
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)
148
223
 
149
224
 
150
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.0.dev4
3
+ Version: 1.3.0.dev5
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.3.0-dev.4
29
+ Requires-Dist: robotcode-core==1.3.0-dev.5
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,5 +1,5 @@
1
1
  robotcode/robot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- robotcode/robot/__version__.py,sha256=hJhzLh8rJqV_2aQ7Vj21Ew4N7Sa97YEVM78TfcKNP1c,28
2
+ robotcode/robot/__version__.py,sha256=xpHiI1TV5XoRHqlkLkhDmsvHAFjE0mYqN3mNqnZnCdw,28
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
@@ -9,24 +9,24 @@ robotcode/robot/diagnostics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
9
9
  robotcode/robot/diagnostics/data_cache.py,sha256=duLbcKzwqlCC1tBvJY8ASYh2LcIoCSs8_NgQ8NUQ7VU,3186
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=mcEg2DXhymqhwRLuhFcuErcZR_46XrqFI1JV4_0NIOo,11872
12
+ robotcode/robot/diagnostics/entities.py,sha256=ubjARNPP4fNGoOfv0Mm1RrbdpPfF3GC0Qn7Sz5Zeoc0,12449
13
13
  robotcode/robot/diagnostics/errors.py,sha256=irVOZIcnpf611c9BdWXWpRu2esEl6SSN0EvZjA7p3bY,2060
14
14
  robotcode/robot/diagnostics/imports_manager.py,sha256=hu4Wp9b8J1jk55-NBqK2teQieWQF5D8LKxM5fyaxI1U,61156
15
- robotcode/robot/diagnostics/keyword_finder.py,sha256=Y74GPkQrrc3Pr-SaDhoc4YngJWnGU3MbqompYQhrNV4,17949
16
- robotcode/robot/diagnostics/library_doc.py,sha256=Twc5dA1UrVNRjG_g9YWkBdJjO9zuyL7kGyRjP-a0SrU,100768
15
+ robotcode/robot/diagnostics/keyword_finder.py,sha256=TRYnbliYe0LPwqzdzABZawJEafksAsZBQ3pF3zYMdaA,18763
16
+ robotcode/robot/diagnostics/library_doc.py,sha256=Bq38jak6MK6S_J_mMyF3taPZkDKtxE0kN7aP-Ld2QPs,100780
17
17
  robotcode/robot/diagnostics/model_helper.py,sha256=RmKg1t5qsbSbW5uiehpFzJt157gDSQ1ayzXlur26AGI,31000
18
- robotcode/robot/diagnostics/namespace.py,sha256=J7Lwk4njBNlJ7C16nCB1QUZJoy8QmEqRCzfpU6-h56E,78941
19
- robotcode/robot/diagnostics/namespace_analyzer.py,sha256=Ybj7_dPdQHtuXenonCS_eVZaeV7-_TgFIUDGB9Hjz-c,77846
18
+ robotcode/robot/diagnostics/namespace.py,sha256=dS8_1JZj-Vk-zX8JswkLJ5cKIg2J0FgEvnXRcnUCeZg,80960
19
+ robotcode/robot/diagnostics/namespace_analyzer.py,sha256=Tv5Pje9WQkUG3LAgJER4eYhiLxXg8molmCvm0LlOro4,78849
20
20
  robotcode/robot/diagnostics/workspace_config.py,sha256=gyKR5z-HpnjxPAui3YujgeZqXX7RYBO_ErGVlk7vnGc,2689
21
21
  robotcode/robot/utils/__init__.py,sha256=HETwRb7y8SJSehSxygixKwkUGdiTKNgS4NjXVOUrUzE,361
22
- robotcode/robot/utils/ast.py,sha256=MmDs0EXa-GvGo-5Jf96alz5vDcQlksoIStvEOsqiVGk,11275
22
+ robotcode/robot/utils/ast.py,sha256=IdihPbvY2ERwm763mwPcDUZlS-si6AgNdF3ROqX48Pk,11417
23
23
  robotcode/robot/utils/markdownformatter.py,sha256=v2p4T-d0wc0SuUJ4iLJJg1pHjgIA6dZX4l_XnZIXjXM,11690
24
24
  robotcode/robot/utils/match.py,sha256=9tG1OD9KS1v9ocWgsERSf6z_w9gAeE5LourNUYHzvTM,653
25
25
  robotcode/robot/utils/robot_path.py,sha256=Z-GVBOPA_xeD20bCJi4_AWaU0eQWvCym-YFtyRpXARE,1767
26
26
  robotcode/robot/utils/stubs.py,sha256=umugZYAyneFNgqRJBRMJPzm0u0B_TH8Sx_y-ykXnxpw,351
27
- robotcode/robot/utils/variables.py,sha256=zwRiorUiHp5GTmzLrJAhiVopcJC6-RywEHArKRtYzMY,4814
27
+ robotcode/robot/utils/variables.py,sha256=RCmBdVWtwVkB058QCBE_Bj3_28H1sXmYs0lJF9bVc0w,7644
28
28
  robotcode/robot/utils/visitor.py,sha256=nP3O0qh3YYuxR6S8wYJRBFfNwIVgsgohURBlrnFkRYQ,2299
29
- robotcode_robot-1.3.0.dev4.dist-info/METADATA,sha256=YhDElMFgRw_hMwtn9XevWvJx-4y_5IC562CLsooiXfU,2249
30
- robotcode_robot-1.3.0.dev4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
- robotcode_robot-1.3.0.dev4.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
32
- robotcode_robot-1.3.0.dev4.dist-info/RECORD,,
29
+ robotcode_robot-1.3.0.dev5.dist-info/METADATA,sha256=e3f7tDaij4-quunMQKGAy5uSQ3hxZiZglhEQgVBtsrk,2249
30
+ robotcode_robot-1.3.0.dev5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
+ robotcode_robot-1.3.0.dev5.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
32
+ robotcode_robot-1.3.0.dev5.dist-info/RECORD,,