@@ -231,8 +231,7 @@ def _get_item_type(components, wrappers):
231
231
232
232
if not i :
233
233
return None , None
234
- else :
235
- raise ValueError ("Not sure how to join components." )
234
+ raise ValueError ("Not sure how to join components." )
236
235
237
236
238
237
class _Component :
@@ -303,10 +302,9 @@ def parse(cls, lines, multiple=False):
303
302
304
303
if multiple :
305
304
return rv
306
- elif len (rv ) != 1 :
305
+ if len (rv ) != 1 :
307
306
raise ValueError (f"Found { len (rv )} components, expected one." )
308
- else :
309
- return rv [0 ]
307
+ return rv [0 ]
310
308
311
309
def dump_lines (self ):
312
310
yield f"BEGIN:{ self .name } "
@@ -323,8 +321,7 @@ def __delitem__(self, key):
323
321
for line in lineiter :
324
322
if line .startswith (prefix ):
325
323
break
326
- else :
327
- new_lines .append (line )
324
+ new_lines .append (line )
328
325
else :
329
326
break
330
327
@@ -347,10 +344,9 @@ def __contains__(self, obj):
347
344
return obj not in self .subcomponents and not any (
348
345
obj in x for x in self .subcomponents
349
346
)
350
- elif isinstance (obj , str ):
347
+ if isinstance (obj , str ):
351
348
return self .get (obj , None ) is not None
352
- else :
353
- raise ValueError (obj )
349
+ raise ValueError (obj )
354
350
355
351
def __getitem__ (self , key ):
356
352
prefix_without_params = f"{ key } :"
@@ -360,7 +356,7 @@ def __getitem__(self, key):
360
356
if line .startswith (prefix_without_params ):
361
357
rv = line [len (prefix_without_params ) :]
362
358
break
363
- elif line .startswith (prefix_with_params ):
359
+ if line .startswith (prefix_with_params ):
364
360
rv = line [len (prefix_with_params ) :].split (":" , 1 )[- 1 ]
365
361
break
366
362
else :
0 commit comments