Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/config.cpython-37.pyc

B

� f��@s�dZddlmZddlZddlZddlmZddlZGdd�de�Z	Gdd�de�Z
Gd	d
�d
e�ZGdd�de�ZGd
d�de�Z
Gdd�d�Ze�Ze�Zdd�ZGdd�de�Zdd�Zedkr�ddlmZedddd�dS)aEidlelib.config -- Manage IDLE configuration information.

The comments at the beginning of config-main.def describe the
configuration files and the design implemented to update user
configuration information.  In particular, user configuration choices
which duplicate the defaults will be removed from the user's
configuration files, and if a user file becomes empty, it will be
deleted.

The configuration database maps options to values.  Conceptually, the
database keys are tuples (config-type, section, item).  As implemented,
there are  separate dicts for default and user values.  Each has
config-type keys 'main', 'extensions', 'highlight', and 'keys'.  The
value for each key is a ConfigParser instance that maps section and item
to values.  For 'main' and 'extensions', user values override
default values.  For 'highlight' and 'keys', user sections augment the
default sections (and must, therefore, have distinct names).

Throughout this module there is an emphasis on returning useable defaults
when a problem occurs in returning a requested configuration value back to
idle. This is to allow IDLE to continue to function in spite of errors in
the retrieval of config information. When a default is returned instead of
a requested config value, a message is printed to stderr to aid in
configuration problem notification and resolution.
�)�ConfigParserN)�Fontc@seZdZdS)�InvalidConfigTypeN)�__name__�
__module__�__qualname__�rr�3/opt/alt/python37/lib64/python3.7/idlelib/config.pyr#src@seZdZdS)�InvalidConfigSetN)rrrrrrr	r
$sr
c@seZdZdS)�InvalidThemeN)rrrrrrr	r%src@s4eZdZdZddd�Zd
dd�Zdd	�Zd
d�ZdS)�IdleConfParserzI
    A ConfigParser specialised for idle configuration file handling
    NcCs||_tj||dd�dS)zK
        cfgFile - string, fully specified configuration file name
        F)�defaults�strictN)�filer�__init__)�self�cfgFileZcfgDefaultsrrr	r+szIdleConfParser.__init__FcCsL|�||�s|S|dkr$|�||�S|dkr8|�||�S|j|||d�SdS)z
        Get an option value for given section/option or return default.
        If type is specified, return as type.
        �bool�int)�rawN)�
has_optionZ
getbooleanZgetint�get)r�section�option�type�defaultrrrr	�Get2szIdleConfParser.GetcCs|�|�r|�|�SgSdS)z4Return a list of options for given section, else [].N)�has_section�options)rrrrr	�
GetOptionListCs

zIdleConfParser.GetOptionListcCs|jr|�|j�dS)z&Load the configuration file from disk.N)r�read)rrrr	�LoadJszIdleConfParser.Load)N)NNF)rrr�__doc__rrrr!rrrr	r's


rc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�IdleUserConfParserzG
    IdleConfigParser specialised for user configuration handling.
    cCs^|�||�r4|�||�|kr dS|�|||�dSn&|�|�sH|�|�|�|||�dSdS)z�Return True if option is added or changed to value, else False.

        Add section if required.  False means option already had value.
        FTN)rr�setr�add_section)rrr�valuerrr	�	SetOptionTs

zIdleUserConfParser.SetOptioncCs|�|�r|�||�SdS)z�Return True if option is removed from section, else False.

        False if either section does not exist or did not have option.
        F)rZ
remove_option)rrrrrr	�RemoveOptiones
zIdleUserConfParser.RemoveOptioncCs|�|�s|�|�dS)z!If section doesn't exist, add it.N)rr%)rrrrr	�
AddSectionns
zIdleUserConfParser.AddSectioncCs*x$|��D]}|�|�s
|�|�q
WdS)z)Remove any sections that have no options.N)�sectionsr�remove_section)rrrrr	�RemoveEmptySectionsss
z&IdleUserConfParser.RemoveEmptySectionscCs|��|��S)z9Return True if no sections after removing empty sections.)r,r*)rrrr	�IsEmptyyszIdleUserConfParser.IsEmptyc	Cs�|j}|r�|ddkr�|��sryt|d�}Wn(tk
rTt�|�t|d�}YnX|�|�|�WdQRXntj�|j�r�t�	|j�dS)z�Update user configuration file.

        If self not empty after removing empty sections, write the file
        to disk. Otherwise, remove the file from disk if it exists.
        r�#�wN)
rr-�open�OSError�os�unlink�write�path�exists�remove)rZfnamerrrr	�Save~s
zIdleUserConfParser.SaveN)
rrrr"r'r(r)r,r-r8rrrr	r#Os	r#c	@seZdZdZdFdd�Zdd�Zdd�ZdGdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��ZdHdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2d3d4d5d6d7d8d9h	ZdId:d;�Zd<d=�Zd>d?�Zd@dA�ZdBdC�Z dDdE�Z!d	S)J�IdleConfalHold config parsers for all idle config files in singleton instance.

    Default config files, self.defaultCfg --
        for config_type in self.config_types:
            (idle install dir)/config-{config-type}.def

    User config files, self.userCfg --
        for config_type in self.config_types:
        (user home dir)/.idlerc/config-{config-type}.cfg
    FcCs0d|_i|_i|_i|_|s,|��|��dS)N)�main�	highlight�keys�
extensions)�config_types�
defaultCfg�userCfg�cfg�CreateConfigHandlers�LoadCfgFiles)rZ_utestrrr	r�szIdleConf.__init__cCs|tj�t�}tjrdn|��|_}xR|jD]H}t	tj�
|d|�d���|j|<ttj�
|p^dd|�d���|j
|<q,WdS)z5Populate default and user config parser dictionaries.�zconfig-z.defr.z.cfgN)r2r5�dirname�__file__�idlelib�testing�
GetUserCfgDir�userdirr>r�joinr?r#r@)rZidledirrJZcfg_typerrr	rB�szIdleConf.CreateConfigHandlerscCs�d}tj�d�}|dkrbtj�|�sbtjs^d|d}yt|tjd�Wnt	k
r\YnXd}|dkrrt�
�}tj�||�}tj�|�s�yt�|�WnRt	k
r�tjs�d|d}yt|tjd�Wnt	k
r�YnXt
�YnX|S)zfReturn a filesystem directory for storing user config files.

        Creates it if required.
        z.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!
)r2r5�
expanduserr6rGrH�print�sys�stderrr1�getcwdrK�mkdir�
SystemExit)rZcfgDirZuserDir�warnrrr	rI�s4
zIdleConf.GetUserCfgDirNTc	Cs�y.|j|�||�r,|j|j||||d�SWnDtk
rrd||||j|j|||d�f}t||||�YnXy.|j|�||�r�|j|j||||d�SWntk
r�YnX|r�d|||f}t||||�|S)aReturn a value for configType section option, or default.

        If type is not None, return a value of that type.  Also pass raw
        to the config parser.  First try to return a valid value
        (including type) from a user configuration. If that fails, try
        the default configuration. If that fails, return default, with a
        default of None.

        Warn if either user or default configurations have an invalid value.
        Warn if default is returned and warn_on_default is True.
        )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|�|||�dS)z0Set section option to value in user config file.N)r@r')rrWrrr&rrr	r'�szIdleConf.SetOptioncCsJ||jkrtd��|dkr&|j|}n|dkr:|j|}ntd��|��S)z�Return sections for configSet configType configuration.

        configSet must be either 'user' or 'default'
        configType must be in self.config_types.
        zInvalid configType specified�userrzInvalid configSet specified)r>rr@r?r
r*)r�	configSetrW�	cfgParserrrr	�GetSectionLists
zIdleConf.GetSectionListcCsR|jd�|�rdnd}|�||�}||d}|dkr<d}||d}||d�S)	z�Return dict of theme element highlight colors.

        The keys are 'foreground' and 'background'.  The values are
        tkinter color strings for configuring backgrounds and tags.
        r;rr[z-foregroundZcursor�normalz-background)Z
foregroundZ
background)r?r�GetThemeDict)r�theme�elementrAZ
theme_dictZforeZbackrrr	�GetHighlightszIdleConf.GetHighlightc Cs�|dkr|jd}n|dkr(|jd}ntd��dddddddddddddddddddddddddddddddd�}xZ|D]R}|�||�s�|�d	�s�d
||||f}t|d||�|j||||d�||<qzW|S)a)Return {option:value} dict for elements in themeName.

        type - string, 'default' or 'user' theme type
        themeName - string, theme name
        Values are loaded over ultimate fallback defaults to guarantee
        that all theme elements are present in a newly created theme.
        r[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-backgroundzcontext-foregroundzcontext-backgroundzlinenumber-foregroundzlinenumber-backgroundzcursor-foregroundzstdout-foregroundzstdout-backgroundzstderr-foregroundzstderr-backgroundzconsole-foregroundzconsole-background)zcontext-zlinenumber-z{
 Warning: config.IdleConf.GetThemeDict -
 problem retrieving theme element %r
 from theme %r.
 returning default color: %r)r)r@r?rr�
