robotcode-robot 2.9.0.dev124__py3-none-any.whl → 2.9.0.dev180__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.124"
1
+ __version__ = "2.9.0-dev.180"
@@ -1162,14 +1162,16 @@ class KeywordDoc(SourceEntity):
1162
1162
  *,
1163
1163
  link_resolver: Optional[LinkResolver] = None,
1164
1164
  reference_targets: Optional[Mapping[str, ReferenceTarget]] = None,
1165
+ ascii_only: bool = False,
1165
1166
  ) -> str:
1167
+ """`ascii_only` marks the kinds of arguments as Libdoc does, for text written to a console."""
1166
1168
  result = ""
1167
1169
 
1168
1170
  # a library that renders all of its keywords builds the targets once
1169
1171
  targets = reference_targets if reference_targets is not None else self.get_reference_targets()
1170
1172
 
1171
1173
  if add_signature:
1172
- result += self._get_signature(header_level, add_type, link_resolver, targets)
1174
+ result += self._get_signature(header_level, add_type, link_resolver, targets, ascii_only=ascii_only)
1173
1175
 
1174
1176
  if self.doc:
1175
1177
  if result:
@@ -1258,11 +1260,14 @@ class KeywordDoc(SourceEntity):
1258
1260
  return first + "\n".join([lines[0], *(f" {line}" if line else "" for line in lines[1:])])
1259
1261
 
1260
1262
  @staticmethod
1261
- def _get_argument_prefix(argument: ArgumentInfo) -> str:
1263
+ def _get_argument_prefix(argument: ArgumentInfo, ascii_only: bool = False) -> str:
1262
1264
  if argument.kind == KeywordArgumentKind.VAR_POSITIONAL:
1263
1265
  return "*"
1264
1266
  if argument.kind == KeywordArgumentKind.VAR_NAMED:
1265
1267
  return "**"
1268
+ if ascii_only:
1269
+ # the `/` and `*` marker entries of the argument list show these kinds
1270
+ return ""
1266
1271
  if argument.kind == KeywordArgumentKind.NAMED_ONLY:
1267
1272
  return "🏷"
1268
1273
  if argument.kind == KeywordArgumentKind.POSITIONAL_ONLY:
@@ -1304,6 +1309,7 @@ class KeywordDoc(SourceEntity):
1304
1309
  link_resolver: Optional[LinkResolver] = None,
1305
1310
  targets: Optional[Mapping[str, ReferenceTarget]] = None,
1306
1311
  with_descriptions: bool = False,
1312
+ ascii_only: bool = False,
1307
1313
  ) -> str:
1308
1314
  """The arguments as a table; with descriptions, they get a fifth column."""
1309
1315
  result = "\n| | | | | |" if with_descriptions else "\n| | | | |"
@@ -1329,9 +1335,16 @@ class KeywordDoc(SourceEntity):
1329
1335
  return f"{cells} {description} |" if with_descriptions else cells
1330
1336
 
1331
1337
  for a in arguments:
1338
+ if a.kind in [KeywordArgumentKind.NAMED_ONLY_MARKER, KeywordArgumentKind.POSITIONAL_ONLY_MARKER]:
1339
+ result += row(a.str_repr, (), None, None, "")
1340
+ continue
1332
1341
  description = self._description_cell(a.doc, link_resolver, targets) if with_descriptions and a.doc else ""
1333
1342
  result += row(
1334
- f"{self._get_argument_prefix(a)}{a.name!s}", a.types or (), a.type_docs, a.default_value, description
1343
+ f"{self._get_argument_prefix(a, ascii_only)}{a.name!s}",
1344
+ a.types or (),
1345
+ a.type_docs,
1346
+ a.default_value,
1347
+ description,
1335
1348
  )
1336
1349
  if with_descriptions:
1337
1350
  # names the documentation describes without being arguments, like ones taken by `**kwargs`
@@ -1345,6 +1358,8 @@ class KeywordDoc(SourceEntity):
1345
1358
  add_type: bool = True,
1346
1359
  link_resolver: Optional[LinkResolver] = None,
1347
1360
  targets: Optional[Mapping[str, ReferenceTarget]] = None,
1361
+ *,
1362
+ ascii_only: bool = False,
1348
1363
  ) -> str:
1349
1364
  if add_type:
1350
1365
  result = (
@@ -1358,17 +1373,21 @@ class KeywordDoc(SourceEntity):
1358
1373
  else:
1359
1374
  result = ""
1360
1375
 
1376
+ # on the console, the `/` and `*` markers stand in the table as in Libdoc's signature
1361
1377
  arguments = [
1362
1378
  a
1363
1379
  for a in self.arguments
1364
- if a.kind not in [KeywordArgumentKind.NAMED_ONLY_MARKER, KeywordArgumentKind.POSITIONAL_ONLY_MARKER]
1380
+ if ascii_only
1381
+ or a.kind not in [KeywordArgumentKind.NAMED_ONLY_MARKER, KeywordArgumentKind.POSITIONAL_ONLY_MARKER]
1365
1382
  ]
1366
1383
  has_descriptions = any(a.doc for a in arguments) or bool(self.extra_argument_docs)
1367
1384
 
1368
1385
  if self.arguments or has_descriptions:
1369
1386
  result += f"\n##{'#' * header_level} Arguments: \n"
1370
1387
 
1371
- result += self._get_argument_table(arguments, link_resolver, targets, with_descriptions=has_descriptions)
1388
+ result += self._get_argument_table(
1389
+ arguments, link_resolver, targets, with_descriptions=has_descriptions, ascii_only=ascii_only
1390
+ )
1372
1391
 
1373
1392
  if self.return_type:
1374
1393
  if result:
@@ -1378,7 +1397,8 @@ class KeywordDoc(SourceEntity):
1378
1397
  f"**Return Type**: {_type_markdown(self.return_type, self.return_type_docs, link_resolver, False)}"
1379
1398
  )
1380
1399
  if self.return_doc:
1381
- result += f" — {self._format_description(self.return_doc, link_resolver, targets)}"
1400
+ dash = " - " if ascii_only else " — "
1401
+ result += f"{dash}{self._format_description(self.return_doc, link_resolver, targets)}"
1382
1402
  result += "\n"
1383
1403
  elif self.return_doc:
1384
1404
  if result:
@@ -1420,7 +1440,10 @@ class KeywordDoc(SourceEntity):
1420
1440
  + ")"
1421
1441
  )
1422
1442
 
