chore: fix linting issues

This commit is contained in:
Akash Mondal
2025-07-13 19:25:02 +00:00
committed by lla-dane
parent 8e6e88140f
commit a6ff93122b
3 changed files with 10 additions and 11 deletions

View File

@ -1,5 +1,3 @@
from typing import Literal
""" """
Configuration classes for QUIC transport. Configuration classes for QUIC transport.
""" """
@ -9,7 +7,7 @@ from dataclasses import (
field, field,
) )
import ssl import ssl
from typing import Any, TypedDict from typing import Any, Literal, TypedDict
from libp2p.custom_types import TProtocol from libp2p.custom_types import TProtocol

View File

@ -500,7 +500,7 @@ class QUICListener(IListener):
try: try:
quic_conn.tls._request_client_certificate = True quic_conn.tls._request_client_certificate = True
logger.debug( logger.debug(
"request_client_certificate set to True in server TLS context" "request_client_certificate set to True in server TLS"
) )
except Exception as e: except Exception as e:
logger.error(f"FAILED to apply request_client_certificate: {e}") logger.error(f"FAILED to apply request_client_certificate: {e}")
@ -694,7 +694,7 @@ class QUICListener(IListener):
if dest_cid in self._connections: if dest_cid in self._connections:
logger.debug( logger.debug(
f"⚠️ PROMOTE: Connection {dest_cid.hex()} already exists in _connections!" f"⚠️ Connection {dest_cid.hex()} already exists in _connections!"
) )
connection = self._connections[dest_cid] connection = self._connections[dest_cid]
else: else:

View File

@ -292,15 +292,15 @@ class LibP2PExtensionHandler:
return signature return signature
else: else:
logger.debug( logger.debug(
f"Cannot extract 64 bytes from {len(signature_data)} byte signature" f"Cannot extract 64 bytes from {len(signature_data)} byte signature"
) )
return signature_data return signature_data
@staticmethod @staticmethod
def _extract_secp256k1_signature(signature_data: bytes) -> bytes: def _extract_secp256k1_signature(signature_data: bytes) -> bytes:
""" """
Extract Secp256k1 signature. Extract Secp256k1 signature. Secp256k1 can use either DER-encoded
Secp256k1 can use either DER-encoded or raw format depending on the implementation. or raw format depending on the implementation.
""" """
logger.debug("🔧 Extracting Secp256k1 signature") logger.debug("🔧 Extracting Secp256k1 signature")
@ -445,11 +445,12 @@ class LibP2PExtensionHandler:
return signature return signature
elif len(signature) > expected_total_length: elif len(signature) > expected_total_length:
logger.debug( logger.debug(
f"🔧 Truncating DER signature from {len(signature)} to {expected_total_length} bytes" "Truncating DER signature from "
f"{len(signature)} to {expected_total_length} bytes"
) )
return signature[:expected_total_length] return signature[:expected_total_length]
else: else:
logger.debug(f"⚠️ DER signature is shorter than expected, using as-is") logger.debug("DER signature is shorter than expected, using as-is")
return signature return signature
@ -823,7 +824,7 @@ class QUICTLSSecurityConfig:
return {"error": str(e)} return {"error": str(e)}
def debug_config(self) -> None: def debug_config(self) -> None:
"""print debugging information about this configuration.""" """Print debugging information about this configuration."""
print(f"=== TLS Security Config Debug ({self.config_name or 'unnamed'}) ===") print(f"=== TLS Security Config Debug ({self.config_name or 'unnamed'}) ===")
print(f"Is client config: {self.is_client_config}") print(f"Is client config: {self.is_client_config}")
print(f"ALPN protocols: {self.alpn_protocols}") print(f"ALPN protocols: {self.alpn_protocols}")