From 11005929eccea12453ea104face63ab55b3b0ba0 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 14 Feb 2018 10:28:12 +0100 Subject: [PATCH 1/2] Set packet_ends = None before using in dviread.py __packed_ends__ is used on lines 649 and 653 but it is not defined/set until line 666. This drives linters nuts because it is safer to set variables before using them. --- lib/matplotlib/dviread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/dviread.py b/lib/matplotlib/dviread.py index b12abf4148cd..6f4ed6398fc0 100644 --- a/lib/matplotlib/dviread.py +++ b/lib/matplotlib/dviread.py @@ -640,7 +640,7 @@ def _read(self): Read one page from the file. Return True if successful, False if there were no more pages. """ - packet_len, packet_char, packet_width = None, None, None + packet_char, packet_ends, packet_len, packet_width = None, None, None, None while True: byte = ord(self.file.read(1)[0]) # If we are in a packet, execute the dvi instructions From a060141820ca86e8351a78909d42e9395d1146a0 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 14 Feb 2018 22:35:52 +0100 Subject: [PATCH 2/2] Shorter lines to avoid PEP8 violation --- lib/matplotlib/dviread.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/dviread.py b/lib/matplotlib/dviread.py index 6f4ed6398fc0..b38af56e67ec 100644 --- a/lib/matplotlib/dviread.py +++ b/lib/matplotlib/dviread.py @@ -640,7 +640,8 @@ def _read(self): Read one page from the file. Return True if successful, False if there were no more pages. """ - packet_char, packet_ends, packet_len, packet_width = None, None, None, None + packet_char, packet_ends = None, None + packet_len, packet_width = None, None while True: byte = ord(self.file.read(1)[0]) # If we are in a packet, execute the dvi instructions