This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch make-prettier
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 6d7c5f2d47ded2825323c0f78f5729b17fd349c6
Author: hughhhh <[email protected]>
AuthorDate: Fri Apr 30 11:26:32 2021 -0400

    reformat code
---
 Makefile                                  | 5 +++++
 superset/cli.py                           | 4 ++--
 superset/commands/base.py                 | 2 +-
 superset/commands/exceptions.py           | 4 ++--
 superset/connectors/connector_registry.py | 2 +-
 superset/db_engine_specs/postgres.py      | 2 +-
 superset/models/alerts.py                 | 2 +-
 superset/models/helpers.py                | 2 +-
 superset/models/reports.py                | 2 +-
 superset/reports/commands/base.py         | 2 +-
 superset/tasks/schedules.py               | 4 ++--
 superset/utils/machine_auth.py            | 4 ++--
 superset/views/utils.py                   | 2 +-
 13 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index 6178bfa..b9c4775 100644
--- a/Makefile
+++ b/Makefile
@@ -47,3 +47,8 @@ pre-commit:
        # setup pre commit dependencies
        pip3 install -r requirements/integration.txt
        pre-commit install
+
+prettier:
+       # code format both python and js files
+       python -m black superset
+       cd superset-frontend; npm run prettier
diff --git a/superset/cli.py b/superset/cli.py
index 83ab526..1e7fcb0 100755
--- a/superset/cli.py
+++ b/superset/cli.py
@@ -194,7 +194,7 @@ def load_examples(
     only_metadata: bool = False,
     force: bool = False,
 ) -> None:
-    """Loads a set of Slices and Dashboards and a supporting dataset """
+    """Loads a set of Slices and Dashboards and a supporting dataset"""
     load_examples_run(load_test_data, load_big_data, only_metadata, force)
 
 
@@ -210,7 +210,7 @@ def load_examples(
     help="Create the DB if it doesn't exist",
 )
 def set_database_uri(database_name: str, uri: str, skip_create: bool) -> None:
-    """Updates a database connection URI """
+    """Updates a database connection URI"""
     utils.get_or_create_db(database_name, uri, not skip_create)
 
 
diff --git a/superset/commands/base.py b/superset/commands/base.py
index 0bcf3a7..ef4fe95 100644
--- a/superset/commands/base.py
+++ b/superset/commands/base.py
@@ -20,7 +20,7 @@ from typing import Any
 
 class BaseCommand(ABC):
     """
-        Base class for all Command like Superset Logic objects
+    Base class for all Command like Superset Logic objects
     """
 
     @abstractmethod
diff --git a/superset/commands/exceptions.py b/superset/commands/exceptions.py
index bb8992a..4fe55f2 100644
--- a/superset/commands/exceptions.py
+++ b/superset/commands/exceptions.py
@@ -23,7 +23,7 @@ from superset.exceptions import SupersetException
 
 
 class CommandException(SupersetException):
-    """ Common base class for Command exceptions. """
+    """Common base class for Command exceptions."""
 
     def __repr__(self) -> str:
         if self._exception:
@@ -32,7 +32,7 @@ class CommandException(SupersetException):
 
 
 class CommandInvalidError(CommandException):
-    """ Common base class for Command Invalid errors. """
+    """Common base class for Command Invalid errors."""
 
     status = 422
 
diff --git a/superset/connectors/connector_registry.py 
b/superset/connectors/connector_registry.py
index 0931fd9..c01994c 100644
--- a/superset/connectors/connector_registry.py
+++ b/superset/connectors/connector_registry.py
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
 
 
 class ConnectorRegistry:
-    """ Central Registry for all available datasource engines"""
+    """Central Registry for all available datasource engines"""
 
     sources: Dict[str, Type["BaseDatasource"]] = {}
 
