Skip to content

Commit

Permalink
fix(Presto): typing annotations
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 Aug 25, 2022
1 parent dd92edc commit c759331
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions superset/db_engine_specs/presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.
# pylint: disable=too-many-lines
from __future__ import annotations

import logging
import re
import textwrap
Expand Down Expand Up @@ -390,7 +392,7 @@ def update_impersonation_config(

@classmethod
def get_table_names(
cls, database: "Database", inspector: Inspector, schema: Optional[str]
cls, database: Database, inspector: Inspector, schema: Optional[str]
) -> List[str]:
tables = super().get_table_names(database, inspector, schema)
if not is_feature_enabled("PRESTO_SPLIT_VIEWS_FROM_TABLES"):
Expand All @@ -402,7 +404,7 @@ def get_table_names(

@classmethod
def get_view_names(
cls, database: "Database", inspector: Inspector, schema: Optional[str]
cls, database: Database, inspector: Inspector, schema: Optional[str]
) -> List[str]:
"""Returns an empty list
Expand Down Expand Up @@ -760,7 +762,7 @@ def _get_fields(cls, cols: List[Dict[str, Any]]) -> List[ColumnClause]:
@classmethod
def select_star( # pylint: disable=too-many-arguments
cls,
database: "Database",
database: Database,
table_name: str,
engine: Engine,
schema: Optional[str] = None,
Expand Down Expand Up @@ -796,7 +798,7 @@ def select_star( # pylint: disable=too-many-arguments

@classmethod
def get_all_datasource_names(
cls, database: "Database", datasource_type: str
cls, database: Database, datasource_type: str
) -> List[utils.DatasourceName]:
datasource_df = database.get_df(
"SELECT table_schema, table_name FROM INFORMATION_SCHEMA.{}S "
Expand Down Expand Up @@ -925,7 +927,7 @@ def expand_data( # pylint: disable=too-many-locals

@classmethod
def extra_table_metadata(
cls, database: "Database", table_name: str, schema_name: Optional[str]
cls, database: Database, table_name: str, schema_name: Optional[str]
) -> Dict[str, Any]:
metadata = {}

Expand Down Expand Up @@ -957,7 +959,7 @@ def extra_table_metadata(

@classmethod
def get_create_view(
cls, database: "Database", schema: Optional[str], table: str
cls, database: Database, schema: Optional[str], table: str
) -> Optional[str]:
"""
Return a CREATE VIEW statement, or `None` if not a view.
Expand Down Expand Up @@ -1062,7 +1064,7 @@ def _extract_error_message(cls, ex: Exception) -> str:
def _partition_query( # pylint: disable=too-many-arguments,too-many-locals
cls,
table_name: str,
database: "Database",
database: Database,
limit: int = 0,
order_by: Optional[List[Tuple[str, bool]]] = None,
filters: Optional[Dict[Any, Any]] = None,
Expand Down Expand Up @@ -1120,7 +1122,7 @@ def where_latest_partition( # pylint: disable=too-many-arguments
cls,
table_name: str,
schema: Optional[str],
database: "Database",
database: Database,
query: Select,
columns: Optional[List[Dict[str, str]]] = None,
) -> Optional[Select]:
Expand Down Expand Up @@ -1161,7 +1163,7 @@ def latest_partition(
cls,
table_name: str,
schema: Optional[str],
database: "Database",
database: Database,
show_first: bool = False,
) -> Tuple[List[str], Optional[List[str]]]:
"""Returns col name and the latest (max) partition value for a table
Expand Down Expand Up @@ -1204,7 +1206,7 @@ def latest_partition(

@classmethod
def latest_sub_partition(
cls, table_name: str, schema: Optional[str], database: "Database", **kwargs: Any
cls, table_name: str, schema: Optional[str], database: Database, **kwargs: Any
) -> Any:
"""Returns the latest (max) partition value for a table
Expand Down

0 comments on commit c759331

Please sign in to comment.