robotcode-robot 0.93.0__py3-none-any.whl → 0.94.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- import functools
4
3
  import itertools
5
4
  import re
6
5
  from abc import ABC, abstractmethod
@@ -224,7 +223,7 @@ _ # end of italic
224
223
  ("*", self._format_bold),
225
224
  ("_", self._format_italic),
226
225
  ("``", self._format_code),
227
- ("", functools.partial(LinkFormatter().format_link)),
226
+ ("", LinkFormatter().format_link),
228
227
  ]
229
228
 
230
229
  def format(self, line: str) -> str:
@@ -249,9 +248,10 @@ _ # end of italic
249
248
  return self._code.sub("\\1`\\3`", line)
250
249
 
251
250
 
252
- class PreformattedFormatter(Formatter):
253
- _format_line = functools.partial(LineFormatter().format)
251
+ _line_formatter = LineFormatter()
252
+
254
253
 
254
+ class PreformattedFormatter(Formatter):
255
255
  def _handles(self, line: str) -> bool:
256
256
  return line.startswith("| ") or line == "|"
257
257
 
@@ -261,8 +261,6 @@ class PreformattedFormatter(Formatter):
261
261
 
262
262
 
263
263
  class ParagraphFormatter(Formatter):
264
- _format_line = functools.partial(LineFormatter().format)
265
-
266
264
  def __init__(self, other_formatters: List[Formatter]) -> None:
267
265
  super().__init__()
268
266
  self._other_formatters = other_formatters
@@ -271,18 +269,17 @@ class ParagraphFormatter(Formatter):
271
269
  return not any(other.handles(line) for other in self._other_formatters)
272
270
 
273
271
  def format(self, lines: List[str]) -> str:
274
- return self._format_line(" ".join(lines)) + "\n\n"
272
+ return _line_formatter.format(" ".join(lines)) + "\n\n"
275
273
 
276
274
 
277
275
  class ListFormatter(Formatter):
278
276
  _strip_lines = False
279
- _format_item = functools.partial(LineFormatter().format)
280
277
 
281
278
  def _handles(self, line: str) -> bool:
282
279
  return bool(line.strip().startswith("- ") or line.startswith(" ") and self._lines)
283
280
 
284
281
  def format(self, lines: List[str]) -> str:
285
- items = ["- %s" % self._format_item(line) for line in self._combine_lines(lines)]
282
+ items = ["- %s" % _line_formatter.format(line) for line in self._combine_lines(lines)]
286
283
  return "\n".join(items) + "\n\n"
287
284
 
288
285
  def _combine_lines(self, lines: List[str]) -> Iterator[str]:
@@ -311,7 +308,7 @@ class RulerFormatter(SingleLineFormatter):
311
308
  class TableFormatter(Formatter):
312
309
  _table_line = re.compile(r"^\| (.* |)\|$")
313
310
  _line_splitter = re.compile(r" \|(?= )")
314
- _format_cell_content = functools.partial(LineFormatter().format)
311
+ _format_cell_content = _line_formatter.format
315
312
 
316
313
  def _handles(self, line: str) -> bool:
317
314
  return self._table_line.match(line) is not None
@@ -351,4 +348,4 @@ class TableFormatter(Formatter):
351
348
  if content.startswith("=") and content.endswith("="):
352
349
  content = content[1:-1]
353
350
 
354
- return f" {self._format_cell_content(content).strip()} "
351
+ return f" {_line_formatter.format(content).strip()} "
@@ -1,6 +1,5 @@
1
1
  import ast
2
2
  from abc import ABC
