Skip to content

Commit

Permalink
fix static checking
Browse files Browse the repository at this point in the history
Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>
  • Loading branch information
dungdm93 committed Nov 24, 2021
1 parent 53e1c67 commit bd18bf3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
21 changes: 10 additions & 11 deletions trino/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions trino/sqlalchemy/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down Expand Up @@ -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]]:
Expand Down

0 comments on commit bd18bf3

Please sign in to comment.