Fixed a few typos and formatting issues in typed-libraries documentation.

This commit is contained in:
Eric Traut 2021-06-22 10:00:30 -07:00
parent 5c08df0bd7
commit bf66ff22c5

View File

@ -54,19 +54,23 @@ A “py.typed” library is said to be “type complete” if all of the symbols
A “known type” is defined as follows:
Classes:
- All class variables, instance variables, and methods that are “visible” (not overriden) are annotated and refer to known types
- If a class is a subclass of a generic class, type arguments are provided for each generic type parameter, and these type arguments are known types
* All class variables, instance variables, and methods that are “visible” (not overridden) are annotated and refer to known types
* If a class is a subclass of a generic class, type arguments are provided for each generic type parameter, and these type arguments are known types
Functions and Methods:
- All input parameters have type annotations that refer to known types
- The return parameter is annotated and refers to a known type
- The result of applying one or more decorators results in a known type
* All input parameters have type annotations that refer to known types
* The return parameter is annotated and refers to a known type
* The result of applying one or more decorators results in a known type
Type Aliases:
- All of the types referenced by the type alias are known
* All of the types referenced by the type alias are known
Variables:
- All variables have type annotations that refer to known types
* All variables have type annotations that refer to known types
Type annotations can be omitted in a few specific cases where the type is obvious from the context:
@ -107,7 +111,7 @@ def func(a: Optional[int], b: Dict[str, float] = {}) -> None:
def func(a, b):
pass
# Function with partially unknown function (because of missing
# Function with partially unknown type (because of missing
# type args on Dict)
def func(a: int, b: Dict) -> None:
pass
@ -233,7 +237,7 @@ _F = TypeVar("_F", bound=Callable[..., Any])
def simple_decorator(_func: _F) -> _F:
"""
Simple decorators are invoked without parens like this:
Simple decorators are invoked without parentheses like this:
@simple_decorator
def my_function(): ...
"""