Skip to content

Commit 1d3a83b

Browse files
committed
Reformatted per pre-commit
1 parent de00d48 commit 1d3a83b

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

adafruit_24lc32.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ class EEPROM:
5454
Must be a ``DigitalInOut`` object.
5555
"""
5656

57-
def __init__(self, max_size: int, write_protect: bool = False, wp_pin: Optional[DigitalInOut] = None) -> None:
57+
def __init__(
58+
self,
59+
max_size: int,
60+
write_protect: bool = False,
61+
wp_pin: Optional[DigitalInOut] = None,
62+
) -> None:
5863
self._max_size = max_size
5964
self._wp = write_protect
6065
self._wraparound = False
@@ -97,7 +102,7 @@ def write_protected(self) -> bool:
97102
def __len__(self) -> int:
98103
"""The size of the current EEPROM chip. This is one more than the highest
99104
address location that can be read or written to.
100-
105+
101106
.. code-block:: python
102107
103108
eeprom = adafruit_24lc32.EEPROM_I2C()
@@ -148,7 +153,9 @@ def __getitem__(self, address: Union[int, slice]) -> bytearray:
148153

149154
return read_buffer
150155

151-
def __setitem__(self, address: Union[int, slice], value: Union[int, Sequence[int]]) -> None:
156+
def __setitem__(
157+
self, address: Union[int, slice], value: Union[int, Sequence[int]]
158+
) -> None:
152159
"""Write the value at the given starting index.
153160
154161
.. code-block:: python
@@ -200,7 +207,9 @@ def _read_address(self, address: int, read_buffer: bytearray) -> bytearray:
200207
# Implemented by subclass
201208
raise NotImplementedError
202209

203-
def _write(self, start_address: int, data: Union[int, Sequence[int]], wraparound: bool) -> None:
210+
def _write(
211+
self, start_address: int, data: Union[int, Sequence[int]], wraparound: bool
212+
) -> None:
204213
# Implemened by subclass
205214
raise NotImplementedError
206215

@@ -217,7 +226,13 @@ class EEPROM_I2C(EEPROM):
217226
"""
218227

219228
# pylint: disable=too-many-arguments
220-
def __init__(self, i2c_bus: I2C, address: int = 0x50, write_protect: bool = False, wp_pin: Optional[DigitalInOut] = None) -> None:
229+
def __init__(
230+
self,
231+
i2c_bus: I2C,
232+
address: int = 0x50,
233+
write_protect: bool = False,
234+
wp_pin: Optional[DigitalInOut] = None,
235+
) -> None:
221236
from adafruit_bus_device.i2c_device import ( # pylint: disable=import-outside-toplevel
222237
I2CDevice as i2cdev,
223238
)
@@ -233,7 +248,12 @@ def _read_address(self, address: int, read_buffer: bytearray) -> bytearray:
233248
i2c.write_then_readinto(write_buffer, read_buffer)
234249
return read_buffer
235250

236-
def _write(self, start_address: int, data: Union[int, Sequence[int]], wraparound: bool = False) -> None:
251+
def _write(
252+
self,
253+
start_address: int,
254+
data: Union[int, Sequence[int]],
255+
wraparound: bool = False,
256+
) -> None:
237257
# Decided against using the chip's "Page Write", since that would require
238258
# doubling the memory usage by creating a buffer that includes the passed
239259
# in data so that it can be sent all in one `i2c.write`. The single-write

0 commit comments

Comments
 (0)