Skip to content

fix black and pylint failures #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ Installing from PyPI
.. note:: This library is not available on PyPI yet. Install documentation is included
as a standard element. Stay tuned for PyPI availability!

.. todo:: Remove the above note if PyPI version is/will be available at time of release.
If the library is not planned for PyPI, remove the entire 'Installing from PyPI' section.

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-ble-berrymed_pulse_oximeter/>`_. To install for current user:

Expand All @@ -60,11 +57,6 @@ To install in a virtual environment in your current project:
source .env/bin/activate
pip3 install adafruit-circuitpython-ble-berrymed-pulse-oximeter

Usage Example
=============

.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.

Contributing
============

Expand Down
19 changes: 9 additions & 10 deletions adafruit_ble_berrymed_pulse_oximeter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

Protocol defined here: https://github.com/zh2x/BCI_Protocol
Thanks as well to:
https://github.com/ehborisov/BerryMed-Pulse-Oximeter-tool
https://github.com/ScheindorfHyenetics/berrymedBluetoothOxymeter
* https://github.com/ehborisov/BerryMed-Pulse-Oximeter-tool
* https://github.com/ScheindorfHyenetics/berrymedBluetoothOxymeter

**Software and Dependencies:**

Expand All @@ -60,28 +60,27 @@


PulseOximeterValues = namedtuple(
"PulseOximeterValues",
("valid", "spo2", "pulse_rate", "pleth", "finger_present"),
"PulseOximeterValues", ("valid", "spo2", "pulse_rate", "pleth", "finger_present"),
)
"""Namedtuple for measurement values.

.. py:attribute:: PulseOximeterValues.valid
* `PulseOximeterValues.valid`

``True` if sensor readings are not valid right now
``True`` if sensor readings are not valid right now

.. py:attribute:: PulseOximeterValues.finger_present
* `PulseOximeterValues.finger_present`

``True`` if finger present.

.. py:attribute:: PulseOximeterValues.spo2
* `PulseOximeterValues.spo2`

SpO2 value (int): 0-100%: blood oxygen saturation level.

.. py:attribute:: PulseOximeterValues.pulse_rate
* `PulseOximeterValues.pulse_rate`

Pulse rate, in beats per minute (int).

.. py:attribute:: PulseOximeterValues.pleth
* `PulseOximeterValues.pleth`

Plethysmograph value, 0-100 (int).

Expand Down
6 changes: 0 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,9 @@ Table of Contents
.. toctree::
:caption: Tutorials

.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave
the toctree above for use later.

.. toctree::
:caption: Related Products

.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
the toctree above for use later.

.. toctree::
:caption: Other Links

Expand Down
12 changes: 5 additions & 7 deletions examples/ble_berrymed_pulse_oximeter_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@
#
# The sensor updates the readings at 100Hz.

import time

import _bleio
import adafruit_ble
from adafruit_ble.advertising.standard import Advertisement,ProvideServicesAdvertisement
from adafruit_ble.advertising.standard import Advertisement
from adafruit_ble.services.standard.device_info import DeviceInfoService
from adafruit_ble_berrymed_pulse_oximeter import BerryMedPulseOximeterService

# PyLint can't find BLERadio for some reason so special case it here.
ble = adafruit_ble.BLERadio() # pylint: disable=no-member
ble = adafruit_ble.BLERadio() # pylint: disable=no-member

pulse_ox_connection = None

Expand All @@ -30,7 +28,7 @@
if not name:
continue
# "BerryMed" devices may have trailing nulls on their name.
if name.strip('\x00') == "BerryMed":
if name.strip("\x00") == "BerryMed":
pulse_ox_connection = ble.connect(adv)
print("Connected")
break
Expand Down Expand Up @@ -58,9 +56,9 @@
pulse_ox_service = pulse_ox_connection[BerryMedPulseOximeterService]
while pulse_ox_connection.connected:
print(pulse_ox_service.values)
except _bleio.ConnectionError:
except _bleio.ConnectionError: # pylint: disable=no-member
try:
pulse_ox_connection.disconnect()
except:
except _bleio.ConnectionError: # pylint: disable=no-member
pass
pulse_ox_connection = None