startswithrVr)rrZ	themeNamer]rarbrYrrr	r`!sZ

zIdleConf.GetThemeDictcCs
|�d�S)z9Return the name of the currently active text color theme.�Theme)�current_colors_and_keys)rrrr	�CurrentThemeeszIdleConf.CurrentThemecCs
|�d�S)z0Return the name of the currently active key set.ZKeys)rf)rrrr	�CurrentKeysiszIdleConf.CurrentKeyscCs�|dkrdnd}|jd|dddd�}d	}|r>|jd|d
d	d�}|sT|jd|dd	d�}|rz|rb|jn|j}||�|�rz|S|dkr�d
S|��S)aReturn the currently active name for Theme or Keys section.

        idlelib.config-main.def ('default') includes these sections

        [Theme]
        default= 1
        name= IDLE Classic
        name2=

        [Keys]
        default= 1
        name=
        name2=

        Item 'name2', is used for built-in ('default') themes and keys
        added after 2015 Oct 1 and 2016 July 1.  This kludge is needed
        because setting 'name' to a builtin not defined in older IDLEs
        to display multiple error messages or quit.
        See https://bugs.python.org/issue25313.
        When default = True, 'name2' takes precedence over 'name',
        while older IDLEs will just use name.  When default = False,
        'name2' may still be set, but it is ignored.
        rer;r<r:rrT)rrrDZname2)r�namezIDLE Classic)rZr?r@r�default_keys)rrZcfgnamerri�sourcerrr	rfms

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

zIdleConf.default_keysc		Cs�|�|�dd��}|�|�dd��}x|D]}||kr*|�|�q*WxdD]}|�|�qJW|r�g}xb|D]Z}|jd|dddd�rj|s�|r�|r�d	}nd
}|jd||dddd�r�|�|�qj|�|�qjW|S|Sd
S)z�Return extensions in default and user config-extensions files.

        If active_only True, only return active (enabled) extensions
        and optionally only editor or shell extensions.
        If active_only False, return all extensions.
        rr=r[)ZAutoCompleteZCodeContextZFormatParagraphZ
ParenMatchZenableTr)rrZ
enable_editorZenable_shellF)rrrXN)�RemoveKeyBindNamesr^�appendr7rZ)	r�active_onlyZeditor_onlyZ
shell_onlyZextnsZ	userExtns�extn�activeExtnsrrrr	�
GetExtensions�s2



zIdleConf.GetExtensionscCsdd�|D�S)z:Return extnNameList with keybinding section names removed.cSsg|]}|�d�s|�qS))�	_bindings�_cfgBindings)�endswith)�.0�nrrr	�
<listcomp>�sz/IdleConf.RemoveKeyBindNames.<locals>.<listcomp>r)rZextnNameListrrr	rp�szIdleConf.RemoveKeyBindNamescCsJd}d|d}x4|jdd�D]$}x|�|�D]}||kr.|}q.WqW|S)z�Return the name of the extension binding virtualEvent, or None.

        virtualEvent - string, name of the virtual event to test for,
                       without the enclosing '<< >>'
        Nz<<z>>r)rr)ru�GetExtensionKeys)r�virtualEventZextNameZvEventrs�eventrrr	�GetExtnNameForEvent�szIdleConf.GetExtnNameForEventc	Csb|d}|��}i}|jd�|�r^|jd�|�}x(|D] }d|d}||}|||<q:W|S)aReturn dict: {configurable extensionName event : active keybinding}.

        Events come from default config extension_cfgBindings section.
        Keybindings come from GetCurrentKeySet() active key dict,
        where previously used bindings are disabled.
        rwr=z<<z>>)�GetCurrentKeySetr?rr)	r�
extensionName�keysNameZ
activeKeys�extKeys�
eventNames�	eventNamer~�bindingrrr	r|�s
zIdleConf.GetExtensionKeyscCsh|d}i}|jd�|�rd|jd�|�}x6|D].}|jd||dd���}d|d}|||<q2W|S)aReturn dict {configurable extensionName event : keybinding list}.

        Events come from default config extension_cfgBindings section.
        Keybindings list come from the splitting of GetOption, which
        tries user config before default config.
        rwr=rD)rz<<z>>)r?rrrZ�split)rr�r�r�r�r�r�r~rrr	Z__GetRawExtensionKeys�s
zIdleConf.__GetRawExtensionKeyscCsn|d}|�|�}|jd�|�rj|jd�|�}x6|D].}|jd||dd���}d|d}|||<q8W|S)aReturn dict {extensionName event : active or defined keybinding}.

        Augment self.GetExtensionKeys(extensionName) with mapping of non-
        configurable events (from default config) to GetOption splits,
        as in self.__GetRawExtensionKeys.
        rvr=rD)rz<<z>>)r|r?rrrZr�)rr�Z	bindsNameZextBindsr�r�r�r~rrr	�GetExtensionBindings�s

zIdleConf.GetExtensionBindingscCs(|dd�}|jd||ddd���}|S)z�Return the keybinding list for keySetName eventStr.

        keySetName - name of key binding set (config-keys section).
        eventStr - virtual event, including brackets, as in '<<event>>'.
        ����r<rDF)rrX)rZr�)r�
keySetNameZeventStrr�r�rrr	�
GetKeyBindingszIdleConf.GetKeyBindingcCsP|�|���}tjdkrLx2|��D]&\}}dd�|D�}||kr"|||<q"W|S)z/Return CurrentKeys with 'darwin' modifications.rncSsg|]}|�dd��qS)z<Alt-z<Option-)�replace)ry�xrrr	r{%sz-IdleConf.GetCurrentKeySet.<locals>.<listcomp>)�	GetKeySetrhrOro�items)r�result�k�vZv2rrr	r�s
zIdleConf.GetCurrentKeySetcCsh|�|�}|jdd�}xL|D]D}|�|�}|rx0|D](}|||��krPd||<||||<q4WqW|S)z�Return event-key dict for keySetName core plus active extensions.

        If a binding defined in an extension is already in use, the
        extension binding is disabled by being set to ''
        �)rrrD)�GetCoreKeysru�_IdleConf__GetRawExtensionKeys�values)rr�ZkeySetrtrsr�r~rrr	r�+s



zIdleConf.GetKeySetcCsd|d|��kS)z�Return True if the virtual event is one of the core idle key events.

        virtualEvent - string, name of the virtual event to test for,
                       without the enclosing '<< >>'
        z<<z>>)r�)rr}rrr	�
IsCoreBinding=szIdleConf.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>>z<<run-custom>>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>gd?�:}|�r�|jd@�|��s<|jd@�|��s<dA|f}t|d@|�nXxV|D]N}|�||�}|�rb|||<n,||jk�rBdB||||f}t|d@||��qBW|S)Ca�Return dict of core virtual-key keybindings for keySetName.

        The default keySetName None corresponds to the keyBindings base
        dict. If keySetName is not None, bindings from the config
        file(s) are loaded _over_ these defaults, so if there is a
        problem getting any core binding there will be an 'ultimate last
        resort fallback' to the CUA-ish bindings defined here.
        z<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<Shift-Key-F5>z<Alt-Key-x>z<Alt-Key-2>):z<<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<<run-custom>>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�Os�



zIdleConf.GetCoreKeysc	Cs�g}|dkr|jd}n|dkr,|jd}ntd��|�d�}xn|D]f}|jd|dd�}|�d�dkrpd	}d	}n"|�d�}|d
��}|d��}|rD|rD|�|||f�qDW|j	dd
�d�|S)a�Return list of extra help sources from a given configSet.

        Valid configSets are 'user' or 'default'.  Return a list of tuples of
        the form (menu_item , path_to_help_file , option), or return the empty
        list.  'option' is the sequence number of the help resource.  'option'
        values determine the position of the menu items on the Help menu,
        therefore the returned list must be sorted by 'option'.

        r[r:rzInvalid configSet specified�	HelpFiles�;)r���rDrr�cSs|dS)Nr�r)r�rrr	�<lambda>��z1IdleConf.GetExtraHelpSourceList.<locals>.<lambda>)�key)
r@r?r
rr�findr��striprq�sort)	rr\ZhelpSourcesr]rrr&ZmenuItemZhelpPathrrr	�GetExtraHelpSourceList�s&



zIdleConf.GetExtraHelpSourceListcCs|�d�|�d�}|S)z�Return a list of the details of all additional help sources.

        Tuples in the list are those of GetExtraHelpSourceList.
        rr[)r�)rZallHelpSourcesrrr	�GetAllExtraHelpSourcesList�sz#IdleConf.GetAllExtraHelpSourcesListc	Cs�|j||ddd�}|j||dddd�}|j||dd	d
d�}|dkr�tdd
|d�}t�|�}|d}|d}|d	krvd}|ddk}|||r�dndfS)a�Retrieve a font from configuration (font, font-size, font-bold)
        Intercept the special value 'TkFixedFont' and substitute
        the actual font, factoring in some tweaks if needed for
        appearance sakes.

        The 'root' parameter can normally be any valid Tkinter widget.

        Return a tuple (family, size, weight) suitable for passing
        to tkinter.Font
        ZfontZcourier)rz	font-sizerZ10)rrz	font-boldrr)rrZTkFixedFontT)rir6�root�family�size�
Zweight�boldr_)rZrZactual)	rr�rWrr�r�r��fZ
actualFontrrr	�GetFont�s
zIdleConf.GetFontcCs0x*|jD] }|j|��|j|��qWdS)zLoad all configuration files.N)r?r!r@)rr�rrr	rC�szIdleConf.LoadCfgFilescCs"x|jD]}|j|��qWdS)z2Write all loaded user configuration files to disk.N)r@r8)rr�rrr	�SaveUserCfgFiles�szIdleConf.SaveUserCfgFiles)F)NNTF)TFF)N)"rrrr"rrBrIrZr'r^rcr`rgrhrf�staticmethodrjrurprr|r�r�r�r�r�r�r�r�r�r�r�rCr�rrrr	r9�sF


