ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/config.cpython-36.opt-2.pyc

3

��2aޗ�@s�ddlmZddlZddlZddlmZddlZGdd�de�ZGdd�de�Z	Gdd	�d	e�Z
Gd
d�de�ZGdd
�d
e�ZGdd�de�Z
Gdd�d�Ze�Ze�Zdd�ZGdd�de�Zdd�Zedkr�ddlmZedddd�dS)�)�ConfigParserN)�Fontc@seZdZdS)�InvalidConfigTypeN)�__name__�
__module__�__qualname__�rr�+/opt/alt/python36/lib64/python3.6/config.pyr#src@seZdZdS)�InvalidConfigSetN)rrrrrrr	r
$sr
c@seZdZdS)�InvalidFgBgN)rrrrrrr	r%src@seZdZdS)�InvalidThemeN)rrrrrrr	r&src@s0eZdZddd�Zddd�Zdd�Zd	d
�ZdS)
�IdleConfParserNcCs||_tj||dd�dS)NF)�defaults�strict)�filer�__init__)�self�cfgFileZcfgDefaultsrrr	r,szIdleConfParser.__init__FcCsL|j||�s|S|dkr$|j||�S|dkr8|j||�S|j|||d�SdS)N�bool�int)�raw)�
has_optionZ
getbooleanZgetint�get)r�section�option�type�defaultrrrr	�Get3szIdleConfParser.GetcCs|j|�r|j|�SgSdS)N)�has_section�options)rrrrr	�
GetOptionListDs

zIdleConfParser.GetOptionListcCs|jr|j|j�dS)N)r�read)rrrr	�LoadKszIdleConfParser.Load)N)NNF)rrrrrr r"rrrr	r
(s

r
c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�IdleUserConfParsercCs^|j||�r4|j||�|kr dS|j|||�dSn&|j|�sH|j|�|j|||�dSdS)NFT)rr�setr�add_section)rrr�valuerrr	�	SetOptionUs

zIdleUserConfParser.SetOptioncCs|j|�r|j||�SdS)NF)rZ
remove_option)rrrrrr	�RemoveOptionfs
zIdleUserConfParser.RemoveOptioncCs|j|�s|j|�dS)N)rr%)rrrrr	�
AddSectionos
zIdleUserConfParser.AddSectioncCs*x$|j�D]}|j|�s
|j|�q
WdS)N)�sectionsr �remove_section)rrrrr	�RemoveEmptySectionsts
z&IdleUserConfParser.RemoveEmptySectionscCs|j�|j�S)N)r,r*)rrrr	�IsEmptyzszIdleUserConfParser.IsEmptycCstjj|j�rtj|j�dS)N)�os�path�existsr�remove)rrrr	�
RemoveFileszIdleUserConfParser.RemoveFilecCsr|j}|rn|j�sfyt|d�}Wn(tk
rHtj|�t|d�}YnX|�|j|�WdQRXn|j�dS)N�w)rr-�open�OSErrorr.�unlink�writer2)rZfnamerrrr	�Save�s
zIdleUserConfParser.SaveN)
rrrr'r(r)r,r-r2r8rrrr	r#Ps	r#c@seZdZdDdd�Zdd�Zdd�ZdEd
d�Zdd
�Zdd�ZdFdd�Z	dd�Z
dd�Zdd�Zdd�Z
edd��ZdGdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1d2d3d4d5d6d7hZdHd8d9�Zd:d;�Zd<d=�Zd>d?�Zd@dA�ZdBdC�Z dS)I�IdleConfFcCs0d|_i|_i|_i|_|s,|j�|j�dS)N�main�	highlight�keys�
extensions)r:r;r<r=)�config_types�
defaultCfg�userCfg�cfg�CreateConfigHandlers�LoadCfgFiles)rZ_utestrrr	r�szIdleConf.__init__cCs�tdkrtjjt�}ntjjtjd�}|j�|_}i}i}xB|j	D]8}tjj
|d|d�||<tjj
|d|d�||<qFWx2|j	D](}t||�|j|<t
||�|j|<q�WdS)N�__main__rzconfig-z.defz.cfg)rr.r/�dirname�__file__�abspath�sys�
GetUserCfgDirZuserdirr>�joinr
r?r#r@)rZidleDir�userDirZdefCfgFilesZusrCfgFilesZcfgTyperrr	rB�szIdleConf.CreateConfigHandlerscCs�d}tjjd�}|dkr\tjj|�s\d|d}yt|tjd�Wntk
rVYnXd}|dkrltj�}tjj	||�}tjj|�s�ytj
|�Wn8tk
r�d|d}tjs�t|tjd�t
�YnX|S)Nz.idlerc�~z.
 Warning: os.path.expanduser("~") points to
 z,
 but the path does not exist.)rz2
 Warning: unable to create user config directory
