Skip to content

Commit

Permalink
Clean up assigned but now used flak8 errors
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Belanger <[email protected]>
  • Loading branch information
pabelanger committed Dec 17, 2018
1 parent 851ad4e commit 544429c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions action_plugins/extract_banners.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def run(self, tmp=None, task_vars=None):
return result

def _extract_banners(self, config):
banners = {}
config_lines = config.split('\n')
found_banner_start = 0
banner_meta = []
Expand All @@ -97,7 +96,7 @@ def _extract_banners(self, config):
banner_delimiter = banner_start.group(2)
banner_delimiter = banner_delimiter.strip()
banner_delimiter_esc = re.escape(banner_delimiter)
except Exception as e:
except Exception:
continue
banner_start_index = linenum
found_banner_start = 1
Expand Down
6 changes: 2 additions & 4 deletions action_plugins/parse_validate_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
class ActionModule(ActionBase):

def run(self, tmp=None, task_vars=None):
socket_path = None

result = super(ActionModule, self).run(task_vars=task_vars)

try:
Expand Down Expand Up @@ -88,7 +86,7 @@ def run(self, tmp=None, task_vars=None):

def _create_packet_dict(self, cmd_out):
import warnings
with warnings.catch_warnings(record=True) as w:
with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
from trigger.acl import parse
import netaddr
Expand All @@ -103,7 +101,7 @@ def _create_packet_dict(self, cmd_out):
pd_it = {}
try:
p = parse(line)
except Exception as e:
except Exception:
continue

if p.terms:
Expand Down
7 changes: 2 additions & 5 deletions action_plugins/verify_dependent_role_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ def run(self, tmp=None, task_vars=None):
except KeyError as exc:
return {'failed': True, 'msg': 'missing required argument: %s' % exc}

# Get max version if specified
max_version = self._task.args.get('max_version')

# Get dependancy version dict if not encoded in meta
depends_dict = self._task.args.get('depends_map')

Expand Down Expand Up @@ -96,7 +93,7 @@ def _get_role_dependencies(self, role_path):
f = open(meta_path, 'r')
metadata = yaml.safe_load(f)
role_dependencies = metadata.get('dependencies') or []
except (OSError, IOError) as IOe:
except (OSError, IOError):
display.vvv("Unable to load metadata for %s" % role_path)
return False
finally:
Expand Down Expand Up @@ -186,7 +183,7 @@ def _get_role_version(self, role_path):
try:
f = open(info_path, 'r')
install_info = yaml.safe_load(f)
except (OSError, IOError) as IOe:
except (OSError, IOError):
display.vvv(
"Unable to load galaxy install info for %s" % role_path)
return "unknown"
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ commands = {posargs}
[flake8]
# TODO(pabelanger): Follow sane flake8 rules for galaxy and sync across all of
# ansible-network.
ignore = E125,E402,F401,F841
ignore = E125,E402,F401
max-line-length = 160
show-source = True
exclude = .tox,dist,build,*.egg

0 comments on commit 544429c

Please sign in to comment.