class_docstr: This class is used to inspect the file system state and determine if the
  file being created can use `fcntl` / `flock` or should use soft file locks.
  
  This can be achieved by finding the device owning the parent directory and
  mapping it to the partition and finally checking the filesystem type.
  
  We prefer using soft file locks *only* if there is a risk of the filesystem
  not being able to handle `fcntl` implementations.
  (e.g. remote filesystems, including NFS<4, BeeGFS, Lustre, etc.)
docstr: Warn only once per device. This is used to avoid spamming the logs with
  the same message.
docstr_tok: ["Warn","only","once","per","device",".","This","is","used","to","avoid","spamming","the","logs","with","the","same","message","."]
code: def _warn_only_once(
      cls,
      path: str,
      device: int,
      fstype: Optional[str],
  ) -> None:
      """
      Warn only once per device. This is used to avoid spamming the logs with
      the same message.
      """
      if device in cls.warned_devices:
          return
      cls.warned_devices.add(device)
  
      if fstype is None:
          logger.warning(
              f"Failed to determine filesystem type for {path} "
              f"(device id: {device}). "
              f"Using soft file locks to avoid potential data corruption."
          )
          return
  
      logger.warning(
          f"The lock file {path} is on a filesystem of type `{fstype}` "
          f"(device id: {device}). "
          f"Using soft file locks to avoid potential data corruption."
      )
  
imports: import os
  import logging
  import pathlib
  import threading
  import uuid
  import time
  from filelock import BaseFileLock, SoftFileLock, UnixFileLock, has_fcntl
  from cachetools.func import ttl_cache
  from psutil import disk_partitions
  from typing import Optional, Union, Dict, Set, Tuple
label_desc: Use image node_id 1 for calling the FileSystemInspector obj's underlying member method code with example usage: obj._warn_only_once(cls, path, device, fstype) without return types