Skip to content

Commit

Permalink
Lint RST on GitHub Actions and fix PEP 646 (#1802)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Feb 8, 2021
1 parent 68794b1 commit 58718c5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions pep-0646.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------
Expand Down Expand Up @@ -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):

Expand Down Expand Up @@ -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``
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit 58718c5

Please sign in to comment.