Skip to content

Commit adb7cc3

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent bb36a84 commit adb7cc3

File tree

7 files changed

+28
-25
lines changed

7 files changed

+28
-25
lines changed

api/integrations/github/github.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,10 @@
66
from django.db.models import Q
77
from django.utils.formats import get_format
88

9-
from core.helpers import get_current_site_url
109
from features.models import Feature, FeatureState, FeatureStateValue
1110
from integrations.github.constants import (
12-
DELETED_FEATURE_TEXT,
13-
DELETED_SEGMENT_OVERRIDE_TEXT,
14-
FEATURE_ENVIRONMENT_URL,
15-
FEATURE_TABLE_HEADER,
16-
FEATURE_TABLE_ROW,
1711
GITHUB_TAG_COLOR,
18-
LINK_FEATURE_TITLE,
19-
LINK_SEGMENT_TITLE,
2012
UNLINKED_FEATURE_TEXT,
21-
UPDATED_FEATURE_TEXT,
2213
GitHubEventType,
2314
GitHubTag,
2415
github_tag_description,

api/integrations/gitlab/client.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ def fetch_gitlab_projects(
6161
response = requests.get(
6262
url,
6363
headers=_build_request_headers(access_token),
64-
params={"membership": "true", "per_page": str(params.page_size), "page": str(params.page)},
64+
params={
65+
"membership": "true",
66+
"per_page": str(params.page_size),
67+
"page": str(params.page),
68+
},
6569
timeout=GITLAB_API_CALLS_TIMEOUT,
6670
)
6771
response.raise_for_status()
@@ -86,9 +90,7 @@ def fetch_search_gitlab_resource(
8690
params: IssueQueryParams,
8791
) -> PaginatedResponse:
8892
"""Search issues or merge requests in a GitLab project."""
89-
url = (
90-
f"{instance_url}/api/v4/projects/{params.gitlab_project_id}/{resource_type}"
91-
)
93+
url = f"{instance_url}/api/v4/projects/{params.gitlab_project_id}/{resource_type}"
9294
query_params: dict[str, str | int] = {
9395
"per_page": params.page_size,
9496
"page": params.page,
@@ -238,7 +240,9 @@ def create_flagsmith_flag_label(
238240
timeout=GITLAB_API_CALLS_TIMEOUT,
239241
)
240242
if response.status_code == 409:
241-
logger.info("Flagsmith Flag label already exists on project %s", gitlab_project_id)
243+
logger.info(
244+
"Flagsmith Flag label already exists on project %s", gitlab_project_id
245+
)
242246
return None
243247

244248
response.raise_for_status()

api/integrations/gitlab/mappers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ def map_feature_states_to_dicts(
2929
env_data["last_updated"] = feature_state.updated_at.strftime(
3030
get_format("DATETIME_INPUT_FORMATS")[0]
3131
)
32-
env_data["environment_api_key"] = (
33-
feature_state.environment.api_key # type: ignore[union-attr]
34-
)
32+
env_data["environment_api_key"] = feature_state.environment.api_key # type: ignore[union-attr]
3533

3634
if (
3735
hasattr(feature_state, "feature_segment")

api/integrations/gitlab/services.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ def dispatch_gitlab_comment(
153153
"feature_name": feature.name,
154154
"event_type": event_type,
155155
"feature_states": feature_states_data,
156-
"url": url if event_type == GitLabEventType.FEATURE_EXTERNAL_RESOURCE_REMOVED.value else None,
156+
"url": url
157+
if event_type == GitLabEventType.FEATURE_EXTERNAL_RESOURCE_REMOVED.value
158+
else None,
157159
"segment_name": segment_name,
158160
},
159161
)

api/integrations/gitlab/tasks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
UNLINKED_FEATURE_TEXT = "**The feature flag `%s` was unlinked from the issue/MR**"
1515

1616

17-
def _parse_resource_url(resource_url: str) -> tuple[str, GitLabResourceEndpoint, int] | None:
17+
def _parse_resource_url(
18+
resource_url: str,
19+
) -> tuple[str, GitLabResourceEndpoint, int] | None:
1820
"""Parse a GitLab resource URL into (project_path, resource_type, iid).
1921
2022
Returns None if the URL format is not recognised.
@@ -69,9 +71,7 @@ def post_gitlab_comment(
6971
deleted_at__isnull=True,
7072
)
7173
except GitLabConfiguration.DoesNotExist:
72-
logger.warning(
73-
"No GitLabConfiguration found for project_id=%s", project_id
74-
)
74+
logger.warning("No GitLabConfiguration found for project_id=%s", project_id)
7575
return
7676

7777
if not gitlab_config.gitlab_project_id:

api/tests/unit/integrations/gitlab/test_unit_gitlab_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ def test_create_gitlab_issue__valid_data__creates_issue() -> None:
268268

269269

270270
@responses.activate
271-
def test_get_gitlab_resource_metadata__valid_resource__returns_title_and_state() -> None:
271+
def test_get_gitlab_resource_metadata__valid_resource__returns_title_and_state() -> (
272+
None
273+
):
272274
# Given
273275
responses.add(
274276
responses.GET,

api/tests/unit/integrations/gitlab/test_unit_gitlab_services.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ def test_gitlab_webhook__invalid_token__returns_400(
9999
url,
100100
data="{}",
101101
content_type="application/json",
102-
**{"HTTP_X_GITLAB_TOKEN": "wrong-secret", "HTTP_X_GITLAB_EVENT": "Merge Request Hook"}, # type: ignore[arg-type]
102+
**{
103+
"HTTP_X_GITLAB_TOKEN": "wrong-secret",
104+
"HTTP_X_GITLAB_EVENT": "Merge Request Hook",
105+
}, # type: ignore[arg-type]
103106
)
104107

105108
# Then
@@ -120,7 +123,10 @@ def test_gitlab_webhook__missing_config__returns_404(
120123
url,
121124
data="{}",
122125
content_type="application/json",
123-
**{"HTTP_X_GITLAB_TOKEN": "some-secret", "HTTP_X_GITLAB_EVENT": "Merge Request Hook"}, # type: ignore[arg-type]
126+
**{
127+
"HTTP_X_GITLAB_TOKEN": "some-secret",
128+
"HTTP_X_GITLAB_EVENT": "Merge Request Hook",
129+
}, # type: ignore[arg-type]
124130
)
125131

126132
# Then

0 commit comments

Comments
 (0)