
    c'                         d Z ddlmZmZ ddlmZ ddlmZmZm	Z	m
Z
mZmZ ddlmZ ddlmZmZmZ ddlmZ ddlmZ e G d	 d
                      Z G d de          ZdededefdZdS )zRope preferences.    )asdict	dataclass)dedent)AnyCallableDictListOptionalTuple)Requirement)PyToolConfigUniversalKeyfield)Source)Folderc                      e Zd ZU dZ ed  ed                    Zee         e	d<    ed  ed                    Z
ee         e	d<    e ed	          d
           Zee         e	d<    ed d          Zee         e	d<    edd          Zee	d<    edd          Zee	d<    edd          Zee	d<    edd          Zee	d<    ed ed                    Zee	d<    edd          Zee	d<    ed d!          Zee	d"<    edd#          Zee	d$<    edd          Zee	d%<    ed& ed'                    Zee	d(<    eed)          Zee         e	d*<    edd+          Zee	d,<    ed ed-                    Zee	d.<    ed ed/                    Zee	d0<    ed ed1                    Zee	d2<    ed ed3                    Zee	d4<    ed ed5                    Z ee	d6<    ed ed7                    Z!ee	d8<    ed9 ed:          ;          Z"ee	d<<    ed= ed>          ;          Z#e$e%         e	d?<    ed=d@e&j'        A          Z(e$e)eef                  e	dB<    ed=e&j*        C          Z*e$ee+                  e	dD<    edE  edF                    Z,e-ee%e.gd=f         f         e	dG<   dHedIe.fdJZ/dHedIe.fdKZ0dRdHedLe.fdMZ1dHedNe%fdOZ2dHedIe.fdPZ3dHefdQZ4d=S )SPrefsz Class to store rope preferences.c                  
    g dS )N)z*.pycz*~z.ropeprojectz.hgz.svn_svnz.gitz.toxz.venvvenvz.mypy_cachez.pytest_cache r       /lib/python3.11/site-packages/rope/base/prefs.py<lambda>zPrefs.<lambda>   s     !
 !
 !
 r   av  
            Specify which files and folders to ignore in the project.
            Changes to ignored resources are not added to the history and
            VCSs.  Also they are not returned in `Project.get_files()`.
            Note that ``?`` and ``*`` match all characters but slashes.
            '*.pyc': matches 'test.pyc' and 'pkg/test.pyc'
            'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc'
            '.svn': matches 'pkg/.svn' and all of its children
            'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o'
            'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o'
        )default_factorydescriptionignored_resourcesc                      dgS )Nz*.pyr   r   r   r   r   zPrefs.<lambda>-   s     r   z
            Specifies which files should be considered python files.  It is
            useful when you have scripts inside your project.  Only files
            ending with ``.py`` are considered to be python files by
            default.
        python_filesa-  
            Custom source folders:  By default rope searches the project
            for finding source folders (folders that should be searched
            for finding modules).  You can add paths to that list.  Note
            that rope guesses project source folders correctly most of the
            time; use this if you have any problems.
            The folders should be relative to project root and use '/' for
            separating folders regardless of the platform rope is running on.
            'src/my_source_folder' for instance.
        c                      g S Nr   r   r   r   r   zPrefs.<lambda>@        r   )r   r   source_foldersc                      g S r!   r   r   r   r   r   zPrefs.<lambda>C   r"   r   z2You can extend python path for looking up modules.python_pathFz+Should rope save object information or not.)defaultr   save_objectdbzDeprecated. This has no effectcompress_objectdbTz<If `True`, rope analyzes each module when it is being saved.automatic_soar   z6The depth of calls to follow in static object analysissoa_followed_callsz
            If `False` when running modules or unit tests 'dynamic object analysis' is turned off.
            This makes them much faster.
        perform_doaz:Rope can check the validity of its object DB when running.validate_objectdb    zHow many undos to hold?max_history_itemsz.Shows whether to save history across sessions.save_historycompress_history   z
            Set the number spaces used for indenting.  According to
            :PEP:`8`, it is best to use 4 spaces.  Since most of rope's
            unit-tests use 4 spaces it is more reliable, too.
        indent_sizez`
Builtin and c-extension modules that are allowed to be imported and inspected by rope.
        extension_modulesz8Add all standard c-extensions to extension_modules list.import_dynload_stdmodsz
            If `True` modules with syntax errors are considered to be empty.
            The default value is `False`; When `False` syntax errors raise
            `rope.base.exceptions.ModuleSyntaxError` exception.
        ignore_syntax_errorsz
            If `True`, rope ignores unresolvable imports.  Otherwise, they
            appear in the importing namespace.
        ignore_bad_importszs
            If `True`, rope will insert new module imports as `from <package> import <module>`by default.
        prefer_module_from_importsz
            If `True`, rope will transform a comma list of imports into
            multiple separate import statements when organizing
            imports.
        split_importsz
            If `True`, rope will remove all top-level import statements and
            reinsert them at the top of the module when making changes.
        pull_imports_to_topz
            If `True`, rope will sort imports alphabetically by module name instead
            of alphabetically by import statement, with from imports after normal
            imports.
        sort_imports_alphabeticallyz>rope.base.oi.type_hinting.factory.default_type_hinting_factorya  
            Location of implementation of
            rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general
            case, you don't have to change this value, unless you're an rope expert.
            Change this value to inject you own implementations of interfaces
            listed in module rope.base.oi.type_hinting.providers.interfaces
            For example, you can add you own providers for Django Models, or disable
            the search type-hinting in a class hierarchy, etc.
        )r   type_hinting_factoryNzr
            This function is called after opening the project.
            Can only be set in config.py.
        project_openedz Minimum python version to target)r&   r   universal_config
py_version)r&   r=   dependenciesc                      i S r!   r   r   r   r   r   zPrefs.<lambda>   r"   r   zt
            Callbacks run when configuration values are changed.
            Can only be set in config.py.
        	callbackskeyvaluec                 j    || j         v r | j         |         |           dS t          | ||           dS )z-Set the value of `key` preference to `value`.N)rA   setattrselfrB   rC   s      r   setz	Prefs.set   sF    $.  	&DN3&&&&&D#u%%%%%r   c                 v    t          | |          g | |<   t          | |                              |           dS )zqAdd an entry to a list preference

        Add `value` to the list of entries for the `key` preference.

        N)getattrappendrF   s      r   addz	Prefs.add   sC     4 	DIc!!%(((((r   r&   c                 $    t          | ||          S )z#Get the value of the key preference)rJ   )rG   rB   r&   s      r   getz	Prefs.get   s    tS'***r   callbackc                     || j         |<   dS )zAdd `key` preference with `callback` function

        Whenever `key` is set the callback is called with the
        given `value` as parameter.

        N)rA   )rG   rB   rO   s      r   add_callbackzPrefs.add_callback   s     'sr   c                 2    |                      ||           d S r!   )rH   rF   s      r   __setitem__zPrefs.__setitem__   s    er   c                 ,    |                      |          S r!   )rN   )rG   rB   s     r   __getitem__zPrefs.__getitem__   s    xx}}r   r!   )5__name__
__module____qualname____doc__r   r   r   r	   str__annotations__r   r#   r%   r'   boolr(   r)   r*   intr+   r,   r.   r/   r0   r2   listr3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r
   r   r   min_py_versionr>   r   r?   r   rA   r   r   rH   rL   rN   rQ   rS   rU   r   r   r   r   r      s$        **#(5
 
 F 
 
 
$ $ $tCy   6 $e((F     L$s)    !&F 	 	 	 #
! ! !NDI    #U"
H  Kc     %#P  M4    $e4  t     %L M4    $eW      F     K    $eP  t   
 #U2;TUUUsUUU"R  L$    #U4  d   
 uF     K    $)5$ $ $tCy    $)5N$ $ $D    "'F   " " "$     %uF            (-uF   ( ( (     %F     M4    !&F   ! ! !    ).F   ) ) )    !&HF   ! ! !#    */F   * * *NHX&    -2E6%4- - -JsCx)   
 16|'@1 1 1L(4,-    38%"
F   3 3 3ItC3%+../   &s &3 & & & &)s )3 ) ) ) )+ +s +S + + + +' 'x ' ' ' 's 3    s      r   r   c                   \    e Zd ZU dZdZeed<   eed<   defdZ	de
fdZdee         fd	Zd
S )_RopeConfigSourcez'Custom source for rope config.py files.	config.pynamerun_globals
ropefolderc                 "    || _         i | _        d S r!   )re   rd   )rG   re   s     r   __init__z_RopeConfigSource.__init__   s    $r   returnc                    | j         | j                             d          sdS | j                             d          }| j                            dt
          |j        d           t          |j                  5 }t          |	                                |j        d          }t          || j                   d d d            n# 1 swxY w Y   dS )Nrb   F__main__)rV   __builtins____file__execT)re   	has_child	get_childrd   updaterk   	real_pathopencompilereadrm   )rG   configfcodes       r   _readz_RopeConfigSource._read   s	   ? 	$/*C*CK*P*P 	5**;77& ,", 	
 	
 	
 &"## 	)q16688V%5v>>Dt'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) ts   :>CCCc                     t                      }|                                 sd S d| j        v r | j        d         |           d| j        v r| j        d         |d<   t          |          S )N	set_prefsr<   )r   rx   rd   r   )rG   prefss     r   parsez_RopeConfigSource.parse  sy    zz|| 	4$** 	1)D[)%000t// 	I&*&67G&HE"#e}}r   N)rV   rW   rX   rY   rc   rZ   r[   r   r   rg   r\   rx   r
   r|   r   r   r   ra   ra      s         11D#6    t     x~      r   ra   rootre   rh   c           	      h    t          |          g}t          d| j        t          |dgdd          }|S )Nropez.ropefolderFT)custom_sourcesbases	recursiveglobal_config)ra   r   pathlibr   )r}   re   r   ru   s       r   
get_configr     sF    '
334N%o  F Mr   N)rY   dataclassesr   r   textwrapr   typingr   r   r   r	   r
   r   packaging.requirementsr   pytoolconfigr   r   r   pytoolconfig.sourcesr   rope.base.resourcesr   r   ra   r   r   r   r   <module>r      sT     ) ) ) ) ) ) ) )       = = = = = = = = = = = = = = = = . . . . . . : : : : : : : : : : ' ' ' ' ' ' & & & & & & d d d d d d d dN" " " " " " " "JV  L      r   