From fd04a4bb5fbbd38b2f3b49eb61fa9dbeb07877d9 Mon Sep 17 00:00:00 2001 From: Thomas Carmet <8408330+tcarmet@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:58:40 +0000 Subject: [PATCH] Fix lint issues --- bert_e/workflow/gitwaterflow/__init__.py | 1 - bert_e/workflow/gitwaterflow/branches.py | 1 - bert_e/workflow/gitwaterflow/queueing.py | 19 +++++++++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/bert_e/workflow/gitwaterflow/__init__.py b/bert_e/workflow/gitwaterflow/__init__.py index dbf0bded..baa8f8c0 100644 --- a/bert_e/workflow/gitwaterflow/__init__.py +++ b/bert_e/workflow/gitwaterflow/__init__.py @@ -21,7 +21,6 @@ from bert_e import exceptions as messages from bert_e.job import handler, CommitJob, PullRequestJob, QueuesJob -from bert_e.jobs.delete_queues import delete_queues from bert_e.lib.cli import confirm from bert_e.reactor import Reactor, NotFound, NotPrivileged, NotAuthored from ..git_utils import push, clone_git_repo diff --git a/bert_e/workflow/gitwaterflow/branches.py b/bert_e/workflow/gitwaterflow/branches.py index e0d209e5..3c566886 100644 --- a/bert_e/workflow/gitwaterflow/branches.py +++ b/bert_e/workflow/gitwaterflow/branches.py @@ -753,7 +753,6 @@ def delete(self): queue.remove(do_push=True) - class BranchCascade(object): def __init__(self): self._cascade = OrderedDict() diff --git a/bert_e/workflow/gitwaterflow/queueing.py b/bert_e/workflow/gitwaterflow/queueing.py index 70d2c482..ffa0e060 100644 --- a/bert_e/workflow/gitwaterflow/queueing.py +++ b/bert_e/workflow/gitwaterflow/queueing.py @@ -23,9 +23,10 @@ from ..git_utils import clone_git_repo, consecutive_merge, robust_merge, push from ..pr_utils import send_comment -from .branches import (BranchCascade, DevelopmentBranch, GWFBranch, IntegrationBranch, - QueueBranch, QueueCollection, QueueIntegrationBranch, - branch_factory, build_queue_collection) +from .branches import (BranchCascade, DevelopmentBranch, GWFBranch, + IntegrationBranch, QueueBranch, QueueCollection, + QueueIntegrationBranch, branch_factory, + build_queue_collection) from .integration import get_integration_branches from typing import List LOG = logging.getLogger(__name__) @@ -208,11 +209,16 @@ def close_queued_pull_request(job, pr_id, cascade): # not critical pass -def is_needed(job: PullRequestJob, wbranches: List[GWFBranch], queues: QueueCollection): + +def is_needed( + job: PullRequestJob, + wbranches: List[GWFBranch], + queues: QueueCollection): """Determine if queuing is required to merge the given PR. Queuing a pull request should only be done if: - - The PR or the integration branches are not up to date with the destination branch. + - The PR or the integration branches are not up to date + with the destination branch. - Other PRs are already in the queue. Returns: @@ -225,7 +231,8 @@ def is_needed(job: PullRequestJob, wbranches: List[GWFBranch], queues: QueueColl len(queues.queued_prs) > 0): return True - if not job.git.src_branch.includes_commit(job.git.dst_branch.get_latest_commit()): + if not job.git.src_branch.includes_commit( + job.git.dst_branch.get_latest_commit()): return True # Check if the wbranches all contain the commits in the dst branches for branch, dst_branch in zip(wbranches, job.git.cascade.dst_branches):