Skip to content

Commit

Permalink
Merge pull request packit#1069 from packit/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate

updates:

github.com/psf/black: 20.8b1 → 21.4b0
github.com/asottile/pyupgrade: v2.12.0 → v2.13.0
github.com/packit/pre-commit-hooks: 5cdbd6e14e148297801cfb20a8dcc6293218dde9 → 83d3ac601119495d984b75ad77f3bf190b03e71f

Reviewed-by: None <None>
  • Loading branch information
softwarefactory-project-zuul[bot] committed Apr 27, 2021
2 parents 4bda37a + 5f6dbde commit 8660647
Show file tree
Hide file tree
Showing 21 changed files with 38 additions and 38 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

repos:
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 21.4b0
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v2.12.0
rev: v2.13.0
hooks:
- id: pyupgrade
- repo: https://github.com/pre-commit/mirrors-prettier
Expand Down Expand Up @@ -44,7 +44,7 @@ repos:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
- repo: https://github.com/packit/pre-commit-hooks
rev: 5cdbd6e14e148297801cfb20a8dcc6293218dde9
rev: 83d3ac601119495d984b75ad77f3bf190b03e71f
hooks:
- id: check-rebase
args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@


class CoprBuildModel(Base):
""" we create an entry for every target """
"""we create an entry for every target"""

__tablename__ = "copr_builds"
id = Column(Integer, primary_key=True)
Expand Down Expand Up @@ -100,7 +100,7 @@ def __repr__(self):


class KojiBuildModel(Base):
""" we create an entry for every target """
"""we create an entry for every target"""

__tablename__ = "koji_builds"
id = Column(Integer, primary_key=True)
Expand Down
2 changes: 1 addition & 1 deletion alembic/versions/a5c06aa9ef30_add_runmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def __repr__(self):


class KojiBuildModel(Base):
""" we create an entry for every target """
"""we create an entry for every target"""

__tablename__ = "koji_builds"
id = Column(Integer, primary_key=True)
Expand Down
6 changes: 3 additions & 3 deletions packit_service/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@


