@@ -165,108 +165,102 @@ def _parse_config(self) -> None:
165
165
# Value Error means the option exists but isn't a boolean.
166
166
# Get as a string instead as it should then be a local path to a
167
167
# CA bundle.
168
- try :
169
- self .ssl_verify = _config .get ("global" , "ssl_verify" )
170
- except Exception : # pragma: no cover
171
- pass
172
- except Exception :
168
+ self .ssl_verify = _config .get ("global" , "ssl_verify" )
169
+ except (configparser .NoOptionError , configparser .NoSectionError ):
173
170
pass
174
171
try :
175
172
self .ssl_verify = _config .getboolean (self .gitlab_id , "ssl_verify" )
176
173
except ValueError :
177
174
# Value Error means the option exists but isn't a boolean.
178
175
# Get as a string instead as it should then be a local path to a
179
176
# CA bundle.
180
- try :
181
- self .ssl_verify = _config .get (self .gitlab_id , "ssl_verify" )
182
- except Exception : # pragma: no cover
183
- pass
184
- except Exception :
177
+ self .ssl_verify = _config .get (self .gitlab_id , "ssl_verify" )
178
+ except (configparser .NoOptionError , configparser .NoSectionError ):
185
179
pass
186
180
187
181
try :
188
182
self .timeout = _config .getint ("global" , "timeout" )
189
- except Exception :
183
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
190
184
pass
191
185
try :
192
186
self .timeout = _config .getint (self .gitlab_id , "timeout" )
193
- except Exception :
187
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
194
188
pass
195
189
196
190
try :
197
191
self .private_token = _config .get (self .gitlab_id , "private_token" )
198
- except Exception :
192
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
199
193
pass
200
194
201
195
try :
202
196
self .oauth_token = _config .get (self .gitlab_id , "oauth_token" )
203
- except Exception :
197
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
204
198
pass
205
199
206
200
try :
207
201
self .job_token = _config .get (self .gitlab_id , "job_token" )
208
- except Exception :
202
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
209
203
pass
210
204
211
205
try :
212
206
self .http_username = _config .get (self .gitlab_id , "http_username" )
213
207
self .http_password = _config .get (
214
208
self .gitlab_id , "http_password"
215
209
) # pragma: no cover
216
- except Exception :
210
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
217
211
pass
218
212
219
213
self ._get_values_from_helper ()
220
214
221
215
try :
222
216
self .api_version = _config .get ("global" , "api_version" )
223
- except Exception :
217
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
224
218
pass
225
219
try :
226
220
self .api_version = _config .get (self .gitlab_id , "api_version" )
227
- except Exception :
221
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
228
222
pass
229
223
if self .api_version not in ("4" ,):
230
224
raise GitlabDataError (f"Unsupported API version: { self .api_version } " )
231
225
232
226
for section in ["global" , self .gitlab_id ]:
233
227
try :
234
228
self .per_page = _config .getint (section , "per_page" )
235
- except Exception :
229
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
236
230
pass
237
231
if self .per_page is not None and not 0 <= self .per_page <= 100 :
238
232
raise GitlabDataError (f"Unsupported per_page number: { self .per_page } " )
239
233
240
234
try :
241
235
self .pagination = _config .get (self .gitlab_id , "pagination" )
242
- except Exception :
236
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
243
237
pass
244
238
245
239
try :
246
240
self .order_by = _config .get (self .gitlab_id , "order_by" )
247
- except Exception :
241
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
248
242
pass
249
243
250
244
try :
251
245
self .user_agent = _config .get ("global" , "user_agent" )
252
- except Exception :
246
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
253
247
pass
254
248
try :
255
249
self .user_agent = _config .get (self .gitlab_id , "user_agent" )
256
- except Exception :
250
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
257
251
pass
258
252
259
253
try :
260
254
self .retry_transient_errors = _config .getboolean (
261
255
"global" , "retry_transient_errors"
262
256
)
263
- except Exception :
257
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
264
258
pass
265
259
try :
266
260
self .retry_transient_errors = _config .getboolean (
267
261
self .gitlab_id , "retry_transient_errors"
268
262
)
269
- except Exception :
263
+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
270
264
pass
271
265
272
266
def _get_values_from_helper (self ) -> None :
0 commit comments