@@ -254,7 +254,7 @@ def format(self):
254
254
"default" : self .value2str (self ._default_value ),
255
255
"name" : self .setting ,
256
256
"value" : self .value2str (self ._value ),
257
- "is_set" : _is_set
257
+ "is_set" : _is_set ,
258
258
}
259
259
return _rv
260
260
@@ -544,10 +544,8 @@ class SpaceSeparatedListOption(Option):
544
544
class_description = "A list of space separated elements."
545
545
546
546
def get (self ):
547
- pathlist = []
548
547
_val = Option .get (self )
549
- for elem in _val .split ():
550
- pathlist .append (elem )
548
+ pathlist = list (_val .split ())
551
549
if pathlist :
552
550
return pathlist
553
551
else :
@@ -562,13 +560,12 @@ class OriginHeadersListOption(Option):
562
560
class_description = "A list of space separated case sensitive\n origin headers 'scheme://host'."
563
561
564
562
def set (self , _val ):
565
- pathlist = self ._value = []
566
- for elem in _val .split ():
567
- pathlist .append (elem )
563
+ pathlist = list (_val .split ())
568
564
if '*' in pathlist and pathlist [0 ] != '*' :
569
565
raise OptionValueError (
570
566
self , _val ,
571
567
"If using '*' it must be the first element." )
568
+ self ._value = pathlist
572
569
573
570
def _value2str (self , value ):
574
571
return ',' .join (value )
@@ -828,7 +825,7 @@ def get(self):
828
825
829
826
class_description = SecretOption .class_description
830
827
831
- def validate (self , options ):
828
+ def validate (self , options ): # noqa: ARG002 -- options unused
832
829
if self .name == "WEB_JWT_SECRET" :
833
830
secrets = self .get ()
834
831
invalid_secrets = [ x for x in secrets [1 :] if len (x ) < 32 ]
@@ -895,10 +892,9 @@ def validate(self, options):
895
892
redis_available = True
896
893
except ImportError :
897
894
if sessiondb_backend == 'redis' :
898
- valid_session_backends = ', ' .join (sorted (list (
895
+ valid_session_backends = ', ' .join (sorted (
899
896
[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' ]))
902
898
raise OptionValueError (
903
899
self , sessiondb_backend ,
904
900
"Unable to load redis module. Please install "
@@ -907,12 +903,10 @@ def validate(self, options):
907
903
908
904
if ((rdbms_backend , sessiondb_backend ) not in
909
905
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
913
908
if x [0 ] == rdbms_backend and
914
- (redis_available or x [1 ] != 'redis' )])
915
- )))
909
+ (redis_available or x [1 ] != 'redis' )}))
916
910
917
911
raise OptionValueError (
918
912
self , sessiondb_backend ,
@@ -975,7 +969,7 @@ def __init__(self, config, section, setting,
975
969
description , aliases )
976
970
977
971
def _value2str (self , value ):
978
- assert isinstance (value , self .RE_TYPE )
972
+ assert isinstance (value , self .RE_TYPE ) # noqa: S101 -- assert is ok
979
973
return value .pattern
980
974
981
975
def str2value (self , value ):
@@ -1057,12 +1051,12 @@ def str2value(self, value):
1057
1051
"If no domain is specified then the config item\n "
1058
1052
"mail -> domain is added." ),
1059
1053
(Option , "email_from_tag" , "" ,
1060
- " Additional text to include in the \ " name\ " part\n "
1054
+ ' Additional text to include in the "name" part\n '
1061
1055
"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] >' ),
1066
1060
(Option , "new_web_user_roles" , "User" ,
1067
1061
"Roles that a user gets when they register\n "
1068
1062
"with Web User Interface.\n "
@@ -1168,7 +1162,7 @@ def str2value(self, value):
1168
1162
"nosy messages.\n "
1169
1163
"If the value is unset (default) the roundup tracker's\n "
1170
1164
"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 '
1172
1166
"author of the change will be used as the reply-to\n "
1173
1167
"address. This allows email exchanges to occur outside of\n "
1174
1168
"the view of roundup and exposes the address of the person\n "
@@ -1539,7 +1533,7 @@ def str2value(self, value):
1539
1533
"cursor, this avoids caching large amounts of data in the\n "
1540
1534
"client. This option only applies for the postgresql backend." ),
1541
1535
), "Settings in this section (except for backend) are used\n "
1542
- " by RDBMS backends only."
1536
+ " by RDBMS backends only." ,
1543
1537
),
1544
1538
("sessiondb" , (
1545
1539
(SessiondbBackendOption , "backend" , "" ,
@@ -1584,7 +1578,7 @@ def str2value(self, value):
1584
1578
"Do not include the '@' symbol." ),
1585
1579
(Option , "host" , NODEFAULT ,
1586
1580
"SMTP mail host that roundup will use to send mail" ,
1587
- ["MAILHOST" ], ),
1581
+ ["MAILHOST" ]),
1588
1582
(Option , "username" , "" , "SMTP login name.\n "
1589
1583
"Set this if your mail host requires authenticated access.\n "
1590
1584
"If username is not empty, password (below) MUST be set!" ),
@@ -1631,15 +1625,15 @@ def str2value(self, value):
1631
1625
("mailgw" , (
1632
1626
(EmailBodyOption , "keep_quoted_text" , "yes" ,
1633
1627
"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 '
1636
1630
"text only if a new issue is being created.\n "
1637
1631
"Signatures are also stripped." ,
1638
1632
["EMAIL_KEEP_QUOTED_TEXT" ]),
1639
1633
(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 '
1641
1635
"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 '
1643
1637
"creating a new issue." ,
1644
1638
["EMAIL_LEAVE_BODY_UNCHANGED" ]),
1645
1639
(Option , "default_class" , "issue" ,
@@ -1653,19 +1647,19 @@ def str2value(self, value):
1653
1647
"the language of the tracker instance." ),
1654
1648
(Option , "subject_prefix_parsing" , "strict" ,
1655
1649
"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 '
1657
1651
"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 '
1659
1653
"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 '
1661
1655
"through as part of the issue title." ),
1662
1656
(Option , "subject_suffix_parsing" , "strict" ,
1663
1657
"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 '
1665
1659
"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 '
1667
1661
"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 '
1669
1663
"through as part of the issue title." ),
1670
1664
(Option , "subject_suffix_delimiters" , "[]" ,
1671
1665
"Defines the brackets used for delimiting the prefix and \n "
@@ -1675,14 +1669,14 @@ def str2value(self, value):
1675
1669
(Option , "subject_content_match" , "always" ,
1676
1670
"Controls matching of the incoming email subject line\n "
1677
1671
"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 '
1680
1674
"will match an issue for the interval after the issue's\n "
1681
1675
"creation or last activity. The interval is a standard\n "
1682
1676
"Roundup interval." ),
1683
1677
(BooleanOption , "subject_updates_title" , "yes" ,
1684
1678
"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'
1686
1680
" the subject\n of incoming email messages.\n " ),
1687
1681
(RegExpOption , "refwd_re" , r"(\s*\W?\s*(fw|fwd|re|aw|sv|ang)\W)+" ,
1688
1682
"Regular expression matching a single reply or forward\n "
@@ -1785,13 +1779,13 @@ def str2value(self, value):
1785
1779
["ADD_RECIPIENTS_TO_NOSY" ]),
1786
1780
(Option , "email_sending" , "single" ,
1787
1781
"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 '
1790
1784
"each recipient as a CC address." ),
1791
1785
(IntegerNumberGeqZeroOption , "max_attachment_size" , sys .maxsize ,
1792
1786
"Attachments larger than the given number of bytes\n "
1793
1787
"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." ),
1795
1789
), "Nosy messages sending" ),
1796
1790
("markdown" , (
1797
1791
(BooleanOption , "break_on_newline" , "no" ,
@@ -1886,7 +1880,7 @@ def add_section(self, section, options, description=None):
1886
1880
*not* have aliases!
1887
1881
1888
1882
"""
1889
- if description or not (section in self .section_descriptions ):
1883
+ if description or (section not in self .section_descriptions ):
1890
1884
self .section_descriptions [section ] = description
1891
1885
for option_def in options :
1892
1886
klass = option_def [0 ]
@@ -1998,7 +1992,7 @@ def getopt(self, args, short_options="", long_options=(),
1998
1992
for (name , letter ) in options .items ():
1999
1993
cfg_name = name .upper ()
2000
1994
short_opt = "-" + letter [0 ]
2001
- name = name .lower ().replace ("_" , "-" )
1995
+ name = name .lower ().replace ("_" , "-" ) # noqa: PLW2901 change name
2002
1996
cfg_names .update ({short_opt : cfg_name , "--" + name : cfg_name })
2003
1997
2004
1998
short_options += letter
@@ -2029,7 +2023,7 @@ def getopt(self, args, short_options="", long_options=(),
2029
2023
extra_options = []
2030
2024
for (opt , arg ) in optlist :
2031
2025
if (opt in booleans ): # and not arg
2032
- arg = "yes"
2026
+ arg = "yes" # noqa: PLW2901 -- change arg
2033
2027
try :
2034
2028
name = cfg_names [opt ]
2035
2029
except KeyError :
0 commit comments