1423
- def parameter_signature(self, full_signatures: Optional[Sequence[int]] = None) -> str:
1443
+ def parameter_signature(self, full_signatures: Optional[Sequence[int]] = None, *, ascii_only: bool = False) -> str:
1444
+ if ascii_only:
1445
+ # Libdoc's signature: `table, /, column, *names, limit: int = 10, **options`
1446
+ return "(" + ", ".join(a.str_repr for a in self.arguments) + ")"
1424
1447
  return (
1425
1448
  "("
1426
1449
  + ", ".join(
@@ -1882,9 +1905,10 @@ class LibraryDoc:
1882
1905
  header_level: int = 2,
1883
1906
  *,
1884
1907
  link_resolver: Optional[LinkResolver] = None,
1908
+ ascii_only: bool = False,
1885
1909
  ) -> str:
1886
1910
  if not only_doc:
1887
- return self._page_to_markdown(header_level, link_resolver)
1911
+ return self._page_to_markdown(header_level, link_resolver, ascii_only=ascii_only)
1888
1912
 
1889
1913
  with io.StringIO(newline="\n") as result:
1890
1914
 
@@ -1901,7 +1925,10 @@ class LibraryDoc:
1901
1925
  if add_signature and any(v for v in self.inits.values() if v.arguments):
1902
1926
  for i in self.inits.values():
1903
1927
  init_markdown = i.to_markdown(
1904
- header_level=header_level, link_resolver=link_resolver, reference_targets=targets
1928
+ header_level=header_level,
1929
+ link_resolver=link_resolver,
1930
+ reference_targets=targets,
1931
+ ascii_only=ascii_only,
1905
1932
  )
1906
1933
  write_lines(init_markdown, "", "---")
1907
1934
 
@@ -1978,9 +2005,11 @@ class LibraryDoc:
1978
2005
 
1979
2006
  return keyword_anchors, {t.name: anchor for t, anchor in zip(page_types, type_anchors) if anchor}
1980
2007
 
1981
- def _page_to_markdown(self, header_level: int, link_resolver: Optional[LinkResolver]) -> str:
2008
+ def _page_to_markdown(
2009
+ self, header_level: int, link_resolver: Optional[LinkResolver], *, ascii_only: bool = False
2010
+ ) -> str:
1982
2011
  """The full page of `robotcode doc lib`, the REPL's `.doc` and the documentation view."""
1983
- head, keywords, tail = self._get_page_parts(header_level, link_resolver)
2012
+ head, keywords, tail = self._get_page_parts(header_level, link_resolver, ascii_only=ascii_only)
1984
2013
 
1985
2014
  # Only the assembled page knows its headings: an anchor can carry a number, and a
1986
2015
  # private keyword or a section the page leaves out has no heading at all.
@@ -2012,7 +2041,7 @@ class LibraryDoc:
2012
2041
  anchor = anchors.get(normalize_reference(name))
2013
2042
  return f"#{anchor}" if anchor is not None else None
2014
2043
 
2015
- head, keywords, tail = self._get_page_parts(header_level, resolver)
2044
+ head, keywords, tail = self._get_page_parts(header_level, resolver, ascii_only=ascii_only)
2016
2045
 
2017
2046
  page = head + keywords + tail
2018
2047
  if keywords:
@@ -2029,7 +2058,9 @@ class LibraryDoc:
2029
2058
 
2030
2059
  return f"{page.rstrip()}\n"
2031
2060
 
2032
- def _get_page_parts(self, header_level: int, link_resolver: Optional[LinkResolver]) -> Tuple[str, str, str]:
2061
+ def _get_page_parts(
2062
+ self, header_level: int, link_resolver: Optional[LinkResolver], *, ascii_only: bool = False
2063
+ ) -> Tuple[str, str, str]:
2033
2064
  """The page up to the keyword entries, the keyword entries, and the rest of the page."""
2034
2065
  targets = self.get_reference_targets()
2035
2066
  separator = "\n\n---\n\n"
@@ -2046,7 +2077,9 @@ class LibraryDoc:
2046
2077
  if any(v for v in self.inits.values() if v.arguments):
2047
2078
  head = f"{head.rstrip()}{separator}##{'#' * header_level} Importing\n\n"
2048
2079
  head += separator.join(
2049
- unique_reference_labels(self._get_page_entry(kw, header_level, link_resolver, targets), labels)
2080
+ unique_reference_labels(
2081
+ self._get_page_entry(kw, header_level, link_resolver, targets, ascii_only), labels
2082
+ )
2050
2083
  for kw in self.inits.values()
2051
2084
  )
2052
2085
 
@@ -2055,7 +2088,9 @@ class LibraryDoc:
2055
2088
  if page_keywords:
2056
2089
  head = f"{head.rstrip()}{separator}##{'#' * header_level} Keywords\n\n"
2057
2090
  keywords = separator.join(
2058
- unique_reference_labels(self._get_page_entry(kw, header_level, link_resolver, targets), labels)
2091
+ unique_reference_labels(
2092
+ self._get_page_entry(kw, header_level, link_resolver, targets, ascii_only), labels
2093
+ )
2059
2094
  for kw in page_keywords
2060
2095
  )
2061
2096
 
@@ -2104,6 +2139,7 @@ class LibraryDoc:
2104
2139
  header_level: int,
2105
2140
  link_resolver: Optional[LinkResolver],
2106
2141
  targets: Mapping[str, ReferenceTarget],
2142
+ ascii_only: bool = False,
2107
2143
  ) -> str:
2108
2144
  return kw.to_markdown(
2109
2145
  header_level=header_level + 2,
@@ -2112,6 +2148,7 @@ class LibraryDoc:
2112
2148
  modify_doc_handler=_page_heading_shift(kw.doc_format, header_level + 3),
2113
2149
  link_resolver=link_resolver,
2114
2150
  reference_targets=targets,
2151
+ ascii_only=ascii_only,
2115
2152
  ).strip()
2116
2153
 
2117
2154
  @property
@@ -2192,9 +2229,10 @@ class VariablesDoc(LibraryDoc):
2192
2229
  header_level: int = 2,
2193
2230
  *,
2194
2231
  link_resolver: Optional[LinkResolver] = None,
