Skip to content

Commit 83c42b2

Browse files
authored
Merge pull request #15 from adafruit/patch-fix
Linted
2 parents 0aa257a + 6b113b2 commit 83c42b2

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
name: pylint (library code)
2525
types: [python]
2626
args:
27-
- --disable=consider-using-f-string
27+
- --disable=consider-using-f-string,duplicate-code
2828
exclude: "^(docs/|examples/|tests/|setup.py$)"
2929
- id: pylint
3030
name: pylint (example code)

adafruit_fona/adafruit_fona.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,7 @@ def gps(self):
355355

356356
@gps.setter
357357
def gps(self, gps_on=False):
358-
if not (
359-
self._fona_type == FONA_3G_A
360-
or self._fona_type == FONA_3G_E
361-
or self._fona_type == FONA_808_V1
362-
or self._fona_type == FONA_808_V2
363-
):
358+
if self._fona_type not in (FONA_3G_A, FONA_3G_E, FONA_808_V1, FONA_808_V2):
364359
raise TypeError("GPS unsupported for this FONA module.")
365360

366361
# check if already enabled or disabled
@@ -466,7 +461,7 @@ def send_sms(self, phone_number, message):
466461
# write out message and ^z
467462
self._uart_write((message + chr(26)).encode())
468463

469-
if self._fona_type == FONA_3G_A or self._fona_type == FONA_3G_E:
464+
if self._fona_type in (FONA_3G_A, FONA_3G_E):
470465
self._read_line(200) # eat first 'CRLF'
471466
self._read_line(200) # eat second 'CRLF'
472467

@@ -526,7 +521,7 @@ def delete_all_sms(self):
526521
if not self._send_check_reply(b"AT+CMGF=1", reply=REPLY_OK):
527522
return False
528523

529-
if self._fona_type == FONA_3G_A or self._fona_type == FONA_3G_E:
524+
if self._fona_type in (FONA_3G_A, FONA_3G_E):
530525
num_sms = self.num_sms()
531526
for slot in range(0, num_sms):
532527
if not self.delete_sms(slot):
@@ -742,7 +737,7 @@ def socket_close(self, sock_num):
742737
self._uart_write(b"AT+CIPCLOSE=" + str(sock_num).encode() + b"\r\n")
743738
self._read_line(3000)
744739

745-
if self._fona_type == FONA_3G_A or self._fona_type == FONA_3G_E:
740+
if self._fona_type in (FONA_3G_A, FONA_3G_E):
746741
if not self._expect_reply(REPLY_OK):
747742
return False
748743
else:

examples/fona_sms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
print("%d SMS's on SIM Card" % num_sms)
4040

4141
# FONA3G SMS memory slots start at 0
42-
if fona.version == FONA_3G_A or fona.version == FONA_3G_E:
42+
if fona.version in (FONA_3G_A, FONA_3G_E):
4343
sms_idx = 0
4444
else: # FONA800 and FONA808 SMS slots start at 1
4545
sms_idx = 1

0 commit comments

Comments
 (0)