Skip to content

Commit

Permalink
chore: add decorator type
Browse files Browse the repository at this point in the history
  • Loading branch information
elhoangvu committed Apr 29, 2024
1 parent 4a36cf6 commit 60498b4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/dictrule/var_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,24 @@ def __init__(
self.__doc__ = doc
self.__name__ = fget.__name__

def __get__(self, obj, objtype=None):
def __get__(self, obj, objtype=None) -> Any:
if obj is None:
return self
if self.fget is None:
raise AttributeError("unreadable attribute")
return self.fget(obj)

def __set__(self, obj, value):
def __set__(self, obj, value) -> None:
if self.fset is None:
raise AttributeError("can't set attribute")
self.fset(obj, value)

def __delete__(self, obj):
def __delete__(self, obj) -> None:
if self.fdel is None:
raise AttributeError("can't delete attribute")
self.fdel(obj)

def getter(self, fget):
def getter(self, fget) -> "var_property":
"""Getter decorator
Examples:
Expand All @@ -83,7 +83,7 @@ def getter(self, fget):
"""
return type(self)(fget, self.fset, self.fdel, self.__doc__)

def setter(self, fset):
def setter(self, fset) -> "var_property":
"""Setter decorator
Examples:
Expand All @@ -94,7 +94,7 @@ def setter(self, fset):
"""
return type(self)(self.fget, fset, self.fdel, self.__doc__)

def deleter(self, fdel):
def deleter(self, fdel) -> "var_property":
"""Deleter decorator
Examples:
Expand Down

0 comments on commit 60498b4

Please sign in to comment.