2232
+ ascii_only: bool = False,
2195
2233
  ) -> str:
2196
2234
  result = super(VariablesDoc, self).to_markdown(
2197
- add_signature, only_doc, header_level, link_resolver=link_resolver
2235
+ add_signature, only_doc, header_level, link_resolver=link_resolver, ascii_only=ascii_only
2198
2236
  )
2199
2237
 
2200
2238
  if self.variables:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: robotcode-robot
3
- Version: 2.9.0-dev.124
3
+ Version: 2.9.0-dev.180
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.124
30
+ Requires-Dist: robotcode-core==2.9.0-dev.180
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,5 +1,5 @@
1
1
  robotcode/robot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- robotcode/robot/__version__.py,sha256=kB2HCucrVBrLij9hB2UXa9rwCOmEfmeDk12kUWayuAU,30
2
+ robotcode/robot/__version__.py,sha256=39yWLbn8Xd-rhIKA3f_deOqSMNKc9u8vdFKv8xFpYNk,30
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=HLbkZem8JiBuy9Q5naghZddAuMPOn8Tk6UBgN2T3Uyc,9073
@@ -16,7 +16,7 @@ robotcode/robot/diagnostics/errors.py,sha256=lqHDWrMNy3ZhuEIVxeEhaU0ns8PB6pVTQBf
16
16
  robotcode/robot/diagnostics/import_resolver.py,sha256=DZjUOD3uNxFAwsVUqrCTRhColjz9DRPetAvIb_Ccufs,32588
17
17
  robotcode/robot/diagnostics/imports_manager.py,sha256=opemApuCLgPNsnqVuYc9MefqHt42g_7Ozqhrmu_osH0,90401
18
18
  robotcode/robot/diagnostics/keyword_finder.py,sha256=nwTmjvhyu5H7HHzyk8gt-pny2K2xdH2qCNyKXwwXRnk,18998
19
- robotcode/robot/diagnostics/library_doc.py,sha256=loLZ7cJjtrNn6YXv_lC8SmptfIUK7P5Hkdc782opN9k,153586
19
+ robotcode/robot/diagnostics/library_doc.py,sha256=glFn-FODQBRTXbM_4On2WAb7MwyTK5NvXpfyMDk-x8U,155212
20
20
  robotcode/robot/diagnostics/model_helper.py,sha256=_ySXwerkK5xvjWa82T0DFy8jpxRzcaavTJiAHnk2lXQ,29740
21
21
  robotcode/robot/diagnostics/namespace.py,sha256=Rcmjk3V0vcY-DUkgjkRyuOdYXurKaTEqXJLc6efYrwY,35489
22
22
  robotcode/robot/diagnostics/namespace_analyzer.py,sha256=dGAEbbznPJlFBKN4dLkMDU7w9xc0mYdmRARvRS3Zlwg,104331
@@ -43,6 +43,6 @@ robotcode/robot/utils/robot_path.py,sha256=ObLP8PqamTZAz5oi0eDXE_dnyZwAPXp4TJYm6
43
43
  robotcode/robot/utils/stubs.py,sha256=umugZYAyneFNgqRJBRMJPzm0u0B_TH8Sx_y-ykXnxpw,351
44
44
  robotcode/robot/utils/variables.py,sha256=9WnP3QqcHdq-zioJ_gJXJobw_2Gcto_rGPCUGmOH9YQ,9829
45
45
  robotcode/robot/utils/visitor.py,sha256=nP3O0qh3YYuxR6S8wYJRBFfNwIVgsgohURBlrnFkRYQ,2299
46
- robotcode_robot-2.9.0.dev124.dist-info/METADATA,sha256=cmy8fBqH5dS-DWv3D33XiFGSB7EF97b0iqoDFDH4xOw,2960
47
- robotcode_robot-2.9.0.dev124.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
48
- robotcode_robot-2.9.0.dev124.dist-info/RECORD,,
46
+ robotcode_robot-2.9.0.dev180.dist-info/METADATA,sha256=zyDDz9T9S1Y0Beg7ZWEOo13jsM8-IZo7QC1c8nlCVZM,2960
47
+ robotcode_robot-2.9.0.dev180.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
48
+ robotcode_robot-2.9.0.dev180.dist-info/RECORD,,