
    HR-exv                     *   d Z ddlZddlZddlZddlZddlZddlZddlmZmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZmZ ddlmZmZ dd	lmZ dd
lmZmZ ddlmZ ddlmZ dZ G d de          Z ed           G d de                      Z G d de          Z  G d de          Z! G d de          Z" G d de#          Z$ G d de$          Z% G d d           Z&i Z'd*d!Z(dZ)d+d#Z*d,d%Z+d*d&Z,d-d'Z- ed          d.d(            Z.d/d)Z/dS )0a  This module contains classes and functions to standardize access to
configuration files for Astropy and affiliated packages.

.. note::
    The configuration system makes use of the 'configobj' package, which stores
    configuration in a text format like that used in the standard library
    `ConfigParser`. More information and documentation for configobj can be
    found at https://configobj.readthedocs.io .
    N)contextmanagernullcontext)path)TextWrapper)warn)	configobjvalidate)find_current_modulesilence)
deprecated)AstropyDeprecationWarningAstropyWarning)resolve_name   )get_config_dir)InvalidConfigurationItemWarningConfigurationMissingWarning
get_configreload_configConfigNamespace
ConfigItemgenerate_configcreate_config_filec                       e Zd ZdZdS )r   zA Warning that is issued when the configuration value specified in the
    astropy configuration file does not match the type expected for that
    configuration value.
    N__name__
__module____qualname____doc__     <lib/python3.11/site-packages/astropy/config/configuration.pyr   r   +   s           r!   r   z5.0c                       e Zd ZdZdS )r   a1  A Warning that is issued when the configuration directory cannot be
    accessed (usually due to a permissions problem). If this warning appears,
    configuration items will be set to their defaults rather than read from the
    configuration file, and no configuration will persist across sessions.
    Nr   r    r!   r"   r   r   4   s           r!   r   c                       e Zd ZdZdS ) ConfigurationDefaultMissingErrorz{An exception that is raised when the configuration defaults (which
    should be generated at build-time) are missing.
    Nr   r    r!   r"   r%   r%   >              r!   r%   c                       e Zd ZdZdS )"ConfigurationDefaultMissingWarningzxA warning that is issued when the configuration defaults (which
    should be generated at build-time) are missing.
    Nr   r    r!   r"   r(   r(   E   r&   r!   r(   c                       e Zd ZdZdS )ConfigurationChangedWarningz@
    A warning that the configuration options have changed.
    Nr   r    r!   r"   r*   r*   K   r&   r!   r*   c                       e Zd Zd ZdS )_ConfigNamespaceMetac                     | j         d         t          u rd S |                                D ]!\  }}t          |t                    r||_        "d S )Nr   )	__bases__objectitems
isinstancer   name)clsr2   basesdictkeyvals         r"   __init__z_ConfigNamespaceMeta.__init__R   sX    =v%%F

 	 	HC#z** 	 	r!   N)r   r   r   r8   r    r!   r"   r,   r,   Q   s#            r!   r,   c                   @    e Zd ZdZd ZeZ	 d Zd Zd Zd	dZ	d	dZ
