Lint RST on GitHub Actions and fix PEP 646 (#1802)

This commit is contained in:
Hugo van Kemenade 2021-02-08 17:20:51 +02:00 committed by GitHub
parent 68794b15c3
commit 58718c543e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 5 deletions

11
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,11 @@
name: Lint
on: [push, pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0

6
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.7.1
hooks:
- id: rst-backticks
- id: rst-inline-touching-normal

View File

@ -53,3 +53,7 @@ package: all rss
cp *.png build/peps/
cp *.rss build/peps/
tar -C build -czf build/peps.tar.gz peps
lint:
pre-commit --version > /dev/null || python3 -m pip install pre-commit
pre-commit run --all-files

View File

@ -281,7 +281,7 @@ As of this PEP, only a single type variable tuple may appear in a type parameter
class Array(Generic[*Ts1, *Ts2]): ... # Error
(``Union`` is the one exception to this rule; see `Type Variable Tuples with ``Union```.)
(``Union`` is the one exception to this rule; see `Type Variable Tuples with Union`_.)
Type Prefixing
--------------
@ -360,7 +360,7 @@ parameterised with the same types.
foo((0,), (1, 2)) # Error
foo((0,), ('1',)) # Error
Following `Type Variable Tuples Must Have Finite Length When Bound`, note
Following `Type Variable Tuples Must Have Known Length`_, note
that the following should *not* type-check as valid (even though it is, of
course, valid at runtime):
@ -401,9 +401,9 @@ Type variable tuples can also be used in the arguments section of a
However, note that as of this PEP, if a type variable tuple does appear in
the arguments section of a ``Callable``, it must appear alone.
That is, `Type Prefixing` is not supported in the context of ``Callable``.
That is, `Type Prefixing`_ is not supported in the context of ``Callable``.
(Use cases where this might otherwise be desirable are likely covered through use
of either a `ParamSpec` from PEP 612, or a type variable tuple in the `__call__`
of either a ``ParamSpec`` from PEP 612, or a type variable tuple in the ``__call__``
signature of a callback protocol from PEP 544.)
Type Variable Tuples with ``Union``
@ -473,7 +473,7 @@ Normal ``TypeVar`` instances can also be used in such aliases:
# T is bound to `int`; Ts is bound to `bool, str`
Foo[int, bool, str]
Note that the same rules for `Type Prefixing` apply for aliases.
Note that the same rules for `Type Prefixing`_ apply for aliases.
In particular, only one ``TypeVarTuple`` may occur within an alias,
and the ``TypeVarTuple`` must be at the end of the alias.