You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if header.startswith(b"BM"):
from . import bmp
return bmp.load(file, bitmap=bitmap, palette=palette)
if header.startswith(b"P"):
from . import pnm
return pnm.load(file, header, bitmap=bitmap, palette=palette)
if header.startswith(b"GIF"):
from . import gif
pnm/__init__.py
The lines in question:
if magic_number in [b"P2", b"P5"]:
from . import pgm
return pgm.load(
file, magic_number, pnm_header, bitmap=bitmap, palette=palette
)
if magic_number == b"P3":
from . import ppm_ascii
return ppm_ascii.load(
file, pnm_header[0], pnm_header[1], bitmap=bitmap, palette=palette
)
if magic_number == b"P6":
from . import ppm_binary
return ppm_binary.load(
file, pnm_header[0], pnm_header[1], bitmap=bitmap, palette=palette
)
and
if magic_number.startswith(b"P1"):
from . import pbm_ascii
return pbm_ascii.load(
file, pnm_header[0], pnm_header[1], bitmap=bitmap, palette=palette
)
from . import pbm_binary
return pbm_binary.load(
file, pnm_header[0], pnm_header[1], bitmap=bitmap, palette=palette
)
pnm/pgm/__init__.py
And finally:
if magic_number == b"P2": # To handle ascii PGM files.
from . import ascii as pgm_ascii
return pgm_ascii.load(file, width, height, bitmap=bitmap, palette=palette)
if magic_number == b"P5": # To handle binary PGM files.
from . import binary
return binary.load(file, width, height, bitmap=bitmap, palette=palette)
I'm not sure how resource-intensive the imported libraries are, but I'd assume for something that loads images, they might take up quite a bit of memory. It'd be useful to have someone test this on a board with a smallish amount of memory to see if it still works when everything is imported at once at the top of the file.
Here's what I get when I run pylint 2.4 locally.
bmp/__init__.py
The lines in question:
__init__.py
The lines in question:
pnm/__init__.py
The lines in question:
and
pnm/pgm/__init__.py
And finally:
I'm not sure how resource-intensive the imported libraries are, but I'd assume for something that loads images, they might take up quite a bit of memory. It'd be useful to have someone test this on a board with a smallish amount of memory to see if it still works when everything is imported at once at the top of the file.
Referencing main issue: adafruit/Adafruit_CircuitPython_Bundle#232
The text was updated successfully, but these errors were encountered: