Skip to content

Commit dcc49b2

Browse files
committed
Merge remote-tracking branch 'upstream/master' into conditional-overloads
2 parents 1452020 + 41a7934 commit dcc49b2

File tree

143 files changed

+1493
-16894
lines changed

Some content is hidden

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

143 files changed

+1493
-16894
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*.{py,c,cpp,h,rst,md,yml,json}]
4+
trim_trailing_whitespace = true
5+
insert_final_newline = true
6+
indent_style = space
7+
8+
[*.{py,c,h,json}]
9+
indent_size = 4
10+
11+
[*.yml]
12+
indent_size = 2

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# We vendor typeshed from https://github.com/python/typeshed
2-
mypy/typeshed/ linguist-vendored
2+
mypy/typeshed/** linguist-vendored

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
contact_links:
2+
- about: "Please check the linked documentation page before filing new issues."
3+
name: "Common issues and solutions"
4+
url: "https://mypy.readthedocs.io/en/stable/common_issues.html"
5+
- about: "Please ask and answer any questions on the mypy Gitter."
6+
name: "Questions or Chat"
7+
url: "https://gitter.im/python/typing"

.github/ISSUE_TEMPLATE/question.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/mypy_primer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
fetch-depth: 0
2727
- uses: actions/setup-python@v2
2828
with:
29-
python-version: 3.8
29+
python-version: "3.10"
3030
- name: Install dependencies
3131
run: |
3232
python -m pip install -U pip

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ DEALINGS IN THE SOFTWARE.
2626

2727
= = = = =
2828

29-
Portions of mypy and mypyc are licensed under different licenses. The
30-
files under stdlib-samples as well as the files
29+
Portions of mypy and mypyc are licensed under different licenses.
30+
The files
3131
mypyc/lib-rt/pythonsupport.h, mypyc/lib-rt/getargs.c and
3232
mypyc/lib-rt/getargsfast.c are licensed under the PSF 2 License, reproduced
3333
below.

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ include runtests.py
4141
include pytest.ini
4242

4343
include LICENSE mypyc/README.md
44-
exclude .gitmodules CONTRIBUTING.md CREDITS ROADMAP.md tox.ini action.yml
44+
exclude .gitmodules CONTRIBUTING.md CREDITS ROADMAP.md tox.ini action.yml .editorconfig
4545

4646
global-exclude *.py[cod]
4747
global-exclude .DS_Store

docs/source/class_basics.rst

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ Slots
320320
*****
321321

322322
When a class has explicitly defined
323-
`__slots__ <https://docs.python.org/3/reference/datamodel.html#slots>`_
324-
mypy will check that all attributes assigned to are members of `__slots__`.
323+
`__slots__ <https://docs.python.org/3/reference/datamodel.html#slots>`_,
324+
mypy will check that all attributes assigned to are members of ``__slots__``:
325325

326326
.. code-block:: python
327327
@@ -331,13 +331,19 @@ mypy will check that all attributes assigned to are members of `__slots__`.
331331
def __init__(self, name: str, year: int) -> None:
332332
self.name = name
333333
self.year = year
334-
self.released = True # E: Trying to assign name "released" that is not in "__slots__" of type "Album"
334+
# Error: Trying to assign name "released" that is not in "__slots__" of type "Album"
335+
self.released = True
335336
336337
my_album = Album('Songs about Python', 2021)
337338
338-
Mypy will only check attribute assignments against `__slots__` when the following conditions hold:
339+
Mypy will only check attribute assignments against ``__slots__`` when
340+
the following conditions hold:
339341

340-
1. All base classes (except builtin ones) must have explicit ``__slots__`` defined (mirrors CPython's behaviour)
341-
2. ``__slots__`` does not include ``__dict__``, since if ``__slots__`` includes ``__dict__``
342-
it allows setting any attribute, similar to when ``__slots__`` is not defined (mirrors CPython's behaviour)
343-
3. All values in ``__slots__`` must be statically known. For example, no variables: only string literals.
342+
1. All base classes (except builtin ones) must have explicit
343+
``__slots__`` defined (this mirrors Python semantics).
344+
345+
2. ``__slots__`` does not include ``__dict__``. If ``__slots__``
346+
includes ``__dict__``, arbitrary attributes can be set, similar to
347+
when ``__slots__`` is not defined (this mirrors Python semantics).
348+
349+
3. All values in ``__slots__`` must be string literals.

docs/source/command_line.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ For more information on how to use these flags, see :ref:`version_and_platform_c
274274
Disallow dynamic typing
275275
***********************
276276

277-
The ``Any`` type is used represent a value that has a :ref:`dynamic type <dynamic-typing>`.
277+
The ``Any`` type is used to represent a value that has a :ref:`dynamic type <dynamic-typing>`.
278278
The ``--disallow-any`` family of flags will disallow various uses of the ``Any`` type in
279279
a module -- this lets us strategically disallow the use of dynamic typing in a controlled way.
280280

@@ -312,8 +312,8 @@ The following options are available:
312312
.. option:: --disallow-any-generics
313313

314314
This flag disallows usage of generic types that do not specify explicit
315-
type parameters. For example you can't use a bare ``x: list``, you must say
316-
``x: list[int]``.
315+
type parameters. For example, you can't use a bare ``x: list``. Instead, you
316+
must always write something like ``x: list[int]``.
317317

318318
.. option:: --disallow-subclassing-any
319319

@@ -853,13 +853,17 @@ format into the specified directory.
853853

854854
Causes mypy to generate a Cobertura XML type checking coverage report.
855855

856-
You must install the `lxml`_ library to generate this report.
856+
To generate this report, you must either manually install the `lxml`_
857+
library or specify mypy installation with the setuptools extra
858+
``mypy[reports]``.
857859

858860
.. option:: --html-report / --xslt-html-report DIR
859861

860862
Causes mypy to generate an HTML type checking coverage report.
861863

862-
You must install the `lxml`_ library to generate this report.
864+
To generate this report, you must either manually install the `lxml`_
865+
library or specify mypy installation with the setuptools extra
866+
``mypy[reports]``.
863867

864868
.. option:: --linecount-report DIR
865869

@@ -881,13 +885,17 @@ format into the specified directory.
881885

882886
Causes mypy to generate a text file type checking coverage report.
883887

884-
You must install the `lxml`_ library to generate this report.
888+
To generate this report, you must either manually install the `lxml`_
889+
library or specify mypy installation with the setuptools extra
890+
``mypy[reports]``.
885891

886892
.. option:: --xml-report DIR
887893

888894
Causes mypy to generate an XML type checking coverage report.
889895

890-
You must install the `lxml`_ library to generate this report.
896+
To generate this report, you must either manually install the `lxml`_
897+
library or specify mypy installation with the setuptools extra
898+
``mypy[reports]``.
891899

892900
Miscellaneous
893901
*************

0 commit comments

Comments
 (0)