robotcode-robot 2.9.0.dev197__py3-none-any.whl → 2.9.0.dev230__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.
@@ -1 +1 @@
1
- __version__ = "2.9.0-dev.197"
1
+ __version__ = "2.9.0-dev.230"
@@ -35,6 +35,12 @@ def private_keyword_call_message(keyword: KeywordDoc, source: Optional[str]) ->
35
35
  return None
36
36
 
37
37
 
38
+ def deprecated_keyword_message(keyword: KeywordDoc) -> str:
39
+ """The `DeprecatedKeyword` message for a call of `keyword`, in the form of Robot Framework's warning."""
40
+ reason = keyword.deprecated_message
41
+ return f"Keyword '{keyword.name}' is deprecated.{f' {reason}' if reason else ''}"
42
+
43
+
38
44
  # The section headers of keyword documentation, as Robot Framework 7.5 recognizes them.
39
45
  _DOC_SECTION_HEADER = re.compile(
40
46
  r"[*_]*(args|arguments|parameters|returns|return|yields|raises|raise|tags)[*_]*::?[*_]*(\s+.*)?",
@@ -35,7 +35,8 @@ from robotcode.robot.diagnostics.diagnostics_modifier import (
35
35
  )
36
36
 
37
37
  from ..config.model import RobotBaseProfile
38
- from ..document_formats import MARKDOWN_LANGUAGE_ID, is_markdown_file
38
+ from ..document_formats import is_markdown_file
39
+ from ..language_definitions import MARKDOWN_LANGUAGE_ID
39
40
  from ..utils import RF_VERSION
40
41
  from ..utils.markdown_blocks import RobotBlock, find_robot_blocks, read_markdown_data
41
42
  from ..utils.stubs import Languages
@@ -56,7 +56,7 @@ from robotcode.core.utils.path import (
56
56
  )
57
57
 
58
58
  from ..__version__ import __version__
59
- from ..document_formats import MARKDOWN_LANGUAGE_ID
59
+ from ..language_definitions import ROBOT_LANGUAGE_IDS
60
60
  from ..utils import RF_VERSION
61
61
  from ..utils.robot_path import find_file_ex
62
62
  from ..utils.stubs import Languages
@@ -1273,7 +1273,7 @@ class ImportsManager:
1273
1273
  # unresolved imports (file didn't exist yet) get invalidated and re-analyzed.
1274
1274
  self.imports_changed(self, uri)
1275
1275
 
1276
- @language_id("robotframework", MARKDOWN_LANGUAGE_ID)
1276
+ @language_id(*ROBOT_LANGUAGE_IDS)
1277
1277
  def _on_possible_resource_document_modified(self, sender: Any, document: TextDocument) -> None:
1278
1278
  run_as_task(self.__on_possible_resource_document_modified, sender, document)
1279
1279
 
@@ -66,6 +66,7 @@ from robot.utils.escaping import unescape
66
66
  from robot.utils.htmlformatters import HeaderFormatter as RobotHeaderFormatter
67
67
  from robot.utils.importer import Importer
68
68
  from robot.utils.robotpath import find_file as robot_find_file
69
+ from robot.utils.text import getshortdoc
69
70
  from robot.variables import Variables
70
71
  from robot.variables.filesetter import PythonImporter, YamlImporter
71
72
  from robot.variables.finders import VariableFinder
@@ -1110,9 +1111,13 @@ class KeywordDoc(SourceEntity):
1110
1111
 
1111
1112
  @property
1112
1113
  def deprecated_message(self) -> str:
1113
- if (m := DEPRECATED_PATTERN.match(self.doc)) is not None:
1114
- return m.group("message").strip()
1115
- return ""
1114
+ # Robot Framework's run-time warning takes the text after the closing `*` of the short doc;
1115
+ # BuiltIn writes its reason between the asterisks, so that is the fallback.
1116
+ short_doc: str = getshortdoc(self.doc)
1117
+ if not short_doc.startswith("*DEPRECATED") or "*" not in short_doc[1:]:
1118
+ return ""
1119
+ _, marker, after = short_doc.split("*", 2)
1120
+ return after.strip() or marker[len("DEPRECATED") :].strip()
1116
1121
 
1117
1122
  @property
1118
1123
  def name_range(self) -> Range:
@@ -70,7 +70,7 @@ from ..utils.variables import (
70
70
  )
71
71
  from ..utils.visitor import Visitor
72
72
  from .analyzer_result import AnalyzerResult
73
- from .diagnostic_rules import private_keyword_call_message, tags_row_without_empty_row
73
+ from .diagnostic_rules import deprecated_keyword_message, private_keyword_call_message, tags_row_without_empty_row
74
74
  from .entities import (
75
75
  ArgumentDefinition,
76
76
  BuiltInVariableDefinition,
@@ -897,8 +897,7 @@ class NamespaceAnalyzer(Visitor):
897
897
  if result.is_deprecated:
898
898
  self._append_diagnostics(
899
899
  range=kw_range,
900
- message=f"Keyword '{result.name}' is deprecated"
901
- f"{f': {result.deprecated_message}' if result.deprecated_message else ''}.",
900
+ message=deprecated_keyword_message(result),
902
901
  severity=DiagnosticSeverity.HINT,
903
902
  tags=[DiagnosticTag.DEPRECATED],
904
903
  code=Error.DEPRECATED_KEYWORD,
@@ -107,7 +107,7 @@ from ...utils.variables import (
107
107
  )
108
108
  from ...utils.visitor import Visitor
109
109
  from ..analyzer_result import AnalyzerResult
110
- from ..diagnostic_rules import private_keyword_call_message, tags_row_without_empty_row
110
+ from ..diagnostic_rules import deprecated_keyword_message, private_keyword_call_message, tags_row_without_empty_row
111
111
  from ..entities import (
112
112
  ArgumentDefinition,
113
113
  BuiltInVariableDefinition,
@@ -2241,8 +2241,7 @@ class SemanticAnalyzer(Visitor):
2241
2241
  if result.is_deprecated:
2242
2242
  self._append_diagnostics(
2243
2243
  range=kw_range,
2244
- message=f"Keyword '{result.name}' is deprecated"
2245
- f"{f': {result.deprecated_message}' if result.deprecated_message else ''}.",
2244
+ message=deprecated_keyword_message(result),
2246
2245
  severity=DiagnosticSeverity.HINT,
2247
2246
  tags=[DiagnosticTag.DEPRECATED],
2248
2247
  code=Error.DEPRECATED_KEYWORD,
@@ -4,7 +4,6 @@ from pathlib import Path
4
4
  from typing import Callable, Dict, List, Optional, Tuple, Union
5
5
 
6
6
  from robot.running.builder import TestSuiteBuilder
7
- from robotcode.core.language import LanguageDefinition
8
7
  from robotcode.core.utils.dataclasses import CamelSnakeMixin
9
8
 
10
9
  from .config.model import RobotBaseProfile, StringExpression
@@ -33,9 +32,6 @@ def _robot_framework_formats() -> Tuple[Tuple[str, ...], Dict[str, str]]:
33
32
 
34
33
  DEFAULT_EXTENSIONS, _FORMAT_OF_EXTENSION = _robot_framework_formats()
35
34
 
36
- # the language of the Markdown files Robot Framework parses; no editor sends it, the server detects it by file name
37
- MARKDOWN_LANGUAGE_ID = "robotframework-markdown"
38
-
39
35
 
40
36
  @dataclass(frozen=True)
41
37
  class DocumentFormat(CamelSnakeMixin):
@@ -106,21 +102,6 @@ def parse_include_condition(profile: RobotBaseProfile, root: Path) -> Optional[C
106
102
  return condition
107
103
 
108
104
 
109
- def markdown_language_definition(profile: RobotBaseProfile, root: Path) -> Optional[LanguageDefinition]:
110
- """The language of the Markdown files Robot Framework parses with the profile in the project `root`; `None` when
111
- no Markdown extension is active."""
112
- extensions = [f".{e}" for e in markdown_extensions(profile)]
113
- if not extensions:
114
- return None
115
-
116
- return LanguageDefinition(
117
- id=MARKDOWN_LANGUAGE_ID,
118
- extensions=extensions,
119
- extensions_ignore_case=True,
120
- file_condition=parse_include_condition(profile, root),
121
- )
122
-
123
-
124
105
  def is_markdown_file(path: Path) -> bool:
125
106
  """Whether Robot Framework reads the file with its Markdown parser, from its code blocks.
126
107
 
@@ -0,0 +1,39 @@
1
+ """The languages RobotCode serves: their ids and their language definitions."""
2
+
3
+ from pathlib import Path
4
+ from typing import Final, Optional
5
+
6
+ from robotcode.core.language import LanguageDefinition
7
+
8
+ from .config.model import RobotBaseProfile
9
+ from .document_formats import markdown_extensions, parse_include_condition
10
+
11
+ ROBOTFRAMEWORK_LANGUAGE_ID = "robotframework"
12
+
13
+ ROBOTFRAMEWORK_LANGUAGE = LanguageDefinition(
14
+ id=ROBOTFRAMEWORK_LANGUAGE_ID,
15
+ extensions=[".robot", ".resource"],
16
+ extensions_ignore_case=True,
17
+ aliases=["Robot Framework", "robotframework"],
18
+ )
19
+
20
+ # the language of the Markdown files Robot Framework parses; no editor sends it, the server detects it by file name
21
+ MARKDOWN_LANGUAGE_ID = "robotframework-markdown"
22
+
23
+ # the languages whose documents hold Robot Framework data
24
+ ROBOT_LANGUAGE_IDS: Final = (ROBOTFRAMEWORK_LANGUAGE_ID, MARKDOWN_LANGUAGE_ID)
25
+
26
+
27
+ def markdown_language_definition(profile: RobotBaseProfile, root: Path) -> Optional[LanguageDefinition]:
28
+ """The language of the Markdown files Robot Framework parses with the profile in the project `root`; `None` when
29
+ no Markdown extension is active."""
30
+ extensions = [f".{e}" for e in markdown_extensions(profile)]
31
+ if not extensions:
32
+ return None
33
+
34
+ return LanguageDefinition(
35
+ id=MARKDOWN_LANGUAGE_ID,
36
+ extensions=extensions,
37
+ extensions_ignore_case=True,
38
+ file_condition=parse_include_condition(profile, root),
39
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: robotcode-robot
3
- Version: 2.9.0-dev.197
3
+ Version: 2.9.0-dev.230
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
@@ -27,7 +27,7 @@ Classifier: Topic :: Utilities
27
27
  Classifier: Typing :: Typed
28
28
  Requires-Python: >=3.10
29
29
  Requires-Dist: platformdirs>=4.3
30
- Requires-Dist: robotcode-core==2.9.0-dev.197
30
+ Requires-Dist: robotcode-core==2.9.0-dev.230
31
31
  Requires-Dist: robotframework>=5.0.0
32
32
  Requires-Dist: tomli>=1.1.0; python_version < '3.11'
33
33
  Description-Content-Type: text/markdown
@@ -1,6 +1,7 @@
1
1
  robotcode/robot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- robotcode/robot/__version__.py,sha256=TuhAPY5tWcB-O8yUsip8A5BqXPAkWXdXI0Yu5xcu0h8,30
3
- robotcode/robot/document_formats.py,sha256=znJ9I-22HJqt_kdar2FJK8xkLatmNM9BiCpnbn3uyMA,5637
2
+ robotcode/robot/__version__.py,sha256=ywQBe3tPie4G6fmOEZtLhXB6uR6pzyY-tUvQqJnZ3Rs,30
3
+ robotcode/robot/document_formats.py,sha256=65dsIzcPkpnNd-WyhkSVSQbHdx6rI7kMq--8AvdDmuM,4842
4
+ robotcode/robot/language_definitions.py,sha256=actqkDp12a11whu2TfKZU3xGk7Hk29HYLDTfeKZ1kqE,1449
4
5
  robotcode/robot/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
5
6
  robotcode/robot/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
7
  robotcode/robot/config/loader.py,sha256=HLbkZem8JiBuy9Q5naghZddAuMPOn8Tk6UBgN2T3Uyc,9073
@@ -9,24 +10,24 @@ robotcode/robot/config/utils.py,sha256=A8gD5IItxuC7AY5Olcc8tmsSbqCCi_vZPVoK3BqWt
9
10
  robotcode/robot/diagnostics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
11
  robotcode/robot/diagnostics/analyzer_result.py,sha256=5pHW5Yf3C3rmaDvmM7tP0y_qwqLW3YHhkeVV-qDhxtg,1459
11
12
  robotcode/robot/diagnostics/data_cache.py,sha256=Yi52oQTUBFgcPK0UF3lDAj4mRFqoD_VOtrAUyRWXnrQ,18200
12
- robotcode/robot/diagnostics/diagnostic_rules.py,sha256=7b4vbGTEuxCef8AHTshV4XAJe75aR4-lJ5QEDyuZtcE,3558
13
+ robotcode/robot/diagnostics/diagnostic_rules.py,sha256=DAeCg65dhCxoKUKSkKqo7zcgZ-fr9RXyj5yB3KYVq2A,3855
13
14
  robotcode/robot/diagnostics/diagnostics_modifier.py,sha256=MftxJlUEDsn9ZiOsBDApXC2N-4OjXHSZj1Y9PXXlSAg,11742
14
- robotcode/robot/diagnostics/document_cache_helper.py,sha256=jUmINWlzBER83xydbopd4yT_Vrcp5FH198O3jblW7Ko,37151
15
+ robotcode/robot/diagnostics/document_cache_helper.py,sha256=GBpXlVqPTtLz6IpnZN6IJdkhIZorVDmse3yRuBQwLRY,37185
15
16
  robotcode/robot/diagnostics/entities.py,sha256=vE5szceIL-ANqJPnAbqIebg3kLddE9OPhxwBL9iKP-M,11949
16
17
  robotcode/robot/diagnostics/errors.py,sha256=lqHDWrMNy3ZhuEIVxeEhaU0ns8PB6pVTQBfaMqRQ8L4,2733
17
18
  robotcode/robot/diagnostics/import_resolver.py,sha256=DZjUOD3uNxFAwsVUqrCTRhColjz9DRPetAvIb_Ccufs,32588
18
- robotcode/robot/diagnostics/imports_manager.py,sha256=PoUEUp4ULZulW583RNxrrCT9bOhkZ1SzdBeExx9tu14,90475
19
+ robotcode/robot/diagnostics/imports_manager.py,sha256=F5tX-wVojpTitkN-IMhuLH0m1KF_95Lb5-eY6f37m7E,90458
19
20
  robotcode/robot/diagnostics/keyword_finder.py,sha256=nwTmjvhyu5H7HHzyk8gt-pny2K2xdH2qCNyKXwwXRnk,18998
20
- robotcode/robot/diagnostics/library_doc.py,sha256=glFn-FODQBRTXbM_4On2WAb7MwyTK5NvXpfyMDk-x8U,155212
21
+ robotcode/robot/diagnostics/library_doc.py,sha256=w-_JhQ2gsHjIFEHh9-02HVmSP-SKzGuT8AHw5DuE38c,155575
21
22
  robotcode/robot/diagnostics/model_helper.py,sha256=_ySXwerkK5xvjWa82T0DFy8jpxRzcaavTJiAHnk2lXQ,29740
22
23
  robotcode/robot/diagnostics/namespace.py,sha256=Rcmjk3V0vcY-DUkgjkRyuOdYXurKaTEqXJLc6efYrwY,35489
23
- robotcode/robot/diagnostics/namespace_analyzer.py,sha256=dGAEbbznPJlFBKN4dLkMDU7w9xc0mYdmRARvRS3Zlwg,104331
24
+ robotcode/robot/diagnostics/namespace_analyzer.py,sha256=oGO-Tz811whfiOTNoKudH8wPr0bbOwwefiquN0_XYh0,104253
24
25
  robotcode/robot/diagnostics/project_index.py,sha256=Oqs7kV279PixVS6rGeigPKXGJYGqJdTDmDBjU7ODDRA,11006
25
26
  robotcode/robot/diagnostics/scope_tree.py,sha256=UREHoFG7NWh6UTWxET1M5Jxz_XBjXaQJg1GUIYPctq0,8348
26
27
  robotcode/robot/diagnostics/variable_scope.py,sha256=bge49DM-1FfQYIeqK2DtBG7JAMm25mazZ_zjh0DoMmg,3096
27
28
  robotcode/robot/diagnostics/workspace_config.py,sha256=GlsR1VnUBHoLBvIZtUXkm1dBDFPT9qoiYZzwZlurmXM,3277
28
29
  robotcode/robot/diagnostics/semantic_analyzer/__init__.py,sha256=ObbJv-S8LDgkWKZtTZjISBodXxyoLdEiOjVYp5aYbT4,1689
29
- robotcode/robot/diagnostics/semantic_analyzer/analyzer.py,sha256=CkROVL_B3QsSULXkHkRDTddLCR0sswVVxEKCQUYk_qs,206149
30
+ robotcode/robot/diagnostics/semantic_analyzer/analyzer.py,sha256=E5CZg5pxAeVoxnelsEBVpRK9_wO3D9woUcvOZs88lVU,206071
30
31
  robotcode/robot/diagnostics/semantic_analyzer/enums.py,sha256=FIf3bHHqYY2etzpNrZTpZxGFsdtBE15lTssI1g8T2ro,8668
31
32
  robotcode/robot/diagnostics/semantic_analyzer/json_dump.py,sha256=2Yq3CLAKF5IEqKeFDoIYn-Ize_1Ucgz82ORkx3wAguY,13836
32
33
  robotcode/robot/diagnostics/semantic_analyzer/model.py,sha256=TTsrU_aDSC4JwbdypxSaGR79iCN071Y5VUMO8vGm5IE,20476
@@ -45,6 +46,6 @@ robotcode/robot/utils/robot_path.py,sha256=ObLP8PqamTZAz5oi0eDXE_dnyZwAPXp4TJYm6
45
46
  robotcode/robot/utils/stubs.py,sha256=umugZYAyneFNgqRJBRMJPzm0u0B_TH8Sx_y-ykXnxpw,351
46
47
  robotcode/robot/utils/variables.py,sha256=9WnP3QqcHdq-zioJ_gJXJobw_2Gcto_rGPCUGmOH9YQ,9829
47
48
  robotcode/robot/utils/visitor.py,sha256=nP3O0qh3YYuxR6S8wYJRBFfNwIVgsgohURBlrnFkRYQ,2299
48
- robotcode_robot-2.9.0.dev197.dist-info/METADATA,sha256=bNMPxcZsBM9n25Y_8XD3VLYE-CwbtdVIr53TCj5e7qk,2960
49
- robotcode_robot-2.9.0.dev197.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
50
- robotcode_robot-2.9.0.dev197.dist-info/RECORD,,
49
+ robotcode_robot-2.9.0.dev230.dist-info/METADATA,sha256=6SnTOV-IEhzdkXpCwk-QyVmsYJNdGhkw471Po77dmCY,2960
50
+ robotcode_robot-2.9.0.dev230.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
51
+ robotcode_robot-2.9.0.dev230.dist-info/RECORD,,