class_docstr: Abstract base class for a file lock object.
docstr: Create a new lock object or if specified return the singleton instance for the lock file.
code: def __new__(  # noqa: PLR0913
      cls,
      lock_file: str | os.PathLike[str],
      timeout: float = -1,  # noqa: ARG003
      mode: int = 0o644,  # noqa: ARG003
      thread_local: bool = True,  # noqa: ARG003, FBT001, FBT002
      *,
      is_singleton: bool = False,
      **kwargs: dict[
          str, Any
      ],  # capture remaining kwargs for subclasses  # noqa: ARG003
  ) -> Self:
      """Create a new lock object or if specified return the singleton instance for the lock file."""
      if not is_singleton:
          return super().__new__(cls)
  
      instance = cls._instances.get(str(lock_file))
      if not instance:
          instance = super().__new__(cls)
          cls._instances[str(lock_file)] = instance
  
      return instance
  
imports: from __future__ import annotations
  import contextlib
  import logging
  import os
  import time
  import warnings
  from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from threading import local
  from typing import TYPE_CHECKING, Any, ClassVar
  from weakref import WeakValueDictionary
  from ._error import Timeout
label_desc: Use image node_id 1 for calling the BaseFileLock obj's underlying member method code with example usage: obj.__new__(cls, lock_file, timeout, mode, thread_local) and returns: instance, super