Your IP : 216.73.216.134


Current Path : /opt/rh/rh-python35/root/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/rh/rh-python35/root/lib64/python3.5/__pycache__/argparse.cpython-35.pyc



���\`�@sdZdZdddddddd	d
ddd
dddddgZddlZddlZddlZddl	Z
ddlZddl
ZddlmZmZdZdZdZdZdZdZdZGdd�de�Zdd �ZGd!d�de�ZGd"d�de�ZGd#d	�d	e�ZGd$d�de�ZGd%d
�d
e�Z d&d'�Z!Gd(d�de"�Z#Gd)d�de"�Z$Gd*d�de�Z%Gd+d,�d,e%�Z&Gd-d.�d.e%�Z'Gd/d0�d0e'�Z(Gd1d2�d2e'�Z)Gd3d4�d4e%�Z*Gd5d6�d6e%�Z+Gd7d8�d8e%�Z,Gd9d:�d:e%�Z-Gd;d<�d<e%�Z.Gd=d>�d>e%�Z/Gd?d�de�Z0Gd@d�de�Z1GdAdB�dBe�Z2GdCdD�dDe2�Z3GdEdF�dFe3�Z4GdGd�dee2�Z5dS)Ha�
Command-line parsing library

This module is an optparse-inspired command-line parsing library that:

    - handles both optional and positional arguments
    - produces highly informative usage messages
    - supports parsers that dispatch to sub-parsers

The following is a simple usage example that sums integers from the
command-line and writes the result to a file::

    parser = argparse.ArgumentParser(
        description='sum the integers at the command line')
    parser.add_argument(
        'integers', metavar='int', nargs='+', type=int,
        help='an integer to be summed')
    parser.add_argument(
        '--log', default=sys.stdout, type=argparse.FileType('w'),
        help='the file where the sum should be written')
    args = parser.parse_args()
    args.log.write('%s' % sum(args.integers))
    args.log.close()

The module contains the following public classes:

    - ArgumentParser -- The main entry point for command-line parsing. As the
        example above shows, the add_argument() method is used to populate
        the parser with actions for optional and positional arguments. Then
        the parse_args() method is invoked to convert the args at the
        command-line into an object with attributes.

    - ArgumentError -- The exception raised by ArgumentParser objects when
        there are errors with the parser's actions. Errors raised while
        parsing the command-line are caught by ArgumentParser and emitted
        as command-line messages.

    - FileType -- A factory for defining types of files to be created. As the
        example above shows, instances of FileType are typically passed as
        the type= argument of add_argument() calls.

    - Action -- The base class for parser actions. Typically actions are
        selected by passing strings like 'store_true' or 'append_const' to
        the action= argument of add_argument(). However, for greater
        customization of ArgumentParser actions, subclasses of Action may
        be defined and passed as the action= argument.

    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
        ArgumentDefaultsHelpFormatter -- Formatter classes which
        may be passed as the formatter_class= argument to the
        ArgumentParser constructor. HelpFormatter is the default,
        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
        not to change the formatting for help text, and
        ArgumentDefaultsHelpFormatter adds information about argument defaults
        to the help.

All other classes in this module are considered implementation details.
(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
considered public as object names -- the API of the formatter objects is
still considered an implementation detail.)
z1.1�ArgumentParser�
ArgumentError�ArgumentTypeError�FileType�
HelpFormatter�ArgumentDefaultsHelpFormatter�RawDescriptionHelpFormatter�RawTextHelpFormatter�MetavarTypeHelpFormatter�	Namespace�Action�ONE_OR_MORE�OPTIONAL�PARSER�	REMAINDER�SUPPRESS�ZERO_OR_MORE�N)�gettext�ngettextz==SUPPRESS==�?�*�+zA...z...Z_unrecognized_argsc@s:eZdZdZdd�Zdd�Zdd�ZdS)	�_AttributeHolderaAbstract base class that provides __repr__.

    The __repr__ method returns a string in the format::
        ClassName(attr=name, attr=name, ...)
    The attributes are determined either by a class-level attribute,
    '_kwarg_names', or by inspecting the instance __dict__.
    cCs�t|�j}g}x'|j�D]}|jt|��q"Wx1|j�D]#\}}|jd||f�qLWd|dj|�fS)Nz%s=%rz%s(%s)z, )�type�__name__�	_get_args�append�repr�_get_kwargs�join)�selfZ	type_name�arg_strings�arg�name�value�r%�8/opt/rh/rh-python35/root/usr/lib64/python3.5/argparse.py�__repr__vsz_AttributeHolder.__repr__cCst|jj��S)N)�sorted�__dict__�items)r r%r%r&rsz_AttributeHolder._get_kwargscCsgS)Nr%)r r%r%r&r�sz_AttributeHolder._get_argsN)r�
__module__�__qualname__�__doc__r'rrr%r%r%r&rms	rcCs5t||d�dkr(t|||�t||�S)N)�getattr�setattr)�	namespacer#r$r%r%r&�
_ensure_value�sr1c@speZdZdZddddd�Zdd�Zd	d
�ZGdd�de�Zd
d�Z	dd�Z
dd�Zdd�Zddd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS);rz�Formatter for generating usage messages and argument help strings.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    ��NcCs�|dkrNyttjd�}Wnttfk
rCd}YnX|d8}||_||_||_t|t	|d|d��|_||_
d|_d|_d|_
|j|d�|_|j|_tjd�|_tjd�|_dS)NZCOLUMNS�Pr2�rz\s+z\n\n\n+)�int�_os�environ�KeyError�
ValueError�_prog�_indent_increment�_max_help_position�min�max�_width�_current_indent�_level�_action_max_length�_Section�
_root_section�_current_section�_re�compile�_whitespace_matcher�_long_break_matcher)r �progZindent_incrementZmax_help_position�widthr%r%r&�__init__�s&
							zHelpFormatter.__init__cCs%|j|j7_|jd7_dS)N�)rAr<rB)r r%r%r&�_indent�szHelpFormatter._indentcCs@|j|j8_|jdks-td��|jd8_dS)NrzIndent decreased below 0.rN)rAr<�AssertionErrorrB)r r%r%r&�_dedent�szHelpFormatter._dedentc@s+eZdZddd�Zdd�ZdS)zHelpFormatter._SectionNcCs(||_||_||_g|_dS)N)�	formatter�parent�headingr*)r rRrSrTr%r%r&rM�s			zHelpFormatter._Section.__init__cCs�|jdk	r|jj�|jj}x!|jD]\}}||�q2W|dd�|jD��}|jdk	r�|jj�|s�dS|jtk	r�|jdk	r�|jj}d|d|jf}nd}|d||dg�S)NcSs"g|]\}}||��qSr%r%)�.0�func�argsr%r%r&�
<listcomp>�s	z6HelpFormatter._Section.format_help.<locals>.<listcomp>�z%*s%s:
�
)	rSrRrO�_join_partsr*rQrTrrA)r rrVrWZ	item_helpZcurrent_indentrTr%r%r&�format_help�s

z"HelpFormatter._Section.format_help)rr+r,rMr\r%r%r%r&rD�srDcCs|jjj||f�dS)N)rFr*r)r rVrWr%r%r&�	_add_item�szHelpFormatter._add_itemcCsB|j�|j||j|�}|j|jg�||_dS)N)rOrDrFr]r\)r rTZsectionr%r%r&�
start_section�s
zHelpFormatter.start_sectioncCs|jj|_|j�dS)N)rFrSrQ)r r%r%r&�end_section�szHelpFormatter.end_sectioncCs2|tk	r.|dk	r.|j|j|g�dS)N)rr]�_format_text)r �textr%r%r&�add_text�szHelpFormatter.add_textcCs5|tk	r1||||f}|j|j|�dS)N)rr]�
_format_usage)r �usage�actions�groups�prefixrWr%r%r&�	add_usage�szHelpFormatter.add_usagecCs�|jtk	r�|j}||�g}x*|j|�D]}|j||��q7Wtdd�|D��}||j}t|j|�|_|j|j	|g�dS)NcSsg|]}t|��qSr%)�len)rU�sr%r%r&rXs	z.HelpFormatter.add_argument.<locals>.<listcomp>)
�helpr�_format_action_invocation�_iter_indented_subactionsrr?rArCr]�_format_action)r �actionZget_invocationZinvocations�	subactionZinvocation_lengthZ
action_lengthr%r%r&�add_argument�s	
	zHelpFormatter.add_argumentcCs"x|D]}|j|�qWdS)N)rq)r reror%r%r&�
add_argumentss
zHelpFormatter.add_argumentscCsA|jj�}|r=|jjd|�}|jd�d}|S)Nz

rZ)rEr\rJ�sub�strip)r rkr%r%r&r\s
zHelpFormatter.format_helpcCsdjdd�|D��S)NrYcSs(g|]}|r|tk	r|�qSr%)r)rU�partr%r%r&rXs	z-HelpFormatter._join_parts.<locals>.<listcomp>)r)r Zpart_stringsr%r%r&r[szHelpFormatter._join_partscs|dkrtd�}|dk	r=|td|j�}n�|dkri|ridtd|j�}n�|dkr�dtd|j�}g}g}x4|D],}|jr�|j|�q�|j|�q�W|j}	|	|||�}
djdd�||
gD��}|j|j�t	|�t	|��kr�d}|	||�}|	||�}
t
j||�}t
j||
�}dj|�|ks�t�dj|�|
ks�t�d�fdd	�}t	|�t	|�d
�krodt	|�t	|�d}|rA||g|||�}|j
|||��q�|rc||g|||�}q�|g}nzdt	|�}||}|||�}t	|�dkr�g}|j
|||��|j
|||��|g|}dj|�}d
||fS)Nzusage: rKz%(prog)s� cSsg|]}|r|�qSr%r%)rUrjr%r%r&rX=s	z/HelpFormatter._format_usage.<locals>.<listcomp>z\(.*?\)+|\[.*?\]+|\S+csg}g}|dk	r+t|�d}nt|�d}x|D]w}|dt|��kr�|r�|j|dj|��g}t|�d}|j|�|t|�d7}qBW|r�|j|dj|��|dk	r|dt|�d�|d<|S)NrNrvr)rirr)�parts�indentrg�lines�lineZline_lenru)�
text_widthr%r&�	get_linesMs"
 
z.HelpFormatter._format_usage.<locals>.get_linesg�?rNrZz%s%s

)�_�dictr;�option_stringsr�_format_actions_usagerr@rArirG�findallrP�extend)r rdrerfrgrKZ	optionals�positionalsro�formatZaction_usageZpart_regexpZ	opt_usageZ	pos_usageZ	opt_partsZ	pos_partsr|rxryrwr%)r{r&rc!sZ
		" 

zHelpFormatter._format_usagec
Cs�t�}i}x#|D]}y|j|jd�}Wntk
rMwYqX|t|j�}|||�|jkrx|jD]}|j|�q�W|js�||kr�||d7<n
d||<d||<n1||kr�||d7<n
d||<d||<x%t|d|�D]}	d	||	<qWqWg}
x�t|�D]w\}	}|j	t
kr�|
jd�|j|	�d	kr�|j
|	�q�|j|	d�d	kr�|j
|	d�qH|js8|j|�}|j||�}||kr(|ddkr(|ddkr(|dd�}|
j|�qH|jd}
|jdkrad
|
}n1|j|�}|j||�}d|
|f}|jr�||kr�d|}|
j|�qHWx1t|d
d�D]}	||	g|
|	|	�<q�Wdjdd�|
D��}d}d}tjd|d|�}tjd|d|�}tjd||fd|�}tjdd|�}|j�}|S)Nrz [�[�]z (�(�)rN�|z%sz%s %sz[%s]�reverseTrvcSs"g|]}|dk	r|�qS)Nr%)rU�itemr%r%r&rX�s	z7HelpFormatter._format_actions_usage.<locals>.<listcomp>z[\[(]z[\])]z(%s) z\1z (%s)z%s *%srYz\(([^|]*)\)���r�)�set�index�_group_actionsr:ri�add�required�range�	enumeraterkrr�get�popr�#_get_default_metavar_for_positional�_format_args�nargs�!_get_default_metavar_for_optionalr(rrGrsrt)r rerf�
group_actionsZinserts�group�start�endro�irw�defaultru�
option_string�args_stringra�open�closer%r%r&r�}sr	

	




	 


z#HelpFormatter._format_actions_usagecCs_d|kr"|td|j�}t|j|jd�}d|j}|j|||�dS)Nz%(prog)rK�rvz

)r~r;r?r@rA�
_fill_text)r rar{rxr%r%r&r`�s

