-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #582 from kif/extensions
Fix extention manipulation
- Loading branch information
Showing
6 changed files
with
18 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
__contact__ = "[email protected]" | ||
__license__ = "MIT" | ||
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" | ||
__date__ = "02/05/2024" | ||
__date__ = "23/08/2024" | ||
__status__ = "stable" | ||
__docformat__ = 'restructuredtext' | ||
|
||
|
@@ -195,6 +195,7 @@ def _get_extension_mapping(): | |
if not hasattr(codec, "DEFAULT_EXTENSIONS"): | ||
continue | ||
for ext in codec.DEFAULT_EXTENSIONS: | ||
ext = ext.strip(".") | ||
if ext not in _extension_cache: | ||
_extension_cache[ext] = [] | ||
_extension_cache[ext].append(codec) | ||
|
@@ -208,8 +209,8 @@ def get_classes_from_extension(extension): | |
:param str extension: File extension, for example "edf" | ||
:return: fabio image class | ||
""" | ||
extension = extension.lower().strip(".") | ||
mapping = _get_extension_mapping() | ||
extension = extension.lower() | ||
if extension in mapping: | ||
# clone the list | ||
return list(mapping[extension]) | ||
|
@@ -224,9 +225,7 @@ def is_extension_supported(extension): | |
:param str format_name: Format name, for example, "edfimage" | ||
:return: instance of the new class | ||
""" | ||
mapping = _get_extension_mapping() | ||
extension = extension.lower() | ||
return extension in mapping | ||
return bool(get_classes_from_extension(extension)) | ||
|
||
|
||
def factory(name): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
__contact__ = "[email protected]" | ||
__license__ = "MIT" | ||
__copyright__ = "2020 ESRF" | ||
__date__ = "19/03/2024" | ||
__date__ = "23/08/2024" | ||
|
||
import logging | ||
logger = logging.getLogger(__name__) | ||
|
@@ -119,7 +119,7 @@ class SparseImage(FabioImage): | |
|
||
DESCRIPTION = "spasify-Bragg" | ||
|
||
DEFAULT_EXTENSIONS = [".h5", ".hdf5", ".nxs"] | ||
DEFAULT_EXTENSIONS = ["h5", "hdf5", "nxs"] | ||
|
||
NOISY = False | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters