diff --git a/omniduct/databases/base.py b/omniduct/databases/base.py index 513e25a..f1cf9da 100644 --- a/omniduct/databases/base.py +++ b/omniduct/databases/base.py @@ -963,10 +963,7 @@ def _register_magics(self, base_name): Documentation for these magics is provided online. """ - # pylint: disable-next=import-error from IPython import get_ipython - - # pylint: disable-next=import-error from IPython.core.magic import ( register_line_magic, register_cell_magic, diff --git a/omniduct/databases/exasol.py b/omniduct/databases/exasol.py index 76e9f34..c0d7da1 100644 --- a/omniduct/databases/exasol.py +++ b/omniduct/databases/exasol.py @@ -46,7 +46,7 @@ def _init(self, schema=None, engine_opts=None): @override def _connect(self): - import pyexasol # pylint: disable=import-error + import pyexasol logger.info("Connecting to Exasol ...") # pylint: disable-next=attribute-defined-outside-init diff --git a/omniduct/databases/hiveserver2.py b/omniduct/databases/hiveserver2.py index 2f497a8..7424c41 100644 --- a/omniduct/databases/hiveserver2.py +++ b/omniduct/databases/hiveserver2.py @@ -216,7 +216,6 @@ def _execute(self, statement, cursor, wait, session_properties, poll_interval=1) log_offset = 0 if self.driver == "pyhive": - # pylint: disable-next=import-error from TCLIService.ttypes import TOperationState # noqa: F821 cursor.execute(statement, **{"async": True}) @@ -249,7 +248,6 @@ def _cursor_empty(self, cursor): return False def _cursor_wait(self, cursor, poll_interval=1): - # pylint: disable-next=import-error from TCLIService.ttypes import TOperationState # noqa: F821 status = cursor.poll().operationState diff --git a/omniduct/databases/neo4j.py b/omniduct/databases/neo4j.py index b3d8f54..854ce1a 100644 --- a/omniduct/databases/neo4j.py +++ b/omniduct/databases/neo4j.py @@ -31,7 +31,7 @@ def _init(self): # Connection @override def _connect(self): - from neo4j.v1 import GraphDatabase # pylint: disable=import-error + from neo4j.v1 import GraphDatabase logger.info("Connecting to Neo4J graph database ...") auth = (self.username, self.password) if self.username else None diff --git a/omniduct/databases/presto.py b/omniduct/databases/presto.py index 001ad6e..f26308b 100644 --- a/omniduct/databases/presto.py +++ b/omniduct/databases/presto.py @@ -127,15 +127,8 @@ def _execute(self, statement, cursor, wait, session_properties): log and present the user with useful debugging information. If that fails, the full traceback will be raised instead. """ - # pylint: disable-next=import-error - from pyhive import ( - presto, - ) - - # pylint: disable-next=import-error - from pyhive.exc import ( - DatabaseError, - ) + from pyhive import presto + from pyhive.exc import DatabaseError try: cursor = cursor or presto.Cursor( @@ -266,7 +259,7 @@ def _table_list(self, namespace, like=None, **kwargs): @override def _table_exists(self, table, **kwargs): - from pyhive.exc import DatabaseError # pylint: disable=import-error + from pyhive.exc import DatabaseError logger.disabled = True try: diff --git a/omniduct/databases/pyspark.py b/omniduct/databases/pyspark.py index 65275c9..79af2ba 100644 --- a/omniduct/databases/pyspark.py +++ b/omniduct/databases/pyspark.py @@ -44,7 +44,7 @@ def _init( @override def _connect(self): - from pyspark.sql import SparkSession # pylint: disable=import-error + from pyspark.sql import SparkSession builder = SparkSession.builder.appName(self.app_name) if self.master: diff --git a/omniduct/filesystems/_pyarrow_compat.py b/omniduct/filesystems/_pyarrow_compat.py index 0683a01..63057e8 100644 --- a/omniduct/filesystems/_pyarrow_compat.py +++ b/omniduct/filesystems/_pyarrow_compat.py @@ -1,4 +1,3 @@ -# pylint: disable=import-error from pyarrow.filesystem import FileSystem from pyarrow.util import implements, _stringify_path diff --git a/omniduct/filesystems/_webhdfs_helpers.py b/omniduct/filesystems/_webhdfs_helpers.py index 85cc6e0..ae7c1cc 100644 --- a/omniduct/filesystems/_webhdfs_helpers.py +++ b/omniduct/filesystems/_webhdfs_helpers.py @@ -1,5 +1,3 @@ -# pylint: disable=import-error # protected via the webhdfs module. - import http.client import json import xml.dom.minidom diff --git a/omniduct/filesystems/base.py b/omniduct/filesystems/base.py index a3a76c8..f638818 100644 --- a/omniduct/filesystems/base.py +++ b/omniduct/filesystems/base.py @@ -757,7 +757,6 @@ def upload(self, source, dest=None, overwrite=False, fs=None): # Magics @override def _register_magics(self, base_name): - # pylint: disable-next=import-error from IPython.core.magic import register_line_magic, register_cell_magic @register_line_magic(f"{base_name}.listdir") diff --git a/omniduct/filesystems/s3.py b/omniduct/filesystems/s3.py index 566c6c6..1e85bd7 100644 --- a/omniduct/filesystems/s3.py +++ b/omniduct/filesystems/s3.py @@ -74,7 +74,7 @@ def _init( self._client = None # Ensure self.host is updated with correct AWS region - import boto3 # pylint: disable=import-error + import boto3 self.host = f"autoscaling.{(session or boto3.Session(profile_name=self.aws_profile)).region_name or 'us-east-1'}.amazonaws.com" @@ -88,10 +88,9 @@ def _connect(self): self._resource = self._session.resource("s3") def _get_boto3_session(self): - import boto3 # pylint: disable=import-error + import boto3 if self.use_opinel: - # pylint: disable-next=import-error from opinel.utils.credentials import read_creds # Refresh access token, and attach credentials to current object for debugging @@ -111,7 +110,7 @@ def _is_connected(self): if self._client is None: return False # Check if still able to perform requests against AWS - import botocore # pylint: disable=import-error + import botocore try: self._client.list_buckets() diff --git a/omniduct/filesystems/webhdfs.py b/omniduct/filesystems/webhdfs.py index 0f701d9..fe2b4f3 100644 --- a/omniduct/filesystems/webhdfs.py +++ b/omniduct/filesystems/webhdfs.py @@ -111,7 +111,7 @@ def _path_separator(self): # File node properties @override def _exists(self, path): - from pywebhdfs.errors import FileNotFound # pylint: disable=import-error + from pywebhdfs.errors import FileNotFound try: self.__webhdfs.get_file_dir_status(path) @@ -121,7 +121,7 @@ def _exists(self, path): @override def _isdir(self, path): - from pywebhdfs.errors import FileNotFound # pylint: disable=import-error + from pywebhdfs.errors import FileNotFound try: stats = self.__webhdfs.get_file_dir_status(path) @@ -131,7 +131,7 @@ def _isdir(self, path): @override def _isfile(self, path): - from pywebhdfs.errors import FileNotFound # pylint: disable=import-error + from pywebhdfs.errors import FileNotFound try: stats = self.__webhdfs.get_file_dir_status(path) diff --git a/omniduct/remotes/base.py b/omniduct/remotes/base.py index 59e4b4f..4a4d65e 100644 --- a/omniduct/remotes/base.py +++ b/omniduct/remotes/base.py @@ -188,7 +188,7 @@ def prepare_smartcards(self): return smartcard_added def _prepare_smartcard(self, name, filename): - import pexpect # pylint: disable=import-error + import pexpect remover = pexpect.spawn(f'ssh-add -e "{filename}"') i = remover.expect(["Card removed:", "Could not remove card", pexpect.TIMEOUT]) diff --git a/omniduct/remotes/ssh.py b/omniduct/remotes/ssh.py index 513a563..65232ce 100644 --- a/omniduct/remotes/ssh.py +++ b/omniduct/remotes/ssh.py @@ -66,7 +66,7 @@ def _connect(self): inspired by the `pxssh` module of `pexpect` (https://github.com/pexpect/pexpect). We have adjusted this workflow to our purposes. """ - import pexpect # pylint: disable=import-error + import pexpect # Create socket directory if it doesn't exist. socket_dir = os.path.dirname(self._socket_path) diff --git a/omniduct/remotes/ssh_paramiko.py b/omniduct/remotes/ssh_paramiko.py index cfc4f0e..55bd4fd 100644 --- a/omniduct/remotes/ssh_paramiko.py +++ b/omniduct/remotes/ssh_paramiko.py @@ -37,7 +37,7 @@ def _init(self): @override def _connect(self): - import paramiko # pylint: disable=import-error + import paramiko # pylint: disable-next=attribute-defined-outside-init self.__client = paramiko.SSHClient() diff --git a/omniduct/restful/base.py b/omniduct/restful/base.py index 9b2e98a..69a5697 100644 --- a/omniduct/restful/base.py +++ b/omniduct/restful/base.py @@ -94,7 +94,7 @@ def request(self, endpoint, method="get", **kwargs): Returns: requests.Response: The response object associated with this request. """ - import requests # pylint: disable=import-error + import requests url = urljoin(self.base_url, endpoint) return requests.request( diff --git a/omniduct/utils/about.py b/omniduct/utils/about.py index 5365cfc..c1349f1 100644 --- a/omniduct/utils/about.py +++ b/omniduct/utils/about.py @@ -109,8 +109,8 @@ def show_about( } try: - from IPython import get_ipython # pylint: disable=import-error - from IPython.display import display, HTML # pylint: disable=import-error + from IPython import get_ipython + from IPython.display import display, HTML ip = get_ipython() if ip is not None and ip.has_trait("kernel"): diff --git a/omniduct/utils/magics.py b/omniduct/utils/magics.py index 1c6fcd6..3044c4d 100644 --- a/omniduct/utils/magics.py +++ b/omniduct/utils/magics.py @@ -28,7 +28,7 @@ def wrapped(*args, **kwargs): def _process_line_arguments(line_arguments): - from IPython import get_ipython # pylint: disable=import-error + from IPython import get_ipython args = [] kwargs = {} @@ -56,7 +56,7 @@ def register_magics(self, base_name=None): raise RuntimeError("Cannot register magics without a base_name.") try: - from IPython import get_ipython # pylint: disable=import-error + from IPython import get_ipython ip = get_ipython() assert ip is not None diff --git a/pyproject.toml b/pyproject.toml index 455e637..f733fd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -192,6 +192,7 @@ disable = [ "duplicate-code", "eval-used", "fixme", + "import-error", "import-outside-toplevel", "invalid-name", "line-too-long",