zHelpFormatter._format_textc
Cs�t|jd|j�}t|j|d�}||jd}|j|�}|jsw|jd|f}d|}n\t|�|kr�|jd||f}d|}d}n"|jd|f}d|}|}|g}|jr\|j	|�}	|j
|	|�}
|jd|d|
df�xQ|
dd�D] }|jd|d|f�q5Wn|jd�sx|jd�x-|j
|�D]}|j|j|��q�W|j|�S)	Nr2r�rYz%*s%s
z	%*s%-*s  rrNrZ)r>rCr=r?r@rArlrkri�_expand_help�_split_linesr�endswithrmrnr[)
r roZ
help_positionZ
help_widthZaction_widthZ
action_header�tupZindent_firstrwZ	help_textZ
help_linesrzrpr%r%r&rn�s6
	

	
		!
zHelpFormatter._format_actioncCs�|js7|j|�}|j||�d�\}|Sg}|jdkr_|j|j�nL|j|�}|j||�}x(|jD]}|jd||f�q�Wdj|�SdS)NrNrz%s %sz, )	rr��_metavar_formatterr�r�r�r�rr)r ror��metavarrwr�r�r%r%r&rls	z'HelpFormatter._format_action_invocationcsr|jdk	r|j�nA|jdk	rVdd�|jD�}ddj|��n|��fdd�}|S)NcSsg|]}t|��qSr%)�str)rUZchoicer%r%r&rX0s	z4HelpFormatter._metavar_formatter.<locals>.<listcomp>z{%s}�,cs"t�t�r�S�f|SdS)N)�
isinstance�tuple)Z
tuple_size)�resultr%r&r�5sz0HelpFormatter._metavar_formatter.<locals>.format)r��choicesr)r ro�default_metavarZchoice_strsr�r%)r�r&r�,sz HelpFormatter._metavar_formattercCs|j||�}|jdkr4d|d�}n�|jtkrVd|d�}n�|jtkrxd|d�}n�|jtkr�d|d�}nr|jtkr�d}nZ|jtkr�d|d�}n8d	d
�t|j�D�}dj|�||j�}|S)Nz%srNz[%s]z
[%s [%s ...]]r2z%s [%s ...]z...z%s ...cSsg|]}d�qS)z%sr%)rUr}r%r%r&rXKs	z.HelpFormatter._format_args.<locals>.<listcomp>rv)	r�r�r
rrrrr�r)r ror�Zget_metavarr�Zformatsr%r%r&r�<s 	zHelpFormatter._format_argscCs�tt|�d|j�}x+t|�D]}||tkr(||=q(Wx8t|�D]*}t||d�rV||j||<qVW|jd�dk	r�djdd�|dD��}||d<|j	|�|S)NrKrr�z, cSsg|]}t|��qSr%)r�)rU�cr%r%r&rXXs	z.HelpFormatter._expand_help.<locals>.<listcomp>)
r~�varsr;�listr�hasattrrr�r�_get_help_string)r roZparamsr#Zchoices_strr%r%r&r�Os 
zHelpFormatter._expand_helpccsFy
|j}Wntk
r!Yn!X|j�|�EdH|j�dS)N)�_get_subactions�AttributeErrorrOrQ)r roZget_subactionsr%r%r&rm\s


z'HelpFormatter._iter_indented_subactionscCs+|jjd|�j�}tj||�S)Nrv)rIrsrt�	_textwrapZwrap)r rarLr%r%r&r�fszHelpFormatter._split_linescCs7|jjd|�j�}tj||d|d|�S)NrvZinitial_indentZsubsequent_indent)rIrsrtr�Zfill)r rarLrxr%r%r&r�jszHelpFormatter._fill_textcCs|jS)N)rk)r ror%r%r&r�oszHelpFormatter._get_help_stringcCs
|jj�S)N)�dest�upper)r ror%r%r&r�rsz/HelpFormatter._get_default_metavar_for_optionalcCs|jS)N)r�)r ror%r%r&r�usz1HelpFormatter._get_default_metavar_for_positional) rr+r,r-rMrOrQ�objectrDr]r^r_rbrhrqrrr\r[rcr�r`rnrlr�r�r�rmr�r�r�r�r�r%r%r%r&r�s<!\a/

c@s"eZdZdZdd�ZdS)rz�Help message formatter which retains any formatting in descriptions.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cs,dj�fdd�|jdd�D��S)NrYc3s|]}�|VqdS)Nr%)rUrz)rxr%r&�	<genexpr>�sz9RawDescriptionHelpFormatter._fill_text.<locals>.<genexpr>�keependsT)r�
splitlines)r rarLrxr%)rxr&r��sz&RawDescriptionHelpFormatter._fill_textN)rr+r,r-r�r%r%r%r&rysc@s"eZdZdZdd�ZdS)rz�Help message formatter which retains formatting of all help text.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs
|j�S)N)r�)r rarLr%r%r&r��sz!RawTextHelpFormatter._split_linesN)rr+r,r-r�r%r%r%r&r�sc@s"eZdZdZdd�ZdS)rz�Help message formatter which adds default values to argument help.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCsY|j}d|jkrU|jtk	rUttg}|jsK|j|krU|d7}|S)Nz
%(default)z (default: %(default)s))rkr�rr
rrr�)r rorkZdefaulting_nargsr%r%r&r��s	
z.ArgumentDefaultsHelpFormatter._get_help_stringN)rr+r,r-r�r%r%r%r&r�sc@s.eZdZdZdd�Zdd�ZdS)r	aHelp message formatter which uses the argument 'type' as the default
    metavar value (instead of the argument 'dest')

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs
|jjS)N)rr)r ror%r%r&r��sz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs
|jjS)N)rr)r ror%r%r&r��sz<MetavarTypeHelpFormatter._get_default_metavar_for_positionalN)rr+r,r-r�r�r%r%r%r&r	�scCsi|dkrdS|jr)dj|j�S|jdtfkrE|jS|jdtfkra|jSdSdS)N�/)rrr�rr�)�argumentr%r%r&�_get_action_name�s	r�c@s.eZdZdZdd�Zdd�ZdS)rz�An error from creating or using an argument (optional or positional).

    The string value of this exception is the message, augmented with
    information about the argument that caused it.
    cCst|�|_||_dS)N)r��
argument_name�message)r r�r�r%r%r&rM�szArgumentError.__init__cCs;|jdkrd}nd}|td|jd|j�S)Nz%(message)sz'argument %(argument_name)s: %(message)sr�r�)r�r~r�)r r�r%r%r&�__str__�s
	zArgumentError.__str__N)rr+r,r-rMr�r%r%r%r&r�sc@seZdZdZdS)rz@An error from trying to convert a command line string to a type.N)rr+r,r-r%r%r%r&r�sc
@sUeZdZdZdddddddddd�Zdd�Zddd	�ZdS)
ra\	Information about how to convert command line strings to Python objects.

    Action objects are used by an ArgumentParser to represent the information
    needed to parse a single argument from one or more strings from the
    command line. The keyword arguments to the Action constructor are also
    all attributes of Action instances.

    Keyword Arguments:

        - option_strings -- A list of command-line option strings which
            should be associated with this action.

        - dest -- The name of the attribute to hold the created object(s)

        - nargs -- The number of command-line arguments that should be
            consumed. By default, one argument will be consumed and a single
            value will be produced.  Other values include:
                - N (an integer) consumes N arguments (and produces a list)
                - '?' consumes zero or one arguments
                - '*' consumes zero or more arguments (and produces a list)
                - '+' consumes one or more arguments (and produces a list)
            Note that the difference between the default and nargs=1 is that
            with the default, a single value will be produced, while with
            nargs=1, a list containing a single value will be produced.

        - const -- The value to be produced if the option is specified and the
            option uses an action that takes no values.

        - default -- The value to be produced if the option is not specified.

        - type -- A callable that accepts a single string argument, and
            returns the converted value.  The standard Python types str, int,
            float, and complex are useful examples of such callables.  If None,
            str is used.

        - choices -- A container of values that should be allowed. If not None,
            after a command-line argument has been converted to the appropriate
            type, an exception will be raised if it is not a member of this
            collection.

        - required -- True if the action must always be specified at the
            command line. This is only meaningful for optional command-line
            arguments.

        - help -- The help string describing the argument.

        - metavar -- The name to be used for the option's argument with the
            help string. If None, the 'dest' value will be used as the name.
    NFcCs^||_||_||_||_||_||_||_||_|	|_|
|_	dS)N)
rr�r��constr�rr�r�rkr�)r rr�r�r�r�rr�r�rkr�r%r%r&rMs									zAction.__init__c	s8ddddddddd	g	}�fd
d�|D�S)Nrr�r�r�r�rr�rkr�cs%g|]}|t�|�f�qSr%)r.)rUr#)r r%r&rX3s	z&Action._get_kwargs.<locals>.<listcomp>r%)r �namesr%)r r&r's	zAction._get_kwargscCsttd���dS)Nz.__call__() not defined)�NotImplementedErrorr})r �parserr0�valuesr�r%r%r&�__call__5szAction.__call__)rr+r,r-rMrr�r%r%r%r&r�s1csIeZdZdddddddd�fdd�Zddd�Z�S)�_StoreActionNFcs�|dkrtd��|dk	r@|tkr@tdt��tt|�jd|d|d|d|d|d	|d
|d|d|	d
|
�
dS)Nrz�nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriatez nargs must be %r to supply constrr�r�r�r�rr�r�rkr�)r:r
�superr�rM)r rr�r�r�r�rr�r�rkr�)�	__class__r%r&rM;sz_StoreAction.__init__cCst||j|�dS)N)r/r�)r r�r0r�r�r%r%r&r�Xsz_StoreAction.__call__)rr+r,rMr�r%r%)r�r&r�9sr�cs=eZdZdddd�fdd�Zddd�Z�S)�_StoreConstActionNFcsAtt|�jd|d|ddd|d|d|d|�dS)	Nrr�r�rr�r�r�rk)r�r�rM)r rr�r�r�r�rkr�)r�r%r&rM^sz_StoreConstAction.__init__cCst||j|j�dS)N)r/r�r�)r r�r0r�r�r%r%r&r�osz_StoreConstAction.__call__)rr+r,rMr�r%r%)r�r&r�\s

r�cs+eZdZddd�fdd�Z�S)�_StoreTrueActionFNc
s;tt|�jd|d|ddd|d|d|�dS)Nrr�r�Tr�r�rk)r�r�rM)r rr�r�r�rk)r�r%r&rMusz_StoreTrueAction.__init__)rr+r,rMr%r%)r�r&r�ssr�cs+eZdZddd�fdd�Z�S)�_StoreFalseActionTFNc
s;tt|�jd|d|ddd|d|d|�dS)Nrr�r�Fr�r�rk)r�r�rM)r rr�r�r�rk)r�r%r&rM�sz_StoreFalseAction.__init__)rr+r,rMr%r%)r�r&r��sr�csIeZdZdddddddd�fdd�Zddd�Z�S)�
_AppendActionNFcs�|dkrtd��|dk	r@|tkr@tdt��tt|�jd|d|d|d|d|d	|d
|d|d|	d
|
�
dS)Nrz�nargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriatez nargs must be %r to supply constrr�r�r�r�rr�r�rkr�)r:r
r�r�rM)r rr�r�r�r�rr�r�rkr�)r�r%r&rM�sz_AppendAction.__init__cCsBtjt||jg��}|j|�t||j|�dS)N)�_copy�copyr1r�rr/)r r�r0r�r�r*r%r%r&r��s
z_AppendAction.__call__)rr+r,rMr�r%r%)r�r&r��sr�cs=eZdZdddd�fdd�Zddd�Z�S)�_AppendConstActionNFcsGtt|�jd|d|ddd|d|d|d|d	|�dS)
Nrr�r�rr�r�r�rkr�)r�r�rM)r rr�r�r�r�rkr�)r�r%r&rM�sz_AppendConstAction.__init__cCsEtjt||jg��}|j|j�t||j|�dS)N)r�r�r1r�rr�r/)r r�r0r�r�r*r%r%r&r��sz_AppendConstAction.__call__)rr+r,rMr�r%r%)r�r&r��s
r�cs:eZdZddd�fdd�Zddd�Z�S)�_CountActionNFc
s;tt|�jd|d|ddd|d|d|�dS)Nrr�r�rr�r�rk)r�r�rM)r rr�r�r�rk)r�r%r&rM�sz_CountAction.__init__cCs0t||jd�d}t||j|�dS)NrrN)r1r�r/)r r�r0r�r�Z	new_countr%r%r&r��sz_CountAction.__call__)rr+r,rMr�r%r%)r�r&r��s	r�cs:eZdZeed�fdd�Zddd�Z�S)�_HelpActionNcs5tt|�jd|d|d|ddd|�dS)Nrr�r�r�rrk)r�r�rM)r rr�r�rk)r�r%r&rM�sz_HelpAction.__init__cCs|j�|j�dS)N)�
print_help�exit)r r�r0r�r�r%r%r&r��s
z_HelpAction.__call__)rr+r,rrMr�r%r%)r�r&r��sr�cs=eZdZdeed�fdd�Zddd�Z�S)�_VersionActionNz&show program's version number and exitcs>tt|�jd|d|d|ddd|�||_dS)Nrr�r�r�rrk)r�r�rM�version)r rr�r�r�rk)r�r%r&rM�sz_VersionAction.__init__cCs^|j}|dkr|j}|j�}|j|�|j|j�tj�|j�dS)N)r��_get_formatterrb�_print_messager\�_sys�stdoutr�)r r�r0r�r�r�rRr%r%r&r�s		
z_VersionAction.__call__)rr+r,rrMr�r%r%)r�r&r��s
	r�csheZdZGdd�de�Zedd�fdd�Zdd�Zdd	�Zdd
d�Z	�S)�_SubParsersActioncs"eZdZ�fdd�Z�S)z&_SubParsersAction._ChoicesPseudoActionc	s_|}}|r'|ddj|�7}ttj|�}|jdgd|d|d|�dS)Nz (%s)z, rr�rkr�)rr�r��_ChoicesPseudoActionrM)r r#�aliasesrkr�r�Zsup)r�r%r&rMs
z/_SubParsersAction._ChoicesPseudoAction.__init__)rr+r,rMr%r%)r�r&r�sr�Nc
sh||_||_tj�|_g|_tt|�jd|d|dt	d|jd|d|�dS)Nrr�r�r�rkr�)
�_prog_prefix�
_parser_class�_collections�OrderedDict�_name_parser_map�_choices_actionsr�r�rMr)r rrK�parser_classr�rkr�)r�r%r&rM"s				z_SubParsersAction.__init__cKs�|jd�dkr,d|j|f|d<|jdf�}d|kr~|jd�}|j|||�}|jj|�|j|�}||j|<x|D]}||j|<q�W|S)NrKz%s %sr�rk)r�r�r�r�r�rr�r�)r r#�kwargsr�rkZ
choice_actionr��aliasr%r%r&�
add_parser7s

z_SubParsersAction.add_parsercCs|jS)N)r�)r r%r%r&r�Nsz!_SubParsersAction._get_subactionsc
Cs |d}|dd�}|jtk	r<t||j|�y|j|}WnOtk
r�d|ddj|j�i}td�|}t||��YnX|j|d�\}	}x0t	|	�j
�D]\}
}t||
|�q�W|rt	|�jtg�t
|t�j|�dS)NrrN�parser_namer�z, z5unknown parser %(parser_name)r (choices: %(choices)s))r�rr/r�r9rr}r�parse_known_argsr�r*�
setdefault�_UNRECOGNIZED_ARGS_ATTRr.r�)r r�r0r�r�r�r!rW�msgZsubnamespace�keyr$r%r%r&r�Qs"

	z_SubParsersAction.__call__)
rr+r,rr�rrMr�r�r�r%r%)r�r&r�sr�c@sFeZdZdZdddddd�Zdd�Zd	d
�ZdS)ra�Factory for creating file object types

    Instances of FileType are typically passed as type= arguments to the
    ArgumentParser add_argument() method.

    Keyword Arguments:
        - mode -- A string indicating how the file is to be opened. Accepts the
            same values as the builtin open() function.
        - bufsize -- The file's desired buffer size. Accepts the same values as
            the builtin open() function.
        - encoding -- The file's encoding. Accepts the same values as the
            builtin open() function.
        - errors -- A string indicating how encoding and decoding errors are to
            be handled. Accepts the same value as the builtin open() function.
    �rrNNcCs(||_||_||_||_dS)N)�_mode�_bufsize�	_encoding�_errors)r �mode�bufsize�encoding�errorsr%r%r&rM�s			zFileType.__init__cCs�|dkrWd|jkr"tjSd|jkr8tjStd�|j}t|��y&t||j|j|j|j	�SWnGt
k
r�}z'td�}t|||f��WYdd}~XnXdS)N�-r��wzargument "-" with mode %rzcan't open '%s': %s)r�r��stdinr�r}r:r�r�r�r��OSErrorr)r �stringr��er�r%r%r&r��szFileType.__call__cCst|j|jf}d|jfd|jfg}djdd�|D�dd�|D��}dt|�j|fS)Nr�r�z, cSs(g|]}|dkrt|��qS)rNr�)r)rUr"r%r%r&rX�s	z%FileType.__repr__.<locals>.<listcomp>cSs2g|](\}}|dk	rd||f�qS)Nz%s=%rr%)rU�kwr"r%r%r&rX�s		z%s(%s))r�r�r�r�rrr)r rWr�Zargs_strr%r%r&r'�s
zFileType.__repr__r�)rr+r,r-rMr�r'r%r%r%r&rvsc@s:eZdZdZdd�Zdd�Zdd�ZdS)	r
z�Simple object for storing attributes.

    Implements equality by attribute names and values, and provides a simple
    string representation.
    cKs)x"|D]}t||||�qWdS)N)r/)r r�r#r%r%r&rM�s
zNamespace.__init__cCs)t|t�stSt|�t|�kS)N)r�r
�NotImplementedr�)r �otherr%r%r&�__eq__�szNamespace.__eq__cCs
||jkS)N)r))r r�r%r%r&�__contains__�szNamespace.__contains__N)rr+r,r-rMrrr%r%r%r&r
�scs�eZdZ�fdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�Zdd�Zd d!�Zd"d#�Zd$d%�Z�S)&�_ActionsContainercsgtt|�j�||_||_||_||_i|_|jddt	�|jddt	�|jddt
�|jddt�|jddt�|jddt
�|jddt�|jddt�|jdd	t�|jdd
t�|jddt�|j�g|_i|_g|_g|_i|_tjd�|_g|_dS)
NroZstoreZstore_const�
store_trueZstore_falserZappend_const�countrkr��parsersz^-\d+$|^-\d*\.\d+$)r�rrM�description�argument_default�prefix_chars�conflict_handler�_registries�registerr�r�r�r�r�r�r�r�r�r��_get_handler�_actions�_option_string_actions�_action_groups�_mutually_exclusive_groups�	_defaultsrGrH�_negative_number_matcher�_has_negative_number_optionals)r rrr
r)r�r%r&rM�s2					
					z_ActionsContainer.__init__cCs#|jj|i�}|||<dS)N)rr�)r �
registry_namer$r��registryr%r%r&r�sz_ActionsContainer.registerNcCs|j|j||�S)N)rr�)r rr$r�r%r%r&�
_registry_get�sz_ActionsContainer._registry_getcKsG|jj|�x0|jD]%}|j|kr||j|_qWdS)N)r�updaterr�r�)r r�ror%r%r&�set_defaultssz_ActionsContainer.set_defaultscCsLx6|jD]+}|j|kr
|jdk	r
|jSq
W|jj|d�S)N)rr�r�rr�)r r�ror%r%r&�get_default	sz_ActionsContainer.get_defaultcOs�|j}|s6t|�dkri|dd|kri|rTd|krTtd��|j||�}n|j||�}d|kr�|d}||jkr�|j||d<n|jdk	r�|j|d<|j|�}t|�s�td|f��||�}|j	d|j
|j
�}t|�sDtd	|f��t|d
�r�y|j�j
|d�Wntk
r�td��YnX|j|�S)z�
        add_argument(dest, ..., name=value, ...)
        add_argument(option_string, option_string, ..., name=value, ...)
        rNrr�z+dest supplied twice for positional argumentr�Nzunknown action "%s"rz%r is not callabler�z,length of metavar tuple does not match nargs)rrir:�_get_positional_kwargs�_get_optional_kwargsrr
�_pop_action_class�callablerrr�r�r��	TypeError�_add_action)r rWr��charsr�Zaction_classro�	type_funcr%r%r&rqs2		-


z_ActionsContainer.add_argumentcOs&t|||�}|jj|�|S)N)�_ArgumentGrouprr)r rWr�r�r%r%r&�add_argument_groupBsz$_ActionsContainer.add_argument_groupcKs#t||�}|jj|�|S)N)�_MutuallyExclusiveGrouprr)r r�r�r%r%r&�add_mutually_exclusive_groupGsz._ActionsContainer.add_mutually_exclusive_groupcCs�|j|�|jj|�||_x|jD]}||j|<q0Wx<|jD]1}|jj|�rQ|jsQ|jjd�qQW|S)NT)	�_check_conflictrr�	containerrrr�matchr)r ror�r%r%r&r%Ls
		z_ActionsContainer._add_actioncCs|jj|�dS)N)r�remove)r ror%r%r&�_remove_actionasz _ActionsContainer._remove_actioncCsIi}xL|jD]A}|j|krDtd�}t||j��|||j<qWi}xs|jD]h}|j|kr�|jd|jd|jd|j�||j<x"|jD]}||j||<q�WqeWxD|jD]9}|j	d|j
�}x|jD]}|||<qWq�Wx*|jD]}|j||�j
|�q"WdS)Nz.cannot merge actions - two groups are named %r�titlerrr�)rr1r}r:r)rrr�rr+r�rr�r%)r r-Ztitle_group_mapr�r�Z	group_mapro�mutex_groupr%r%r&�_add_container_actionsds,				z(_ActionsContainer._add_container_actionscKs�d|kr$td�}t|��|jd�ttgkrId|d<|jd�tkrtd|krtd|d<t|d|dg�S)Nr�z1'required' is an invalid argument for positionalsr�Tr�r�r)r}r$r�r
rr~)r r�r�r�r%r%r&r �s
!
z(_ActionsContainer._get_positional_kwargsc	OsJg}g}x�|D]�}|d|jkr]d|d|ji}td�}t||��|j|�|d|jkrt|�dkr|d|jkr|j|�qW|jdd�}|dkr4|r�|d}n
|d}|j|j�}|s"td�}t||��|jdd	�}t|d|d
|�S)Nr�optionrzNinvalid option string %(option)r: must start with a character %(prefix_chars)rrNr�z%dest= is required for options like %rr�r}r)	rr}r:rrir��lstrip�replacer~)	r rWr�rZlong_option_stringsr�r�r�Zdest_option_stringr%r%r&r!�s0



z&_ActionsContainer._get_optional_kwargscCs%|jd|�}|jd||�S)Nro)r�r)r r�r�ror%r%r&r"�sz#_ActionsContainer._pop_action_classcCsVd|j}yt||�SWn1tk
rQtd�}t||j��YnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)rr.r�r}r:)r Zhandler_func_namer�r%r%r&r�s

z_ActionsContainer._get_handlercCslg}x@|jD]5}||jkr|j|}|j||f�qW|rh|j�}|||�dS)N)rrrr)r roZconfl_optionalsr�Zconfl_optionalrr%r%r&r,�s
z!_ActionsContainer._check_conflictcCsKtddt|��}djdd�|D��}t|||��dS)Nzconflicting option string: %szconflicting option strings: %sz, cSsg|]\}}|�qSr%r%)rUr�ror%r%r&rX�s	z<_ActionsContainer._handle_conflict_error.<locals>.<listcomp>)rrirr)r ro�conflicting_actionsr�Zconflict_stringr%r%r&�_handle_conflict_error�s
z(_ActionsContainer._handle_conflict_errorcCsWxP|D]H\}}|jj|�|jj|d�|js|jj|�qWdS)N)rr/rr�r-r0)r ror7r�r%r%r&�_handle_conflict_resolve�s
	z*_ActionsContainer._handle_conflict_resolve)rr+r,rMrrrrrqr)r+r%r0r3r r!r"rr,r8r9r%r%)r�r&r�s$4	
/($		rcsLeZdZdd�fdd�Z�fdd�Z�fdd�Z�S)r(Ncs�|j}|d|j�|d|j�|d|j�tt|�j}|d||�||_g|_|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_dS)Nrrr
r)r�rrr
r�r(rMr1r�rrrrrr)r r-r1rr�rZ
super_init)r�r%r&rM�s			z_ArgumentGroup.__init__cs,tt|�j|�}|jj|�|S)N)r�r(r%r�r)r ro)r�r%r&r%sz_ArgumentGroup._add_actioncs*tt|�j|�|jj|�dS)N)r�r(r0r�r/)r ro)r�r%r&r0sz_ArgumentGroup._remove_action)rr+r,rMr%r0r%r%)r�r&r(�sr(cs=eZdZd�fdd�Zdd�Zdd�Z�S)r*Fcs,tt|�j|�||_||_dS)N)r�r*rMr��
_container)r r-r�)r�r%r&rMs	z _MutuallyExclusiveGroup.__init__cCsG|jr!td�}t|��|jj|�}|jj|�|S)Nz-mutually exclusive arguments must be optional)r�r}r:r:r%r�r)r ror�r%r%r&r%s	z#_MutuallyExclusiveGroup._add_actioncCs$|jj|�|jj|�dS)N)r:r0r�r/)r ror%r%r&r0$sz&_MutuallyExclusiveGroup._remove_action)rr+r,rMr%r0r%r%)r�r&r*sr*cs�eZdZdZddddgedddddd�fdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dddd�Zdddd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zdd2d3�Zdd4d5�Zdd6d7�Zd8dd9d:�Zd;d<�Z�S)=ra�Object for parsing command line strings into Python objects.

    Keyword Arguments:
        - prog -- The name of the program (default: sys.argv[0])
        - usage -- A usage message (default: auto-generated from arguments)
        - description -- A description of what the program does
        - epilog -- Text following the argument descriptions
        - parents -- Parsers whose arguments should be copied into this one
        - formatter_class -- HelpFormatter class for printing help messages
        - prefix_chars -- Characters that prefix optional arguments
        - fromfile_prefix_chars -- Characters that prefix files containing
            additional arguments
        - argument_default -- The default value for all arguments
        - conflict_handler -- String indicating how to handle conflicts
        - add_help -- Add a -h/-help option
        - allow_abbrev -- Allow long options to be abbreviated unambiguously
    Nr��errorTc
s�tt|�j}
|
d|d|d|	d|
�|dkrVtjjtjd�}||_||_	||_
||_||_||_
||_|j}|td��|_|td��|_d|_dd	�}|jd
d|�d|krdn|d}|j
rI|j|d|d
ddddtdtd��xM|D]E}|j|�y
|j}Wntk
r�YqPX|jj|�qPWdS)Nrrr
rrzpositional argumentszoptional argumentscSs|S)Nr%)rr%r%r&�identitybsz)ArgumentParser.__init__.<locals>.identityrr��hr2rkror�zshow this help message and exit)r�rrMr7�path�basenamer��argvrKrd�epilog�formatter_class�fromfile_prefix_chars�add_help�allow_abbrevr)r}�_positionals�
_optionals�_subparsersrrqrr3rr�r)r rKrdrrA�parentsrBrrCr
rrDrEZ	superinitZ	add_groupr<Zdefault_prefixrSZdefaults)r�r%r&rM<sB										




zArgumentParser.__init__cs/ddddddg}�fdd�|D�S)	NrKrdrrBrrDcs%g|]}|t�|�f�qSr%)r.)rUr#)r r%r&rX�s	z.ArgumentParser._get_kwargs.<locals>.<listcomp>r%)r r�r%)r r&r|s	zArgumentParser._get_kwargsc	KsA|jdk	r"|jtd��|jdt|��d|ksPd|kr�t|jdd��}t|jdd��}|j||�|_n|j|_|jd�dkr	|j	�}|j
�}|j}|j|j
||d�|j�j�|d<|j|d�}|d	g|�}|jj|�|S)
Nz(cannot have multiple subparser argumentsr�r1rZsubcommandsrKrYrr)rHr;r}r�rr�r)rFr�r��_get_positional_actionsrrhrdr\rtr"r%)	r r�r1rrRr�rfZ
parsers_classror%r%r&�add_subparsers�s$	zArgumentParser.add_subparserscCs0|jr|jj|�n|jj|�|S)N)rrGr%rF)r ror%r%r&r%�s	zArgumentParser._add_actioncCsdd�|jD�S)NcSsg|]}|jr|�qSr%)r)rUror%r%r&rX�s	z8ArgumentParser._get_optional_actions.<locals>.<listcomp>)r)r r%r%r&�_get_optional_actions�s	z$ArgumentParser._get_optional_actionscCsdd�|jD�S)NcSsg|]}|js|�qSr%)r)rUror%r%r&rX�s	z:ArgumentParser._get_positional_actions.<locals>.<listcomp>)r)r r%r%r&rJ�s	z&ArgumentParser._get_positional_actionscCsH|j||�\}}|rDtd�}|j|dj|��|S)Nzunrecognized arguments: %srv)r�r}r;r)r rWr0r@r�r%r%r&�
parse_args�s
zArgumentParser.parse_argscCsk|dkr"tjdd�}nt|�}|dkrCt�}xW|jD]L}|jtk	rMt||j�sM|jtk	rMt	||j|j�qMWx7|j
D],}t||�s�t	|||j
|�q�WyX|j||�\}}t|t�r$|j
t|t��t|t�||fSWn5tk
rftj�d}|jt|��YnXdS)NrN)r�r@r�r
rr�rr�r�r/r�_parse_known_argsr�r�r.�delattrr�exc_infor;r�)r rWr0ror��errr%r%r&r��s,	

zArgumentParser.parse_known_argscs.�	jdk	r�	j���i�x~�	jD]s}|j}xat|j�D]P\}}�j|g�}|j|d|��|j||dd��qMWq.Wi�g}t��}	x�t|	�D]�\}}
|
dkr|jd�x_|	D]}
|jd�q�Wq��	j	|
�}|dkr4d}n|�|<d}|j|�q�Wdj
|��t��t��d�����	fdd�������	�fd	d
�}
�	j������	�fdd�}g�d
�
�rt
��}nd}x��
|kr�t�
fdd��D��}�
|krm|�
�}|�
krg|�
qn|�
�
�kr���
|�}�j|�|�
|
�
��
qW|�
�}�j�|d��g}x��	jD]�}|�kr�|jr|jt|��q�|jdk	r�t|jt�r�t�|j�r�|jt�|j�kr�t�|j�	j||j��q�W|r��	jtd�dj
|��xw�	jD]l}|jr�xZ|jD]}|�kr�Pq�Wdd�|jD�}td�}�	j|dj
|��q�W��fS)NrNz--r��A�OrYcs��j|��j||�}||jk	r��j|�xQ�j|g�D]=}|�krNtd�}t|�}t|||��qNW|tk	r�|��||�dS)Nznot allowed with argument %s)r��_get_valuesr�r�r}r�rr)roZargument_stringsr�Zargument_valuesZconflict_actionr�Zaction_name)�action_conflictsr0�seen_actions�seen_non_default_actionsr r%r&�take_actions

z5ArgumentParser._parse_known_args.<locals>.take_actioncs�|}|\}}}�j}g}x�|dkrP�j�|�|dS|dk	ry||d�}�j}|dkr|d|kr|j|g|f�|d}	|	|d}|dd�p�d}
�j}||kr�||}|
}qvtd�}t|||��q�|dkrW|d}
|g}|j|||f�Pq�td�}t|||��q+|d}�|d�}|||�}||}
�||
�}|j|||f�Pq+W|s�t�x'|D]\}}}�|||�q�W|
S)NrNrRrzignored explicit argument %r)�_match_argumentrrrr}rrP)�start_index�option_tupleror��explicit_argZmatch_argumentZ
action_tuples�	arg_countr&�charZnew_explicit_argZ
optionals_mapr��stoprWr�Zselected_patterns)r!�arg_strings_pattern�extras�option_string_indicesr rXr%r&�consume_optional+sP
		
	
	
	

z:ArgumentParser._parse_known_args.<locals>.consume_optionalcs��j}�|d�}|�|�}xHt�|�D]7\}}�|||�}||7}�||�q8W�t|�d��dd�<|S)N)�_match_arguments_partial�zipri)rZZ
match_partialZselected_patternZ
arg_countsror]rW)r!r`r�r rXr%r&�consume_positionalsxs	
 z=ArgumentParser._parse_known_args.<locals>.consume_positionalsrcs"g|]}|�kr|�qSr%r%)rUr�)rZr%r&rX�s	z4ArgumentParser._parse_known_args.<locals>.<listcomp>z(the following arguments are required: %sz, cSs+g|]!}|jtk	rt|��qSr%)rkrr�)rUror%r%r&rX�s	z#one of the arguments %s is requiredrvr�)rC�_read_args_from_filesrr�r�r�r��iterr�_parse_optionalrr�rJr?r>rr�r�r�r�r�r�r�r.r/�
_get_valuer;r})r r!r0r2r�r�Zmutex_actionZ	conflictsZarg_string_pattern_partsZarg_strings_iter�
arg_stringr[�patternrcrfZmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ
stop_indexZrequired_actionsror�r�r�r%)rUr!r`rar0rbr�rVrWr rZrXr&rN�s�	#

	
		!!J

			
z ArgumentParser._parse_known_argscCsg}x�|D]�}|s-|d|jkr=|j|�q
y�t|dd���m}g}xA|j�j�D]-}x$|j|�D]}|j|�q�WqrW|j|�}|j|�WdQRXWq
tk
r�t	j
�d}|jt|��Yq
Xq
W|S)NrrN)
rCrr��readr��convert_arg_line_to_argsrgr�rr�rPr;r�)r r!Znew_arg_stringsrkZ	args_file�arg_liner"rQr%r%r&rg�s 

z$ArgumentParser._read_args_from_filescCs|gS)Nr%)r ror%r%r&rn�sz'ArgumentParser.convert_arg_line_to_argscCs�|j|�}tj||�}|dkr�dtd�ttd�ttd�i}tdd|j�|j}|j|j|�}t	||��t
|jd��S)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrN)�_get_nargs_patternrGr.r}r
rrr�r�rrir�)r ror`�
nargs_patternr.Znargs_errorsr�r�r%r%r&rY�szArgumentParser._match_argumentcs�g}x�tt|�dd�D]w}|d|�}dj�fdd�|D��}tj||�}|dk	r|jdd�|j�D��PqW|S)NrrNrYcsg|]}�j|��qSr%)rp)rUro)r r%r&rXs	z;ArgumentParser._match_arguments_partial.<locals>.<listcomp>cSsg|]}t|��qSr%)ri)rUrr%r%r&rXs	r�)r�rirrGr.r�rf)r rer`r�r�Z
actions_slicerlr.r%)r r&rds
 z'ArgumentParser._match_arguments_partialc
Cs�|s
dS|d|jkr!dS||jkrJ|j|}||dfSt|�dkr`dSd|kr�|jdd�\}}||jkr�|j|}|||fS|jrD|j|�}t|�dkr%djdd�|D��}d|d|i}td	�}|j||�nt|�dkrD|\}	|	S|j	j
|�rc|jscdSd
|krsdSd|dfS)NrrN�=z, cSsg|]\}}}|�qSr%r%)rUror�r\r%r%r&rX?s	z2ArgumentParser._parse_optional.<locals>.<listcomp>r4Zmatchesz4ambiguous option: %(option)s could match %(matches)srv)rrri�splitrE�_get_option_tuplesrr}r;rr.r)
r rkror�r\Z
option_tuplesZoptionsrWr�r[r%r%r&ris>



	
		zArgumentParser._parse_optionalc
Cs�g}|j}|d|kr�|d|kr�d|krV|jdd�\}}n|}d}x6|jD]>}|j|�rl|j|}|||f}|j|�qlWn�|d|kr�|d|kr�|}d}|dd�}|dd�}	x�|jD]v}||krE|j|}|||	f}|j|�q|j|�r|j|}|||f}|j|�qWn|jtd�|�|S)NrrNrrr2zunexpected option string: %s)rrsr�
startswithrr;r})
r r�r�r&Z
option_prefixr\ror�Zshort_option_prefixZshort_explicit_argr%r%r&rtZs8	 
 

z!ArgumentParser._get_option_tuplescCs�|j}|dkrd}n�|tkr3d}nk|tkrHd}nV|tkr]d}nA|tkrrd}n,|tkr�d}nddjd	|�}|jr�|jdd
�}|jdd
�}|S)Nz(-*A-*)z(-*A?-*)z	(-*[A-]*)z
(-*A[A-]*)z([-AO]*)z(-*A[-AO]*)z(-*%s-*)z-*rRrYr�)	r�r
rrrrrrr6)r ror�rqr%r%r&rp�s$								z!ArgumentParser._get_nargs_patterncs��jttgkr;y|jd�Wntk
r:YnX|r��jtkr��jrf�j}n	�j}t	|t
�r��j�|�}�j�|�nV|r��jt
kr��jr��jdk	r��j}n|}�j�|�nt|�dkrL�jdtgkrL|\}�j�|�}�j�|�n��jtkrz��fdd�|D�}n�jtkr���fdd�|D�}�j�|d�n=��fdd�|D�}x|D]}�j�|�q�W|S)Nz--rNcs"g|]}�j�|��qSr%)rj)rU�v)ror r%r&rX�s	z.ArgumentParser._get_values.<locals>.<listcomp>cs"g|]}�j�|��qSr%)rj)rUrv)ror r%r&rX�s	rcs"g|]}�j�|��qSr%)rj)rUrv)ror r%r&rX�s	)r�rrr/r:r
rr�r�r�r�rj�_check_valuerri)r ror!r$rkrvr%)ror r&rT�s>
		
