class_docstr: Class that implements a cache for JumpStart models manifests and specs.
  
  The manifest and specs associated with JumpStart models provide the information necessary
  for launching JumpStart models from the SageMaker SDK.
docstr: Initialize a ``JumpStartModelsCache`` instance.
  
  Args:
      region (str): AWS region to associate with cache. Default: region associated
          with boto3 session.
      max_s3_cache_items (int): Maximum number of items to store in s3 cache.
          Default: 20.
      s3_cache_expiration_horizon (datetime.timedelta): Maximum time to hold
          items in s3 cache before invalidation. Default: 6 hours.
      max_semantic_version_cache_items (int): Maximum number of items to store in
          semantic version cache. Default: 20.
      semantic_version_cache_expiration_horizon (datetime.timedelta):
          Maximum time to hold items in semantic version cache before invalidation.
          Default: 6 hours.
      manifest_file_s3_key (str): The key in S3 corresponding to the sdk metadata manifest.
      s3_bucket_name (Optional[str]): S3 bucket to associate with cache.
          Default: JumpStart-hosted content bucket for region.
      s3_client_config (Optional[botocore.config.Config]): s3 client config to use for cache.
          Default: None (no config).
      s3_client (Optional[boto3.client]): s3 client to use. Default: None.
docstr_tok: ["Initialize","a","``","JumpStartModelsCache","``","instance",".","Args",":","region","(","str",")",":","AWS","region","to","associate","with","cache",".","Default",":","region","associated","with","boto3","session",".","max_s3_cache_items","(","int",")",":","Maximum","number","of","items","to","store","in","s3","cache",".","Default",":","20.","s3_cache_expiration_horizon","(","datetime.timedelta",")",":","Maximum","time","to","hold","items","in","s3","cache","before","invalidation",".","Default",":","6","hours",".","max_semantic_version_cache_items","(","int",")",":","Maximum","number","of","items","to","store","in","semantic","version","cache",".","Default",":","20.","semantic_version_cache_expiration_horizon","(","datetime.timedelta",")",":","Maximum","time","to","hold","items","in","semantic","version","cache","before","invalidation",".","Default",":","6","hours",".","manifest_file_s3_key","(","str",")",":","The","key","in","S3","corresponding","to","the","sdk","metadata","manifest",".","s3_bucket_name","(","Optional","[","str","]",")",":","S3","bucket","to","associate","with","cache",".","Default",":","JumpStart-hosted","content","bucket","for","region",".","s3_client_config","(","Optional","[","botocore.config.Config","]",")",":","s3","client","config","to","use","for","cache",".","Default",":","None","(","no","config",")",".","s3_client","(","Optional","[","boto3.client","]",")",":","s3","client","to","use",".","Default",":","None","."]
code: def __init__(
      self,
      region: str = JUMPSTART_DEFAULT_REGION_NAME,
      max_s3_cache_items: int = JUMPSTART_DEFAULT_MAX_S3_CACHE_ITEMS,
      s3_cache_expiration_horizon: datetime.timedelta = JUMPSTART_DEFAULT_S3_CACHE_EXPIRATION_HORIZON,
      max_semantic_version_cache_items: int = JUMPSTART_DEFAULT_MAX_SEMANTIC_VERSION_CACHE_ITEMS,
      semantic_version_cache_expiration_horizon: datetime.timedelta = JUMPSTART_DEFAULT_SEMANTIC_VERSION_CACHE_EXPIRATION_HORIZON,
      manifest_file_s3_key: str = JUMPSTART_DEFAULT_MANIFEST_FILE_S3_KEY,
      s3_bucket_name: Optional[str] = None,
      s3_client_config: Optional[botocore.config.Config] = None,
      s3_client: Optional[boto3.client] = None,
  ) -> None:  # fmt: on
      """Initialize a ``JumpStartModelsCache`` instance.
  
      Args:
          region (str): AWS region to associate with cache. Default: region associated
              with boto3 session.
          max_s3_cache_items (int): Maximum number of items to store in s3 cache.
              Default: 20.
          s3_cache_expiration_horizon (datetime.timedelta): Maximum time to hold
              items in s3 cache before invalidation. Default: 6 hours.
          max_semantic_version_cache_items (int): Maximum number of items to store in
              semantic version cache. Default: 20.
          semantic_version_cache_expiration_horizon (datetime.timedelta):
              Maximum time to hold items in semantic version cache before invalidation.
              Default: 6 hours.
          manifest_file_s3_key (str): The key in S3 corresponding to the sdk metadata manifest.
          s3_bucket_name (Optional[str]): S3 bucket to associate with cache.
              Default: JumpStart-hosted content bucket for region.
          s3_client_config (Optional[botocore.config.Config]): s3 client config to use for cache.
              Default: None (no config).
          s3_client (Optional[boto3.client]): s3 client to use. Default: None.
      """
  
      self._region = region
      self._s3_cache = LRUCache[
          JumpStartCachedS3ContentKey, JumpStartCachedS3ContentValue
      ](
          max_cache_items=max_s3_cache_items,
          expiration_horizon=s3_cache_expiration_horizon,
          retrieval_function=self._retrieval_function,
      )
      self._model_id_semantic_version_manifest_key_cache = LRUCache[
          JumpStartVersionedModelId, JumpStartVersionedModelId
      ](
          max_cache_items=max_semantic_version_cache_items,
          expiration_horizon=semantic_version_cache_expiration_horizon,
          retrieval_function=self._get_manifest_key_from_model_id_semantic_version,
      )
      self._manifest_file_s3_key = manifest_file_s3_key
      self.s3_bucket_name = (
          utils.get_jumpstart_content_bucket(self._region)
          if s3_bucket_name is None
          else s3_bucket_name
      )
      self._s3_client = s3_client or (
          boto3.client(
              "s3", region_name=self._region, config=s3_client_config
          )
          if s3_client_config
          else boto3.client("s3", region_name=self._region)
      )
  
