Skip to content

Commit b78ffbd

Browse files
authored
Merge pull request #109 from ArcanaFramework/handle-union-in-from-mime
2 parents 21704dd + 86ab641 commit b78ffbd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fileformats/core/datatype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def get_format(mime_name: str) -> ty.Type[DataType]:
263263
f"Did not find '{class_name}' class in fileformats.{namespace} "
264264
f"corresponding to MIME, or MIME-like, type {mime_string}"
265265
) from None
266-
if not issubclass(klass, cls):
266+
if not (ty.get_origin(klass) is ty.Union or issubclass(klass, cls)):
267267
raise FormatRecognitionError(
268268
f"Class '{klass}' does not inherit from '{cls}'"
269269
)

0 commit comments

Comments
 (0)