Skip to content

Commit 9f4d338

Browse files
authored
python2 removal (#1515)
* python2 removal
1 parent 1e92d70 commit 9f4d338

File tree

95 files changed

+966
-1074
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+966
-1074
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
python-version: [ '3.6', '3.7', '3.8', '3.9', '3.11', '3.12', '3.13' ]
21+
python-version: [ '3.9', '3.11', '3.12', '3.13' ]
2222

2323
steps:
2424
- uses: actions/checkout@v4

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version: 2
88
build:
99
os: ubuntu-lts-latest
1010
tools:
11-
python: "3.8"
11+
python: "3.9"
1212

1313
# Build documentation in the docs/ directory with Sphinx
1414
sphinx:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Run `make` or `make help` to see a list of tasks.
33
# Based on GCOVR project (https://github.com/gcovr/gcovr).
44

5-
PYTHON_VERSION ?= 3.7
5+
PYTHON_VERSION ?= 3.9
66

77
ATLASSIAN_SDK ?= atlassian-sdk
88
QA_CONTAINER ?= atlassian-python-api-qa-$(PYTHON_VERSION)

atlassian/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.41.21
1+
4.0.0

atlassian/bamboo.py

Lines changed: 72 additions & 71 deletions
Large diffs are not rendered by default.

atlassian/bitbucket/__init__.py

Lines changed: 78 additions & 105 deletions
Large diffs are not rendered by default.

atlassian/bitbucket/cloud/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ def __init__(self, url="https://api.bitbucket.org/", *args, **kwargs):
1010
kwargs["cloud"] = True
1111
kwargs["api_root"] = None
1212
kwargs["api_version"] = "2.0"
13-
url = url.strip("/") + "/{}".format(kwargs["api_version"])
13+
url = url.strip("/") + f"/{kwargs['api_version']}"
1414
super(Cloud, self).__init__(url, *args, **kwargs)
15-
self.__workspaces = Workspaces("{}/workspaces".format(self.url), **self._new_session_args)
16-
self.__repositories = Repositories("{}/repositories".format(self.url), **self._new_session_args)
15+
self.__workspaces = Workspaces(f"{self.url}/workspaces", **self._new_session_args)
16+
self.__repositories = Repositories(f"{self.url}/repositories", **self._new_session_args)
1717

1818
@property
1919
def workspaces(self):

atlassian/bitbucket/cloud/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, url, *args, **kwargs):
2222
expected_type = kwargs.pop("expected_type", None)
2323
super(BitbucketCloudBase, self).__init__(url, *args, **kwargs)
2424
if expected_type is not None and not expected_type == self.get_data("type"):
25-
raise ValueError("Expected type of data is [{}], got [{}].".format(expected_type, self.get_data("type")))
25+
raise ValueError(f"Expected type of data is [{expected_type}], got [{self.get_data('type')}].")
2626

2727
def get_link(self, link):
2828
"""
@@ -115,7 +115,7 @@ def raise_for_status(self, response):
115115
if e.get("detail"):
116116
# It uses interpolation instead of concatenation because of
117117
# https://github.com/atlassian-api/atlassian-python-api/issues/1481
118-
error_msg = "{}\n{}".format(error_msg, str(e["detail"]))
118+
error_msg = f"{error_msg}\n{str(e['detail'])}"
119119
except Exception as e:
120120
log.error(e)
121121
response.raise_for_status()

atlassian/bitbucket/cloud/common/builds.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def refname(self):
8080
def update(self, **kwargs):
8181
"""Update build status.
8282
83-
See https://developer.atlassian.com/cloud/bitbucket/rest/api-group-commit-statuses/#api-repositories-workspace-repo-slug-commit-commit-statuses-build-key-put
83+
See
84+
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-commit-statuses/#api-repositories-workspace-repo-slug-commit-commit-statuses-build-key-put
8485
"""
8586
return self._update_data(self.put(None, data=kwargs))

atlassian/bitbucket/cloud/repositories/__init__.py

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def get(self, workspace, repo_slug):
8787
API docs:
8888
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-get
8989
"""
90-
return self._get_object(super(Repositories, self).get("{}/{}".format(workspace, repo_slug)))
90+
return self._get_object(super(Repositories, self).get(f"{workspace}/{repo_slug}"))
9191

9292

9393
class WorkspaceRepositories(RepositoriesBase):
@@ -127,7 +127,7 @@ def create(self, repo_slug, project_key=None, is_private=None, fork_policy=None)
127127
data["is_private"] = is_private
128128
if fork_policy is not None:
129129
if fork_policy not in self.FORK_POLICIES:
130-
raise ValueError("fork_policy must be one of {}".format(self.FORK_POLICIES))
130+
raise ValueError(f"fork_policy must be one of {self.FORK_POLICIES}")
131131
data["fork_policy"] = fork_policy
132132
return self._get_object(self.post(repo_slug, data=data))
133133

