Robot Framework Integrated Development Environment (RIDE)
robotide.lib.robot.utils.argumentparser.ArgumentParser Class Reference

Public Member Functions

def __init__ (self, usage, name=None, version=None, arg_limits=None, validator=None, env_options=None, auto_help=True, auto_version=True, auto_escape=True, auto_pythonpath=True, auto_argumentfile=True)
 Available options and tool name are read from the usage. More...
 
def parse_args (self, args)
 Parse given arguments and return options and positional arguments. More...
 

Public Attributes

 name
 
 version
 

Private Member Functions

def _create_option (self, short_opts, long_opt, takes_arg, is_multi)
 
def _create_options (self, usage)
 
def _get_available_escapes (self)
 
def _get_default_opts (self)
 
def _get_env_options (self)
 
def _get_escapes (self, escape_strings)
 
def _get_name (self, name)
 
def _get_pythonpath (self, paths)
 
def _glob_args (self, args)
 
def _handle_special_options (self, opts, args)
 
def _lowercase_long_option (self, opt)
 
def _parse_args (self, args)
 
def _process_opts (self, opt_tuple)
 
def _process_possible_argfile (self, args)
 
def _raise_help (self)
 
def _raise_option_multiple_times_in_usage (self, opt)
 
def _raise_version (self)
 
def _save_filenames (self, args)
 
def _split_pythonpath (self, paths)
 
def _unescape (self, value, escapes)
 
def _unescape_opts_and_args (self, opts, args)
 
def _verify_long_not_already_used (self, opt, flag=False)
 

Private Attributes

 _arg_limit_validator
 
 _auto_argumentfile
 
 _auto_escape
 
 _auto_help
 
 _auto_pythonpath
 
 _auto_version
 
 _env_options
 
 _expected_args
 
 _flag_opts
 
 _long_opts
 
 _multi_opts
 
 _short_opts
 
 _short_to_long
 
 _usage
 
 _validator
 

Static Private Attributes

 _opt_line_re
 
 _quotes_re
 

Detailed Description

Definition at line 62 of file argumentparser.py.

Constructor & Destructor Documentation

◆ __init__()

def robotide.lib.robot.utils.argumentparser.ArgumentParser.__init__ (   self,
  usage,
  name = None,
  version = None,
  arg_limits = None,
  validator = None,
  env_options = None,
  auto_help = True,
  auto_version = True,
  auto_escape = True,
  auto_pythonpath = True,
  auto_argumentfile = True 
)

Available options and tool name are read from the usage.

    Tool name is got from the first row of the usage. It is either the
    whole row or anything before first ' -- '.

Definition at line 84 of file argumentparser.py.

Member Function Documentation

◆ _create_option()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._create_option (   self,
  short_opts,
  long_opt,
  takes_arg,
  is_multi 
)
private

Definition at line 352 of file argumentparser.py.

◆ _create_options()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._create_options (   self,
  usage 
)
private

Definition at line 343 of file argumentparser.py.

◆ _get_available_escapes()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._get_available_escapes (   self)
private

Definition at line 413 of file argumentparser.py.

◆ _get_default_opts()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._get_default_opts (   self)
private

Definition at line 317 of file argumentparser.py.

◆ _get_env_options()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._get_env_options (   self)
private

Definition at line 173 of file argumentparser.py.

◆ _get_escapes()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._get_escapes (   self,
  escape_strings 
)
private

Definition at line 278 of file argumentparser.py.

◆ _get_name()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._get_name (   self,
  name 
)
private

Definition at line 336 of file argumentparser.py.

◆ _get_pythonpath()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._get_pythonpath (   self,
  paths 
)
private

Definition at line 380 of file argumentparser.py.

◆ _glob_args()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._glob_args (   self,
  args 
)
private

Definition at line 326 of file argumentparser.py.

◆ _handle_special_options()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._handle_special_options (   self,
  opts,
  args 
)
private

Definition at line 180 of file argumentparser.py.

◆ _lowercase_long_option()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._lowercase_long_option (   self,
  opt 
)
private

Definition at line 248 of file argumentparser.py.

◆ _parse_args()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._parse_args (   self,
  args 
)
private

Definition at line 240 of file argumentparser.py.

◆ _process_opts()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._process_opts (   self,
  opt_tuple 
)
private

Definition at line 303 of file argumentparser.py.

◆ _process_possible_argfile()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._process_possible_argfile (   self,
  args 
)
private

Definition at line 271 of file argumentparser.py.

◆ _raise_help()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._raise_help (   self)
private

Definition at line 417 of file argumentparser.py.

◆ _raise_option_multiple_times_in_usage()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._raise_option_multiple_times_in_usage (   self,
  opt 
)
private

Definition at line 432 of file argumentparser.py.

◆ _raise_version()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._raise_version (   self)
private

Definition at line 429 of file argumentparser.py.

◆ _save_filenames()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._save_filenames (   self,
  args 
)
private

Definition at line 198 of file argumentparser.py.

◆ _split_pythonpath()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._split_pythonpath (   self,
  paths 
)
private

Definition at line 388 of file argumentparser.py.

◆ _unescape()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._unescape (   self,
  value,
  escapes 
)
private

Definition at line 293 of file argumentparser.py.

◆ _unescape_opts_and_args()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._unescape_opts_and_args (   self,
  opts,
  args 
)
private

Definition at line 256 of file argumentparser.py.

◆ _verify_long_not_already_used()

def robotide.lib.robot.utils.argumentparser.ArgumentParser._verify_long_not_already_used (   self,
  opt,
  flag = False 
)
private

Definition at line 371 of file argumentparser.py.

◆ parse_args()

def robotide.lib.robot.utils.argumentparser.ArgumentParser.parse_args (   self,
  args 
)

Parse given arguments and return options and positional arguments.

    Arguments must be given as a list and are typically sys.argv[1:].

    Options are returned as a dictionary where long options are keys. Value
    is a string for those options that can be given only one time (if they
    are given multiple times the last value is used) or None if the option
    is not used at all. Value for options that can be given multiple times
    (denoted with '*' in the usage) is a list which contains all the given
    values and is empty if options are not used. Options not taken
    arguments have value False when they are not set and True otherwise.

    Positional arguments are returned as a list in the order they are given.

    If 'check_args' is True, this method will automatically check that
    correct number of arguments, as parsed from the usage line, are given.
    If the last argument in the usage line ends with the character 's',
    the maximum number of arguments is infinite.

    Possible errors in processing arguments are reported using DataError.

    Some options have a special meaning and are handled automatically
    if defined in the usage and given from the command line:

    --escape option can be used to automatically unescape problematic
    characters given in an escaped format.

    --argumentfile can be used to automatically read arguments from
    a specified file. When --argumentfile is used, the parser always
    allows using it multiple times. Adding '*' to denote that is thus
    recommend. A special value 'stdin' can be used to read arguments from
    stdin instead of a file.

    --pythonpath can be used to add extra path(s) to sys.path.

    --help and --version automatically generate help and version messages.
    Version is generated based on the tool name and version -- see __init__
    for information how to set them. Help contains the whole usage given to
    __init__. Possible <VERSION> text in the usage is replaced with the
    given version. Possible <--ESCAPES--> is replaced with available
    escapes so that they are wrapped to multiple lines but take the same
    amount of horizontal space as <---ESCAPES--->. Both help and version
    are wrapped to Information exception.

Definition at line 153 of file argumentparser.py.

Member Data Documentation

◆ _arg_limit_validator

robotide.lib.robot.utils.argumentparser.ArgumentParser._arg_limit_validator
private

Definition at line 93 of file argumentparser.py.

◆ _auto_argumentfile

robotide.lib.robot.utils.argumentparser.ArgumentParser._auto_argumentfile
private

Definition at line 99 of file argumentparser.py.

◆ _auto_escape

robotide.lib.robot.utils.argumentparser.ArgumentParser._auto_escape
private

Definition at line 97 of file argumentparser.py.

◆ _auto_help

robotide.lib.robot.utils.argumentparser.ArgumentParser._auto_help
private

Definition at line 95 of file argumentparser.py.

◆ _auto_pythonpath

robotide.lib.robot.utils.argumentparser.ArgumentParser._auto_pythonpath
private

Definition at line 98 of file argumentparser.py.

◆ _auto_version

robotide.lib.robot.utils.argumentparser.ArgumentParser._auto_version
private

Definition at line 96 of file argumentparser.py.

◆ _env_options

robotide.lib.robot.utils.argumentparser.ArgumentParser._env_options
private

Definition at line 100 of file argumentparser.py.

◆ _expected_args

robotide.lib.robot.utils.argumentparser.ArgumentParser._expected_args
private

Definition at line 106 of file argumentparser.py.

◆ _flag_opts

robotide.lib.robot.utils.argumentparser.ArgumentParser._flag_opts
private

Definition at line 104 of file argumentparser.py.

◆ _long_opts

robotide.lib.robot.utils.argumentparser.ArgumentParser._long_opts
private

Definition at line 102 of file argumentparser.py.

◆ _multi_opts

robotide.lib.robot.utils.argumentparser.ArgumentParser._multi_opts
private

Definition at line 103 of file argumentparser.py.

◆ _opt_line_re

robotide.lib.robot.utils.argumentparser.ArgumentParser._opt_line_re
staticprivate

Definition at line 66 of file argumentparser.py.

◆ _quotes_re

robotide.lib.robot.utils.argumentparser.ArgumentParser._quotes_re
staticprivate

Definition at line 77 of file argumentparser.py.

◆ _short_opts

robotide.lib.robot.utils.argumentparser.ArgumentParser._short_opts
private

Definition at line 101 of file argumentparser.py.

◆ _short_to_long

robotide.lib.robot.utils.argumentparser.ArgumentParser._short_to_long
private

Definition at line 105 of file argumentparser.py.

◆ _usage

robotide.lib.robot.utils.argumentparser.ArgumentParser._usage
private

Definition at line 92 of file argumentparser.py.

◆ _validator

robotide.lib.robot.utils.argumentparser.ArgumentParser._validator
private

Definition at line 94 of file argumentparser.py.

◆ name

robotide.lib.robot.utils.argumentparser.ArgumentParser.name

Definition at line 90 of file argumentparser.py.

◆ version

robotide.lib.robot.utils.argumentparser.ArgumentParser.version

Definition at line 91 of file argumentparser.py.


The documentation for this class was generated from the following file: