diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0baff51b..aac023fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,11 +14,10 @@ jobs: matrix: python-version: - "pypy-3.8-v7.3.10" + - "3.12" - "3.11" - "3.10" - "3.9" - - "3.8" - - "3.7" os: [ubuntu-latest] runs-on: ${{ matrix.os }} name: "${{ matrix.os }} Python: ${{ matrix.python-version }}" @@ -26,7 +25,7 @@ jobs: - name: Setup Python for tox uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - name: Install tox run: python -m pip install tox tox-gh-actions - uses: actions/checkout@v3 diff --git a/.github/workflows/do-lint.yml b/.github/workflows/do-lint.yml index 77e23abb..2be42685 100644 --- a/.github/workflows/do-lint.yml +++ b/.github/workflows/do-lint.yml @@ -15,7 +15,7 @@ jobs: - name: Setup Python for linting uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - name: Install tox run: python -m pip install tox tox-gh-actions - uses: actions/checkout@v3 diff --git a/docs/source/conf.py b/docs/source/conf.py index b51d356e..43760d14 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,7 +11,7 @@ project = "docformatter" copyright = "2022-2023, Steven Myint" author = "Steven Myint" -release = "1.7.5" +release = "1.7.6" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/pyproject.toml b/pyproject.toml index b91d7bfa..8b9f0938 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "docformatter" -version = "1.7.5" +version = "1.7.6" description = "Formats docstrings to follow PEP 257" authors = ["Steven Myint"] maintainers = [ @@ -18,11 +18,10 @@ classifiers=[ 'Intended Audience :: Developers', 'Environment :: Console', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: Implementation', 'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: Python :: Implementation :: CPython', @@ -37,7 +36,7 @@ charset_normalizer = "^3.0.0" tomli = {version = "^2.0.0", python = "<3.11", optional = true} untokenize = "^0.1.1" -[tool.poetry.dev-dependencies] +[poetry.group.dev-dependencies] autopep8 = "^2.0.0" black = "^22.0.0" coverage = {extras = ["toml"], version = "^6.4.0"} @@ -145,7 +144,7 @@ output = 'coverage.xml' [tool.black] line-length = 88 -target-version = ['py37', 'py38', 'py39', 'py310', 'py311'] +target-version = ['py38', 'py39', 'py310', 'py311'] include = '\.pyi?$' exclude = ''' /( @@ -191,11 +190,10 @@ ignore_roles = [ legacy_tox_ini = """ [tox] envlist = - py37 - py38 py39 py310 py311 + py312 pypy3 coverage style @@ -205,12 +203,11 @@ skipsdist = true [gh-actions] python = - 3.7: py37 - 3.8: py38 3.9: py39 3.10: py310 3.11: py311 - pypy-3.8: pypy3 + 3.12: py312 + pypy-3.10: pypy3 [testenv] description = run the test suite using pytest under {basepython} @@ -255,7 +252,7 @@ commands = coverage combine coverage report -m coverage xml -o {toxworkdir}/coverage.xml -depends = py37, py38, py39, py310, py311, pypy3 +depends = py39, py310, py311, py312, pypy3 [testenv:style] description = run autoformatters and style checkers diff --git a/src/docformatter/__pkginfo__.py b/src/docformatter/__pkginfo__.py index b73c14fb..756a4ce8 100644 --- a/src/docformatter/__pkginfo__.py +++ b/src/docformatter/__pkginfo__.py @@ -23,4 +23,4 @@ # SOFTWARE. """Package information for docformatter.""" -__version__ = "1.7.5" +__version__ = "1.7.6" diff --git a/src/docformatter/format.py b/src/docformatter/format.py index c315ab61..5f5297ee 100644 --- a/src/docformatter/format.py +++ b/src/docformatter/format.py @@ -334,7 +334,7 @@ def _do_format_code(self, source): return _strings.normalize_line_endings( _code.splitlines(True), _original_newline - ) + ).rstrip(" ") except (tokenize.TokenError, IndentationError): return source diff --git a/src/docformatter/strings.py b/src/docformatter/strings.py index 8083b886..0eccef00 100644 --- a/src/docformatter/strings.py +++ b/src/docformatter/strings.py @@ -101,6 +101,7 @@ def normalize_line(line: str, newline: str) -> str: The supplied line with line endings replaced by the newline. """ stripped = line.rstrip("\n\r") + return stripped + newline if stripped != line else line diff --git a/tests/_data/string_files/do_format_code.toml b/tests/_data/string_files/do_format_code.toml index 5d886f3c..26c37b18 100644 --- a/tests/_data/string_files/do_format_code.toml +++ b/tests/_data/string_files/do_format_code.toml @@ -151,14 +151,14 @@ outstring='''def pytest_addoption(parser: pytest.Parser) -> " ''' [issue_97_2] -instring='''def pytest_addoption(parser: pytest.Parser) -> +instring='''def pytest_addoption(parser: pytest.Parser) -> None: # pragma: no cover - + register_toggle.pytest_addoption(parser) ''' -outstring='''def pytest_addoption(parser: pytest.Parser) -> +outstring='''def pytest_addoption(parser: pytest.Parser) -> None: # pragma: no cover - + register_toggle.pytest_addoption(parser) '''