Merge pull request #697 from google/python_styleguide

Project import generated by Copybara.
This commit is contained in:
Gregory P. Smith 2022-06-07 17:09:21 -07:00 committed by GitHub
commit 965d902e13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -272,10 +272,11 @@ package twice.
Exemptions from this rule: Exemptions from this rule:
* Classes imported from the [`typing` module](#typing-imports). * Symbols from the following modules and used to support static analysis and
* Classes imported from the [`collections.abc` module](#typing-imports). type checking:
* Classes imported from the * [`typing` module](#typing-imports)
[`typing_extensions` module](https://github.com/python/typing/tree/HEAD/typing_extensions). * [`collections.abc` module](#typing-imports)
* [`typing_extensions` module](https://github.com/python/typing_extensions/blob/main/README.md)
* Redirects from the * Redirects from the
[six.moves module](https://six.readthedocs.io/#module-six.moves). [six.moves module](https://six.readthedocs.io/#module-six.moves).
@ -2543,9 +2544,10 @@ Imports should be on separate lines; there are
E.g.: E.g.:
```python ```python
Yes: import os Yes: from collections.abc import Mapping, Sequence
import os
import sys import sys
from typing import Mapping, Sequence from typing import Any, NewType
``` ```
```python ```python
@ -3171,6 +3173,8 @@ CapWorded. If the alias is used only in this module, it should be \_Private.
For example, if the name of the module together with the name of the type is too For example, if the name of the module together with the name of the type is too
long: long:
<!-- Annotate below with `typing.TypeAlias` for 3.10. -->
```python ```python
_ShortName = module_with_long_name.TypeWithLongName _ShortName = module_with_long_name.TypeWithLongName
ComplexMap = Mapping[str, list[tuple[int, int]]] ComplexMap = Mapping[str, list[tuple[int, int]]]