def flagFunction(method, name=None):
 if _PY3:
  reqArgs = len(inspect.signature(method).parameters)
  if (reqArgs > 1):
   raise UsageError(('Invalid Option function for %s' % (name or method.__name__)))
  if (reqArgs == 1):
   return False
 else:
  reqArgs = len(inspect.getargspec(method).args)
  if (reqArgs > 2):
   raise UsageError(('Invalid Option function for %s' % (name or method.__name__)))
  if (reqArgs == 2):
   return False
 return True

def flagFunction ( method , name = None ) : if _PY3 : reqArgs = len ( inspect . signature ( method ) . parameters ) if ( reqArgs > 1 ) : raise UsageError ( ( 'Invalid Option function for %s' % ( name or method . __name__ ) ) ) if ( reqArgs == 1 ) : return False else : reqArgs = len ( inspect . getargspec ( method ) . args ) if ( reqArgs > 2 ) : raise UsageError ( ( 'Invalid Option function for %s' % ( name or method . __name__ ) ) ) if ( reqArgs == 2 ) : return False return True
determine whether a function is an optional handler for a i{flag} or an i{option} .