Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-subprocrunner for 
openSUSE:Factory checked in at 2022-10-12 18:24:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-subprocrunner (Old)
 and      /work/SRC/openSUSE:Factory/.python-subprocrunner.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-subprocrunner"

Wed Oct 12 18:24:22 2022 rev:9 rq:1009831 version:2.0.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-subprocrunner/python-subprocrunner.changes    
    2022-04-22 21:55:45.914909300 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-subprocrunner.new.2275/python-subprocrunner.changes
      2022-10-12 18:25:50.601837135 +0200
@@ -1,0 +2,8 @@
+Tue Oct 11 15:32:48 UTC 2022 - Yogalakshmi Arunachalam <[email protected]>
+
+- Update to version 2.0.0 
+  Drop support for Python 3.5
+  Add input/encoding keyword arguments to run method
+  Add raise_for_returncode method to SubprocessRunner class
+
+-------------------------------------------------------------------

Old:
----
  subprocrunner-1.6.0.tar.gz

New:
----
  subprocrunner-2.0.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-subprocrunner.spec ++++++
--- /var/tmp/diff_new_pack.bB5s2K/_old  2022-10-12 18:25:51.681839834 +0200
+++ /var/tmp/diff_new_pack.bB5s2K/_new  2022-10-12 18:25:51.693839863 +0200
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-subprocrunner
-Version:        1.6.0
+Version:        2.0.0
 Release:        0
 Summary:        A Python wrapper library for subprocess module
 License:        MIT

++++++ subprocrunner-1.6.0.tar.gz -> subprocrunner-2.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/PKG-INFO 
new/subprocrunner-2.0.0/PKG-INFO
--- old/subprocrunner-1.6.0/PKG-INFO    2021-06-05 13:14:36.910000000 +0200
+++ new/subprocrunner-2.0.0/PKG-INFO    2022-01-15 13:56:57.050000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: subprocrunner
-Version: 1.6.0
+Version: 2.0.0
 Summary: A Python wrapper library for subprocess module.
 Home-page: https://github.com/thombashi/subprocrunner
 Author: Tsuyoshi Hombashi
@@ -8,165 +8,6 @@
 License: MIT License
 Project-URL: Source, https://github.com/thombashi/subprocrunner
 Project-URL: Tracker, https://github.com/thombashi/subprocrunner/issues
