Skip to content

Commit 5a78ffa

Browse files
committed
style: lint after rebase
1 parent 331a412 commit 5a78ffa

15 files changed

+67
-74
lines changed

packages/gg_api_core/src/gg_api_core/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _init_urls(self, gitguardian_url: str | None = None):
129129

130130
def _init_personal_access_token(self, personal_access_token: str | None = None):
131131
"""Initialize authentication token based on transport mode.
132-
132+
133133
Authentication architecture:
134134
- stdio mode: OAuth (interactive) OR PAT from env var (non-interactive)
135135
- HTTP mode: Per-request Authorization header ONLY (multi-tenant capable)
@@ -958,7 +958,9 @@ async def get_incidents(self, incident_ids: list[str]) -> list[dict[str, Any]]:
958958

959959
return incidents
960960

961-
async def update_incident(self, incident_id: str, status: str | None = None, custom_tags: list | None = None) -> dict[str, Any]:
961+
async def update_incident(
962+
self, incident_id: str, status: str | None = None, custom_tags: list | None = None
963+
) -> dict[str, Any]:
962964
"""Update a secret incident.
963965
964966
Args:
@@ -1392,9 +1394,7 @@ async def update_incident_note(self, incident_id: str, note_id: str, content: st
13921394
Updated note details
13931395
"""
13941396
logger.info(f"Updating note {note_id} for incident {incident_id}")
1395-
return await self._request_patch(
1396-
f"/incidents/secrets/{incident_id}/notes/{note_id}", json={"content": content}
1397-
)
1397+
return await self._request_patch(f"/incidents/secrets/{incident_id}/notes/{note_id}", json={"content": content})
13981398

13991399
async def delete_incident_note(self, incident_id: str, note_id: str) -> dict[str, Any]:
14001400
"""Delete a note from a secret incident.

packages/gg_api_core/src/gg_api_core/mcp_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, *args, **kwargs):
4343
kwargs["lifespan"] = self._create_token_scope_lifespan(original_lifespan)
4444
# Call parent __init__ in the MRO chain
4545
super().__init__(*args, **kwargs)
46-
46+
4747
def clear_cache(self) -> None:
4848
"""Clear cached token information and scopes."""
4949
self._token_scopes = set()
@@ -106,8 +106,8 @@ def __init__(self, *args, default_scopes: list[str] | None = None, **kwargs):
106106
# Map each tool to its required scopes (instance attribute)
107107
self._tool_scopes: dict[str, set[str]] = {}
108108

109-
self.add_middleware(self._scope_filtering_middleware)
110-
109+
self.add_middleware(self._scope_filtering_middleware)
110+
111111
def clear_cache(self) -> None:
112112
"""Clear cached data. Override in subclasses that cache."""
113113
pass

packages/gg_api_core/src/gg_api_core/tools/assign_incident.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
from typing import Any
3-
from typing_extensions import cast
43

54
from fastmcp.exceptions import ToolError
65
from pydantic import BaseModel, Field, model_validator

packages/gg_api_core/src/gg_api_core/tools/find_current_source_id.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ async def find_current_source_id(repository_path: str = ".") -> FindCurrentSourc
123123
logger.info(f"Detected repository name: {repository_name} (method: {detection_method})")
124124

125125
# Search for the source in GitGuardian with robust non-exact matching
126-
source_result: dict[str, Any] | list[dict[str, Any]] | None = await client.get_source_by_name(repository_name, return_all_on_no_match=True)
126+
source_result: dict[str, Any] | list[dict[str, Any]] | None = await client.get_source_by_name(
127+
repository_name, return_all_on_no_match=True
128+
)
127129

128130
# Handle exact match (single dict result)
129131
if isinstance(source_result, dict):
@@ -194,7 +196,7 @@ async def find_current_source_id(repository_path: str = ".") -> FindCurrentSourc
194196
message = f"No exact match for '{repository_name}', but found {len(fallback_result)} potential matches using repo name '{repo_only}'."
195197
if detection_method == "directory name":
196198
message += f" (repository name inferred from {detection_method})"
197-
199+
198200
return FindCurrentSourceIdResult(
199201
repository_name=repository_name,
200202
message=message,
@@ -207,7 +209,8 @@ async def find_current_source_id(repository_path: str = ".") -> FindCurrentSourc
207209
monitored=source.get("monitored"),
208210
deleted_at=source.get("deleted_at"),
209211
)
210-
for source in fallback_result if source.get("id") is not None
212+
for source in fallback_result
213+
if source.get("id") is not None
211214
],
212215
)
213216

packages/gg_api_core/src/gg_api_core/tools/list_honeytokens.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import logging
32
from typing import Any
43

@@ -34,15 +33,17 @@ class ListHoneytokensResult(BaseModel):
3433
"""Result from listing honeytokens."""
3534

3635
honeytokens: list[dict[str, Any]] = Field(description="List of honeytoken objects")
37-
next_cursor: str | None = Field(default=None, description="Cursor for fetching the next page (null if no more results)")
36+
next_cursor: str | None = Field(
37+
default=None, description="Cursor for fetching the next page (null if no more results)"
38+
)
3839

3940

4041
async def list_honeytokens(params: ListHoneytokensParams) -> ListHoneytokensResult:
4142
"""
4243
List honeytokens from the GitGuardian dashboard with filtering options.
4344
44-
IMPORTANT: When the user asks for "my honeytokens", "my tokens", "honeytokens I created",
45-
"honeytokens created by me", or similar possessive/personal references, you MUST set mine=True
45+
IMPORTANT: When the user asks for "my honeytokens", "my tokens", "honeytokens I created",
46+
"honeytokens created by me", or similar possessive/personal references, you MUST set mine=True
4647
to filter to only the current user's honeytokens.
4748
4849
Args:
@@ -75,7 +76,6 @@ async def list_honeytokens(params: ListHoneytokensParams) -> ListHoneytokensResu
7576
except Exception as e:
7677
logger.warning(f"Failed to get current user info for 'mine' filter: {str(e)}")
7778

78-
7979
try:
8080
response = await client.list_honeytokens(
8181
status=params.status,
@@ -91,7 +91,7 @@ async def list_honeytokens(params: ListHoneytokensParams) -> ListHoneytokensResu
9191

9292
honeytokens_data = response["data"]
9393
next_cursor = response["cursor"]
94-
94+
9595
logger.debug(f"Found {len(honeytokens_data)} honeytokens")
9696
return ListHoneytokensResult(honeytokens=honeytokens_data, next_cursor=next_cursor)
9797
except Exception as e:

packages/gg_api_core/src/gg_api_core/tools/list_incidents.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,21 @@ class ListIncidentsParams(BaseModel):
121121
exclude_tags: list[str | TagNames] | None = Field(
122122
default=cast(list[str | TagNames], DEFAULT_EXCLUDED_TAGS), description="Exclude incidents with these tag names."
123123
)
124-
status: list[str | IncidentStatus] | None = Field(default=cast(list[str | IncidentStatus], DEFAULT_STATUSES), description="Filter by status (list of status names)")
124+
status: list[str | IncidentStatus] | None = Field(
125+
default=cast(list[str | IncidentStatus], DEFAULT_STATUSES),
126+
description="Filter by status (list of status names)",
127+
)
125128
mine: bool = Field(
126129
default=False,
127130
description="If True, fetch only incidents assigned to the current user. Set to False to get all incidents.",
128131
)
129132
severity: list[str | IncidentSeverity] | None = Field(
130-
default=cast(list[str | IncidentSeverity], DEFAULT_SEVERITIES), description="Filter by severity (list of severity names)"
133+
default=cast(list[str | IncidentSeverity], DEFAULT_SEVERITIES),
134+
description="Filter by severity (list of severity names)",
131135
)
132136
validity: list[str | IncidentValidity] | None = Field(
133-
default=cast(list[str | IncidentValidity], DEFAULT_VALIDITIES), description="Filter by validity (list of validity names)"
137+
default=cast(list[str | IncidentValidity], DEFAULT_VALIDITIES),
138+
description="Filter by validity (list of validity names)",
134139
)
135140

136141

@@ -220,7 +225,7 @@ async def list_incidents(params: ListIncidentsParams) -> ListIncidentsResult | L
220225
response = await client.list_incidents(**api_params)
221226
incidents_data = response["data"]
222227
next_cursor = response["cursor"]
223-
228+
224229
count = len(incidents_data)
225230
return ListIncidentsResult(
226231
source_id=params.source_id,

packages/gg_api_core/src/gg_api_core/tools/list_repo_occurrences.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ class ListRepoOccurrencesFilters(BaseModel):
4949
default=DEFAULT_EXCLUDED_TAGS,
5050
description="Exclude occurrences with these tag names. Pass empty list to disable filtering.",
5151
)
52-
status: list[IncidentStatus] | None = Field(default=DEFAULT_STATUSES, description="Filter by status (list of status names)")
52+
status: list[IncidentStatus] | None = Field(
53+
default=DEFAULT_STATUSES, description="Filter by status (list of status names)"
54+
)
5355
severity: list[IncidentSeverity] | None = Field(
5456
default=DEFAULT_SEVERITIES, description="Filter by severity (list of severity names)"
5557
)
@@ -246,7 +248,7 @@ async def list_repo_occurrences(
246248
occurrences_data = result["data"]
247249
next_cursor = result["cursor"]
248250
has_more = result["has_more"]
249-
251+
250252
count = len(occurrences_data)
251253
return ListRepoOccurrencesResult(
252254
repository=params.repository_name,

packages/gg_api_core/src/gg_api_core/tools/list_users.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import logging
33
from typing import Any
44

5-
from fastmcp.exceptions import ToolError
65
from pydantic import BaseModel, Field
76

87
from gg_api_core.utils import get_client
@@ -90,6 +89,4 @@ async def list_users(params: ListUsersParams) -> ListUsersResult:
9089
# Single page request
9190
result = await client.list_members(params=query_params)
9291
logger.debug(f"Found {len(result['data'])} members")
93-
return ListUsersResult(
94-
members=result["data"], total_count=len(result["data"]), next_cursor=result["cursor"]
95-
)
92+
return ListUsersResult(members=result["data"], total_count=len(result["data"]), next_cursor=result["cursor"])

packages/gg_api_core/src/gg_api_core/tools/remediate_secret_incidents.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,8 @@ async def remediate_secret_incidents(
107107
try:
108108
# Use the list_repo_occurrences_params and update with parent-level repository info
109109
if params.list_repo_occurrences_params is None:
110-
return RemediateSecretIncidentsError(
111-
error="list_repo_occurrences_params is required", sub_tools_results={}
112-
)
113-
110+
return RemediateSecretIncidentsError(error="list_repo_occurrences_params is required", sub_tools_results={})
111+
114112
occurrences_params = params.list_repo_occurrences_params.model_copy(
115113
update={
116114
"repository_name": params.repository_name or params.list_repo_occurrences_params.repository_name,

packages/gg_api_core/src/gg_api_core/tools/write_custom_tags.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ class WriteCustomTagsParams(BaseModel):
2828
async def write_custom_tags(params: WriteCustomTagsParams):
2929
"""
3030
Create or delete custom tags in the GitGuardian dashboard.
31-
31+
3232
For creating tags, use the "key" or "key:value" format:
3333
- "env" creates a label without a value
3434
- "env:prod" creates a label with key="env" and value="prod"
35-
35+
3636
For deleting tags:
3737
1. First call read_custom_tags to list all available tags and get their IDs
3838
2. Then call this function with action="delete_tag" and the specific tag_id
@@ -89,11 +89,11 @@ class UpdateOrCreateIncidentCustomTagsParams(BaseModel):
8989
async def update_or_create_incident_custom_tags(params: UpdateOrCreateIncidentCustomTagsParams) -> dict[str, Any]:
9090
"""
9191
Update a secret incident with custom tags, creating tags if they don't exist.
92-
92+
9393
Custom tags can be in two formats:
9494
- "key" (creates a label without a value)
9595
- "key:value" (creates a label with a value)
96-
96+
9797
Args:
9898
params: UpdateOrCreateIncidentCustomTagsParams model containing custom tags configuration
9999
@@ -114,18 +114,18 @@ async def update_or_create_incident_custom_tags(params: UpdateOrCreateIncidentCu
114114
# Tag is just a key with no value
115115
key = tag
116116
value = None
117-
117+
118118
# Create the tag if it doesn't exist
119119
try:
120120
await client.create_custom_tag(key, value)
121121
logger.debug(f"Created custom tag: {key}={value}")
122122
except Exception as e:
123123
# Tag might already exist, which is fine
124124
logger.debug(f"Tag {key}={value} may already exist: {str(e)}")
125-
125+
126126
# Add to parsed tags list in the format expected by update_incident
127127
parsed_tags.append({"key": key, "value": value})
128-
128+
129129
# Update the incident with the custom tags
130130
result = await client.update_incident(
131131
incident_id=str(params.incident_id),

0 commit comments

Comments
 (0)