refactor(semantics): migrate legacy @TIER to @COMPLEXITY annotations
- Replaced @TIER: TRIVIAL with @COMPLEXITY: 1 - Replaced @TIER: STANDARD with @COMPLEXITY: 3 - Replaced @TIER: CRITICAL with @COMPLEXITY: 5 - Manually elevated specific critical/complex components to levels 2 and 4 - Ignored legacy, specs, and node_modules directories - Updated generated semantic map
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# [DEF:backend.core.utils.network:Module]
|
||||
# [DEF:network:Module]
|
||||
#
|
||||
# @COMPLEXITY: 3
|
||||
# @SEMANTICS: network, http, client, api, requests, session, authentication
|
||||
# @PURPOSE: Инкапсулирует низкоуровневую HTTP-логику для взаимодействия с Superset API, включая аутентификацию, управление сессией, retry-логику и обработку ошибок.
|
||||
# @LAYER: Infra
|
||||
@@ -22,9 +23,11 @@ from ..logger import logger as app_logger, belief_scope
|
||||
# [/SECTION]
|
||||
|
||||
# [DEF:SupersetAPIError:Class]
|
||||
# @COMPLEXITY: 1
|
||||
# @PURPOSE: Base exception for all Superset API related errors.
|
||||
class SupersetAPIError(Exception):
|
||||
# [DEF:__init__:Function]
|
||||
# @COMPLEXITY: 1
|
||||
# @PURPOSE: Initializes the exception with a message and context.
|
||||
# @PRE: message is a string, context is a dict.
|
||||
# @POST: Exception is initialized with context.
|
||||
@@ -36,9 +39,11 @@ class SupersetAPIError(Exception):
|
||||
# [/DEF:SupersetAPIError:Class]
|
||||
|
||||
# [DEF:AuthenticationError:Class]
|
||||
# @COMPLEXITY: 1
|
||||
# @PURPOSE: Exception raised when authentication fails.
|
||||
class AuthenticationError(SupersetAPIError):
|
||||
# [DEF:__init__:Function]
|
||||
# @COMPLEXITY: 1
|
||||
# @PURPOSE: Initializes the authentication error.
|
||||
# @PRE: message is a string, context is a dict.
|
||||
# @POST: AuthenticationError is initialized.
|
||||
@@ -77,7 +82,7 @@ class DashboardNotFoundError(SupersetAPIError):
|
||||
# [DEF:NetworkError:Class]
|
||||
# @PURPOSE: Exception raised when a network level error occurs.
|
||||
class NetworkError(Exception):
|
||||
# [DEF:__init__:Function]
|
||||
# [DEF:network.APIClient.__init__:Function]
|
||||
# @PURPOSE: Initializes the network error.
|
||||
# @PRE: message is a string.
|
||||
# @POST: NetworkError is initialized.
|
||||
@@ -89,7 +94,7 @@ class NetworkError(Exception):
|
||||
# [/DEF:NetworkError:Class]
|
||||
|
||||
|
||||
# [DEF:SupersetAuthCache:Class]
|
||||
# [DEF:network.SupersetAuthCache:Class]
|
||||
# @PURPOSE: Process-local cache for Superset access/csrf tokens keyed by environment credentials.
|
||||
# @PRE: base_url and username are stable strings.
|
||||
# @POST: Cached entries expire automatically by TTL and can be reused across requests.
|
||||
@@ -145,10 +150,10 @@ class SupersetAuthCache:
|
||||
# [/DEF:SupersetAuthCache:Class]
|
||||
|
||||
# [DEF:APIClient:Class]
|
||||
# @TIER: STANDARD
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Synchronous Superset API client with process-local auth token caching.
|
||||
# @RELATION: DEPENDS_ON -> backend.src.core.utils.network.SupersetAuthCache
|
||||
# @RELATION: DEPENDS_ON -> backend.src.core.logger.logger
|
||||
# @RELATION: DEPENDS_ON -> network.SupersetAuthCache
|
||||
# @RELATION: DEPENDS_ON -> logger
|
||||
class APIClient:
|
||||
DEFAULT_TIMEOUT = 30
|
||||
|
||||
|
||||
Reference in New Issue
Block a user