Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jvoisin
mat2
Commits
1f73a16e
Commit
1f73a16e
authored
Jan 14, 2023
by
jvoisin
Browse files
imghdr is deprecated
parent
e8b38f11
Pipeline
#126007
passed with stages
in 4 minutes and 38 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
libmat2/images.py
View file @
1f73a16e
import
imghdr
import
os
import
re
from
typing
import
Union
,
Any
...
...
@@ -71,9 +70,6 @@ class PNGParser(exiftool.ExiftoolParser):
def
__init__
(
self
,
filename
):
super
().
__init__
(
filename
)
if
imghdr
.
what
(
filename
)
!=
'png'
:
raise
ValueError
try
:
# better fail here than later
cairo
.
ImageSurface
.
create_from_png
(
self
.
filename
)
except
:
# pragma: no cover
...
...
@@ -111,7 +107,6 @@ class GdkPixbufAbstractParser(exiftool.ExiftoolParser):
def
__init__
(
self
,
filename
):
super
().
__init__
(
filename
)
# we can't use imghdr here because of https://bugs.python.org/issue28591
try
:
GdkPixbuf
.
Pixbuf
.
new_from_file
(
self
.
filename
)
except
GLib
.
GError
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment