parameters: (self, path, threaded=True, timeout=None)
docstring: >>> lock = LockBase('somefile')
          >>> lock = LockBase('somefile', threaded=False)
docstring_summary: >>> lock = LockBase('somefile')
          >>> lock = LockBase('somefile', threaded=False)
docstring_tokens: >>> lock = LockBase ( somefile ) >>> lock = LockBase ( somefile threaded = False )
function: def __init__(self, path, threaded=True, timeout=None):
          """
          >>> lock = LockBase('somefile')
          >>> lock = LockBase('somefile', threaded=False)
          """
          self.path = path
          self.lock_file = os.path.abspath(path) + ".lock"
          self.hostname = socket.gethostname()
          self.pid = os.getpid()
          if threaded:
              t = threading.current_thread()
              # Thread objects in Python 2.4 and earlier do not have ident
              # attrs.  Worm around that.
              ident = getattr(t, "ident", hash(t))
              self.tname = "-%x" % (ident & 0xffffffff)
          else:
              self.tname = ""
          dirname = os.path.dirname(self.lock_file)
  
          # unique name is mostly about the current process, but must
          # also contain the path -- otherwise, two adjacent locked
          # files conflict (one file gets locked, creating lock-file and
          # unique file, the other one gets locked, creating lock-file
          # and overwriting the already existing lock-file, then one
          # gets unlocked, deleting both lock-file and unique file,
          # finally the last lock errors out upon releasing.
          self.unique_name = os.path.join(dirname,
                                          "%s%s.%s%s" % (self.hostname,
                                                         self.tname,
                                                         self.pid,
                                                         hash(self.path)))
          self.timeout = timeout
function_tokens: def __init__ ( self , path , threaded = True , timeout = None ) : self . path = path self . lock_file = os . path . abspath ( path ) + ".lock" self . hostname = socket . gethostname ( ) self . pid = os . getpid ( ) if threaded : t = threading . current_thread ( ) # Thread objects in Python 2.4 and earlier do not have ident # attrs.  Worm around that. ident = getattr ( t , "ident" , hash ( t ) ) self . tname = "-%x" % ( ident & 0xffffffff ) else : self . tname = "" dirname = os . path . dirname ( self . lock_file ) # unique name is mostly about the current process, but must # also contain the path -- otherwise, two adjacent locked # files conflict (one file gets locked, creating lock-file and # unique file, the other one gets locked, creating lock-file # and overwriting the already existing lock-file, then one # gets unlocked, deleting both lock-file and unique file, # finally the last lock errors out upon releasing. self . unique_name = os . path . join ( dirname , "%s%s.%s%s" % ( self . hostname , self . tname , self . pid , hash ( self . path ) ) ) self . timeout = timeout