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_intervall: interval of trying to acquire the lock file
  :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.
docstr_tok: ["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_intervall",":","interval","of","trying","to","acquire","the","lock","file",":","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=None, poll_intervall=0.05):
      """
      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_intervall: interval of trying to acquire the lock file
      :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.timeout
  
      # Increment the number right at the beginning. We can still undo it, if something fails.
      with self._thread_lock:
          self._lock_counter += 1
  
      lock_id = id(self)
      lock_filename = self._lock_file
      start_time = time.time()
      try:
          while True:
              with self._thread_lock:
                  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
              elif 0 <= timeout < time.time() - start_time:
                  _LOGGER.debug(
                      "Timeout on acquiring lock %s on %s",
                      lock_id,
                      lock_filename,
                  )
                  raise Timeout(self._lock_file)
              else:
                  msg = "Lock %s not acquired on %s, waiting %s seconds ..."
                  _LOGGER.debug(
                      msg, lock_id, lock_filename, poll_intervall
                  )
                  time.sleep(poll_intervall)
      except (
          BaseException
      ):  # Something did go wrong, so decrement the counter.
          with self._thread_lock:
              self._lock_counter = max(0, self._lock_counter - 1)
          raise
      return AcquireReturnProxy(lock=self)
  
imports: import logging
  import time
  from threading import Lock
  from ._error import Timeout
label_desc: Use image node_id 8 for calling the BaseFileLock obj's underlying member method code with example usage: obj.acquire(timeout, poll_intervall) and returns: AcquireReturnProxy