dS )
r   as  
    A namespace of configuration items.  Each subpackage with
    configuration items should define a subclass of this class,
    containing `ConfigItem` instances as members.

    For example::

        class Conf(_config.ConfigNamespace):
            unicode_output = _config.ConfigItem(
                False,
                'Use Unicode characters when outputting values, ...')
            use_color = _config.ConfigItem(
                sys.platform != 'win32',
                'When True, use ANSI color escape sequences when ...',
                aliases=['astropy.utils.console.USE_COLOR'])
        conf = Conf()
    c              #      K   | j         j                                        D ]\  }}t          |t                    r|V  d S N	__class____dict__r0   r1   r   selfr6   r7   s      r"   __iter__zConfigNamespace.__iter__n   sP      /5577 	 	HC#z** 				 	r!   c              #   ~   K   | j         j                                        D ]}t          |t                    r|V  dS )z'Iterate over configuration item values.N)r=   r>   valuesr1   r   r@   r7   s     r"   rC   zConfigNamespace.valuesv   sL      >*1133 	 	C#z** 				 	r!   c              #      K   | j         j                                        D ] \  }}t          |t                    r||fV  !dS )z8Iterate over configuration item ``(name, value)`` pairs.Nr<   r?   s      r"   r0   zConfigNamespace.items|   sT      /5577 	 	HC#z** 3h	 	r!   c                     t          | |          r%| j        j        |                             |          S t	          d| d          )a  
        Temporarily set a configuration value.

        Parameters
        ----------
        attr : str
            Configuration item name

        value : object
            The value to set temporarily.

        Examples
        --------
        >>> import astropy
        >>> with astropy.conf.set_temp('use_color', False):
        ...     pass
        ...     # console output will not contain color
        >>> # console output contains color again...
        No configuration parameter '')hasattrr=   r>   set_tempAttributeError)r@   attrvalues      r"   rJ   zConfigNamespace.set_temp   sO    ( 4 	A>*4099%@@@CDCCCDDDr!   Nc                     |Gt          | |          r$| j        j        |                                         S t	          d| d          |                                 D ]}|                                 dS )a  
        Reload a configuration item from the configuration file.

        Parameters
        ----------
        attr : str, optional
            The name of the configuration parameter to reload.  If not
            provided, reload all configuration parameters.
        NrG   rH   )rI   r=   r>   reloadrK   rC   )r@   rL   items      r"   rO   zConfigNamespace.reload   s     tT"" >~.t4;;=== !G!G!G!GHHHKKMM 	 	DKKMMMM	 	r!   c                    |Qt          | |          r.| j        j        |         }|                    |j                   dS t          d| d          |                                 D ]}|                    |j                   dS )a  
        Reset a configuration item to its default.

        Parameters
        ----------
        attr : str, optional
            The name of the configuration parameter to reload.  If not
            provided, reset all configuration parameters.
        NrG   rH   )rI   r=   r>   setdefaultvaluerK   rC   )r@   rL   proprP   s       r"   resetzConfigNamespace.reset   s     tT"" ~.t4*+++ !G!G!G!GHHHKKMM 	( 	(DHHT&''''	( 	(r!   r;   )r   r   r   r   rA   keysrC   r0   rJ   rO   rU   r    r!   r"   r   r   [   s         $  
 D0    E E E0   $( ( ( ( ( (r!   r   )	metaclassc                       e Zd ZdZ ej                    ZdZ	 dZ	 	 ddZ	d Z
ddZd Zed	             Zd
 Zd Zd Zd Zd ZdS )r   a  
    A setting and associated value stored in a configuration file.

    These objects should be created as members of
    `ConfigNamespace` subclasses, for example::

        class _Conf(config.ConfigNamespace):
            unicode_output = config.ConfigItem(
                False,
                'Use Unicode characters when outputting values, and writing widgets '
                'to the console.')
        conf = _Conf()

    Parameters
    ----------
    defaultvalue : object, optional
        The default value for this item. If this is a list of strings, this
        item will be interpreted as an 'options' value - this item must be one
        of those values, and the first in the list will be taken as the default
        value.

    description : str or None, optional
        A description of this item (will be shown as a comment in the
        configuration file)

    cfgtype : str or None, optional
        A type specifier like those used as the *values* of a particular key
        in a ``configspec`` file of ``configobj``. If None, the type will be
        inferred from the default value.

    module : str or None, optional
        The full module name that this item is associated with. The first
        element (e.g. 'astropy' if this is 'astropy.config.configuration')
        will be used to determine the name of the configuration file, while
        the remaining items determine the section. If None, the package will be
        inferred from the package within which this object's initializer is
        called.

    aliases : str, or list of str, optional
        The deprecated location(s) of this configuration item.  If the
        config item is not found at the new location, it will be
        searched for at all of the old locations.

    Raises
    ------
    RuntimeError
        If ``module`` is `None`, but the module this item is created from
        cannot be determined.
    Nastropy c                    ddl m} |.t          d          }|d}d}t          ||z             |j        }|| _        || _        || _        | ||          rEt          |t                    s0d |D             }	dd
                    |	          z   d	z   }|	d         }nnt          |t                    rd
}nVt          |t                    rd}n>t          |t                    rd}n&t          |t                    rd}t          |          }|| _        |                     |           || _        |	g | _        d S t          |t                    r
|g| _        d S || _        d S )Nr   )
isiterable   2Cannot automatically determine get_config module, 3because it is not called from inside a valid modulec                 ,    g | ]}t          |          S r    )str.0vs     r"   
<listcomp>z'ConfigItem.__init__.<locals>.<listcomp>  s    666AQ666r!   zoption(, )booleanintegerfloatstring)astropy.utilsr\   r
   RuntimeErrorr   moduledescriptionr   r1   ra   joinboolintrj   cfgtype_validate_valrS   aliases)
