<s> """<STR_LIT>""" <EOL> class MockClient ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , wconfdmock ) : <EOL> self . wconfdmock = wconfdmock <EOL> def TryUpdateLocks ( self , _cid , req ) : <EOL> for lockrq in req : <EOL> if lockrq [ <NUM_LIT:1> ] == "<STR_LIT>" : <EOL> if lockrq [ <NUM_LIT:0> ] in self . wconfdmock . mylocks : <EOL> del self . wconfdmock . mylocks [ lockrq [ <NUM_LIT:0> ] ] <EOL> else : <EOL> self . wconfdmock . mylocks [ lockrq [ <NUM_LIT:0> ] ] = lockrq [ <NUM_LIT:1> ] <EOL> self . wconfdmock . all_locks [ lockrq [ <NUM_LIT:0> ] ] = lockrq [ <NUM_LIT:1> ] <EOL> return [ ] <EOL> def UpdateLocksWaiting ( self , cid , _prio , req ) : <EOL> return self . TryUpdateLocks ( cid , req ) <EOL> def HasPendingRequest ( self , _cid ) : <EOL> return False <EOL> def ListLocks ( self , * _ ) : <EOL> result = [ ] <EOL> for lock in self . wconfdmock . mylocks : <EOL> result . append ( [ lock , self . wconfdmock . mylocks [ lock ] ] ) <EOL> return result <EOL> def FreeLocksLevel ( self , _cid , level ) : <EOL> locks = self . wconfdmock . mylocks . keys ( ) <EOL> for lock in locks : <EOL> if lock . startswith ( level + "<STR_LIT:/>" ) : <EOL> del self . wconfdmock . mylocks [ lock ] <EOL> def OpportunisticLockUnion ( self , _cid , req ) : <EOL> for lockrq in req : <EOL> self . wconfdmock . mylocks [ lockrq [ <NUM_LIT:0> ] ] = lockrq [ <NUM_LIT:1> ] <EOL> return [ lockrq [ <NUM_LIT:0> ] for lockrq in req ] <EOL> def PrepareClusterDestruction ( self , _cid ) : <EOL> pass <EOL> class WConfdMock ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> self . mylocks = { } <EOL> self . all_locks = { } <EOL> def Client ( self ) : <EOL> return MockClient ( self ) </s>
