mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
CONTRIBUTING: Use PEP 526 syntax in example (#1803)
* Add an example property, whitespace for grouping * No default values from module-level constants * Document that PEP 526 syntax is preferred
This commit is contained in:
committed by
Jelle Zijlstra
parent
f207bc3cc3
commit
35edccce68
@@ -148,10 +148,10 @@ that you know.
|
||||
The below is an excerpt from the types for the `datetime` module.
|
||||
|
||||
```python
|
||||
MAXYEAR = ... # type: int
|
||||
MINYEAR = ... # type: int
|
||||
MAXYEAR: int
|
||||
MINYEAR: int
|
||||
|
||||
class date(object):
|
||||
class date:
|
||||
def __init__(self, year: int, month: int, day: int) -> None: ...
|
||||
@classmethod
|
||||
def fromtimestamp(cls, timestamp: float) -> date: ...
|
||||
@@ -159,6 +159,8 @@ class date(object):
|
||||
def today(cls) -> date: ...
|
||||
@classmethod
|
||||
def fromordinal(cls, ordinal: int) -> date: ...
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
def replace(self, year: int = ..., month: int = ..., day: int = ...) -> date: ...
|
||||
def ctime(self) -> str: ...
|
||||
def weekday(self) -> int: ...
|
||||
@@ -183,6 +185,8 @@ rule is that they should be as concise as possible. Specifically:
|
||||
* use a single blank line between top-level class definitions, or none
|
||||
if the classes are very small;
|
||||
* do not use docstrings;
|
||||
* use variable annotations instead of type comments, even for stubs
|
||||
that target older versions of Python;
|
||||
* for arguments with a type and a default, use spaces around the `=`.
|
||||
|
||||
Stub files should only contain information necessary for the type
|
||||
|
||||
Reference in New Issue
Block a user