File: property.pyi

package info (click to toggle)
python-atom 0.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 1,676 kB
  • sloc: cpp: 9,254; python: 6,181; makefile: 123
file content (63 lines) | stat: -rw-r--r-- 2,090 bytes parent folder | download
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
61
62
63
# --------------------------------------------------------------------------------------
# Copyright (c) 2021-2024, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# --------------------------------------------------------------------------------------
from typing import Callable, NoReturn, Optional, TypeVar, overload

from .atom import Atom
from .catom import Member

A = TypeVar("A", bound=Atom)
T = TypeVar("T")
S = TypeVar("S")

class Property(Member[T, S]):
    @overload
    def __new__(
        cls,
        fget: None = None,
        fset: None = None,
        fdel: Optional[Callable[[A], None]] = None,
        cached: bool = False,
    ) -> Property[NoReturn, NoReturn]: ...
    @overload
    def __new__(
        cls,
        fget: None,
        fset: Callable[[A, S], None],
        fdel: Optional[Callable[[A], None]] = None,
        cached: bool = False,
    ) -> Property[NoReturn, S]: ...
    @overload
    def __new__(
        cls,
        fget: Callable[[A], T],
        fset: None = None,
        fdel: Optional[Callable[[A], None]] = None,
        cached: bool = False,
    ) -> Property[T, NoReturn]: ...
    @overload
    def __new__(
        cls,
        fget: Callable[[A], T],
        fset: Callable[[A, S], None],
        fdel: Optional[Callable[[A], None]] = None,
        cached: bool = False,
    ) -> Property[T, S]: ...
    @property
    def fget(self) -> Optional[Callable[[Atom], T]]: ...
    @property
    def fset(self) -> Optional[Callable[[Atom, S], None]]: ...
    @property
    def fdel(self) -> Optional[Callable[[Atom], None]]: ...
    @property
    def cached(self) -> bool: ...
    def getter(self, func: Callable[[A], T]) -> Callable[[A], T]: ...
    def setter(self, func: Callable[[A, S], None]) -> Callable[[A, S], None]: ...
    def deleter(self, func: Callable[[A], None]) -> Callable[[A], None]: ...
    def reset(self, owner: Atom) -> None: ...

def cached_property(fget: Callable[[A], T]) -> Property[T, NoReturn]: ...