r@   rS   ro   rs   rn   ru   r\   msg1msg2dvstrs
             r"   r8   zConfigItem.__init__  s    	-,,,,,>(++F~KL"4$;///&" ?z,'' 1
<0M0M 166666#dii&6&66<$QxL$// 1#L#.. 1#L%00 1!L#.. 1""<00<((((?DLLL%% 	##9DLLL"DLLLr!   c                 ,    |                      |          S r;   rR   )r@   objrM   s      r"   __set__zConfigItem.__set__1  s    xxr!   c                     || S  |             S r;   r    )r@   r{   objtypes      r"   __get__zConfigItem.__get__4  s    ;Ktvvr!   c                     	 |                      |          }n<# t          j        $ r*}t          d| j         d|j        d                    d}~ww xY wt          | j        | j                  }||| j        <   dS )a  
        Sets the current value of this ``ConfigItem``.

        This also updates the comments that give the description and type
        information.

        Parameters
        ----------
        value
            The value this item should be set to.

        Raises
        ------
        TypeError
            If the provided ``value`` is not valid for this ``ConfigItem``.
        z&Provided value for configuration item z not valid: r   Nrootname)	rt   r	   ValidateError	TypeErrorr2   argsr   rn   r   )r@   rM   esecs       r"   rR   zConfigItem.set9  s    "	&&u--EE% 	 	 	     F1I     	 t}===DIs    A%AAc              #      K    |             }|                      |           	 dV  |                      |           dS # |                      |           w xY w)a  
        Sets this item to a specified value only inside a with block.

        Use as::

            ITEM = ConfigItem('ITEM', 'default', 'description')

            with ITEM.set_temp('newval'):
                #... do something that wants ITEM's value to be 'newval' ...
                print(ITEM)

            # ITEM is now 'default' after the with block

        Parameters
        ----------
        value
            The value to set this item to inside the with block.

        Nrz   )r@   rM   initvals      r"   rJ   zConfigItem.set_tempV  s`      * $&&	EEEHHWDHHWs	   > Ac                    |                      | j                   t          | j        d| j                  }|j        }|}|j        |ur|j        }|j        |ut          j        |j	        d          }|&||vr|
                    | j                  S ||         }| j        |v r|| j                 || j        <   |
                    | j                  S )zReloads the value of this ``ConfigItem`` from the relevant
        configuration file.

        Returns
        -------
        val : object
            The new value loaded from the configuration file.

        Tr   Finterpolation)rR   rS   r   rn   r   r2   parentr   	ConfigObjfilenameget)r@   baseobjsecnamecobjnewobjs        r"   rO   zConfigItem.reloadr  s     	"###T[$GGG,k%%;D k%% $T]%HHHf$${{49---G_F9!'	!2GDI{{49%%%r!   c           
      j    d| j         j         d| j        d |             dt          |           dd	S )N<z: name=z value=z at 0xx>)r=   r   r2   idr@   s    r"   __repr__zConfigItem.__repr__  sX     '    	    DDFF    T((     	
