Skip to content

Commit aa0e207

Browse files
committed
Fixing Pylint Short Namnes
1 parent 5dee063 commit aa0e207

File tree

4 files changed

+78
-71
lines changed

4 files changed

+78
-71
lines changed

adafruit_bme280/advanced.py

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -284,36 +284,36 @@ class Adafruit_BME280_I2C(Adafruit_BME280_Advanced):
284284
285285
**Quickstart: Importing and using the BME280**
286286
287-
Here is an example of using the :class:`Adafruit_BME280_I2C`.
288-
First you will need to import the libraries to use the sensor
287+
Here is an example of using the :class:`Adafruit_BME280_I2C`.
288+
First you will need to import the libraries to use the sensor
289289
290-
.. code-block:: python
290+
.. code-block:: python
291291
292-
import board
293-
import adafruit_bme280.advanced as adafruit_bme280
292+
import board
293+
import adafruit_bme280.advanced as adafruit_bme280
294294
295-
Once this is done you can define your `board.I2C` object and define your sensor object
295+
Once this is done you can define your `board.I2C` object and define your sensor object
296296
297-
.. code-block:: python
297+
.. code-block:: python
298298
299-
i2c = board.I2C() # uses board.SCL and board.SDA
300-
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
299+
i2c = board.I2C() # uses board.SCL and board.SDA
300+
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
301301
302-
You need to setup the pressure at sea level
302+
You need to setup the pressure at sea level
303303
304-
.. code-block:: python
304+
.. code-block:: python
305305
306-
bme280.sea_level_pressure = 1013.25
306+
bme280.sea_level_pressure = 1013.25
307307
308-
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
309-
:attr:`pressure` and :attr:`altitude` attributes
308+
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
309+
:attr:`pressure` and :attr:`altitude` attributes
310310
311-
.. code-block:: python
311+
.. code-block:: python
312312
313-
temperature = bme280.temperature
314-
relative_humidity = bme280.relative_humidity
315-
pressure = bme280.pressure
316-
altitude = bme280.altitude
313+
temperature = bme280.temperature
314+
relative_humidity = bme280.relative_humidity
315+
pressure = bme280.pressure
316+
altitude = bme280.altitude
317317
318318
"""
319319

@@ -325,7 +325,7 @@ class Adafruit_BME280_SPI(Adafruit_BME280_Advanced):
325325
"""Driver for BME280 connected over SPI
326326
327327
:param ~busio.SPI spi: SPI device
328-
:param ~digitalio.DigitalInOut cs: Chip Select
328+
:param ~digitalio.DigitalInOut chip_select: Chip Select
329329
:param int baudrate: Clock rate, default is 100000. Can be changed with :meth:`baudrate`
330330
331331
.. note::
@@ -334,40 +334,42 @@ class Adafruit_BME280_SPI(Adafruit_BME280_Advanced):
334334
335335
**Quickstart: Importing and using the BME280**
336336
337-
Here is an example of using the :class:`Adafruit_BME280_SPI` class.
338-
First you will need to import the libraries to use the sensor
337+
Here is an example of using the :class:`Adafruit_BME280_SPI` class.
338+
First you will need to import the libraries to use the sensor
339339
340-
.. code-block:: python
340+
.. code-block:: python
341341
342-
import board
343-
from digitalio import DigitalInOut
344-
import adafruit_bme280.advanced as adafruit_bme280
342+
import board
343+
from digitalio import DigitalInOut
344+
import adafruit_bme280.advanced as adafruit_bme280
345345
346-
Once this is done you can define your `board.SPI` object and define your sensor object
346+
Once this is done you can define your `board.SPI` object and define your sensor object
347347
348-
.. code-block:: python
348+
.. code-block:: python
349349
350-
cs = digitalio.DigitalInOut(board.D10)
351-
spi = board.SPI()
352-
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, cs)
350+
chip_select = digitalio.DigitalInOut(board.D10)
351+
spi = board.SPI()
352+
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, chip_select)
353353
354-
You need to setup the pressure at sea level
354+
You need to setup the pressure at sea level
355355
356-
.. code-block:: python
356+
.. code-block:: python
357357
358-
bme280.sea_level_pressure = 1013.25
358+
bme280.sea_level_pressure = 1013.25
359359
360-
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
361-
:attr:`pressure` and :attr:`altitude` attributes
360+
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
361+
:attr:`pressure` and :attr:`altitude` attributes
362362
363-
.. code-block:: python
363+
.. code-block:: python
364364
365-
temperature = bme280.temperature
366-
relative_humidity = bme280.relative_humidity
367-
pressure = bme280.pressure
368-
altitude = bme280.altitude
365+
temperature = bme280.temperature
366+
relative_humidity = bme280.relative_humidity
367+
pressure = bme280.pressure
368+
altitude = bme280.altitude
369369
370370
"""
371371

372-
def __init__(self, spi: SPI, cs: DigitalInOut, baudrate: int = 100000) -> None:
373-
super().__init__(SPI_Impl(spi, cs, baudrate))
372+
def __init__(
373+
self, spi: SPI, chip_select: DigitalInOut, baudrate: int = 100000
374+
) -> None:
375+
super().__init__(SPI_Impl(spi, chip_select, baudrate))

adafruit_bme280/basic.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -331,36 +331,36 @@ class Adafruit_BME280_I2C(Adafruit_BME280):
331331
332332
**Quickstart: Importing and using the BME280**
333333
334-
Here is an example of using the :class:`Adafruit_BME280_I2C`.
335-
First you will need to import the libraries to use the sensor
334+
Here is an example of using the :class:`Adafruit_BME280_I2C`.
335+
First you will need to import the libraries to use the sensor
336336
337-
.. code-block:: python
337+
.. code-block:: python
338338
339-
import board
340-
from adafruit_bme280 import basic as adafruit_bme280
339+
import board
340+
from adafruit_bme280 import basic as adafruit_bme280
341341
342-
Once this is done you can define your `board.I2C` object and define your sensor object
342+
Once this is done you can define your `board.I2C` object and define your sensor object
343343
344-
.. code-block:: python
344+
.. code-block:: python
345345
346-
i2c = board.I2C() # uses board.SCL and board.SDA
347-
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
346+
i2c = board.I2C() # uses board.SCL and board.SDA
347+
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
348348
349-
You need to setup the pressure at sea level
349+
You need to setup the pressure at sea level
350350
351-
.. code-block:: python
351+
.. code-block:: python
352352
353-
bme280.sea_level_pressure = 1013.25
353+
bme280.sea_level_pressure = 1013.25
354354
355-
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
356-
:attr:`pressure` and :attr:`altitude` attributes
355+
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
356+
:attr:`pressure` and :attr:`altitude` attributes
357357
358-
.. code-block:: python
358+
.. code-block:: python
359359
360-
temperature = bme280.temperature
361-
relative_humidity = bme280.relative_humidity
362-
pressure = bme280.pressure
363-
altitude = bme280.altitude
360+
temperature = bme280.temperature
361+
relative_humidity = bme280.relative_humidity
362+
pressure = bme280.pressure
363+
altitude = bme280.altitude
364364
365365
"""
366366

