Skip to content

Commit 57b2824

Browse files
author
Kevin J Walters
committed
Changing the named parameter json_transforms to be singular to match other similar ones. #38 #39
1 parent d2dec13 commit 57b2824

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

adafruit_pyportal.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class PyPortal:
127127
``False``, no wrapping.
128128
:param text_maxlen: The max length of the text for text wrapping. Defaults to 0.
129129
:param text_transform: A function that will be called on the text before display
130-
:param json_transforms: A function or a list of functions to call with the parsed JSON.
130+
:param json_transform: A function or a list of functions to call with the parsed JSON.
131131
Changes and additions are permitted for the ``dict`` object.
132132
:param image_json_path: The JSON traversal path for a background image to display. Defaults to
133133
``None``.
@@ -156,7 +156,7 @@ def __init__(self, *, url=None, headers=None, json_path=None, regexp_path=None,
156156
default_bg=0x000000, status_neopixel=None,
157157
text_font=None, text_position=None, text_color=0x808080,
158158
text_wrap=False, text_maxlen=0, text_transform=None,
159-
json_transforms=None, image_json_path=None,
159+
json_transform=None, image_json_path=None,
160160
image_resize=None, image_position=None,
161161
caption_text=None, caption_font=None, caption_position=None,
162162
caption_color=0x808080, image_url_path=None,
@@ -335,12 +335,12 @@ def __init__(self, *, url=None, headers=None, json_path=None, regexp_path=None,
335335
self._text = None
336336

337337
# Add any JSON translators
338-
self._json_transforms = []
339-
if json_transforms:
340-
if callable(json_transforms):
341-
self._json_transforms.append(json_transforms)
338+
self._json_transform = []
339+
if json_transform:
340+
if callable(json_transform):
341+
self._json_transform.append(json_transform)
342342
else:
343-
self._json_transforms.extend(filter(callable, json_transforms))
343+
self._json_transform.extend(filter(callable, json_transform))
344344

345345
self._image_json_path = image_json_path
346346
self._image_url_path = image_url_path
@@ -726,7 +726,7 @@ def fetch(self, refresh_url=None):
726726

727727
# optional JSON post processing, apply any transformations
728728
# these MAY change/add element
729-
for idx, json_transform in enumerate(self._json_transforms):
729+
for idx, json_transform in enumerate(self._json_transform):
730730
try:
731731
json_transform(json_out)
732732
except Exception as error:

0 commit comments

Comments
 (0)