Skip to content

Linted #15

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
Nov 8, 2021
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
name: pylint (library code)
types: [python]
args:
- --disable=consider-using-f-string
- --disable=consider-using-f-string,duplicate-code
exclude: "^(docs/|examples/|tests/|setup.py$)"
- id: pylint
name: pylint (example code)
Expand Down
13 changes: 4 additions & 9 deletions adafruit_fona/adafruit_fona.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,7 @@ def gps(self):

@gps.setter
def gps(self, gps_on=False):
if not (
self._fona_type == FONA_3G_A
or self._fona_type == FONA_3G_E
or self._fona_type == FONA_808_V1
or self._fona_type == FONA_808_V2
):
if self._fona_type not in (FONA_3G_A, FONA_3G_E, FONA_808_V1, FONA_808_V2):
raise TypeError("GPS unsupported for this FONA module.")

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

if self._fona_type == FONA_3G_A or self._fona_type == FONA_3G_E:
if self._fona_type in (FONA_3G_A, FONA_3G_E):
self._read_line(200) # eat first 'CRLF'
self._read_line(200) # eat second 'CRLF'

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

if self._fona_type == FONA_3G_A or self._fona_type == FONA_3G_E:
if self._fona_type in (FONA_3G_A, FONA_3G_E):
num_sms = self.num_sms()
for slot in range(0, num_sms):
if not self.delete_sms(slot):
Expand Down Expand Up @@ -742,7 +737,7 @@ def socket_close(self, sock_num):
self._uart_write(b"AT+CIPCLOSE=" + str(sock_num).encode() + b"\r\n")
self._read_line(3000)

if self._fona_type == FONA_3G_A or self._fona_type == FONA_3G_E:
if self._fona_type in (FONA_3G_A, FONA_3G_E):
if not self._expect_reply(REPLY_OK):
return False
else:
Expand Down
2 changes: 1 addition & 1 deletion examples/fona_sms.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
print("%d SMS's on SIM Card" % num_sms)

# FONA3G SMS memory slots start at 0
if fona.version == FONA_3G_A or fona.version == FONA_3G_E:
if fona.version in (FONA_3G_A, FONA_3G_E):
sms_idx = 0
else: # FONA800 and FONA808 SMS slots start at 1
sms_idx = 1
Expand Down