@@ -373,7 +373,7 @@ class Adafruit_BME280_SPI(Adafruit_BME280):
373373
"""Driver for BME280 connected over SPI
374374
375375
:param ~busio.SPI spi: SPI device
376-
:param ~digitalio.DigitalInOut cs: Chip Select
376+
:param ~digitalio.DigitalInOut chip_select: Chip Select
377377
:param int baudrate: Clock rate, default is 100000. Can be changed with :meth:`baudrate`
378378
379379
.. note::
@@ -395,9 +395,9 @@ class Adafruit_BME280_SPI(Adafruit_BME280):
395395
396396
.. code-block:: python
397397
398-
cs = digitalio.DigitalInOut(board.D10)
398+
chip_select = digitalio.DigitalInOut(board.D10)
399399
spi = board.SPI()
400-
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, cs)
400+
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, chip_select)
401401
402402
You need to setup the pressure at sea level
403403
@@ -417,5 +417,7 @@ class Adafruit_BME280_SPI(Adafruit_BME280):
417417
418418
"""
419419

420-
def __init__(self, spi: SPI, cs: DigitalInOut, baudrate: int = 100000) -> None:
421-
super().__init__(SPI_Impl(spi, cs, baudrate))
420+
def __init__(
421+
self, spi: SPI, chip_select: DigitalInOut, baudrate: int = 100000
422+
) -> None:
423+
super().__init__(SPI_Impl(spi, chip_select, baudrate))

adafruit_bme280/protocol.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ def read_register(self, register: int, length: int) -> bytearray:
2626
return result
2727

2828
def write_register_byte(self, register: int, value: int) -> None:
29-
"Write to the device register."
29+
"""Write to the device register"""
3030
with self._i2c as i2c:
3131
i2c.write(bytes([register & 0xFF, value & 0xFF]))
3232

3333

3434
class SPI_Impl:
35-
"Protocol implemenation for the SPI bus."
35+
"""Protocol implemenation for the SPI bus."""
3636

3737
def __init__(
3838
self,
3939
spi: SPI,
40-
cs: DigitalInOut, # pylint: disable=invalid-name
40+
chip_select: DigitalInOut,
4141
baudrate: int = 100000,
4242
) -> None:
4343
from adafruit_bus_device import ( # pylint: disable=import-outside-toplevel
4444
spi_device,
4545
)
4646

47-
self._spi = spi_device.SPIDevice(spi, cs, baudrate=baudrate)
47+
self._spi = spi_device.SPIDevice(spi, chip_select, baudrate=baudrate)
4848

4949
def read_register(self, register: int, length: int) -> bytearray:
5050
"Read from the device register."

docs/api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99

1010
.. automodule:: adafruit_bme280.advanced
1111
:members:
12+
13+
.. automodule:: adafruit_bme280.protocol
14+
:members:

0 commit comments

Comments
 (0)