1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
from __future__ import annotations
from datetime import datetime
from typing import Any
CONSTANT = 'foo'
SENTINEL = object()
def foo(name: str = CONSTANT,
sentinel: Any = SENTINEL,
now: datetime = datetime.now(),
color: int = 0xFFFFFF,
*,
kwarg1,
kwarg2 = 0xFFFFFF) -> None:
"""docstring"""
class Class:
"""docstring"""
def meth(self, name: str = CONSTANT, sentinel: Any = SENTINEL,
now: datetime = datetime.now(), color: int = 0xFFFFFF,
*, kwarg1, kwarg2 = 0xFFFFFF) -> None:
"""docstring"""
@classmethod
def clsmeth(cls, name: str = CONSTANT, sentinel: Any = SENTINEL,
now: datetime = datetime.now(), color: int = 0xFFFFFF,
*, kwarg1, kwarg2 = 0xFFFFFF) -> None:
"""docstring"""
get_sentinel = lambda custom=SENTINEL: custom
"""docstring"""
class MultiLine:
"""docstring"""
# The properties will raise a silent SyntaxError because "lambda self: 1"
# will be detected as a function to update the default values of. However,
# only prop3 will not fail because it's on a single line whereas the others
# will fail to parse.
prop1 = property(
lambda self: 1, doc="docstring")
prop2 = property(
lambda self: 2, doc="docstring"
)
prop3 = property(lambda self: 3, doc="docstring")
prop4 = (property
(lambda self: 4, doc="docstring"))
prop5 = property\
(lambda self: 5, doc="docstring")
|