@@ -22,25 +22,25 @@ def make(data=None, **kwargs):
2222
2323def _check_box_size (size ):
2424 if int (size ) <= 0 :
25- msg = f"Invalid box size (was { size } , expected larger than 0)"
26- raise ValueError (msg )
25+ raise ValueError (f"Invalid box size (was { size } , expected larger than 0)" )
2726
2827
2928def _check_border (size ):
3029 if int (size ) < 0 :
31- msg = f"Invalid border value (was { size } , expected 0 or larger than that)"
32- raise ValueError (msg )
30+ raise ValueError (
31+ f"Invalid border value (was { size } , expected 0 or larger than that)"
32+ )
3333
3434
3535def _check_mask_pattern (mask_pattern ):
3636 if mask_pattern is None :
3737 return
3838 if not isinstance (mask_pattern , int ):
39- msg = f"Invalid mask pattern (was { type (mask_pattern )} , expected int)"
40- raise TypeError (msg )
39+ raise TypeError (
40+ f"Invalid mask pattern (was { type (mask_pattern )} , expected int)"
41+ )
4142 if mask_pattern < 0 or mask_pattern > 7 :
42- msg = f"Mask pattern should be in range(8) (got { mask_pattern } )"
43- raise ValueError (msg )
43+ raise ValueError (f"Mask pattern should be in range(8) (got { mask_pattern } )" )
4444
4545
4646def copy_2d_array (x ):
@@ -258,8 +258,7 @@ def print_tty(self, out=None):
258258 out = sys .stdout
259259
260260 if not out .isatty ():
261- msg = "Not a tty"
262- raise OSError (msg )
261+ raise OSError ("Not a tty" )
263262
264263 if self .data_cache is None :
265264 self .make ()
@@ -288,8 +287,7 @@ def print_ascii(self, out=None, tty=False, invert=False):
288287 out = sys .stdout
289288
290289 if tty and not out .isatty ():
291- msg = "Not a tty"
292- raise OSError (msg )
290+ raise OSError ("Not a tty" )
293291
294292 if self .data_cache is None :
295293 self .make ()
@@ -354,8 +352,9 @@ def make_image(self, image_factory=None, **kwargs):
354352 or kwargs .get ("embeded_image_path" )
355353 or kwargs .get ("embeded_image" )
356354 ) and self .error_correction != constants .ERROR_CORRECT_H :
357- msg = "Error correction level must be ERROR_CORRECT_H if an embedded image is provided"
358- raise ValueError (msg )
355+ raise ValueError (
356+ "Error correction level must be ERROR_CORRECT_H if an embedded image is provided"
357+ )
359358
360359 _check_box_size (self .box_size )
361360 if self .data_cache is None :
0 commit comments