From 3fd59eace374c2d3e1828eafaebc779b6fb8a9ab Mon Sep 17 00:00:00 2001 From: jerubball Date: Wed, 11 Mar 2026 17:01:22 -0400 Subject: [PATCH 1/2] run black formatter --- atlassian/__init__.py | 1 - atlassian/bamboo.py | 21 ++----------------- atlassian/bitbucket/__init__.py | 10 +-------- atlassian/rest_client.py | 7 ++++++- atlassian/statuspage.py | 1 + atlassian/utils.py | 18 ++++++---------- examples/confluence/confluence_attach_file.py | 1 + .../confluence_scrap_regex_from_page.py | 1 - examples/jira/jira_admins_confluence_page.py | 6 ++---- examples/jira/jira_project_administrators.py | 4 +--- examples/jira/jira_project_leaders.py | 6 ++---- tests/test_jira.py | 1 + tests/test_rest_client.py | 1 + 13 files changed, 24 insertions(+), 54 deletions(-) diff --git a/atlassian/__init__.py b/atlassian/__init__.py index 5c17f3eed..8422e7dbb 100644 --- a/atlassian/__init__.py +++ b/atlassian/__init__.py @@ -19,7 +19,6 @@ from .tempo import TempoCloud, TempoServer from .xray import Xray - __all__ = [ "Confluence", "ConfluenceCloud", diff --git a/atlassian/bamboo.py b/atlassian/bamboo.py index a9fa51441..81dc3266a 100755 --- a/atlassian/bamboo.py +++ b/atlassian/bamboo.py @@ -62,17 +62,7 @@ def _get_generator( logging.error(f"Broken response: {response}") yield response - def base_list_call( - self, - resource, - expand, - favourite, - clover_enabled, - max_results, - label=None, - start_index=0, - **kwargs - ): # fmt: skip + def base_list_call(self, resource, expand, favourite, clover_enabled, max_results, label=None, start_index=0, **kwargs): # fmt: skip flags = [] params = {"max-results": max_results} if expand: @@ -622,14 +612,7 @@ def delete_build_result(self, build_key): params = {"buildKey": plan_key, "buildNumber": build_number} return self.post(custom_resource, params=params, headers=self.form_token_headers) - def execute_build( - self, - plan_key, - stage=None, - execute_all_stages=True, - custom_revision=None, - **bamboo_variables - ): # fmt: skip + def execute_build(self, plan_key, stage=None, execute_all_stages=True, custom_revision=None, **bamboo_variables): # fmt: skip """ Fire build execution for specified plan. !IMPORTANT! NOTE: for some reason, this method always execute all stages diff --git a/atlassian/bitbucket/__init__.py b/atlassian/bitbucket/__init__.py index 4e23a98a5..635285459 100644 --- a/atlassian/bitbucket/__init__.py +++ b/atlassian/bitbucket/__init__.py @@ -2568,15 +2568,7 @@ def delete_code_insights_report(self, project_key, repository_slug, commit_id, r url = self._url_code_insights_report(project_key, repository_slug, commit_id, report_key) return self.delete(url) - def create_code_insights_report( - self, - project_key, - repository_slug, - commit_id, - report_key, - report_title, - **report_params - ): # fmt: skip + def create_code_insights_report(self, project_key, repository_slug, commit_id, report_key, report_title, **report_params): # fmt: skip """ Create a new insight report, or replace the existing one if a report already exists for the given repository_slug, commit, and report key. diff --git a/atlassian/rest_client.py b/atlassian/rest_client.py index 73a1619b2..79479457d 100644 --- a/atlassian/rest_client.py +++ b/atlassian/rest_client.py @@ -359,7 +359,12 @@ def _handle(response): delay = self._parse_retry_after_header(response.headers.get("Retry-After")) if delay is not None: retry_with_header_count += 1 - log.debug("Retrying after %s seconds (attempt %d/%d)", delay, retry_with_header_count, max_retry_with_header_attempts) + log.debug( + "Retrying after %s seconds (attempt %d/%d)", + delay, + retry_with_header_count, + max_retry_with_header_attempts, + ) time.sleep(delay) return True diff --git a/atlassian/statuspage.py b/atlassian/statuspage.py index 4bc047322..d084e2129 100644 --- a/atlassian/statuspage.py +++ b/atlassian/statuspage.py @@ -1,5 +1,6 @@ # coding=utf-8 """Statuspage API wrapper.""" + import logging from enum import Enum diff --git a/atlassian/utils.py b/atlassian/utils.py index 24a479993..631d0111d 100644 --- a/atlassian/utils.py +++ b/atlassian/utils.py @@ -213,14 +213,12 @@ def block_code_macro_confluence(code, lang=None): """ if not lang: lang = "" - return ( - """\ + return ("""\ {lang} - """ - ).format(lang=lang, code=code) + """).format(lang=lang, code=code) def html_code__macro_confluence(text): @@ -229,13 +227,11 @@ def html_code__macro_confluence(text): :param text: :return: """ - return ( - """\ + return ("""\ - """ - ).format(text=text) + """).format(text=text) def noformat_code_macro_confluence(text, nopanel=None): @@ -247,14 +243,12 @@ def noformat_code_macro_confluence(text, nopanel=None): """ if not nopanel: nopanel = False - return ( - """\ + return ("""\ {nopanel} - """ - ).format(nopanel=nopanel, text=text) + """).format(nopanel=nopanel, text=text) def symbol_normalizer(text): diff --git a/examples/confluence/confluence_attach_file.py b/examples/confluence/confluence_attach_file.py index 0819b0cbe..e7854adfa 100644 --- a/examples/confluence/confluence_attach_file.py +++ b/examples/confluence/confluence_attach_file.py @@ -3,6 +3,7 @@ This is example to attach file with mimetype """ + import logging # https://pypi.org/project/python-magic/ diff --git a/examples/confluence/confluence_scrap_regex_from_page.py b/examples/confluence/confluence_scrap_regex_from_page.py index 03225875b..f63825b80 100644 --- a/examples/confluence/confluence_scrap_regex_from_page.py +++ b/examples/confluence/confluence_scrap_regex_from_page.py @@ -1,6 +1,5 @@ from atlassian import Confluence - confluence = Confluence( url="", username="", diff --git a/examples/jira/jira_admins_confluence_page.py b/examples/jira/jira_admins_confluence_page.py index 5703ad0d0..0232cf1ae 100644 --- a/examples/jira/jira_admins_confluence_page.py +++ b/examples/jira/jira_admins_confluence_page.py @@ -12,15 +12,13 @@ confluence = Confluence(url="http://localhost:8090", username="admin", password="admin") -html = [ - """ +html = ["""
- """ -] + """] for data in jira.project_leaders(): log.info("{project_key} leader is {lead_name} <{lead_email}>".format(**data)) diff --git a/examples/jira/jira_project_administrators.py b/examples/jira/jira_project_administrators.py index de3af90e8..a25b248dc 100644 --- a/examples/jira/jira_project_administrators.py +++ b/examples/jira/jira_project_administrators.py @@ -17,9 +17,7 @@ - """.format( - **data - ) + """.format(**data) html += "
Project Key Project Name Leader Email
{project_name} {lead_name} {lead_email}
" diff --git a/examples/jira/jira_project_leaders.py b/examples/jira/jira_project_leaders.py index 4fdff24a4..709fcc61c 100644 --- a/examples/jira/jira_project_leaders.py +++ b/examples/jira/jira_project_leaders.py @@ -7,8 +7,7 @@ jira = Jira(url="http://localhost:8080", username="admin", password="admin") EMAIL_SUBJECT = quote("Jira access to project {project_key}") -EMAIL_BODY = quote( - """I am asking for access to the {project_key} project in Jira. +EMAIL_BODY = quote("""I am asking for access to the {project_key} project in Jira. To give me the appropriate permissions, assign me to a role on the page: http://localhost:8080/plugins/servlet/project-config/{project_key}/roles @@ -16,8 +15,7 @@ Role: Users - read-only access + commenting Developers - work on tasks, editing, etc. -Admin - Change of configuration and the possibility of starting sprints""" -) +Admin - Change of configuration and the possibility of starting sprints""") MAILTO = '{lead_name}' diff --git a/tests/test_jira.py b/tests/test_jira.py index 1edeb0de3..64f7a4c73 100644 --- a/tests/test_jira.py +++ b/tests/test_jira.py @@ -1,5 +1,6 @@ # coding: utf8 """Tests for Jira Modules""" + from unittest import TestCase from atlassian import jira from .mockup import mockup_server diff --git a/tests/test_rest_client.py b/tests/test_rest_client.py index e91d0e81c..8df253d8c 100644 --- a/tests/test_rest_client.py +++ b/tests/test_rest_client.py @@ -421,6 +421,7 @@ def fake_sleep(delay): def test_retry_handler_skips_invalid_header(self, monkeypatch): """Ensure invalid Retry-After headers fall back to regular logic.""" + def fake_sleep(_): raise AssertionError("sleep should not be called for invalid header") From 9d45a5be96eeb5b7dd0042f9d1a11706f5ec7114 Mon Sep 17 00:00:00 2001 From: jerubball Date: Wed, 11 Mar 2026 17:16:23 -0400 Subject: [PATCH 2/2] fix issues with fmt: skip and multiline method signature --- atlassian/bamboo.py | 21 +++++++++++++++++++-- atlassian/bitbucket/__init__.py | 10 +++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/atlassian/bamboo.py b/atlassian/bamboo.py index 81dc3266a..0447dad32 100755 --- a/atlassian/bamboo.py +++ b/atlassian/bamboo.py @@ -62,7 +62,17 @@ def _get_generator( logging.error(f"Broken response: {response}") yield response - def base_list_call(self, resource, expand, favourite, clover_enabled, max_results, label=None, start_index=0, **kwargs): # fmt: skip + def base_list_call( + self, + resource, + expand, + favourite, + clover_enabled, + max_results, + label=None, + start_index=0, + **kwargs, + ): flags = [] params = {"max-results": max_results} if expand: @@ -612,7 +622,14 @@ def delete_build_result(self, build_key): params = {"buildKey": plan_key, "buildNumber": build_number} return self.post(custom_resource, params=params, headers=self.form_token_headers) - def execute_build(self, plan_key, stage=None, execute_all_stages=True, custom_revision=None, **bamboo_variables): # fmt: skip + def execute_build( + self, + plan_key, + stage=None, + execute_all_stages=True, + custom_revision=None, + **bamboo_variables, + ): """ Fire build execution for specified plan. !IMPORTANT! NOTE: for some reason, this method always execute all stages diff --git a/atlassian/bitbucket/__init__.py b/atlassian/bitbucket/__init__.py index 635285459..1a2be47e4 100644 --- a/atlassian/bitbucket/__init__.py +++ b/atlassian/bitbucket/__init__.py @@ -2568,7 +2568,15 @@ def delete_code_insights_report(self, project_key, repository_slug, commit_id, r url = self._url_code_insights_report(project_key, repository_slug, commit_id, report_key) return self.delete(url) - def create_code_insights_report(self, project_key, repository_slug, commit_id, report_key, report_title, **report_params): # fmt: skip + def create_code_insights_report( + self, + project_key, + repository_slug, + commit_id, + report_key, + report_title, + **report_params, + ): """ Create a new insight report, or replace the existing one if a report already exists for the given repository_slug, commit, and report key.