Sindbad~EG File Manager

Current Path : /home/infinitibizsol/mypythonenv/lib/python3.6/site-packages/Xlib/__pycache__/
Upload File :
Current File : /home/infinitibizsol/mypythonenv/lib/python3.6/site-packages/Xlib/__pycache__/rdb.cpython-36.pyc

3

�
dR�M�
@s�ddlZddlZddlZddlmZejd�Zejd�Zejd�Zejd�Z	dZ
dZdZd	Z
Gd
d�de�ZGdd
�d
�ZejGdd�d��Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZGdd�d�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZGd$d%�d%e�Ze�ZGd&d'�d'e�Ze�Z Gd(d)�d)e�Z!e!�Z"Gd*d+�d+e�Z#ej$fd,d-�Z%ed.�ed.�ed/�ed/�ed0�ed0�ed1�ed2�ed3d4�eed5�ed5�d6�Z&dS)7�N)�lockz^\s*!z#^\s*([-_a-zA-Z0-9?.*]+)\s*:\s*(.*)$z\\([ 	n\\]|[0-7]{3,3})z([.*]+)���c@seZdZdS)�OptionErrorN)�__name__�
__module__�__qualname__�r
r
�H/home/infinitibizsol/mypythonenv/lib/python3.6/site-packages/Xlib/rdb.pyr/src@s`eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zddd�Z	dd�Z
dd�Zdd�ZdS)�
ResourceDBNcCsJi|_tj�|_|dk	r"|j|�|dk	r4|j|�|dk	rF|j|�dS)N)�dbr�
allocate_lock�insert_file�
insert_string�insert_resources)�self�file�string�	resourcesr
r
r�__init__4s


zResourceDB.__init__cCs(t|�tkrt|d�}|j|j��dS)z�insert_file(file)

        Load resources entries from FILE, and insert them into the
        database.  FILE can be a filename (a string)or a file object.

        �rN)�type�str�openr�read)rrr
r
rr?s
zResourceDB.insert_filec
Cs|jd�}�x|�r|d}|d=|s(qtj|�r4qx>|ddkrr|rb|dd�|d}|d=q6|dd
�}Pq6Wtj|�}|s�q|jdd�\}}tj|�}xPtdt|�d�D]<}||}	t|	�dkr�tt	|	d��||<q�|	d	kr�d||<q�W|dj
�|d<d
j|�}|j||�qWdS)zqinsert_string(data)

        Insert the resources entries in the string DATA into the
        database.

        �
r��\Nr���n����r#r#r#r#)
�split�
comment_re�match�resource_spec_re�group�value_escape_re�range�len�chr�int�rstrip�join�insert)
r�data�lines�line�m�res�value�splits�i�sr
r
rrMs8	





zResourceDB.insert_stringcCs"x|D]\}}|j||�qWdS)ainsert_resources(resources)

        Insert all resources entries in the list RESOURCES into the
        database.  Each element in RESOURCES should be a tuple:

          (resource, value)

        Where RESOURCE is a string and VALUE can be any Python value.

        N)r0)rrr5r6r
r
rr�szResourceDB.insert_resourcescCs�tj|�}|ddkrdS|jj�|j}xrtdt|�d�D]^}||d|krdiif|||d<d||kr�|||dd}q<|||dd}q<W|d|kr�||d	dd�|f||d
<nii|f||d<|jj�dS)z�insert(resource, value)

        Insert a resource entry into the database.  RESOURCE is a
        string and VALUE can be any Python value.

        rr"Nr�*rr#r#r#r#r#)�resource_parts_rer$r�acquirer
r*r+�release)r�resourcer6�partsr
r8r
r
rr0�s	

$zResourceDB.insertc

Cs�|\}}|jd�}|jd�}t|�t|�kr<td||f��t|�}g}|jj��z||d|jkr�t|ttf|j|d��|d|jkr�t|tt	f|j|d��d|jkr�t|tt
f|jd��|dko�|�r|d}|j|�r�|j�St
||f��d|jk�r&t|tf|jdd��x�|�r�|d}|d=|j�}	xv||	tf||	t	fdt
ffD]T\}
}|j|
|�}|�r�|j|��r�|j�St||�|j|�}|�rdt||��qdW�q(Wt
||f��Wd|jj�XdS)z�db[name, class]

        Return the value matching the resource identified by NAME and
        CLASS.  If no match is found, KeyError is raised.
        �.z7Different number of parts in resource name/class: %s/%sr�?rr"N)r$r+�
ValueErrorrr<r
�
bin_insert�_Match�
NAME_MATCH�CLASS_MATCH�
WILD_MATCH�finalr6�KeyError�match_lengthr&�
skip_matchr=)
rZnc�name�clsZnamepZclsp�complen�matches�xr8�part�scorer&r
r
r�__getitem__�sN




	


zResourceDB.__getitem__cCs&y|||fStk
r |SXdS)z�get(name, class [, default])

        Return the value matching the resource identified by NAME and
        CLASS.  If no match is found, DEFAULT is returned, or None if
        DEFAULT isn't specified.

        N)rI)rr5rM�defaultr
r
r�get0s	zResourceDB.getcCs&|jj�t|j|j�|jj�dS)zrupdate(db)

        Update this database with all resources entries in the resource
        database DB.

        N)rr<�	update_dbr
r=)rr
r
r
r�update>s
zResourceDB.updatecCs$|jj�td|j�}|jj�|S)zOoutput()

        Return the resource database in text representation.
        r")rr<�	output_dbr
r=)r�textr
r
r�outputJs

zResourceDB.outputcCs�x�|r�|dr�|dddkr�y||dj|||�}Wqtk
r\td|d��Yqtk
r~td|d��YqXqW|S)a,getopt(name, argv, opts)

        Parse X command line options, inserting the recognised options
        into the resource database.

        NAME is the application name, and will be prepended to all
        specifiers.  ARGV is the list of command line arguments,
        typically sys.argv[1:].

        OPTS is a mapping of options to resource specifiers.  The key is
        the option flag (with leading -), and the value is an instance of
        some Option subclass:

        NoArg(specifier, value): set resource to value.
        IsArg(specifier):        set resource to option itself
        SepArg(specifier):       value is next argument
        ResArg:                  resource and value in next argument
        SkipArg:                 ignore this option and next argument
        SkipLine:                ignore rest of arguments
        SkipNArgs(count):        ignore this option and count arguments

        The remaining, non-option, oparguments is returned.

        rdb.OptionError is raised if there is an error in the argument list.
        r�-zunknown option: %szmissing argument to option: %s)�parserIr�
IndexError)rrL�argv�optsr
r
r�getoptUszResourceDB.getopt)NNN)N)
rrr	rrrrr0rSrUrWrZr`r
r
r
rr3s
<'q
rc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)rDcCs0||_t|�tkr d|_||_nd|_||_dS)Nrr)�pathr�tuple�skipr(r
)rraZdbsr
r
rr}sz_Match.__init__cCs|j|jkS)N)ra)r�otherr
r
r�__eq__�sz
_Match.__eq__cCs|j|jkS)N)ra)rrdr
r
r�__lt__�sz
_Match.__lt__cCs
t|j�S)N)r+ra)rr
r
rrJ�sz_Match.match_lengthcCs�|jr.||jkr(t|j|f|j|�SdSn\||jdkrXt|j|f|jd|�S||jdkr�t|j|df|jd|�SdSdS)Nrr)rcr
rDrar()rrQrRr
r
rr&�s
 z_Match.matchcCsft|j�d|krdS|jr<|jr6t|jtf|j�SdSn&|jdr^t|jtf|jd�SdSdS)Nr)r+rarcr
rD�
MATCH_SKIPr()rrNr
r
rrK�s
z_Match.skip_matchcCs0|jr(t|j�|kr(t|j�dkr(dSdSdS)Nrrr)rcr+rar()rrNr
r
rrH�s$z_Match.finalcCs
|jdS)Nr)r()rr
r
rr6�sz_Match.valueN)rrr	rrerfrJr&rKrHr6r
r
r
rrD{srDcCs�|s|j|�dSd}t|�d}xT||krv||d}|||krN|d}q$|||krd|d}q$|||kr$dSq$W|||kr�|j||�n|||kr�|j|d|�dS)z�bin_insert(list, element)

    Insert ELEMENT into LIST.  LIST must be sorted, and ELEMENT will
    be inserted to that LIST remains sorted.  If LIST already contains
    ELEMENT, it will not be duplicated.

    Nrrr)�appendr+r0)�list�element�lower�upper�centerr
r
rrC�s"	



rCcCs�x�|j�D]v\}}||krtt||d|d�t||d|d�t|�dkr�||dd�|dd�||<q
t|�||<q
WdS)Nrrr)�itemsrVr+�
copy_group)�dest�src�compr(r
r
rrV�s"rVcCs$t|d�t|d�f|dd�S)Nrrr)�copy_db)r(r
r
rro�srocCs*i}x |j�D]\}}t|�||<qW|S)N)rnro)r
Znewdbrrr(r
r
rrs�srscCsxd}xn|j�D]b\}}t|�dkr<|d||t|d�f}|t||d|d�}|t||d|d�}qW|S)Nr"rz	%s%s: %s
r@rr:r)rnr+�
output_escaperX)�prefixr
r5rrr(r
r
rrXsrXcCszt|�}|s|SxdD]\}}|j||�}qW|ddkrBd|}|ddkrv|dd�dkrv|dd�d|d}|S)Nr�\\��\000r�\nrz 	rr�rrv�rwrx�rry)rzr{r|r#���r#r#r#)r�replace)r6�char�escr
r
rrtsrtc@seZdZdd�Zdd�ZdS)�OptioncCsdS)Nr
)rr
r
rr/szOption.__init__cCsdS)Nr
)rrLr
�argsr
r
rr\2szOption.parseN)rrr	rr\r
r
r
rr�.sr�c@s eZdZdZdd�Zdd�ZdS)�NoArgz!Value is provided to constructor.cCs||_||_dS)N)�	specifierr6)rr�r6r
r
rr7szNoArg.__init__cCs |j||j|j�|dd�S)Nr)r0r�r6)rrLr
r�r
r
rr\;szNoArg.parseN)rrr	�__doc__rr\r
r
r
rr�5sr�c@s eZdZdZdd�Zdd�ZdS)�IsArgz"Value is the option string itself.cCs
||_dS)N)r�)rr�r
r
rrAszIsArg.__init__cCs"|j||j|d�|dd�S)Nrr)r0r�)rrLr
r�r
r
rr\DszIsArg.parseN)rrr	r�rr\r
r
r
rr�?sr�c@s eZdZdZdd�Zdd�ZdS)�SepArgzValue is the next argument.cCs
||_dS)N)r�)rr�r
r
rrJszSepArg.__init__cCs"|j||j|d�|dd�S)Nrr)r0r�)rrLr
r�r
r
rr\MszSepArg.parseN)rrr	r�rr\r
r
r
rr�Hsr�c@seZdZdZdd�ZdS)�ResArgClassz(Resource and value in the next argument.cCs|j|d�|dd�S)Nrr)r)rrLr
r�r
r
rr\SszResArgClass.parseN)rrr	r�r\r
r
r
rr�Qsr�c@seZdZdZdd�ZdS)�SkipArgClassz%Ignore this option and next argument.cCs|dd�S)Nrr
)rrLr
r�r
r
rr\[szSkipArgClass.parseN)rrr	r�r\r
r
r
rr�Ysr�c@seZdZdZdd�ZdS)�
SkipLineClasszIgnore rest of the arguments.cCsgS)Nr
)rrLr
r�r
r
rr\bszSkipLineClass.parseN)rrr	r�r\r
r
r
rr�`sr�c@s eZdZdZdd�Zdd�ZdS)�	SkipNArgsz0Ignore this option and the next COUNT arguments.cCs
||_dS)N)�count)rr�r
r
rriszSkipNArgs.__init__cCs|d|jd�S)Nr)r�)rrLr
r�r
r
rr\lszSkipNArgs.parseN)rrr	r�rr\r
r
r
rr�gsr�c
Cs�ddlm}m}ddl}|jj|jj|d��d}t�}|j||dd�|�}|j	|d|dd�}|j
|�}	|	jd�jj
|j|j�}
|
r�|
j}nd}t|d�}|j|�|	|||fS)a!display, name, db, args = get_display_opts(options, [argv])

    Parse X OPTIONS from ARGV (or sys.argv if not provided).

    Connect to the display specified by a *.display resource if one is
    set, or to the default X display otherwise.  Extract the
    RESOURCE_MANAGER property and insert all resources from ARGV.

    The four return values are:
      DISPLAY -- the display object
      NAME    -- the application name (the filname of ARGV[0])
      DB      -- the created resource database
      ARGS    -- any remaining arguments
    r)�display�XatomNrz.displayz.Display)r)�Xlibr�r��osra�splitext�basenamerr`rUZDisplayZscreen�rootZget_full_propertyZRESOURCE_MANAGER�STRINGr6rW)
�optionsr^r�r�r�rLZoptdbZleftargvZdname�dZ	rdbstringr1r
r
r
r�get_display_optsqs


r�z*backgroundz*foregroundz*fontz.namez.titlez*synchronous�onz.display)z-bgz-backgroundz-fgz-foregroundz-fnz-fontz-namez-titlez-synchronousz-xrmz-displayz-d)'�	functools�re�sysZXlib.supportr�compiler%r'r)r;rErFrGrg�	Exceptionrr�total_orderingrDrCrVrorsrXrtr�r�r�r�r�ZResArgr�ZSkipArgr�ZSkipLiner�r^r�Zstdoptsr
r
r
r�<module>s\



JG#
		
)

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists