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
22click>=8.1.0
33pluggy>=1.0.0
44tomli > 2.0.0
5+ tomli_w >= 1.0.0
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ classifiers = [
2525 " Framework :: Robot Framework" ,
2626 " Framework :: Robot Framework :: Tool" ,
2727]
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 " ]
2929dynamic = [" version" ]
3030
3131[project .urls ]
Original file line number Diff line number Diff line change 77
88import click
99import pluggy
10+ import tomli_w
1011from robotcode .core .dataclasses import as_dict , as_json
1112
1213__all__ = [
@@ -108,19 +109,13 @@ def print_data(
108109
109110 text = None
110111 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+ )
124119
125120 if text is None :
126121 if format in [OutputFormat .JSON , OutputFormat .JSON_INDENT ]:
You can’t perform that action at this time.
0 commit comments