Skip to content

Commit 89c5f7b

Browse files
Copilot0xrinegade
andcommitted
style: fix black formatting and line length issues
Co-authored-by: 0xrinegade <[email protected]>
1 parent f580096 commit 89c5f7b

File tree

5 files changed

+20
-42
lines changed

5 files changed

+20
-42
lines changed

python/.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E203, W503

python/solana_ai_registries/constants.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,8 @@
102102
# A2AMPL Token
103103
A2AMPL_DECIMALS: Final[int] = 9
104104
A2AMPL_BASE_UNIT: Final[int] = 1_000_000_000 # 1 A2AMPL = 10^9 base units
105-
A2AMPL_TOKEN_MINT_MAINNET: Final[str] = (
106-
"Cpzvdx6pppc9TNArsGsqgShCsKC9NCCjA2gtzHvUpump"
107-
)
108-
A2AMPL_TOKEN_MINT_DEVNET: Final[str] = (
109-
"A2AMPLyncKHwfSnwRNsJ2qsjsetgo9fGkP8YZPsDZ9mE"
110-
)
105+
A2AMPL_TOKEN_MINT_MAINNET: Final[str] = "Cpzvdx6pppc9TNArsGsqgShCsKC9NCCjA2gtzHvUpump"
106+
A2AMPL_TOKEN_MINT_DEVNET: Final[str] = "A2AMPLyncKHwfSnwRNsJ2qsjsetgo9fGkP8YZPsDZ9mE"
111107

112108
# Agent Registry Fees (in base units)
113109
AGENT_REGISTRATION_FEE: Final[int] = 100_000_000_000 # 100 A2AMPL
@@ -162,9 +158,7 @@
162158
# ============================================================================
163159

164160
# Registry Programs
165-
AGENT_REGISTRY_PROGRAM_ID: Final[str] = (
166-
"AgentReg11111111111111111111111111111111111"
167-
)
161+
AGENT_REGISTRY_PROGRAM_ID: Final[str] = "AgentReg11111111111111111111111111111111111"
168162
MCP_SERVER_REGISTRY_PROGRAM_ID: Final[str] = "TBD" # To be updated
169163

170164
# Authorized External Programs
@@ -238,9 +232,7 @@ def get_token_mint_for_cluster(cluster: str) -> str:
238232
raise ValueError(f"Unsupported cluster: {cluster}")
239233

240234

241-
def validate_string_length(
242-
value: str, max_length: int, field_name: str
243-
) -> None:
235+
def validate_string_length(value: str, max_length: int, field_name: str) -> None:
244236
"""Validate string length against maximum constraint.
245237
246238
Args:
@@ -270,6 +262,5 @@ def validate_url(url: str, field_name: str) -> None:
270262
allowed_schemes = ("http://", "https://", "ipfs://", "ar://")
271263
if not any(url.startswith(scheme) for scheme in allowed_schemes):
272264
raise ValueError(
273-
f"{field_name} must start with one of: "
274-
f"{', '.join(allowed_schemes)}"
265+
f"{field_name} must start with one of: " f"{', '.join(allowed_schemes)}"
275266
)

python/solana_ai_registries/exceptions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ def __init__(self, required: int, available: int, token_mint: str):
113113
available: Available amount in base units
114114
token_mint: Token mint address
115115
"""
116-
message = (
117-
f"Insufficient funds: required {required}, available {available}"
118-
)
116+
message = f"Insufficient funds: required {required}, " f"available {available}"
119117
details = {
120118
"required": required,
121119
"available": available,

python/solana_ai_registries/types.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def __post_init__(self) -> None:
7979
validate_string_length(self.url, 256, "endpoint URL")
8080
validate_url(self.url, "endpoint URL")
8181
if self.description:
82-
validate_string_length(
83-
self.description, 512, "endpoint description"
84-
)
82+
validate_string_length(self.description, 512, "endpoint description")
8583

8684

8785
@dataclass
@@ -148,9 +146,7 @@ def __post_init__(self) -> None:
148146
validate_string_length(self.provider_url, 256, "provider_url")
149147
validate_url(self.provider_url, "provider_url")
150148
if self.documentation_url:
151-
validate_string_length(
152-
self.documentation_url, 256, "documentation_url"
153-
)
149+
validate_string_length(self.documentation_url, 256, "documentation_url")
154150
validate_url(self.documentation_url, "documentation_url")
155151

156152
# Validate collections
@@ -184,8 +180,7 @@ def from_account_data(cls, data: Dict[str, Any]) -> "AgentRegistryEntry":
184180
provider_url=data.get("provider_url"),
185181
documentation_url=data.get("documentation_url"),
186182
service_endpoints=[
187-
ServiceEndpoint(**ep)
188-
for ep in data.get("service_endpoints", [])
183+
ServiceEndpoint(**ep) for ep in data.get("service_endpoints", [])
189184
],
190185
capabilities_flags=data.get("capabilities_flags", 0),
191186
supported_input_modes=data.get("supported_input_modes", []),
@@ -194,9 +189,7 @@ def from_account_data(cls, data: Dict[str, Any]) -> "AgentRegistryEntry":
194189
security_info_uri=data.get("security_info_uri"),
195190
aea_address=data.get("aea_address"),
196191
economic_intent_summary=data.get("economic_intent_summary"),
197-
supported_aea_protocols_hash=data.get(
198-
"supported_aea_protocols_hash"
199-
),
192+
supported_aea_protocols_hash=data.get("supported_aea_protocols_hash"),
200193
extended_metadata_uri=data.get("extended_metadata_uri"),
201194
tags=data.get("tags", []),
202195
created_at=data.get("created_at", 0),
@@ -311,7 +304,9 @@ def __post_init__(self) -> None:
311304
)
312305
if self.full_capabilities_uri:
313306
validate_string_length(
314-
self.full_capabilities_uri, 256, "full_capabilities_uri"
307+
self.full_capabilities_uri,
308+
256,
309+
"full_capabilities_uri",
315310
)
316311
validate_url(self.full_capabilities_uri, "full_capabilities_uri")
317312

@@ -321,9 +316,7 @@ def __post_init__(self) -> None:
321316
validate_string_length(tag, 32, "server tag")
322317

323318
@classmethod
324-
def from_account_data(
325-
cls, data: Dict[str, Any]
326-
) -> "McpServerRegistryEntry":
319+
def from_account_data(cls, data: Dict[str, Any]) -> "McpServerRegistryEntry":
327320
"""Create instance from on-chain account data.
328321
329322
Args:
@@ -343,13 +336,8 @@ def from_account_data(
343336
resource_count=cap_data.get("resource_count", 0),
344337
prompt_count=cap_data.get("prompt_count", 0),
345338
tools=[McpTool(**tool) for tool in cap_data.get("tools", [])],
346-
resources=[
347-
McpResource(**res) for res in cap_data.get("resources", [])
348-
],
349-
prompts=[
350-
McpPrompt(**prompt)
351-
for prompt in cap_data.get("prompts", [])
352-
],
339+
resources=[McpResource(**res) for res in cap_data.get("resources", [])],
340+
prompts=[McpPrompt(**prompt) for prompt in cap_data.get("prompts", [])],
353341
)
354342

355343
return cls(

python/tests/conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ def pytest_configure(config: Any) -> None:
212212
config.addinivalue_line(
213213
"markers", "devnet: tests specifically for devnet environment"
214214
)
215-
config.addinivalue_line(
216-
"markers", "slow: tests that take longer than 1 second"
217-
)
215+
config.addinivalue_line("markers", "slow: tests that take longer than 1 second")
218216

219217

220218
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)