
    i                     F    d dl Z ddlmZ  G d dee          ZddddZdS )	    N   )AutocommandErrorc                       e Zd ZdS )AutomainRequiresModuleErrorN)__name__
__module____qualname__     _/srv/django_bis/venv311/lib/python3.11/site-packages/setuptools/_vendor/autocommand/automain.pyr   r      s        Dr   r   r
   )argskwargsc                t    t          |           rt          |           | dk    s| du ri fd}|S d S )a  
    This decorator automatically invokes a function if the module is being run
    as the "__main__" module. Optionally, provide args or kwargs with which to
    call the function. If `module` is "__main__", the function is called, and
    the program is `sys.exit`ed with the return value. You can also pass `True`
    to cause the function to be called unconditionally. If the function is not
    called, it is returned unchanged by the decorator.

    Usage:

    @automain(__name__)  # Pass __name__ to check __name__=="__main__"
    def main():
        ...

    If __name__ is "__main__" here, the main function is called, and then
    sys.exit called with the return value.
    __main__TNc                 <    t          j         | i            d S N)sysexit)mainr   r   s    r   automain_decoratorz$automain.<locals>.automain_decorator6   s(    HTT4*6**+++++r   c                     | S r   r
   )r   s    r   <lambda>zautomain.<locals>.<lambda>;   s    D r   )callabler   )moduler   r   r   s    `` r   automainr      sp    (  2)&111v~~>F	, 	, 	, 	, 	, 	, "!   r   )r   errorsr   	TypeErrorr   r   r
   r   r   <module>r      sy   $ 


 $ $ $ $ $ $	 	 	 	 	"2I 	 	 	   !! !! !! !! !! !! !!r   