class_docstr: In-memory file manager for MediaFile objects.
  
  This keeps track of:
  - Which files exist, and what their IDs are. This is important so we can
    serve files by ID -- that's the whole point of this class!
  - Which files are being used by which AppSession (by ID). This is
    important so we can remove files from memory when no more sessions need
    them.
  - The exact location in the app where each file is being used (i.e. the
    file's "coordinates"). This is is important so we can mark a file as "not
    being used by a certain session" if it gets replaced by another file at
    the same coordinates. For example, when doing an animation where the same
    image is constantly replace with new frames. (This doesn't solve the case
    where the file's coordinates keep changing for some reason, though! e.g.
    if new elements keep being prepended to the app. Unlikely to happen, but
    we should address it at some point.)
class_docstr_tok: ["In-memory","file","manager","for","MediaFile","objects",".","This","keeps","track","of",":","-","Which","files","exist",",","and","what","their","IDs","are",".","This","is","important","so","we","can","serve","files","by","ID","--","that","'s","the","whole","point","of","this","class","!","-","Which","files","are","being","used","by","which","AppSession","(","by","ID",")",".","This","is","important","so","we","can","remove","files","from","memory","when","no","more","sessions","need","them",".","-","The","exact","location","in","the","app","where","each","file","is","being","used","(","i.e",".","the","file","'s","``","coordinates","''",")",".","This","is","is","important","so","we","can","mark","a","file","as","``","not","being","used","by","a","certain","session","''","if","it","gets","replaced","by","another","file","at","the","same","coordinates",".","For","example",",","when","doing","an","animation","where","the","same","image","is","constantly","replace","with","new","frames",".","(","This","does","n't","solve","the","case","where","the","file","'s","coordinates","keep","changing","for","some","reason",",","though","!","e.g",".","if","new","elements","keep","being","prepended","to","the","app",".","Unlikely","to","happen",",","but","we","should","address","it","at","some","point",".",")"]
docstr: Compute the set of files that are stored in the manager, but are
  not referenced by any active session. These are files that can be
  safely deleted.
  
  Thread safety: callers must hold `self._lock`.
docstr_tok: ["Compute","the","set","of","files","that","are","stored","in","the","manager",",","but","are","not","referenced","by","any","active","session",".","These","are","files","that","can","be","safely","deleted",".","Thread","safety",":","callers","must","hold","`","self._lock","`","."]
code: def _get_inactive_file_ids(self) -> Set[str]:
      """Compute the set of files that are stored in the manager, but are
      not referenced by any active session. These are files that can be
      safely deleted.
  
      Thread safety: callers must hold `self._lock`.
      """
      # Get the set of all our file IDs.
      file_ids = set(self._file_metadata.keys())
  
      # Subtract all IDs that are in use by each session
      for (
          session_file_ids_by_coord
      ) in self._files_by_session_and_coord.values():
          file_ids.difference_update(session_file_ids_by_coord.values())
  
      return file_ids
  
file_path: streamlit/lib/streamlit/runtime/media_file_manager.py
imports: import collections
  import threading
  from typing import Dict, Optional, Set, Union
  from streamlit.logger import get_logger
  from streamlit.runtime.media_file_storage import MediaFileKind, MediaFileStorage
label_desc: Use image node_id 2 for calling the MediaFileManager obj's underlying member method code with example usage: obj._get_inactive_file_ids() and returns: file_ids