Skip to content

Commit

Permalink
Merge pull request #67 from jposada202020/fixing_short_names
Browse files Browse the repository at this point in the history
Fixing Pylint Short Names
  • Loading branch information
dhalbert authored Mar 27, 2023
2 parents 5dee063 + ed8aec4 commit ce97999
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Good variable names which should always be accepted, separated by a comma
# good-names=i,j,k,ex,Run,_
good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_,cs

# Include a hint for the correct naming format with invalid-name
include-naming-hint=no
Expand Down
80 changes: 40 additions & 40 deletions adafruit_bme280/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,36 +284,36 @@ class Adafruit_BME280_I2C(Adafruit_BME280_Advanced):
**Quickstart: Importing and using the BME280**
Here is an example of using the :class:`Adafruit_BME280_I2C`.
First you will need to import the libraries to use the sensor
Here is an example of using the :class:`Adafruit_BME280_I2C`.
First you will need to import the libraries to use the sensor
.. code-block:: python
.. code-block:: python
import board
import adafruit_bme280.advanced as adafruit_bme280
import board
import adafruit_bme280.advanced as adafruit_bme280
Once this is done you can define your `board.I2C` object and define your sensor object
Once this is done you can define your `board.I2C` object and define your sensor object
.. code-block:: python
.. code-block:: python
i2c = board.I2C() # uses board.SCL and board.SDA
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
i2c = board.I2C() # uses board.SCL and board.SDA
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
You need to setup the pressure at sea level
You need to setup the pressure at sea level
.. code-block:: python
.. code-block:: python
bme280.sea_level_pressure = 1013.25
bme280.sea_level_pressure = 1013.25
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
:attr:`pressure` and :attr:`altitude` attributes
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
:attr:`pressure` and :attr:`altitude` attributes
.. code-block:: python
.. code-block:: python
temperature = bme280.temperature
relative_humidity = bme280.relative_humidity
pressure = bme280.pressure
altitude = bme280.altitude
temperature = bme280.temperature
relative_humidity = bme280.relative_humidity
pressure = bme280.pressure
altitude = bme280.altitude
"""

Expand All @@ -334,38 +334,38 @@ class Adafruit_BME280_SPI(Adafruit_BME280_Advanced):
**Quickstart: Importing and using the BME280**
Here is an example of using the :class:`Adafruit_BME280_SPI` class.
First you will need to import the libraries to use the sensor
Here is an example of using the :class:`Adafruit_BME280_SPI` class.
First you will need to import the libraries to use the sensor
.. code-block:: python
.. code-block:: python
import board
from digitalio import DigitalInOut
import adafruit_bme280.advanced as adafruit_bme280
import board
from digitalio import DigitalInOut
import adafruit_bme280.advanced as adafruit_bme280
Once this is done you can define your `board.SPI` object and define your sensor object
Once this is done you can define your `board.SPI` object and define your sensor object
.. code-block:: python
.. code-block:: python
cs = digitalio.DigitalInOut(board.D10)
spi = board.SPI()
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, cs)
cs = digitalio.DigitalInOut(board.D10)
spi = board.SPI()
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, cs)
You need to setup the pressure at sea level
You need to setup the pressure at sea level
.. code-block:: python
.. code-block:: python
bme280.sea_level_pressure = 1013.25
bme280.sea_level_pressure = 1013.25
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
:attr:`pressure` and :attr:`altitude` attributes
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
:attr:`pressure` and :attr:`altitude` attributes
.. code-block:: python
.. code-block:: python
temperature = bme280.temperature
relative_humidity = bme280.relative_humidity
pressure = bme280.pressure
altitude = bme280.altitude
temperature = bme280.temperature
relative_humidity = bme280.relative_humidity
pressure = bme280.pressure
altitude = bme280.altitude
"""

Expand Down
38 changes: 19 additions & 19 deletions adafruit_bme280/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,36 +331,36 @@ class Adafruit_BME280_I2C(Adafruit_BME280):
**Quickstart: Importing and using the BME280**
Here is an example of using the :class:`Adafruit_BME280_I2C`.
First you will need to import the libraries to use the sensor
Here is an example of using the :class:`Adafruit_BME280_I2C`.
First you will need to import the libraries to use the sensor
.. code-block:: python
.. code-block:: python
import board
from adafruit_bme280 import basic as adafruit_bme280
import board
from adafruit_bme280 import basic as adafruit_bme280
Once this is done you can define your `board.I2C` object and define your sensor object
Once this is done you can define your `board.I2C` object and define your sensor object
.. code-block:: python
.. code-block:: python
i2c = board.I2C() # uses board.SCL and board.SDA
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
i2c = board.I2C() # uses board.SCL and board.SDA
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
You need to setup the pressure at sea level
You need to setup the pressure at sea level
.. code-block:: python
.. code-block:: python
bme280.sea_level_pressure = 1013.25
bme280.sea_level_pressure = 1013.25
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
:attr:`pressure` and :attr:`altitude` attributes
Now you have access to the :attr:`temperature`, :attr:`relative_humidity`
:attr:`pressure` and :attr:`altitude` attributes
.. code-block:: python
.. code-block:: python
temperature = bme280.temperature
relative_humidity = bme280.relative_humidity
pressure = bme280.pressure
altitude = bme280.altitude
temperature = bme280.temperature
relative_humidity = bme280.relative_humidity
pressure = bme280.pressure
altitude = bme280.altitude
"""

Expand Down
6 changes: 3 additions & 3 deletions adafruit_bme280/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ def read_register(self, register: int, length: int) -> bytearray:
return result

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


class SPI_Impl:
"Protocol implemenation for the SPI bus."
"""Protocol implemenation for the SPI bus."""

def __init__(
self,
spi: SPI,
cs: DigitalInOut, # pylint: disable=invalid-name
cs: DigitalInOut,
baudrate: int = 100000,
) -> None:
from adafruit_bus_device import ( # pylint: disable=import-outside-toplevel
Expand Down
3 changes: 3 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@

.. automodule:: adafruit_bme280.advanced
:members:

.. automodule:: adafruit_bme280.protocol
:members:

0 comments on commit ce97999

Please sign in to comment.