Skip to content

Commit 618dc3a

Browse files
committed
fix running aillio.py from source
1 parent 5a5dddb commit 618dc3a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/artisanlib/aillio.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def __init__(self, debug:bool = False) -> None:
189189

190190
def __del__(self) -> None:
191191
if not self.simulated:
192-
self.__close()
192+
self._close_port()
193193

194194
def __dbg(self, msg:str) -> None:
195195
if self.AILLIO_DEBUG and not self.simulated:
@@ -198,7 +198,7 @@ def __dbg(self, msg:str) -> None:
198198
except OSError:
199199
pass
200200

201-
def __open(self) -> None:
201+
def _open_port(self) -> None:
202202
if self.simulated:
203203
return
204204
if self.usbhandle is not None:
@@ -336,7 +336,7 @@ def __open(self) -> None:
336336
self.ep_in = None
337337
raise OSError(f'Failed to configure device: {str(e)}') from e
338338

339-
def __close(self) -> None:
339+
def _close_port(self) -> None:
340340
if self.simulated:
341341
return
342342

@@ -412,7 +412,7 @@ def __updatestate(self, p:'Connection') -> None:
412412
try:
413413
# Check connection periodically
414414
if self.usbhandle is None:
415-
self.__open()
415+
self._open_port()
416416

417417
if self.protocol == 1:
418418
# V1 protocol - read two 64 byte frames
@@ -576,7 +576,7 @@ def __getstate(self) -> None:
576576
return
577577
# Check connection periodically
578578
if self.usbhandle is None:
579-
self.__open()
579+
self._open_port()
580580

581581

582582
def get_roast_number(self) -> int:
@@ -1137,7 +1137,7 @@ def set_preheat(self, temp: int) -> None:
11371137
if __name__ == '__main__':
11381138
R1 = AillioR1(debug=False)
11391139
try:
1140-
R1.__open() # pylint: disable=protected-access
1140+
R1._open_port()
11411141
print(f"Connected to {R1.model} using protocol V{R1.protocol}")
11421142

11431143
# Example reading loop
@@ -1157,4 +1157,4 @@ def set_preheat(self, temp: int) -> None:
11571157
except OSError as e:
11581158
print(f"Error: {e}")
11591159
finally:
1160-
R1.__close() # pylint: disable=protected-access
1160+
R1._close_port()

0 commit comments

Comments
 (0)