@@ -2582,21 +2582,17 @@ def push_state(self):
25822582 self ._state_stack .append (self .get_state ().copy ())
25832583
25842584 def main (self , s , loc , toks ):
2585- #~ print "finish", toks
25862585 return [Hlist (toks )]
25872586
25882587 def math_string (self , s , loc , toks ):
2589- # print "math_string", toks[0][1:-1]
25902588 return self ._math_expression .parseString (toks [0 ][1 :- 1 ])
25912589
25922590 def math (self , s , loc , toks ):
2593- #~ print "math", toks
25942591 hlist = Hlist (toks )
25952592 self .pop_state ()
25962593 return [hlist ]
25972594
25982595 def non_math (self , s , loc , toks ):
2599- #~ print "non_math", toks
26002596 s = toks [0 ].replace (r'\$' , '$' )
26012597 symbols = [Char (c , self .get_state (), math = False ) for c in s ]
26022598 hlist = Hlist (symbols )
@@ -2630,7 +2626,7 @@ def _make_space(self, percentage):
26302626 r'\!' : - 0.16667 , # -3/18 em = -3 mu
26312627 }
26322628 def space (self , s , loc , toks ):
2633- assert ( len (toks )== 1 )
2629+ assert len (toks )== 1
26342630 num = self ._space_widths [toks [0 ]]
26352631 box = self ._make_space (num )
26362632 return [box ]
@@ -2639,7 +2635,6 @@ def customspace(self, s, loc, toks):
26392635 return [self ._make_space (float (toks [0 ]))]
26402636
26412637 def symbol (self , s , loc , toks ):
2642- # print "symbol", toks
26432638 c = toks [0 ]
26442639 try :
26452640 char = Char (c , self .get_state ())
@@ -2691,7 +2686,6 @@ def symbol(self, s, loc, toks):
26912686 snowflake = symbol
26922687
26932688 def unknown_symbol (self , s , loc , toks ):
2694- # print "symbol", toks
26952689 c = toks [0 ]
26962690 raise ParseFatalException (s , loc , "Unknown symbol: %s" % c )
26972691
@@ -2768,7 +2762,7 @@ def c_over_c(self, s, loc, toks):
27682762 ) (set (_accent_map ))
27692763
27702764 def accent (self , s , loc , toks ):
2771- assert ( len (toks )== 1 )
2765+ assert len (toks )== 1
27722766 state = self .get_state ()
27732767 thickness = state .font_output .get_underline_thickness (
27742768 state .font , state .fontsize , state .dpi )
@@ -2792,7 +2786,6 @@ def accent(self, s, loc, toks):
27922786 ])
27932787
27942788 def function (self , s , loc , toks ):
2795- #~ print "function", toks
27962789 self .push_state ()
27972790 state = self .get_state ()
27982791 state .font = 'rm'
@@ -2830,7 +2823,7 @@ def end_group(self, s, loc, toks):
28302823 return []
28312824
28322825 def font (self , s , loc , toks ):
2833- assert ( len (toks )== 1 )
2826+ assert len (toks )== 1
28342827 name = toks [0 ]
28352828 self .get_state ().font = name
28362829 return []
@@ -2856,7 +2849,7 @@ def is_between_brackets(self, s, loc):
28562849 return False
28572850
28582851 def subsuper (self , s , loc , toks ):
2859- assert ( len (toks )== 1 )
2852+ assert len (toks )== 1
28602853
28612854 nucleus = None
28622855 sub = None
@@ -3086,14 +3079,14 @@ def _genfrac(self, ldelim, rdelim, rule, style, num, den):
30863079 return result
30873080
30883081 def genfrac (self , s , loc , toks ):
3089- assert ( len (toks ) == 1 )
3090- assert ( len (toks [0 ]) == 6 )
3082+ assert len (toks ) == 1
3083+ assert len (toks [0 ]) == 6
30913084
30923085 return self ._genfrac (* tuple (toks [0 ]))
30933086
30943087 def frac (self , s , loc , toks ):
3095- assert ( len (toks ) == 1 )
3096- assert ( len (toks [0 ]) == 2 )
3088+ assert len (toks ) == 1
3089+ assert len (toks [0 ]) == 2
30973090 state = self .get_state ()
30983091
30993092 thickness = state .font_output .get_underline_thickness (
@@ -3104,8 +3097,8 @@ def frac(self, s, loc, toks):
31043097 self ._math_style_dict ['textstyle' ], num , den )
31053098
31063099 def dfrac (self , s , loc , toks ):
3107- assert ( len (toks ) == 1 )
3108- assert ( len (toks [0 ]) == 2 )
3100+ assert len (toks ) == 1
3101+ assert len (toks [0 ]) == 2
31093102 state = self .get_state ()
31103103
31113104 thickness = state .font_output .get_underline_thickness (
@@ -3116,23 +3109,22 @@ def dfrac(self, s, loc, toks):
31163109 self ._math_style_dict ['displaystyle' ], num , den )
31173110
31183111 def stackrel (self , s , loc , toks ):
3119- assert ( len (toks ) == 1 )
3120- assert ( len (toks [0 ]) == 2 )
3112+ assert len (toks ) == 1
3113+ assert len (toks [0 ]) == 2
31213114 num , den = toks [0 ]
31223115
31233116 return self ._genfrac ('' , '' , 0.0 ,
31243117 self ._math_style_dict ['textstyle' ], num , den )
31253118
31263119 def binom (self , s , loc , toks ):
3127- assert ( len (toks ) == 1 )
3128- assert ( len (toks [0 ]) == 2 )
3120+ assert len (toks ) == 1
3121+ assert len (toks [0 ]) == 2
31293122 num , den = toks [0 ]
31303123
31313124 return self ._genfrac ('(' , ')' , 0.0 ,
31323125 self ._math_style_dict ['textstyle' ], num , den )
31333126
31343127 def sqrt (self , s , loc , toks ):
3135- #~ print "sqrt", toks
31363128 root , body = toks [0 ]
31373129 state = self .get_state ()
31383130 thickness = state .font_output .get_underline_thickness (
@@ -3177,8 +3169,8 @@ def sqrt(self, s, loc, toks):
31773169 return [hlist ]
31783170
31793171 def overline (self , s , loc , toks ):
3180- assert ( len (toks )== 1 )
3181- assert ( len (toks [0 ])== 1 )
3172+ assert len (toks )== 1
3173+ assert len (toks [0 ])== 1
31823174
31833175 body = toks [0 ][0 ]
31843176
@@ -3222,7 +3214,6 @@ def _auto_sized_delimiter(self, front, middle, back):
32223214 return hlist
32233215
32243216 def auto_delim (self , s , loc , toks ):
3225- #~ print "auto_delim", toks
32263217 front , middle , back = toks
32273218
32283219 return self ._auto_sized_delimiter (front , middle .asList (), back )
@@ -3320,7 +3311,7 @@ def to_mask(self, texstr, dpi=120, fontsize=14):
33203311 - depth is the offset of the baseline from the bottom of the
33213312 image in pixels.
33223313 """
3323- assert ( self ._output == "bitmap" )
3314+ assert self ._output == "bitmap"
33243315 prop = FontProperties (size = fontsize )
33253316 ftimage , depth = self .parse (texstr , dpi = dpi , prop = prop )
33263317
@@ -3402,7 +3393,7 @@ def get_depth(self, texstr, dpi=120, fontsize=14):
34023393 *fontsize*
34033394 The font size in points
34043395 """
3405- assert ( self ._output == "bitmap" )
3396+ assert self ._output == "bitmap"
34063397 prop = FontProperties (size = fontsize )
34073398 ftimage , depth = self .parse (texstr , dpi = dpi , prop = prop )
34083399 return depth
0 commit comments