Skip to content

Commit

Permalink
Bump actions/setup-python from 4 to 5 (#408)
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Bernát Gábor <[email protected]>
  • Loading branch information
dependabot[bot] authored and gaborbernat committed Feb 13, 2024
1 parent 601583f commit 6527235
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: check
on:
workflow_dispatch:
push:
branches: "main"
branches: ["main"]
tags-ignore: ["**"]
pull_request:
schedule:
Expand Down
23 changes: 15 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ repos:
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.0"
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 24.1.1
- id: check-github-workflows
args: [ "--verbose" ]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: black
- id: codespell
additional_dependencies: ["tomli>=2.0.1"]
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "1.3.1"
hooks:
Expand All @@ -22,7 +23,13 @@ repos:
rev: "1.7.0"
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.11.4"]
additional_dependencies: ["tox>=4.12.1"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.1"
hooks:
- id: ruff-format
- id: ruff
args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
- repo: meta
hooks:
- id: check-hooks-apply
Expand Down
2 changes: 2 additions & 0 deletions ignore-words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
master
manuel
23 changes: 17 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,38 @@ version.source = "vcs"
line-length = 120

[tool.ruff]
select = ["ALL"]
line-length = 120
target-version = "py37"
isort = {known-first-party = ["tox", "tests"], required-imports = ["from __future__ import annotations"]}
ignore = [
"ANN101", # no typoe annotation for self
lint.select = ["ALL"]
lint.isort = {known-first-party = ["sphinx_autodoc_typehints", "tests"], required-imports = ["from __future__ import annotations"]}
lint.ignore = [
"ANN101", # no type annotation for self
"ANN401", # allow Any as type annotation
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"S104", # Possible binding to all interface
"COM812", # Conflict with formatter
"ISC001", # Conflict with formatter
"CPY", # No copyright statements
]
[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed in tests...
"FBT", # don"t care about booleans as positional arguments in tests
"INP001", # no implicit namespace
"D", # don"t care about documentation in tests
"D", # don't care about documentation in tests
"S603", # `subprocess` call: check for execution of untrusted input
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
"PLR0913", # any number of arguments in tests
"PLR0917", # any number of arguments in tests
]

[tool.codespell]
builtin = "clear,usage,en-GB_to_en-US"
ignore-words = "ignore-words.txt"
write-changes = true
count = true

[tool.pytest.ini_options]
testpaths = ["tests"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SomeClass:
@classmethod
def from_str(cls, input_value: str) -> SomeClass: # noqa: ANN102
"""
Initialise from string
Initialize from string
:param input_value: Input
:return: result
Expand All @@ -27,7 +27,7 @@ def from_str(cls, input_value: str) -> SomeClass: # noqa: ANN102
@classmethod
def from_date(cls, input_value: datetime.date) -> SomeClass: # noqa: ANN102
"""
Initialise from date
Initialize from date
:param input_value: Input
:return: result
Expand All @@ -37,7 +37,7 @@ def from_date(cls, input_value: datetime.date) -> SomeClass: # noqa: ANN102
@classmethod
def from_time(cls, input_value: datetime.time) -> SomeClass: # noqa: ANN102
"""
Initialise from time
Initialize from time
:param input_value: Input
:return: result
Expand Down
3 changes: 2 additions & 1 deletion tests/roots/test-resolve-typing-guard/demo_typing_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def guarded(self, item: Decimal) -> None:
"""


def func(_x: Literal) -> None: ...
def func(_x: Literal) -> None:
...


__all__ = [
Expand Down
14 changes: 8 additions & 6 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,11 +625,13 @@ def func_with_examples() -> int:


@overload
def func_with_overload(a: int, b: int) -> None: ...
def func_with_overload(a: int, b: int) -> None:
...


@overload
def func_with_overload(a: str, b: str) -> None: ...
def func_with_overload(a: str, b: str) -> None:
...


@expected(
Expand Down Expand Up @@ -1094,7 +1096,7 @@ def docstring_with_bullet_list_after_params(param: int) -> None: # noqa: ARG001
maybe multiple lines
Next Term
Somethign about it
Something about it
""",
)
Expand All @@ -1110,7 +1112,7 @@ def docstring_with_definition_list_after_params(param: int) -> None: # noqa: AR
maybe multiple lines
Next Term
Somethign about it
Something about it
"""


Expand Down Expand Up @@ -1162,7 +1164,7 @@ def docstring_with_enum_list_after_params(param: int) -> None: # noqa: ARG001
maybe multiple lines
Next Term
Somethign about it
Something about it
-[ Example ]-
""",
Expand All @@ -1179,7 +1181,7 @@ def docstring_with_definition_list_after_params_no_blank_line(param: int) -> Non
maybe multiple lines
Next Term
Somethign about it
Something about it
.. rubric:: Example
"""

Expand Down
13 changes: 9 additions & 4 deletions tests/test_sphinx_autodoc_typehints.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import typing_extensions
from sphinx.application import Sphinx
from sphinx.config import Config

from sphinx_autodoc_typehints import (
_resolve_type_guarded_imports,
backfill_type_hints,
Expand Down Expand Up @@ -80,17 +81,20 @@ class A:
def get_type(self) -> type:
return type(self)

class Inner: ...
class Inner:
...


class B(Generic[T]):
name = "Foo" # This is set to make sure the correct class name ("B") is picked up


class C(B[str]): ...
class C(B[str]):
...


class D(typing_extensions.Protocol): ...
class D(typing_extensions.Protocol):
...


class E(typing_extensions.Protocol[T]): # type: ignore[misc]
Expand All @@ -101,7 +105,8 @@ class Slotted:
__slots__ = ()


class Metaclass(type): ...
class Metaclass(type):
...


class HintedMethods:
Expand Down

0 comments on commit 6527235

Please sign in to comment.