Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

black -> ruff #650

Merged
merged 1 commit into from
Dec 13, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- run: pip install --no-deps -e .

- run: ruff --fix-only .
- run: black .
- run: ruff format .

- run: git checkout test/testdata/ pdoc/markdown2/
- run: test/test_snapshot.py
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
lint:
uses: mhils/workflows/.github/workflows/python-tox.yml@main
with:
cmd: tox -e lint -- -v ${{ matrix.args }}
cmd: tox -e lint

test:
strategy:
Expand Down
4 changes: 3 additions & 1 deletion pdoc/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,9 @@ def signature(self) -> inspect.Signature:
)
)
for p in sig.parameters.values():
p._annotation = safe_eval_type(p.annotation, globalns, localns, mod, self.fullname) # type: ignore
p._annotation = safe_eval_type( # type: ignore
p.annotation, globalns, localns, mod, self.fullname
)
return sig

@cached_property
Expand Down
4 changes: 1 addition & 3 deletions pdoc/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ def mock_some_common_side_effects():
"os.startfile", new=_noop, create=True
), patch("sys.stdout", new=io.StringIO()), patch(
"sys.stderr", new=io.StringIO()
), patch(
"sys.stdin", new=io.StringIO()
):
), patch("sys.stdin", new=io.StringIO()):
yield


Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pdoc = "pdoc.__main__:cli"
dev = [
"tox",
"ruff",
"black",
"mypy",
"types-pygments",
"pytest",
Expand Down Expand Up @@ -90,9 +89,6 @@ markers = [
"slow: marks tests as slow.",
]

[tool.black]
extend-exclude = "test/testdata/demo.py"

[[tool.mypy.overrides]]
module = "pytest.*"
ignore_missing_imports = true
Expand All @@ -102,8 +98,9 @@ module = "demopackage2"
ignore_missing_imports = true

[tool.ruff]
line-length = 140
extend-exclude = ["test/testdata/demo.py"]
select = ["E", "F", "I"]
ignore = ["E501"]

[tool.ruff.isort]
force-single-line = true
Expand Down
24 changes: 7 additions & 17 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --all-extras --allow-unsafe --output-file=requirements-dev.txt pyproject.toml
#
attrs==23.1.0
# via hypothesis
black==23.11.0
# via pdoc (pyproject.toml)
cachetools==5.3.2
# via tox
chardet==5.2.0
# via tox
click==8.1.7
# via black
colorama==0.4.6
# via tox
coverage[toml]==7.3.2
# via pytest-cov
distlib==0.3.7
distlib==0.3.8
# via virtualenv
filelock==3.13.1
# via
# tox
# virtualenv
hypothesis==6.91.0
hypothesis==6.92.0
# via pdoc (pyproject.toml)
iniconfig==2.0.0
# via pytest
Expand All @@ -37,22 +33,16 @@ markupsafe==2.1.3
mypy==1.7.1
# via pdoc (pyproject.toml)
mypy-extensions==1.0.0
# via
# black
# mypy
# via mypy
packaging==23.2
# via
# black
# pyproject-api
# pytest
# tox
pathspec==0.11.2
# via black
pdoc-pyo3-sample-library==1.0.11
# via pdoc (pyproject.toml)
platformdirs==4.0.0
platformdirs==4.1.0
# via
# black
# tox
# virtualenv
pluggy==1.3.0
Expand All @@ -72,7 +62,7 @@ pytest-cov==4.1.0
# via pdoc (pyproject.toml)
pytest-timeout==2.2.0
# via pdoc (pyproject.toml)
ruff==0.1.6
ruff==0.1.8
# via pdoc (pyproject.toml)
sortedcontainers==2.4.0
# via hypothesis
Expand All @@ -84,7 +74,7 @@ types-pygments==2.17.0.0
# via pdoc (pyproject.toml)
types-setuptools==69.0.0.0
# via types-pygments
typing-extensions==4.8.0
typing-extensions==4.9.0
# via mypy
virtualenv==20.25.0
# via tox
4 changes: 1 addition & 3 deletions test/testdata/demopackage/subpackage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

from ..child_b import B

__all__ = [
"B"
]
__all__ = ["B"]
20 changes: 9 additions & 11 deletions test/testdata/demopackage_dir.html
Original file line number Diff line number Diff line change
Expand Up @@ -1078,17 +1078,15 @@ <h1 class=&quot;modulename&quot;>

<label class=&quot;view-source-button&quot; for=&quot;mod-subpackage-view-source&quot;><span>View Source</span></label>

<div class=&quot;pdoc-code codehilite&quot;><pre><span></span><span id=&quot;L-1&quot;><a href=&quot;#L-1&quot;><span class=&quot;linenos&quot;> 1</span></a><span class=&quot;sd&quot;>&amp;quot;&amp;quot;&amp;quot;</span>
</span><span id=&quot;L-2&quot;><a href=&quot;#L-2&quot;><span class=&quot;linenos&quot;> 2</span></a><span class=&quot;sd&quot;>A sub-package.</span>
</span><span id=&quot;L-3&quot;><a href=&quot;#L-3&quot;><span class=&quot;linenos&quot;> 3</span></a>
</span><span id=&quot;L-4&quot;><a href=&quot;#L-4&quot;><span class=&quot;linenos&quot;> 4</span></a><span class=&quot;sd&quot;>It imports and re-exposes ..child_b.B, and links to `..C` .</span>
</span><span id=&quot;L-5&quot;><a href=&quot;#L-5&quot;><span class=&quot;linenos&quot;> 5</span></a><span class=&quot;sd&quot;>&amp;quot;&amp;quot;&amp;quot;</span>
</span><span id=&quot;L-6&quot;><a href=&quot;#L-6&quot;><span class=&quot;linenos&quot;> 6</span></a>
</span><span id=&quot;L-7&quot;><a href=&quot;#L-7&quot;><span class=&quot;linenos&quot;> 7</span></a><span class=&quot;kn&quot;>from</span> <span class=&quot;nn&quot;>..child_b</span> <span class=&quot;kn&quot;>import</span> <span class=&quot;n&quot;>B</span>
</span><span id=&quot;L-8&quot;><a href=&quot;#L-8&quot;><span class=&quot;linenos&quot;> 8</span></a>
</span><span id=&quot;L-9&quot;><a href=&quot;#L-9&quot;><span class=&quot;linenos&quot;> 9</span></a><span class=&quot;n&quot;>__all__</span> <span class=&quot;o&quot;>=</span> <span class=&quot;p&quot;>[</span>
</span><span id=&quot;L-10&quot;><a href=&quot;#L-10&quot;><span class=&quot;linenos&quot;>10</span></a> <span class=&quot;s2&quot;>&amp;quot;B&amp;quot;</span>
</span><span id=&quot;L-11&quot;><a href=&quot;#L-11&quot;><span class=&quot;linenos&quot;>11</span></a><span class=&quot;p&quot;>]</span>
<div class=&quot;pdoc-code codehilite&quot;><pre><span></span><span id=&quot;L-1&quot;><a href=&quot;#L-1&quot;><span class=&quot;linenos&quot;>1</span></a><span class=&quot;sd&quot;>&amp;quot;&amp;quot;&amp;quot;</span>
</span><span id=&quot;L-2&quot;><a href=&quot;#L-2&quot;><span class=&quot;linenos&quot;>2</span></a><span class=&quot;sd&quot;>A sub-package.</span>
</span><span id=&quot;L-3&quot;><a href=&quot;#L-3&quot;><span class=&quot;linenos&quot;>3</span></a>
</span><span id=&quot;L-4&quot;><a href=&quot;#L-4&quot;><span class=&quot;linenos&quot;>4</span></a><span class=&quot;sd&quot;>It imports and re-exposes ..child_b.B, and links to `..C` .</span>
</span><span id=&quot;L-5&quot;><a href=&quot;#L-5&quot;><span class=&quot;linenos&quot;>5</span></a><span class=&quot;sd&quot;>&amp;quot;&amp;quot;&amp;quot;</span>
</span><span id=&quot;L-6&quot;><a href=&quot;#L-6&quot;><span class=&quot;linenos&quot;>6</span></a>
</span><span id=&quot;L-7&quot;><a href=&quot;#L-7&quot;><span class=&quot;linenos&quot;>7</span></a><span class=&quot;kn&quot;>from</span> <span class=&quot;nn&quot;>..child_b</span> <span class=&quot;kn&quot;>import</span> <span class=&quot;n&quot;>B</span>
</span><span id=&quot;L-8&quot;><a href=&quot;#L-8&quot;><span class=&quot;linenos&quot;>8</span></a>
</span><span id=&quot;L-9&quot;><a href=&quot;#L-9&quot;><span class=&quot;linenos&quot;>9</span></a><span class=&quot;n&quot;>__all__</span> <span class=&quot;o&quot;>=</span> <span class=&quot;p&quot;>[</span><span class=&quot;s2&quot;>&amp;quot;B&amp;quot;</span><span class=&quot;p&quot;>]</span>
</span></pre></div>


Expand Down
Loading