class_docstr: Bounded semaphore to prevent too many parallel processes from running
  
  This method is deprecated because multiple processes that are completely
  unrelated could end up using the same semaphore.  To prevent this,
  use `NamedBoundedSemaphore` instead. The
  `NamedBoundedSemaphore` is a drop-in replacement for this class.
  
  >>> semaphore = BoundedSemaphore(2, directory='')
  >>> str(semaphore.get_filenames()[0])
  'bounded_semaphore.00.lock'
  >>> str(sorted(semaphore.get_random_filenames())[1])
  'bounded_semaphore.01.lock'
code: def try_lock(self, filenames: typing.Sequence[Filename]) -> bool:
      filename: Filename
      for filename in filenames:
          logger.debug("trying lock for %r", filename)
          self.lock = Lock(filename, fail_when_locked=True)
          try:
              self.lock.acquire()
          except exceptions.AlreadyLocked:
              self.lock = None
          else:
              logger.debug("locked %r", filename)
              return True
  
      return False
  
imports: import abc
  import atexit
  import contextlib
  import logging
  import os
  import pathlib
  import random
  import tempfile
  import time
  import typing
  import warnings
  from .None import constants, exceptions, portalocker
label_desc: Use image node_id 6 for calling the BoundedSemaphore obj's underlying member method code with example usage: obj.try_lock(filenames) and returns: False, True