diff --git a/docs/conf.py b/docs/conf.py index e850102..d798e42 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # procrunner documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. @@ -48,9 +47,9 @@ master_doc = "index" # General information about the project. -project = u"ProcRunner" -copyright = u"2018, Markus Gerstel" -author = u"Markus Gerstel" +project = "ProcRunner" +copyright = "2020, Markus Gerstel" +author = "Markus Gerstel" # The version info for the project you're documenting, acts as replacement # for |version| and |release|, also used in various other places throughout @@ -129,8 +128,8 @@ ( master_doc, "procrunner.tex", - u"ProcRunner Documentation", - u"Markus Gerstel", + "ProcRunner Documentation", + "Markus Gerstel", "manual", ) ] @@ -140,7 +139,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, "procrunner", u"ProcRunner Documentation", [author], 1)] +man_pages = [(master_doc, "procrunner", "ProcRunner Documentation", [author], 1)] # -- Options for Texinfo output ---------------------------------------- @@ -152,7 +151,7 @@ ( master_doc, "procrunner", - u"ProcRunner Documentation", + "ProcRunner Documentation", author, "procrunner", "One line description of project.", diff --git a/procrunner/__init__.py b/procrunner/__init__.py index f6fe75b..ad214bc 100644 --- a/procrunner/__init__.py +++ b/procrunner/__init__.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- - -from __future__ import absolute_import, division, print_function - import codecs import io import logging @@ -58,7 +54,7 @@ logger.addHandler(logging.NullHandler()) -class _LineAggregator(object): +class _LineAggregator: """ Buffer that can be filled with stream data and will aggregate complete lines. Lines can be printed or passed to an arbitrary callback function. @@ -107,7 +103,7 @@ self._buffer = "" -class _NonBlockingStreamReader(object): +class _NonBlockingStreamReader: """Reads a stream in a thread to avoid blocking/deadlocks""" def __init__(self, stream, output=True, debug=False, notify=None, callback=None): @@ -201,7 +197,7 @@ return data -class _NonBlockingStreamWriter(object): +class _NonBlockingStreamWriter: """Writes to a stream in a thread to avoid blocking/deadlocks""" def __init__(self, stream, data, debug=False, notify=None): @@ -224,7 +220,7 @@ block = self._buffer[self._buffer_pos :] try: self._stream.write(block) - except IOError as e: + except OSError as e: if ( e.errno == 32 ): # broken pipe, ie. process terminated without reading entire stdin @@ -316,7 +312,7 @@ """ def __init__(self, *arg, **kw): - super(ReturnObject, self).__init__(*arg, **kw) + super().__init__(*arg, **kw) self.args = self["command"] self.returncode = self["exitcode"] self.stdout = self["stdout"] diff --git a/tests/test_procrunner.py b/tests/test_procrunner.py index c645968..b174d1d 100644 --- a/tests/test_procrunner.py +++ b/tests/test_procrunner.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import copy import mock import os @@ -150,7 +148,6 @@ random_environment_variable = list(os.environ)[0] if random_environment_variable == list(mock_env2)[0]: random_environment_variable = list(os.environ)[1] - random_environment_value = os.getenv(random_environment_variable) assert ( random_environment_variable and random_environment_variable != list(mock_env2)[0] @@ -192,7 +189,7 @@ def test_nonblockingstreamreader_can_read(mock_select): import time - class _stream(object): + class _stream: def __init__(self): self.data = b"" self.closed = False diff --git a/tests/test_procrunner_resolution.py b/tests/test_procrunner_resolution.py index ae00e90..2237c7c 100644 --- a/tests/test_procrunner_resolution.py +++ b/tests/test_procrunner_resolution.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import os import sys diff --git a/tests/test_procrunner_system.py b/tests/test_procrunner_system.py index 5955463..7442deb 100644 --- a/tests/test_procrunner_system.py +++ b/tests/test_procrunner_system.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import os import sys @@ -36,8 +34,8 @@ else: assert result.stdout == test_string out, err = capsys.readouterr() - assert out == u"test\ufffdstring\n" - assert err == u"" + assert out == "test\ufffdstring\n" + assert err == "" def test_running_wget(tmpdir):