Skip to content

Commit

Permalink
chore: upgrade black (#19410)
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Mar 29, 2022
1 parent 816a2c3 commit a619cb4
Show file tree
Hide file tree
Showing 204 changed files with 2,125 additions and 608 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ repos:
- id: trailing-whitespace
args: ["--markdown-linebreak-ext=md"]
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 22.3.0
hooks:
- id: black
language_version: python3
Expand Down
8 changes: 6 additions & 2 deletions RELEASING/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ def _get_changelog_version_head(self) -> str:
return f"### {self._version} ({self._logs[0].time})"

def _parse_change_log(
self, changelog: Dict[str, str], pr_info: Dict[str, str], github_login: str,
self,
changelog: Dict[str, str],
pr_info: Dict[str, str],
github_login: str,
) -> None:
formatted_pr = (
f"- [#{pr_info.get('id')}]"
Expand Down Expand Up @@ -355,7 +358,8 @@ def compare(base_parameters: BaseParameters) -> None:

@cli.command("changelog")
@click.option(
"--csv", help="The csv filename to export the changelog to",
"--csv",
help="The csv filename to export the changelog to",
)
@click.option(
"--access_token",
Expand Down
7 changes: 6 additions & 1 deletion RELEASING/send_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ def inter_send_email(

class BaseParameters(object):
def __init__(
self, email: str, username: str, password: str, version: str, version_rc: str,
self,
email: str,
username: str,
password: str,
version: str,
version_rc: str,
) -> None:
self.email = email
self.username = username
Expand Down
9 changes: 7 additions & 2 deletions scripts/cancel_github_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def request(


def list_runs(
repo: str, params: Optional[Dict[str, str]] = None,
repo: str,
params: Optional[Dict[str, str]] = None,
) -> Iterator[Dict[str, Any]]:
"""List all github workflow runs.
Returns:
Expand Down Expand Up @@ -193,7 +194,11 @@ def cancel_github_workflows(
if branch and ":" in branch:
[user, branch] = branch.split(":", 2)
runs = get_runs(
repo, branch=branch, user=user, statuses=statuses, events=events,
repo,
branch=branch,
user=user,
statuses=statuses,
events=events,
)

# sort old jobs to the front, so to cancel older jobs first
Expand Down
4 changes: 3 additions & 1 deletion superset/annotation_layers/annotations/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def validate(self) -> None:

# Validate short descr uniqueness on this layer
if not AnnotationDAO.validate_update_uniqueness(
layer_id, short_descr, annotation_id=self._model_id,
layer_id,
short_descr,
annotation_id=self._model_id,
):
exceptions.append(AnnotationUniquenessValidationError())
else:
Expand Down
8 changes: 6 additions & 2 deletions superset/annotation_layers/annotations/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,17 @@ class AnnotationPostSchema(Schema):
)
long_descr = fields.String(description=annotation_long_descr, allow_none=True)
start_dttm = fields.DateTime(
description=annotation_start_dttm, required=True, allow_none=False,
description=annotation_start_dttm,
required=True,
allow_none=False,
)
end_dttm = fields.DateTime(
description=annotation_end_dttm, required=True, allow_none=False
)
json_metadata = fields.String(
description=annotation_json_metadata, validate=validate_json, allow_none=True,
description=annotation_json_metadata,
validate=validate_json,
allow_none=True,
)


Expand Down
6 changes: 4 additions & 2 deletions superset/cachekeys/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ def invalidate(self) -> Response:
)

try:
delete_stmt = CacheKey.__table__.delete().where( # pylint: disable=no-member
CacheKey.cache_key.in_(cache_keys)
delete_stmt = (
CacheKey.__table__.delete().where( # pylint: disable=no-member
CacheKey.cache_key.in_(cache_keys)
)
)
db.session.execute(delete_stmt)
db.session.commit()
Expand Down
15 changes: 11 additions & 4 deletions superset/cachekeys/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@


class Datasource(Schema):
database_name = fields.String(description="Datasource name",)
datasource_name = fields.String(description=datasource_name_description,)
schema = fields.String(description="Datasource schema",)
database_name = fields.String(
description="Datasource name",
)
datasource_name = fields.String(
description=datasource_name_description,
)
schema = fields.String(
description="Datasource schema",
)
datasource_type = fields.String(
description=datasource_type_description,
validate=validate.OneOf(choices=("druid", "table", "view")),
Expand All @@ -37,7 +43,8 @@ class Datasource(Schema):

class CacheInvalidationRequestSchema(Schema):
datasource_uids = fields.List(
fields.String(), description=datasource_uid_description,
fields.String(),
description=datasource_uid_description,
)
datasources = fields.List(
fields.Nested(Datasource),
Expand Down
Loading

0 comments on commit a619cb4

Please sign in to comment.