ok

Mini Shell

Direktori : /proc/thread-self/root/proc/thread-self/root/usr/lib64/python2.7/site-packages/gi/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/usr/lib64/python2.7/site-packages/gi/_option.pyc

�
QLZc	@s:dZddlZddlZddlmZmZmZmZmZddlm	Z	ej
dkrweZd�Z
neZeZ
dd	lmZdd
lmZe	d�Zejej��Zdd
dddddddg	Zdejfd��YZdejfd��YZdejfd��YZeZdS(s,GOption command line parser

Extends optparse to use the GOptionGroup, GOptionEntry and GOptionContext
objects. So it is possible to use the gtk, gnome_program and gstreamer command
line groups and contexts.

Use this interface instead of the raw wrappers of GOptionContext and
GOptionGroup in glib.
i����N(t
OptParseErrortOptionErrortOptionValueErrortBadOptionErrortOptionConflictErrori(tget_introspection_moduleiicCs
|j�S(N(tencode(ts((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt<lambda>&s(t_glib(tGErrortGLibRRRRRtOptiontOptionGrouptOptionParsertmake_optioncBs_eZdZejjd	ZejjdddgZdejZ	d�Z
d�Zd�ZRS(
s�Represents a command line option

    To use the extended possibilities of the GOption API Option
    (and make_option) are extended with new types and attributes.

    Types:
        filename   The supplied arguments are read as filename, GOption
                   parses this type in with the GLib filename encoding.

    :ivar optional_arg:
        This does not need a arguement, but it can be supplied.
    :ivar hidden:
        The help list does not show this option
    :ivar in_main:
        This option apears in the main group, this should only
        be used for backwards compatibility.

    Use Option.REMAINING as option name to get all positional arguments.

    .. NOTE::
        Every argument to an option is passed as utf-8 coded string, the only
        exception are options which use the 'filename' type, its arguments
        are passed as strings in the GLib filename encoding.

    For further help, see optparse.Option.
    tfilenamethiddentin_maintoptional_args--cOs�tjj|||�|js.td��nt|j�t|j�kr[td��n|js}td|jd��ndS(Ns!%s at least one long option name.s;%s at least more long option names than short option names.s%s needs a help message.i(toptparseRt__init__t
_long_optst
ValueErrortlent_short_optsthelp(tselftargstkwargs((s0/usr/lib64/python2.7/site-packages/gi/_option.pyRes		cCsi|j|kr%|jj|j�ntjj||�t|j�t|j�kretd��ndS(NsCgoption.Option needs more long option names than short option names(	t	REMAININGRtappendRRt_set_opt_stringRRR(Rtopts((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR qs
ccs2d}|jr"|tjjO}n|jr>|tjjO}n|j�ri|jry|tjjO}qyn|tjj	O}|j
dkr�|tjjO}nxKt|j
|j�D]4\}}|dt|d�||j|jfVq�WxB|j
t|j�D]*}|dtd�||j|jfVqWdS(NiRiit(RRtOptionFlagstHIDDENRtIN_MAINttakes_valueRtOPTIONAL_ARGtNO_ARGttypetFILENAMEtzipRRt_bytesRtmetavarR(Rtflagst	long_namet
short_name((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt_to_goptionentriesys			",(sfilename(
t__name__t
__module__t__doc__RRtTYPEStATTRSRtOPTION_REMAININGRRR R1(((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR>s		

		cBsJeZdZddddd�Zd�Zd�Zdd�Zd�ZRS(s�A group of command line options.

    :param str name:
        The groups name, used to create the --help-{name} option
    :param str description:
        Shown as title of the groups help view
    :param str help_description:
        Shown as help to the --help-{name} option
    :param list option_list:
        The options used in this group, must be option.Option()
    :param dict defaults:
        A dicitionary of default values
    :param translation_domain:
           Sets the translation domain for gettext().

    .. NOTE::
        This OptionGroup does not exactly map the optparse.OptionGroup
        interface. There is no parser object to supply, but it is possible
        to set default values and option_lists. Also the default values and
        values are not shared with the OptionParser.

    To pass a OptionGroup into a function which expects a GOptionGroup (e.g.
    gnome_program_init() ). OptionGroup.get_option_group() can be used.

    For further help, see optparse.OptionGroup.
    tcCs�tjj|td|�||_d|_||_|rF||_nd|_	||_
|rx|D]}|j|�qeWndS(Nterror(RtOptionContainerRRtnametNonetparserthelp_descriptiontdefaultstvaluesttranslation_domaint
add_option(RR;tdescriptionR>toption_listR?RAtoption((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR�s					
cCsg|_|j�dS(N(RDt_create_option_mappings(R((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt_create_option_list�s	cs���fd�}tj�j�j�j|�}�jrO|j�j�ng}x$�jD]}|j|j	��q_W|j
|�|S(Ncs�|jd�r�j|}n
�j|}y|j||�j��Wn`tk
r�tj�d}tt	|��}t
|_tj
j|_t	|�|_|�nXdS(Ns--i(t
startswitht	_long_optt
_short_opttprocessR@Rtsystexc_infoR
tstrtOPTION_CONTEXT_ERROR_QUARKtdomainRRt	BAD_VALUEtcodetmessage(toption_nametoption_valuetgrouptoptR9tgerror(R=R(s0/usr/lib64/python2.7/site-packages/gi/_option.pytcallback�s

	(R	R
R;RCR>RAtset_translation_domainRDtextendR1tadd_entries(RR=RYRVtentriesRE((R=Rs0/usr/lib64/python2.7/site-packages/gi/_option.pyt_to_goptiongroup�s	
cCs|j�|j|�S(s� Returns the corresponding GOptionGroup object.

        Can be used as parameter for gnome_program_init(), gtk_init().
        (tset_values_to_defaultsR^(RR=((s0/usr/lib64/python2.7/site-packages/gi/_option.pytget_option_group�s
cCs|x`|jD]U}|jj|j�}t|t�r
|j�}|j||�|j|j<q
q
Wtj	|j�|_
dS(N(RDR?tgettdestt
isinstancet_basestringtget_opt_stringtcheck_valueRtValuesR@(RREtdefaulttopt_str((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR_�sN(	R2R3R4R<RRGR^R`R_(((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR
�s		cBsSeZdZd�Zd�Zd�Zd�Zd�Zd�Zddd�Z
RS(	sHCommand line parser with GOption support.

    :param bool help_enabled:
        The --help, --help-all and --help-{group} options are enabled (default).
    :param bool ignore_unknown_options:
        Do not throw a exception when a option is not knwon, the option
        will be in the result list.

    .. NOTE::
        The OptionParser interface is not the exactly the same as the
        optparse.OptionParser interface. Especially the usage parameter
        is only used to show the metavar of the arguements.

    OptionParser.add_option_group() does not only accept OptionGroup instances
    but also glib.OptionGroup, which is returned by gtk_get_option_group().

    Only glib.option.OptionGroup and glib.option.Option instances should
    be passed as groups and options.

    For further help, see optparse.OptionParser.
    cOscd|krt|d<n|jdt�|_|jdt�|_tjj|dt||�dS(Ntoption_classthelp_enabledtignore_unknown_optionstadd_help_option(	RtpoptTrueRktFalseRlRRR(RRR((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR
s
	cCsJ|dkrd|_n.|jd�r=|td�|_n	||_dS(NR8s%prog(R<tusageRHR(RRq((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt	set_usages
c
s�jr �jd�j}n	�j}tj|�}|j�j�|j�j�xH�jD]=}t	|tj
�r�|}n|j��}|j|�qbW��fd�}tj
ddd|�}g}x$�jD]}	|j|	j��q�W|j|�|j|�|S(Ns - csF|jd�r�j|}n
�j|}|j||���dS(Ns--(RHRIRJRK(RTRURVRW(RR@(s0/usr/lib64/python2.7/site-packages/gi/_option.pyRY+s
(RCRqR	t
OptionContexttset_help_enabledRktset_ignore_unknown_optionsRlt
option_groupsRcR
R`t	add_groupR<RDR[R1R\tset_main_group(
RR@tparameter_stringtcontexttoption_grouptg_groupRYt
main_grouptmain_entriesRE((RR@s0/usr/lib64/python2.7/site-packages/gi/_option.pyt_to_goptioncontexts&			

cOs�t|dt�r6tjj|t|||��dSt|�dkr�|r�t|dt�r�|djs||d_n|dj|k	r�td��q�nt|dt	j�r�|j
j|d�dSntjj|||�dS(Niis"invalid OptionGroup (wrong parser)(RcRdRRtadd_option_groupR
RR=RR	RvR(RRR((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR�;s
cCsG|j}x6|jD]+}t|tj�r|j|j�qqW|S(N(RDRvRcRR
R[(RtoptionsRV((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt_get_all_optionsKs

cCs5|j|�}|jtjdg|�d|(dS(Nii(RtparseRLtargv(RtlargstrargsR@Rz((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt
_process_argsRsc	CsD|p	g}y"tjj|||�\}}Wn�tk
r�tj�d}|jtkrc�n|jt	j
jkr�t|j
��q�|jt	j
jkr�t|j
��q�|jt	j
jkr�t|j
��q��nXxD|jD]9}x0|jjj�D]\}}|j||�qWq�W|dt|�!}||fS(Nii(RRt
parse_argsR
RLRMRPRORRRRRQRRStUNKNOWN_OPTIONRtFAILEDRRvR@t__dict__titemstensure_valueR(	RRR@told_argsR�R9RVtkeytvalue((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR�Zs(	
N(R2R3R4RRrRR�R�R�R<R�(((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR�s				 			(ii(R4RLRRRRRRtmoduleRtversion_infoRNRdR,t
basestringtgi._giR	t	gi._errorR
Rtquark_to_stringtoption_error_quarkROt__all__RR
RR(((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt<module>s4(	Ta�

Zerion Mini Shell 1.0