@@ -179,9 +179,9 @@ def get(self, repository, by="slug"):
179179
if r.name == repository:
180180
return r
181181
else:
182-
ValueError("Unknown value '{}' for argument [by], expected 'key' or 'name'".format(by))
182+
ValueError(f"Unknown value '{by}' for argument [by], expected 'key' or 'name'")
183183

184-
raise Exception("Unknown repository {} '{}'".format(by, repository))
184+
raise Exception(f"Unknown repository {by} '{repository}'")
185185

186186
def exists(self, repository, by="slug"):
187187
"""
@@ -203,7 +203,7 @@ def exists(self, repository, by="slug"):
203203
if e.response.status_code in (401, 404):
204204
pass
205205
except Exception as e:
206-
if not str(e) == "Unknown project {} '{}'".format(by, repository):
206+
if not str(e) == f"Unknown project {by} '{repository}'":
207207
raise e
208208
return exists
209209

@@ -243,46 +243,40 @@ def get(self, repository, by="slug"):
243243
https://developer.atlassian.com/bitbucket/api/2/reference/resource/workspaces/%7Bworkspace%7D/projects/%7Bproject_key%7D#get
244244
"""
245245
if by not in ("slug", "name"):
246-
ValueError("Unknown value '{}' for argument [by], expected 'slug' or 'name'".format(by))
246+
ValueError(f"Unknown value '{by}' for argument [by], expected 'slug' or 'name'")
247247

248248
for r in self.each():
249249
if ((by == "slug") and (r.slug == repository)) or ((by == "name") and (r.name == repository)):
250250
return r
251251

252-
raise Exception("Unknown repository {} '{}'".format(by, repository))
252+
raise Exception(f"Unknown repository {by} '{repository}'")
253253

254254

255255
class Repository(BitbucketCloudBase):
256256
def __init__(self, data, *args, **kwargs):
257257
super(Repository, self).__init__(None, *args, data=data, expected_type="repository", **kwargs)
258-
self.__branch_restrictions = BranchRestrictions(
259-
"{}/branch-restrictions".format(self.url), **self._new_session_args
260-
)
261-
self.__branches = Branches("{}/refs/branches".format(self.url), **self._new_session_args)
258+
self.__branch_restrictions = BranchRestrictions(f"{self.url}/branch-restrictions", **self._new_session_args)
259+
self.__branches = Branches(f"{self.url}/refs/branches", **self._new_session_args)
262260
self.__commits = Commits(
263-
"{}/commits".format(self.url),
264-
data={"links": {"commit": {"href": "{}/commit".format(self.url)}}},
261+
f"{self.url}/commits",
262+
data={"links": {"commit": {"href": f"{self.url}/commit"}}},
265263
**self._new_session_args
266264
) # fmt: skip
267265
self.__hooks = Hooks(
268-
"{}/hooks".format(self.url),
269-
data={"links": {"hooks": {"href": "{}/hooks".format(self.url)}}},
266+
f"{self.url}/hooks",
267+
data={"links": {"hooks": {"href": f"{self.url}/hooks"}}},
270268
**self._new_session_args
271269
) # fmt: skip
272-
self.__default_reviewers = DefaultReviewers("{}/default-reviewers".format(self.url), **self._new_session_args)
273-
self.__deployment_environments = DeploymentEnvironments(
274-
"{}/environments".format(self.url), **self._new_session_args
275-
)
276-
self.__group_permissions = GroupPermissions(
277-
"{}/permissions-config/groups".format(self.url), **self._new_session_args
278-
)
279-
self.__issues = Issues("{}/issues".format(self.url), **self._new_session_args)
280-
self.__pipelines = Pipelines("{}/pipelines".format(self.url), **self._new_session_args)
281-
self.__pullrequests = PullRequests("{}/pullrequests".format(self.url), **self._new_session_args)
270+
self.__default_reviewers = DefaultReviewers(f"{self.url}/default-reviewers", **self._new_session_args)
271+
self.__deployment_environments = DeploymentEnvironments(f"{self.url}/environments", **self._new_session_args)
272+
self.__group_permissions = GroupPermissions(f"{self.url}/permissions-config/groups", **self._new_session_args)
273+
self.__issues = Issues(f"{self.url}/issues", **self._new_session_args)
274+
self.__pipelines = Pipelines(f"{self.url}/pipelines", **self._new_session_args)
275+
self.__pullrequests = PullRequests(f"{self.url}/pullrequests", **self._new_session_args)
282276
self.__repository_variables = RepositoryVariables(
283-
"{}/pipelines_config/variables".format(self.url), **self._new_session_args
277+
f"{self.url}/pipelines_config/variables", **self._new_session_args
284278
)
285-
self.__tags = Tags("{}/refs/tags".format(self.url), **self._new_session_args)
279+
self.__tags = Tags(f"{self.url}/refs/tags", **self._new_session_args)
286280

287281
def update(self, **kwargs):
288282
"""

0 commit comments

Comments
 (0)