$
'D&	
(
` 	r9cGsH|f|}|tkrDyt|tjd�Wntk
r8YnXt�|�dS)N)r)�_warnedrNrOrPr1�add)�msgr�rrr	rVs
rVc@sDeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dS)�
ConfigChangesa�Manage a user's proposed configuration option changes.

    Names used across multiple methods:
        page -- one of the 4 top-level dicts representing a
                .idlerc/config-x.cfg file.
        config_type -- name of a page.
        section -- a section within a page/file.
        option -- name of an option within a section.
        value -- value for the option.

    Methods
        add_option: Add option and value to changes.
        save_option: Save option and value to config parser.
        save_all: Save all the changes to the config parser and file.
        delete_section: If section exists,
                        delete from changes, userCfg, and file.
        clear: Clear all changes by clearing each page.
    cCs2g|_x&tjD]}i||<|j�||�qWdS)z)Create a page for each configuration fileN)�pages�idleConfr>rq)r�config_typerrr	rszConfigChanges.__init__cCs0||}t|�}||kr i||<||||<dS)z0Add item/value pair for config_type and section.N)�str)rr�r�itemr&�pagerrr	�
add_option%s
zConfigChanges.add_optioncCsNtj|�||�r:tj|�||�|kr:tj|�||�Stj|�|||�S)zcReturn True if the configuration value was added or changed.

        Helper for save_all.
        )r�r?rrr@r(r')r�rr�r&rrr	�save_option-szConfigChanges.save_optionc	Cs�tjd��d}x�|D]~}d}||}xV|D]N}|dkrNtjd�d�d}x,||��D]\}}|�||||�r\d}q\Wq.W|rtj|��d}qWxdD]}tj|��q�W|��|S)z�Save configuration changes to the user config file.

        Clear self in preparation for additional changes.
        Return changed for testing.
        r:Fr�T)r<r;)r�r@r8r+r�r��clear)rZchangedr�Zcfg_type_changedr�rr�r&rrr	�save_all:s&


zConfigChanges.save_allcCs6|||kr|||=tj|}|�|�|��dS)zjDelete a section from self, userCfg, and file.

        Used to delete custom themes and keysets.
        N)r�r@r+r8)rr�rZ
configpagerrr	�delete_sectionXs



zConfigChanges.delete_sectioncCsx|jD]}|��qWdS)z�Clear all 4 pages.

        Called in save_all after saving to idleConf.
        XXX Mark window *title* when there are changes; unmark here.
        N)r�r�)rr�rrr	r�cszConfigChanges.clearN)rrrr"rr�r�r�r�r�r�rrrr	r�s
r�csVddlm�d\}}�fdd���fdd�}|tj�|tj�td|d	|d
d�dS)Nr)�crc32)rrcs.t|�}td7a�|jdd�t�at|�dS)Nr�zutf-8)�encoding)r��line�encode�crcrN)�objZtxt)r�rr	�sprintrsz_dump.<locals>.sprintc	s�td|d�x�t|���D]v}||��}�|��|�xT|D]L}||�|�}�|��|�x(|D] }�|d||�||��qhWq@WqWdS)N�
z = )rN�sortedr<r*rr)rAr�r*rrr)r�rr	�dumpCfgzs

z_dump.<locals>.dumpCfgz	
lines = z, crc = rD)�sep)�zlibr�r�r?r@rN)r�r�r�r)r�r�r	�_dumpns

r��__main__)r:zidlelib.idle_test.test_configr�F)�	verbosity�exit)r"Zconfigparserrr2rOZtkinter.fontrrG�	Exceptionrr
rrr#r9r�r$r�rV�dictr�r�rZunittestr:rrrr	�<module>s.(Bq
c

Hacked By AnonymousFox1.0, Coded By AnonymousFox