-
Notifications
You must be signed in to change notification settings - Fork 9
#28 Replaced assert() calls with if/else/raise <Exception>() #30
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
Conversation
It seems that the CI have failed. Could you run pylint locally to verify. Thanks |
It seems that you would need to run black before committing again. the CI is not passing. let me know if you need help with that . Thanks |
Yeah, can you please guide me? |
Yes, no problem just use black before submitting in your clone directory, as shown in this guide It is easy to intall with a pip install Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes
I testes this using the folllowing code to use and change the cases for the exceptions
import time
import sys
import displayio
from blinka_displayio_pygamedisplay import PyGameDisplay
from adafruit_progressbar.progressbar import ProgressBar
from adafruit_progressbar.horizontalprogressbar import (
HorizontalProgressBar,
HorizontalFillDirection,
)
display = PyGameDisplay(width=320, height=240, auto_refresh=False)
splash = displayio.Group(max_size=10)
display.show(splash)
color_bitmap = displayio.Bitmap(display.width, display.height, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x2266AA # Teal-ish-kinda
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)
progress_bar = ProgressBar(
width=180,
height=40,
x=10,
y=20,
progress=1.0,
bar_color=0x1100FF,
outline_color=0x777777,
)
splash.append(progress_bar)
horizontal_bar = HorizontalProgressBar(
(10, 80),
(180, 40),
min_value=-40,
max_value=130,
value=80,
border_thickness=6,
margin_size=5,
fill_color=0x778822,
outline_color=0x0000FF,
bar_color=0x00FF00,
direction=HorizontalFillDirection.LEFT_TO_RIGHT,
)
splash.append(horizontal_bar)
horizontal_bar.border_color = 0x990099
horizontal_bar.margin_size = 7
test_value_range_1 = [99, 100, 99, 1, 0, 1]
test_value_range_2 = [120, 130, 129, -20, -39, -40, -28]
delay = 2
_incr = 1
# Must check display.running in the main loop!
while display.running:
print("\nDemonstration of legacy functionality and syntax, increment by 0.01")
for val in range(0, 101):
if not display.running:
sys.exit(0)
_use_value = round((val * 0.01), 2)
if (val % 10) == 0:
print(f"Value has reached {_use_value:2}")
progress_bar.progress = round(_use_value, 2)
display.refresh()
time.sleep(0.05)
print("\nDemonstration of values between 0 and 100 - Horizontal and vertical")
for val in test_value_range_1:
if not display.running:
sys.exit(0)
print(f"Setting value to {val}")
horizontal_bar.value = val
display.refresh()
time.sleep(delay)
print("\nDemonstration of Fahrenheit range -40 and 130 - Horizontal and vertical")
for val in test_value_range_2:
if not display.running:
sys.exit(0)
print(f"Setting value to {val}")
display.refresh()
time.sleep(delay)
Results as expected
Tested on
Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Adafruit PyPortal Titano with samd51j20
Updating https://github.com/adafruit/Adafruit_CircuitPython_BNO08X to 1.1.1 from 1.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_BNO08x#23 from jposada202020/improving_docs > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template > Merge pull request adafruit/Adafruit_CircuitPython_BNO08x#22 from caternuson/iss21 Updating https://github.com/adafruit/Adafruit_CircuitPython_DPS310 to 1.2.6 from 1.2.5: > Merge pull request adafruit/Adafruit_CircuitPython_DPS310#17 from jposada202020/correcting_returning_units > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 3.5.10 from 3.5.9: > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#132 from mikejc58/wait_spi_char > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template Updating https://github.com/adafruit/Adafruit_CircuitPython_PCA9685 to 3.3.7 from 3.3.6: > Merge pull request adafruit/Adafruit_CircuitPython_PCA9685#36 from jvalrog/fix-servo-example > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template Updating https://github.com/adafruit/Adafruit_CircuitPython_SI5351 to 1.2.8 from 1.2.7: > Merge pull request adafruit/Adafruit_CircuitPython_SI5351#21 from jposada202020/changing_assertions > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template Updating https://github.com/adafruit/Adafruit_CircuitPython_TCA9548A to 0.5.0 from 0.4.0: > Merge pull request adafruit/Adafruit_CircuitPython_TCA9548A#35 from jposada202020/adding_example_docs_improvement > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template > "Increase duplicate code check threshold " Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 1.10.1 from 1.10.0: > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#34 from bjnhur/master > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template Updating https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font to 1.5.1 from 1.5.0: > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#47 from adafruit/linting > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout to 1.9.3 from 1.9.2: > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_Layout#39 from adafruit/linting > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_Layout#37 from jposada202020/main Updating https://github.com/adafruit/Adafruit_CircuitPython_Gizmo to 1.3.2 from 1.3.1: > Merge pull request adafruit/Adafruit_CircuitPython_Gizmo#18 from adafruit/linting > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template > "Increase duplicate code check threshold " Updating https://github.com/adafruit/Adafruit_CircuitPython_HID to 5.0.1 from 5.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_HID#69 from jfurcean/fix-led-example > Merge pull request adafruit/Adafruit_CircuitPython_HID#70 from FoamyGuy/adding_brightness_codes > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template Updating https://github.com/adafruit/Adafruit_CircuitPython_ProgressBar to 2.2.0 from 2.1.1: > Merge pull request adafruit/Adafruit_CircuitPython_ProgressBar#31 from jposada202020/progressbar_accelerometer > Merge pull request adafruit/Adafruit_CircuitPython_ProgressBar#30 from alimustafashah/master > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template
No description provided.