diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2019-02-07 11:31:45 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-03-20 15:57:20 +0000 |
commit | cfbf75bb36a170d9e62b6029104a3af51016cb58 (patch) | |
tree | e82ddf5d3ad6fba23ba5b76c040980c44b8ffd40 | |
parent | a3d60c2c71ed87f02492c153346b72602f356cc0 (diff) | |
download | sos-cfbf75bb36a170d9e62b6029104a3af51016cb58.tar.gz |
[general] remove duplicit module imports
Relevant to: #1559
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/policies/__init__.py | 3 | ||||
-rw-r--r-- | sos/reporting.py | 3 | ||||
-rw-r--r-- | sos/sosreport.py | 6 | ||||
-rw-r--r-- | sos/utilities.py | 3 |
4 files changed, 5 insertions, 10 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index 07c3f922..07e07970 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -9,7 +9,6 @@ import fnmatch import tempfile import random import string -from os import environ from sos.utilities import (ImporterHelper, import_module, @@ -627,7 +626,7 @@ No changes will be made to system configuration. self.commons = commons def _set_PATH(self, path): - environ['PATH'] = path + os.environ['PATH'] = path def set_exec_path(self): self._set_PATH(self.PATH) diff --git a/sos/reporting.py b/sos/reporting.py index 0d42fd06..cb97e473 100644 --- a/sos/reporting.py +++ b/sos/reporting.py @@ -19,7 +19,6 @@ except ImportError: import simplejson as json # PYCOMPAT -from six import iteritems import six @@ -146,7 +145,7 @@ class PlainTextReport(object): def unicode(self): self.line_buf = line_buf = [] - for section_name, section_contents in sorted(iteritems( + for section_name, section_contents in sorted(six.iteritems( self.report_node.data)): line_buf.append(section_name + "\n" + self.DIVIDER) for type_, format_, header in self.subsections: diff --git a/sos/sosreport.py b/sos/sosreport.py index 0845f9f2..6337a0c8 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -41,7 +41,6 @@ from sos.reporting import (Report, Section, Command, CopiedFile, CreatedFile, # PYCOMPAT import six from six.moves import zip, input -from six import print_ # file system errors that should terminate a run fatal_fs_errors = (errno.ENOSPC, errno.EROFS) @@ -407,11 +406,10 @@ class SoSReport(object): # device, so we call the default hook sys.__excepthook__(etype, eval_, etrace) else: - import pdb # we are NOT in interactive mode, print the exception... traceback.print_exception(etype, eval_, etrace, limit=2, file=sys.stdout) - print_() + six.print_() # ...then start the debugger in post-mortem mode. pdb.pm() @@ -430,7 +428,7 @@ class SoSReport(object): (etype, val, tb) = sys.exc_info() # we are NOT in interactive mode, print the exception... traceback.print_exception(etype, val, tb, file=sys.stdout) - print_() + six.print_() # ...then start the debugger in post-mortem mode. pdb.post_mortem(tb) if plugname and func: diff --git a/sos/utilities.py b/sos/utilities.py index 6ab4e18d..bd7004b9 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -24,7 +24,6 @@ from collections import deque # PYCOMPAT import six -from six import StringIO def tail(filename, number_of_bytes): @@ -43,7 +42,7 @@ def fileobj(path_or_file, mode='r'): except IOError: log = logging.getLogger('sos') log.debug("fileobj: %s could not be opened" % path_or_file) - return closing(StringIO()) + return closing(six.StringIO()) else: return closing(path_or_file) |