r!   c           
          d                     | j        j         d| j         d| j        d| j        d| j        d| j         d |             f          S )N
z: z
  cfgtype=z  defaultvalue=z  description=z	  module=z  value=)rp   r=   r   r2   rs   rS   ro   rn   r   s    r"   __str__zConfigItem.__str__  s|    yy>*99di99-T\--7$"3775!155)DK))%4466%%	
 	
 		
r!   c                 
   d }g }t          | j        | j                  }| j        |v r-|                    || j                 | j        | j        f           | j        D ]}|                    dd          \  }}t          || j                  }d|v r|                    dd          \  }}n|}d}||v rd| j        v r"| j                            dd          d         }nd}t          d| d ||           dt          || j                   d	| j         d ||           d
t                     |                    ||         ||f           t          |          dk    r7|                     | j                   |                    | j        ddf           t          |          dk    r| j                            dd          \  }}t          d| j         d ||           dt          || j                   dd                    d |D                        d	t                     |d         d         }		 |                     |	          S # t           j        $ r"}
t%          d|
j        d                    d}
~
ww xY w)aD  Returns the value of this ``ConfigItem``.

        Returns
        -------
        val : object
            This item's value, with a type determined by the ``cfgtype``
            attribute.

        Raises
        ------
        TypeError
            If the configuration value as stored is not this item's type.

        c                     | dk    rdS d|  dS )NrZ   zat the top-levelzin section []r    )sections    r"   section_namez)ConfigItem.__call__.<locals>.section_name  s"    "}}))0g0000r!   r   .r   rZ   zConfig parameter 'z' z of the file 'z' is deprecated. Use 'z	 instead.r   Nz#' is given by more than one alias (rf   c                 X    g | ]'}|d          
d                     |d d                   (S )r   Nr      )rp   )rc   r   s     r"   re   z'ConfigItem.__call__.<locals>.<listcomp>  s5    VVVQQqTEU1Q3 0 0EUEUEUr!   z). Using the first.zConfiguration value not valid: )r   rn   r   r2   appendru   rsplitsplitr   get_config_filenamer   lenrR   rS   rp   rt   r	   r   r   r   )r@   r   optionsr   aliasrn   r2   r   
new_moduler7   r   s              r"   __call__zConfigItem.__call__  s    	1 	1 	1 t}===9NNC	NDKCDDD\ 	: 	:E <<Q//LFDVdm<<<Cf}}#)<<Q#7#7 &&!s{{$+%%!%!2!23!:!:1!=JJ!#J< < <f1E1E < <,XNNN< <)-< < %Z00< < < .   D	648999w<<1HHT&'''NND-tT:;;;w<<! K--c155MHc$TY $ $,,s2C2C $ $(DMJJJ$ $ YYVV'VVVWW$ $ $
 *   ajm	K%%c***% 	K 	K 	KIafQiIIJJJ	Ks   <I J I==Jc                 B    | j                             | j        |          S )zValidates the provided value based on cfgtype and returns the
        type-cast value.

        throws the underlying configobj exception if it fails
        )
_validatorcheckrs   rD   s     r"   rt   zConfigItem._validate_val  s     $$T\3777r!   )rZ   NNNNr;   )r   r   r   r   r	   	Validatorr   rs   r   r8   r|   r   rR   r   rJ   rO   r   r   r   rt   r    r!   r"   r   r      s       0 0h $#%%JG
 H
 UY-# -# -# -#^     
  :   ^6& & &:
 
 


 

 

EK EK EKN	8 	8 	8 	8 	8r!   r   c                 d    t          | |          }|j        |ur|j        }|j        |u|j        S )z^
    Get the filename of the config file associated with the given
    package or module.
    r   )r   r   r   )packageormodr   cfgs      r"   r   r     sA    
 \H
5
5
5C
*C

j *C

