@@ -304,7 +304,7 @@ def __setitem__(self, option_name, value) -> None:
304
304
return
305
305
306
306
simple_setter = functools .partial (target_obj .__setattr__ , option_name )
307
- setter = getattr (target_obj , ' set_%s' % option_name , simple_setter )
307
+ setter = getattr (target_obj , f" set_{ option_name } " , simple_setter )
308
308
setter (parsed )
309
309
310
310
self .set_options .append (option_name )
@@ -372,8 +372,8 @@ def parser(value):
372
372
exclude_directive = 'file:'
373
373
if value .startswith (exclude_directive ):
374
374
raise ValueError (
375
- 'Only strings are accepted for the {0 } field, '
376
- 'files are not accepted' . format ( key )
375
+ f 'Only strings are accepted for the { key } field, '
376
+ 'files are not accepted'
377
377
)
378
378
return value
379
379
@@ -491,12 +491,12 @@ def parse(self) -> None:
491
491
for section_name , section_options in self .sections .items ():
492
492
method_postfix = ''
493
493
if section_name : # [section.option] variant
494
- method_postfix = '_%s' % section_name
494
+ method_postfix = f"_ { section_name } "
495
495
496
496
section_parser_method : Callable | None = getattr (
497
497
self ,
498
498
# Dots in section names are translated into dunderscores.
499
- ( 'parse_section%s' % method_postfix ) .replace ('.' , '__' ),
499
+ f 'parse_section{ method_postfix } ' .replace ('.' , '__' ),
500
500
None ,
501
501
)
502
502
@@ -701,10 +701,7 @@ def parse_section_packages__find(self, section_options):
701
701
section_data = self ._parse_section_to_dict (section_options , self ._parse_list )
702
702
703
703
valid_keys = ['where' , 'include' , 'exclude' ]
704
-
705
- find_kwargs = dict ([
706
- (k , v ) for k , v in section_data .items () if k in valid_keys and v
707
- ])
704
+ find_kwargs = {k : v for k , v in section_data .items () if k in valid_keys and v }
708
705
709
706
where = find_kwargs .get ('where' )
710
707
if where is not None :
0 commit comments