Skip to content

Commit f8e27b2

Browse files
committed
Merge remote-tracking branch 'upstream/master' into conditional-overloads
2 parents dcc49b2 + 9b31477 commit f8e27b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3845
-231
lines changed

.github/workflows/test.yml

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -113,24 +113,23 @@ jobs:
113113
- name: Test
114114
run: tox -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }}
115115

116-
# TODO: uncomment this when 3.11-dev is available
117-
# python-nightly:
118-
# runs-on: ubuntu-latest
119-
# name: Test suite with Python nightly
120-
# steps:
121-
# - uses: actions/checkout@v2
122-
# - uses: actions/setup-python@v2
123-
# with:
124-
# python-version: '3.11-dev'
125-
# - name: Install tox
126-
# run: |
127-
# pip install -U pip==21.2.3 setuptools
128-
# pip install --upgrade 'setuptools!=50' virtualenv==20.4.7 tox==3.20.1
129-
# - name: Setup tox environment
130-
# run: tox -e py --notest
131-
# - name: Test
132-
# run: tox -e py --skip-pkg-install -- "-n 2"
133-
# continue-on-error: true
134-
# - name: Mark as a success
135-
# run: exit 0
136-
116+
# TODO: re-enable when `typed-ast` will be fixed for `python==3.11`
117+
# python-nightly:
118+
# runs-on: ubuntu-latest
119+
# name: Test suite with Python nightly
120+
# steps:
121+
# - uses: actions/checkout@v2
122+
# - uses: actions/setup-python@v2
123+
# with:
124+
# python-version: '3.11-dev'
125+
# - name: Install tox
126+
# run: |
127+
# pip install -U pip==21.2.3 setuptools
128+
# pip install --upgrade 'setuptools!=50' virtualenv==20.4.7 tox==3.20.1
129+
# - name: Setup tox environment
130+
# run: tox -e py --notest
131+
# - name: Test
132+
# run: tox -e py --skip-pkg-install -- "-n 2"
133+
# continue-on-error: true
134+
# - name: Mark as a success
135+
# run: exit 0

docs/source/error_code_list.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,28 @@ consistently when using the call-based syntax. Example:
657657
# Error: First argument to namedtuple() should be "Point2D", not "Point"
658658
Point2D = NamedTuple("Point", [("x", int), ("y", int)])
659659
660+
Check that overloaded functions have an implementation [no-overload-impl]
661+
-------------------------------------------------------------------------
662+
663+
Overloaded functions outside of stub files must be followed by a non overloaded
664+
implementation.
665+
666+
.. code-block:: python
667+
668+
from typing import overload
669+
670+
@overload
671+
def func(value: int) -> int:
672+
...
673+
674+
@overload
675+
def func(value: str) -> str:
676+
...
677+
678+
# presence of required function below is checked
679+
def func(value):
680+
pass # actual implementation
681+
660682
Report syntax errors [syntax]
661683
-----------------------------
662684

docs/source/literal_types.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ corresponding to some particular index, we can use Literal types like so:
186186
187187
# But what if we want the index to be a variable? Normally mypy won't
188188
# know exactly what the index is and so will return a less precise type:
189-
int_index = 1
189+
int_index = 0
190190
reveal_type(tup[int_index]) # Revealed type is "Union[str, float]"
191191
192192
# But if we use either Literal types or a Final int, we can gain back
193193
# the precision we originally had:
194-
lit_index: Literal[1] = 1
195-
fin_index: Final = 1
194+
lit_index: Literal[0] = 0
195+
fin_index: Final = 0
196196
reveal_type(tup[lit_index]) # Revealed type is "str"
197197
reveal_type(tup[fin_index]) # Revealed type is "str"
198198

docs/source/running_mypy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ This is computed from the following items:
491491

492492
.. note::
493493

494-
You cannot point to a :pep:`561` package via the ``MYPYPATH``, it must be
494+
You cannot point to a stub-only package (:pep:`561`) via the ``MYPYPATH``, it must be
495495
installed (see :ref:`PEP 561 support <installed-packages>`)
496496

497497
Second, mypy searches for stub files in addition to regular Python files

0 commit comments

Comments
 (0)