z(
 Check path and permissions.
 Exiting!
)r.r/�
expanduserr0�printrH�stderrr5�getcwdrJ�mkdir�idlelibZtesting�
SystemExit)rZcfgDirrK�warnrrr	rI�s,
zIdleConf.GetUserCfgDirNTc	Cs�y.|j|j||�r,|j|j||||d�SWnDtk
rrd||||j|j|||d�f}t||||�YnXy.|j|j||�r�|j|j||||d�SWntk
r�YnX|r�d|||f}t||||�|S)N)rrzn
 Warning: config.py - IdleConf.GetOption -
 invalid %r value for configuration option %r
 from section %r: %r)rz�
 Warning: config.py - IdleConf.GetOption -
 problem retrieving configuration option %r
 from section %r.
 returning default value: %r)r@rr�
ValueError�_warnr?)	r�
configTyperrrr�warn_on_defaultr�warningrrr	�	GetOption�s(

zIdleConf.GetOptioncCs|j|j|||�dS)N)r@r')rrWrrr&rrr	r'
szIdleConf.SetOptioncCsJ||jkrtd��|dkr&|j|}n|dkr:|j|}ntd��|j�S)NzInvalid configType specified�userrzInvalid configSet specified)r>rr@r?r
r*)r�	configSetrW�	cfgParserrrr	�GetSectionLists
zIdleConf.GetSectionListcCs�|jdj|�r|jd|�}n|jd|�}||d}|dkrH|d}n||d}||d�}|sf|S|d	krv|d
S|dkr�|dStd
��dS)Nr;rr[z-foregroundZcursorznormal-backgroundz-background)�
foreground�
backgroundZfgr_�bgr`zInvalid fgBg specified)r?r�GetThemeDictr)r�theme�elementZfgBgZ	themeDictZforeZbackr;rrr	�GetHighlights	

zIdleConf.GetHighlightcCs�|dkr|jd}n|dkr(|jd}ntd��dddddddddddddddddddddddddddddd�}xP|D]H}|j||�s�d	||||f}t|d||�|j||||d
�||<qvW|S)Nr[r;rzInvalid theme type specifiedz#000000z#ffffffZgray)znormal-foregroundznormal-backgroundzkeyword-foregroundzkeyword-backgroundzbuiltin-foregroundzbuiltin-backgroundzcomment-foregroundzcomment-backgroundzstring-foregroundzstring-backgroundzdefinition-foregroundzdefinition-backgroundzhilite-foregroundzhilite-backgroundzbreak-foregroundzbreak-backgroundzhit-foregroundzhit-backgroundzerror-foregroundzerror-backgroundzcursor-foregroundzstdout-foregroundzstdout-backgroundzstderr-foregroundzstderr-backgroundzconsole-foregroundzconsole-backgroundzcontext-foregroundzcontext-backgroundz{
 Warning: config.IdleConf.GetThemeDict -
 problem retrieving theme element %r
 from theme %r.
 returning default color: %r)r)r@r?rrrVr)rrZ	themeNamer]rcrdrYrrr	rb;sT
zIdleConf.GetThemeDictcCs
|jd�S)N�Theme)�current_colors_and_keys)rrrr	�CurrentTheme{szIdleConf.CurrentThemecCs
|jd�S)NZKeys)rg)rrrr	�CurrentKeysszIdleConf.CurrentKeyscCs�|dkrdnd}|jd|dddd�}d	}|r>|jd|d
d	d�}|sT|jd|dd	d�}|rz|rb|jn|j}||j|�rz|S|dkr�d
S|j�S)Nrfr;r<r:rrT)rr�Zname2)r�namezIDLE Classic)rZr?r@r�default_keys)rrZcfgnamerrk�sourcerrr	rg�s

z IdleConf.current_colors_and_keyscCs,tjdd�dkrdStjdkr$dSdSdS)N��winzIDLE Classic Windows�darwinzIDLE Classic OSXzIDLE Modern Unix)rH�platformrrrr	rl�s

zIdleConf.default_keysc		Cs�|j|jdd��}|j|jdd��}x|D]}||kr*|j|�q*WxdD]}|j|�qJW|r�g}xb|D]Z}|jd|dd	d
d�rj|s�|r�|r�d}nd
}|jd||d	d
dd�r�|j|�qj|j|�qjW|S|SdS)Nrr=r[�AutoComplete�CodeContext�FormatParagraph�
ParenMatch�enableTr)rrZ
enable_editorZenable_shellF)rrrX)rrrsrtru)�RemoveKeyBindNamesr^�appendr1rZ)	r�active_onlyZeditor_onlyZ
shell_onlyZextnsZ	userExtns�extn�activeExtnsrrrr	�
GetExtensions�s4


zIdleConf.GetExtensionscCsdd�|D�S)NcSsg|]}|jd�s|�qS)�	_bindings�_cfgBindings)r}r~)�endswith)�.0�nrrr	�
<listcomp>�sz/IdleConf.RemoveKeyBindNames.<locals>.<listcomp>r)rZextnNameListrrr	rw�szIdleConf.RemoveKeyBindNamescCsJd}d|d}x4|jdd�D]$}x|j|�D]}||kr.|}q.WqW|S)Nz<<z>>r)ry)r|�GetExtensionKeys)r�virtualEventZextNameZvEventrz�eventrrr	�GetExtnNameForEvent�szIdleConf.GetExtnNameForEventc	Csb|d}|j�}i}|jdj|�r^|jdj|�}x(|D] }d|d}||}|||<q:W|S)Nr~r=z<<z>>)�GetCurrentKeySetr?rr )	r�
extensionName�keysNameZ
activeKeys�extKeys�
eventNames�	eventNamer��bindingrrr	r��s
zIdleConf.GetExtensionKeyscCsh|d}i}|jdj|�rd|jdj|�}x6|D].}|jd||dd�j�}d|d}|||<q2W|S)Nr~r=rj)rz<<z>>)r?rr rZ�split)rr�r�r�r�r�r�r�rrr	Z__GetRawExtensionKeys�s
zIdleConf.__GetRawExtensionKeyscCsn|d}|j|�}|jdj|�rj|jdj|�}x6|D].}|jd||dd�j�}d|d}|||<q8W|S)Nr}r=rj)rz<<z>>)r�r?rr rZr�)rr�Z	bindsNameZextBindsr�r�r�r�rrr	�GetExtensionBindingss

zIdleConf.GetExtensionBindingscCs(|dd�}|jd||ddd�j�}|S)N�r<rjF)rrX���)rZr�)r�
keySetNameZeventStrr�r�rrr	�
GetKeyBinding%szIdleConf.GetKeyBindingcCsP|j|j��}tjdkrLx2|j�D]&\}}dd�|D�}||kr"|||<q"W|S)NrpcSsg|]}|jdd��qS)z<Alt-z<Option-)�replace)r��xrrr	r�;sz-IdleConf.GetCurrentKeySet.<locals>.<listcomp>)�	GetKeySetrirHrq�items)r�result�k�vZv2rrr	r�0s
zIdleConf.GetCurrentKeySetcCsh|j|�}|jdd�}xL|D]D}|j|�}|rx0|D](}|||j�krPd||<||||<q4WqW|S)N�)ryrj)�GetCoreKeysr|�_IdleConf__GetRawExtensionKeys�values)rr�ZkeySetr{rzr�r�rrr	r�As



zIdleConf.GetKeySetcCsd|d|j�kS)Nz<<z>>)r�)rr�rrr	�
IsCoreBindingSszIdleConf.IsCoreBindingz<<force-open-completions>>z<<expand-word>>z<<force-open-calltip>>z<<flash-paren>>z<<format-paragraph>>z<<run-module>>z<<check-module>>z<<zoom-height>>c:Cs�ddgddgddgddgd	gd
gdgdgdgd
gdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgdgd gd!d"gd#gd$gd%gd&gd'gd(gd)d*gd+gd,gd-gd.gd/gd0gd1gd2gd3gd4gd5gd6gd7gd8gd9gd:gd;gd<gd=gd>�9}|�r�|jd?j|��p|jd?j|��s8d@|f}t|d?|�nXxV|D]N}|j||�}|�r^|||<n,||jk�r>dA||||f}t|d?||��q>W|S)BNz<Control-c>z<Control-C>z<Control-x>z<Control-X>z<Control-v>z<Control-V>z<Control-a>z<Home>z<Control-l>z<Control-q>z<Alt-F4>z<Control-d>z<F1>z
<Shift-F1>z<Alt-n>z<Alt-p>z<F6>z<Control-F6>z<Alt-c>z<Alt-m>z<Control-n>z<Control-o>z<Control-j>z<Control-p>z<Control-y>z<Escape>z
<Alt-Shift-S>z<Alt-s>z<Control-s>z<Alt-a>z<Control-slash>z<Control-z>z<Control-g>z<F3>z<Alt-F3>z<Control-F3>z<Control-f>z<Control-h>z<Alt-g>z<Key-BackSpace>z<Key-Return>z<Key-KP_Enter>z	<Key-Tab>z<Control-Key-bracketright>z<Control-Key-bracketleft>z<Alt-Key-3>z<Alt-Key-4>z<Alt-Key-5>z<Alt-Key-6>z<Alt-Key-t>z<Alt-Key-u>z<Control-Key-BackSpace>z<Control-Key-Delete>z<Control-Key-space>z<Alt-Key-slash>z<Control-Key-backslash>z<Control-Key-0>z<Alt-Key-q>z<Key-F5>z<Alt-Key-x>z<Alt-Key-2>)9z<<copy>>z<<cut>>z	<<paste>>z<<beginning-of-line>>z<<center-insert>>z<<close-all-windows>>z<<close-window>>z<<do-nothing>>z<<end-of-file>>z<<python-docs>>z<<python-context-help>>z<<history-next>>z<<history-previous>>z<<interrupt-execution>>z<<view-restart>>z<<restart-shell>>z<<open-class-browser>>z<<open-module>>z<<open-new-window>>z<<open-window-from-file>>z<<plain-newline-and-indent>>z<<print-window>>z<<redo>>z<<remove-selection>>z<<save-copy-of-window-as-file>>z<<save-window-as-file>>z<<save-window>>z<<select-all>>z<<toggle-auto-coloring>>z<<undo>>z<<find-again>>z<<find-in-files>>z<<find-selection>>z<<find>>z<<replace>>z
<<goto-line>>z<<smart-backspace>>z<<newline-and-indent>>z<<smart-indent>>z<<indent-region>>z<<dedent-region>>z<<comment-region>>z<<uncomment-region>>z<<tabify-region>>z<<untabify-region>>z<<toggle-tabs>>z<<change-indentwidth>>z<<del-word-left>>z<<del-word-right>>z<<force-open-completions>>z<<expand-word>>z<<force-open-calltip>>z<<flash-paren>>z<<format-paragraph>>z<<run-module>>z<<check-module>>z<<zoom-height>>r<za
 Warning: config.py - IdleConf.GetCoreKeys -
 key set %r is not defined, using default bindings.z�
 Warning: config.py - IdleConf.GetCoreKeys -
 problem retrieving key binding for event %r
 from key set %r.
 returning default value: %r)r@rr?rVr��former_extension_events)rr�ZkeyBindingsrYr�r�rrr	r�cs�



zIdleConf.GetCoreKeysc	Cs�g}|dkr|jd}n|dkr,|jd}ntd��|jd�}xn|D]f}|jd|dd�}|jd�dkrpd	}d	}n"|jd�}|d
j�}|dj�}|rD|rD|j|||f�qDW|j	dd�d
�|S)Nr[r:rzInvalid configSet specified�	HelpFiles�;)rr�rjrcSs|dS)Nr�r)r�rrr	�<lambda>�sz1IdleConf.GetExtraHelpSourceList.<locals>.<lambda>)�key���)
r@r?r
r r�findr��striprx�sort)	rr\ZhelpSourcesr]rrr&ZmenuItemZhelpPathrrr	�GetExtraHelpSourceList�s&



zIdleConf.GetExtraHelpSourceListcCs|jd�|jd�}|S)Nrr[)r�)rZallHelpSourcesrrr	�GetAllExtraHelpSourcesList�sz#IdleConf.GetAllExtraHelpSourcesListc	Cs�|j||ddd�}|j||dddd�}|j||dd	d
d�}|dkr�tdd
|d�}tj|�}|d}|d}|d	krvd}|ddk}|||r�dndfS)NZfontZcourier)rz	font-sizerZ10)rrz	font-boldrr)rrZTkFixedFontT)rkr0�root�family�size�
Zweight�boldZnormal)rZr�actual)	rr�rWrr�r�r��fZ
actualFontrrr	�GetFont�s
zIdleConf.GetFontcCs0x*|jD] }|j|j�|j|j�qWdS)N)r?r"r@)rr�rrr	rCszIdleConf.LoadCfgFilescCs"x|jD]}|j|j�qWdS)N)r@r8)rr�rrr	�SaveUserCfgFilesszIdleConf.SaveUserCfgFiles)F)NNTF)N)TFF)N)!rrrrrBrIrZr'r^rerbrhrirg�staticmethodrlr|rwr�r�r�r�r�r�r�r�r�r�r�r�r�rCr�rrrr	r9�sB

 
'
@&	
(

_ 	r9cGsH|f|}|tkrDyt|tjd�Wntk
r8YnXtj|�dS)N)r)�_warnedrNrHrOr5�add)�msgr�rrr	rVs
rVc@s@eZdZdd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	d
S)�
ConfigChangescCs2g|_x&tjD]}i||<|jj||�qWdS)N)�pages�idleConfr>rx)r�config_typerrr	r1szConfigChanges.__init__cCs0||}t|�}||kr i||<||||<dS)N)�str)rr�r�itemr&�pagerrr	�
add_option8s
zConfigChanges.add_optioncCsNtj|j||�r:tj|j||�|kr:tj|j||�Stj|j|||�S)N)r�r?rrr@r(r')r�rr�r&rrr	�save_option@szConfigChanges.save_optioncCs�tjdj�d}x�|D]~}d}||}xV|D]N}|dkrNtjdjd�d}x,||j�D]\}}|j||||�r\d}q\Wq.W|rtj|j�d}qWxdD]}tj|j�q�W|j�|S)Nr:Fr�Tr<r;)r<r;)r�r@r8r+r�r��clear)rZchangedr�Zcfg_type_changedr�rr�r&rrr	�save_allMs&


zConfigChanges.save_allcCs6|||kr|||=tj|}|j|�|j�dS)N)r�r@r+r8)rr�rZ
configpagerrr	�delete_sectionks



zConfigChanges.delete_sectioncCsx|jD]}|j�qWdS)N)r�r�)rr�rrr	r�vszConfigChanges.clearN)
rrrrr�r�r�r�r�r�rrrr	r�s
r�csVddlm�d\}}�fdd���fdd�}|tj�|tj�td|d|d	d
�dS)Nr)�crc32cs.t|�}td7a�|jdd�t�at|�dS)Nr�zutf-8)�encoding)r��line�encode�crcrN)�objZtxt)r�rr	�sprint�sz_dump.<locals>.sprintcs�td|d�x�t|j��D]v}||j�}�|��|�xT|D]L}||j|�}�|��|�x(|D] }�|d||j||��qhWq@WqWdS)N�
z = )rN�sortedr<r*rr)rAr�r*rrr)r�rr	�dumpCfg�s

z_dump.<locals>.dumpCfgz	
lines = z, crc = rj)�sep)rr)�zlibr�r�r?r@rN)r�r�r�r)r�r�r	�_dump�s

r�rD)r:zidlelib.idle_test.test_configr�F)�	verbosity�exit)Zconfigparserrr.rHZtkinter.fontrrR�	Exceptionrr
rrr
r#r9r�r$r�rV�dictr�r�rZunittestr:rrrr	�<module>s.(H}
c

Zerion Mini Shell 1.0