Skip to content

Commit 930060e

Browse files
Michael Christensenim-michaelc
authored andcommitted
chore: apply pre-commit fixes (EOF, trailing whitespace)
1 parent 2742b4b commit 930060e

File tree

15 files changed

+160
-220
lines changed

15 files changed

+160
-220
lines changed

src/amazon-keyspaces-mcp-server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Edit the Kiro configuration file at `~/.kiro/settings/mcp.json`:
146146
"autoApprove" : []
147147
}
148148
}
149-
149+
150150
}
151151
```
152152

src/amazon-keyspaces-mcp-server/awslabs/amazon_keyspaces_mcp_server/client.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
import logging
2222
import os
2323
import ssl
24-
from typing import Any, Dict, List, Optional
25-
26-
from cassandra.auth import PlainTextAuthProvider
27-
from cassandra.cluster import Cluster, Session
28-
2924
from .consts import (
3025
CERT_DIRECTORY,
3126
CERT_FILENAME,
@@ -35,6 +30,9 @@
3530
PROTOCOL_VERSION,
3631
UNSAFE_OPERATIONS,
3732
)
33+
from cassandra.auth import PlainTextAuthProvider
34+
from cassandra.cluster import Cluster, Session
35+
from typing import Any, Dict, List, Optional
3836

3937

4038
# Older versions of the Cassandra Python driver may not include SSLOptions. Conditionally
@@ -252,8 +250,7 @@ async def describe_table(self, keyspace_name: str, table_name: str) -> Dict[str,
252250
"""Get detailed information about a table."""
253251
try:
254252
query = (
255-
'SELECT * FROM system_schema.tables WHERE '
256-
'keyspace_name = %s AND table_name = %s'
253+
'SELECT * FROM system_schema.tables WHERE keyspace_name = %s AND table_name = %s'
257254
)
258255
session = await self.get_session()
259256

@@ -318,23 +315,28 @@ async def describe_table(self, keyspace_name: str, table_name: str) -> Dict[str,
318315
)
319316
session = await self.get_session()
320317

321-
capacity_row = session.execute(
322-
query, [keyspace_name, table_name]
323-
).one()
318+
capacity_row = session.execute(query, [keyspace_name, table_name]).one()
324319

325320
if capacity_row and capacity_row.custom_properties:
326321
props = capacity_row.custom_properties
327322
if 'capacity_mode' in props:
328323
table_details['capacity_mode'] = props['capacity_mode']
329324

330325
if props['capacity_mode'] == 'PROVISIONED':
331-
if 'read_capacity_units' not in props or 'write_capacity_units' not in props:
326+
if (
327+
'read_capacity_units' not in props
328+
or 'write_capacity_units' not in props
329+
):
332330
raise RuntimeError(
333331
f'PROVISIONED capacity mode requires both read_capacity_units '
334332
f'and write_capacity_units for table {keyspace_name}.{table_name}'
335333
)
336-
table_details['read_capacity_units'] = int(props['read_capacity_units'])
337-
table_details['write_capacity_units'] = int(props['write_capacity_units'])
334+
table_details['read_capacity_units'] = int(
335+
props['read_capacity_units']
336+
)
337+
table_details['write_capacity_units'] = int(
338+
props['write_capacity_units']
339+
)
338340
except (RuntimeError, ValueError, AttributeError) as e:
339341
# Ignore errors when trying to get capacity information
340342
logger.warning(
@@ -361,10 +363,7 @@ async def execute_read_only_query(
361363
raise ValueError('Only SELECT queries are allowed for read-only execution')
362364

363365
# Check for any modifications that might be disguised as SELECT
364-
if any(
365-
op in trimmed_query
366-
for op in UNSAFE_OPERATIONS
367-
):
366+
if any(op in trimmed_query for op in UNSAFE_OPERATIONS):
368367
raise ValueError('Query contains potentially unsafe operations')
369368

370369
try:
@@ -398,9 +397,7 @@ async def execute_read_only_query(
398397
if hasattr(row, col_name) and getattr(row, col_name) is not None:
399398
value = getattr(row, col_name)
400399
except (AttributeError, TypeError, ValueError) as e:
401-
logger.warning(
402-
'Error getting value for column %s: %s', col_name, str(e)
403-
)
400+
logger.warning('Error getting value for column %s: %s', col_name, str(e))
404401
row_data[col_name] = value
405402
rows.append(row_data)
406403

src/amazon-keyspaces-mcp-server/awslabs/amazon_keyspaces_mcp_server/config.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
"""Configuration module for Keyspaces MCP Server."""
1515

1616
import os
17+
from .consts import CASSANDRA_DEFAULT_PORT, ENV_DIRECTORY, ENV_FILENAME
1718
from dataclasses import dataclass
1819
from dotenv import load_dotenv
1920

20-
from .consts import CASSANDRA_DEFAULT_PORT, ENV_DIRECTORY, ENV_FILENAME
21-
2221

2322
# Load environment variables from ENV_FILENAME in the user's home directory,
2423
# if it exists.

src/amazon-keyspaces-mcp-server/awslabs/amazon_keyspaces_mcp_server/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class KeyspacesException(Exception):
1818
"""Base exception for Keyspaces MCP server errors."""
1919

20-
def __init__(self, message: str, details: str = ""):
20+
def __init__(self, message: str, details: str = ''):
2121
"""Initialize exception with message and optional details."""
2222
self.message = message
2323
self.details = details

0 commit comments

Comments
 (0)