#NEWLINE# def __enter__( self ) : #NEWLINE# #INDENT# startedAt = time . time ( ) #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if os . path . exists ( self . lockDirPath ) : #NEWLINE# #INDENT# raise FileExistsError ( self . lockDirPath ) #NEWLINE# #UNINDENT# os . mkdir ( self . lockDirPath ) #NEWLINE# break #NEWLINE# #UNINDENT# except FileExistsError : #NEWLINE# #INDENT# if ( ( self . waitTimeout == 0 ) or ( ( time . time ( ) - startedAt ) < self . waitTimeout ) ) : #NEWLINE# #INDENT# time . sleep ( self . waitInterval ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise DirLockTimeoutException ( )