imports: from __future__ import absolute_import
  import datetime
  from difflib import get_close_matches
  import os
  from typing import List, Optional, Tuple, Union
  import json
  import boto3
  import botocore
  from packaging.version import Version
  from packaging.specifiers import SpecifierSet, InvalidSpecifier
  from sagemaker.jumpstart.constants import ENV_VARIABLE_JUMPSTART_MANIFEST_LOCAL_ROOT_DIR_OVERRIDE, ENV_VARIABLE_JUMPSTART_SPECS_LOCAL_ROOT_DIR_OVERRIDE, JUMPSTART_DEFAULT_MANIFEST_FILE_S3_KEY, JUMPSTART_DEFAULT_REGION_NAME, JUMPSTART_LOGGER, MODEL_ID_LIST_WEB_URL
  from sagemaker.jumpstart.exceptions import get_wildcard_model_version_msg
  from sagemaker.jumpstart.parameters import JUMPSTART_DEFAULT_MAX_S3_CACHE_ITEMS, JUMPSTART_DEFAULT_MAX_SEMANTIC_VERSION_CACHE_ITEMS, JUMPSTART_DEFAULT_S3_CACHE_EXPIRATION_HORIZON, JUMPSTART_DEFAULT_SEMANTIC_VERSION_CACHE_EXPIRATION_HORIZON
  from sagemaker.jumpstart.types import JumpStartCachedS3ContentKey, JumpStartCachedS3ContentValue, JumpStartModelHeader, JumpStartModelSpecs, JumpStartS3FileType, JumpStartVersionedModelId
  from sagemaker.jumpstart import utils
  from sagemaker.utilities.cache import LRUCache
label_desc: Use image node_id 1 to create a new JumpStartModelsCache object  with example: obj = JumpStartModelsCache(region, max_s3_cache_items, s3_cache_expiration_horizon, max_semantic_version_cache_items, semantic_version_cache_expiration_horizon, manifest_file_s3_key, s3_bucket_name, s3_client_config, s3_client)