parameters: (self, rosdep_args)
return_statement: return resolution
docstring: See :meth:`Installer.resolve()`
docstring_summary: See :meth:`Installer.resolve()`
docstring_tokens: See : meth : Installer . resolve ()
function: def resolve(self, rosdep_args):
          """
          See :meth:`Installer.resolve()`
          """
  
          def coerce_to_list(options):
              if isinstance(options, list):
                  return options
              elif isinstance(options, _basestring):
                  return options.split()
              else:
                  raise InvalidData("Expected list or string for options '%s'" % options)
  
          def handle_options(options):
              # if only one package is specified we allow a flat list of options
              if len(packages) == 1 and options and not isinstance(options[0],list):
                  options = [options]
              else:
                  options = list(map(coerce_to_list, options))
  
              # make sure options is a list of list of strings
              try:
                  valid = all([isinstance(x, _basestring) for l in options for x in l])
              except Exception as e:
                  raise InvalidData("Invalid list of options '%s', error: %s" % (options, e))
              else:
                  if not valid:
                      raise InvalidData("Invalid list of options '%s'" % options)
  
              # allow only fewer or equal number of option lists
              if len(options) > len(packages):
                  raise InvalidData("More options '%s' than packages '%s'" % (options, packages))
              else:
                  options.extend([[]] * (len(packages) - len(options)))
  
              return options
  
          packages = super(HomebrewInstaller, self).resolve(rosdep_args)
          resolution = []
          if packages:
              options = []
              install_flags = []
              if type(rosdep_args) == dict:
                  options = coerce_to_list(rosdep_args.get("options", []))
                  install_flags = coerce_to_list(rosdep_args.get("install_flags", []))
  
              options = handle_options(options)
              install_flags = handle_options(install_flags)
  
              # packages, options and install_flags now have the same length
              resolution = map(HomebrewResolution, packages, install_flags, options)
          return resolution
function_tokens: def resolve ( self , rosdep_args ) : def coerce_to_list ( options ) : if isinstance ( options , list ) : return options elif isinstance ( options , _basestring ) : return options . split ( ) else : raise InvalidData ( "Expected list or string for options '%s'" % options ) def handle_options ( options ) : # if only one package is specified we allow a flat list of options if len ( packages ) == 1 and options and not isinstance ( options [ 0 ] , list ) : options = [ options ] else : options = list ( map ( coerce_to_list , options ) ) # make sure options is a list of list of strings try : valid = all ( [ isinstance ( x , _basestring ) for l in options for x in l ] ) except Exception as e : raise InvalidData ( "Invalid list of options '%s', error: %s" % ( options , e ) ) else : if not valid : raise InvalidData ( "Invalid list of options '%s'" % options ) # allow only fewer or equal number of option lists if len ( options ) > len ( packages ) : raise InvalidData ( "More options '%s' than packages '%s'" % ( options , packages ) ) else : options . extend ( [ [ ] ] * ( len ( packages ) - len ( options ) ) ) return options packages = super ( HomebrewInstaller , self ) . resolve ( rosdep_args ) resolution = [ ] if packages : options = [ ] install_flags = [ ] if type ( rosdep_args ) == dict : options = coerce_to_list ( rosdep_args . get ( "options" , [ ] ) ) install_flags = coerce_to_list ( rosdep_args . get ( "install_flags" , [ ] ) ) options = handle_options ( options ) install_flags = handle_options ( install_flags ) # packages, options and install_flags now have the same length resolution = map ( HomebrewResolution , packages , install_flags , options ) return resolution