robotcode-plugin 2.6.2__py3-none-any.whl → 2.8.0.dev548__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.
@@ -136,6 +136,7 @@ def _get_deep_markdown_cls() -> "type[Markdown]":
136
136
  TableHeaderElement,
137
137
  TableRowElement,
138
138
  )
139
+ from rich.segment import Segment
139
140
  from rich.text import Text
140
141
 
141
142
  class LeftHeading(Heading):
@@ -196,6 +197,25 @@ def _get_deep_markdown_cls() -> "type[Markdown]":
196
197
  parser.options.maxNesting = 1000
197
198
  self.parsed = parser.parse(markup)
198
199
 
200
+ def __rich_console__(self, console: Console, options: ConsoleOptions) -> RenderResult:
201
+ # rich pads every line with spaces to the full console width. A
202
+ # pager that reserves columns (bat's line numbers and grid) wraps
203
+ # those full-width lines, and every wrapped remainder shows up
204
+ # as an empty line. Drop the padding unless it carries a
205
+ # background colour (code blocks draw a box with it).
206
+ for line in Segment.split_lines(cast(Iterable[Segment], super().__rich_console__(console, options))):
207
+ while line and not line[-1].control:
208
+ text, style, _ = line[-1]
209
+ if style is not None and style.bgcolor is not None:
210
+ break
211
+ text = text.rstrip(" ")
212
+ if text:
213
+ line[-1] = Segment(text, style)
214
+ break
215
+ line.pop()
216
+ yield from line
217
+ yield Segment.line()
218
+
199
219
  _deep_markdown_cls = DeepMarkdown
200
220
  return DeepMarkdown
201
221
 
@@ -341,7 +361,7 @@ class Application:
341
361
  if dataclasses.is_dataclass(data)
342
362
  else data
343
363
  if isinstance(data, dict)
344
- else {data: data}
364
+ else {"data": data}
345
365
  )
346
366
 
347
367
  if text is None:
@@ -349,7 +369,7 @@ class Application:
349
369
  text = as_json(
350
370
  data,
351
371
  indent=format == OutputFormat.JSON_INDENT,
352
- compact=format == OutputFormat.TEXT,
372
+ compact=format == OutputFormat.JSON,
353
373
  )
354
374
  else:
355
375
  text = str(data)
@@ -1 +1 @@
1
- __version__ = "2.6.2"
1
+ __version__ = "2.8.0-dev.548"
@@ -0,0 +1,21 @@
1
+ import click
2
+
3
+ _ROBOT_EXIT_CODES_ATTR = "__robotcode_robot_exit_codes__"
4
+
5
+
6
+ def robot_exit_codes(cmd: click.Command) -> click.Command:
7
+ """Mark a CLI command that passes on the exit code of a Robot Framework tool.
8
+
9
+ Such a command answers with Robot Framework's exit codes, like the `wrappable`
10
+ commands that run Robot Framework, so an error robotcode reports itself for it
11
+ exits with Robot Framework's 252 instead of Click's 1 or 2. Mark the commands
12
+ that pass on a tool's exit code without running tests - rebot, libdoc,
13
+ testdoc; `wrappable` commands are covered already.
14
+ """
15
+ setattr(cmd, _ROBOT_EXIT_CODES_ATTR, True)
16
+ return cmd
17
+
18
+
19
+ def has_robot_exit_codes(cmd: click.Command) -> bool:
20
+ """Return whether `cmd` was marked with :func:`robot_exit_codes`."""
21
+ return bool(getattr(cmd, _ROBOT_EXIT_CODES_ATTR, False))
@@ -0,0 +1,26 @@
1
+ import click
2
+
3
+ # Set in the environment once a wrapper has been applied to the process tree.
4
+ # Prevents infinite re-exec recursion and lets an outer layer (e.g. the VS Code
5
+ # debug launcher applying its own wrapper) suppress the CLI/profile re-exec.
6
+ WRAPPER_APPLIED_ENV = "ROBOTCODE_WRAPPER_APPLIED"
7
+
8
+ _WRAPPABLE_ATTR = "__robotcode_wrappable__"
9
+
10
+
11
+ def wrappable(cmd: click.Command) -> click.Command:
12
+ """Mark a CLI command as *wrappable*.
13
+
14
+ When a `wrapper` (session) command is configured, a wrappable command is
15
+ re-executed through it, because it executes Robot Framework (and may, for
16
+ example, need to run inside a specific X11/Wayland session). Commands that
17
+ do not execute Robot Framework - language server, discovery, libdoc, … -
18
+ must NOT be marked.
19
+ """
20
+ setattr(cmd, _WRAPPABLE_ATTR, True)
21
+ return cmd
22
+
23
+
24
+ def is_wrappable(cmd: click.Command) -> bool:
25
+ """Return whether `cmd` was marked with :func:`wrappable`."""
26
+ return bool(getattr(cmd, _WRAPPABLE_ATTR, False))
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: robotcode-plugin
3
- Version: 2.6.2
3
+ Version: 2.8.0-dev.548
4
4
  Summary: Some classes for RobotCode plugin management
5
5
  Project-URL: Donate, https://opencollective.com/robotcode
6
6
  Project-URL: Documentation, https://github.com/robotcodedev/robotcode#readme
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3.13
21
21
  Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Programming Language :: Python :: 3.15
22
23
  Classifier: Programming Language :: Python :: Implementation :: CPython
23
24
  Classifier: Programming Language :: Python :: Implementation :: PyPy
24
25
  Classifier: Topic :: Utilities
@@ -1,12 +1,14 @@
1
- robotcode/plugin/__init__.py,sha256=DDk7J1ulkuIOzqIC41ATau9sbe7zbTkJHSG0G8OvMTM,16308
2
- robotcode/plugin/__version__.py,sha256=53Sii4w6BIWn-1RhaTyqUO46gDe4nDCRQDAcpsWFH24,22
1
+ robotcode/plugin/__init__.py,sha256=GZc3LUHnoIcvYlSZjS1zA1SV0p1WY4GWwkN89QVIKgw,17381
2
+ robotcode/plugin/__version__.py,sha256=4qGR5Sg7VszfoERVpnszHJ_tsWJ0G_bUZdheH0_dqx4,30
3
3
  robotcode/plugin/_agent_detection.py,sha256=PVsBAxy_Xn_uefTBpBAGE-q3Z5CUxbhwp_z4Dcb_RL4,3606
4
4
  robotcode/plugin/manager.py,sha256=ARNXtSbQTRktsbNQGLeU1fwtsK7GdstHa6OJaXuadrU,1098
5
5
  robotcode/plugin/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
6
6
  robotcode/plugin/specs.py,sha256=_Ws6A9CZoCTHdxx_5D8ifpj4tfwin4zYUYJ8WLhSO3U,588
7
7
  robotcode/plugin/click_helper/aliases.py,sha256=NJZKyF6GOro52fjp728OZfqZ9EptNhiJvQBhunqIpzc,1628
8
+ robotcode/plugin/click_helper/exit_codes.py,sha256=k5ih_20gKkuEWpOhyig2_g11ZywrjPoiZHzH9pV2obs,854
8
9
  robotcode/plugin/click_helper/options.py,sha256=eAU05TfOq93wVWkiYqw7BV6RrXAp1xw9jT6DsPRdZ_Y,11430
9
10
  robotcode/plugin/click_helper/types.py,sha256=UAno_G-0uNdPfapGCvECwd0yghdEZXMMv4DIlUAKKsw,3679
10
- robotcode_plugin-2.6.2.dist-info/METADATA,sha256=R3dATBSKmbp3TdQE-4MoyPrzN42_oj5kxDZHgwtow50,2785
11
- robotcode_plugin-2.6.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
12
- robotcode_plugin-2.6.2.dist-info/RECORD,,
11
+ robotcode/plugin/click_helper/wrappable.py,sha256=28FzkR4OO5lSi3_e35AKKZHQD2fD7Dr1DM4xkI_PrPg,1009
12
+ robotcode_plugin-2.8.0.dev548.dist-info/METADATA,sha256=I1KfPhinm-ysupKV7ESunfG_7RAfKIsS4qhTkQw3668,2844
13
+ robotcode_plugin-2.8.0.dev548.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
14
+ robotcode_plugin-2.8.0.dev548.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.30.1
2
+ Generator: hatchling 1.32.4
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any