Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@ 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 }}"
steps:
- 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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/do-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 8 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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',
Expand All @@ -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"}
Expand Down Expand Up @@ -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 = '''
/(
Expand Down Expand Up @@ -191,11 +190,10 @@ ignore_roles = [
legacy_tox_ini = """
[tox]
envlist =
py37
py38
py39
py310
py311
py312
pypy3
coverage
style
Expand All @@ -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}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/docformatter/__pkginfo__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
# SOFTWARE.
"""Package information for docformatter."""

__version__ = "1.7.5"
__version__ = "1.7.6"
2 changes: 1 addition & 1 deletion src/docformatter/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/docformatter/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
8 changes: 4 additions & 4 deletions tests/_data/string_files/do_format_code.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
'''

Expand Down
Loading