'	
zArgumentParser._get_valuescCs|jd|j|j�}t|�sFtd�}t|||��y||�}Wn�tk
r�t|jdt|j��}tt	j
�d�}t||��Yngttfk
rt|jdt|j��}d|d|i}td�}t|||��YnX|S)Nrz%r is not callablerrNr$z!invalid %(type)s value: %(value)r)
rrr#r}rrr.rr�r�rPr$r:)r rorkr'r�r�r#rWr%r%r&rj�s 
zArgumentParser._get_valuecCsh|jdk	rd||jkrdd|ddjtt|j��i}td�}t|||��dS)Nr$r�z, z3invalid choice: %(value)r (choose from %(choices)s))r�r�maprr}r)r ror$rWr�r%r%r&rw	s
!zArgumentParser._check_valuecCs2|j�}|j|j|j|j�|j�S)N)r�rhrdrrr\)r rRr%r%r&�format_usage	s
zArgumentParser.format_usagecCs�|j�}|j|j|j|j�|j|j�xK|jD]@}|j|j	�|j|j�|j
|j�|j�qBW|j|j
�|j�S)N)r�rhrdrrrbrrr^r1rrr�r_rAr\)r rRZaction_groupr%r%r&r\	s
zArgumentParser.format_helpcCs|jd|j�S)NrK)rBrK)r r%r%r&r�(	szArgumentParser._get_formattercCs/|dkrtj}|j|j�|�dS)N)r�r�r�ry)r �filer%r%r&�print_usage.	s	zArgumentParser.print_usagecCs/|dkrtj}|j|j�|�dS)N)r�r�r�r\)r rzr%r%r&r�3	s	zArgumentParser.print_helpcCs,|r(|dkrtj}|j|�dS)N)r��stderr�write)r r�rzr%r%r&r�8	s	zArgumentParser._print_messagercCs*|r|j|tj�tj|�dS)N)r�r�r|r�)r Zstatusr�r%r%r&r�A	szArgumentParser.exitcCsC|jtj�d|jd|i}|jdtd�|�dS)z�error(message: string)

        Prints a usage message incorporating the message to stderr and
        exits.

        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        rKr�r2z%(prog)s: error: %(message)s
