Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(black): set line length to 100 #2598

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
# pre-commit install -t pre-commit -t pre-push

repos:
- repo: https://github.com/psf/black
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.291
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
hooks:
- id: black
args:
- "-l 100"
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
Expand Down Expand Up @@ -116,9 +124,3 @@ repos:
- LICENSE_HEADER.txt
- --comment-style
- "#"
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.291
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ def upgrade():
project_url = url[0 : (url.rfind("/pull-request/"))] # noqa[203]
pr_id = int(url[(url.rfind("/pull-request/") + 14) :]) # noqa[203]
namespace = "rpms"
repo = url[
(url.rfind("rpms/") + 5) : url.rfind("/pull-request") # noqa[203]
]
repo = url[(url.rfind("rpms/") + 5) : url.rfind("/pull-request")] # noqa[203]
pull_request = SyncReleasePullRequestModel.get_or_create(
pr_id,
namespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ def upgrade():
len(project.project_authentication_issue) <= 0
and len(project_dot_git.project_authentication_issue) > 0
):
project_authentication_issue = project_dot_git.project_authentication_issue[
0
]
project_authentication_issue = project_dot_git.project_authentication_issue[0]
project_authentication_issue.project_id = project.id
session.add(project_authentication_issue)
# we need to commit here explicitly b/c we are changing the foreign key
Expand Down
3 changes: 1 addition & 2 deletions alembic/versions/a5c06aa9ef30_add_runmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,7 @@ def upgrade():
for test, build in zip(test_group, matching_builds):
if len(build.runs) != 1:
PackitException(
f"Build {build} does not have exactly one run:\n"
f"{build.runs}",
f"Build {build} does not have exactly one run:\n" f"{build.runs}",
)
test_runs_attached += 1
build.runs[-1].test_run = test
Expand Down
3 changes: 1 addition & 2 deletions alembic/versions/a619bd414ff0_add_build_status_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def upgrade():
"ALTER COLUMN status TYPE buildstatus USING status::buildstatus",
)
op.execute(
"ALTER TABLE srpm_builds "
"ALTER COLUMN status TYPE buildstatus USING status::buildstatus",
"ALTER TABLE srpm_builds " "ALTER COLUMN status TYPE buildstatus USING status::buildstatus",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ def downgrade():
)
for row in rows:
bind.execute(
update(SRPMBuildModel)
.where(SRPMBuildModel.id == row[0])
.values(commit_sha=row[1]),
update(SRPMBuildModel).where(SRPMBuildModel.id == row[0]).values(commit_sha=row[1]),
)
rows = (
session.query(CoprBuildTargetModel.id, ProjectEventModel.commit_sha)
Expand Down
17 changes: 4 additions & 13 deletions alembic/versions/c6250555a36c_.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,7 @@ def add_account(cls, session: Session, account_name: str, status: str):

@classmethod
def get_account(cls, session: Session, account_name: str):
return (
session.query(WhitelistUpgradeModel)
.filter_by(account_name=account_name)
.first()
)
return session.query(WhitelistUpgradeModel).filter_by(account_name=account_name).first()


class InstallationUpgradeModel(Base):
Expand All @@ -313,9 +309,7 @@ class InstallationUpgradeModel(Base):
@classmethod
def get_by_account_login(cls, session: Session, account_login: str):
return (
session.query(InstallationUpgradeModel)
.filter_by(account_login=account_login)
.first()
session.query(InstallationUpgradeModel).filter_by(account_login=account_login).first()
)

@classmethod
Expand Down Expand Up @@ -364,9 +358,7 @@ class CoprBuildUpgradeModel(Base):
@classmethod
def get_by_build_id(cls, session: Session, build_id: str, target: str):
return (
session.query(CoprBuildUpgradeModel)
.filter_by(build_id=build_id, target=target)
.first()
session.query(CoprBuildUpgradeModel).filter_by(build_id=build_id, target=target).first()
)

@classmethod
Expand Down Expand Up @@ -556,8 +548,7 @@ def upgrade():

status = copr_build.get("status")
web_url = (
f"https://copr.fedorainfracloud.org/coprs/{owner}/{project_name}/"
f"build/{build_id}/"
f"https://copr.fedorainfracloud.org/coprs/{owner}/{project_name}/" f"build/{build_id}/"
)

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ def upgrade():

for project in session.query(GitProjectUpgradeModel).all():
if not project.project_url:
project.project_url = (
f"https://github.com/{project.namespace}/{project.repo_name}"
)
project.project_url = f"https://github.com/{project.namespace}/{project.repo_name}"
session.add(project)

session.commit()
Expand Down
4 changes: 1 addition & 3 deletions files/scripts/db-cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@
]
for trigger_type, trigger_model in trigger_types:
triggers = (
select(JobTriggerModel)
.filter(JobTriggerModel.type == trigger_type)
.subquery()
select(JobTriggerModel).filter(JobTriggerModel.type == trigger_type).subquery()
)
orphaned_triggers = (
select(trigger_model.id)
Expand Down
12 changes: 3 additions & 9 deletions packit_service/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
"</tr>"
)

MSG_GET_IN_TOUCH = (
f"\n\n---\n\n*Get in [touch with us]({CONTACTS_URL}) if you need some help.*"
)
MSG_GET_IN_TOUCH = f"\n\n---\n\n*Get in [touch with us]({CONTACTS_URL}) if you need some help.*"

MSG_RETRIGGER = (
"You can retrigger the {job} by adding a comment (`{packit_comment_command_prefix} {command}`) "
Expand Down Expand Up @@ -219,9 +217,7 @@ def from_number(number: int):
"or only test job via `{packit_comment_command_prefix} test` comment.*",
)

CUSTOM_COPR_PROJECT_NOT_ALLOWED_STATUS = (
"Not allowed to build in {copr_project} Copr project."
)
CUSTOM_COPR_PROJECT_NOT_ALLOWED_STATUS = "Not allowed to build in {copr_project} Copr project."
CUSTOM_COPR_PROJECT_NOT_ALLOWED_CONTENT = (
"Your git-forge project is not allowed to use "
"the configured `{copr_project}` Copr project.\n\n"
Expand All @@ -234,9 +230,7 @@ def from_number(number: int):

PACKIT_VERIFY_FAS_COMMAND = "verify-fas"

MISSING_PERMISSIONS_TO_BUILD_IN_COPR = (
"You don't have permissions to build in this copr."
)
MISSING_PERMISSIONS_TO_BUILD_IN_COPR = "You don't have permissions to build in this copr."
NOT_ALLOWED_TO_BUILD_IN_COPR = "is not allowed to build in the copr"
GIT_FORGE_PROJECT_NOT_ALLOWED_TO_BUILD_IN_COPR = "can't build in this Copr via Packit."

Expand Down
Loading
Loading