-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(back): Remove top-level GitHub imports to prevent errors
- Loading branch information
Showing
6 changed files
with
139 additions
and
25 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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# @Copyright: CEA-LIST/DIASI/SIALV/LVA (2023) | ||
# @Author: CEA-LIST/DIASI/SIALV/LVA <[email protected]> | ||
# @License: CECILL-C | ||
# | ||
# This software is a collaborative computer program whose purpose is to | ||
# generate and explore labeled data for computer vision applications. | ||
# This software is governed by the CeCILL-C license under French law and | ||
# abiding by the rules of distribution of free software. You can use, | ||
# modify and/ or redistribute the software under the terms of the CeCILL-C | ||
# license as circulated by CEA, CNRS and INRIA at the following URL | ||
# | ||
# http://www.cecill.info | ||
|
||
from .main import attempt_import | ||
|
||
__all__ = [ | ||
"attempt_import", | ||
] |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# @Copyright: CEA-LIST/DIASI/SIALV/LVA (2023) | ||
# @Author: CEA-LIST/DIASI/SIALV/LVA <[email protected]> | ||
# @License: CECILL-C | ||
# | ||
# This software is a collaborative computer program whose purpose is to | ||
# generate and explore labeled data for computer vision applications. | ||
# This software is governed by the CeCILL-C license under French law and | ||
# abiding by the rules of distribution of free software. You can use, | ||
# modify and/ or redistribute the software under the terms of the CeCILL-C | ||
# license as circulated by CEA, CNRS and INRIA at the following URL | ||
# | ||
# http://www.cecill.info | ||
|
||
import importlib | ||
from types import ModuleType | ||
|
||
|
||
def attempt_import(module: str, package: str = None) -> ModuleType: | ||
"""Import specified module, or raise ImportError with a helpful message | ||
Args: | ||
module (str): The name of the module to import | ||
package (str): The package to install, None if identical to module name. Defaults to None. | ||
Returns: | ||
ModuleType: Imported module | ||
""" | ||
|
||
try: | ||
return importlib.import_module(module) | ||
except ImportError as e: | ||
raise ImportError( | ||
f"Please install {module} to use this model: pip install {package or module}" | ||
) from e |