
    k7io                     x    S r SSKrSSKJr  SSKJrJr  SSKJrJ	r	J
r
  \(       a  SSKJr  \	 " S S5      5       rg)	z9Lazy-loadable command specification for deferred imports.    N)chain)TYPE_CHECKINGAny)FactorydefinefieldAppc                       \ rS rSr% Sr\\S'   Sr\\\S4   -  S-  \S'   \	" \
5      r\
\\4   \S'   \" SSSS	9rS
\S'   SS jr\S\4S j5       rSrg)CommandSpec   a>  Specification for a command that will be lazily loaded on first access.

This allows registering commands via import path strings (e.g., "myapp.commands:create")
without importing them until they're actually used, improving CLI startup time.

Parameters
----------
import_path : str
    Import path in the format "module.path:attribute_name".
    The attribute should be either a function or an App instance.
name : str | tuple[str, ...] | None
    CLI command name. If None, will be derived from the attribute name via name_transform.
    For function imports: used as the name of the wrapper App.
    For App imports: must match the App's internal name, or ValueError is raised at resolution.
app_kwargs : dict
    Keyword arguments to pass to App() if wrapping a function.
    Raises ValueError if used with App imports (Apps should be configured in their own definition).

Examples
--------
>>> from cyclopts import App
>>> app = App()
>>> # Lazy load - doesn't import myapp.commands until "create" is executed
>>> app.command("myapp.commands:create_user", name="create")
>>> app()
import_pathN.name
app_kwargsF)initdefaultreprz
App | None	_resolvedreturnc                    U R                   b  U R                   $ U R                  R                  S5      u  p#nU(       a  U(       d  [        SU R                  < S35      e [        R
                  " U5      n [        XT5      nSSK	J
n  [        Xx5      (       a  U R                  (       a(  [        SU R                  < SU R                  < S35      eU R                  bs  UR                  S   U R                  :w  aV  [        SU R                  < SUR                  S   < SU R                  < SU R                   SUR                  S    S35      eSSK	Jn	  U	" Xq5        Xpl         O[        U R                  5      n
SSK	Jn  U
R#                  SUR$                  5        U
R#                  SUR&                  5        SU
;  a  UR(                  b  UR(                  U
S'   U" X5        U" SSU R                  0U
D6U l         U R                   R+                  U5        [-        U R                   R$                  U R                   R&                  5       H  nSU R                   U   l        M     U R                   $ ! [         a#  n[        SU< SU R                  < 35      UeSnAff = f! [         a(  n[        SU< SU< S	U R                  < S
35      UeSnAff = f)a(  Import and resolve the command on first access.

Parameters
----------
parent_app : App
    Parent app to inherit defaults from (help_flags, version_flags, groups).
    Required to match the behavior of direct command registration.

Returns
-------
App
    The resolved App instance, either imported directly or wrapping a function.

Raises
------
ValueError
    If import_path is not in the correct format "module.path:attribute_name".
ImportError
    If the module cannot be imported.
AttributeError
    If the attribute doesn't exist in the module.
N:zInvalid import path: z/. Expected format: 'module.path:attribute_name'zCannot import module z from zModule z has no attribute z (from import path )r   r	   z8Cannot apply configuration to imported App. Import path z0 resolves to an App, but kwargs were specified: z.. Configure the App in its definition instead.z(Imported App name mismatch. Import path z resolves to an App with name=z., but it was registered with CLI command name=z. Either use app.command('z	', name='z%') or change the App's name to match.)_apply_parent_defaults_to_app)_apply_parent_groups_to_kwargs
help_flagsversion_flagsversionr   F )r   r   
rpartition
ValueError	importlibimport_moduleImportErrorgetattrAttributeErrorcyclopts.corer
   
isinstancer   r   r   dictr   
setdefaultr   r   r   r   r   show)self
parent_appmodule_path_	attr_namemoduleetargetr
   r   r   r   flags                O/home/james-whalen/.local/lib/python3.13/site-packages/cyclopts/command_spec.pyresolveCommandSpec.resolve0   s   . >>%>>! %)$4$4$?$?$D!	)'(8(8';;jk 
	h,,[9F	V/F 	&f"" ##'#3#3"6 7226//1D ECD  yy$Q499)D ##'#3#3"66TU[U`U`abUcTf gCCG99- P//3/?/?.@	&++VW.IY Z9:  D)&=#N doo.JD!!,
0E0EF!!/:3K3KL
*z/A/A/M(2(:(:
9%*:B >dii>:>DNNN""6* $..33T^^5Q5QRD(-DNN4 % S ~~}  	h 5k_F4K[K[J^_`fgg	h
  	 +(:9-GZ[_[k[kZnnop	s0   !I3 8J# 3
J =JJ #
K-#KKc                     U R                   SL$ )z9Check if this command has been imported and resolved yet.Nr   )r+   s    r4   is_resolvedCommandSpec.is_resolved   s     ~~T))    r8   )r,   r
   r   r
   )__name__
__module____qualname____firstlineno____doc__str__annotations__r   tupler   r(   r   r   r   r   r5   propertyboolr9   __static_attributes__r   r;   r4   r   r      sv    6 )-D#c3h
$
&-!(JS#X.#5II|IbH *T * *r;   r   )r@   r!   	itertoolsr   typingr   r   attrsr   r   r   r&   r
   r   r   r;   r4   <module>rJ      s9    ?   % ( (! I* I* I*r;   