@@ -85,15 +85,15 @@ def initialize(self, *args, **kwargs):
85
85
self .manager = WorkspacesManager (self .workspaces_dir )
86
86
87
87
def start (self ):
88
- if len (self .extra_args ) > 1 :
88
+ if len (self .extra_args ) > 1 : # pragma: no cover
89
89
warnings .warn ("Too many arguments were provided for workspace export." )
90
90
self .exit (1 )
91
91
92
92
raw = DEFAULT_WORKSPACE if not self .extra_args else self .extra_args [0 ]
93
93
try :
94
94
workspace = self .manager .load (raw )
95
95
print (json .dumps (workspace ))
96
- except Exception :
96
+ except Exception : # pragma: no cover
97
97
print (json .dumps (dict (data = dict (), metadata = dict (id = raw ))))
98
98
99
99
@@ -124,20 +124,20 @@ def initialize(self, *args, **kwargs):
124
124
125
125
def start (self ):
126
126
127
- if len (self .extra_args ) != 1 :
127
+ if len (self .extra_args ) != 1 : # pragma: no cover
128
128
print ("One argument is required for workspace import." )
129
129
self .exit (1 )
130
130
131
131
with self ._smart_open () as fid :
132
132
try : # to load, parse, and validate the workspace file.
133
133
workspace = self ._validate (fid )
134
- except Exception as e :
134
+ except Exception as e : # pragma: no cover
135
135
print (f"{ fid .name } is not a valid workspace:\n { e } " )
136
136
self .exit (1 )
137
137
138
138
try :
139
139
workspace_path = self .manager .save (workspace ["metadata" ]["id" ], json .dumps (workspace ))
140
- except Exception as e :
140
+ except Exception as e : # pragma: no cover
141
141
print (f"Workspace could not be exported:\n { e !s} " )
142
142
self .exit (1 )
143
143
@@ -146,12 +146,12 @@ def start(self):
146
146
def _smart_open (self ):
147
147
file_name = self .extra_args [0 ]
148
148
149
- if file_name == "-" :
149
+ if file_name == "-" : # pragma: no cover
150
150
return sys .stdin
151
151
else :
152
152
file_path = Path (file_name ).resolve ()
153
153
154
- if not file_path .exists ():
154
+ if not file_path .exists (): # pragma: no cover
155
155
print (f"{ file_name !s} does not exist." )
156
156
self .exit (1 )
157
157
0 commit comments