From bd18bf37600a4250c4a3aa2baa5fa8a76ae12326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=E1=BA=B7ng=20Minh=20D=C5=A9ng?= Date: Wed, 24 Nov 2021 21:39:25 +0700 Subject: [PATCH] fix static checking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Đặng Minh Dũng --- trino/auth.py | 21 ++++++++++----------- trino/sqlalchemy/dialect.py | 8 ++++---- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/trino/auth.py b/trino/auth.py index 49dd3f8b..9bdf03a4 100644 --- a/trino/auth.py +++ b/trino/auth.py @@ -90,15 +90,15 @@ def get_exceptions(self): def __eq__(self, other): if not isinstance(other, KerberosAuthentication): return False - return self._config == other._config and \ - self._service_name == other._service_name and \ - self._mutual_authentication == other._mutual_authentication and \ - self._force_preemptive == other._force_preemptive and \ - self._hostname_override == other._hostname_override and \ - self._sanitize_mutual_error_response == other._sanitize_mutual_error_response and \ - self._principal == other._principal and \ - self._delegate == other._delegate and \ - self._ca_bundle == other._ca_bundle + return (self._config == other._config + and self._service_name == other._service_name + and self._mutual_authentication == other._mutual_authentication + and self._force_preemptive == other._force_preemptive + and self._hostname_override == other._hostname_override + and self._sanitize_mutual_error_response == other._sanitize_mutual_error_response + and self._principal == other._principal + and self._delegate == other._delegate + and self._ca_bundle == other._ca_bundle) class BasicAuthentication(Authentication): @@ -121,8 +121,7 @@ def get_exceptions(self): def __eq__(self, other): if not isinstance(other, BasicAuthentication): return False - return self._username == other._username and \ - self._password == other._password + return self._username == other._username and self._password == other._password class _BearerAuth(AuthBase): diff --git a/trino/sqlalchemy/dialect.py b/trino/sqlalchemy/dialect.py index b1021a38..80ee4efa 100644 --- a/trino/sqlalchemy/dialect.py +++ b/trino/sqlalchemy/dialect.py @@ -59,8 +59,8 @@ def dbapi(cls): return trino_dbapi def create_connect_args(self, url: URL) -> Tuple[Sequence[Any], Mapping[str, Any]]: - args = list() - kwargs = dict(host=url.host) + args: Sequence[Any] = list() + kwargs: Dict[str, Any] = dict(host=url.host) if url.port: kwargs['port'] = url.port @@ -79,7 +79,7 @@ def create_connect_args(self, url: URL) -> Tuple[Sequence[Any], Mapping[str, Any if url.password: if not url.username: - raise ValueError(f'Username is required when specify password in connection URL') + raise ValueError('Username is required when specify password in connection URL') kwargs['http_scheme'] = 'https' kwargs['auth'] = BasicAuthentication(url.username, url.password) @@ -125,7 +125,7 @@ def get_pk_constraint(self, connection: Connection, def get_primary_keys(self, connection: Connection, table_name: str, schema: str = None, **kw) -> List[str]: pk = self.get_pk_constraint(connection, table_name, schema) - return pk.get('constrained_columns') # type: List[str] + return pk.get('constrained_columns') # type: ignore def get_foreign_keys(self, connection: Connection, table_name: str, schema: str = None, **kw) -> List[Dict[str, Any]]: