Skip to content

Commit

Permalink
add 'with' support (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalcohol authored Dec 9, 2024
1 parent 5c230fd commit 3f31b8f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions axengine/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ def __init__(
def __del__(self):
self._final()

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
self._final()

def _init(self, vnpu=VNPUType.DISABLED): # vnpu type, the default is disabled
ret = self._sys_lib.AX_SYS_Init()
if 0 != ret:
Expand Down

0 comments on commit 3f31b8f

Please sign in to comment.