def get_pg_url() -> str:
""" create postgresql connection string """
"""create postgresql connection string"""
return (
f"postgres+psycopg2://{os.getenv('POSTGRESQL_USER')}"
f":{os.getenv('POSTGRESQL_PASSWORD')}@{os.getenv('POSTGRESQL_HOST', 'postgres')}"
Expand All @@ -64,7 +64,7 @@ def get_pg_url() -> str:

@contextmanager
def get_sa_session() -> Session:
""" get SQLAlchemy session """
"""get SQLAlchemy session"""
session = ScopedSession()
try:
yield session
Expand Down Expand Up @@ -892,7 +892,7 @@ def __repr__(self):


class KojiBuildModel(ProjectAndTriggersConnector, Base):
""" we create an entry for every target """
"""we create an entry for every target"""

__tablename__ = "koji_builds"
id = Column(Integer, primary_key=True)
Expand Down
2 changes: 1 addition & 1 deletion packit_service/service/api/copr_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CoprBuildsList(Resource):
@ns.expect(pagination_arguments)
@ns.response(HTTPStatus.PARTIAL_CONTENT.value, "Copr builds list follows")
def get(self):
""" List all Copr builds. """
"""List all Copr builds."""

# Return relevant info thats concise
# Usecases like the packit-dashboard copr-builds table
Expand Down
2 changes: 1 addition & 1 deletion packit_service/service/api/koji_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class KojiBuildsList(Resource):
@koji_builds_ns.expect(pagination_arguments)
@koji_builds_ns.response(HTTPStatus.PARTIAL_CONTENT, "Koji builds list follows")
def get(self):
""" List all Koji builds. """
"""List all Koji builds."""

first, last = indices()
result = []
Expand Down
2 changes: 1 addition & 1 deletion packit_service/service/api/srpm_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SRPMBuildsList(Resource):
@ns.expect(pagination_arguments)
@ns.response(HTTPStatus.PARTIAL_CONTENT.value, "SRPM builds list follows")
def get(self):
""" List all SRPM builds. """
"""List all SRPM builds."""

result = []

Expand Down
2 changes: 1 addition & 1 deletion packit_service/service/api/testing_farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def validate_testing_farm_request():
@ns.expect(pagination_arguments)
@ns.response(HTTPStatus.PARTIAL_CONTENT.value, "Testing Farm Results follow")
def get(self):
""" List all Testing Farm results. """
"""List all Testing Farm results."""

result = []

Expand Down
2 changes: 1 addition & 1 deletion packit_service/service/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ def from_build_id(
pkg: str,
timestamp,
) -> Optional["AbstractCoprBuildEvent"]:
""" Return cls instance or None if build_id not in CoprBuildDB"""
"""Return cls instance or None if build_id not in CoprBuildDB"""
build = CoprBuildModel.get_by_build_id(str(build_id), chroot)
if not build:
logger.warning(f"Build id {build_id} not in CoprBuildDB.")
Expand Down
4 changes: 2 additions & 2 deletions packit_service/worker/handlers/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ def pre_check(self) -> bool:
return True

def clean(self):
""" clean up the mess once we're done """
"""clean up the mess once we're done"""
logger.info("Cleaning up the mess.")
if self.api:
self.api.clean()
self._clean_workplace()


class JobHandler(Handler):
""" Generic interface to handle different type of inputs """
"""Generic interface to handle different type of inputs"""

task_name: TaskName

Expand Down
2 changes: 1 addition & 1 deletion packit_service/worker/handlers/fedmsg_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def add_topic(kls: Type["FedmsgHandler"]):


class FedmsgHandler(JobHandler):
""" Handlers for events from fedmsg """
"""Handlers for events from fedmsg"""

topic: str

Expand Down
4 changes: 2 additions & 2 deletions packit_service/worker/handlers/pagure_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def status_reporter(self) -> StatusReporter:
return self._status_reporter

def _create_bug(self):
""" Fill a Bugzilla bug and store in db. """
"""Fill a Bugzilla bug and store in db."""
bug_id, bug_url = self.bugzilla.create_bug(
product="Red Hat Enterprise Linux 8",
version="CentOS Stream",
Expand All @@ -94,7 +94,7 @@ def _create_bug(self):
)

def _attach_patch(self):
""" Attach a patch from the pull request to the bug. """
"""Attach a patch from the pull request to the bug."""
if not (self.bz_model and self.bz_model.bug_id):
raise RuntimeError(
"PagurePullRequestLabelHandler._attach_patch(): bug_id not set"
Expand Down
22 changes: 11 additions & 11 deletions packit_service/worker/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def parse_event(

@staticmethod
def parse_mr_event(event) -> Optional[MergeRequestGitlabEvent]:
""" Look into the provided event and see if it's one for a new gitlab MR. """
"""Look into the provided event and see if it's one for a new gitlab MR."""
if event.get("object_kind") != "merge_request":
return None

Expand Down Expand Up @@ -186,7 +186,7 @@ def parse_mr_event(event) -> Optional[MergeRequestGitlabEvent]:

@staticmethod
def parse_pr_event(event) -> Optional[PullRequestGithubEvent]:
""" Look into the provided event and see if it's one for a new github PR. """
"""Look into the provided event and see if it's one for a new github PR."""
if not event.get("pull_request"):
return None

Expand Down Expand Up @@ -362,7 +362,7 @@ def parse_push_event(event) -> Optional[PushGitHubEvent]:

@staticmethod
def parse_issue_comment_event(event) -> Optional[IssueCommentEvent]:
""" Look into the provided event and see if it is Github issue comment event. """
"""Look into the provided event and see if it is Github issue comment event."""
if nested_get(event, "issue", "pull_request"):
return None

Expand Down Expand Up @@ -400,7 +400,7 @@ def parse_issue_comment_event(event) -> Optional[IssueCommentEvent]:

@staticmethod
def parse_gitlab_issue_comment_event(event) -> Optional[IssueCommentGitlabEvent]:
""" Look into the provided event and see if it is Gitlab Issue comment event. """
"""Look into the provided event and see if it is Gitlab Issue comment event."""
if event.get("object_kind") != "note":
return None

Expand Down Expand Up @@ -462,7 +462,7 @@ def parse_gitlab_issue_comment_event(event) -> Optional[IssueCommentGitlabEvent]
def parse_merge_request_comment_event(
event,
) -> Optional[MergeRequestCommentGitlabEvent]:
""" Look into the provided event and see if it is Gitlab MR comment event. """
"""Look into the provided event and see if it is Gitlab MR comment event."""
if event.get("object_kind") != "note":
return None

Expand Down Expand Up @@ -543,7 +543,7 @@ def parse_merge_request_comment_event(
def parse_pull_request_comment_event(
event,
) -> Optional[PullRequestCommentGithubEvent]:
""" Look into the provided event and see if it is Github PR comment event. """
"""Look into the provided event and see if it is Github PR comment event."""
if not nested_get(event, "issue", "pull_request"):
return None

Expand Down Expand Up @@ -589,7 +589,7 @@ def parse_pull_request_comment_event(

@staticmethod
def parse_installation_event(event) -> Optional[InstallationEvent]:
""" Look into the provided event and see Github App installation details. """
"""Look into the provided event and see Github App installation details."""
# Check if installation key in JSON isn't enough, we have to check the account as well
if not nested_get(event, "installation", "account"):
return None
Expand Down Expand Up @@ -668,7 +668,7 @@ def parse_release_event(event) -> Optional[ReleaseEvent]:

@staticmethod
def parse_distgit_commit_event(event) -> Optional[DistGitCommitEvent]:
""" this corresponds to dist-git event when someone pushes new commits """
"""this corresponds to dist-git event when someone pushes new commits"""
topic = event.get("topic")
if topic != DistGitCommitHandler.topic:
return None
Expand Down Expand Up @@ -725,7 +725,7 @@ def parse_distgit_commit_event(event) -> Optional[DistGitCommitEvent]:

@staticmethod
def _parse_tf_result_xunit(xunit: Optional[str]) -> List[TestResult]:
""" Parse event["result"]["xunit"] to get tests results """
"""Parse event["result"]["xunit"] to get tests results"""
if not xunit:
return []
xunit_dict = xmltodict.parse(xunit)
Expand All @@ -751,7 +751,7 @@ def _parse_tf_result_xunit(xunit: Optional[str]) -> List[TestResult]:
def parse_testing_farm_results_event(
event: dict,
) -> Optional[TestingFarmResultsEvent]:
""" this corresponds to testing farm results event """
"""this corresponds to testing farm results event"""
if event.get("source") != "testing-farm" or not event.get("request_id"):
return None

Expand Down Expand Up @@ -837,7 +837,7 @@ def parse_testing_farm_results_event(

@staticmethod
def parse_copr_event(event) -> Optional[AbstractCoprBuildEvent]:
""" this corresponds to copr build event e.g:"""
"""this corresponds to copr build event e.g:"""
topic = event.get("topic")

copr_build_cls: Type["AbstractCoprBuildEvent"]
Expand Down
2 changes: 1 addition & 1 deletion packit_service/worker/psbugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class Bugzilla:
""" To create a Bugzilla bug & attach a patch. Uses Bugzilla XMLRPC access module. """
"""To create a Bugzilla bug & attach a patch. Uses Bugzilla XMLRPC access module."""

def __init__(self, url: str, api_key: str):
self.logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion packit_service/worker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def process_message(
max_retries=7,
)
def babysit_copr_build(self, build_id: int):
""" check status of a copr build and update it in DB """
"""check status of a copr build and update it in DB"""
if not check_copr_build(build_id=build_id):
self.retry()

Expand Down
2 changes: 1 addition & 1 deletion packit_service/worker/testing_farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def is_fmf_configured(self) -> bool:

@staticmethod
def chroot2distro_arch(chroot: str) -> Tuple[str, str]:
""" Get distro and arch from chroot. """
"""Get distro and arch from chroot."""
distro, arch = chroot.rsplit("-", 1)
# https://github.com/packit/packit-service/issues/939#issuecomment-769896841
# https://github.com/packit/packit-service/pull/1008#issuecomment-789574614
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_something(dump_http_com):
"""

def f(path: str):
""" path points to a file where the http communication will be saved """
"""path points to a file where the http communication will be saved"""
conf = ServiceConfig()
# TODO: add pagure support
# conf._pagure_user_token = os.environ.get("PAGURE_TOKEN", "test")
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_parse_missing(service_config_missing):
),
)
def test_config_opts(sc):
""" test that ServiceConfig knows all the options """
"""test that ServiceConfig knows all the options"""
assert sc.server_name is not None
assert sc.deployment == Deployment.stg
assert sc.admins is not None
Expand Down
2 changes: 1 addition & 1 deletion tests_requre/openshift_integration/test_fedpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def tearDown(self) -> None:
super().tearDown()

def test_fedpkg_clone(self):
""" test `fedpkg clone -a` within an openshift pod """
"""test `fedpkg clone -a` within an openshift pod"""
t = Path(self.tmpdir)
f = FedPKG()
f.clone("units", str(t), anonymous=True)
Expand Down
2 changes: 1 addition & 1 deletion tests_requre/openshift_integration/test_sandcastle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@


def test_get_api_client():
""" let's make sure we can get k8s API client """
"""let's make sure we can get k8s API client"""
assert sandcastle.Sandcastle.get_api_client()
2 changes: 1 addition & 1 deletion tests_requre/service/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def test_get_projects_branches(


def test_meta(client, clean_before_and_after, a_copr_build_for_pr):
""" Test meta info like headers, status etc """
"""Test meta info like headers, status etc"""
response = client.get(url_for("api.copr-builds_copr_builds_list"))
assert response.status_code == 206
assert response.status == "206 PARTIAL CONTENT"
Expand Down

0 comments on commit 8660647

Please sign in to comment.