<r!   Fc                 V   | 1t          d          } | d}d}t          ||z             | j        } d}nd}|                     d          }|d         }d                    |d	d                   }||r|}nd
}t
                              |d          }	|	|r~d}
	 t          t          }
n&t          j        t          |          |dz             }
t          j        |
d          }	n%# t          $ r t          j        d          }	Y nw xY w|	t
          |<   |r||	vri |	|<   |	|         S |	S )a  Gets the configuration object or section associated with a particular
    package or module.

    Parameters
    ----------
    packageormod : str or None
        The package for which to retrieve the configuration object. If a
        string, it must be a valid package name, or if ``None``, the package from
        which this function is called will be used.

    reload : bool, optional
        Reload the file, even if we have it cached.

    rootname : str or None
        Name of the root configuration directory. If ``None`` and
        ``packageormod`` is ``None``, this defaults to be the name of
        the package from which this function is called. If ``None`` and
        ``packageormod`` is not ``None``, this defaults to ``astropy``.

    Returns
    -------
    cfgobj : ``configobj.ConfigObj`` or ``configobj.Section``
        If the requested package is a base package, this will be the
        ``configobj.ConfigObj`` for that package, or if it is a subpackage or
        module, it will return the relevant ``configobj.Section`` object.

    Raises
    ------
    RuntimeError
        If ``packageormod`` is `None`, but the package this item is created
        from cannot be determined.
    Nr]   r^   r_   TFr   r   r   rY   r   .cfgr   )r
   rm   r   r   rp   _cfgobjsr   _override_config_filer   r   r   r   OSError)r   rO   r   rv   rw   _autopkgpackageormodsplpkgnamer   r   cfgfns              r"   r   r   
  su   B *1--GDHDtd{+++'0L "((--Oa Ghhqrr*++G 	!HH H<<&&D|v|		<$0-	.("C"C"CWvEUVV&uEBBBDD 	< 	< 	<&U;;;DDD	< ! $DMG}s   AC' 'D	D	rY   c                 r   |rt           }t          }nt          }t          }t	          j        |           } |            5  t          j                    5  t          j        d|           t          j
        |j        |j        dz             D ]}|j        j                            d          s|j                            d          r<|j                            d          d                             d          rpt'          j        t*                    5  t	          j        |j                   d	d	d	           n# 1 swxY w Y   	 d	d	d	           n# 1 swxY w Y   d	d	d	           n# 1 swxY w Y   t-          d
d
d          }|t/          |           }t'          j                    5 }t3          |t4          t6          j        f          r$|                    t=          |d                    }	n|}	t>                                           }
tC                      }tE          |
d           D ]}|j#        }|                    d          d         | k    r*||v r/|$                    |           d} |            %                                D ]}|rD|j&        | k    r7|j&        '                    |  dd          }|	(                    d| d           d}|	(                    |)                    |j*                  dz              t3          |j+        tX          tZ          f          rt]          |j+                  dk    r|	(                    d|j         d           t]          |j+                  dk    r.|	(                    d|j         d|j+        d          d           |	(                    d|j         dd/                    ta          t4          |j+                             d           e|	(                    d|j         d|j+         d           	 d	d	d	           d	S # 1 swxY w Y   d	S )ap  Generates a configuration file, from the list of `ConfigItem`
    objects for each subpackage.

    .. versionadded:: 4.1

    Parameters
    ----------
    pkgname : str or None
        The package for which to retrieve the configuration object.
    filename : str or file-like or None
        If None, the default configuration path is taken from `get_config`.

    ignore)categoryr   )r   prefix)testtestssetup_package_Nz## N   )initial_indentsubsequent_indentwidthwc                     | j         S r;   )r   )r   s    r"   <lambda>z!generate_config.<locals>.<lambda>  s    Q\ r!   )r6   r   TrZ   [z]

Fr   z# z = ,

r   z = z,

