Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
25a9830
adding type hints
bandophahita Jun 6, 2024
e577032
avoiding errors about override signature
bandophahita Jun 11, 2024
ca83b63
adding various types packages to requirements-dev.txt
bandophahita Jun 11, 2024
36cb481
adding type hints
bandophahita Jun 11, 2024
28fec8b
using alias for json response type
bandophahita Jun 11, 2024
d845adf
allowing test action to be run manually to help troubleshoot failures
bandophahita Jun 12, 2024
1d40c4a
cannot utilize the workflow_dispatch on branches until it's been merg…
bandophahita Jun 12, 2024
e26d59a
black formatting is different in 3.7
bandophahita Jun 12, 2024
dc07f73
urllib3 is imported directly, thus should be in the reqs
bandophahita Jun 12, 2024
063fb5d
cannot use new style annotations with older versions of python
bandophahita Jun 12, 2024
3715902
future annotations aren't available in 3.6
bandophahita Jun 12, 2024
d1db0f6
looks like bandit is not able to be installed in python3.6
bandophahita Jun 12, 2024
93bf877
ignoring the list return vs the typical dictionary
bandophahita Jun 12, 2024
95b20cb
avoiding black formatter inconsistencies between 23.3 and 24.x
bandophahita Jun 12, 2024
43822f0
minor cleanup after rebase
bandophahita Mar 25, 2025
7fa1d9d
enforcing flake8 TC006 rule
bandophahita Mar 25, 2025
be5563c
fixing black formatting
bandophahita Mar 25, 2025
16f5609
mypy fixes
bandophahita Mar 25, 2025
ab4cc74
adding types-jmespath to requirements-dev.txt
bandophahita Mar 25, 2025
4fce803
adding types-oauthlib to reqs dev
bandophahita Mar 25, 2025
d97000d
mypy fixes - incompatible return types
bandophahita Mar 25, 2025
7d2cff6
rebased from master and updated missing annotations for arguments
bandophahita Mar 25, 2025
a5b6151
adjust for mypy
gonchik Mar 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions atlassian/bitbucket/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# coding=utf-8
import logging
from enum import Enum
from typing import Optional

from deprecated import deprecated
from requests import HTTPError

from .base import BitbucketBase
from atlassian.bitbucket.cloud import Cloud

from .base import BitbucketBase

log = logging.getLogger(__name__)


Expand Down Expand Up @@ -1891,7 +1893,7 @@ def get_pull_requests_participants(

def assign_pull_request_participant_role(
self, project_key: str, repository_slug: str, pull_request_id: int, role: str, user: str
) -> dict:
) -> Optional[dict]:
"""
Assign a role to a user for a pull request
:param project_key: The project key
Expand Down Expand Up @@ -2117,7 +2119,9 @@ def add_pull_request_blocker_comment(
data = {"text": text, "severity": severity}
return self.post(url, data=data)

def search_pull_request_blocker_comment(self, project_key: str, repository_slug: str, pull_request_id: int) -> dict:
def search_pull_request_blocker_comment(
self, project_key: str, repository_slug: str, pull_request_id: int
) -> Optional[dict]:
"""
Get all comments that block the merge of a pull request
:param project_key: The project key
Expand Down
5 changes: 2 additions & 3 deletions atlassian/bitbucket/cloud/repositories/repositoryVariables.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# coding=utf-8

from ..base import BitbucketCloudBase


class RepositoryVariables(BitbucketCloudBase):
def __init__(self, url, *args, **kwargs):
super(RepositoryVariables, self).__init__(url, *args, **kwargs)

def __get_object(self, data):
def __get_object(self, data) -> "RepositoryVariable":
return RepositoryVariable(
self.url_joiner(self.url, data["uuid"]),
data,
Expand Down Expand Up @@ -61,7 +60,7 @@ def each(self, q=None, sort=None):

return

def get(self, uuid):
def get(self, uuid: str): # type: ignore[override]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature for get in AtlassianRestAPI doesn't match here. So we need to override.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"""
Returns the pipeline with the uuid in this repository.

Expand Down
24 changes: 13 additions & 11 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import os
import re
import time
from typing import cast

import requests
from bs4 import BeautifulSoup
from deprecated import deprecated
import requests
from requests import HTTPError

from atlassian import utils

from .errors import (
ApiConflictError,
ApiError,
Expand Down Expand Up @@ -1644,7 +1646,7 @@

return response

def remove_page_label(self, page_id, label):
def remove_page_label(self, page_id: str, label: str):
"""
Delete Confluence page label
:param page_id: content_id format
Expand Down Expand Up @@ -2740,13 +2742,13 @@
:return: The URL to download the exported file.
"""

def get_atl_request(url: str):
def get_atl_request(link: str):

Check warning on line 2745 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L2745

Added line #L2745 was not covered by tests
# Nested function used to get atl_token used for XSRF protection.
# This is only applicable to html/csv/xml space exports
try:
response = self.get(url, advanced_mode=True)
response = self.get(link, advanced_mode=True)

Check warning on line 2749 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L2749

Added line #L2749 was not covered by tests
parsed_html = BeautifulSoup(response.text, "html.parser")
atl_token = parsed_html.find("input", {"name": "atl_token"}).get("value")
atl_token = parsed_html.find("input", {"name": "atl_token"}).get("value") # type: ignore[union-attr]

Check warning on line 2751 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L2751

Added line #L2751 was not covered by tests
return atl_token
except Exception as e:
raise ApiError("Problems with getting the atl_token for get_space_export method :", reason=e)
Expand Down Expand Up @@ -2798,17 +2800,17 @@
parsed_html = BeautifulSoup(response.text, "html.parser")
# Getting the poll URL to get the export progress status
try:
poll_url = parsed_html.find("meta", {"name": "ajs-pollURI"}).get("content")
poll_url = cast("str", parsed_html.find("meta", {"name": "ajs-pollURI"}).get("content")) # type: ignore[union-attr]

Check warning on line 2803 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L2803

Added line #L2803 was not covered by tests
except Exception as e:
raise ApiError("Problems with getting the poll_url for get_space_export method :", reason=e)
running_task = True
while running_task:
try:
progress_response = self.get(poll_url)
log.info("Space" + space_key + " export status: " + progress_response["message"])
if progress_response["complete"]:
parsed_html = BeautifulSoup(progress_response["message"], "html.parser")
download_url = parsed_html.find("a", {"class": "space-export-download-path"}).get("href")
progress_response = self.get(poll_url) or {}
log.info(f"Space {space_key} export status: {progress_response.get('message', 'None')}")

Check warning on line 2810 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L2809-L2810

Added lines #L2809 - L2810 were not covered by tests
if progress_response is not {} and progress_response.get("complete"):
parsed_html = BeautifulSoup(progress_response.get("message"), "html.parser")
download_url = cast("str", parsed_html.find("a", {"class": "space-export-download-path"}).get("href")) # type: ignore

Check warning on line 2813 in atlassian/confluence.py

View check run for this annotation

Codecov / codecov/patch

atlassian/confluence.py#L2812-L2813

Added lines #L2812 - L2813 were not covered by tests
if self.url in download_url:
return download_url
else:
Expand Down
Loading