@@ -49,51 +49,9 @@ file (i.e., it can be interpreted by Python 3), except all the methods are empty
4949Python function annotations ([ PEP 3107] ( https://www.python.org/dev/peps/pep-3107/ ) )
5050are used to describe the types the function has.
5151
52- See [ PEP 484] ( http://www.python.org/dev/peps/pep-0484/ ) for the exact syntax
53- of the stub files.
54-
55- ## Syntax example
56-
57- The below is an excerpt from the types for the ` datetime ` module.
58-
59- ``` python
60- from typing import Union
61-
62- MAXYEAR = ... # type: int
63- MINYEAR = ... # type: int
64-
65- class date (object ):
66- def __init__ (self , year : int , month : int , day : int ) -> None : ...
67- @ classmethod
68- def fromtimestamp (cls , timestamp : float ) -> date: ...
69- @ classmethod
70- def today (cls ) -> date: ...
71- @ classmethod
72- def fromordinal (cls , ordinal : int ) -> date: ...
73- def replace (self , year : int = ... , month : int = ... , day : int = ... ) -> date: ...
74- def ctime (self ) -> str : ...
75- def weekday (self ) -> int : ...
76- ```
77-
78- ## Conventions
79-
80- * At the time of this writing, ` unicode ` arguments, in Python 2 stubs, are
81- interpreted by type-checkers as ` Union[bytes, unicode] ` (so it means the same
82- as ` Text ` ).
83- Even so, in Python 2, whenever possible, use ` unicode ` if that's the only
84- possible type, and ` Text ` if it can be either ` unicode ` or ` bytes ` .
85- * For arguments with default values, use ` ... ` instead of the actual
86- default value.
87- * Most type-checkers interpret optional parameters of the form ` x : Foo = None `
88- as ` x : Optional[Foo] = ... ` . (So the former is a shortcut for the latter)
89- In typeshed, however, we prefer the explicit latter form.
90- * When something is declared as taking only float, it also takes ` int ` . See
91- https://www.python.org/dev/peps/pep-0484/#the-numeric-tower . So write ` float `
92- instead of ` Union[int, float] ` .
93- * Avoid Union return types: https://github.com/python/mypy/issues/1693
94- * Avoid invariant collection types (List, Dict) in argument positions, in favor
95- of covariant types like Mapping or Sequence.
96-
52+ See [ PEP 484] ( http://www.python.org/dev/peps/pep-0484/ ) for the exact
53+ syntax of the stub files and [ CONTRIBUTING.md] ( CONTRIBUTING.md ) for the
54+ coding style used in typeshed.
9755
9856## Directory structure
9957
0 commit comments