Skip to content

Commit b7385a0

Browse files
move debug_show_secrets flag to ctor
1 parent 1614277 commit b7385a0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

adafruit_esp32spi/adafruit_esp32spi.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,18 @@ class ESP_SPIcontrol: # pylint: disable=too-many-public-methods, too-many-insta
141141

142142
# pylint: disable=too-many-arguments
143143
def __init__(
144-
self, spi, cs_dio, ready_dio, reset_dio, gpio0_dio=None, *, debug=False
144+
self,
145+
spi,
146+
cs_dio,
147+
ready_dio,
148+
reset_dio,
149+
gpio0_dio=None,
150+
*,
151+
debug=False,
152+
debug_show_secrets=False,
145153
):
146154
self._debug = debug
155+
self._debug_show_secrets = debug_show_secrets
147156
self.set_psk = False
148157
self.set_crt = False
149158
self._buffer = bytearray(10)
@@ -563,22 +572,19 @@ def connect(self, secrets):
563572
that contains a 'ssid' and 'password' entry"""
564573
self.connect_AP(secrets["ssid"], secrets["password"])
565574

566-
def connect_AP(
567-
self, ssid, password, timeout_s=10, show_password=False
568-
): # pylint: disable=invalid-name
575+
def connect_AP(self, ssid, password, timeout_s=10): # pylint: disable=invalid-name
569576
"""Connect to an access point with given name and password.
570577
Will wait until specified timeout seconds and return on success
571578
or raise an exception on failure.
572579
573580
:param ssid: the SSID to connect to
574581
:param passphrase: the password of the access point
575582
:param timeout_s: number of seconds until we time out and fail to create AP
576-
:param show_password: print password if debug == True (default False)
577583
"""
578584
if self._debug:
579585
print(
580586
f"Connect to AP: {ssid=}, password=\
581-
{repr(password if show_password else '*' * len(password))}"
587+
{repr(password if self._debug_show_secrets else '*' * len(password))}"
582588
)
583589
if isinstance(ssid, str):
584590
ssid = bytes(ssid, "utf-8")

0 commit comments

Comments
 (0)