Skip to content

Commit 3b9d306

Browse files
committed
entity decorator: fixed type signature and updated docstring #52
1 parent af0e4dd commit 3b9d306

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

objectbox/model/entity.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,15 @@ def _unmarshal(self, data: bytes):
278278
obx_models_by_name: Dict[str, List[_Entity]] = {}
279279

280280

281-
def Entity(uid: int = 0, model: str = "default") -> Callable[[Type], _Entity]:
282-
""" Entity decorator that wraps _Entity to allow @Entity(id=, uid=); i.e. no class arguments. """
283-
284-
def wrapper(class_):
281+
def Entity(uid: int = 0, model: str = "default") -> _Entity:
282+
"""
283+
Entity decorator for user classes using syntax ``@Entity([uid=])``
284+
285+
Wraps user classes and returns a ``_Entity`` wrapper.
286+
Use allow @Entity(id=, uid=); i.e. no class arguments.
287+
"""
288+
289+
def wrapper(class_) -> Callable[[Type], _Entity]:
285290
# Also allow defining properties as class members; we'll instantiate them here
286291
class_members = inspect.getmembers(class_, lambda a: (inspect.isclass(a) and issubclass(a, Property)))
287292
for name, member_type in class_members:

0 commit comments

Comments
 (0)