← Về thư mục
skills/ncats-arax/scripts/arax_client.py
- AraxClientError · class · L87-L105 — class AraxClientError(Exception)
- init · method · L90-L105 — def init( self, message: str, *, exit_code: int, kind: str, http_status: int | None = None, response_body: bytes | None = None, attempts: int = 0, ) -> None
- UsageError · class · L108-L110 — class UsageError(AraxClientError)
- init · method · L109-L110 — def init(self, message: str) -> None
- PreflightError · class · L113-L115 — class PreflightError(AraxClientError)
- init · method · L114-L115 — def init(self, message: str, **kwargs: Any) -> None
- NormalizationError · class · L118-L120 — class NormalizationError(AraxClientError)
- init · method · L119-L120 — def init(self, message: str) -> None
- TransportError · class · L123-L125 — class TransportError(AraxClientError)
- init · method · L124-L125 — def init(self, message: str, **kwargs: Any) -> None
- ResponseError · class · L128-L130 — class ResponseError(AraxClientError)
- init · method · L129-L130 — def init(self, message: str, **kwargs: Any) -> None
- HttpResult · class · L134-L139 — class HttpResult
- ServiceInfo · class · L143-L157 — class ServiceInfo
- as_dict · method · L150-L157 — def as_dict(self, *, biolink_version: str | None = None) -> dict[str, Any]
- QueryContract · class · L161-L168 — class QueryContract
- RejectRepeatedValueAction · class · L171-L183 — class RejectRepeatedValueAction(argparse.Action)
- call · method · L174-L183 — def call( self, parser: argparse.ArgumentParser, namespace: argparse.Namespace, values: Any, option_string: str | None = None, ) -> None
- _sanitize_text · function · L186-L192 — def _sanitize_text(value: Any, limit: int = MAX_DISPLAY_TEXT) -> str
- make_warning · function · L195-L212 — def make_warning( code: str, message: str, context: Mapping[str, Any] | None = None, ) -> dict[str, Any]
- _append_warning · function · L215-L228 — def _append_warning( warnings: list[dict[str, Any]], code: str, message: str, context: Mapping[str, Any] | None = None, ) -> None
- _has_control · function · L231-L232 — def _has_control(value: str) -> bool
- validate_curie · function · L235-L240 — def validate_curie(value: str) -> str
- _looks_like_curie · function · L243-L248 — def _looks_like_curie(value: str) -> bool
- validate_biolink_term · function · L251-L256 — def validate_biolink_term(value: str, label: str = "Biolink term") -> str
- validate_provider_id · function · L259-L266 — def validate_provider_id(value: str) -> str
- _unique · function · L269-L272 — def _unique(values: Sequence[str], label: str) -> list[str]
- validate_predicates · function · L275-L278 — def validate_predicates(values: Sequence[str]) -> list[str]
- parse_qualifiers · function · L281-L301 — def parse_qualifiers(values: Sequence[str]) -> list[tuple[str, str]]
- validate_result_limit · function · L304-L307 — def validate_result_limit(value: int) -> int
- validate_base_url · function · L310-L343 — def validate_base_url(value: str, allow_nonproduction: bool) -> tuple[str, list[dict[str, Any]]]
- resolve_mode · function · L346-L363 — def resolve_mode( mode: str, provider_values: Sequence[str], result_limit: int | None, ) -> tuple[list[str], int]
- build_query_edge · function · L366-L386 — def build_query_edge( subject: str, object_: str, predicates: Sequence[str], qualifiers: Sequence[tuple[str, str]], ) -> dict[str, Any]
- _provider_parameter · function · L389-L392 — def _provider_parameter(mode: str, provider_ids: Sequence[str]) -> str
- build_operations · function · L395-L414 — def build_operations( edge_keys: Sequence[str], mode: str, provider_ids: Sequence[str], result_limit: int, ) -> dict[str, list[str]]
- build_one_hop_query · function · L417-L452 — def build_one_hop_query( *, subject_id: str | None, subject_category: str, predicates: Sequence[str], object_id: str | None, object_category: str, qualifiers: Sequence[tuple[str, str]], mode: str, provider_ids: Sequence[str], result_limit: int, ) -> dict[str, Any]
- build_two_hop_query · function · L455-L504 — def build_two_hop_query( *, subject_id: str, subject_category: str, predicates_1: Sequence[str], intermediate_category: str, predicates_2: Sequence[str], object_id: str, object_category: str, qualifiers_1: Sequence[tuple[str, str]], qualifiers_2: Sequence[tuple[str, str]], mode: str, provider_ids: Sequence[str], expand_order: str, result_limit: int, ) -> dict[str, Any]
- serialize_request · function · L507-L517 — def serialize_request(body: Mapping[str, Any]) -> bytes
- _origin · function · L520-L528 — def _origin(url: str) -> tuple[str, str | None, int | None]
- SameOriginHttpsRedirectHandler · class · L531-L555 — class SameOriginHttpsRedirectHandler(urllib.request.HTTPRedirectHandler)
- redirect_request · method · L532-L555 — def redirect_request( self, req: urllib.request.Request, fp: Any, code: int, msg: str, headers: Any, newurl: str, ) -> urllib.request.Request | None
- _open_url · function · L558-L560 — def _open_url(request: urllib.request.Request, timeout: int) -> Any
- read_bounded_response · function · L563-L567 — def read_bounded_response(response: Any, byte_limit: int = MAX_RESPONSE_BYTES) -> bytes
- _response_status · function · L570-L572 — def _response_status(response: Any) -> int
- _headers_dict · function · L575-L581 — def _headers_dict(headers: Any) -> dict[str, str]
- _retry_delay · function · L584-L598 — def _retry_delay(headers: Mapping[str, str], now: Callable[[], datetime] | None = None) -> float
- _is_timeout_error · function · L601-L606 — def _is_timeout_error(error: BaseException) -> bool
- request_get_with_retry · function · L609-L666 — def request_get_with_retry( url: str, *, timeout: int = GET_TIMEOUT_SECONDS, sleep: Callable[[float], None] = time.sleep, ) -> HttpResult
- post_query · function · L669-L713 — def post_query(url: str, request_bytes: bytes, *, timeout: int) -> HttpResult
- _decode_json · function · L716-L723 — def _decode_json(body: bytes, label: str) -> Any
- reject_constant · function · L717-L718 — def reject_constant(value: str) -> None
- _version_series · function · L726-L732 — def _version_series(version: str | None) -> str | None
- _check_trapi_version · function · L735-L751 — def _check_trapi_version( trapi_version: str | None, allow_untested: bool, warnings: list[dict[str, Any]], ) -> None
- parse_openapi_service_info · function · L754-L791 — def parse_openapi_service_info( payload: Any, *, base_url: str, openapi_url: str, allow_untested_version: bool, initial_warnings: Sequence[dict[str, Any]] = (), ) -> ServiceInfo
- fetch_openapi · function · L794-L828 — def fetch_openapi( base_url: str, *, allow_untested_version: bool, initial_warnings: Sequence[dict[str, Any]] = (), ) -> tuple[ServiceInfo, HttpResult]
- normalize_entity_request · function · L831-L833 — def normalize_entity_request(base_url: str, term: str) -> HttpResult
- parse_normalization_response · function · L836-L907 — def parse_normalization_response( payload: Any, *, term: str, expected_category: str | None, max_synonyms: int, service: ServiceInfo, ) -> tuple[dict[str, Any], bool]
- _require_exact_keys · function · L910-L919 — def _require_exact_keys(value: Mapping[str, Any], allowed: set[str], label: str) -> None
- _validate_edge_contract · function · L922-L958 — def _validate_edge_contract(edge: Any) -> tuple[str, str]
- _parse_kp_parameter · function · L961-L970 — def _parse_kp_parameter(value: str) -> tuple[str, tuple[str, ...]]
- validate_saved_request_contract · function · L973-L1074 — def validate_saved_request_contract(payload: Any) -> QueryContract
- _normalize_node_bindings · function · L1077-L1098 — def _normalize_node_bindings(value: Any) -> tuple[dict[str, list[dict[str, Any]]], dict[str, set[str]]]
- _resource_ids_for_role · function · L1101-L1109 — def _resource_ids_for_role(sources: Sequence[dict[str, Any]], role: str) -> list[str]
- extract_publications · function · L1112-L1125 — def extract_publications(edge: Mapping[str, Any]) -> list[str]
- _classify_logs · function · L1128-L1184 — def _classify_logs( payload: Mapping[str, Any], contract: QueryContract, warnings: list[dict[str, Any]], ) -> bool
- parse_trapi_response · function · L1187-L1422 — def parse_trapi_response( payload: Any, contract: QueryContract, *, service: ServiceInfo | None = None, initial_warnings: Sequence[dict[str, Any]] = (), ) -> dict[str, Any]
- render_text_summary · function · L1425-L1528 — def render_text_summary( summary: Mapping[str, Any], *, summary_path: str = "summary.json", response_path: str = "response.json", ) -> str
- rendered · function · L1431-L1432 — def rendered(value: Any, limit: int = 200) -> str
- rendered_list · function · L1434-L1437 — def rendered_list(values: Any, *, limit: int = 200) -> str
- sha256_bytes · function · L1531-L1532 — def sha256_bytes(value: bytes) -> str
- prepare_output_directory · function · L1535-L1549 — def prepare_output_directory(value: str | Path) -> Path
- atomic_write_bytes · function · L1552-L1594 — def atomic_write_bytes(path: Path, value: bytes) -> None
- atomic_write_json · function · L1597-L1605 — def atomic_write_json(path: Path, value: Mapping[str, Any]) -> bytes
- _utc_now · function · L1608-L1609 — def _utc_now() -> str
- new_manifest · function · L1612-L1661 — def new_manifest( command: str, *, base_url: str, privacy_acknowledged: bool, http_timeout: int, result_limit: int | None = None, ) -> dict[str, Any]
- _apply_service_to_manifest · function · L1664-L1666 — def _apply_service_to_manifest(manifest: dict[str, Any], service: ServiceInfo) -> None
- _record_response · function · L1669-L1679 — def _record_response(manifest: dict[str, Any], result: HttpResult, filename: str = "response.json") -> None
- _write_manifest · function · L1682-L1684 — def _write_manifest(output_dir: Path, manifest: dict[str, Any]) -> None
- _retain_failure · function · L1687-L1724 — def _retain_failure( output_dir: Path | None, manifest: dict[str, Any] | None, error: AraxClientError, stage: str, ) -> None
- _json_from_http · function · L1727-L1728 — def _json_from_http(result: HttpResult, label: str) -> Any
- _preflight_summary · function · L1731-L1742 — def _preflight_summary(service: ServiceInfo) -> dict[str, Any]
- handle_preflight · function · L1745-L1778 — def handle_preflight(args: argparse.Namespace) -> int
- handle_normalize · function · L1781-L1844 — def handle_normalize(args: argparse.Namespace) -> int
- _build_from_args · function · L1847-L1879 — def _build_from_args(args: argparse.Namespace) -> tuple[dict[str, Any], QueryContract, int]
- _validate_query_response_version · function · L1882-L1894 — def _validate_query_response_version( payload: Mapping[str, Any], allow_untested_version: bool, warnings: list[dict[str, Any]], ) -> None
- handle_graph_query · function · L1897-L1966 — def handle_graph_query(args: argparse.Namespace) -> int
- handle_summarize · function · L1969-L2001 — def handle_summarize(args: argparse.Namespace) -> int
- _add_network_policy_options · function · L2004-L2007 — def _add_network_policy_options(parser: argparse.ArgumentParser) -> None
- _add_query_common · function · L2010-L2016 — def _add_query_common(parser: argparse.ArgumentParser) -> None
- build_parser · function · L2019-L2065 — def build_parser() -> argparse.ArgumentParser
- main · function · L2068-L2083 — def main(argv: Sequence[str] | None = None) -> int