File tree Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ typing-extensions>=4.4.0
2
2
click>=8.1.0
3
3
pluggy>=1.0.0
4
4
tomli > 2.0.0
5
+ tomli_w >= 1.0.0
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ classifiers = [
25
25
" Framework :: Robot Framework" ,
26
26
" Framework :: Robot Framework :: Tool" ,
27
27
]
28
- dependencies = [" click>=8.0.0" , " pluggy>=1.0.0" ]
28
+ dependencies = [" click>=8.0.0" , " pluggy>=1.0.0" , " tomli_w>=1.0.0 " ]
29
29
dynamic = [" version" ]
30
30
31
31
[project .urls ]
Original file line number Diff line number Diff line change 7
7
8
8
import click
9
9
import pluggy
10
+ import tomli_w
10
11
from robotcode .core .dataclasses import as_dict , as_json
11
12
12
13
__all__ = [
@@ -108,19 +109,13 @@ def print_data(
108
109
109
110
text = None
110
111
if format == OutputFormat .TOML :
111
- try :
112
- import tomli_w
113
-
114
- text = tomli_w .dumps (
115
- as_dict (data , remove_defaults = remove_defaults )
116
- if dataclasses .is_dataclass (data )
117
- else data
118
- if isinstance (data , dict )
119
- else {data : data }
120
- )
121
- except ImportError :
122
- self .warning ("Package 'tomli_w' is required to use TOML output. Using JSON format instead." )
123
- format = OutputFormat .JSON
112
+ text = tomli_w .dumps (
113
+ as_dict (data , remove_defaults = remove_defaults )
114
+ if dataclasses .is_dataclass (data )
115
+ else data
116
+ if isinstance (data , dict )
117
+ else {data : data }
118
+ )
124
119
125
120
if text is None :
126
121
if format in [OutputFormat .JSON , OutputFormat .JSON_INDENT ]:
You can’t perform that action at this time.
0 commit comments