class_docstr: See documentation here
  
  https://wiki.yandex-team.ru/yatool/test/#python-acquire-ports
class_docstr_tok: ["See","documentation","here","https",":","\/\/wiki.yandex-team.ru\/yatool\/test\/","#","python-acquire-ports"]
code: def _capture_port_no_lock(self, port, sock_type):
      if port in self._filelocks:
          return False
  
      filelock = None
      if self._sync_dir:
          # yatest.common should try to be hermetic and don't have peerdirs
          # otherwise, PYTEST_SCRIPT (aka USE_ARCADIA_PYTHON=no) won't work
          import library.python.filelock
  
          filelock = library.python.filelock.FileLock(
              os.path.join(self._sync_dir, str(port))
          )
          if not filelock.acquire(blocking=False):
              return False
          if self.is_port_free(port, sock_type):
              self._filelocks[port] = filelock
              return True
          else:
              filelock.release()
              return False
  
      if self.is_port_free(port, sock_type):
          self._filelocks[port] = filelock
          return True
      if filelock:
          filelock.release()
      return False
  
imports: import os
  import errno
  import socket
  import random
  import logging
  import platform
  import threading
  import six
label_desc: Use image node_id 16 for calling the PortManager obj's underlying member method code with example usage: obj._capture_port_no_lock(port, sock_type) and returns: False, False, True, False, True, False