Lint RST on GitHub Actions and fix PEP 646 (#1802)
This commit is contained in:
parent
68794b15c3
commit
58718c543e
|
@ -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
|
|
@ -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
|
4
Makefile
4
Makefile
|
@ -53,3 +53,7 @@ package: all rss
|
||||||
cp *.png build/peps/
|
cp *.png build/peps/
|
||||||
cp *.rss build/peps/
|
cp *.rss build/peps/
|
||||||
tar -C build -czf build/peps.tar.gz 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
|
||||||
|
|
10
pep-0646.rst
10
pep-0646.rst
|
@ -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
|
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
|
Type Prefixing
|
||||||
--------------
|
--------------
|
||||||
|
@ -360,7 +360,7 @@ parameterised with the same types.
|
||||||
foo((0,), (1, 2)) # Error
|
foo((0,), (1, 2)) # Error
|
||||||
foo((0,), ('1',)) # 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
|
that the following should *not* type-check as valid (even though it is, of
|
||||||
course, valid at runtime):
|
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
|
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.
|
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
|
(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.)
|
signature of a callback protocol from PEP 544.)
|
||||||
|
|
||||||
Type Variable Tuples with ``Union``
|
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`
|
# T is bound to `int`; Ts is bound to `bool, str`
|
||||||
Foo[int, 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,
|
In particular, only one ``TypeVarTuple`` may occur within an alias,
|
||||||
and the ``TypeVarTuple`` must be at the end of the alias.
|
and the ``TypeVarTuple`` must be at the end of the alias.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue