Skip to content

Commit

Permalink
replace imghdr by puremagic
Browse files Browse the repository at this point in the history
imghdr allowed to detect a few imagetimes and has been deprecated
in python 3.13: https://docs.python.org/3.12/library/imghdr.html

from the release notes:

> The filetype, puremagic, or python-magic libraries should be used as replacements.
> For example, the puremagic.what() function can be used to replace the imghdr.what()
> function for all file formats that were supported by imghdr.

See also https://github.com/cdgriffith/puremagic/blob/763349ec4d02ba930fb1142c6eb684afdf06c6ab/puremagic/main.py#L421
  • Loading branch information
bernt-matthias committed Oct 29, 2024
1 parent d11d893 commit 9b3a7d7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 1 addition & 0 deletions lib/galaxy/dependencies/pinned-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ h5py==3.11.0 ; python_version >= "3.8" and python_version < "3.9"
h5py==3.12.1 ; python_version >= "3.9" and python_version < "3.13"
humanfriendly==10.0 ; python_version >= "3.8" and python_version < "3.13"
idna==3.10 ; python_version >= "3.8" and python_version < "3.13"
puremagic=1.28 ; python_version >= "3.8" and python_version < "3.13"
importlib-metadata==8.5.0 ; python_version >= "3.8" and python_version < "3.13"
importlib-resources==6.4.5 ; python_version >= "3.8" and python_version < "3.9"
isa-rwval @ git+https://github.com/nsoranzo/isa-rwval.git@3d989181058d2765a93cb0e7ca85d6955e0eb6ef ; python_version >= "3.8" and python_version < "3.13"
Expand Down
2 changes: 0 additions & 2 deletions lib/galaxy/util/image_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ def image_type(filename: str) -> Optional[str]:
# We continue to try with imghdr, so this is a rare case of an
# exception we expect to happen frequently, so we're not logging
pass
if not fmt:
fmt = imghdr.what(filename)
if fmt:
return fmt.upper()
else:
Expand Down

0 comments on commit 9b3a7d7

Please sign in to comment.