Skip to content

Commit c258ed1

Browse files
Remove syntax incompatible with python 2 (#1374)
* Remove syntax incompatible with python 2 * Add py27 as one of black's target versions --------- Co-authored-by: Gonchik Tsymzhitov <[email protected]>
1 parent ecf109f commit c258ed1

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

atlassian/confluence.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,9 +1468,8 @@ def download_attachments_from_page(self, page_id, path=None, start=0, limit=50,
14681468
for attachment in attachments:
14691469
file_name = attachment["title"] or attachment["id"] # Use attachment ID if title is unavailable
14701470
download_link = self.url + attachment["_links"]["download"]
1471-
14721471
# Fetch the file content
1473-
response = self._session.get(download_link)
1472+
response = self._session.get(str(download_link))
14741473
response.raise_for_status() # Raise error if request fails
14751474

14761475
if to_memory:
@@ -1488,7 +1487,6 @@ def download_attachments_from_page(self, page_id, path=None, start=0, limit=50,
14881487
return downloaded_files
14891488
else:
14901489
return {"attachments_downloaded": len(attachments), "path": path}
1491-
14921490
except NotADirectoryError:
14931491
raise FileNotFoundError("The directory '{path}' does not exist.".format(path=path))
14941492
except PermissionError:

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 + "/secure/issueAttachments/%s.zip" % (issue_id)
258+
url = self.url + "/secure/issueAttachments/{}.zip".format(issue_id)
259259
else:
260-
url = self.url + "/secure/attachmentzip/%s.zip" % (issue_id)
260+
url = self.url + "/secure/attachmentzip/{}.zip".format(issue_id)
261261
response = self._session.get(url)
262-
attachment_name = "%s_attachments.zip" % (issue_id)
262+
attachment_name = "{}_attachments.zip".format(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))

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ commands = pylint {[base]linting_targets}
3535

3636
[testenv:black]
3737
basepython = python3
38-
target-version = ["py37"]
38+
target-version = ["py27", "py37"]
3939
skip_install = true
4040
deps = black
4141
commands = black --check --diff {[base]linting_targets} --exclude __pycache__

0 commit comments

Comments
 (0)