Skip to content

Commit ca129fc

Browse files
committed
Fix outdated comments and typos
1 parent f9e81fc commit ca129fc

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

examples/fsm_endpoint_1.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
99
pip install python4yahdlc[examples]
1010
11-
To create a virtual serial bus, you can use socat as followed:
11+
To create a virtual serial bus, you can use socat as follows:
1212
1313
::
1414
1515
socat -d -d pty,raw,echo=0 pty,raw,echo=0
1616
17-
Then, edit `ser.port` variable as needed.
17+
Then, edit `ser.port` accordingly.
1818
"""
1919

2020
import signal
@@ -26,7 +26,9 @@
2626

2727
from yahdlc import FRAME_ACK, FRAME_DATA, FRAME_NACK, MessageError, frame_data, get_data
2828

29-
# Serial port configuration.
29+
# -------------------------------------------------- #
30+
# Serial port configuration
31+
# -------------------------------------------------- #
3032
ser = serial.Serial()
3133
ser.port = "/dev/pts/5"
3234
ser.baudrate = 9600
@@ -97,9 +99,10 @@ def timeout_handler(signum, frame):
9799
signal.alarm(0)
98100
break
99101
except MessageError:
102+
# No HDLC frame detected.
100103
pass
101104
except TimeoutError as err:
102-
stderr.write("[x] " + str(err) + "\n")
105+
stderr.write(f"[x] {str(err)}\n")
103106
e.fsm.timeout()
104107

105108
if ftype not in (FRAME_ACK, FRAME_NACK):

examples/fsm_endpoint_2.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
99
pip install python4yahdlc[examples]
1010
11-
To create a virtual serial bus, you can use socat as followed:
11+
To create a virtual serial bus, you can use socat as follows:
1212
1313
::
1414
1515
socat -d -d pty,raw,echo=0 pty,raw,echo=0
1616
17-
Then, edit `ser.port` variable as needed.
17+
Then, edit `ser.port` accordingly.
1818
"""
1919

2020
from sys import stderr
@@ -33,7 +33,9 @@
3333
get_data,
3434
)
3535

36+
# -------------------------------------------------- #
3637
# Serial port configuration
38+
# -------------------------------------------------- #
3739
ser = serial.Serial()
3840
ser.port = "/dev/pts/6"
3941
ser.baudrate = 9600
@@ -82,6 +84,7 @@ def wait_for_data(e):
8284
_, ftype, seq_no = get_data(ser.read(ser.in_waiting))
8385
break
8486
except MessageError:
87+
# No HDLC frame detected.
8588
pass
8689
except FCSError:
8790
stderr.write("[x] Bad FCS\n")

examples/receive_data_frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
99
pip install python4yahdlc[examples]
1010
11-
To create a virtual serial bus, you can use socat as followed:
11+
To create a virtual serial bus, you can use socat as follows:
1212
1313
::
1414
1515
socat -d -d pty,raw,echo=0 pty,raw,echo=0
1616
17-
Then, edit `ser.port` variable as needed
17+
Then, edit `SERIAL_PORT` accordingly.
1818
"""
1919

2020
from sys import exit as sys_exit

examples/send_data_frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
99
pip install python4yahdlc[examples]
1010
11-
To create a virtual serial bus, you can use socat as followed:
11+
To create a virtual serial bus, you can use socat as follows:
1212
1313
::
1414
1515
socat -d -d pty,raw,echo=0 pty,raw,echo=0
1616
17-
Then, edit `ser.port` variable as needed.
17+
Then, edit `SERIAL_PORT` accordingly.
1818
"""
1919

2020
import signal

tests/integration/test_encode_decode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ def test_decode_frame_byte_per_byte(self):
4040
self.assertEqual(FRAME_DATA, ftype)
4141
self.assertEqual(0, seq_no)
4242
except MessageError:
43+
# No HDLC frame detected.
4344
pass

0 commit comments

Comments
 (0)