Release/v0.4.1 #1
2 changed files with 3 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
from .cell_property import CellProperty
|
from .cell_property import CellProperty
|
||||||
from .classproperty import ClassProperty
|
from .classproperty import ClassProperty, classproperty
|
||||||
from .hook_property import HookProperty
|
from .hook_property import HookProperty
|
||||||
from .initonly import Initonly, initonly
|
from .initonly import Initonly, initonly
|
||||||
from .priv_property import PrivProperty
|
from .priv_property import PrivProperty
|
||||||
|
|
@ -9,6 +9,7 @@ from .readonly import Readonly, readonly
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"CellProperty",
|
"CellProperty",
|
||||||
"ClassProperty",
|
"ClassProperty",
|
||||||
|
"classproperty",
|
||||||
"HookProperty",
|
"HookProperty",
|
||||||
"Initonly",
|
"Initonly",
|
||||||
"initonly",
|
"initonly",
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class PrivProperty[T]:
|
||||||
def __get__(self, instance: Any, owner: type | None = None, /) -> T:
|
def __get__(self, instance: Any, owner: type | None = None, /) -> T:
|
||||||
if self.__default_value:
|
if self.__default_value:
|
||||||
return getattr(instance, self.__name, self.__default_value)
|
return getattr(instance, self.__name, self.__default_value)
|
||||||
return getattr(instance, self.__name)
|
return getattr(instance, self.__name) # type: ignore
|
||||||
|
|
||||||
def __set__(self, instance: Any, value: T, /) -> None:
|
def __set__(self, instance: Any, value: T, /) -> None:
|
||||||
setattr(instance, self.__name, value)
|
setattr(instance, self.__name, value)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue