Robot Framework
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_pythonpath='DEPRECATED', 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_default_opts (self)
 
def _get_env_options (self)
 
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 _split_pythonpath (self, paths)
 
def _verify_long_not_already_used (self, opt, flag=False)
 

Private Attributes

 _arg_limit_validator
 
 _auto_argumentfile
 
 _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
 

Detailed Description

Definition at line 47 of file argumentparser.py.

Constructor & Destructor Documentation

◆ __init__()

def 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_pythonpath = 'DEPRECATED',
  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 64 of file argumentparser.py.

Member Function Documentation

◆ _create_option()

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

Definition at line 243 of file argumentparser.py.

◆ _create_options()

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

Definition at line 234 of file argumentparser.py.

◆ _get_default_opts()

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

Definition at line 208 of file argumentparser.py.

◆ _get_env_options()

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

Definition at line 149 of file argumentparser.py.

◆ _get_name()

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

Definition at line 227 of file argumentparser.py.

◆ _get_pythonpath()

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

Definition at line 271 of file argumentparser.py.

◆ _glob_args()

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

Definition at line 217 of file argumentparser.py.

◆ _handle_special_options()

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

Definition at line 156 of file argumentparser.py.

◆ _lowercase_long_option()

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

Definition at line 179 of file argumentparser.py.

◆ _parse_args()

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

Definition at line 171 of file argumentparser.py.

◆ _process_opts()

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

Definition at line 194 of file argumentparser.py.

◆ _process_possible_argfile()

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

Definition at line 187 of file argumentparser.py.

◆ _raise_help()

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

Definition at line 304 of file argumentparser.py.

◆ _raise_option_multiple_times_in_usage()

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

Definition at line 313 of file argumentparser.py.

◆ _raise_version()

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

Definition at line 310 of file argumentparser.py.

◆ _split_pythonpath()

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

Definition at line 279 of file argumentparser.py.

◆ _verify_long_not_already_used()

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

Definition at line 262 of file argumentparser.py.

◆ parse_args()

def 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:

    --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.
    This functionality was deprecated in Robot Framework 5.0.

    --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. Both help and version are wrapped to Information
    exception.

Definition at line 134 of file argumentparser.py.

Member Data Documentation

◆ _arg_limit_validator

robot.utils.argumentparser.ArgumentParser._arg_limit_validator
private

Definition at line 73 of file argumentparser.py.

◆ _auto_argumentfile

robot.utils.argumentparser.ArgumentParser._auto_argumentfile
private

Definition at line 84 of file argumentparser.py.

◆ _auto_help

robot.utils.argumentparser.ArgumentParser._auto_help
private

Definition at line 75 of file argumentparser.py.

◆ _auto_pythonpath

robot.utils.argumentparser.ArgumentParser._auto_pythonpath
private

Definition at line 83 of file argumentparser.py.

◆ _auto_version

robot.utils.argumentparser.ArgumentParser._auto_version
private

Definition at line 76 of file argumentparser.py.

◆ _env_options

robot.utils.argumentparser.ArgumentParser._env_options
private

Definition at line 85 of file argumentparser.py.

◆ _expected_args

robot.utils.argumentparser.ArgumentParser._expected_args
private

Definition at line 91 of file argumentparser.py.

◆ _flag_opts

robot.utils.argumentparser.ArgumentParser._flag_opts
private

Definition at line 89 of file argumentparser.py.

◆ _long_opts

robot.utils.argumentparser.ArgumentParser._long_opts
private

Definition at line 87 of file argumentparser.py.

◆ _multi_opts

robot.utils.argumentparser.ArgumentParser._multi_opts
private

Definition at line 88 of file argumentparser.py.

◆ _opt_line_re

robot.utils.argumentparser.ArgumentParser._opt_line_re
staticprivate

Definition at line 51 of file argumentparser.py.

◆ _short_opts

robot.utils.argumentparser.ArgumentParser._short_opts
private

Definition at line 86 of file argumentparser.py.

◆ _short_to_long

robot.utils.argumentparser.ArgumentParser._short_to_long
private

Definition at line 90 of file argumentparser.py.

◆ _usage

robot.utils.argumentparser.ArgumentParser._usage
private

Definition at line 72 of file argumentparser.py.

◆ _validator

robot.utils.argumentparser.ArgumentParser._validator
private

Definition at line 74 of file argumentparser.py.

◆ name

robot.utils.argumentparser.ArgumentParser.name

Definition at line 70 of file argumentparser.py.

◆ version

robot.utils.argumentparser.ArgumentParser.version

Definition at line 71 of file argumentparser.py.


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