@@ -21,7 +21,7 @@ def load(file, width, height, bitmap=None, palette=None):
2121 Load a PGM ascii file (P2)
2222 """
2323 data_start = file .tell () # keep this so we can rewind
24- palette_colors = set ()
24+ _palette_colors = set ()
2525 pixel = bytearray ()
2626 # build a set of all colors present in the file, so palette and bitmap can be constructed
2727 while True :
@@ -30,14 +30,14 @@ def load(file, width, height, bitmap=None, palette=None):
3030 break
3131 if not byte .isdigit ():
3232 int_pixel = int ("" .join (["%c" % char for char in pixel ]))
33- palette_colors .add (int_pixel )
33+ _palette_colors .add (int_pixel )
3434 pixel = bytearray ()
3535 pixel += byte
3636 if palette :
37- palette = build_palette (palette , palette_colors )
37+ palette = build_palette (palette , _palette_colors )
3838 if bitmap :
39- bitmap = bitmap (width , height , len (palette_colors ))
40- palette_colors = list (palette_colors )
39+ bitmap = bitmap (width , height , len (_palette_colors ))
40+ _palette_colors = list (_palette_colors )
4141 file .seek (data_start )
4242 for y in range (height ):
4343 for x in range (width ):
@@ -48,11 +48,11 @@ def load(file, width, height, bitmap=None, palette=None):
4848 break
4949 pixel += byte
5050 int_pixel = int ("" .join (["%c" % char for char in pixel ]))
51- bitmap [x , y ] = palette_colors .index (int_pixel )
51+ bitmap [x , y ] = _palette_colors .index (int_pixel )
5252 return bitmap , palette
5353
5454
55- def build_palette (palette_class , palette_colors ):
55+ def build_palette (palette_class , palette_colors ): # pylint: disable=duplicate-code
5656 """
5757 construct the Palette, and populate it with the set of palette_colors
5858 """
0 commit comments