diff --git a/ansible_mitogen/connection.py b/ansible_mitogen/connection.py index b5f80910..90b5e41a 100644 --- a/ansible_mitogen/connection.py +++ b/ansible_mitogen/connection.py @@ -31,7 +31,6 @@ import logging import os import shlex import stat -import sys import time import jinja2.runtime @@ -58,6 +57,7 @@ def _connect_local(spec): } } + def wrap_or_none(klass, value): if value is not None: return klass(value) @@ -393,7 +393,7 @@ class Connection(ansible.plugins.connection.ConnectionBase): raise ansible.errors.AnsibleConnectionFailure( self.unknown_via_msg % ( self.mitogen_via, - config['inventory_name'], + inventory_name, ) ) diff --git a/ansible_mitogen/mixins.py b/ansible_mitogen/mixins.py index 18d29da3..e4a7a748 100644 --- a/ansible_mitogen/mixins.py +++ b/ansible_mitogen/mixins.py @@ -32,7 +32,6 @@ import logging import os import pwd import shutil -import tempfile import traceback from ansible.module_utils._text import to_bytes @@ -43,11 +42,6 @@ import ansible.constants import ansible.plugins import ansible.plugins.action -try: - from ansible.plugins.loader import module_loader -except ImportError: # Ansible<2.4 - from ansible.plugins import module_loader - import mitogen.core import mitogen.select import mitogen.utils diff --git a/ansible_mitogen/module_finder.py b/ansible_mitogen/module_finder.py index 1d062454..79e1882c 100644 --- a/ansible_mitogen/module_finder.py +++ b/ansible_mitogen/module_finder.py @@ -85,7 +85,7 @@ def find(name, path=(), parent=None): head, _, tail = name.partition('.') try: tup = imp.find_module(head, list(path)) - except ImportError as e: + except ImportError: return parent fp, modpath, (suffix, mode, kind) = tup diff --git a/ansible_mitogen/planner.py b/ansible_mitogen/planner.py index c540119b..1006956c 100644 --- a/ansible_mitogen/planner.py +++ b/ansible_mitogen/planner.py @@ -52,9 +52,7 @@ except ImportError: # Ansible <2.4 from ansible.plugins import module_utils_loader import mitogen -import mitogen.service import ansible_mitogen.target -import ansible_mitogen.services LOG = logging.getLogger(__name__) diff --git a/ansible_mitogen/process.py b/ansible_mitogen/process.py index e97d695d..c4f58310 100644 --- a/ansible_mitogen/process.py +++ b/ansible_mitogen/process.py @@ -136,7 +136,7 @@ class MuxProcess(object): """ Construct a Router, Broker, and mitogen.unix listener """ - self.router = mitogen.master.Router(max_message_size=4096*1048576) + self.router = mitogen.master.Router(max_message_size=4096 * 1048576) self.router.responder.whitelist_prefix('ansible') self.router.responder.whitelist_prefix('ansible_mitogen') mitogen.core.listen(self.router.broker, 'shutdown', self.on_broker_shutdown) diff --git a/ansible_mitogen/runner.py b/ansible_mitogen/runner.py index 522f1e2e..e14d26bd 100644 --- a/ansible_mitogen/runner.py +++ b/ansible_mitogen/runner.py @@ -42,7 +42,6 @@ import imp import json import logging import os -import shutil import sys import tempfile import types diff --git a/ansible_mitogen/strategy.py b/ansible_mitogen/strategy.py index ce528c7f..2fd4cb91 100644 --- a/ansible_mitogen/strategy.py +++ b/ansible_mitogen/strategy.py @@ -29,7 +29,6 @@ from __future__ import absolute_import import os -import ansible.errors import ansible_mitogen.mixins import ansible_mitogen.process diff --git a/ansible_mitogen/target.py b/ansible_mitogen/target.py index 3ac97c2f..6dbaca8c 100644 --- a/ansible_mitogen/target.py +++ b/ansible_mitogen/target.py @@ -32,7 +32,6 @@ for file transfer, module execution and sundry bits like changing file modes. """ from __future__ import absolute_import -import cStringIO import errno import grp import json @@ -44,7 +43,6 @@ import re import stat import subprocess import tempfile -import time import traceback import ansible.module_utils.json_utils diff --git a/mitogen/service.py b/mitogen/service.py index 3e05deb7..62180e33 100644 --- a/mitogen/service.py +++ b/mitogen/service.py @@ -34,6 +34,7 @@ import pwd import stat import sys import threading +import time import mitogen.core import mitogen.select