N)r{r�r|rKr�r})r r�rWr%r%r&r;F	s	zArgumentParser.error) rr+r,r-rrMrrKr%rLrJrMr�rNrgrnrYrdrirtrprTrjrwryr\r�r{r�r�r�r;r%r%)r�r&r)sN4#�;,,4	)6r-�__version__�__all__�collectionsr�r�r��osr7�rerG�sysr��textwrapr�rr}rrr
rrrrr�r�rr1rrrrr	r��	Exceptionrrrr�r�r�r�r�r�r�r�r�r�rr
rr(r*rr%r%r%r&�<module>>sz	
��
	[#%`6�4"

Rosenblum TV: Video training, virtual workshops, classes, tutorials
logologologologo
  • About
  • What We Do
  • Our Clients
  • Case Studies
    • The BBC
    • CBS News
    • New York Times Television
    • Spectrum News
    • The Newark Star-Ledger
    • The United Nations
    • McGraw/Hill
    • Oyster Yachts
    • Scottish Environmental Protection Agency
  • The Power of Storytelling
  • Why iPhones?
  • Michael on Media
  • Books
  • Contact
  • About
  • What We Do
  • Our Clients
  • Case Studies
    • The BBC
    • CBS News
    • New York Times Television
    • Spectrum News
    • The Newark Star-Ledger
    • The United Nations
    • McGraw/Hill
    • Oyster Yachts
    • Scottish Environmental Protection Agency
  • The Power of Storytelling
  • Why iPhones?
  • Michael on Media
  • Books
  • Contact

RE-INVENTING THE TELEVISION NEWS BUSINESS*

A revolution in video storytelling

Creating entirely new & cost-effective production methods

From the world leaders in video production training and the creators of Character Driven Storytelling™

*and every other business that uses video

WHAT WE DO

Over the past 35 years, we have designed, built or restructured some of the most powerful news and journalism companies in the world.

We replace the traditional TV news ‘crew’ with one highly trained journalist, working alone with nothing but an iPhone.

No more TV news ‘crews’, no editors and no field producers.

This is television news done the way newspaper journalism is done – one reporter with their electronic pad and pencil.

In doing this, we can cut the cost of production by as much as 75% while increasing ratings and audience engagement.

In the place of conventional TV news ‘packages’ – ie, reporter stand up, interview, b-roll, man on the street, we marry great journalism with Netflix and Hollywood storytelling.

It’s a combination that works.

We have taken most of our clients to #1 in their respective markets.

And it’s not just for news. Any company, any profit, any NGO and anyone else who is online needs to tell their story in compelling yet cost-effective video. We can teach you to do that. Either in person or virtually.

EXAMPLES OF WHAT WE CAN TEACH YOUR STAFF TO PRODUCE

ITAY HOD

Itay Hod, MMJ with KPIX/CBS in San Francisco, took the 5-Day Intensive Video Storytelling Bootcamp in 2018.

Because he works alone, with only an iPhone, he was able to embed himself with a homeless family.

Here’s the story he produced in a one-day turn.

KIET DO

Kiet Do, an MMJ with KPIX/CBS in San Francisco, took the 5-Day Intensive Video Storytelling Bootcamp in 2021.

Here is a story he produced, all on his own, with only an iPhone and in a one-day turn.

TAYLOR SCHAUB

Taylor Schaub, an MMJ with Spectrum News 1 in LA, took the 5-Day Intensive Video Storytelling Bootcamp in 2023.

Here is a story he turned in only one day, using only an iPhone. It was the first video story he ever did and it was nominated for an Emmy.

THE BOOTCAMP

How do we convert stations and whole networks to working in this way?

Since 1988, we have run intensive 5-Day Video Storytelling Bootcamps

We have done these all over the world.

These are hands-on bootcamps, and participants learn an entirely new way of creating TV news stories.

-We shoot at a 3:1 ratio or lower, so turnaround times are fast.

-We go directly from camera to timelilne and edit – no written scripts.  We work in the medium of pictures and sound.

-We are entirely character-driven.

-We are driven by pictures and real events.

-We are focused almost entirely on ’the viewer experience’.

Since 1988, more than 70,000 journalists around the world have taken our bootcamps, either in person on virtualy.

Case Studies

CBS Case Study Logos
CBS News

We have started to work with CBS News, bringing our ideas of character-driven storytelling to one of the most successful and biggest networks in the United States. Since beginning to work with them ratings have climbed and more importantly, audience engagement is through the ceiling.

Learn More
NYT Case Study Logos
New York Times Television

We started New York Times Television in 1990 and it was the first paper to be brought into the world of TV. It quickly became one of the most successful non-fiction production companies in the United States. The series and documentaries we produced won many awards including multiple Emmys.

Learn More
BBC Case Study Logos
The BBC

We have been working with the BBC since the year 2000 helping to convert their national news network to our visual storytelling technique. Most recently we have trained teams from their sports, documentaries, and comedy divisions to make character-driven stories using only smartphones.

Learn More
Spectrum Case Study Logos
Spectrum News

For the past five years we have worked with Spectrum News to introduce and train their journalists on visual, character driven storytelling using smartphones helping to create a different kind of local news for their network of 24-Hour News Stations across the United States.

Learn More
UN Case Study Logos
The United Nations

In 2006, we were approached by the United Nations. Rather than rely on news outlets, it would be much easier to train the field operatives to produce their own stories. We spent two years working with the UN, training more than 100 of their staff in bootcamps in Geneva and Nairobi.

Learn More
Star Ledger Case Study Logos
The Newark Star-Ledger

We trained 50 print reporters at the paper to shoot and tell their own stories, in conjunction with their print work. We built a TV newsroom in their existing print newsroom – you could not ask for a better set and they began to live stream their stories in conjunction with their print work.

Learn More
Mcgraw Hill Case Study Logos
Mcgraw Hill

We spent two years with McGraw Hill, training more than 150 of their staffers, making them completely video literate. McGraw/Hill media properties we transit included Business Week, Aviation Week, (what was the name of the architecture magazine), and JD Power and Associates.

Learn More
VOA Case Study Logos
Voice of America

In 1990, we were approached by The Voice of America, the official broadcasting agency for the United States Government. When we met with VOA, they were only a short wave radio broadcaster, but working with them, we took them into television, launching VOA-TV.

Learn More
Oyster Case Study Logos
Oyster Yachts

British based Oyster Yachts makes some of the finest yachts in the world. Like every other company, they had to find a way to feed the never-ending video demands of social media – sites like Instagram and TikTok. We trained the Oyster staff to tell their own stories, using only iPhones.

Learn More
SEPA Case Study Logos
Scottish Environmental Protection Agency

We were approached by SEPA, the Scottish Environmental Protection Agency because they had to continually find a way to ‘feed the media beast’. The result was that SEPA was able to tell their own stories, whenever they wanted, and at almost no additional cost.

Learn More
Image 11-11-22 at 6.25 PM

Michael on Media

Michael Rosenblum has been writing about the media since 1988. His work and ideas have appeared in The Guardian, The Huffington Post, Ilkeston Life and many other publications.

He has been blogging regularly for the past 35 years on this subject. Having taught media studies at Columbia University, NYU and now the University of Oxford, he is considered an expert on this subject.

Continue reading this post or look back at previous posts.

Read More

Do You Have Questions About Learning Video Skills?

If you would like to know more about our courses contact us and one of our training advisors will be happy to call you.

Contact Us

Copyright 2024. All rights reserved.