3
- from collections import defaultdict
4
3
  from typing import (
5
4
  Any,
6
5
  AsyncIterator,
@@ -9,7 +8,6 @@ from typing import (
9
8
  Iterator,
10
9
  Optional,
11
10
  Type,
12
- Union,
13
11
  )
14
12
 
15
13
  from robot.parsing.model.statements import Statement
@@ -65,17 +63,12 @@ async def iter_nodes(node: ast.AST) -> AsyncIterator[ast.AST]:
65
63
  yield n
66
64
 
67
65
 
68
- class _NotSet:
69
- pass
70
-
71
-
72
66
  class VisitorFinder(ABC):
73
- __NOT_SET = _NotSet()
74
- __cls_finder_cache__: Dict[Type[Any], Union[Callable[..., Any], None, _NotSet]]
67
+ __cls_finder_cache__: Dict[Type[Any], Optional[Callable[..., Any]]]
75
68
 
76
69
  def __init_subclass__(cls, **kwargs: Any) -> None:
77
70
  super().__init_subclass__(**kwargs)
78
- cls.__cls_finder_cache__ = defaultdict(lambda: cls.__NOT_SET)
71
+ cls.__cls_finder_cache__ = {}
79
72
 
80
73
  @classmethod
81
74
  def __find_visitor(cls, node_cls: Type[Any]) -> Optional[Callable[..., Any]]:
@@ -93,10 +86,11 @@ class VisitorFinder(ABC):
93
86
 
94
87
  @classmethod
95
88
  def _find_visitor(cls, node_cls: Type[Any]) -> Optional[Callable[..., Any]]:
96
- result = cls.__cls_finder_cache__[node_cls]
97
- if result is cls.__NOT_SET:
98
- result = cls.__cls_finder_cache__[node_cls] = cls.__find_visitor(node_cls)
99
- return result # type: ignore[return-value]
89
+ if node_cls in cls.__cls_finder_cache__:
90
+ return cls.__cls_finder_cache__[node_cls]
91
+
92
+ result = cls.__cls_finder_cache__[node_cls] = cls.__find_visitor(node_cls)
93
+ return result
100
94
 
101
95
 
102
96
  class Visitor(VisitorFinder):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: robotcode-robot
3
- Version: 0.93.0
3
+ Version: 0.94.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.2.0,>=3.2.0
29
- Requires-Dist: robotcode-core==0.93.0
29
+ Requires-Dist: robotcode-core==0.94.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,31 @@
1
+ robotcode/robot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ robotcode/robot/__version__.py,sha256=BbCpQB0IaKmq_fOtysTb_iVtvqbH-vHS1DoS1eLd4w8,23
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=bNJwr_XdCoUzpG2ag0BH33PIfiCwn0GMxn7q_Sw3zOk,8103
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/diagnostics_modifier.py,sha256=3dDsu8-ET6weIvv7Sk3IQaPYFNxnXUs8Y7gpGTjfOBs,9796
10
+ robotcode/robot/diagnostics/document_cache_helper.py,sha256=n903UxVXM4Uq4fPxN5s-dugQAKcWUwf4Nw4q0CJV7aw,23902
11
+ robotcode/robot/diagnostics/entities.py,sha256=sNXKBdJEy7elkzc0P2qszHQQosbmcyWrCw3Za4-LSCE,11013
12
+ robotcode/robot/diagnostics/errors.py,sha256=QpvimvU_-c13i6mNrOiIavr2BeClHThRk8Rh7zIbA1s,1813
13
+ robotcode/robot/diagnostics/imports_manager.py,sha256=somlZbrkXasgU6KZmnf9Zfm4_3nqXEbi8Er5kSO-48Y,58999
14
+ robotcode/robot/diagnostics/keyword_finder.py,sha256=KQKZN0lf4D8qRERRx1JUeEdSHFgRfs0wEcu0XH2xJ-A,16809
15
+ robotcode/robot/diagnostics/library_doc.py,sha256=2qPU1MeD4uiUAipV0U3JUxQAKhr9TH_WwDM_rDdMZuw,98862
16
+ robotcode/robot/diagnostics/model_helper.py,sha256=9JGZN_dBXMPP06WsAIDz5Q_Fg3F3Rq1n-7Rc72etivo,30864
17
+ robotcode/robot/diagnostics/namespace.py,sha256=_KNsoQS5UJB6Laa8Ic0FrQZjxngxmaKO36KJ260qyug,76054
18
+ robotcode/robot/diagnostics/namespace_analyzer.py,sha256=z1AyGQXMoq1up3LrPSLWJHHNUI_j_iwIj9ucLJcg7gU,71399
19
+ robotcode/robot/diagnostics/workspace_config.py,sha256=3SoewUj_LZB1Ki5hXM8oxQpJr6vyiog66SUw-ibODSA,2478
20
+ robotcode/robot/utils/__init__.py,sha256=OjNPMn_XSnfaMCyKd8Kmq6vlRt6mIGlzW4qiiD3ykUg,447
21
+ robotcode/robot/utils/ast.py,sha256=_ob36KHFY776n9dhljn0xAWVoUDb7pV86fPW40vIirY,11266
22
+ robotcode/robot/utils/markdownformatter.py,sha256=Cj4NjComTcNZf8uuezvtBbZqPMLjS237RknMopZYETk,11418
23
+ robotcode/robot/utils/match.py,sha256=ofyfXgrvVddl7a064Dk5Kiqp3a-n_6gTIgqDbL3E80Q,632
24
+ robotcode/robot/utils/robot_path.py,sha256=qKBh1cEnReBBLKkWu4gB9EzM-scAwE4xJc1m6v2LRN0,1786
25
+ robotcode/robot/utils/stubs.py,sha256=6-DMI_CQVJHDgG13t-zINKGCRb_Q7MQPm0_AkfhAEvE,748
26
+ robotcode/robot/utils/variables.py,sha256=fEl8S37lb_mD4hn2MZRAlkiuLGBjAOeZVK0r2o2CfPw,742
27
+ robotcode/robot/utils/visitor.py,sha256=V3ZtpzrCilKpLQfDXUcjapd2uGq12XxbHppNPOl_Jns,3080
28
+ robotcode_robot-0.94.0.dist-info/METADATA,sha256=ZC2K7aAay0qTvzWb38ymbXwS1Ufd8OvfKZdICK2A1uw,2240
29
+ robotcode_robot-0.94.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
30
+ robotcode_robot-0.94.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
31
+ robotcode_robot-0.94.0.dist-info/RECORD,,
@@ -1,30 +0,0 @@
1
- robotcode/robot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- robotcode/robot/__version__.py,sha256=W-KEJT0wpRrG8XJ2aDG4NSyzaUucgZR9y6mwfCTlku4,23
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=bNJwr_XdCoUzpG2ag0BH33PIfiCwn0GMxn7q_Sw3zOk,8103
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/diagnostics_modifier.py,sha256=3dDsu8-ET6weIvv7Sk3IQaPYFNxnXUs8Y7gpGTjfOBs,9796
10
- robotcode/robot/diagnostics/document_cache_helper.py,sha256=MlOPXC3mUVjNB2rHn5UJK7NnUPa8S4mE3qojILOi_Mk,23756
11
- robotcode/robot/diagnostics/entities.py,sha256=dWZFSrAuW9wzW9AEDSr-stseexLbJIYfdScfAbBj4FY,11002
12
- robotcode/robot/diagnostics/errors.py,sha256=HCE0h0_ui1tx-6pJHs0r4s09ZHmArYwKUo-_lBl9K-4,1600
13
- robotcode/robot/diagnostics/imports_manager.py,sha256=GvcIEqghVjtliTWUwQo4N-xier00CGnEh_eO7l05cJg,57187
14
- robotcode/robot/diagnostics/library_doc.py,sha256=7m29COvY_YlK_n9dj57q0c7sFRThoR_X4bgdZapWwaY,98160
15
- robotcode/robot/diagnostics/model_helper.py,sha256=_5ixKKMrb-nY-uvV8_WjJ1rlNlz7gT7kHM5NYi_hjVg,30232
16
- robotcode/robot/diagnostics/namespace.py,sha256=lH5RReu-fW0g8CZBh9LKWHItCZh14D-XFvFdYUvBoDg,90151
17
- robotcode/robot/diagnostics/namespace_analyzer.py,sha256=3eC1xEBm_foCnqoHk8Cj6O11UXOHcHxWnfuKP8M5KIQ,51369
18
- robotcode/robot/diagnostics/workspace_config.py,sha256=3SoewUj_LZB1Ki5hXM8oxQpJr6vyiog66SUw-ibODSA,2478
19
- robotcode/robot/utils/__init__.py,sha256=OjNPMn_XSnfaMCyKd8Kmq6vlRt6mIGlzW4qiiD3ykUg,447
20
- robotcode/robot/utils/ast.py,sha256=_ob36KHFY776n9dhljn0xAWVoUDb7pV86fPW40vIirY,11266
21
- robotcode/robot/utils/markdownformatter.py,sha256=0XZZ5wDU2yfzIuShjG7h79PgzMaQJ501WH4YRFcG1VM,11615
22
- robotcode/robot/utils/match.py,sha256=ofyfXgrvVddl7a064Dk5Kiqp3a-n_6gTIgqDbL3E80Q,632
23
- robotcode/robot/utils/robot_path.py,sha256=qKBh1cEnReBBLKkWu4gB9EzM-scAwE4xJc1m6v2LRN0,1786
24
- robotcode/robot/utils/stubs.py,sha256=6-DMI_CQVJHDgG13t-zINKGCRb_Q7MQPm0_AkfhAEvE,748
25
- robotcode/robot/utils/variables.py,sha256=fEl8S37lb_mD4hn2MZRAlkiuLGBjAOeZVK0r2o2CfPw,742
26
- robotcode/robot/utils/visitor.py,sha256=uYLqEhGPmzWKWI3SSrmCaYMwtKvNShvbiPZ4b3FavX8,3241
27
- robotcode_robot-0.93.0.dist-info/METADATA,sha256=64V1dXSzlmT6KArsIP0YqCm79s_oPXVm3MXBlenwx2E,2240
28
- robotcode_robot-0.93.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
29
- robotcode_robot-0.93.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
30
- robotcode_robot-0.93.0.dist-info/RECORD,,