Merge pull request #2 from radarhere/open_formats_case

Moved case transformation before initialization check
This commit is contained in:
Piolie 2021-02-05 12:44:48 -03:00 committed by GitHub
commit 957cc1b186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2922,10 +2922,11 @@ def open(fp, mode="r", formats=None):
def _open_core(fp, filename, prefix, formats):
for i in formats:
i = i.upper()
if i not in OPEN:
init()
try:
factory, accept = OPEN[i.upper()]
factory, accept = OPEN[i]
result = not accept or accept(prefix)
if type(result) in [str, bytes]:
accept_warnings.append(result)