Skip to content

Commit

Permalink
Fixed or silenced flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van der Schoor committed Feb 28, 2024
1 parent 1ec693a commit 1c27dd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions mail_editor/mail_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Defines helpers for validating e-mail templates
"""

from __future__ import absolute_import, unicode_literals

from django.core.exceptions import ValidationError
from django.template import ( # TODO: should be able to specify engine
Context,
Expand Down Expand Up @@ -63,7 +61,8 @@ def check_syntax_errors(self, value):
def check_variables(self, template, field):
variables_seen = set()
required_vars = {var.name for var in self.config[field] if var.required}
optional_vars = {var.name for var in self.config[field] if not var.required}
# TODO do we need to check optional_vars? the following line was here but never used
# optional_vars = {var.name for var in self.config[field] if not var.required}
for node in template.nodelist.get_nodes_by_type(VariableNode):
var_name = node.filter_expression.var.var
variables_seen.add(var_name)
Expand All @@ -80,8 +79,8 @@ def check_variables(self, template, field):
params={field: message}, message=message, code=self.code
)

def _is_attribute(self, vars, known_vars):
for var in vars:
def _is_attribute(self, var_names, known_vars):
for var in var_names:
if any(var.startswith("{}.".format(known_var)) for known_var in known_vars):
return True

Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ max-line-length=120
exclude=migrations,static,media

[flake8]
ignore=E203,E261,E501,E731,F405,W293,W291,W503,F841,E741
max-line-length=120
exclude=env,.tox,doc
exclude=env,.tox,docs

[isort]
combine_as_imports = true
Expand Down

0 comments on commit 1c27dd4

Please sign in to comment.