class_docstr: Abstract base class for a file lock object.
docstr: Try to acquire the file lock.
  
  :param timeout: maximum wait time for acquiring the lock, ``None`` means use the default :attr:`~timeout` is and
   if ``timeout < 0``, there is no timeout and this method will block until the lock could be acquired
  :param poll_interval: interval of trying to acquire the lock file
  :param poll_intervall: deprecated, kept for backwards compatibility, use ``poll_interval`` instead
  :param blocking: defaults to True. If False, function will return immediately if it cannot obtain a lock on the
   first attempt. Otherwise, this method will block until the timeout expires or the lock is acquired.
  :raises Timeout: if fails to acquire lock within the timeout period
  :return: a context object that will unlock the file when the context is exited
  
  .. code-block:: python
  
      # You can use this method in the context manager (recommended)
      with lock.acquire():
          pass
  
      # Or use an equivalent try-finally construct:
      lock.acquire()
      try:
          pass
      finally:
          lock.release()
  
  .. versionchanged:: 2.0.0
  
      This method returns now a *proxy* object instead of *self*,
      so that it can be used in a with statement without side effects.
code: def acquire(
      self,
      timeout: float | None = None,
      poll_interval: float = 0.05,
      *,
      poll_intervall: float | None = None,
      blocking: bool = True,
  ) -> AcquireReturnProxy:
      """
      Try to acquire the file lock.
  
      :param timeout: maximum wait time for acquiring the lock, ``None`` means use the default :attr:`~timeout` is and
       if ``timeout < 0``, there is no timeout and this method will block until the lock could be acquired
      :param poll_interval: interval of trying to acquire the lock file
      :param poll_intervall: deprecated, kept for backwards compatibility, use ``poll_interval`` instead
      :param blocking: defaults to True. If False, function will return immediately if it cannot obtain a lock on the
       first attempt. Otherwise, this method will block until the timeout expires or the lock is acquired.
      :raises Timeout: if fails to acquire lock within the timeout period
      :return: a context object that will unlock the file when the context is exited
  
      .. code-block:: python
  
          # You can use this method in the context manager (recommended)
          with lock.acquire():
              pass
  
          # Or use an equivalent try-finally construct:
          lock.acquire()
          try:
              pass
          finally:
              lock.release()
  
      .. versionchanged:: 2.0.0
  
          This method returns now a *proxy* object instead of *self*,
          so that it can be used in a with statement without side effects.
  
      """
      # Use the default timeout, if no timeout is provided.
      if timeout is None:
          timeout = self._context.timeout
  
      if poll_intervall is not None:
          msg = "use poll_interval instead of poll_intervall"
          warnings.warn(msg, DeprecationWarning, stacklevel=2)
          poll_interval = poll_intervall
  
      # Increment the number right at the beginning. We can still undo it, if something fails.
      self._context.lock_counter += 1
  
      lock_id = id(self)
      lock_filename = self.lock_file
      start_time = time.perf_counter()
      try:
          while True:
              if not self.is_locked:
                  _LOGGER.debug(
                      "Attempting to acquire lock %s on %s",
                      lock_id,
                      lock_filename,
                  )
                  self._acquire()
              if self.is_locked:
                  _LOGGER.debug(
                      "Lock %s acquired on %s", lock_id, lock_filename
                  )
                  break
              if blocking is False:
                  _LOGGER.debug(
                      "Failed to immediately acquire lock %s on %s",
                      lock_id,
                      lock_filename,
                  )
                  raise Timeout(lock_filename)  # noqa: TRY301
              if 0 <= timeout < time.perf_counter() - start_time:
                  _LOGGER.debug(
                      "Timeout on acquiring lock %s on %s",
                      lock_id,
                      lock_filename,
                  )
                  raise Timeout(lock_filename)  # noqa: TRY301
              msg = "Lock %s not acquired on %s, waiting %s seconds ..."
              _LOGGER.debug(msg, lock_id, lock_filename, poll_interval)
              time.sleep(poll_interval)
      except (
          BaseException
      ):  # Something did go wrong, so decrement the counter.
          self._context.lock_counter = max(
              0, self._context.lock_counter - 1
          )
          raise
      return AcquireReturnProxy(lock=self)
  
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 12 for calling the BaseFileLock obj's underlying member method code with example usage: obj.acquire(timeout, poll_interval) and returns: AcquireReturnProxy