Skip to content

Commit 70389d1

Browse files
beckjakegvanrossum
authored andcommitted
Make property a type (#199)
1 parent 3e37029 commit 70389d1

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

stdlib/2.7/__builtin__.pyi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ _T4 = TypeVar('_T4')
2424

2525
staticmethod = object() # Special, only valid as a decorator.
2626
classmethod = object() # Special, only valid as a decorator.
27-
property = object()
2827

2928
class object:
3029
__doc__ = ... # type: str
@@ -647,6 +646,17 @@ class module:
647646
__file__ = ... # type: str
648647
__dict__ = ... # type: Dict[unicode, Any]
649648

649+
class property:
650+
def __init__(self, fget: Callable[[Any], Any] = None,
651+
fset: Callable[[Any, Any], None] = None,
652+
fdel: Callable[[Any], None] = None, doc: str = None) -> None: ...
653+
def getter(self, fget: Callable[[Any], Any]) -> property: ...
654+
def setter(self, fset: Callable[[Any, Any], None]) -> property: ...
655+
def deleter(self, fdel: Callable[[Any], None]) -> property: ...
656+
def __get__(self, obj: Any, type: type=None) -> Any: ...
657+
def __set__(self, obj: Any, value: Any) -> None: ...
658+
def __del__(self, obj: Any) -> None: ...
659+
650660
long = int
651661
bytes = str
652662

stdlib/3/builtins.pyi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ _T4 = TypeVar('_T4')
2323

2424
staticmethod = object() # Only valid as a decorator.
2525
classmethod = object() # Only valid as a decorator.
26-
property = object()
2726

2827
class object:
2928
__doc__ = ... # type: str
@@ -622,6 +621,17 @@ class module:
622621
__file__ = ... # type: str
623622
__dict__ = ... # type: Dict[str, Any]
624623

624+
class property:
625+
def __init__(self, fget: Callable[[Any], Any] = None,
626+
fset: Callable[[Any, Any], None] = None,
627+
fdel: Callable[[Any], None] = None, doc: str = None) -> None: ...
628+
def getter(self, fget: Callable[[Any], Any]) -> property: ...
629+
def setter(self, fset: Callable[[Any, Any], None]) -> property: ...
630+
def deleter(self, fdel: Callable[[Any], None]) -> property: ...
631+
def __get__(self, obj: Any, type: type=None) -> Any: ...
632+
def __set__(self, obj: Any, value: Any) -> None: ...
633+
def __del__(self, obj: Any) -> None: ...
634+
625635
NotImplemented = ... # type: Any
626636

627637
def abs(n: SupportsAbs[_T]) -> _T: ...

0 commit comments

Comments
 (0)