-Description: .. contents:: **subprocrunner**
-           :backlinks: top
-           :depth: 2
-        
-        
-        Summary
-        =============
-        A Python wrapper library for subprocess module.
-        
-        
-        .. image:: https://badge.fury.io/py/subprocrunner.svg
-            :target: https://badge.fury.io/py/subprocrunner
-            :alt: PyPI package version
-        
-        .. image:: https://img.shields.io/pypi/pyversions/subprocrunner.svg
-            :target: https://pypi.org/project/subprocrunner
-            :alt: Supported Python versions
-        
-        .. image:: https://img.shields.io/pypi/implementation/subprocrunner.svg
-            :target: https://pypi.org/project/subprocrunner
-            :alt: Supported Python implementations
-        
-        .. image:: 
https://github.com/thombashi/subprocrunner/workflows/Tests/badge.svg
-            :target: 
https://github.com/thombashi/subprocrunner/actions/workflows/tests.yml
-            :alt: Test result of Linux/macOS/Windows
-        
-        .. image:: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint.yml/badge.svg
-            :target: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint.yml
-            :alt: Lint result
-        
-        .. image:: 
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
-            :target: 
https://coveralls.io/github/thombashi/subprocrunner?branch=master
-            :alt: Test coverage
-        
-        
-        Examples
-        ========
-        Execute a command
-        ----------------------------
-        :Sample Code:
-            .. code:: python
-        
-                from subprocrunner import SubprocessRunner
-        
-                runner = SubprocessRunner(["echo", "test"])
-                print(runner)
-                print(f"return code: {runner.run()}")
-                print(f"stdout: {runner.stdout}")
-                
-                runner = SubprocessRunner(["ls", "__not_exist_dir__"])
-                print(runner)
-                print(f"return code: {runner.run()}")
-                print(f"stderr: {runner.stderr}")
-                
-        :Output:
-            .. code::
-        
-                SubprocessRunner(command='echo test', returncode='not yet 
executed')
-                return code: 0
-                stdout: test
-                
-                SubprocessRunner(command='ls __not_exist_dir__', 
returncode='not yet executed')
-                return code: 2
-                stderr: ls: cannot access '__not_exist_dir__': No such file or 
directory
-        
-        Execute a command with retry
-        --------------------------------------------------------
-        
-        :Sample Code:
-            .. code:: python
-        
-                from subprocrunner import Retry, SubprocessRunner
-        
-                SubprocessRunner(command).run(retry=Retry(total=3, 
backoff_factor=0.2, jitter=0.2))
-        
-        dry run
-        ----------------------------
-        Commands are not actually run when passing ``dry_run=True`` to 
``SubprocessRunner`` class constructor.
-        
-        :Sample Code:
-            .. code:: python
-        
-                from subprocrunner import SubprocessRunner
-        
-                runner = SubprocessRunner("echo test", dry_run=True)
-                print(runner)
-                print(f"return code: {runner.run()}")
-                print(f"stdout: {runner.stdout}")
-                
-        :Output:
-            .. code::
-        
-                SubprocessRunner(command='echo test', returncode='not yet 
executed', dryrun=True)
-                return code: 0
-                stdout: 
-        
-        Get execution command history
-        --------------------------------------------------------
-        :Sample Code:
-            .. code:: python
-        
-                from subprocrunner import SubprocessRunner
-        
-                SubprocessRunner.clear_history()
-                SubprocessRunner.is_save_history = True
-                
-                SubprocessRunner(["echo", "hoge"]).run()
-                SubprocessRunner(["echo", "foo"]).run()
-                
-                print("\n".join(SubprocessRunner.get_history()))
-        
-        :Output:
-            .. code::
-        
-                echo hoge
-                echo foo
-        
-        Get a command information
-        ----------------------------
-        .. code-block:: pycon
-        
-            >>> from subprocrunner import Which
-            >>> which = Which("ls")
-            >>> which.is_exist()
-            True
-            >>> which.abspath()
-            '/usr/bin/ls'
-            >>> which
-            command=ls, is_exist=True, abspath=/usr/bin/ls
-        
-        
-        Installation
-        ============
-        
-        Install from PyPI
-        ------------------------------
-        ::
-        
-            pip install subprocrunner
-        
-        Install from PPA (for Ubuntu)
-        ------------------------------
-        ::
-        
-            sudo add-apt-repository ppa:thombashi/ppa
-            sudo apt update
-            sudo apt install python3-subprocrunner
-        
-        
-        Dependencies
-        ============
-        - Python 3.5+
-        - `Python package dependencies (automatically installed) 
<https://github.com/thombashi/subprocrunner/network/dependencies>`__
-        
-        Optional dependencies
-        ----------------------------------
-        - `loguru <https://github.com/Delgan/loguru>`__
-            - Used for logging if the package installed
-        
 Keywords: library,subprocess
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
@@ -178,7 +19,6 @@
 Classifier: Operating System :: POSIX
 Classifier: Operating System :: POSIX :: Linux
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
@@ -189,7 +29,198 @@
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=3.5
+Requires-Python: >=3.6
 Description-Content-Type: text/x-rst
 Provides-Extra: logging
 Provides-Extra: test
+License-File: LICENSE
+
+.. contents:: **subprocrunner**
+   :backlinks: top
+   :depth: 2
+
+
+Summary
+=============
+A Python wrapper library for ``subprocess`` module.
+
+.. image:: https://badge.fury.io/py/subprocrunner.svg
+    :target: https://badge.fury.io/py/subprocrunner
+    :alt: PyPI package version
+
+.. image:: https://img.shields.io/pypi/pyversions/subprocrunner.svg
+    :target: https://pypi.org/project/subprocrunner
+    :alt: Supported Python versions
+
+.. image:: https://img.shields.io/pypi/implementation/subprocrunner.svg
+    :target: https://pypi.org/project/subprocrunner
+    :alt: Supported Python implementations
+
+.. image:: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml/badge.svg
+    :target: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml
+    :alt: CI status of Linux/macOS/Windows
+
+.. image:: 
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
+    :target: https://coveralls.io/github/thombashi/subprocrunner?branch=master
+    :alt: Test coverage
+
+
+Usage
+========
+Execute a command
+----------------------------
+:Sample Code:
+    .. code:: python
+
+        from subprocrunner import SubprocessRunner
+
+        runner = SubprocessRunner(["echo", "test"])
+        print(runner)
+        print(f"return code: {runner.run()}")
+        print(f"stdout: {runner.stdout}")
+        
+        runner = SubprocessRunner(["ls", "__not_exist_dir__"])
+        print(runner)
+        print(f"return code: {runner.run()}")
+        print(f"stderr: {runner.stderr}")
+        
+:Output:
+    .. code::
+
+        SubprocessRunner(command='echo test', returncode='not yet executed')
+        return code: 0
+        stdout: test
+        
+        SubprocessRunner(command='ls __not_exist_dir__', returncode='not yet 
executed')
+        return code: 2
+        stderr: ls: cannot access '__not_exist_dir__': No such file or 
directory
+
+Execute a command with retry
+--------------------------------------------------------
+
+:Sample Code:
+    .. code:: python
+
+        from subprocrunner import Retry, SubprocessRunner
+
+        SubprocessRunner(command).run(retry=Retry(total=3, backoff_factor=0.2, 
jitter=0.2))
+
+Raise an exception when a command execution failed
+--------------------------------------------------------
+:Sample Code:
+    .. code:: python
+
+        import sys
+        from subprocrunner import SubprocessRunner
+        from subprocrunner.error import CalledProcessError
+
+        runner = SubprocessRunner("ls not-exist-dir")
+
+        # raise an exception at run
+        try:
+            runner.run(check=True)
+        except CalledProcessError as e:
+            print(f"run(check=True): {e}\n{e.stderr}", file=sys.stderr)
+
+
+        # raise an exception after run
+        runner.run()
+        try:
+            runner.raise_for_returncode()
+        except CalledProcessError as e:
+            print(f"raise_for_returncode(): {e}\n{e.stderr}", file=sys.stderr)
+
+:Output:
+    .. code::
+
+        run(check=True): Command 'ls not-exist-dir' returned non-zero exit 
status 2.
+        ls: cannot access 'not-exist-dir': No such file or directory
+
+        raise_for_returncode(): Command 'ls not-exist-dir' returned non-zero 
exit status 2.
+        ls: cannot access 'not-exist-dir': No such file or directory
+
+dry run
+----------------------------
+Commands are not actually run when passing ``dry_run=True`` to 
``SubprocessRunner`` class constructor.
+
+:Sample Code:
+    .. code:: python
+
+        from subprocrunner import SubprocessRunner
+
+        runner = SubprocessRunner("echo test", dry_run=True)
+        print(runner)
+        print(f"return code: {runner.run()}")
+        print(f"stdout: {runner.stdout}")
+        
+:Output:
+    .. code::
+
+        SubprocessRunner(command='echo test', returncode='not yet executed', 
dryrun=True)
+        return code: 0
+        stdout: 
+
+Get execution command history
+--------------------------------------------------------
+:Sample Code:
+    .. code:: python
+
+        from subprocrunner import SubprocessRunner
+
+        SubprocessRunner.clear_history()
+        SubprocessRunner.is_save_history = True
+        
+        SubprocessRunner(["echo", "hoge"]).run()
+        SubprocessRunner(["echo", "foo"]).run()
+        
+        print("\n".join(SubprocessRunner.get_history()))
+
+:Output:
+    .. code::
+
+        echo hoge
+        echo foo
+
+Get a command information
+----------------------------
+.. code-block:: pycon
+
+    >>> from subprocrunner import Which
+    >>> which = Which("ls")
+    >>> which.is_exist()
+    True
+    >>> which.abspath()
+    '/usr/bin/ls'
+    >>> which
+    command=ls, is_exist=True, abspath=/usr/bin/ls
+
+
+Installation
+============
+
+Install from PyPI
+------------------------------
+::
+
+    pip install subprocrunner
+
+Install from PPA (for Ubuntu)
+------------------------------
+::
+
+    sudo add-apt-repository ppa:thombashi/ppa
+    sudo apt update
+    sudo apt install python3-subprocrunner
+
+
+Dependencies
+============
+- Python 3.6+
+- `Python package dependencies (automatically installed) 
<https://github.com/thombashi/subprocrunner/network/dependencies>`__
+
+Optional dependencies
+----------------------------------
+- `loguru <https://github.com/Delgan/loguru>`__
+    - Used for logging if the package installed
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/README.rst 
new/subprocrunner-2.0.0/README.rst
--- old/subprocrunner-1.6.0/README.rst  2021-06-05 13:14:22.000000000 +0200
+++ new/subprocrunner-2.0.0/README.rst  2022-01-15 13:56:25.000000000 +0100
@@ -5,8 +5,7 @@
 
 Summary
 =============
-A Python wrapper library for subprocess module.
-
+A Python wrapper library for ``subprocess`` module.
 
 .. image:: https://badge.fury.io/py/subprocrunner.svg
     :target: https://badge.fury.io/py/subprocrunner
@@ -20,20 +19,16 @@
     :target: https://pypi.org/project/subprocrunner
     :alt: Supported Python implementations
 
-.. image:: https://github.com/thombashi/subprocrunner/workflows/Tests/badge.svg
-    :target: 
https://github.com/thombashi/subprocrunner/actions/workflows/tests.yml
-    :alt: Test result of Linux/macOS/Windows
-
-.. image:: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint.yml/badge.svg
-    :target: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint.yml
-    :alt: Lint result
+.. image:: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml/badge.svg
+    :target: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml
+    :alt: CI status of Linux/macOS/Windows
 
 .. image:: 
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
     :target: https://coveralls.io/github/thombashi/subprocrunner?branch=master
     :alt: Test coverage
 
 
-Examples
+Usage
 ========
 Execute a command
 ----------------------------
@@ -73,6 +68,40 @@
 
         SubprocessRunner(command).run(retry=Retry(total=3, backoff_factor=0.2, 
jitter=0.2))
 
+Raise an exception when a command execution failed
+--------------------------------------------------------
+:Sample Code:
+    .. code:: python
+
+        import sys
+        from subprocrunner import SubprocessRunner
+        from subprocrunner.error import CalledProcessError
+
+        runner = SubprocessRunner("ls not-exist-dir")
+
+        # raise an exception at run
+        try:
+            runner.run(check=True)
+        except CalledProcessError as e:
+            print(f"run(check=True): {e}\n{e.stderr}", file=sys.stderr)
+
+
+        # raise an exception after run
+        runner.run()
+        try:
+            runner.raise_for_returncode()
+        except CalledProcessError as e:
+            print(f"raise_for_returncode(): {e}\n{e.stderr}", file=sys.stderr)
+
+:Output:
+    .. code::
+
+        run(check=True): Command 'ls not-exist-dir' returned non-zero exit 
status 2.
+        ls: cannot access 'not-exist-dir': No such file or directory
+
+        raise_for_returncode(): Command 'ls not-exist-dir' returned non-zero 
exit status 2.
+        ls: cannot access 'not-exist-dir': No such file or directory
+
 dry run
 ----------------------------
 Commands are not actually run when passing ``dry_run=True`` to 
``SubprocessRunner`` class constructor.
@@ -149,7 +178,7 @@
 
 Dependencies
 ============
-- Python 3.5+
+- Python 3.6+
 - `Python package dependencies (automatically installed) 
<https://github.com/thombashi/subprocrunner/network/dependencies>`__
 
 Optional dependencies
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/setup.py 
new/subprocrunner-2.0.0/setup.py
--- old/subprocrunner-1.6.0/setup.py    2021-06-05 13:14:22.000000000 +0200
+++ new/subprocrunner-2.0.0/setup.py    2022-01-15 13:56:25.000000000 +0100
@@ -9,11 +9,11 @@
 
 
 MODULE_NAME = "subprocrunner"
-REPOSITORY_URL = "https://github.com/thombashi/{:s}".format(MODULE_NAME)
+REPOSITORY_URL = f"https://github.com/thombashi/{MODULE_NAME:s}";
 REQUIREMENT_DIR = "requirements"
 ENCODING = "utf8"
 
-pkg_info = {}  # type: Dict[str, str]
+pkg_info: Dict[str, str] = {}
 
 
 def get_release_command_class() -> Dict[str, setuptools.Command]:
@@ -54,8 +54,11 @@
     long_description_content_type="text/x-rst",
     packages=setuptools.find_packages(exclude=["test*"]),
     package_data={MODULE_NAME: ["py.typed"]},
-    project_urls={"Source": REPOSITORY_URL, "Tracker": 
"{:s}/issues".format(REPOSITORY_URL)},
-    python_requires=">=3.5",
+    project_urls={
+        "Source": REPOSITORY_URL,
+        "Tracker": f"{REPOSITORY_URL:s}/issues",
+    },
+    python_requires=">=3.6",
     install_requires=install_requires,
     extras_require={"logging": LOGGING_REQUIRES, "test": tests_requires + 
LOGGING_REQUIRES},
     classifiers=[
@@ -68,7 +71,6 @@
         "Operating System :: POSIX",
         "Operating System :: POSIX :: Linux",
         "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.5",
         "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/subprocrunner/__version__.py 
new/subprocrunner-2.0.0/subprocrunner/__version__.py
--- old/subprocrunner-1.6.0/subprocrunner/__version__.py        2021-06-05 
13:14:22.000000000 +0200
+++ new/subprocrunner-2.0.0/subprocrunner/__version__.py        2022-01-15 
13:56:25.000000000 +0100
@@ -1,6 +1,6 @@
 __author__ = "Tsuyoshi Hombashi"
-__copyright__ = "Copyright 2016, {}".format(__author__)
+__copyright__ = f"Copyright 2016, {__author__}"
 __license__ = "MIT License"
-__version__ = "1.6.0"
+__version__ = "2.0.0"
 __maintainer__ = __author__
 __email__ = "[email protected]"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/subprocrunner/_logger/_logger.py 
new/subprocrunner-2.0.0/subprocrunner/_logger/_logger.py
--- old/subprocrunner-1.6.0/subprocrunner/_logger/_logger.py    2021-06-05 
13:14:22.000000000 +0200
+++ new/subprocrunner-2.0.0/subprocrunner/_logger/_logger.py    2022-01-15 
13:56:25.000000000 +0100
@@ -43,7 +43,7 @@
     log_level = log_level.strip().upper()
     method = method_table.get(log_level)
     if method is None:
-        raise ValueError("unknown log level: {}".format(log_level))
+        raise ValueError(f"unknown log level: {log_level}")
 
     return method
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/subprocrunner-1.6.0/subprocrunner/_subprocess_runner.py 
new/subprocrunner-2.0.0/subprocrunner/_subprocess_runner.py
--- old/subprocrunner-1.6.0/subprocrunner/_subprocess_runner.py 2021-06-05 
13:14:22.000000000 +0200
+++ new/subprocrunner-2.0.0/subprocrunner/_subprocess_runner.py 2022-01-15 
13:56:25.000000000 +0100
@@ -43,7 +43,7 @@
     is_save_history = False
     history_size = 512
 
-    __command_history = []  # type: List[Command]
+    __command_history: List[Command] = []
 
     @classmethod
     def get_history(cls) -> List[Command]:
@@ -61,7 +61,7 @@
         dry_run: Optional[bool] = None,
         quiet: bool = False,
     ) -> None:
-        self.__command = []  # type: Union[str, Sequence[str]]
+        self.__command: Union[str, Sequence[str]] = []
 
         if not command:
             raise ValueError("command is empty")
@@ -77,9 +77,9 @@
             self.__dry_run = dry_run
         else:
             self.__dry_run = self.default_is_dry_run
-        self.__stdout = None  # type: Optional[str]
-        self.__stderr = None  # type: Optional[str]
-        self.__returncode = None  # type: Optional[int]
+        self.__stdout: Optional[str] = None
+        self.__stderr: Optional[str] = None
+        self.__returncode: Optional[int] = None
 
         self.__ignore_stderr_regexp = ignore_stderr_regexp
         self.__debug_logging_method = get_logging_method("QUIET" if quiet else 
"DEBUG")
@@ -95,13 +95,13 @@
 
     def __repr__(self) -> str:
         params = [
-            "command='{}'".format(self.command_str),
+            f"command='{self.command_str}'",
             "returncode={}".format(
                 self.returncode if self.returncode is not None else "'not yet 
executed'"
             ),
         ]
         if self.dry_run:
-            params.append("dry_run={}".format(self.dry_run))
+            params.append(f"dry_run={self.dry_run}")
 
         return "SubprocessRunner({})".format(", ".join(params))
 
@@ -140,7 +140,15 @@
     def error_log_level(self, log_level: Optional[str]):
         self.__error_logging_method = get_logging_method(log_level)
 
-    def _run(self, env, check: bool, timeout: Optional[float] = None, 
**kwargs) -> int:
+    def _run(
+        self,
+        env,
+        check: bool,
+        input: Union[str, bytes, None] = None,
+        encoding: str = "ascii",
+        timeout: Optional[float] = None,
+        **kwargs,
+    ) -> int:
         self.__save_command()
         
self.__debug_print_command(retry_attept=kwargs.get(self._RETRY_ATTEMPT_KEY))
 
@@ -161,7 +169,9 @@
                 self.command, shell=self.__is_shell, stdin=PIPE, stdout=PIPE, 
stderr=PIPE
             )
 
-        stdout, stderr = proc.communicate(timeout=timeout, **kwargs)
+        if input and not isinstance(input, bytes) and encoding:
+            input = input.encode(encoding)
+        stdout, stderr = proc.communicate(input=input, timeout=timeout)  # 
type: ignore
         self.__returncode = proc.returncode
 
         self.__stdout = MultiByteStrDecoder(stdout).unicode_str
@@ -186,21 +196,20 @@
         )
 
         if check is True:
-            raise CalledProcessError(
-                returncode=self.__returncode,
-                cmd=self.command_str,
-                output=self.stdout,
-                stderr=self.stderr,
-            )
+            self.raise_for_returncode()
 
         return self.__returncode
 
-    def run(self, timeout: Optional[float] = None, retry: Retry = None, 
**kwargs) -> int:
+    def run(
+        self,
+        input: Union[str, bytes, None] = None,
+        encoding: Optional[str] = None,
+        timeout: Optional[float] = None,
+        retry: Retry = None,
+        **kwargs,
+    ) -> int:
         self.__verify_command()
 
-        check = kwargs.pop("check", False)
-        env = self.__get_env(kwargs.pop("env", None))
-
         if self.dry_run:
             self.__stdout = self._DRY_RUN_OUTPUT
             self.__stderr = self._DRY_RUN_OUTPUT
@@ -211,8 +220,17 @@
 
             return self.__returncode
 
+        check = kwargs.pop("check", False)
+        env = self.__get_env(kwargs.pop("env", None))
+        encoding = "ascii" if encoding is None else encoding
+
         returncode = self._run(
-            env=env, check=check if retry is None else False, timeout=timeout, 
**kwargs
+            env=env,
+            check=check if retry is None else False,
+            input=input,
+            encoding=encoding,
+            timeout=timeout,
+            **kwargs,
         )
         if retry is None or returncode in [0] + retry.no_retry_returncodes:
             return returncode
@@ -225,17 +243,14 @@
             )
             kwargs[self._RETRY_ATTEMPT_KEY] = i + 1
 
