ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/lib64/python2.7/site-packages/glib/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/lib64/python2.7/site-packages/glib/option.pyo

�
�uTc	@sdZddlZddlZddlmZmZmZmZmZejdkrge	Z
d�ZneZ
e	Zddl
Z
ejdZdd	d
ddd
dddg	Zd
ejfd��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
OptParseErrortOptionErrortOptionValueErrortBadOptionErrortOptionConflictErroriicCs
|j�S(N(tencode(ts((s1/usr/lib64/python2.7/site-packages/glib/option.pyt<lambda>'ss
glib._glibRRRRRtOptiontOptionGroupt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.

    Attributes:
        optional_arg  This does not need a arguement, but it can be supplied.
        hidden        The help list does not show this option
        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(toptparseRt__init__t
_long_optst
ValueErrortlent_short_optsthelp(tselftargstkwargs((s1/usr/lib64/python2.7/site-packages/glib/option.pyR_s		cCsi|j|kr%|jj|j�ntjj||�t|j�t|j�kretd��ndS(NsCgoption.Option needs more long option names than short option names(	t	REMAININGRtappendRRt_set_opt_stringRRR(Rtopts((s1/usr/lib64/python2.7/site-packages/glib/option.pyRls
ccs#d}|jr|tjO}n|jr8|tjO}n|j�r`|jrm|tjO}qmn
|tjO}|j	dkr�|tj
O}nxKt|j|j
�D]4\}}|dt|d�||j|jfVq�WxB|jt|j
�D]*}|dtd�||j|jfVq�WdS(NiRiit(R
t_glibtOPTION_FLAG_HIDDENRtOPTION_FLAG_IN_MAINttakes_valueRtOPTION_FLAG_OPTIONAL_ARGtOPTION_FLAG_NO_ARGttypetOPTION_FLAG_FILENAMEtzipRRt_bytesRtmetavarR(Rtflagst	long_namet
short_name((s1/usr/lib64/python2.7/site-packages/glib/option.pyt_to_goptionentriests			
",(sfilename(
t__name__t
__module__t__doc__RRtTYPEStATTRSRtOPTION_REMAININGRRRR-(((s1/usr/lib64/python2.7/site-packages/glib/option.pyR;s		

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

    Arguements:
       name:             The groups name, used to create the
                         --help-{name} option
       description:      Shown as title of the groups help view
       help_description: Shown as help to the --help-{name} option
       option_list:      The options used in this group, must be option.Option()
       defaults:         A dicitionary of default values
       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(RtOptionContainerRRtnametNonetparserthelp_descriptiontdefaultstvaluesttranslation_domaint
add_option(RR7tdescriptionR:toption_listR;R=toption((s1/usr/lib64/python2.7/site-packages/glib/option.pyR�s					
cCsg|_|j�dS(N(R@t_create_option_mappings(R((s1/usr/lib64/python2.7/site-packages/glib/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��Wnctk
r�tj�d}tj	t
|��}tj|_tj
|_t
|�|_|�nXdS(Ns--i(t
startswitht	_long_optt
_short_opttprocessR<Rtsystexc_infoRtGErrortstrtOPTION_ERRORtdomaintOPTION_ERROR_BAD_VALUEtcodetmessage(toption_nametoption_valuetgrouptoptR5tgerror(R9R(s1/usr/lib64/python2.7/site-packages/glib/option.pytcallback�s

(RR	R7R?R:R=tset_translation_domainR@textendR-tadd_entries(RR9RVRStentriesRA((R9Rs1/usr/lib64/python2.7/site-packages/glib/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[(RR9((s1/usr/lib64/python2.7/site-packages/glib/option.pytget_option_group�s
cCs|x`|jD]U}|jj|j�}t|t�r
|j�}|j||�|j|j<q
q
Wtj	|j�|_
dS(N(R@R;tgettdestt
isinstancet_basestringtget_opt_stringtcheck_valueRtValuesR<(RRAtdefaulttopt_str((s1/usr/lib64/python2.7/site-packages/glib/option.pyR\�sN(	R.R/R0R8RRCR[R]R\(((s1/usr/lib64/python2.7/site-packages/glib/option.pyR	�s		cBsSeZdZd�Zd�Zd�Zd�Zd�Zd�Zddd�Z
RS(	sqCommand line parser with GOption support.

    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.

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

    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(	RtpoptTrueRhtFalseRiRR
R(RRR((s1/usr/lib64/python2.7/site-packages/glib/option.pyR�s
	cCsJ|dkrd|_n.|jd�r=|td�|_n	||_dS(NR4s%prog(R8tusageRDR(RRn((s1/usr/lib64/python2.7/site-packages/glib/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--(RDRERFRG(RQRRRSRT(RR<(s1/usr/lib64/python2.7/site-packages/glib/option.pyRVs
(R?RnRt
OptionContexttset_help_enabledRhtset_ignore_unknown_optionsRit
option_groupsR`R	R]t	add_groupR8R@RXR-RYtset_main_group(
RR<tparameter_stringtcontexttoption_grouptg_groupRVt
main_grouptmain_entriesRA((RR<s1/usr/lib64/python2.7/site-packages/glib/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)(R`RaRR
tadd_option_groupR	RR9RRRsR(RRR((s1/usr/lib64/python2.7/site-packages/glib/option.pyR}.s
cCsG|j}x6|jD]+}t|tj�r|j|j�qqW|S(N(R@RsR`RR	RX(RtoptionsRS((s1/usr/lib64/python2.7/site-packages/glib/option.pyt_get_all_options>s

cCs5|j|�}|jtjdg|�d|(dS(Nii(R|tparseRHtargv(RtlargstrargsR<Rw((s1/usr/lib64/python2.7/site-packages/glib/option.pyt
_process_argsEsc	CsA|p	g}y"tjj|||�\}}Wn�tjk
r�tj�d}|jtjkri�n|j	tj
kr�t|j��q�|j	tj
kr�t|j��q�|j	tjkr�t|j��q��nXxD|jD]9}x0|jjj�D]\}}|j||�q�Wq�W|dt|�!}||fS(Nii(RR
t
parse_argsRRJRHRIRMRLRORNRRPtOPTION_ERROR_UNKNOWN_OPTIONRtOPTION_ERROR_FAILEDRRsR<t__dict__titemstensure_valueR(	RRR<told_argsR~R5RStkeytvalue((s1/usr/lib64/python2.7/site-packages/glib/option.pyR�Ms(	N(R.R/R0RRoR|R}RR�R8R�(((s1/usr/lib64/python2.7/site-packages/glib/option.pyR
�s				 			(ii(R0RHRRRRRRtversion_infoRKRaR(t
basestringtglibtmodulesRt__all__RR	R
R(((s1/usr/lib64/python2.7/site-packages/glib/option.pyt<module>s.(
	Q[

Zerion Mini Shell 1.0