mirror of https://github.com/apache/superset.git
chore(ci): bump pylint to 2.10.2 (#16463)
This commit is contained in:
parent
577ede4b12
commit
ac1d779a30
|
@ -86,6 +86,9 @@ disable=
|
|||
missing-docstring,
|
||||
too-many-lines,
|
||||
duplicate-code,
|
||||
unspecified-encoding,
|
||||
# re-enable once this no longer raises false positives
|
||||
too-many-instance-attributes
|
||||
|
||||
[REPORTS]
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ openpyxl
|
|||
parameterized
|
||||
pyfakefs
|
||||
pyhive[presto]>=0.6.3
|
||||
pylint==2.6.0
|
||||
pylint==2.10.2
|
||||
pytest
|
||||
pytest-cov
|
||||
statsd
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# SHA1:5bfcfb5d0ab31dd532ce58caa2aab91d6807b123
|
||||
# SHA1:59e47200215ca4695f09e03a773e1a6f310f78da
|
||||
#
|
||||
# This file is autogenerated by pip-compile-multi
|
||||
# To update, run:
|
||||
|
@ -11,7 +11,7 @@
|
|||
# via -r requirements/base.in
|
||||
appnope==0.1.2
|
||||
# via ipython
|
||||
astroid==2.6.6
|
||||
astroid==2.7.2
|
||||
# via pylint
|
||||
backcall==0.2.0
|
||||
# via ipython
|
||||
|
@ -71,7 +71,7 @@ pyhive[hive,presto]==0.6.4
|
|||
# via
|
||||
# -r requirements/development.in
|
||||
# -r requirements/testing.in
|
||||
pylint==2.9.6
|
||||
pylint==2.10.2
|
||||
# via -r requirements/testing.in
|
||||
pytest==6.2.4
|
||||
# via
|
||||
|
|
|
@ -381,7 +381,7 @@ class AnnotationRestApi(BaseSupersetModelRestApi):
|
|||
try:
|
||||
new_model = UpdateAnnotationCommand(g.user, annotation_id, item).run()
|
||||
return self.response(200, id=new_model.id, result=item)
|
||||
except (AnnotationNotFoundError, AnnotationLayerNotFoundError) as ex:
|
||||
except (AnnotationNotFoundError, AnnotationLayerNotFoundError):
|
||||
return self.response_404()
|
||||
except AnnotationInvalidError as ex:
|
||||
return self.response_422(message=ex.normalized_messages())
|
||||
|
@ -438,7 +438,7 @@ class AnnotationRestApi(BaseSupersetModelRestApi):
|
|||
try:
|
||||
DeleteAnnotationCommand(g.user, annotation_id).run()
|
||||
return self.response(200, message="OK")
|
||||
except AnnotationNotFoundError as ex:
|
||||
except AnnotationNotFoundError:
|
||||
return self.response_404()
|
||||
except AnnotationDeleteFailedError as ex:
|
||||
logger.error(
|
||||
|
|
|
@ -52,7 +52,7 @@ class CreateAnnotationCommand(BaseCommand):
|
|||
return annotation
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
layer_id: Optional[int] = self._properties.get("layer")
|
||||
start_dttm: Optional[datetime] = self._properties.get("start_dttm")
|
||||
end_dttm: Optional[datetime] = self._properties.get("end_dttm")
|
||||
|
|
|
@ -56,7 +56,7 @@ class UpdateAnnotationCommand(BaseCommand):
|
|||
return annotation
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
layer_id: Optional[int] = self._properties.get("layer")
|
||||
short_descr: str = self._properties.get("short_descr", "")
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ class AnnotationLayerRestApi(BaseSupersetModelRestApi):
|
|||
try:
|
||||
DeleteAnnotationLayerCommand(g.user, pk).run()
|
||||
return self.response(200, message="OK")
|
||||
except AnnotationLayerNotFoundError as ex:
|
||||
except AnnotationLayerNotFoundError:
|
||||
return self.response_404()
|
||||
except AnnotationLayerDeleteIntegrityError as ex:
|
||||
return self.response_422(message=str(ex))
|
||||
|
@ -288,7 +288,7 @@ class AnnotationLayerRestApi(BaseSupersetModelRestApi):
|
|||
try:
|
||||
new_model = UpdateAnnotationLayerCommand(g.user, pk, item).run()
|
||||
return self.response(200, id=new_model.id, result=item)
|
||||
except (AnnotationLayerNotFoundError) as ex:
|
||||
except AnnotationLayerNotFoundError:
|
||||
return self.response_404()
|
||||
except AnnotationLayerInvalidError as ex:
|
||||
return self.response_422(message=ex.normalized_messages())
|
||||
|
|
|
@ -48,7 +48,7 @@ class CreateAnnotationLayerCommand(BaseCommand):
|
|||
return annotation_layer
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
|
||||
name = self._properties.get("name", "")
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class UpdateAnnotationLayerCommand(BaseCommand):
|
|||
return annotation_layer
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
name = self._properties.get("name", "")
|
||||
self._model = AnnotationLayerDAO.find_by_id(self._model_id)
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class CreateChartCommand(CreateMixin, BaseCommand):
|
|||
return chart
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions = list()
|
||||
exceptions = []
|
||||
datasource_type = self._properties["datasource_type"]
|
||||
datasource_id = self._properties["datasource_id"]
|
||||
dashboard_ids = self._properties.get("dashboards", [])
|
||||
|
|
|
@ -68,7 +68,7 @@ class UpdateChartCommand(UpdateMixin, BaseCommand):
|
|||
return chart
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
dashboard_ids = self._properties.get("dashboards")
|
||||
owner_ids: Optional[List[int]] = self._properties.get("owners")
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ def populate_owners(
|
|||
:returns: Final list of owners
|
||||
"""
|
||||
owner_ids = owner_ids or []
|
||||
owners = list()
|
||||
owners = []
|
||||
if not owner_ids and default_to_user:
|
||||
return [user]
|
||||
if user.id not in owner_ids and "admin" not in [
|
||||
|
|
|
@ -471,9 +471,7 @@ sqlatable_user = Table(
|
|||
)
|
||||
|
||||
|
||||
class SqlaTable(
|
||||
Model, BaseDatasource
|
||||
): # pylint: disable=too-many-instance-attributes,too-many-public-methods
|
||||
class SqlaTable(Model, BaseDatasource): # pylint: disable=too-many-public-methods
|
||||
"""An ORM object for SqlAlchemy table references"""
|
||||
|
||||
type = "table"
|
||||
|
|
|
@ -50,7 +50,7 @@ class CreateDashboardCommand(CreateMixin, BaseCommand):
|
|||
return dashboard
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
owner_ids: Optional[List[int]] = self._properties.get("owners")
|
||||
role_ids: Optional[List[int]] = self._properties.get("roles")
|
||||
slug: str = self._properties.get("slug", "")
|
||||
|
|
|
@ -77,7 +77,7 @@ class CreateDatabaseCommand(BaseCommand):
|
|||
return database
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
sqlalchemy_uri: Optional[str] = self._properties.get("sqlalchemy_uri")
|
||||
database_name: Optional[str] = self._properties.get("database_name")
|
||||
if not sqlalchemy_uri:
|
||||
|
|
|
@ -69,7 +69,7 @@ class UpdateDatabaseCommand(BaseCommand):
|
|||
return database
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
# Validate/populate model exists
|
||||
self._model = DatabaseDAO.find_by_id(self._model_id)
|
||||
if not self._model:
|
||||
|
|
|
@ -66,7 +66,7 @@ class CreateDatasetCommand(CreateMixin, BaseCommand):
|
|||
return dataset
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
database_id = self._properties["database"]
|
||||
table_name = self._properties["table_name"]
|
||||
schema = self._properties.get("schema", None)
|
||||
|
|
|
@ -76,7 +76,7 @@ class UpdateDatasetCommand(UpdateMixin, BaseCommand):
|
|||
raise DatasetUpdateFailedError()
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
owner_ids: Optional[List[int]] = self._properties.get("owners")
|
||||
# Validate/populate model exists
|
||||
self._model = DatasetDAO.find_by_id(self._model_id)
|
||||
|
|
|
@ -219,7 +219,7 @@ class DatasetDAO(BaseDAO): # pylint: disable=too-many-public-methods
|
|||
- If there are extra metrics on the metadata db that are not defined on the List
|
||||
then we delete.
|
||||
"""
|
||||
new_metrics = list()
|
||||
new_metrics = []
|
||||
for metric in property_metrics:
|
||||
metric_id = metric.get("id")
|
||||
if metric.get("id"):
|
||||
|
|
|
@ -129,9 +129,7 @@ DashboardRoles = Table(
|
|||
)
|
||||
|
||||
|
||||
class Dashboard( # pylint: disable=too-many-instance-attributes
|
||||
Model, AuditMixinNullable, ImportExportMixin
|
||||
):
|
||||
class Dashboard(Model, AuditMixinNullable, ImportExportMixin):
|
||||
"""The dashboard object!"""
|
||||
|
||||
__tablename__ = "dashboards"
|
||||
|
|
|
@ -55,7 +55,7 @@ class CreateReportScheduleCommand(CreateMixin, BaseReportScheduleCommand):
|
|||
return report_schedule
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
owner_ids: Optional[List[int]] = self._properties.get("owners")
|
||||
name = self._properties.get("name", "")
|
||||
report_type = self._properties.get("type")
|
||||
|
|
|
@ -59,7 +59,7 @@ class UpdateReportScheduleCommand(UpdateMixin, BaseReportScheduleCommand):
|
|||
return report_schedule
|
||||
|
||||
def validate(self) -> None:
|
||||
exceptions: List[ValidationError] = list()
|
||||
exceptions: List[ValidationError] = []
|
||||
owner_ids: Optional[List[int]] = self._properties.get("owners")
|
||||
report_type = self._properties.get("type", ReportScheduleType.ALERT)
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ def load_chart_data_into_cache(
|
|||
raise exc
|
||||
except Exception as exc:
|
||||
# TODO: QueryContext should support SIP-40 style errors
|
||||
error = exc.message if hasattr(exc, "message") else str(exc) # type: ignore # pylint: disable=no-member
|
||||
error = exc.message if hasattr(exc, "message") else str(exc) # type: ignore
|
||||
errors = [{"message": error}]
|
||||
async_query_manager.update_job(
|
||||
job_metadata, async_query_manager.STATUS_ERROR, errors=errors
|
||||
|
@ -122,11 +122,9 @@ def load_explore_json_into_cache( # pylint: disable=too-many-locals
|
|||
raise ex
|
||||
except Exception as exc:
|
||||
if isinstance(exc, SupersetVizException):
|
||||
errors = exc.errors # pylint: disable=no-member
|
||||
errors = exc.errors
|
||||
else:
|
||||
error = (
|
||||
exc.message if hasattr(exc, "message") else str(exc) # type: ignore # pylint: disable=no-member
|
||||
)
|
||||
error = exc.message if hasattr(exc, "message") else str(exc) # type: ignore
|
||||
errors = [error]
|
||||
|
||||
async_query_manager.update_job(
|
||||
|
|
|
@ -36,7 +36,7 @@ def export_schema_to_dict(back_references: bool) -> Dict[str, Any]:
|
|||
clusters = [
|
||||
DruidCluster.export_schema(recursive=True, include_parent_ref=back_references)
|
||||
]
|
||||
data = dict()
|
||||
data = {}
|
||||
if databases:
|
||||
data[DATABASES_KEY] = databases
|
||||
if clusters:
|
||||
|
@ -69,7 +69,7 @@ def export_to_dict(
|
|||
for cluster in cls
|
||||
]
|
||||
logger.info("Exported %d %s", len(clusters), DRUID_CLUSTERS_KEY)
|
||||
data = dict()
|
||||
data = {}
|
||||
if databases:
|
||||
data[DATABASES_KEY] = databases
|
||||
if clusters:
|
||||
|
|
|
@ -33,8 +33,8 @@ logger = logging.getLogger(__name__)
|
|||
SqlResults = Dict[str, Any]
|
||||
|
||||
|
||||
@dataclass # pylint: disable=R0902
|
||||
class SqlJsonExecutionContext:
|
||||
@dataclass
|
||||
class SqlJsonExecutionContext: # pylint: disable=too-many-instance-attributes
|
||||
database_id: int
|
||||
schema: str
|
||||
sql: str
|
||||
|
|
|
@ -112,7 +112,7 @@ class BaseOwnedSchema(BaseSupersetSchema):
|
|||
|
||||
@staticmethod
|
||||
def set_owners(instance: Model, owners: List[int]) -> None:
|
||||
owner_objs = list()
|
||||
owner_objs = []
|
||||
if g.user.get_id() not in owners:
|
||||
owners.append(g.user.get_id())
|
||||
for owner_id in owners:
|
||||
|
|
Loading…
Reference in New Issue