,z

)1r   r   r   Warning	importlibimport_modulewarningscatch_warningssimplefilterpkgutilwalk_packages__path__r   module_finderr   endswithr2   r   
startswith
contextlibsuppressImportErrorr   r   	ExitStackr1   ra   osPathLikeenter_contextopenr   __subclasses__rR   sortedr   addrC   rn   replacewritefillro   rS   tuplelistr   rp   map)r   r   verbose	verbosityfilter_warningspackagemodwrapperstackfp
subclasses	processedconfprint_modulerP   modnames                   r"   r   r   ^  ss     "	3	!%g..G	 2 2h-// 2 2hAAAA(!'*:S*@
 
 
 	2 	2C  %../@AA SXEVEVF F  x~~c""2&11#66 $[11 2 2'1112 2 2 2 2 2 2 2 2 2 2 2 2 2 2	22 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2" %rRRRG&w//				 0I5hbk 233 	$$T(C%8%899BB B %3355
EE	:+A+ABBB %	I %	ID/C yy~~a G++ ic"""L I I ) {g--"&+"5"5mmmR"H"H!3W!3!3!3444#(Ld&677$>???d/%?? I4,--22!9di!9!9!9::::T.//144!Odi!O!OD4Ea4H!O!O!OPPPPL L L #S$2C)D)D E EL L L   
 HHG$)GG0AGGGHHHH+I!%	I0I 0I 0I 0I 0I 0I 0I 0I 0I 0I 0I 0I 0I 0I 0I 0I 0I 0Ism   E+CED;	/E;D??ED?EE+E	E+E	E++E/2E/,I2P,,P03P0c                     t          | d|          }|j        |ur|j        }|j        |u|                                 dS )a  Reloads configuration settings from a configuration file for the root
    package of the requested package/module.

    This overwrites any changes that may have been made in `ConfigItem`
    objects.  This applies for any items that are based on this file, which
    is determined by the *root* package of ``packageormod``
    (e.g. ``'astropy.cfg'`` for the ``'astropy.config.configuration'``
    module).

    Parameters
    ----------
    packageormod : str or None
        The package or module name - see `get_config` for details.
    rootname : str or None
        Name of the root configuration directory - see `get_config`
        for details.
    Tr   N)r   r   rO   )r   r   r   s      r"   r   r     sL    $ \4(
;
;
;C
*C

j *C

JJLLLLLr!   c                     t          j        |           }t          j        |d          }t	          d |                                D                        S )z
    Determines if a config file can be safely replaced because it doesn't
    actually contain any meaningful content, i.e. if it contains only comments
    or is completely empty.
    Tr   c              3   <   K   | ]}t          |          d k    V  dS )r   N)r   rb   s     r"   	<genexpr>z*is_unedited_config_file.<locals>.<genexpr>  s,      88!3q66A:888888r!   )ioStringIOr   r   anyrC   )contenttemplate_contentbufferraw_cfgs       r"   is_unedited_config_filer    sR     [!!F!&===G88w~~'7'78888888r!   c           	      v   t          j        |          rt          j        || dz             }n|}t          j        |          sdS t	          | |          j        }t          |d          5 }|                                }ddd           n# 1 swxY w Y   d}|t          j        |          rVt          |d          5 }	|	                                }
ddd           n# 1 swxY w Y   |
|k    }|st          |
|          }n*t          j        t          j
        |                    rd}d}|t          | d          }|rEd	|vrA|?t          j        t          |          |  d
| d          }t          j        |           }nd}|s|r|rbt          |dd          5 }|                    |           ddd           n# 1 swxY w Y   |s!|st          d|  d| d| dt                     |rC|sAt          |dd          5 }|                    |           ddd           n# 1 swxY w Y   dS dS )a  
    Checks if the configuration file for the specified package exists,
    and if not, copy over the default configuration.  If the
    configuration file looks like it has already been edited, we do
    not write over it, but instead write a file alongside it named
    ``pkg.version.cfg`` as a "template" for the user.

    Parameters
    ----------
    pkg : str
        The package to be updated.
    default_cfg_dir_or_fn : str
        The filename or directory name where the default configuration file is.
        If a directory name, ``'pkg.cfg'`` will be used in that directory.
    version : str, optional
        The current version of the given package.  If not provided, it will
        be obtained from ``pkg.__version__``.
    rootname : str
        Name of the root configuration directory.

    Returns
    -------
    updated : bool
        If the profile was updated, `True`, otherwise `False`.

    Raises
    ------
    AttributeError
        If the version number of the package could not determined.

    r   Fr   latin-1encodingNT__version__devr   r   zThe configuration options in  z may have changed, your configuration file was not updated in order to preserve local changes.  A new configuration template has been saved to 'z'.)r   isdirrp   isfiler   r   r   readexistsr  dirnamer   r   r   r   r*   )pkgdefault_cfg_dir_or_fnversionr   default_cfgfnr   frr  doupdatefdr  	identicaltemplate_pathneeds_templatefws                  r"   update_default_configr    s   B z'(( .	"7vFF-;}%%  usX...7E	mi	0	0	0 %B7799% % % % % % % % % % % % % % % H;u 
	ei000 $B''))$ $ $ $ $ $ $ $ $ $ $ $ $ $ $  #33I N27<LMM[e,,-- 	HIsM22  5''E,=	H---#/E/E/E/E/E
 
 "[777 >  	mS9=== +)***+ + + + + + + + + + + + + + +
  X <C < <' < < +8< < < 0    	I 	eS9555 +)***+ + + + + + + + + + + + + + +45sH   -BBBC##C'*C'$GG
G

H,,H03H0c                 ~   ddl m} t          | |          }t          j                    }t          | |           |                    d           |                                }d}|at          j	        |          rMt          |d          5 }|                                }ddd           n# 1 swxY w Y   t          ||          }|s|rYt          |dd          5 }	|	                    |           ddd           n# 1 swxY w Y   |                    d	|            dS |s|                    d
           dS )a'  
    Create the default configuration file for the specified package.
    If the file already exists, it is updated only if it has not been
    modified.  Otherwise the ``overwrite`` flag is needed to overwrite it.

    Parameters
    ----------
    pkg : str
        The package to be updated.
    rootname : str
        Name of the root configuration directory.
    overwrite : bool
        Force updating the file if it already exists.

    Returns
    -------
    updated : bool
        If the profile was updated, `True`, otherwise `False`.

    r   )logr   TNr	  r
  r   z8The configuration file has been successfully written to zThe configuration file already exists and seems to have been customized, so it has not been updated. Use overwrite=True if you really want to update it.F)astropy.loggerr!  r   r   r  r   seekr  r   r  r   r  r   infowarning)
r  r   	overwriter!  r   r  r  r  r  r  s
             r"   r   r   J  s   , #"""""h777E {}}C)***!',,..H T[//%),,, 	 ggiiG	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  +74DEE 

9 

%y111 	'RHH%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'SESSTTTt 
B	
 	
 	
 5s$   B..B25B2DDD)NN)NFN)rY   NFr;   )NrY   )rY   F)0r   r   r   r   r   r   r   r   r   r   textwrapr   r   astropy.extern.configobjr   r	   rl   r
   r   astropy.utils.decoratorsr   astropy.utils.exceptionsr   r   astropy.utils.introspectionr   pathsr   __all__r   r   
ValueErrorr%   r(   r*   typer,   r   r   r   r   r   r   r   r   r  r  r   r    r!   r"   <module>r0     sm            				 				   2 2 2 2 2 2 2 2                         8 8 8 8 8 8 8 8 6 6 6 6 6 6 6 6 / / / / / / N N N N N N N N 4 4 4 4 4 4 ! ! ! ! ! !	    n    E    .       z              .       4   c( c( c( c( c( 4 c( c( c( c(Lp8 p8 p8 p8 p8 p8 p8 p8j	      Q Q Q Qh\I \I \I \I~   2	9 	9 	9 	9  E` ` ` `F5 5 5 5 5 5r!   