Skip to content

Commit

Permalink
Reformat with black 24.1.1
Browse files Browse the repository at this point in the history
Black 24.1.0 changed some formatting styles.
  • Loading branch information
bjoernricks committed Jan 29, 2024
1 parent 8d69054 commit dd2c799
Show file tree
Hide file tree
Showing 20 changed files with 605 additions and 433 deletions.
204 changes: 102 additions & 102 deletions pontos/github/api/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ def update_from_applied_settings(
if required_linear_history is not None:
kwargs["required_linear_history"] = required_linear_history
elif branch_protection.required_linear_history:
kwargs[
"required_linear_history"
] = branch_protection.required_linear_history.enabled
kwargs["required_linear_history"] = (
branch_protection.required_linear_history.enabled
)
else:
kwargs["required_linear_history"] = None

if allow_force_pushes is not None:
kwargs["allow_force_pushes"] = allow_force_pushes
elif branch_protection.allow_force_pushes:
kwargs[
"allow_force_pushes"
] = branch_protection.allow_force_pushes.enabled
kwargs["allow_force_pushes"] = (
branch_protection.allow_force_pushes.enabled
)
else:
kwargs["allow_force_pushes"] = None

Expand All @@ -78,13 +78,13 @@ def update_from_applied_settings(
kwargs["allow_deletions"] = None

if required_conversation_resolution is not None:
kwargs[
"required_conversation_resolution"
] = required_conversation_resolution
kwargs["required_conversation_resolution"] = (
required_conversation_resolution
)
elif branch_protection.required_conversation_resolution:
kwargs[
"required_conversation_resolution"
] = branch_protection.required_conversation_resolution.enabled
kwargs["required_conversation_resolution"] = (
branch_protection.required_conversation_resolution.enabled
)
else:
kwargs["required_conversation_resolution"] = None

Expand All @@ -105,25 +105,25 @@ def update_from_applied_settings(
if allow_fork_syncing is not None:
kwargs["allow_fork_syncing"] = allow_fork_syncing
elif branch_protection.allow_fork_syncing:
kwargs[
"allow_fork_syncing"
] = branch_protection.allow_fork_syncing.enabled
kwargs["allow_fork_syncing"] = (
branch_protection.allow_fork_syncing.enabled
)
else:
kwargs["allow_fork_syncing"] = None
if required_signatures is not None:
kwargs["required_signatures"] = required_signatures
elif branch_protection.required_signatures:
kwargs[
"required_signatures"
] = branch_protection.required_signatures.enabled
kwargs["required_signatures"] = (
branch_protection.required_signatures.enabled
)
else:
kwargs["required_signatures"] = None

existing_required_status_checks = branch_protection.required_status_checks
if existing_required_status_checks:
kwargs[
"require_branches_to_be_up_to_date"
] = existing_required_status_checks.strict
kwargs["require_branches_to_be_up_to_date"] = (
existing_required_status_checks.strict
)
if existing_required_status_checks.checks is not None:
kwargs["required_status_checks"] = [
(c.context, c.app_id)
Expand All @@ -132,9 +132,9 @@ def update_from_applied_settings(
if required_status_checks is not None:
kwargs["required_status_checks"] = required_status_checks
if require_branches_to_be_up_to_date:
kwargs[
"require_branches_to_be_up_to_date"
] = require_branches_to_be_up_to_date
kwargs["require_branches_to_be_up_to_date"] = (
require_branches_to_be_up_to_date
)

required_pull_request_reviews = (
branch_protection.required_pull_request_reviews
Expand Down Expand Up @@ -163,18 +163,18 @@ def update_from_applied_settings(
else:
kwargs["dismissal_restrictions_apps"] = []

kwargs[
"dismiss_stale_reviews"
] = required_pull_request_reviews.dismiss_stale_reviews
kwargs[
"require_code_owner_reviews"
] = required_pull_request_reviews.require_code_owner_reviews
kwargs[
"required_approving_review_count"
] = required_pull_request_reviews.required_approving_review_count
kwargs[
"require_last_push_approval"
] = required_pull_request_reviews.require_last_push_approval
kwargs["dismiss_stale_reviews"] = (
required_pull_request_reviews.dismiss_stale_reviews
)
kwargs["require_code_owner_reviews"] = (
required_pull_request_reviews.require_code_owner_reviews
)
kwargs["required_approving_review_count"] = (
required_pull_request_reviews.required_approving_review_count
)
kwargs["require_last_push_approval"] = (
required_pull_request_reviews.require_last_push_approval
)

bypass_pull_request_allowances = (
required_pull_request_reviews.bypass_pull_request_allowances
Expand Down Expand Up @@ -249,9 +249,9 @@ def update_from_applied_settings(
if require_code_owner_reviews is not None:
kwargs["require_code_owner_reviews"] = require_code_owner_reviews
if required_approving_review_count is not None:
kwargs[
"required_approving_review_count"
] = required_approving_review_count
kwargs["required_approving_review_count"] = (
required_approving_review_count
)
if require_last_push_approval is not None:
kwargs["require_last_push_approval"] = require_last_push_approval

Expand Down Expand Up @@ -477,9 +477,9 @@ async def update_protection_rules(
if block_creations is not None:
data["block_creations"] = block_creations
if required_conversation_resolution is not None:
data[
"required_conversation_resolution"
] = required_conversation_resolution
data["required_conversation_resolution"] = (
required_conversation_resolution
)
if lock_branch is not None:
data["lock_branch"] = lock_branch
if allow_fork_syncing is not None:
Expand Down Expand Up @@ -529,42 +529,42 @@ async def update_protection_rules(
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
)
required_pull_request_reviews[
"dismiss_stale_reviews"
] = dismiss_stale_reviews
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["dismiss_stale_reviews"] = (
dismiss_stale_reviews
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if require_code_owner_reviews is not None:
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
)
required_pull_request_reviews[
"require_code_owner_reviews"
] = require_code_owner_reviews
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["require_code_owner_reviews"] = (
require_code_owner_reviews
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if required_approving_review_count is not None:
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
)
required_pull_request_reviews[
"required_approving_review_count"
] = required_approving_review_count
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["required_approving_review_count"] = (
required_approving_review_count
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if require_last_push_approval is not None:
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
)
required_pull_request_reviews[
"require_last_push_approval"
] = require_last_push_approval
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["require_last_push_approval"] = (
require_last_push_approval
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if dismissal_restrictions_users is not None:
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
Expand All @@ -573,12 +573,12 @@ async def update_protection_rules(
"dismissal_restrictions", {}
)
dismissal_restrictions["users"] = list(dismissal_restrictions_users)
required_pull_request_reviews[
"dismissal_restrictions"
] = dismissal_restrictions
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["dismissal_restrictions"] = (
dismissal_restrictions
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if dismissal_restrictions_teams is not None:
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
Expand All @@ -587,12 +587,12 @@ async def update_protection_rules(
"dismissal_restrictions", {}
)
dismissal_restrictions["teams"] = list(dismissal_restrictions_teams)
required_pull_request_reviews[
"dismissal_restrictions"
] = dismissal_restrictions
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["dismissal_restrictions"] = (
dismissal_restrictions
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if dismissal_restrictions_apps is not None:
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
Expand All @@ -601,12 +601,12 @@ async def update_protection_rules(
"dismissal_restrictions", {}
)
dismissal_restrictions["apps"] = list(dismissal_restrictions_apps)
required_pull_request_reviews[
"dismissal_restrictions"
] = dismissal_restrictions
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["dismissal_restrictions"] = (
dismissal_restrictions
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if bypass_pull_request_allowances_users is not None:
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
Expand All @@ -617,12 +617,12 @@ async def update_protection_rules(
bypass_pull_request_allowances["users"] = list(
bypass_pull_request_allowances_users
)
required_pull_request_reviews[
"bypass_pull_request_allowances"
] = bypass_pull_request_allowances
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["bypass_pull_request_allowances"] = (
bypass_pull_request_allowances
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if bypass_pull_request_allowances_teams is not None:
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
Expand All @@ -633,12 +633,12 @@ async def update_protection_rules(
bypass_pull_request_allowances["teams"] = list(
bypass_pull_request_allowances_teams
)
required_pull_request_reviews[
"bypass_pull_request_allowances"
] = bypass_pull_request_allowances
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["bypass_pull_request_allowances"] = (
bypass_pull_request_allowances
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if bypass_pull_request_allowances_apps is not None:
required_pull_request_reviews = (
data.get("required_pull_request_reviews") or {}
Expand All @@ -649,12 +649,12 @@ async def update_protection_rules(
bypass_pull_request_allowances["apps"] = list(
bypass_pull_request_allowances_apps
)
required_pull_request_reviews[
"bypass_pull_request_allowances"
] = bypass_pull_request_allowances
data[
"required_pull_request_reviews"
] = required_pull_request_reviews
required_pull_request_reviews["bypass_pull_request_allowances"] = (
bypass_pull_request_allowances
)
data["required_pull_request_reviews"] = (
required_pull_request_reviews
)
if required_signatures is not None:
data["required_signatures"] = required_signatures

Expand Down
5 changes: 3 additions & 2 deletions pontos/github/script/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ def load_script(
if path.suffix == ".py":
module_name = path.stem

with add_sys_path(path.parent.absolute()), ensure_unload_module(
module_name
with (
add_sys_path(path.parent.absolute()),
ensure_unload_module(module_name),
):
yield importlib.import_module(module_name)
else:
Expand Down
6 changes: 3 additions & 3 deletions pontos/github/scripts/team-repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ async def github_script(api: GitHubAsyncRESTApi, args: Namespace) -> int:

done, pending = await asyncio.wait(
tasks,
return_when=asyncio.FIRST_EXCEPTION
if args.failfast
else asyncio.ALL_COMPLETED,
return_when=(
asyncio.FIRST_EXCEPTION if args.failfast else asyncio.ALL_COMPLETED
),
)
pending: Set[asyncio.Task]

Expand Down
16 changes: 10 additions & 6 deletions pontos/release/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ def _create_changelog(
)

return changelog_builder.create_changelog(
last_version=last_release_version.parsed_version
if last_release_version
else None,
last_version=(
last_release_version.parsed_version
if last_release_version
else None
),
next_version=release_version,
)

Expand Down Expand Up @@ -193,9 +195,11 @@ async def async_run( # type: ignore[override]
last_release_version = get_last_release_version(
parse_version=versioning_scheme.parse_version,
git_tag_prefix=self.git_tag_prefix,
tag_name=f"{self.git_tag_prefix}{release_series}.*"
if release_series
else None,
tag_name=(
f"{self.git_tag_prefix}{release_series}.*"
if release_series
else None
),
# include changes from pre-releases in release changelog for
# non pre-release changes
ignore_pre_releases=release_type
Expand Down
Loading

0 comments on commit dd2c799

Please sign in to comment.