Skip to content

Commit

Permalink
changing import to import_module for pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-rakowski committed Dec 12, 2023
1 parent e358611 commit 49cd053
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pylops/utils/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
]

import os
from importlib import util
from importlib import import_module, util
from typing import Optional


Expand Down Expand Up @@ -152,14 +152,14 @@ def cupy_import(message: Optional[str] = None):
if cupy_test:
# try importing it
try:
import cupy # noqa: F401
import_module("cupy") # noqa: F401

# if successful set the message to None.
cupy_message = None
# if unable to import but it is installed
except (ImportError, ModuleNotFoundError) as e:
cupy_message = (
f"Failed to import cupy. Falling back to CPU (error: {e}). "
f"Failed to import cupy, Falling back to CPU (error: {e}). "
f""
"Please ensure your CUDA envrionment is set up correctly "
"for more details visit 'https://docs.cupy.dev/en/stable/install.html'"
Expand Down Expand Up @@ -188,7 +188,7 @@ def cusignal_import(message: Optional[str] = None):
if cusignal_test:
# try importing it
try:
import cusignal # noqa: F401
import_module("cusignal") # noqa: F401

# if successful set the message to None.
cusignal_message = None
Expand Down

0 comments on commit 49cd053

Please sign in to comment.