robotcode 0.91.0__py3-none-any.whl → 0.92.0__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.
robotcode/cli/__init__.py CHANGED
@@ -240,9 +240,8 @@ def robotcode(
240
240
  robotcode.add_command(config)
241
241
  robotcode.add_command(profiles)
242
242
 
243
- for p in PluginManager().cli_commands:
244
- for c in p:
245
- robotcode.add_command(c)
243
+ for c in PluginManager.instance().cli_commands:
244
+ robotcode.add_command(c)
246
245
 
247
246
 
248
247
  @robotcode.command()
@@ -1 +1 @@
1
- __version__ = "0.91.0"
1
+ __version__ = "0.92.0"
@@ -2,7 +2,7 @@ import dataclasses
2
2
  import os
3
3
  from fnmatch import fnmatchcase
4
4
  from pathlib import Path
5
- from typing import Any, Dict, List, Optional
5
+ from typing import Any, Callable, Dict, Iterable, List, Optional, Type, Union, get_args, get_origin
6
6
 
7
7
  import click
8
8
 
@@ -20,11 +20,9 @@ from robotcode.robot.config.loader import (
20
20
  load_robot_config_from_path,
21
21
  )
22
22
  from robotcode.robot.config.model import (
23
- LibDocProfile,
24
- RebotProfile,
23
+ BaseOptions,
25
24
  RobotConfig,
26
25
  RobotProfile,
27
- TestDocProfile,
28
26
  )
29
27
  from robotcode.robot.config.utils import get_config_files
30
28
 
@@ -70,7 +68,11 @@ def show(app: Application, single: bool, paths: List[Path]) -> None:
70
68
 
71
69
  if single:
72
70
  for file, _ in config_files:
73
- config = load_robot_config_from_path(file)
71
+ config = load_robot_config_from_path(
72
+ file,
73
+ extra_tools={k: v for k, v in PluginManager.instance().tool_config_classes},
74
+ verbose_callback=app.verbose,
75
+ )
74
76
  click.secho(f"File: {file}")
75
77
  app.print_data(
76
78
  config,
@@ -80,7 +82,11 @@ def show(app: Application, single: bool, paths: List[Path]) -> None:
80
82
 
81
83
  return
82
84
 
83
- config = load_robot_config_from_path(*config_files)
85
+ config = load_robot_config_from_path(
86
+ *config_files,
87
+ extra_tools={k: v for k, v in PluginManager.instance().tool_config_classes},
88
+ verbose_callback=app.verbose,
89
+ )
84
90
 
85
91
  app.print_data(
86
92
  config,
@@ -193,55 +199,51 @@ def info(app: Application) -> None:
193
199
  """Shows informations about possible configuration settings."""
194
200
 
195
201
 
196
- def get_config_fields() -> Dict[str, Dict[str, str]]:
197
- result = {}
198
- for field in dataclasses.fields(RobotConfig):
199
- field_name_encoded = encode_case_for_field_name(RobotConfig, field)
200
- result[field_name_encoded] = {
201
- "type": str(field.type),
202
- "description": field.metadata.get("description", "").strip(),
203
- }
202
+ def type_to_str(t: Union[Type[Any], str]) -> str:
203
+ if isinstance(t, str):
204
+ return f"'{t}'"
204
205
 
205
- for field in dataclasses.fields(RobotProfile):
206
- field_name_encoded = encode_case_for_field_name(RobotProfile, field)
207
- if field_name_encoded in result:
206
+ origin = get_origin(t)
207
+ if origin is None:
208
+ return t.__name__
209
+
210
+ if origin is Union:
211
+ return " | ".join(type_to_str(a) for a in get_args(t))
212
+
213
+ return f"{origin.__name__}[{', '.join(type_to_str(a) for a in get_args(t))}]"
214
+
215
+
216
+ def _get_config_fields_for_type(
217
+ prefix: str, cls: Type[Any], filter: Optional[Callable[[str], bool]] = None
218
+ ) -> Dict[str, Dict[str, str]]:
219
+ result = {}
220
+ for field in dataclasses.fields(cls):
221
+ field_name_encoded = encode_case_for_field_name(cls, field)
222
+ if filter and not filter(field_name_encoded):
208
223
  continue
209
224
 
210
- result["[profile]." + field_name_encoded] = {
211
- "type": str(field.type),
225
+ result[prefix + field_name_encoded] = {
226
+ "type": type_to_str(field.type),
212
227
  "description": field.metadata.get("description", "").strip(),
213
228
  }
229
+ args = get_args(field.type)
214
230
 
215
- for field in dataclasses.fields(RebotProfile):
216
- field_name_encoded = encode_case_for_field_name(RebotProfile, field)
217
- result["rebot." + field_name_encoded] = {
218
- "type": str(field.type),
219
- "description": field.metadata.get("description", "").strip(),
220
- }
231
+ p = f"{prefix}{'' if prefix[-1]=='.' else '.'}" if prefix else ""
232
+ for a in args:
233
+ origin = get_origin(a)
234
+ if origin is None and issubclass(a, BaseOptions):
235
+ result.update(_get_config_fields_for_type(f"{p}{field_name_encoded}.", a, filter))
236
+ return result
221
237
 
222
- for field in dataclasses.fields(LibDocProfile):
223
- field_name_encoded = encode_case_for_field_name(LibDocProfile, field)
224
- result["libdoc." + field_name_encoded] = {
225
- "type": str(field.type),
226
- "description": field.metadata.get("description", "").strip(),
227
- }
228
238
 
229
- for field in dataclasses.fields(TestDocProfile):
230
- field_name_encoded = encode_case_for_field_name(TestDocProfile, field)
231
- result["testdoc." + field_name_encoded] = {
232
- "type": str(field.type),
233
- "description": field.metadata.get("description", "").strip(),
234
- }
239
+ def get_config_fields() -> Dict[str, Dict[str, str]]:
240
+ result = {}
241
+ result.update(_get_config_fields_for_type("", RobotConfig))
235
242
 
236
- for entry in PluginManager().config_classes:
237
- for s, cls in entry:
238
- if dataclasses.is_dataclass(cls):
239
- for field in dataclasses.fields(cls):
240
- field_name_encoded = encode_case_for_field_name(TestDocProfile, field)
241
- result[f"{s}." + field_name_encoded] = {
242
- "type": str(field.type),
243
- "description": field.metadata.get("description", "").strip(),
244
- }
243
+ result.update(_get_config_fields_for_type("[profile].", RobotProfile, lambda x: x not in result))
244
+ for entry in PluginManager.instance().tool_config_classes:
245
+ if dataclasses.is_dataclass(entry.config_class):
246
+ result.update(_get_config_fields_for_type(f"tool.{entry.tool_name}.", entry.config_class))
245
247
 
246
248
  return {k: v for k, v in sorted(result.items(), key=lambda item: item[0])}
247
249
 
@@ -275,7 +277,15 @@ def list(app: Application, name: Optional[List[str]] = None) -> None:
275
277
  result.append(field)
276
278
 
277
279
  if app.config.output_format is None or app.config.output_format == OutputFormat.TEXT:
278
- app.echo_via_pager(os.linesep.join(result))
280
+
281
+ def output() -> Iterable[str]:
282
+ for r in result:
283
+ yield r + os.linesep
284
+
285
+ yield os.linesep
286
+ yield f"Total: {len(result)}"
287
+
288
+ app.echo_via_pager(output())
279
289
  else:
280
290
  app.print_data({"names": result})
281
291
 
@@ -42,7 +42,7 @@ def show(app: Application, no_evaluate: bool, paths: List[Path]) -> None:
42
42
  try:
43
43
  config_files, _, _ = get_config_files(paths, app.config.config_files, verbose_callback=app.verbose)
44
44
 
45
- config = load_robot_config_from_path(*config_files).combine_profiles(
45
+ config = load_robot_config_from_path(*config_files, verbose_callback=app.verbose).combine_profiles(
46
46
  *(app.config.profiles or []), verbose_callback=app.verbose, error_callback=app.error
47
47
  )
48
48
 
@@ -75,7 +75,7 @@ def list(app: Application, paths: List[Path], show_hidden: bool = False, sort_by
75
75
  try:
76
76
  config_files, _, discovered_by = get_config_files(paths, app.config.config_files, verbose_callback=app.verbose)
77
77
 
78
- config = load_robot_config_from_path(*config_files)
78
+ config = load_robot_config_from_path(*config_files, verbose_callback=app.verbose)
79
79
 
80
80
  _, selected_profiles, enabled_names = config.combine_profiles_ex(
81
81
  *(app.config.profiles or []), verbose_callback=app.verbose, error_callback=app.error
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: robotcode
3
- Version: 0.91.0
3
+ Version: 0.92.0
4
4
  Summary: Command line interface for RobotCode
5
5
  Project-URL: Homepage, https://robotcode.io
6
6
  Project-URL: Donate, https://opencollective.com/robotcode
@@ -33,33 +33,33 @@ Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
33
33
  Classifier: Topic :: Utilities
34
34
  Classifier: Typing :: Typed
35
35
  Requires-Python: >=3.8
36
- Requires-Dist: robotcode-core==0.91.0
37
- Requires-Dist: robotcode-plugin==0.91.0
38
- Requires-Dist: robotcode-robot==0.91.0
36
+ Requires-Dist: robotcode-core==0.92.0
37
+ Requires-Dist: robotcode-plugin==0.92.0
38
+ Requires-Dist: robotcode-robot==0.92.0
39
39
  Provides-Extra: all
40
40
  Requires-Dist: docutils; extra == 'all'
41
41
  Requires-Dist: pyyaml>=5.4; extra == 'all'
42
42
  Requires-Dist: rich; extra == 'all'
43
- Requires-Dist: robotcode-analyze==0.91.0; extra == 'all'
44
- Requires-Dist: robotcode-debugger==0.91.0; extra == 'all'
45
- Requires-Dist: robotcode-language-server==0.91.0; extra == 'all'
46
- Requires-Dist: robotcode-runner==0.91.0; extra == 'all'
43
+ Requires-Dist: robotcode-analyze==0.92.0; extra == 'all'
44
+ Requires-Dist: robotcode-debugger==0.92.0; extra == 'all'
45
+ Requires-Dist: robotcode-language-server==0.92.0; extra == 'all'
46
+ Requires-Dist: robotcode-runner==0.92.0; extra == 'all'
47
47
  Requires-Dist: robotframework-robocop>=2.0.0; extra == 'all'
48
48
  Requires-Dist: robotframework-tidy>=2.0.0; extra == 'all'
49
49
  Provides-Extra: analyze
50
- Requires-Dist: robotcode-analyze==0.91.0; extra == 'analyze'
50
+ Requires-Dist: robotcode-analyze==0.92.0; extra == 'analyze'
51
51
  Provides-Extra: colored
52
52
  Requires-Dist: rich; extra == 'colored'
53
53
  Provides-Extra: debugger
54
- Requires-Dist: robotcode-debugger==0.91.0; extra == 'debugger'
54
+ Requires-Dist: robotcode-debugger==0.92.0; extra == 'debugger'
55
55
  Provides-Extra: languageserver
56
- Requires-Dist: robotcode-language-server==0.91.0; extra == 'languageserver'
56
+ Requires-Dist: robotcode-language-server==0.92.0; extra == 'languageserver'
57
57
  Provides-Extra: lint
58
58
  Requires-Dist: robotframework-robocop>=2.0.0; extra == 'lint'
59
59
  Provides-Extra: rest
60
60
  Requires-Dist: docutils; extra == 'rest'
61
61
  Provides-Extra: runner
62
- Requires-Dist: robotcode-runner==0.91.0; extra == 'runner'
62
+ Requires-Dist: robotcode-runner==0.92.0; extra == 'runner'
63
63
  Provides-Extra: tidy
64
64
  Requires-Dist: robotframework-tidy>=2.0.0; extra == 'tidy'
65
65
  Provides-Extra: yaml
@@ -0,0 +1,12 @@
1
+ robotcode/cli/__init__.py,sha256=L68nprRGdjQ27LvEfmg3QcrJXI74mMh8ccrwiA7U1DQ,7104
2
+ robotcode/cli/__main__.py,sha256=hX3nwROMTnsYGT1KS0rXUYrslu9sFzctYdAh66Rcckw,153
3
+ robotcode/cli/__version__.py,sha256=4oQqdZ-jW338RGQfLxI7hoQNb8tTR6y4hzWoJRPdI3o,23
4
+ robotcode/cli/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
5
+ robotcode/cli/commands/__init__.py,sha256=XJHRt_YwMO2Ni2EfL2aj4jkJXMVG6NGFTpzvSVgIRnQ,92
6
+ robotcode/cli/commands/config.py,sha256=Y8MmRDn0VVxC0T7GulK46bFKWXin3nm-aAtEH8b4tyM,10145
7
+ robotcode/cli/commands/profiles.py,sha256=NJ4bjKsvKHXQr1ILjB1H4mZYRgvwXyDKAtCpfSV6lYM,5720
8
+ robotcode-0.92.0.dist-info/METADATA,sha256=hNxnVnUbMTFkONZMYcFf_AaPh__RDWw9IpmNadm3MPY,6628
9
+ robotcode-0.92.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
10
+ robotcode-0.92.0.dist-info/entry_points.txt,sha256=Pb4DKVVdJb5PboVl48njwk3DkKQHBJOL1A8KkpemqA8,58
11
+ robotcode-0.92.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
12
+ robotcode-0.92.0.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- robotcode/cli/__init__.py,sha256=6c-evRLgJ0NR08YvynBQzKxAesAbXB0fnrzZ7MvBDM0,7115
2
- robotcode/cli/__main__.py,sha256=hX3nwROMTnsYGT1KS0rXUYrslu9sFzctYdAh66Rcckw,153
3
- robotcode/cli/__version__.py,sha256=RBon26SFk4Bs08h0XAmTYW8lrYs3N9ihifF9r6VT4Vc,23
4
- robotcode/cli/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
5
- robotcode/cli/commands/__init__.py,sha256=XJHRt_YwMO2Ni2EfL2aj4jkJXMVG6NGFTpzvSVgIRnQ,92
6
- robotcode/cli/commands/config.py,sha256=fCXhxsotQJl3vMSWpCEM-zwV-tST7sZBH7T-5v9j5EU,10061
7
- robotcode/cli/commands/profiles.py,sha256=HUCsNMaK75AVSG_A6F1I209xtQH2AICaoLcqpIO7Vjs,5660
8
- robotcode-0.91.0.dist-info/METADATA,sha256=IW1fsf7rm_4v9JmF4IWn6BhvmxyTOSqjctFnqROtVuA,6628
9
- robotcode-0.91.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
10
- robotcode-0.91.0.dist-info/entry_points.txt,sha256=Pb4DKVVdJb5PboVl48njwk3DkKQHBJOL1A8KkpemqA8,58
11
- robotcode-0.91.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
12
- robotcode-0.91.0.dist-info/RECORD,,