Skip to content

Commit c5f02a3

Browse files
committed
Continue to support Python 2
Avoid Python 3-only capabilities: - Remove f-strings (jira.py, confluence.py) - Remove type specifications (bitbucket) - Remove trailing commas (bitbucket)
1 parent 7379193 commit c5f02a3

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

atlassian/bitbucket/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,13 +2208,13 @@ def is_pull_request_can_be_merged(self, project_key, repository_slug, pr_id):
22082208

22092209
def merge_pull_request(
22102210
self,
2211-
project_key: str,
2212-
repository_slug: str,
2213-
pr_id: int,
2214-
merge_message: str,
2215-
close_source_branch: bool = False,
2216-
merge_strategy: Union[str, MergeStrategy] = MergeStrategy.MERGE_COMMIT,
2217-
pr_version: Optional[int] = None,
2211+
project_key,
2212+
repository_slug,
2213+
pr_id,
2214+
merge_message,
2215+
close_source_branch=False,
2216+
merge_strategy=MergeStrategy.MERGE_COMMIT,
2217+
pr_version=None,
22182218
):
22192219
"""
22202220
Merge pull request

atlassian/bitbucket/cloud/repositories/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ def __init__(self, data, *args, **kwargs):
263263
self.__hooks = Hooks(
264264
"{}/hooks".format(self.url),
265265
data={"links": {"hooks": {"href": "{}/hooks".format(self.url)}}},
266-
**self._new_session_args,
267-
)
266+
**self._new_session_args
267+
) # fmt: skip
268268
self.__default_reviewers = DefaultReviewers("{}/default-reviewers".format(self.url), **self._new_session_args)
269269
self.__deployment_environments = DeploymentEnvironments(
270270
"{}/environments".format(self.url), **self._new_session_args

atlassian/confluence.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,7 @@ def download_attachments_from_page(self, page_id, path=None, start=0, limit=50):
13401340
if not file_name:
13411341
file_name = attachment["id"] # if the attachment has no title, use attachment_id as a filename
13421342
download_link = self.url + attachment["_links"]["download"]
1343-
r = self._session.get(f"{download_link}")
1343+
r = self._session.get(download_link)
13441344
file_path = os.path.join(path, file_name)
13451345
with open(file_path, "wb") as f:
13461346
f.write(r.content)
@@ -2922,7 +2922,7 @@ def create_whiteboard(self, spaceId, title=None, parentId=None):
29222922

29232923
def get_whiteboard(self, whiteboard_id):
29242924
try:
2925-
url = f"/api/v2/whiteboards/{whiteboard_id}"
2925+
url = "/api/v2/whiteboards/%s" % (whiteboard_id)
29262926
return self.get(url)
29272927
except HTTPError as e:
29282928
# Default 404 error handling is ambiguous
@@ -2935,7 +2935,7 @@ def get_whiteboard(self, whiteboard_id):
29352935

29362936
def delete_whiteboard(self, whiteboard_id):
29372937
try:
2938-
url = f"/api/v2/whiteboards/{whiteboard_id}"
2938+
url = "/api/v2/whiteboards/%s" % (whiteboard_id)
29392939
return self.delete(url)
29402940
except HTTPError as e:
29412941
# # Default 404 error handling is ambiguous
@@ -3071,7 +3071,7 @@ def add_user_to_group(self, username, group_name):
30713071
:param group_name: str - name of group to add user to
30723072
:return: Current state of the group
30733073
"""
3074-
url = f"rest/api/user/{username}/group/{group_name}"
3074+
url = "rest/api/user/%s/group/%s" % (username, group_name)
30753075
return self.put(url)
30763076

30773077
def add_space_permissions(

atlassian/jira.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ def download_attachments_from_issue(self, issue, path=None, cloud=True):
255255
path = os.getcwd()
256256
issue_id = self.issue(issue, fields="id")["id"]
257257
if cloud:
258-
url = self.url + f"/secure/issueAttachments/{issue_id}.zip"
258+
url = self.url + "/secure/issueAttachments/%s.zip" % (issue_id)
259259
else:
260-
url = self.url + f"/secure/attachmentzip/{issue_id}.zip"
260+
url = self.url + "/secure/attachmentzip/%s.zip" % (issue_id)
261261
response = self._session.get(url)
262-
attachment_name = f"{issue_id}_attachments.zip"
262+
attachment_name = "%s_attachments.zip" % (issue_id)
263263
file_path = os.path.join(path, attachment_name)
264264
# if Jira issue doesn't have any attachments _session.get request response will return 22 bytes of PKzip format
265265
file_size = sum(len(chunk) for chunk in response.iter_content(8196))

0 commit comments

Comments
 (0)