@@ -254,7 +254,7 @@ def format(self):
254254 "default" : self .value2str (self ._default_value ),
255255 "name" : self .setting ,
256256 "value" : self .value2str (self ._value ),
257- "is_set" : _is_set
257+ "is_set" : _is_set ,
258258 }
259259 return _rv
260260
@@ -544,10 +544,8 @@ class SpaceSeparatedListOption(Option):
544544 class_description = "A list of space separated elements."
545545
546546 def get (self ):
547- pathlist = []
548547 _val = Option .get (self )
549- for elem in _val .split ():
550- pathlist .append (elem )
548+ pathlist = list (_val .split ())
551549 if pathlist :
552550 return pathlist
553551 else :
@@ -562,13 +560,12 @@ class OriginHeadersListOption(Option):
562560 class_description = "A list of space separated case sensitive\n origin headers 'scheme://host'."
563561
564562 def set (self , _val ):
565- pathlist = self ._value = []
566- for elem in _val .split ():
567- pathlist .append (elem )
563+ pathlist = list (_val .split ())
568564 if '*' in pathlist and pathlist [0 ] != '*' :
569565 raise OptionValueError (
570566 self , _val ,
571567 "If using '*' it must be the first element." )
568+ self ._value = pathlist
572569
573570 def _value2str (self , value ):
574571 return ',' .join (value )
@@ -828,7 +825,7 @@ def get(self):
828825
829826 class_description = SecretOption .class_description
830827
831- def validate (self , options ):
828+ def validate (self , options ): # noqa: ARG002 -- options unused
832829 if self .name == "WEB_JWT_SECRET" :
833830 secrets = self .get ()
834831 invalid_secrets = [ x for x in secrets [1 :] if len (x ) < 32 ]
@@ -895,10 +892,9 @@ def validate(self, options):
895892 redis_available = True
896893 except ImportError :
897894 if sessiondb_backend == 'redis' :
898- valid_session_backends = ', ' .join (sorted (list (
895+ valid_session_backends = ', ' .join (sorted (
899896 [x [1 ] for x in self .compatibility_matrix
900- if x [0 ] == rdbms_backend and x [1 ] != 'redis' ])
901- ))
897+ if x [0 ] == rdbms_backend and x [1 ] != 'redis' ]))
902898 raise OptionValueError (
903899 self , sessiondb_backend ,
904900 "Unable to load redis module. Please install "
@@ -907,12 +903,10 @@ def validate(self, options):
907903
908904 if ((rdbms_backend , sessiondb_backend ) not in
909905 self .compatibility_matrix ):
910-
911- valid_session_backends = ', ' .join (sorted (list (
912- set ([x [1 ] for x in self .compatibility_matrix
906+ valid_session_backends = ', ' .join (sorted (
907+ {x [1 ] for x in self .compatibility_matrix
913908 if x [0 ] == rdbms_backend and
914- (redis_available or x [1 ] != 'redis' )])
915- )))
909+ (redis_available or x [1 ] != 'redis' )}))
916910
917911 raise OptionValueError (
918912 self , sessiondb_backend ,
@@ -975,7 +969,7 @@ def __init__(self, config, section, setting,
975969 description , aliases )
976970
977971 def _value2str (self , value ):
978- assert isinstance (value , self .RE_TYPE )
972+ assert isinstance (value , self .RE_TYPE ) # noqa: S101 -- assert is ok
979973 return value .pattern
980974
981975 def str2value (self , value ):
@@ -1057,12 +1051,12 @@ def str2value(self, value):
10571051 "If no domain is specified then the config item\n "
10581052 "mail -> domain is added." ),
10591053 (Option , "email_from_tag" , "" ,
1060- " Additional text to include in the \ " name\ " part\n "
1054+ ' Additional text to include in the "name" part\n '
10611055 "of the From: address used in nosy messages.\n "
1062- " If the sending user is \ " Foo Bar\ " , the From: line\n "
1063- " is usually: \ " Foo Bar\ " <[email protected] >\n " 1064- " the EMAIL_FROM_TAG goes inside the \ " Foo Bar\ " quotes like so:\n "
1065- " \" Foo Bar EMAIL_FROM_TAG\ " <[email protected] >" ),
1056+ ' If the sending user is "Foo Bar", the From: line\n '
1057+ ' is usually: "Foo Bar" <[email protected] >\n ' 1058+ ' the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so:\n '
1059+ '" Foo Bar EMAIL_FROM_TAG" <[email protected] >' ),
10661060 (Option , "new_web_user_roles" , "User" ,
10671061 "Roles that a user gets when they register\n "
10681062 "with Web User Interface.\n "
@@ -1168,7 +1162,7 @@ def str2value(self, value):
11681162 "nosy messages.\n "
11691163 "If the value is unset (default) the roundup tracker's\n "
11701164 "email address (above) is used.\n "
1171- " If set to \ " AUTHOR\ " then the primary email address of the\n "
1165+ ' If set to "AUTHOR" then the primary email address of the\n '
11721166 "author of the change will be used as the reply-to\n "
11731167 "address. This allows email exchanges to occur outside of\n "
11741168 "the view of roundup and exposes the address of the person\n "
@@ -1539,7 +1533,7 @@ def str2value(self, value):
15391533 "cursor, this avoids caching large amounts of data in the\n "
15401534 "client. This option only applies for the postgresql backend." ),
15411535 ), "Settings in this section (except for backend) are used\n "
1542- " by RDBMS backends only."
1536+ " by RDBMS backends only." ,
15431537 ),
15441538 ("sessiondb" , (
15451539 (SessiondbBackendOption , "backend" , "" ,
@@ -1584,7 +1578,7 @@ def str2value(self, value):
15841578 "Do not include the '@' symbol." ),
15851579 (Option , "host" , NODEFAULT ,
15861580 "SMTP mail host that roundup will use to send mail" ,
1587- ["MAILHOST" ], ),
1581+ ["MAILHOST" ]),
15881582 (Option , "username" , "" , "SMTP login name.\n "
15891583 "Set this if your mail host requires authenticated access.\n "
15901584 "If username is not empty, password (below) MUST be set!" ),
@@ -1631,15 +1625,15 @@ def str2value(self, value):
16311625 ("mailgw" , (
16321626 (EmailBodyOption , "keep_quoted_text" , "yes" ,
16331627 "Keep email citations when accepting messages.\n "
1634- " Setting this to \ " no\ " strips out \ " quoted\ " text\n "
1635- " from the message. Setting this to \ " new\ " keeps quoted\n "
1628+ ' Setting this to "no" strips out "quoted" text\n '
1629+ ' from the message. Setting this to "new" keeps quoted\n '
16361630 "text only if a new issue is being created.\n "
16371631 "Signatures are also stripped." ,
16381632 ["EMAIL_KEEP_QUOTED_TEXT" ]),
16391633 (EmailBodyOption , "leave_body_unchanged" , "no" ,
1640- " Setting this to \ " yes\ " preserves the email body\n "
1634+ ' Setting this to "yes" preserves the email body\n '
16411635 "as is - that is, keep the citations _and_ signatures.\n "
1642- " Setting this to \ " new\ " keeps the body only if we are\n "
1636+ ' Setting this to "new" keeps the body only if we are\n '
16431637 "creating a new issue." ,
16441638 ["EMAIL_LEAVE_BODY_UNCHANGED" ]),
16451639 (Option , "default_class" , "issue" ,
@@ -1653,19 +1647,19 @@ def str2value(self, value):
16531647 "the language of the tracker instance." ),
16541648 (Option , "subject_prefix_parsing" , "strict" ,
16551649 "Controls the parsing of the [prefix] on subject\n "
1656- " lines in incoming emails. \ " strict\ " will return an\n "
1650+ ' lines in incoming emails. "strict" will return an\n '
16571651 "error to the sender if the [prefix] is not recognised.\n "
1658- " \" loose\ " will attempt to parse the [prefix] but just\n "
1652+ '" loose" will attempt to parse the [prefix] but just\n '
16591653 "pass it through as part of the issue title if not\n "
1660- " recognised. \ " none\ " will always pass any [prefix]\n "
1654+ ' recognised. "none" will always pass any [prefix]\n '
16611655 "through as part of the issue title." ),
16621656 (Option , "subject_suffix_parsing" , "strict" ,
16631657 "Controls the parsing of the [suffix] on subject\n "
1664- " lines in incoming emails. \ " strict\ " will return an\n "
1658+ ' lines in incoming emails. "strict" will return an\n '
16651659 "error to the sender if the [suffix] is not recognised.\n "
1666- " \" loose\ " will attempt to parse the [suffix] but just\n "
1660+ '" loose" will attempt to parse the [suffix] but just\n '
16671661 "pass it through as part of the issue title if not\n "
1668- " recognised. \ " none\ " will always pass any [suffix]\n "
1662+ ' recognised. "none" will always pass any [suffix]\n '
16691663 "through as part of the issue title." ),
16701664 (Option , "subject_suffix_delimiters" , "[]" ,
16711665 "Defines the brackets used for delimiting the prefix and \n "
@@ -1675,14 +1669,14 @@ def str2value(self, value):
16751669 (Option , "subject_content_match" , "always" ,
16761670 "Controls matching of the incoming email subject line\n "
16771671 "against issue titles in the case where there is no\n "
1678- " designator [prefix]. \ " never\ " turns off matching.\n "
1679- " \" creation + interval\ " or \ " activity + interval\ "\n "
1672+ ' designator [prefix]. "never" turns off matching.\n '
1673+ '" creation + interval" or "activity + interval"\n '
16801674 "will match an issue for the interval after the issue's\n "
16811675 "creation or last activity. The interval is a standard\n "
16821676 "Roundup interval." ),
16831677 (BooleanOption , "subject_updates_title" , "yes" ,
16841678 "Update issue title if incoming subject of email is different.\n "
1685- " Setting this to \ " no\ " will ignore the title part of"
1679+ ' Setting this to "no" will ignore the title part of'
16861680 " the subject\n of incoming email messages.\n " ),
16871681 (RegExpOption , "refwd_re" , r"(\s*\W?\s*(fw|fwd|re|aw|sv|ang)\W)+" ,
16881682 "Regular expression matching a single reply or forward\n "
@@ -1785,13 +1779,13 @@ def str2value(self, value):
17851779 ["ADD_RECIPIENTS_TO_NOSY" ]),
17861780 (Option , "email_sending" , "single" ,
17871781 "Controls the email sending from the nosy reactor. If\n "
1788- " \" multiple\ " then a separate email is sent to each\n "
1789- " recipient. If \ " single\ " then a single email is sent with\n "
1782+ '" multiple" then a separate email is sent to each\n '
1783+ ' recipient. If "single" then a single email is sent with\n '
17901784 "each recipient as a CC address." ),
17911785 (IntegerNumberGeqZeroOption , "max_attachment_size" , sys .maxsize ,
17921786 "Attachments larger than the given number of bytes\n "
17931787 "won't be attached to nosy mails. They will be replaced by\n "
1794- "a link to the tracker's download page for the file." )
1788+ "a link to the tracker's download page for the file." ),
17951789 ), "Nosy messages sending" ),
17961790 ("markdown" , (
17971791 (BooleanOption , "break_on_newline" , "no" ,
@@ -1886,7 +1880,7 @@ def add_section(self, section, options, description=None):
18861880 *not* have aliases!
18871881
18881882 """
1889- if description or not (section in self .section_descriptions ):
1883+ if description or (section not in self .section_descriptions ):
18901884 self .section_descriptions [section ] = description
18911885 for option_def in options :
18921886 klass = option_def [0 ]
@@ -1998,7 +1992,7 @@ def getopt(self, args, short_options="", long_options=(),
19981992 for (name , letter ) in options .items ():
19991993 cfg_name = name .upper ()
20001994 short_opt = "-" + letter [0 ]
2001- name = name .lower ().replace ("_" , "-" )
1995+ name = name .lower ().replace ("_" , "-" ) # noqa: PLW2901 change name
20021996 cfg_names .update ({short_opt : cfg_name , "--" + name : cfg_name })
20031997
20041998 short_options += letter
@@ -2029,7 +2023,7 @@ def getopt(self, args, short_options="", long_options=(),
20292023 extra_options = []
20302024 for (opt , arg ) in optlist :
20312025 if (opt in booleans ): # and not arg
2032- arg = "yes"
2026+ arg = "yes" # noqa: PLW2901 -- change arg
20332027 try :
20342028 name = cfg_names [opt ]
20352029 except KeyError :
0 commit comments