1- # Copyright 2019-2021 ObjectBox Ltd. All rights reserved.
1+ # Copyright 2019-2024 ObjectBox Ltd. All rights reserved.
22#
33# Licensed under the Apache License, Version 2.0 (the "License");
44# you may not use this file except in compliance with the License.
1414
1515
1616from objectbox .model .entity import _Entity
17- from objectbox .objectbox import ObjectBox
17+ from objectbox .store import Store
1818from objectbox .query_builder import QueryBuilder
1919from objectbox .condition import QueryCondition
2020from objectbox .c import *
2121
2222
2323class Box :
24- def __init__ (self , ob : ObjectBox , entity : _Entity ):
24+ def __init__ (self , store : Store , entity : _Entity ):
2525 if not isinstance (entity , _Entity ):
2626 raise Exception ("Given type is not an Entity" )
2727
28- self ._ob = ob
28+ self ._store = store
2929 self ._entity = entity
30- self ._c_box = obx_box (ob ._c_store , entity .id )
30+ self ._c_box = obx_box (store ._c_store , entity .id )
3131
3232 def is_empty (self ) -> bool :
3333 is_empty = ctypes .c_bool ()
@@ -109,7 +109,7 @@ def _put_many(self, objects) -> None:
109109 self ._entity .set_object_id (objects [k ], ids [k ])
110110
111111 def get (self , id : int ):
112- with self ._ob .read_tx ():
112+ with self ._store .read_tx ():
113113 c_data = ctypes .c_void_p ()
114114 c_size = ctypes .c_size_t ()
115115 code : obx_err = obx_box_get (self ._c_box , id , ctypes .byref (
@@ -122,7 +122,7 @@ def get(self, id: int):
122122 return self ._entity .unmarshal (data )
123123
124124 def get_all (self ) -> list :
125- with self ._ob .read_tx ():
125+ with self ._store .read_tx ():
126126 # OBX_bytes_array*
127127 c_bytes_array_p = obx_box_get_all (self ._c_box )
128128
@@ -166,7 +166,7 @@ def query(self, condition: Optional[QueryCondition] = None) -> QueryBuilder:
166166 Useful for a user-friendly API design; for example:
167167 ``box.query(name_property.equals("Johnny")).build()``
168168 """
169- qb = QueryBuilder (self ._ob , self )
169+ qb = QueryBuilder (self ._store , self )
170170 if condition is not None :
171171 condition .apply (qb )
172172 return qb
0 commit comments