Skip to content

Commit 3da156b

Browse files
committed
Reformatted per pre-commit
1 parent b1e3ac2 commit 3da156b

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

adafruit_onewire/bus.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ def reset(self, required: bool = False) -> bool:
9696
raise OneWireError("No presence pulse found. Check devices and wiring.")
9797
return not reset
9898

99-
def readinto(self, buf: bytearray, *, start: int = 0, end: Optional[int] = None) -> None:
99+
def readinto(
100+
self, buf: bytearray, *, start: int = 0, end: Optional[int] = None
101+
) -> None:
100102
"""
101103
Read into ``buf`` from the device. The number of bytes read will be the
102104
length of ``buf``.
@@ -114,7 +116,9 @@ def readinto(self, buf: bytearray, *, start: int = 0, end: Optional[int] = None)
114116
for i in range(start, end):
115117
buf[i] = self._readbyte()
116118

117-
def write(self, buf: bytearray, *, start: int = 0, end: Optional[int] = None) -> None:
119+
def write(
120+
self, buf: bytearray, *, start: int = 0, end: Optional[int] = None
121+
) -> None:
118122
"""
119123
Write the bytes from ``buf`` to the device.
120124
@@ -163,7 +167,9 @@ def _writebyte(self, value: int) -> None:
163167
bit = (value >> i) & 0x1
164168
self._ow.write_bit(bit)
165169

166-
def _search_rom(self, l_rom: Optional[bytearray], diff: int) -> Tuple[bytearray, int]:
170+
def _search_rom(
171+
self, l_rom: Optional[bytearray], diff: int
172+
) -> Tuple[bytearray, int]:
167173
if not self.reset():
168174
return None, 0
169175
self._writebyte(_SEARCH_ROM)

adafruit_onewire/device.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,21 @@ def __init__(self, bus: OneWireBus, address: OneWireAddress):
3131
self._bus = bus
3232
self._address = address
3333

34-
def __enter__(self) -> 'OneWireDevice':
34+
def __enter__(self) -> "OneWireDevice":
3535
self._select_rom()
3636
return self
3737

38-
def __exit__(self, exception_type: Optional[Type[type]], exception_value: Optional[BaseException], traceback: Optional[TracebackType]) -> bool:
38+
def __exit__(
39+
self,
40+
exception_type: Optional[Type[type]],
41+
exception_value: Optional[BaseException],
42+
traceback: Optional[TracebackType],
43+
) -> bool:
3944
return False
4045

41-
def readinto(self, buf: bytearray, *, start: int = 0, end: Optional[int] = None) -> None:
46+
def readinto(
47+
self, buf: bytearray, *, start: int = 0, end: Optional[int] = None
48+
) -> None:
4249
"""
4350
Read into ``buf`` from the device. The number of bytes read will be the
4451
length of ``buf``.
@@ -56,7 +63,9 @@ def readinto(self, buf: bytearray, *, start: int = 0, end: Optional[int] = None)
5663
if self._bus.crc8(buf):
5764
raise RuntimeError("CRC error.")
5865

59-
def write(self, buf: bytearray, *, start: int = 0, end: Optional[int] = None) -> None:
66+
def write(
67+
self, buf: bytearray, *, start: int = 0, end: Optional[int] = None
68+
) -> None:
6069
"""
6170
Write the bytes from ``buf`` to the device.
6271

0 commit comments

Comments
 (0)