chore(pylint): Remove top-level disable (#16589)

* chore(pylint): Remove top-level disable

* Update examples.py

* Update command.py

Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
John Bodley 2021-09-15 09:30:23 -07:00 committed by GitHub
parent adc3d24c21
commit fb4650a6eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 681 additions and 655 deletions

View File

@ -120,7 +120,7 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme
[BASIC] [BASIC]
# Good variable names which should always be accepted, separated by a comma # Good variable names which should always be accepted, separated by a comma
good-names=_,df,ex,f,i,id,j,k,l,o,pk,Run,ts,v,x good-names=_,df,ex,f,i,id,j,k,l,o,pk,Run,ts,v,x,y
# Bad variable names which should always be refused, separated by a comma # Bad variable names which should always be refused, separated by a comma
bad-names=fd,foo,bar,baz,toto,tutu,tata bad-names=fd,foo,bar,baz,toto,tutu,tata

View File

@ -13,9 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
#
# pylint: disable=no-value-for-parameter
import csv as lib_csv import csv as lib_csv
import os import os
import re import re

View File

@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=protected-access
from typing import Any, Dict, List, Set, Tuple from typing import Any, Dict, List, Set, Tuple
from marshmallow import Schema from marshmallow import Schema
@ -78,6 +76,7 @@ class ImportExamplesCommand(ImportModelsCommand):
@classmethod @classmethod
def _get_uuids(cls) -> Set[str]: def _get_uuids(cls) -> Set[str]:
# pylint: disable=protected-access
return ( return (
ImportDatabasesCommand._get_uuids() ImportDatabasesCommand._get_uuids()
| ImportDatasetsCommand._get_uuids() | ImportDatasetsCommand._get_uuids()
@ -85,9 +84,8 @@ class ImportExamplesCommand(ImportModelsCommand):
| ImportDashboardsCommand._get_uuids() | ImportDashboardsCommand._get_uuids()
) )
# pylint: disable=too-many-locals, arguments-differ
@staticmethod @staticmethod
def _import( def _import( # pylint: disable=arguments-differ,too-many-locals
session: Session, session: Session,
configs: Dict[str, Any], configs: Dict[str, Any],
overwrite: bool = False, overwrite: bool = False,

View File

@ -38,6 +38,7 @@ from dateutil import tz
from flask import Blueprint from flask import Blueprint
from flask_appbuilder.security.manager import AUTH_DB from flask_appbuilder.security.manager import AUTH_DB
from pandas.io.parsers import STR_NA_VALUES from pandas.io.parsers import STR_NA_VALUES
from werkzeug.local import LocalProxy
from superset.jinja_context import BaseTemplateProcessor from superset.jinja_context import BaseTemplateProcessor
from superset.stats_logger import DummyStatsLogger from superset.stats_logger import DummyStatsLogger
@ -178,9 +179,9 @@ SQLALCHEMY_CUSTOM_PASSWORD_STORE = None
# Note: the default impl leverages SqlAlchemyUtils' EncryptedType, which defaults # Note: the default impl leverages SqlAlchemyUtils' EncryptedType, which defaults
# to AES-128 under the covers using the app's SECRET_KEY as key material. # to AES-128 under the covers using the app's SECRET_KEY as key material.
# #
# pylint: disable=C0103 SQLALCHEMY_ENCRYPTED_FIELD_TYPE_ADAPTER = ( # pylint: disable=invalid-name
SQLALCHEMY_ENCRYPTED_FIELD_TYPE_ADAPTER = SQLAlchemyUtilsAdapter SQLAlchemyUtilsAdapter
)
# The limit of queries fetched for query search # The limit of queries fetched for query search
QUERY_SEARCH_LIMIT = 1000 QUERY_SEARCH_LIMIT = 1000
@ -841,7 +842,7 @@ CSV_TO_HIVE_UPLOAD_S3_BUCKET = None
CSV_TO_HIVE_UPLOAD_DIRECTORY = "EXTERNAL_HIVE_TABLES/" CSV_TO_HIVE_UPLOAD_DIRECTORY = "EXTERNAL_HIVE_TABLES/"
# Function that creates upload directory dynamically based on the # Function that creates upload directory dynamically based on the
# database used, user and schema provided. # database used, user and schema provided.
def CSV_TO_HIVE_UPLOAD_DIRECTORY_FUNC( def CSV_TO_HIVE_UPLOAD_DIRECTORY_FUNC( # pylint: disable=invalid-name
database: "Database", database: "Database",
user: "models.User", # pylint: disable=unused-argument user: "models.User", # pylint: disable=unused-argument
schema: Optional[str], schema: Optional[str],
@ -986,7 +987,14 @@ DB_CONNECTION_MUTATOR = None
# def SQL_QUERY_MUTATOR(sql, user_name, security_manager, database): # def SQL_QUERY_MUTATOR(sql, user_name, security_manager, database):
# dttm = datetime.now().isoformat() # dttm = datetime.now().isoformat()
# return f"-- [SQL LAB] {username} {dttm}\n{sql}" # return f"-- [SQL LAB] {username} {dttm}\n{sql}"
SQL_QUERY_MUTATOR = None def SQL_QUERY_MUTATOR( # pylint: disable=invalid-name,unused-argument
sql: str,
user_name: Optional[str],
security_manager: LocalProxy,
database: "Database",
) -> str:
return sql
# Enable / disable scheduled email reports # Enable / disable scheduled email reports
# #

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=too-many-ancestors
import json import json
import logging import logging
from datetime import datetime from datetime import datetime
@ -62,7 +61,9 @@ class EnsureEnabledMixin:
raise NotFound() raise NotFound()
class DruidColumnInlineView(CompactCRUDMixin, EnsureEnabledMixin, SupersetModelView): class DruidColumnInlineView( # pylint: disable=too-many-ancestors
CompactCRUDMixin, EnsureEnabledMixin, SupersetModelView,
):
datamodel = SQLAInterface(models.DruidColumn) datamodel = SQLAInterface(models.DruidColumn)
include_route_methods = RouteMethod.RELATED_VIEW_SET include_route_methods = RouteMethod.RELATED_VIEW_SET
@ -149,7 +150,9 @@ class DruidColumnInlineView(CompactCRUDMixin, EnsureEnabledMixin, SupersetModelV
self.post_update(item) self.post_update(item)
class DruidMetricInlineView(CompactCRUDMixin, EnsureEnabledMixin, SupersetModelView): class DruidMetricInlineView( # pylint: disable=too-many-ancestors
CompactCRUDMixin, EnsureEnabledMixin, SupersetModelView,
):
datamodel = SQLAInterface(models.DruidMetric) datamodel = SQLAInterface(models.DruidMetric)
include_route_methods = RouteMethod.RELATED_VIEW_SET include_route_methods = RouteMethod.RELATED_VIEW_SET
@ -202,7 +205,7 @@ class DruidMetricInlineView(CompactCRUDMixin, EnsureEnabledMixin, SupersetModelV
edit_form_extra_fields = add_form_extra_fields edit_form_extra_fields = add_form_extra_fields
class DruidClusterModelView( class DruidClusterModelView( # pylint: disable=too-many-ancestors
EnsureEnabledMixin, SupersetModelView, DeleteMixin, YamlExportMixin, EnsureEnabledMixin, SupersetModelView, DeleteMixin, YamlExportMixin,
): ):
datamodel = SQLAInterface(models.DruidCluster) datamodel = SQLAInterface(models.DruidCluster)
@ -266,7 +269,7 @@ class DruidClusterModelView(
DeleteMixin._delete(self, pk) DeleteMixin._delete(self, pk)
class DruidDatasourceModelView( class DruidDatasourceModelView( # pylint: disable=too-many-ancestors
EnsureEnabledMixin, DatasourceModelView, DeleteMixin, YamlExportMixin, EnsureEnabledMixin, DatasourceModelView, DeleteMixin, YamlExportMixin,
): ):
datamodel = SQLAInterface(models.DruidDatasource) datamodel = SQLAInterface(models.DruidDatasource)

View File

@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=too-few-public-methods
from typing import Any, Optional from typing import Any, Optional
from flask_appbuilder.security.sqla.models import Role from flask_appbuilder.security.sqla.models import Role
@ -31,7 +29,7 @@ from superset.views.base import BaseFilter, get_user_roles, is_user_admin
from superset.views.base_api import BaseFavoriteFilter from superset.views.base_api import BaseFavoriteFilter
class DashboardTitleOrSlugFilter(BaseFilter): class DashboardTitleOrSlugFilter(BaseFilter): # pylint: disable=too-few-public-methods
name = _("Title or Slug") name = _("Title or Slug")
arg_name = "title_or_slug" arg_name = "title_or_slug"
@ -47,7 +45,9 @@ class DashboardTitleOrSlugFilter(BaseFilter):
) )
class DashboardFavoriteFilter(BaseFavoriteFilter): class DashboardFavoriteFilter( # pylint: disable=too-few-public-methods
BaseFavoriteFilter
):
""" """
Custom filter for the GET list that filters all dashboards that a user has favored Custom filter for the GET list that filters all dashboards that a user has favored
""" """
@ -57,7 +57,7 @@ class DashboardFavoriteFilter(BaseFavoriteFilter):
model = Dashboard model = Dashboard
class DashboardAccessFilter(BaseFilter): class DashboardAccessFilter(BaseFilter): # pylint: disable=too-few-public-methods
""" """
List dashboards with the following criteria: List dashboards with the following criteria:
1. Those which the user owns 1. Those which the user owns
@ -140,7 +140,7 @@ class DashboardAccessFilter(BaseFilter):
return query return query
class FilterRelatedRoles(BaseFilter): class FilterRelatedRoles(BaseFilter): # pylint: disable=too-few-public-methods
""" """
A filter to allow searching for related roles of a resource. A filter to allow searching for related roles of a resource.

View File

@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=too-many-lines,unused-argument # pylint: disable=too-many-lines
import json import json
import logging import logging
import re import re
@ -328,7 +328,9 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
return new_exception(str(exception)) return new_exception(str(exception))
@classmethod @classmethod
def get_allow_cost_estimate(cls, extra: Dict[str, Any]) -> bool: def get_allow_cost_estimate( # pylint: disable=unused-argument
cls, extra: Dict[str, Any],
) -> bool:
return False return False
@classmethod @classmethod
@ -581,8 +583,8 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
return indexes return indexes
@classmethod @classmethod
def extra_table_metadata( def extra_table_metadata( # pylint: disable=unused-argument
cls, database: "Database", table_name: str, schema_name: str cls, database: "Database", table_name: str, schema_name: str,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
""" """
Returns engine-specific table metadata Returns engine-specific table metadata
@ -683,7 +685,9 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
df.to_sql(con=engine, **to_sql_kwargs) df.to_sql(con=engine, **to_sql_kwargs)
@classmethod @classmethod
def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]: def convert_dttm( # pylint: disable=unused-argument
cls, target_type: str, dttm: datetime,
) -> Optional[str]:
""" """
Convert Python datetime object to a SQL expression Convert Python datetime object to a SQL expression
@ -815,8 +819,8 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
return sorted(inspector.get_schema_names()) return sorted(inspector.get_schema_names())
@classmethod @classmethod
def get_table_names( def get_table_names( # pylint: disable=unused-argument
cls, database: "Database", inspector: Inspector, schema: Optional[str] cls, database: "Database", inspector: Inspector, schema: Optional[str],
) -> List[str]: ) -> List[str]:
""" """
Get all tables from schema Get all tables from schema
@ -831,8 +835,8 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
return sorted(tables) return sorted(tables)
@classmethod @classmethod
def get_view_names( def get_view_names( # pylint: disable=unused-argument
cls, database: "Database", inspector: Inspector, schema: Optional[str] cls, database: "Database", inspector: Inspector, schema: Optional[str],
) -> List[str]: ) -> List[str]:
""" """
Get all views from schema Get all views from schema
@ -885,7 +889,7 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
return inspector.get_columns(table_name, schema) return inspector.get_columns(table_name, schema)
@classmethod @classmethod
def where_latest_partition( # pylint: disable=too-many-arguments def where_latest_partition( # pylint: disable=too-many-arguments,unused-argument
cls, cls,
table_name: str, table_name: str,
schema: Optional[str], schema: Optional[str],
@ -1072,7 +1076,9 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
""" """
@classmethod @classmethod
def execute(cls, cursor: Any, query: str, **kwargs: Any) -> None: def execute( # pylint: disable=unused-argument
cls, cursor: Any, query: str, **kwargs: Any,
) -> None:
""" """
Execute a SQL query Execute a SQL query
@ -1201,7 +1207,9 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
return sqla_column_type.compile(dialect=dialect).upper() return sqla_column_type.compile(dialect=dialect).upper()
@classmethod @classmethod
def get_function_names(cls, database: "Database") -> List[str]: def get_function_names( # pylint: disable=unused-argument
cls, database: "Database",
) -> List[str]:
""" """
Get a list of function names that are able to be called on the database. Get a list of function names that are able to be called on the database.
Used for SQL Lab autocomplete. Used for SQL Lab autocomplete.
@ -1224,7 +1232,9 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
return data return data
@staticmethod @staticmethod
def mutate_db_for_connection_test(database: "Database") -> None: def mutate_db_for_connection_test( # pylint: disable=unused-argument
database: "Database",
) -> None:
""" """
Some databases require passing additional parameters for validating database Some databases require passing additional parameters for validating database
connections. This method makes it possible to mutate the database instance prior connections. This method makes it possible to mutate the database instance prior
@ -1271,7 +1281,7 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
@classmethod @classmethod
@memoized @memoized
def get_column_spec( def get_column_spec( # pylint: disable=unused-argument
cls, cls,
native_type: Optional[str], native_type: Optional[str],
source: utils.ColumnTypeSource = utils.ColumnTypeSource.GET_TABLE, source: utils.ColumnTypeSource = utils.ColumnTypeSource.GET_TABLE,
@ -1320,7 +1330,9 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
return False return False
@classmethod @classmethod
def get_cancel_query_id(cls, cursor: Any, query: Query) -> Optional[str]: def get_cancel_query_id( # pylint: disable=unused-argument
cls, cursor: Any, query: Query,
) -> Optional[str]:
""" """
Select identifiers from the database engine that uniquely identifies the Select identifiers from the database engine that uniquely identifies the
queries to cancel. The identifier is typically a session id, process id queries to cancel. The identifier is typically a session id, process id
@ -1334,7 +1346,9 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
return None return None
@classmethod @classmethod
def cancel_query(cls, cursor: Any, query: Query, cancel_query_id: str) -> bool: def cancel_query( # pylint: disable=unused-argument
cls, cursor: Any, query: Query, cancel_query_id: str,
) -> bool:
""" """
Cancel query in the underlying database. Cancel query in the underlying database.
@ -1407,7 +1421,7 @@ class BasicParametersMixin:
encryption_parameters: Dict[str, str] = {} encryption_parameters: Dict[str, str] = {}
@classmethod @classmethod
def build_sqlalchemy_uri( def build_sqlalchemy_uri( # pylint: disable=unused-argument
cls, cls,
parameters: BasicParametersType, parameters: BasicParametersType,
encryted_extra: Optional[Dict[str, str]] = None, encryted_extra: Optional[Dict[str, str]] = None,
@ -1432,7 +1446,7 @@ class BasicParametersMixin:
) )
@classmethod @classmethod
def get_parameters_from_uri( def get_parameters_from_uri( # pylint: disable=unused-argument
cls, uri: str, encrypted_extra: Optional[Dict[str, Any]] = None cls, uri: str, encrypted_extra: Optional[Dict[str, Any]] = None
) -> BasicParametersType: ) -> BasicParametersType:
url = make_url(uri) url = make_url(uri)

View File

@ -20,9 +20,8 @@ if TYPE_CHECKING:
from pyhive.hive import Cursor from pyhive.hive import Cursor
from TCLIService.ttypes import TFetchOrientation from TCLIService.ttypes import TFetchOrientation
# pylint: disable=protected-access
# TODO: contribute back to pyhive. # TODO: contribute back to pyhive.
def fetch_logs( def fetch_logs( # pylint: disable=protected-access
self: "Cursor", self: "Cursor",
_max_rows: int = 1024, _max_rows: int = 1024,
orientation: Optional["TFetchOrientation"] = None, orientation: Optional["TFetchOrientation"] = None,

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=too-many-statements
import json import json
from superset import db from superset import db
@ -172,7 +171,7 @@ POSITION_JSON = """\
}""" }"""
def load_deck_dash() -> None: def load_deck_dash() -> None: # pylint: disable=too-many-statements
print("Loading deck.gl dashboard") print("Loading deck.gl dashboard")
slices = [] slices = []
table = get_table_connector_registry() table = get_table_connector_registry()

View File

@ -58,8 +58,7 @@ if TYPE_CHECKING:
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# pylint: disable=R0904 class SupersetAppInitializer: # pylint: disable=too-many-public-methods
class SupersetAppInitializer:
def __init__(self, app: SupersetApp) -> None: def __init__(self, app: SupersetApp) -> None:
super().__init__() super().__init__()

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=line-too-long,unused-argument
"""A collection of ORM sqlalchemy models for Superset""" """A collection of ORM sqlalchemy models for Superset"""
import enum import enum
import json import json
@ -244,7 +243,7 @@ class Database(
uri = make_url(self.sqlalchemy_uri_decrypted) uri = make_url(self.sqlalchemy_uri_decrypted)
encrypted_extra = self.get_encrypted_extra() encrypted_extra = self.get_encrypted_extra()
try: try:
parameters = self.db_engine_spec.get_parameters_from_uri(uri, encrypted_extra=encrypted_extra) # type: ignore parameters = self.db_engine_spec.get_parameters_from_uri(uri, encrypted_extra=encrypted_extra) # type: ignore # pylint: disable=line-too-long,useless-suppression
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
parameters = {} parameters = {}
@ -479,7 +478,7 @@ class Database(
key=lambda self, *args, **kwargs: f"db:{self.id}:schema:None:table_list", key=lambda self, *args, **kwargs: f"db:{self.id}:schema:None:table_list",
cache=cache_manager.data_cache, cache=cache_manager.data_cache,
) )
def get_all_table_names_in_database( def get_all_table_names_in_database( # pylint: disable=unused-argument
self, self,
cache: bool = False, cache: bool = False,
cache_timeout: Optional[bool] = None, cache_timeout: Optional[bool] = None,
@ -494,7 +493,7 @@ class Database(
key=lambda self, *args, **kwargs: f"db:{self.id}:schema:None:view_list", key=lambda self, *args, **kwargs: f"db:{self.id}:schema:None:view_list",
cache=cache_manager.data_cache, cache=cache_manager.data_cache,
) )
def get_all_view_names_in_database( def get_all_view_names_in_database( # pylint: disable=unused-argument
self, self,
cache: bool = False, cache: bool = False,
cache_timeout: Optional[bool] = None, cache_timeout: Optional[bool] = None,
@ -506,10 +505,10 @@ class Database(
return self.db_engine_spec.get_all_datasource_names(self, "view") return self.db_engine_spec.get_all_datasource_names(self, "view")
@cache_util.memoized_func( @cache_util.memoized_func(
key=lambda self, schema, *args, **kwargs: f"db:{self.id}:schema:{schema}:table_list", key=lambda self, schema, *args, **kwargs: f"db:{self.id}:schema:{schema}:table_list", # pylint: disable=line-too-long,useless-suppression
cache=cache_manager.data_cache, cache=cache_manager.data_cache,
) )
def get_all_table_names_in_schema( def get_all_table_names_in_schema( # pylint: disable=unused-argument
self, self,
schema: str, schema: str,
cache: bool = False, cache: bool = False,
@ -539,10 +538,10 @@ class Database(
return [] return []
@cache_util.memoized_func( @cache_util.memoized_func(
key=lambda self, schema, *args, **kwargs: f"db:{self.id}:schema:{schema}:view_list", key=lambda self, schema, *args, **kwargs: f"db:{self.id}:schema:{schema}:view_list", # pylint: disable=line-too-long,useless-suppression
cache=cache_manager.data_cache, cache=cache_manager.data_cache,
) )
def get_all_view_names_in_schema( def get_all_view_names_in_schema( # pylint: disable=unused-argument
self, self,
schema: str, schema: str,
cache: bool = False, cache: bool = False,
@ -573,7 +572,7 @@ class Database(
key=lambda self, *args, **kwargs: f"db:{self.id}:schema_list", key=lambda self, *args, **kwargs: f"db:{self.id}:schema_list",
cache=cache_manager.data_cache, cache=cache_manager.data_cache,
) )
def get_all_schema_names( def get_all_schema_names( # pylint: disable=unused-argument
self, self,
cache: bool = False, cache: bool = False,
cache_timeout: Optional[int] = None, cache_timeout: Optional[int] = None,

View File

@ -74,7 +74,7 @@ class Slice( # pylint: disable=too-many-public-methods
# the last time a user has saved the chart, changed_on is referencing # the last time a user has saved the chart, changed_on is referencing
# when the database row was last written # when the database row was last written
last_saved_at = Column(DateTime, nullable=True) last_saved_at = Column(DateTime, nullable=True)
last_saved_by_fk = Column(Integer, ForeignKey("ab_user.id"), nullable=True,) last_saved_by_fk = Column(Integer, ForeignKey("ab_user.id"), nullable=True)
last_saved_by = relationship( last_saved_by = relationship(
security_manager.user_model, foreign_keys=[last_saved_by_fk] security_manager.user_model, foreign_keys=[last_saved_by_fk]
) )

View File

@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=too-few-public-methods,too-many-lines # pylint: disable=too-many-lines
"""A set of constants and methods to manage permissions and security""" """A set of constants and methods to manage permissions and security"""
import logging import logging
import re import re
@ -78,7 +78,7 @@ if TYPE_CHECKING:
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class SupersetSecurityListWidget(ListWidget): class SupersetSecurityListWidget(ListWidget): # pylint: disable=too-few-public-methods
""" """
Redeclaring to avoid circular imports Redeclaring to avoid circular imports
""" """
@ -86,7 +86,7 @@ class SupersetSecurityListWidget(ListWidget):
template = "superset/fab_overrides/list.html" template = "superset/fab_overrides/list.html"
class SupersetRoleListWidget(ListWidget): class SupersetRoleListWidget(ListWidget): # pylint: disable=too-few-public-methods
""" """
Role model view from FAB already uses a custom list widget override Role model view from FAB already uses a custom list widget override
So we override the override So we override the override

View File

@ -30,7 +30,6 @@ from celery import Task
from celery.exceptions import SoftTimeLimitExceeded from celery.exceptions import SoftTimeLimitExceeded
from flask_babel import gettext as __ from flask_babel import gettext as __
from sqlalchemy.orm import Session from sqlalchemy.orm import Session
from werkzeug.local import LocalProxy
from superset import app, results_backend, results_backend_use_msgpack, security_manager from superset import app, results_backend, results_backend_use_msgpack, security_manager
from superset.dataframe import df_to_records from superset.dataframe import df_to_records
@ -38,7 +37,6 @@ from superset.db_engine_specs import BaseEngineSpec
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.exceptions import SupersetErrorException, SupersetErrorsException from superset.exceptions import SupersetErrorException, SupersetErrorsException
from superset.extensions import celery_app from superset.extensions import celery_app
from superset.models.core import Database
from superset.models.sql_lab import LimitingFactor, Query from superset.models.sql_lab import LimitingFactor, Query
from superset.result_set import SupersetResultSet from superset.result_set import SupersetResultSet
from superset.sql_parse import CtasMethod, ParsedQuery from superset.sql_parse import CtasMethod, ParsedQuery
@ -52,25 +50,13 @@ from superset.utils.core import (
from superset.utils.dates import now_as_float from superset.utils.dates import now_as_float
from superset.utils.decorators import stats_timing from superset.utils.decorators import stats_timing
# pylint: disable=unused-argument, redefined-outer-name
def dummy_sql_query_mutator(
sql: str,
user_name: Optional[str],
security_manager: LocalProxy,
database: Database,
) -> str:
"""A no-op version of SQL_QUERY_MUTATOR"""
return sql
config = app.config config = app.config
stats_logger = config["STATS_LOGGER"] stats_logger = config["STATS_LOGGER"]
SQLLAB_TIMEOUT = config["SQLLAB_ASYNC_TIME_LIMIT_SEC"] SQLLAB_TIMEOUT = config["SQLLAB_ASYNC_TIME_LIMIT_SEC"]
SQLLAB_HARD_TIMEOUT = SQLLAB_TIMEOUT + 60 SQLLAB_HARD_TIMEOUT = SQLLAB_TIMEOUT + 60
SQL_MAX_ROW = config["SQL_MAX_ROW"] SQL_MAX_ROW = config["SQL_MAX_ROW"]
SQLLAB_CTAS_NO_LIMIT = config["SQLLAB_CTAS_NO_LIMIT"] SQLLAB_CTAS_NO_LIMIT = config["SQLLAB_CTAS_NO_LIMIT"]
SQL_QUERY_MUTATOR = config.get("SQL_QUERY_MUTATOR") or dummy_sql_query_mutator SQL_QUERY_MUTATOR = config["SQL_QUERY_MUTATOR"]
log_query = config["QUERY_LOGGER"] log_query = config["QUERY_LOGGER"]
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
cancel_query_key = "cancel_query" cancel_query_key = "cancel_query"
@ -192,8 +178,7 @@ def get_sql_results( # pylint: disable=too-many-arguments
return handle_query_error(ex, query, session) return handle_query_error(ex, query, session)
# pylint: disable=too-many-arguments, too-many-locals, too-many-statements def execute_sql_statement( # pylint: disable=too-many-arguments,too-many-locals,too-many-statements
def execute_sql_statement(
sql_statement: str, sql_statement: str,
query: Query, query: Query,
user_name: Optional[str], user_name: Optional[str],

View File

@ -14,15 +14,12 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=too-few-public-methods
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
from superset.models.core import Database from superset.models.core import Database
class SQLValidationAnnotation: class SQLValidationAnnotation: # pylint: disable=too-few-public-methods
"""Represents a single annotation (error/warning) in an SQL querytext""" """Represents a single annotation (error/warning) in an SQL querytext"""
def __init__( def __init__(
@ -47,7 +44,7 @@ class SQLValidationAnnotation:
} }
class BaseSQLValidator: class BaseSQLValidator: # pylint: disable=too-few-public-methods
"""BaseSQLValidator defines the interface for checking that a given sql """BaseSQLValidator defines the interface for checking that a given sql
query is valid for a given database engine.""" query is valid for a given database engine."""

View File

@ -124,7 +124,7 @@ class ExecuteSqlCommand(BaseCommand):
QueryStatus.TIMED_OUT, QueryStatus.TIMED_OUT,
] ]
def _run_sql_json_exec_from_scratch(self,) -> SqlJsonExecutionStatus: def _run_sql_json_exec_from_scratch(self) -> SqlJsonExecutionStatus:
self.execution_context.set_database(self._get_the_query_db()) self.execution_context.set_database(self._get_the_query_db())
query = self.execution_context.create_query() query = self.execution_context.create_query()
try: try:
@ -183,7 +183,7 @@ class ExecuteSqlCommand(BaseCommand):
self.session.commit() self.session.commit()
raise SupersetErrorException(ex.error, status=403) from ex raise SupersetErrorException(ex.error, status=403) from ex
def _render_query(self,) -> str: def _render_query(self) -> str:
def validate( def validate(
rendered_query: str, template_processor: BaseTemplateProcessor rendered_query: str, template_processor: BaseTemplateProcessor
) -> None: ) -> None:
@ -232,7 +232,7 @@ class ExecuteSqlCommand(BaseCommand):
if self._is_required_to_set_limit(): if self._is_required_to_set_limit():
self._set_query_limit(rendered_query) self._set_query_limit(rendered_query)
def _is_required_to_set_limit(self,) -> bool: def _is_required_to_set_limit(self) -> bool:
return not ( return not (
config.get("SQLLAB_CTAS_NO_LIMIT") and self.execution_context.select_as_cta config.get("SQLLAB_CTAS_NO_LIMIT") and self.execution_context.select_as_cta
) )
@ -382,10 +382,8 @@ class ExecuteSqlCommand(BaseCommand):
is_feature_enabled("SQLLAB_BACKEND_PERSISTENCE") and not query.select_as_cta is_feature_enabled("SQLLAB_BACKEND_PERSISTENCE") and not query.select_as_cta
) )
def _create_payload_from_execution_context( def _create_payload_from_execution_context( # pylint: disable=invalid-name
# pylint: disable=invalid-name self, status: SqlJsonExecutionStatus,
self,
status: SqlJsonExecutionStatus,
) -> str: ) -> str:
if status == SqlJsonExecutionStatus.HAS_RESULTS: if status == SqlJsonExecutionStatus.HAS_RESULTS:

View File

@ -68,18 +68,17 @@ def load_chart_data_into_cache(
async_query_manager.update_job( async_query_manager.update_job(
job_metadata, async_query_manager.STATUS_DONE, result_url=result_url, job_metadata, async_query_manager.STATUS_DONE, result_url=result_url,
) )
except SoftTimeLimitExceeded as exc: except SoftTimeLimitExceeded as ex:
logger.warning("A timeout occurred while loading chart data, error: %s", exc) logger.warning("A timeout occurred while loading chart data, error: %s", ex)
raise exc raise ex
except Exception as exc: except Exception as ex:
# TODO: QueryContext should support SIP-40 style errors # TODO: QueryContext should support SIP-40 style errors
# pylint: disable=no-member error = ex.message if hasattr(ex, "message") else str(ex) # type: ignore # pylint: disable=no-member
error = exc.message if hasattr(exc, "message") else str(exc) # type: ignore
errors = [{"message": error}] errors = [{"message": error}]
async_query_manager.update_job( async_query_manager.update_job(
job_metadata, async_query_manager.STATUS_ERROR, errors=errors job_metadata, async_query_manager.STATUS_ERROR, errors=errors
) )
raise exc raise ex
@celery_app.task(name="load_explore_json_into_cache", soft_time_limit=query_timeout) @celery_app.task(name="load_explore_json_into_cache", soft_time_limit=query_timeout)
@ -127,16 +126,14 @@ def load_explore_json_into_cache( # pylint: disable=too-many-locals
except SoftTimeLimitExceeded as ex: except SoftTimeLimitExceeded as ex:
logger.warning("A timeout occurred while loading explore json, error: %s", ex) logger.warning("A timeout occurred while loading explore json, error: %s", ex)
raise ex raise ex
except Exception as exc: except Exception as ex:
# pylint: disable=no-member if isinstance(ex, SupersetVizException):
if isinstance(exc, SupersetVizException): errors = ex.errors # pylint: disable=no-member
# pylint: disable=no-member
errors = exc.errors
else: else:
error = exc.message if hasattr(exc, "message") else str(exc) # type: ignore error = ex.message if hasattr(ex, "message") else str(ex) # type: ignore # pylint: disable=no-member
errors = [error] errors = [error]
async_query_manager.update_job( async_query_manager.update_job(
job_metadata, async_query_manager.STATUS_ERROR, errors=errors job_metadata, async_query_manager.STATUS_ERROR, errors=errors
) )
raise exc raise ex

View File

@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=too-few-public-methods
import json import json
import logging import logging
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
@ -85,7 +83,7 @@ def get_url(chart: Slice, extra_filters: Optional[Dict[str, Any]] = None) -> str
return f"{baseurl}{chart.get_explore_url(overrides=extra_filters)}" return f"{baseurl}{chart.get_explore_url(overrides=extra_filters)}"
class Strategy: class Strategy: # pylint: disable=too-few-public-methods
""" """
A cache warm up strategy. A cache warm up strategy.
@ -115,7 +113,7 @@ class Strategy:
raise NotImplementedError("Subclasses must implement get_urls!") raise NotImplementedError("Subclasses must implement get_urls!")
class DummyStrategy(Strategy): class DummyStrategy(Strategy): # pylint: disable=too-few-public-methods
""" """
Warm up all charts. Warm up all charts.
@ -140,7 +138,7 @@ class DummyStrategy(Strategy):
return [get_url(chart) for chart in charts] return [get_url(chart) for chart in charts]
class TopNDashboardsStrategy(Strategy): class TopNDashboardsStrategy(Strategy): # pylint: disable=too-few-public-methods
""" """
Warm up charts in the top-n dashboards. Warm up charts in the top-n dashboards.
@ -187,7 +185,7 @@ class TopNDashboardsStrategy(Strategy):
return urls return urls
class DashboardTagsStrategy(Strategy): class DashboardTagsStrategy(Strategy): # pylint: disable=too-few-public-methods
""" """
Warm up charts in dashboards with custom tags. Warm up charts in dashboards with custom tags.

View File

@ -26,6 +26,7 @@ import urllib.request
from collections import namedtuple from collections import namedtuple
from datetime import datetime, timedelta from datetime import datetime, timedelta
from email.utils import make_msgid, parseaddr from email.utils import make_msgid, parseaddr
from enum import Enum
from typing import ( from typing import (
Any, Any,
Callable, Callable,
@ -72,8 +73,6 @@ from superset.utils.retries import retry_call
from superset.utils.screenshots import ChartScreenshot, WebDriverProxy from superset.utils.screenshots import ChartScreenshot, WebDriverProxy
from superset.utils.urls import get_url_path from superset.utils.urls import get_url_path
# pylint: disable=too-few-public-methods
if TYPE_CHECKING: if TYPE_CHECKING:
from flask_appbuilder.security.sqla.models import User from flask_appbuilder.security.sqla.models import User
from werkzeug.datastructures import TypeConversionDict from werkzeug.datastructures import TypeConversionDict
@ -571,7 +570,7 @@ def schedule_alert_query(
raise RuntimeError("Unknown report type") raise RuntimeError("Unknown report type")
class AlertState: class AlertState(str, Enum):
ERROR = "error" ERROR = "error"
TRIGGER = "trigger" TRIGGER = "trigger"
PASS = "pass" PASS = "pass"

View File

@ -138,8 +138,7 @@ def parse_past_timedelta(
) )
# pylint: disable=too-many-arguments, too-many-locals, too-many-branches def get_since_until( # pylint: disable=too-many-arguments,too-many-locals,too-many-branches
def get_since_until(
time_range: Optional[str] = None, time_range: Optional[str] = None,
since: Optional[str] = None, since: Optional[str] = None,
until: Optional[str] = None, until: Optional[str] = None,

View File

@ -24,8 +24,7 @@ import flask.config
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# pylint: disable=too-few-public-methods class LoggingConfigurator(abc.ABC): # pylint: disable=too-few-public-methods
class LoggingConfigurator(abc.ABC):
@abc.abstractmethod @abc.abstractmethod
def configure_logging( def configure_logging(
self, app_config: flask.config.Config, debug_mode: bool self, app_config: flask.config.Config, debug_mode: bool
@ -33,7 +32,9 @@ class LoggingConfigurator(abc.ABC):
pass pass
class DefaultLoggingConfigurator(LoggingConfigurator): class DefaultLoggingConfigurator( # pylint: disable=too-few-public-methods
LoggingConfigurator
):
def configure_logging( def configure_logging(
self, app_config: flask.config.Config, debug_mode: bool self, app_config: flask.config.Config, debug_mode: bool
) -> None: ) -> None:

View File

@ -67,8 +67,9 @@ MAXIMUM_DATE = date.today()
days_range = (MAXIMUM_DATE - MINIMUM_DATE).days days_range = (MAXIMUM_DATE - MINIMUM_DATE).days
# pylint: disable=too-many-return-statements, too-many-branches def get_type_generator( # pylint: disable=too-many-return-statements,too-many-branches
def get_type_generator(sqltype: sqlalchemy.sql.sqltypes) -> Callable[[], Any]: sqltype: sqlalchemy.sql.sqltypes,
) -> Callable[[], Any]:
if isinstance(sqltype, sqlalchemy.dialects.mysql.types.TINYINT): if isinstance(sqltype, sqlalchemy.dialects.mysql.types.TINYINT):
return lambda: random.choice([0, 1]) return lambda: random.choice([0, 1])

View File

@ -470,9 +470,8 @@ def diff(
return _append_columns(df, df_diff, columns) return _append_columns(df, df_diff, columns)
# pylint: disable=too-many-arguments
@validate_column_args("source_columns", "compare_columns") @validate_column_args("source_columns", "compare_columns")
def compare( def compare( # pylint: disable=too-many-arguments
df: DataFrame, df: DataFrame,
source_columns: List[str], source_columns: List[str],
compare_columns: List[str], compare_columns: List[str],

View File

@ -376,8 +376,9 @@ def common_bootstrap_payload() -> Dict[str, Any]:
return bootstrap_data return bootstrap_data
# pylint: disable=invalid-name def get_error_level_from_status_code( # pylint: disable=invalid-name
def get_error_level_from_status_code(status: int) -> ErrorLevel: status: int,
) -> ErrorLevel:
if status < 400: if status < 400:
return ErrorLevel.INFO return ErrorLevel.INFO
if status < 500: if status < 500:

View File

@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=comparison-with-callable,line-too-long,too-many-lines # pylint: disable=too-many-lines
from __future__ import annotations from __future__ import annotations
import logging import logging
@ -326,7 +326,7 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
requests = ( requests = (
session.query(DAR) session.query(DAR)
.filter( .filter( # pylint: disable=comparison-with-callable
DAR.datasource_id == datasource_id, DAR.datasource_id == datasource_id,
DAR.datasource_type == datasource_type, DAR.datasource_type == datasource_type,
DAR.created_by_fk == requested_by.id, DAR.created_by_fk == requested_by.id,
@ -1537,7 +1537,9 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
Dash = Dashboard Dash = Dashboard
qry = ( qry = (
db.session.query(Dash) db.session.query(Dash)
.filter(or_(Dash.created_by_fk == user_id, Dash.changed_by_fk == user_id)) .filter( # pylint: disable=comparison-with-callable
or_(Dash.created_by_fk == user_id, Dash.changed_by_fk == user_id)
)
.order_by(Dash.changed_on.desc()) .order_by(Dash.changed_on.desc())
) )
payload = [ payload = [
@ -1581,7 +1583,7 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
), ),
isouter=True, isouter=True,
) )
.filter( .filter( # pylint: disable=comparison-with-callable
or_( or_(
Slice.id.in_(owner_ids_query), Slice.id.in_(owner_ids_query),
Slice.created_by_fk == user_id, Slice.created_by_fk == user_id,
@ -1617,7 +1619,9 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
user_id = g.user.get_id() user_id = g.user.get_id()
qry = ( qry = (
db.session.query(Slice) db.session.query(Slice)
.filter(or_(Slice.created_by_fk == user_id, Slice.changed_by_fk == user_id)) .filter( # pylint: disable=comparison-with-callable
or_(Slice.created_by_fk == user_id, Slice.changed_by_fk == user_id)
)
.order_by(Slice.changed_on.desc()) .order_by(Slice.changed_on.desc())
) )
payload = [ payload = [
@ -1859,7 +1863,8 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
""" """
Server side rendering for a dashboard Server side rendering for a dashboard
:param dashboard_id_or_slug: identifier for dashboard. used in the decorators :param dashboard_id_or_slug: identifier for dashboard. used in the decorators
:param add_extra_log_payload: added by `log_this_with_manual_updates`, set a default value to appease pylint :param add_extra_log_payload: added by `log_this_with_manual_updates`, set a
default value to appease pylint
:param dashboard: added by `check_dashboard_access` :param dashboard: added by `check_dashboard_access`
""" """
if not dashboard: if not dashboard:
@ -2422,10 +2427,8 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
command_result: CommandResult = command.run() command_result: CommandResult = command.run()
return self._create_response_from_execution_context(command_result) return self._create_response_from_execution_context(command_result)
def _create_response_from_execution_context( def _create_response_from_execution_context( # pylint: disable=invalid-name, no-self-use
# pylint: disable=invalid-name, no-self-use self, command_result: CommandResult,
self,
command_result: CommandResult,
) -> FlaskResponse: ) -> FlaskResponse:
status_code = 200 status_code = 200

View File

@ -23,10 +23,9 @@ from sqlalchemy.orm import Query
from superset import security_manager from superset import security_manager
# pylint: disable=too-few-public-methods
class FilterRelatedOwners(BaseFilter): # pylint: disable=too-few-public-methods
class FilterRelatedOwners(BaseFilter):
""" """
A filter to allow searching for related owners of a resource. A filter to allow searching for related owners of a resource.

File diff suppressed because it is too large Load Diff

View File

@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=no-self-use, invalid-name
import json import json
from datetime import datetime from datetime import datetime
from unittest.mock import patch from unittest.mock import patch
@ -313,7 +311,7 @@ class TestChartsUpdateCommand(SupersetTestCase):
@patch("superset.security.manager.g") @patch("superset.security.manager.g")
@pytest.mark.usefixtures("load_energy_table_with_slice") @pytest.mark.usefixtures("load_energy_table_with_slice")
def test_update_v1_response(self, mock_sm_g, mock_g): def test_update_v1_response(self, mock_sm_g, mock_g):
""""Test that a chart command updates properties""" """Test that a chart command updates properties"""
pk = db.session.query(Slice).all()[0].id pk = db.session.query(Slice).all()[0].id
actor = security_manager.find_user(username="admin") actor = security_manager.find_user(username="admin")
mock_g.user = mock_sm_g.user = actor mock_g.user = mock_sm_g.user = actor
@ -334,7 +332,7 @@ class TestChartsUpdateCommand(SupersetTestCase):
@patch("superset.security.manager.g") @patch("superset.security.manager.g")
@pytest.mark.usefixtures("load_energy_table_with_slice") @pytest.mark.usefixtures("load_energy_table_with_slice")
def test_query_context_update_command(self, mock_sm_g, mock_g): def test_query_context_update_command(self, mock_sm_g, mock_g):
"""" """ "
Test that a user can generate the chart query context Test that a user can generate the chart query context
payloadwithout affecting owners payloadwithout affecting owners
""" """

View File

@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=no-self-use
from superset.commands.exceptions import CommandInvalidError from superset.commands.exceptions import CommandInvalidError
from superset.commands.importers.v1.utils import is_valid_config from superset.commands.importers.v1.utils import is_valid_config
from tests.integration_tests.base_tests import SupersetTestCase from tests.integration_tests.base_tests import SupersetTestCase

View File

@ -15,7 +15,6 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# isort:skip_file # isort:skip_file
# pylint: disable=too-many-public-methods, no-self-use, invalid-name, too-many-arguments
"""Unit tests for Superset""" """Unit tests for Superset"""
import json import json
from io import BytesIO from io import BytesIO

View File

@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=no-self-use, invalid-name
import itertools import itertools
import json import json
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch

View File

@ -15,7 +15,6 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# isort:skip_file # isort:skip_file
# pylint: disable=invalid-name, no-self-use, too-many-public-methods, too-many-arguments
"""Unit tests for Superset""" """Unit tests for Superset"""
import dataclasses import dataclasses
import json import json

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=no-self-use, invalid-name
from unittest import mock, skip from unittest import mock, skip
from unittest.mock import patch from unittest.mock import patch

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=too-many-public-methods, invalid-name
"""Unit tests for Superset""" """Unit tests for Superset"""
import json import json
import unittest import unittest

View File

@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=no-self-use, invalid-name, line-too-long
from operator import itemgetter from operator import itemgetter
from typing import Any, List from typing import Any, List
from unittest.mock import patch from unittest.mock import patch

View File

@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=line-too-long
from typing import Any, Dict, List from typing import Any, Dict, List
# example V0 import/export format # example V0 import/export format

View File

@ -14,10 +14,7 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=invalid-name class Row:
class Row(object):
def __init__(self, values): def __init__(self, values):
self.values = values self.values = values

View File

@ -15,7 +15,6 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# isort:skip_file # isort:skip_file
# pylint: disable=too-many-public-methods, no-self-use, invalid-name, too-many-arguments
"""Unit tests for Superset""" """Unit tests for Superset"""
import json import json

View File

@ -15,7 +15,6 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# isort:skip_file # isort:skip_file
# pylint: disable=invalid-name, no-self-use
"""Unit tests for Sql Lab""" """Unit tests for Sql Lab"""
import unittest import unittest
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=no-self-use
import pytest import pytest
from superset.utils.core import form_data_to_adhoc, simple_filter_to_adhoc from superset.utils.core import form_data_to_adhoc, simple_filter_to_adhoc

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=no-self-use
import io import io
import pandas as pd import pandas as pd

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=no-self-use
import datetime import datetime
import math import math
from typing import Any from typing import Any

View File

@ -14,19 +14,16 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=no-self-use from typing import Any, Callable, Dict
import pytest import pytest
from superset.sql_lab import dummy_sql_query_mutator
from superset.utils.public_interfaces import compute_hash, get_warning_message from superset.utils.public_interfaces import compute_hash, get_warning_message
from tests.integration_tests.base_tests import SupersetTestCase
# These are public interfaces exposed by Superset. Make sure # These are public interfaces exposed by Superset. Make sure
# to only change the interfaces and update the hashes in new # to only change the interfaces and update the hashes in new
# major versions of Superset. # major versions of Superset.
hashes = { hashes: Dict[Callable[..., Any], str] = {}
dummy_sql_query_mutator: "Kv%NM3b;7BcpoD2wbPkW",
}
@pytest.mark.parametrize("interface,expected_hash", list(hashes.items())) @pytest.mark.parametrize("interface,expected_hash", list(hashes.items()))

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=unused-argument, invalid-name
from flask.ctx import AppContext from flask.ctx import AppContext
from pytest_mock import MockFixture from pytest_mock import MockFixture

View File

@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# pylint: disable=unused-argument, invalid-name
from datetime import datetime from datetime import datetime
from typing import List from typing import List