-            returncode = self._run(env=env, check=False, timeout=timeout, 
**kwargs)
+            returncode = self._run(
+                env=env, check=False, input=input, encoding=encoding, 
timeout=timeout, **kwargs
+            )
             if returncode in [0] + retry.no_retry_returncodes:
                 return returncode
 
         if check is True:
-            raise CalledProcessError(
-                returncode=self.__returncode,  # type: ignore
-                cmd=self.command_str,
-                output=self.stdout,
-                stderr=self.stderr,
-            )
+            self.raise_for_returncode()
 
         return self.__returncode  # type: ignore
 
@@ -268,10 +283,23 @@
 
         return process
 
+    def raise_for_returncode(self) -> None:
+        if self.__returncode in [None, 0]:
+            return
+
+        assert self.__returncode
+
+        raise CalledProcessError(
+            returncode=self.__returncode,
+            cmd=self.command_str,
+            output=self.stdout,
+            stderr=self.stderr,
+        )
+
     def __verify_command(self) -> None:
         if not self.command:
             raise CommandError(
-                "invalid command: {}".format(self.command), 
cmd=self.command_str, errno=errno.EINVAL
+                f"invalid command: {self.command}", cmd=self.command_str, 
errno=errno.EINVAL
             )
 
         if self.dry_run or platform.system() == "Windows":
@@ -313,7 +341,7 @@
             message_list.append("dryrun: ")
 
         if retry_attept is not None:
-            message_list.append("retry-attempt={}: {}".format(retry_attept, 
self.command_str))
+            message_list.append(f"retry-attempt={retry_attept}: 
{self.command_str}")
         else:
             message_list.append(self.command_str)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/subprocrunner/_which.py 
new/subprocrunner-2.0.0/subprocrunner/_which.py
--- old/subprocrunner-1.6.0/subprocrunner/_which.py     2021-06-05 
13:14:22.000000000 +0200
+++ new/subprocrunner-2.0.0/subprocrunner/_which.py     2022-01-15 
13:56:25.000000000 +0100
@@ -25,17 +25,17 @@
 
         self.__command = command
         self.__follow_symlinks = follow_symlinks
-        self.__abspath = None  # type: Optional[str]
+        self.__abspath: Optional[str] = None
 
     def __repr__(self) -> str:
         item_list = [
-            "command={}".format(self.command),
-            "is_exist={}".format(self.is_exist()),
-            "follow_symlinks={}".format(self.__follow_symlinks),
+            f"command={self.command}",
+            f"is_exist={self.is_exist()}",
+            f"follow_symlinks={self.__follow_symlinks}",
         ]
 
         if self.is_exist():
-            item_list.append("abspath={}".format(self.abspath()))
+            item_list.append(f"abspath={self.abspath()}")
 
         return ", ".join(item_list)
 
@@ -45,7 +45,7 @@
     def verify(self) -> None:
         if not self.is_exist():
             raise CommandError(
-                "command not found: {}".format(self.command), 
cmd=self.command, errno=errno.ENOENT
+                f"command not found: {self.command}", cmd=self.command, 
errno=errno.ENOENT
             )
 
     def abspath(self) -> Optional[str]:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/subprocrunner/retry.py 
new/subprocrunner-2.0.0/subprocrunner/retry.py
--- old/subprocrunner-1.6.0/subprocrunner/retry.py      2021-06-05 
13:14:22.000000000 +0200
+++ new/subprocrunner-2.0.0/subprocrunner/retry.py      2022-01-15 
13:56:25.000000000 +0100
@@ -33,13 +33,13 @@
 
     def __repr__(self) -> str:
         msgs = [
-            "total={}".format(self.total),
-            "backoff-factor={}".format(self.__backoff_factor),
-            "jitter={}".format(self.__jitter),
+            f"total={self.total}",
+            f"backoff-factor={self.__backoff_factor}",
+            f"jitter={self.__jitter}",
         ]
 
         if self.no_retry_returncodes:
-            
msgs.append("no-retry-returncodes={}".format(self.no_retry_returncodes))
+            msgs.append(f"no-retry-returncodes={self.no_retry_returncodes}")
 
         return "Retry({})".format(", ".join(msgs))
 
@@ -59,11 +59,11 @@
 
         if logging_method and not self.__quiet:
             if retry_target:
-                msg = "Retrying '{}' in ".format(retry_target)
+                msg = f"Retrying '{retry_target}' in "
             else:
                 msg = "Retrying in "
 
-            msg += "{:.2f} seconds ... (attempt={}/{})".format(sleep_duration, 
attempt, self.total)
+            msg += f"{sleep_duration:.2f} seconds ... 
(attempt={attempt}/{self.total})"
 
             logging_method(msg)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/subprocrunner.egg-info/PKG-INFO 
new/subprocrunner-2.0.0/subprocrunner.egg-info/PKG-INFO
--- old/subprocrunner-1.6.0/subprocrunner.egg-info/PKG-INFO     2021-06-05 
13:14:36.000000000 +0200
+++ new/subprocrunner-2.0.0/subprocrunner.egg-info/PKG-INFO     2022-01-15 
13:56:56.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: subprocrunner
-Version: 1.6.0
+Version: 2.0.0
 Summary: A Python wrapper library for subprocess module.
 Home-page: https://github.com/thombashi/subprocrunner
 Author: Tsuyoshi Hombashi
@@ -8,165 +8,6 @@
 License: MIT License
 Project-URL: Source, https://github.com/thombashi/subprocrunner
 Project-URL: Tracker, https://github.com/thombashi/subprocrunner/issues
-Description: .. contents:: **subprocrunner**
-           :backlinks: top
-           :depth: 2
-        
-        
-        Summary
-        =============
-        A Python wrapper library for subprocess module.
-        
-        
-        .. image:: https://badge.fury.io/py/subprocrunner.svg
-            :target: https://badge.fury.io/py/subprocrunner
-            :alt: PyPI package version
-        
-        .. image:: https://img.shields.io/pypi/pyversions/subprocrunner.svg
-            :target: https://pypi.org/project/subprocrunner
-            :alt: Supported Python versions
-        
-        .. image:: https://img.shields.io/pypi/implementation/subprocrunner.svg
-            :target: https://pypi.org/project/subprocrunner
-            :alt: Supported Python implementations
-        
-        .. image:: 
https://github.com/thombashi/subprocrunner/workflows/Tests/badge.svg
-            :target: 
https://github.com/thombashi/subprocrunner/actions/workflows/tests.yml
-            :alt: Test result of Linux/macOS/Windows
-        
-        .. image:: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint.yml/badge.svg
-            :target: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint.yml
-            :alt: Lint result
-        
-        .. image:: 
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
-            :target: 
https://coveralls.io/github/thombashi/subprocrunner?branch=master
-            :alt: Test coverage
-        
-        
-        Examples
-        ========
-        Execute a command
-        ----------------------------
-        :Sample Code:
-            .. code:: python
-        
-                from subprocrunner import SubprocessRunner
-        
-                runner = SubprocessRunner(["echo", "test"])
-                print(runner)
-                print(f"return code: {runner.run()}")
-                print(f"stdout: {runner.stdout}")
-                
-                runner = SubprocessRunner(["ls", "__not_exist_dir__"])
-                print(runner)
-                print(f"return code: {runner.run()}")
-                print(f"stderr: {runner.stderr}")
-                
-        :Output:
-            .. code::
-        
-                SubprocessRunner(command='echo test', returncode='not yet 
executed')
-                return code: 0
-                stdout: test
-                
-                SubprocessRunner(command='ls __not_exist_dir__', 
returncode='not yet executed')
-                return code: 2
-                stderr: ls: cannot access '__not_exist_dir__': No such file or 
directory
-        
-        Execute a command with retry
-        --------------------------------------------------------
-        
-        :Sample Code:
-            .. code:: python
-        
-                from subprocrunner import Retry, SubprocessRunner
-        
-                SubprocessRunner(command).run(retry=Retry(total=3, 
backoff_factor=0.2, jitter=0.2))
-        
-        dry run
-        ----------------------------
-        Commands are not actually run when passing ``dry_run=True`` to 
``SubprocessRunner`` class constructor.
-        
-        :Sample Code:
-            .. code:: python
-        
-                from subprocrunner import SubprocessRunner
-        
-                runner = SubprocessRunner("echo test", dry_run=True)
-                print(runner)
-                print(f"return code: {runner.run()}")
-                print(f"stdout: {runner.stdout}")
-                
-        :Output:
-            .. code::
-        
-                SubprocessRunner(command='echo test', returncode='not yet 
executed', dryrun=True)
-                return code: 0
-                stdout: 
-        
-        Get execution command history
-        --------------------------------------------------------
-        :Sample Code:
-            .. code:: python
-        
-                from subprocrunner import SubprocessRunner
-        
-                SubprocessRunner.clear_history()
-                SubprocessRunner.is_save_history = True
-                
-                SubprocessRunner(["echo", "hoge"]).run()
-                SubprocessRunner(["echo", "foo"]).run()
-                
-                print("\n".join(SubprocessRunner.get_history()))
-        
-        :Output:
-            .. code::
-        
-                echo hoge
-                echo foo
-        
-        Get a command information
-        ----------------------------
-        .. code-block:: pycon
-        
-            >>> from subprocrunner import Which
-            >>> which = Which("ls")
-            >>> which.is_exist()
-            True
-            >>> which.abspath()
-            '/usr/bin/ls'
-            >>> which
-            command=ls, is_exist=True, abspath=/usr/bin/ls
-        
-        
-        Installation
-        ============
-        
-        Install from PyPI
-        ------------------------------
-        ::
-        
-            pip install subprocrunner
-        
-        Install from PPA (for Ubuntu)
-        ------------------------------
-        ::
-        
-            sudo add-apt-repository ppa:thombashi/ppa
-            sudo apt update
-            sudo apt install python3-subprocrunner
-        
-        
-        Dependencies
-        ============
-        - Python 3.5+
-        - `Python package dependencies (automatically installed) 
<https://github.com/thombashi/subprocrunner/network/dependencies>`__
-        
-        Optional dependencies
-        ----------------------------------
-        - `loguru <https://github.com/Delgan/loguru>`__
-            - Used for logging if the package installed
-        
 Keywords: library,subprocess
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
@@ -178,7 +19,6 @@
 Classifier: Operating System :: POSIX
 Classifier: Operating System :: POSIX :: Linux
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
@@ -189,7 +29,198 @@
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=3.5
+Requires-Python: >=3.6
 Description-Content-Type: text/x-rst
 Provides-Extra: logging
 Provides-Extra: test
+License-File: LICENSE
+
+.. contents:: **subprocrunner**
+   :backlinks: top
+   :depth: 2
+
+
+Summary
+=============
+A Python wrapper library for ``subprocess`` module.
+
+.. image:: https://badge.fury.io/py/subprocrunner.svg
+    :target: https://badge.fury.io/py/subprocrunner
+    :alt: PyPI package version
+
+.. image:: https://img.shields.io/pypi/pyversions/subprocrunner.svg
+    :target: https://pypi.org/project/subprocrunner
+    :alt: Supported Python versions
+
+.. image:: https://img.shields.io/pypi/implementation/subprocrunner.svg
+    :target: https://pypi.org/project/subprocrunner
+    :alt: Supported Python implementations
+
+.. image:: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml/badge.svg
+    :target: 
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml
+    :alt: CI status of Linux/macOS/Windows
+
+.. image:: 
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
+    :target: https://coveralls.io/github/thombashi/subprocrunner?branch=master
+    :alt: Test coverage
+
+
+Usage
+========
+Execute a command
+----------------------------
+:Sample Code:
+    .. code:: python
+
+        from subprocrunner import SubprocessRunner
+
+        runner = SubprocessRunner(["echo", "test"])
+        print(runner)
+        print(f"return code: {runner.run()}")
+        print(f"stdout: {runner.stdout}")
+        
+        runner = SubprocessRunner(["ls", "__not_exist_dir__"])
+        print(runner)
+        print(f"return code: {runner.run()}")
+        print(f"stderr: {runner.stderr}")
+        
+:Output:
+    .. code::
+
+        SubprocessRunner(command='echo test', returncode='not yet executed')
+        return code: 0
+        stdout: test
+        
+        SubprocessRunner(command='ls __not_exist_dir__', returncode='not yet 
executed')
+        return code: 2
+        stderr: ls: cannot access '__not_exist_dir__': No such file or 
directory
+
+Execute a command with retry
+--------------------------------------------------------
+
+:Sample Code:
+    .. code:: python
+
+        from subprocrunner import Retry, SubprocessRunner
+
+        SubprocessRunner(command).run(retry=Retry(total=3, backoff_factor=0.2, 
jitter=0.2))
+
+Raise an exception when a command execution failed
+--------------------------------------------------------
+:Sample Code:
+    .. code:: python
+
+        import sys
+        from subprocrunner import SubprocessRunner
+        from subprocrunner.error import CalledProcessError
+
+        runner = SubprocessRunner("ls not-exist-dir")
+
+        # raise an exception at run
+        try:
+            runner.run(check=True)
+        except CalledProcessError as e:
+            print(f"run(check=True): {e}\n{e.stderr}", file=sys.stderr)
+
+
+        # raise an exception after run
+        runner.run()
+        try:
+            runner.raise_for_returncode()
+        except CalledProcessError as e:
+            print(f"raise_for_returncode(): {e}\n{e.stderr}", file=sys.stderr)
+
+:Output:
+    .. code::
+
+        run(check=True): Command 'ls not-exist-dir' returned non-zero exit 
status 2.
+        ls: cannot access 'not-exist-dir': No such file or directory
+
+        raise_for_returncode(): Command 'ls not-exist-dir' returned non-zero 
exit status 2.
+        ls: cannot access 'not-exist-dir': No such file or directory
+
+dry run
+----------------------------
+Commands are not actually run when passing ``dry_run=True`` to 
``SubprocessRunner`` class constructor.
+
+:Sample Code:
+    .. code:: python
+
+        from subprocrunner import SubprocessRunner
+
+        runner = SubprocessRunner("echo test", dry_run=True)
+        print(runner)
+        print(f"return code: {runner.run()}")
+        print(f"stdout: {runner.stdout}")
+        
+:Output:
+    .. code::
+
+        SubprocessRunner(command='echo test', returncode='not yet executed', 
dryrun=True)
+        return code: 0
+        stdout: 
+
+Get execution command history
+--------------------------------------------------------
+:Sample Code:
+    .. code:: python
+
+        from subprocrunner import SubprocessRunner
+
+        SubprocessRunner.clear_history()
+        SubprocessRunner.is_save_history = True
+        
+        SubprocessRunner(["echo", "hoge"]).run()
+        SubprocessRunner(["echo", "foo"]).run()
+        
+        print("\n".join(SubprocessRunner.get_history()))
+
+:Output:
+    .. code::
+
+        echo hoge
+        echo foo
+
+Get a command information
+----------------------------
+.. code-block:: pycon
+
+    >>> from subprocrunner import Which
+    >>> which = Which("ls")
+    >>> which.is_exist()
+    True
+    >>> which.abspath()
+    '/usr/bin/ls'
+    >>> which
+    command=ls, is_exist=True, abspath=/usr/bin/ls
+
+
+Installation
+============
+
+Install from PyPI
+------------------------------
+::
+
+    pip install subprocrunner
+
+Install from PPA (for Ubuntu)
+------------------------------
+::
+
+    sudo add-apt-repository ppa:thombashi/ppa
+    sudo apt update
+    sudo apt install python3-subprocrunner
+
+
+Dependencies
+============
+- Python 3.6+
+- `Python package dependencies (automatically installed) 
<https://github.com/thombashi/subprocrunner/network/dependencies>`__
+
+Optional dependencies
+----------------------------------
+- `loguru <https://github.com/Delgan/loguru>`__
+    - Used for logging if the package installed
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/test/test_subproc_runner.py 
new/subprocrunner-2.0.0/test/test_subproc_runner.py
--- old/subprocrunner-1.6.0/test/test_subproc_runner.py 2021-06-05 
13:14:22.000000000 +0200
+++ new/subprocrunner-2.0.0/test/test_subproc_runner.py 2022-01-15 
13:56:25.000000000 +0100
@@ -7,7 +7,6 @@
 import os
 import platform
 import re
-import subprocess
 import sys
 from subprocess import PIPE
 
@@ -135,10 +134,10 @@
         assert runner.returncode != 0
 
         out, err = capsys.readouterr()
-        print("[sys stdout]\n{}\n".format(out))
-        print("[sys stderr]\n{}\n".format(err))
-        print("[proc stdout]\n{}\n".format(runner.stdout))
-        print("[proc stderr]\n{}\n".format(runner.stderr))
+        print(f"[sys stdout]\n{out}\n")
+        print(f"[sys stderr]\n{err}\n")
+        print(f"[proc stdout]\n{runner.stdout}\n")
+        print(f"[proc stderr]\n{runner.stderr}\n")
 
         actual = out_regexp.search(err) is not None
         assert actual == expected
@@ -160,6 +159,15 @@
             with pytest.raises(expected):
                 runner.run(check=True)
 
+    def test_input_kwarg(self, mocker):
+        mocked_communicate = mocker.patch("subprocess.Popen.communicate")
+        mocked_communicate.return_value = ("", "")
+
+        runner = SubprocessRunner(list_command)
+        runner.run(input="test input")
+
+        mocked_communicate.assert_called_with(input=b"test input", 
timeout=None)
+
     def test_timeout_kwarg(self, mocker):
         mocked_communicate = mocker.patch("subprocess.Popen.communicate")
         mocked_communicate.return_value = ("", "")
@@ -168,13 +176,14 @@
         runner = SubprocessRunner("dummy")
         runner.run(timeout=1)
 
-        mocked_communicate.assert_called_with(timeout=1)
+        mocked_communicate.assert_called_with(input=None, timeout=1)
 
-    def test_unicode(self, monkeypatch):
-        def monkey_communicate(input=None, timeout=None):
-            return ("", "'dummy' 
??????????????????????????????????????????????????????" 
"???????????????????????????????????????????????? 
????????????????????????????????????????????????")
-
-        monkeypatch.setattr(subprocess.Popen, "communicate", 
monkey_communicate)
+    def test_unicode(self, mocker):
+        mocked_communicate = mocker.patch("subprocess.Popen.communicate")
+        mocked_communicate.return_value = (
+            "",
+            "'dummy' ??????????????????????????????????????????????????????" 
"???????????????????????????????????????????????? 
????????????????????????????????????????????????",
+        )
 
         runner = SubprocessRunner(list_command)
         runner.run()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/subprocrunner-1.6.0/tox.ini 
new/subprocrunner-2.0.0/tox.ini
--- old/subprocrunner-1.6.0/tox.ini     2021-06-05 13:14:22.000000000 +0200
+++ new/subprocrunner-2.0.0/tox.ini     2022-01-15 13:56:25.000000000 +0100
@@ -1,6 +1,6 @@
 [tox]
 envlist =
-    py{35,36,37,38,39,310}
+    py{36,37,38,39,310}
     pypy3
     build
     clean
@@ -27,7 +27,7 @@
 [testenv:clean]
 skip_install = true
 deps =
-    cleanpy
+    cleanpy>=0.3.1
 commands =
     cleanpy --all --exclude-envs .
 
@@ -44,7 +44,7 @@
 skip_install = true
 deps =
     autoflake
-    black
+    black[jupyter]
     isort>=5
 commands =
     autoflake --in-place --recursive --remove-all-unused-imports 
--ignore-init-module-imports .
@@ -56,8 +56,8 @@
 skip_install = true
 deps =
     codespell
-    mypy
-    pylama
+    mypy>=0.910
+    pylama>=8.3.6
 commands =
     python setup.py check
     mypy subprocrunner

Reply via email to