@@ -31,11 +31,13 @@ def __init__(self, store: Store, entity: _Entity):
3131 self ._c_box = obx_box (store ._c_store , entity ._id )
3232
3333 def is_empty (self ) -> bool :
34+ """Returns true if box is empty (i.e. no objects of entity type are available)."""
3435 is_empty = ctypes .c_bool ()
3536 obx_box_is_empty (self ._c_box , ctypes .byref (is_empty ))
3637 return bool (is_empty .value )
3738
3839 def count (self , limit : int = 0 ) -> int :
40+ """Returns the count of existing objects."""
3941 count = ctypes .c_uint64 ()
4042 obx_box_count (self ._c_box , limit , ctypes .byref (count ))
4143 return int (count .value )
@@ -110,6 +112,7 @@ def _put_many(self, objects) -> None:
110112 self ._entity ._set_object_id (objects [k ], ids [k ])
111113
112114 def get (self , id : int ):
115+ """Get object by given Id or None if not found."""
113116 with self ._store .read_tx ():
114117 c_data = ctypes .c_void_p ()
115118 c_size = ctypes .c_size_t ()
@@ -123,6 +126,7 @@ def get(self, id: int):
123126 return self ._entity ._unmarshal (data )
124127
125128 def get_all (self ) -> list :
129+ """Get all objects."""
126130 with self ._store .read_tx ():
127131 # OBX_bytes_array*
128132 c_bytes_array_p = obx_box_get_all (self ._c_box )
@@ -143,6 +147,7 @@ def get_all(self) -> list:
143147 obx_bytes_array_free (c_bytes_array_p )
144148
145149 def remove (self , id_or_object ) -> bool :
150+ """Remove object by id or object."""
146151 if isinstance (id_or_object , self ._entity ._user_type ):
147152 id = self ._entity ._get_object_id (id_or_object )
148153 else :
@@ -155,6 +160,7 @@ def remove(self, id_or_object) -> bool:
155160 return True
156161
157162 def remove_all (self ) -> int :
163+ """Removes all objects and returns number of removed."""
158164 count = ctypes .c_uint64 ()
159165 obx_box_remove_all (self ._c_box , ctypes .byref (count ))
160166 return int (count .value )
@@ -166,7 +172,7 @@ def query(self, condition: Optional[QueryCondition] = None) -> QueryBuilder:
166172 If given, applies the given high-level condition to the new QueryBuilder object.
167173 Useful for a user-friendly API design; for example:
168174
169- ``box.query(name_property .equals("Johnny")).build()``
175+ ``box.query(MyEntity.name .equals("Johnny")).build()``
170176 """
171177 qb = QueryBuilder (self ._store , self )
172178 if condition is not None :
0 commit comments