@@ -271,7 +271,8 @@ def _output(self):
271271 Output the text and boxes belonging to the most recent page.
272272 page = dvi._output()
273273 """
274- minx , miny , maxx , maxy = np .inf , np .inf , - np .inf , - np .inf
274+ minx = miny = np .inf
275+ maxx = maxy = - np .inf
275276 maxy_pure = - np .inf
276277 for elt in self .text + self .boxes :
277278 if isinstance (elt , Box ):
@@ -422,7 +423,7 @@ def _nop(self, _):
422423 @_dispatch (139 , state = _dvistate .outer , args = ('s4' ,)* 11 )
423424 def _bop (self , c0 , c1 , c2 , c3 , c4 , c5 , c6 , c7 , c8 , c9 , p ):
424425 self .state = _dvistate .inpage
425- self .h , self .v , self .w , self .x , self .y , self .z = 0 , 0 , 0 , 0 , 0 , 0
426+ self .h = self .v = self .w = self .x = self .y = self .z = 0
426427 self .stack = []
427428 self .text = [] # list of Text objects
428429 self .boxes = [] # list of Box objects
@@ -678,16 +679,16 @@ def _read(self):
678679 Read one page from the file. Return True if successful,
679680 False if there were no more pages.
680681 """
681- packet_char , packet_ends = None , None
682- packet_len , packet_width = None , None
682+ packet_char = packet_ends = None
683+ packet_len = packet_width = None
683684 while True :
684685 byte = self .file .read (1 )[0 ]
685686 # If we are in a packet, execute the dvi instructions
686687 if self .state is _dvistate .inpage :
687688 byte_at = self .file .tell ()- 1
688689 if byte_at == packet_ends :
689690 self ._finalize_packet (packet_char , packet_width )
690- packet_len , packet_char , packet_width = None , None , None
691+ packet_len = packet_char = packet_width = None
691692 # fall through to out-of-packet code
692693 elif byte_at > packet_ends :
693694 raise ValueError ("Packet length mismatch in vf file" )
@@ -701,23 +702,31 @@ def _read(self):
701702 # We are outside a packet
702703 if byte < 242 : # a short packet (length given by byte)
703704 packet_len = byte
704- packet_char , packet_width = self ._arg (1 ), self ._arg (3 )
705+ packet_char = self ._arg (1 )
706+ packet_width = self ._arg (3 )
705707 packet_ends = self ._init_packet (byte )
706708 self .state = _dvistate .inpage
707709 elif byte == 242 : # a long packet
708- packet_len , packet_char , packet_width = \
709- [self ._arg (x ) for x in (4 , 4 , 4 )]
710+ packet_len = self ._arg (4 )
711+ packet_char = self ._arg (4 )
712+ packet_width = self ._arg (4 )
710713 self ._init_packet (packet_len )
711714 elif 243 <= byte <= 246 :
712715 k = self ._arg (byte - 242 , byte == 246 )
713- c , s , d , a , l = [self ._arg (x ) for x in (4 , 4 , 4 , 1 , 1 )]
716+ c = self ._arg (4 )
717+ s = self ._arg (4 )
718+ d = self ._arg (4 )
719+ a = self ._arg (1 )
720+ l = self ._arg (1 )
714721 self ._fnt_def_real (k , c , s , d , a , l )
715722 if self ._first_font is None :
716723 self ._first_font = k
717724 elif byte == 247 : # preamble
718- i , k = self ._arg (1 ), self ._arg (1 )
725+ i = self ._arg (1 )
726+ k = self ._arg (1 )
719727 x = self .file .read (k )
720- cs , ds = self ._arg (4 ), self ._arg (4 )
728+ cs = self ._arg (4 )
729+ ds = self ._arg (4 )
721730 self ._pre (i , x , cs , ds )
722731 elif byte == 248 : # postamble (just some number of 248s)
723732 break
@@ -727,8 +736,10 @@ def _read(self):
727736 def _init_packet (self , pl ):
728737 if self .state != _dvistate .outer :
729738 raise ValueError ("Misplaced packet in vf file" )
730- self .h , self .v , self .w , self .x , self .y , self .z = 0 , 0 , 0 , 0 , 0 , 0
731- self .stack , self .text , self .boxes = [], [], []
739+ self .h = self .v = self .w = self .x = self .y = self .z = 0
740+ self .stack = []
741+ self .text = []
742+ self .boxes = []
732743 self .f = self ._first_font
733744 self ._missing_font = None
734745 return self .file .tell () + pl
@@ -794,7 +805,9 @@ def __init__(self, filename):
794805 widths = struct .unpack (f'!{ nw } i' , file .read (4 * nw ))
795806 heights = struct .unpack (f'!{ nh } i' , file .read (4 * nh ))
796807 depths = struct .unpack (f'!{ nd } i' , file .read (4 * nd ))
797- self .width , self .height , self .depth = {}, {}, {}
808+ self .width = {}
809+ self .height = {}
810+ self .depth = {}
798811 for idx , char in enumerate (range (bc , ec + 1 )):
799812 byte0 = char_info [4 * idx ]
800813 byte1 = char_info [4 * idx + 1 ]
0 commit comments