2021-01-27 10:57:46 -06:00
|
|
|
from __future__ import annotations
|
2022-12-30 14:14:18 -06:00
|
|
|
|
2021-01-27 10:57:46 -06:00
|
|
|
from datetime import datetime
|
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
CONSTANT = 'foo'
|
|
|
|
SENTINEL = object()
|
|
|
|
|
|
|
|
|
|
|
|
def foo(name: str = CONSTANT,
|
2021-09-07 19:15:25 -05:00
|
|
|
sentinel: Any = SENTINEL,
|
2021-10-30 10:26:03 -05:00
|
|
|
now: datetime = datetime.now(),
|
2022-04-02 02:55:48 -05:00
|
|
|
color: int = 0xFFFFFF,
|
|
|
|
*,
|
|
|
|
kwarg1,
|
|
|
|
kwarg2 = 0xFFFFFF) -> None:
|
2021-01-27 10:57:46 -06:00
|
|
|
"""docstring"""
|
|
|
|
|
|
|
|
|
|
|
|
class Class:
|
|
|
|
"""docstring"""
|
|
|
|
|
2021-09-07 19:15:25 -05:00
|
|
|
def meth(self, name: str = CONSTANT, sentinel: Any = SENTINEL,
|
2022-04-02 02:55:48 -05:00
|
|
|
now: datetime = datetime.now(), color: int = 0xFFFFFF,
|
|
|
|
*, kwarg1, kwarg2 = 0xFFFFFF) -> None:
|
2021-01-27 10:57:46 -06:00
|
|
|
"""docstring"""
|
2022-05-07 05:52:25 -05:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def clsmeth(cls, name: str = CONSTANT, sentinel: Any = SENTINEL,
|
|
|
|
now: datetime = datetime.now(), color: int = 0xFFFFFF,
|
|
|
|
*, kwarg1, kwarg2 = 0xFFFFFF) -> None:
|
|
|
|
"""docstring"""
|
2023-08-16 20:19:25 -05:00
|
|
|
|
|
|
|
|
|
|
|
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")
|