<s> import errno <EOL> import inspect <EOL> from functools import wraps <EOL> from six import string_types <EOL> from fuse import FuseOSError <EOL> class not_in ( object ) : <EOL> def __init__ ( self , look_at , check = None ) : <EOL> self . look_at = look_at <EOL> self . check = check <EOL> def __call__ ( self , f ) : <EOL> @ wraps ( f ) <EOL> def decorated ( their_self , * args , ** kwargs ) : <EOL> if isinstance ( self . look_at , string_types ) : <EOL> self . look_at = getattr ( their_self , self . look_at ) <EOL> self . check_args ( f , args ) <EOL> result = f ( their_self , * args , ** kwargs ) <EOL> return result <EOL> return decorated <EOL> def check_args ( self , f , methods_args ) : <EOL> to_check = [ ] <EOL> args = inspect . getargspec ( f ) <EOL> for arg in self . check : <EOL> if arg in args [ <NUM_LIT:0> ] : <EOL> to_check . append ( args [ <NUM_LIT:0> ] . index ( arg ) ) <EOL> for index in to_check : <EOL> arg = methods_args [ index - <NUM_LIT:1> ] <EOL> if self . look_at . cache . get ( arg , False ) : <EOL> raise FuseOSError ( errno . EACCES ) <EOL> if self . look_at . check_key ( arg ) : <EOL> self . look_at . cache [ arg ] = True <EOL> raise FuseOSError ( errno . ENOENT ) <EOL> self . look_at . cache [ arg ] = False </s>
