parameters: (self, uri: str)
docstring: Initialize the file-driven database from a JSON file.
          If the file doesn't exist, a new file will be created.
docstring_summary: Initialize the file-driven database from a JSON file.
          If the file doesn't exist, a new file will be created.
docstring_tokens: Initialize the file - driven database from a JSON file . If the file doesn t exist a new file will be created .
function: def __init__(self, uri: str) -> None:
          """Initialize the file-driven database from a JSON file.
          If the file doesn't exist, a new file will be created.
          """
          parsed_uri = urlparse(uri)
          # using urlparse to parse relative/absolute file path
          # abs path: urlparse("file:///path/to/file") ->
          #           (netloc='', path='/path/to/file')
          # rel path: urlparse("file://path/to/file") ->
          #           (netloc='path', path='/to/file')
          # so, the filepath would be netloc+path for both cases
          self._json_file = Path(parsed_uri.netloc) / Path(parsed_uri.path)
          storage_path = os.environ.get("GEM5ART_STORAGE", "")
          self._storage_enabled = True if storage_path else False
          self._storage_path = Path(storage_path)
          if (
              self._storage_enabled
              and self._storage_path.exists()
              and not self._storage_path.is_dir()
          ):
              raise Exception(
                  f"GEM5ART_STORAGE={storage_path} exists and is not a directory"
              )
          if self._storage_enabled:
              os.makedirs(self._storage_path, exist_ok=True)
  
          self._uuid_artifact_map, self._hash_uuid_map = self._load_from_file(
              self._json_file
          )
function_tokens: def __init__ ( self , uri : str ) -> None : parsed_uri = urlparse ( uri ) # using urlparse to parse relative/absolute file path # abs path: urlparse("file:///path/to/file") -> #           (netloc='', path='/path/to/file') # rel path: urlparse("file://path/to/file") -> #           (netloc='path', path='/to/file') # so, the filepath would be netloc+path for both cases self . _json_file = Path ( parsed_uri . netloc ) / Path ( parsed_uri . path ) storage_path = os . environ . get ( "GEM5ART_STORAGE" , "" ) self . _storage_enabled = True if storage_path else False self . _storage_path = Path ( storage_path ) if ( self . _storage_enabled and self . _storage_path . exists ( ) and not self . _storage_path . is_dir ( ) ) : raise Exception ( f"GEM5ART_STORAGE={storage_path} exists and is not a directory" ) if self . _storage_enabled : os . makedirs ( self . _storage_path , exist_ok = True ) self . _uuid_artifact_map , self . _hash_uuid_map = self . _load_from_file ( self . _json_file )