Skip to content

Ran black, updated to pylint 2.x #93

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 1 commit into from
Mar 17, 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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
source actions-ci/install.sh
- name: Pip install pylint, black, & Sphinx
run: |
pip install --force-reinstall pylint==1.9.2 black==19.10b0 Sphinx sphinx-rtd-theme
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
- name: Library version
run: git describe --dirty --always --tags
- name: PyLint
Expand Down
25 changes: 15 additions & 10 deletions adafruit_esp32spi/PWMOut.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
* Author(s): Brent Rubell
"""

class PWMOut():

class PWMOut:
"""
Implementation of CircuitPython PWMOut for ESP32SPI.

Expand All @@ -37,16 +38,18 @@ class PWMOut():
:param int frequency: The target frequency in Hertz (32-bit).
:param bool variable_frequency: True if the frequency will change over time.
"""
ESP32_PWM_PINS = set([0, 1, 2, 4, 5,
12, 13, 14, 15,
16, 17, 18, 19,
21, 22, 23, 25,
26, 27, 32, 33])
def __init__(self, esp, pwm_pin, *, frequency=500, duty_cycle=0, variable_frequency=False):

ESP32_PWM_PINS = set(
[0, 1, 2, 4, 5, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33]
)

def __init__(
self, esp, pwm_pin, *, frequency=500, duty_cycle=0, variable_frequency=False
):
if pwm_pin in self.ESP32_PWM_PINS:
self._pwm_pin = pwm_pin
else:
raise AttributeError("Pin %d is not a valid ESP32 GPIO Pin."%pwm_pin)
raise AttributeError("Pin %d is not a valid ESP32 GPIO Pin." % pwm_pin)
self._esp = esp
self._duty_cycle = duty_cycle
self._freq = frequency
Expand All @@ -67,8 +70,10 @@ def deinit(self):
def _is_deinited(self):
"""Checks if PWMOut object has been previously de-initalized"""
if self._pwm_pin is None:
raise ValueError("PWMOut Object has been deinitialized and can no longer "
"be used. Create a new PWMOut object.")
raise ValueError(
"PWMOut Object has been deinitialized and can no longer "
"be used. Create a new PWMOut object."
)

@property
def duty_cycle(self):
Expand Down
Loading