diff --git a/superset/db_engine_specs/postgres.py 
b/superset/db_engine_specs/postgres.py
index c2e6776..ac4ffd8 100644
--- a/superset/db_engine_specs/postgres.py
+++ b/superset/db_engine_specs/postgres.py
@@ -82,7 +82,7 @@ CONNECTION_UNKNOWN_DATABASE_REGEX = re.compile(
 
 
 class PostgresBaseEngineSpec(BaseEngineSpec):
-    """ Abstract class for Postgres 'like' databases """
+    """Abstract class for Postgres 'like' databases"""
 
     engine = ""
     engine_name = "PostgreSQL"
diff --git a/superset/models/alerts.py b/superset/models/alerts.py
index 85bad4e..163dcf0 100644
--- a/superset/models/alerts.py
+++ b/superset/models/alerts.py
@@ -126,7 +126,7 @@ class Alert(Model, AuditMixinNullable):
 
     @property
     def pretty_config(self) -> str:
-        """ String representing the comparison that will trigger a validator 
"""
+        """String representing the comparison that will trigger a validator"""
         config = json.loads(self.validator_config)
 
         if self.validator_type.lower() == "operator":
diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index dddfa8e..9237ee3 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -340,7 +340,7 @@ class ImportExportMixin:
         self.params = json.dumps(params)
 
     def reset_ownership(self) -> None:
-        """ object will belong to the user the current user """
+        """object will belong to the user the current user"""
         # make sure the object doesn't have relations to a user
         # it will be filled by appbuilder on save
         self.created_by = None
diff --git a/superset/models/reports.py b/superset/models/reports.py
index 73c74eb..94728b9 100644
--- a/superset/models/reports.py
+++ b/superset/models/reports.py
@@ -50,7 +50,7 @@ class ReportScheduleType(str, enum.Enum):
 
 
 class ReportScheduleValidatorType(str, enum.Enum):
-    """ Validator types for alerts """
+    """Validator types for alerts"""
 
     NOT_NULL = "not null"
     OPERATOR = "operator"
diff --git a/superset/reports/commands/base.py 
b/superset/reports/commands/base.py
index bb4064d..85e3b99 100644
--- a/superset/reports/commands/base.py
+++ b/superset/reports/commands/base.py
@@ -44,7 +44,7 @@ class BaseReportScheduleCommand(BaseCommand):
     def validate_chart_dashboard(
         self, exceptions: List[ValidationError], update: bool = False
     ) -> None:
-        """ Validate chart or dashboard relation """
+        """Validate chart or dashboard relation"""
         chart_id = self._properties.get("chart")
         dashboard_id = self._properties.get("dashboard")
         if chart_id and dashboard_id:
diff --git a/superset/tasks/schedules.py b/superset/tasks/schedules.py
index c6e8e96..1e44958 100644
--- a/superset/tasks/schedules.py
+++ b/superset/tasks/schedules.py
@@ -824,7 +824,7 @@ def get_scheduler_action(report_type: str) -> 
Optional[Callable[..., Any]]:
 
 @celery_app.task(name="email_reports.schedule_hourly")
 def schedule_hourly() -> None:
-    """ Celery beat job meant to be invoked hourly """
+    """Celery beat job meant to be invoked hourly"""
     if not config["ENABLE_SCHEDULED_EMAIL_REPORTS"]:
         logger.info("Scheduled email reports not enabled in config")
         return
@@ -842,7 +842,7 @@ def schedule_hourly() -> None:
 
 @celery_app.task(name="alerts.schedule_check")
 def schedule_alerts() -> None:
-    """ Celery beat job meant to be invoked every minute to check alerts """
+    """Celery beat job meant to be invoked every minute to check alerts"""
     resolution = 0
     now = datetime.utcnow()
     start_at = now - timedelta(
diff --git a/superset/utils/machine_auth.py b/superset/utils/machine_auth.py
index 778f2a6..fe1db3b 100644
--- a/superset/utils/machine_auth.py
+++ b/superset/utils/machine_auth.py
@@ -42,8 +42,8 @@ class MachineAuthProvider:
 
     def authenticate_webdriver(self, driver: WebDriver, user: "User",) -> 
WebDriver:
         """
-            Default AuthDriverFuncType type that sets a session cookie 
flask-login style
-            :return: The WebDriver passed in (fluent)
+        Default AuthDriverFuncType type that sets a session cookie flask-login 
style
+        :return: The WebDriver passed in (fluent)
         """
         # Short-circuit this method if we have an override configured
         if self._auth_webdriver_func_override:
diff --git a/superset/views/utils.py b/superset/views/utils.py
index f45aa04..a1c91e0 100644
--- a/superset/views/utils.py
+++ b/superset/views/utils.py
@@ -429,7 +429,7 @@ def is_slice_in_container(
 
 
 def is_owner(obj: Union[Dashboard, Slice], user: User) -> bool:
-    """ Check if user is owner of the slice """
+    """Check if user is owner of the slice"""
     return obj and user in obj.owners
 
 

Reply via email to