summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Warsaw2016-11-21 14:08:02 +0000
committerBarry Warsaw2016-11-21 14:08:02 +0000
commit28ee840bbb4ef616fa2655452534a1f1ba687b00 (patch)
treeeb4da32bbfb874f999736d8bf678870e08459818
parent54d32b872ee4e67a64a176077dbc49a4f87b9324 (diff)
parent0a5efbdf15a67f6e4065c78b0c70e72202e0d965 (diff)
downloadmailman-28ee840bbb4ef616fa2655452534a1f1ba687b00.tar.gz
mailman-28ee840bbb4ef616fa2655452534a1f1ba687b00.tar.zst
mailman-28ee840bbb4ef616fa2655452534a1f1ba687b00.zip
Merge branch 'flake8-errors' into 'master'
Ignore some Flake8 errors Flake8 implicitely ignores some errors, and new versions tend to add new errors. This change explicitely lists the errors we want to ignore. See merge request !218
Diffstat (limited to '')
-rw-r--r--src/mailman/bin/master.py10
-rw-r--r--src/mailman/chains/tests/test_accept.py2
-rw-r--r--src/mailman/chains/tests/test_headers.py2
-rw-r--r--src/mailman/chains/tests/test_owner.py2
-rw-r--r--src/mailman/commands/cli_control.py2
-rw-r--r--src/mailman/config/tests/test_configuration.py2
-rw-r--r--src/mailman/database/tests/test_migrations.py2
-rw-r--r--src/mailman/handlers/cook_headers.py2
-rw-r--r--src/mailman/interfaces/template.py1
-rw-r--r--src/mailman/model/tests/test_domain.py2
-rw-r--r--src/mailman/model/tests/test_requests.py2
-rw-r--r--src/mailman/rest/tests/test_paginate.py2
-rw-r--r--src/mailman/rest/users.py2
-rw-r--r--src/mailman/runners/rest.py2
-rw-r--r--src/mailman/testing/helpers.py2
-rw-r--r--src/mailman/testing/nose.py2
-rw-r--r--src/mailman/tests/test_configfile.py2
-rw-r--r--src/mailman/utilities/tests/test_templates.py10
-rw-r--r--src/mailman/utilities/tests/test_uid.py2
19 files changed, 27 insertions, 26 deletions
diff --git a/src/mailman/bin/master.py b/src/mailman/bin/master.py
index 543af4ff4..8e0b1265f 100644
--- a/src/mailman/bin/master.py
+++ b/src/mailman/bin/master.py
@@ -299,33 +299,33 @@ class Loop:
# Set up our signal handlers. Also set up a SIGALRM handler to
# refresh the lock once per day. The lock lifetime is 1 day + 6 hours
# so this should be plenty.
- def sigalrm_handler(signum, frame): # noqa: E301
+ def sigalrm_handler(signum, frame): # noqa: E306
self._lock.refresh()
signal.alarm(SECONDS_IN_A_DAY)
signal.signal(signal.SIGALRM, sigalrm_handler)
signal.alarm(SECONDS_IN_A_DAY)
# SIGHUP tells the runners to close and reopen their log files.
- def sighup_handler(signum, frame): # noqa: E301
+ def sighup_handler(signum, frame): # noqa: E306
reopen()
for pid in self._kids:
os.kill(pid, signal.SIGHUP)
log.info('Master watcher caught SIGHUP. Re-opening log files.')
signal.signal(signal.SIGHUP, sighup_handler)
# SIGUSR1 is used by 'mailman restart'.
- def sigusr1_handler(signum, frame): # noqa: E301
+ def sigusr1_handler(signum, frame): # noqa: E306
for pid in self._kids:
os.kill(pid, signal.SIGUSR1)
log.info('Master watcher caught SIGUSR1. Exiting.')
signal.signal(signal.SIGUSR1, sigusr1_handler)
# SIGTERM is what init will kill this process with when changing run
# levels. It's also the signal 'mailman stop' uses.
- def sigterm_handler(signum, frame): # noqa: E301
+ def sigterm_handler(signum, frame): # noqa: E306
for pid in self._kids:
os.kill(pid, signal.SIGTERM)
log.info('Master watcher caught SIGTERM. Exiting.')
signal.signal(signal.SIGTERM, sigterm_handler)
# SIGINT is what control-C gives.
- def sigint_handler(signum, frame): # noqa: E301
+ def sigint_handler(signum, frame): # noqa: E306
for pid in self._kids:
os.kill(pid, signal.SIGINT)
log.info('Master watcher caught SIGINT. Restarting.')
diff --git a/src/mailman/chains/tests/test_accept.py b/src/mailman/chains/tests/test_accept.py
index 07ed958b0..7643818e7 100644
--- a/src/mailman/chains/tests/test_accept.py
+++ b/src/mailman/chains/tests/test_accept.py
@@ -60,7 +60,7 @@ Subject: Ignore
config.chains['mine'] = MyChain()
self.addCleanup(config.chains.pop, 'mine')
hits = None
- def handler(event): # noqa: E301
+ def handler(event): # noqa: E306
nonlocal hits
if isinstance(event, AcceptEvent):
hits = event.msg['x-mailman-rule-hits']
diff --git a/src/mailman/chains/tests/test_headers.py b/src/mailman/chains/tests/test_headers.py
index 7e7219118..e31111c6e 100644
--- a/src/mailman/chains/tests/test_headers.py
+++ b/src/mailman/chains/tests/test_headers.py
@@ -302,7 +302,7 @@ A message body.
header_matches = IHeaderMatchList(self._mlist)
header_matches.append('Header2', 'b+')
header_matches.append('Header3', 'c+')
- def get_links(): # noqa: E301
+ def get_links(): # noqa: E306
return [
link for link in chain.get_links(self._mlist, Message(), {})
if link.rule.name != 'any'
diff --git a/src/mailman/chains/tests/test_owner.py b/src/mailman/chains/tests/test_owner.py
index 70328303b..d00f61edd 100644
--- a/src/mailman/chains/tests/test_owner.py
+++ b/src/mailman/chains/tests/test_owner.py
@@ -50,7 +50,7 @@ Message-ID: <ant>
# This event subscriber records the event that occurs when the message
# is processed by the owner chain.
events = []
- def catch_event(event): # noqa: E301
+ def catch_event(event): # noqa: E306
if isinstance(event, AcceptOwnerEvent):
events.append(event)
with event_subscribers(catch_event):
diff --git a/src/mailman/commands/cli_control.py b/src/mailman/commands/cli_control.py
index af22c3b06..5ba0b5427 100644
--- a/src/mailman/commands/cli_control.py
+++ b/src/mailman/commands/cli_control.py
@@ -93,7 +93,7 @@ class Start:
self.parser.error(
_('A previous run of GNU Mailman did not exit '
'cleanly. Try using --force.'))
- def log(message): # noqa: E301
+ def log(message): # noqa: E306
if not args.quiet:
print(message)
# Try to find the path to a valid, existing configuration file, and
diff --git a/src/mailman/config/tests/test_configuration.py b/src/mailman/config/tests/test_configuration.py
index 24f2804fa..5fb8a27b9 100644
--- a/src/mailman/config/tests/test_configuration.py
+++ b/src/mailman/config/tests/test_configuration.py
@@ -39,7 +39,7 @@ class TestConfiguration(unittest.TestCase):
# Pushing a new configuration onto the stack triggers a
# post-processing event.
events = []
- def on_event(event): # noqa: E301
+ def on_event(event): # noqa: E306
if isinstance(event, ConfigurationUpdatedEvent):
# Record both the event and the top overlay.
events.append(event.config.overlays[0].name)
diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py
index 874f3a9ce..ee45d1a00 100644
--- a/src/mailman/database/tests/test_migrations.py
+++ b/src/mailman/database/tests/test_migrations.py
@@ -130,7 +130,7 @@ class TestMigrations(unittest.TestCase):
sa.sql.column('value', SAUnicode),
sa.sql.column('pended_id', sa.Integer),
)
- def get_from_db(): # noqa: E301
+ def get_from_db(): # noqa: E306
results = {}
for i in range(1, 6):
query = sa.sql.select(
diff --git a/src/mailman/handlers/cook_headers.py b/src/mailman/handlers/cook_headers.py
index 78109bb77..5f203fcbd 100644
--- a/src/mailman/handlers/cook_headers.py
+++ b/src/mailman/handlers/cook_headers.py
@@ -107,7 +107,7 @@ def process(mlist, msg, msgdata):
# A convenience function, requires nested scopes. pair is (name, addr)
new = []
d = {}
- def add(pair): # noqa: E301
+ def add(pair): # noqa: E306
lcaddr = pair[1].lower()
if lcaddr in d:
return
diff --git a/src/mailman/interfaces/template.py b/src/mailman/interfaces/template.py
index e576eb882..24f956b78 100644
--- a/src/mailman/interfaces/template.py
+++ b/src/mailman/interfaces/template.py
@@ -157,6 +157,7 @@ class ITemplateManager(Interface):
:type context: str
"""
+
# Mapping of template names to their in-source file names. A None value means
# that there is no file in the tree for that template.
diff --git a/src/mailman/model/tests/test_domain.py b/src/mailman/model/tests/test_domain.py
index fb7896c6e..f1bf56edf 100644
--- a/src/mailman/model/tests/test_domain.py
+++ b/src/mailman/model/tests/test_domain.py
@@ -122,7 +122,7 @@ class TestDomainManager(unittest.TestCase):
self.assertEqual(
sorted(owner.addresses[0].email for owner in domain.owners),
['anne@example.com', 'bart@example.com'])
- def sort_key(owner): # noqa: E301
+ def sort_key(owner): # noqa: E306
return owner.addresses[0].email
self.assertEqual(sorted(domain.owners, key=sort_key), [anne, bart])
diff --git a/src/mailman/model/tests/test_requests.py b/src/mailman/model/tests/test_requests.py
index 3d4f64783..63795179e 100644
--- a/src/mailman/model/tests/test_requests.py
+++ b/src/mailman/model/tests/test_requests.py
@@ -104,7 +104,7 @@ Something else.
# value in a descending counter.
request_ids = []
counter = count(200, -1)
- def id_hacker(session, flush_context, instances): # noqa: E301
+ def id_hacker(session, flush_context, instances): # noqa: E306
for instance in session.new:
if isinstance(instance, _Request):
instance.id = next(counter)
diff --git a/src/mailman/rest/tests/test_paginate.py b/src/mailman/rest/tests/test_paginate.py
index 5f28d093a..cd2b76d7a 100644
--- a/src/mailman/rest/tests/test_paginate.py
+++ b/src/mailman/rest/tests/test_paginate.py
@@ -48,7 +48,7 @@ class TestPaginateHelper(unittest.TestCase):
class Resource(CollectionMixin):
def _get_collection(self, request):
return ['one', 'two', 'three', 'four', 'five']
- def _resource_as_dict(self, res): # noqa: E301
+ def _resource_as_dict(self, res): # noqa: E306
return {'value': res}
return Resource()
diff --git a/src/mailman/rest/users.py b/src/mailman/rest/users.py
index c405a1ede..f9ce9b132 100644
--- a/src/mailman/rest/users.py
+++ b/src/mailman/rest/users.py
@@ -55,7 +55,7 @@ class ListOfDomainOwners(GetterSetter):
def get(self, domain, attribute):
assert attribute == 'owner', (
'Unexpected attribute: {}'.format(attribute))
- def sort_key(owner): # noqa: E301
+ def sort_key(owner): # noqa: E306
return owner.addresses[0].email
return sorted(domain.owners, key=sort_key)
diff --git a/src/mailman/runners/rest.py b/src/mailman/runners/rest.py
index 36b03aa5a..037b6adf8 100644
--- a/src/mailman/runners/rest.py
+++ b/src/mailman/runners/rest.py
@@ -50,7 +50,7 @@ class RESTRunner(Runner):
# server.
self._server = make_server()
self._event = threading.Event()
- def stopper(event, server): # noqa: E301
+ def stopper(event, server): # noqa: E306
event.wait()
server.shutdown()
self._thread = threading.Thread(
diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py
index d9cf974f5..2ce6956b7 100644
--- a/src/mailman/testing/helpers.py
+++ b/src/mailman/testing/helpers.py
@@ -248,7 +248,7 @@ def get_nntp_server(cleanups):
cleanups.append(patcher.stop)
nntpd = server_class()
# A class for more convenient access to the posted message.
- class NNTPProxy: # noqa: E301
+ class NNTPProxy: # noqa: E306
def get_message(self):
args = nntpd.post.call_args
return specialized_message_from_string(args[0][0].read())
diff --git a/src/mailman/testing/nose.py b/src/mailman/testing/nose.py
index 6a2e0d6ba..bbd361390 100644
--- a/src/mailman/testing/nose.py
+++ b/src/mailman/testing/nose.py
@@ -42,7 +42,7 @@ class NosePlugin(Plugin):
super().__init__()
self.patterns = []
self.stderr = False
- def set_stderr(ignore): # noqa: E301
+ def set_stderr(ignore): # noqa: E306
self.stderr = True
self.addArgument(self.patterns, 'P', 'pattern',
'Add a test matching pattern')
diff --git a/src/mailman/tests/test_configfile.py b/src/mailman/tests/test_configfile.py
index 0112f78bd..36b9abdcf 100644
--- a/src/mailman/tests/test_configfile.py
+++ b/src/mailman/tests/test_configfile.py
@@ -116,7 +116,7 @@ class TestConfigFileSearchWithChroot(TestConfigFileBase):
# system that we can write to and test is to hack os.path.exists() to
# prepend a temporary directory onto the path it tests.
self._os_path_exists = os.path.exists
- def exists(path): # noqa: E301
+ def exists(path): # noqa: E306
# Strip off the leading slash, otherwise we'll end up with path.
return self._os_path_exists(self._make_fake(path))
os.path.exists = exists
diff --git a/src/mailman/utilities/tests/test_templates.py b/src/mailman/utilities/tests/test_templates.py
index a2b364c1a..02c77d0fa 100644
--- a/src/mailman/utilities/tests/test_templates.py
+++ b/src/mailman/utilities/tests/test_templates.py
@@ -77,7 +77,7 @@ class TestSearchOrder(unittest.TestCase):
def test_fully_specified_search_order(self):
search_order = self._stripped_search_order('foo.txt', self.mlist, 'it')
# For convenience.
- def nexteq(path): # noqa: E301
+ def nexteq(path): # noqa: E306
self.assertEqual(next(search_order), path)
# 1: Use the given language argument
nexteq('/v/templates/lists/l.example.com/it/foo.txt')
@@ -107,7 +107,7 @@ class TestSearchOrder(unittest.TestCase):
def test_no_language_argument_search_order(self):
search_order = self._stripped_search_order('foo.txt', self.mlist)
# For convenience.
- def nexteq(path): # noqa: E301
+ def nexteq(path): # noqa: E306
self.assertEqual(next(search_order), path)
# 1: Use mlist.preferred_language
nexteq('/v/templates/lists/l.example.com/de/foo.txt')
@@ -132,7 +132,7 @@ class TestSearchOrder(unittest.TestCase):
def test_no_mailing_list_argument_search_order(self):
search_order = self._stripped_search_order('foo.txt', language='it')
# For convenience.
- def nexteq(path): # noqa: E301
+ def nexteq(path): # noqa: E306
self.assertEqual(next(search_order), path)
# 1: Use the given language argument
nexteq('/v/templates/site/it/foo.txt')
@@ -148,7 +148,7 @@ class TestSearchOrder(unittest.TestCase):
def test_no_optional_arguments_search_order(self):
search_order = self._stripped_search_order('foo.txt')
# For convenience.
- def nexteq(path): # noqa: E301
+ def nexteq(path): # noqa: E306
self.assertEqual(next(search_order), path)
# 1: Use the site's default language
nexteq('/v/templates/site/fr/foo.txt')
@@ -180,7 +180,7 @@ class TestFind(unittest.TestCase):
self.mlist.preferred_language = 'xx'
self.fp = None
# Populate the template directories with a few fake templates.
- def write(text, path): # noqa: E301
+ def write(text, path): # noqa: E306
os.makedirs(os.path.dirname(path))
with open(path, 'w') as fp:
fp.write(text)
diff --git a/src/mailman/utilities/tests/test_uid.py b/src/mailman/utilities/tests/test_uid.py
index fd00ddfff..e3476dfbc 100644
--- a/src/mailman/utilities/tests/test_uid.py
+++ b/src/mailman/utilities/tests/test_uid.py
@@ -54,7 +54,7 @@ class TestUID(unittest.TestCase):
def test_uid_record_try_again(self):
called = False
- def record_second(ignore): # noqa: E301
+ def record_second(ignore): # noqa: E306
nonlocal called
if not called:
called = True