
    Ƿi                     t    d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
mZ  G d de          Zd ZdS )	    N)List)
AppCommand)color_style)_make_writeablesignalcommandc                   X     e Zd ZU dZg Zee         ed<   dZ fdZ	e
d             Z xZS )CommandzfCreates a Django management command directory structure for the given app name in the app's directory.requires_system_checksTc                     t                                          |           |                    dddddd           |                    dd	dd
dd           |                    dddd           d S )Nz--namez-nstorecommand_namesamplez*The name to use for the management command)actiondestdefaulthelpz--basez-bbase_commandBasezdThe base class used for implementation of this command. Should be one of Base, App, Label, or NoArgsz	--dry-run
store_trueFz Do not actually create any files)r   r   r   )superadd_argumentsadd_argument)selfparser	__class__s     l/srv/django_bis/venv311/lib/python3.11/site-packages/django_extensions/management/commands/create_command.pyr   zCommand.add_arguments   s    f%%%d7= 	 	
 	
 	

 	d7 "I 	 	
 	
 	

 	e3 	 	
 	
 	
 	
 	
    c                 0    |}t          d|j        fi | d S )Ncommand_template)copy_templatepath)r   argsoptionsapps       r   handle_app_configzCommand.handle_app_config&   s(    (#(>>g>>>>>r   )__name__
__module____qualname__r   r
   r   str__annotations__can_import_settingsr   r   r%   __classcell__)r   s   @r   r	   r	      sw         sD(*DI*** 
 
 
 
 
" ? ? ]? ? ? ? ?r   r	   c           
      d   ddl }t                      }t          |dd           }t          |dd           }|d         d|d	         z  }}|d
         }	|d         }
t          j                            |j        d         d|           }t          j        |          D ]\  }}}|t          |          dz   d         }|rqt          j        	                    t          j                            ||                    s4|	s2t          j
        t          j                            ||                     t          |          D ]\  }}|                    d          r||= |D ]O}|                    d          s|                    d          r.t          j                            ||          }t          j                            |||                    d|                                        d          }t          j        	                    |          rvt          j                            |||                              d          }t          j        	                    |          r#|
dk    rt!           |d|z                       +|
dk    rt!           |d|z                       t#          |d          5 }|                                }|                    d|          }|                    d|          }|	s=t#          |d          5 }|                    |           ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   |	sZ	 t)          j        ||           t-          |           # t.          $ r& t0          j                            d|z             Y Kw xY wQdS )z=Copy the specified template directory to the copy_to locationr   NERRORc                     | S N xs    r   <lambda>zcopy_template.<locals>.<lambda>1   s    a r   SUCCESSc                     | S r0   r1   r2   s    r   r4   zcopy_template.<locals>.<lambda>2   s    ! r   r   z	%sCommandr   dry_run	verbosityconf   .)z.pycz.pyo)z	.DS_Store__pycache__r   z.tmplz%s already existsz%srz{{ command_name }}z{{ base_command }}wzlNotice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.
)django_extensionsr   getattrosr!   join__path__walklenexistsmkdir	enumerate
startswithendswithreplacerstripprintopenreadwriteshutilcopymoder   OSErrorsysstderr)template_namecopy_tor#   r?   styler.   r5   r   r   r7   r8   template_dirdsubdirsfilesrelative_dirisubdirfpath_oldpath_newfp_origdatafp_news                           r   r    r    ,   s9   MMEE7KK00EeY44G!(!8+P^H_:_,Li G$I7<< 1 :1 =v}UUL  W\22 !a !a7E\**Q.//0 	>rw||G\/R/R S S 	> >g|<<==="7++ 	 	IAv  %% AJ 	a 	aAzz*++ q||<X/Y/Y w||Aq))Hw||G\199X|;\;\]]ddelmmHw~~h'' 7<<qAAHHQQ7>>(++  1}}ee$7($BCCDDD1}}ggdXo..///h$$ +||~~||$8,GG||$8,GG +h,, +T***+ + + + + + + + + + + + + + ++ + + + + + + + + + + + + + +  aaOHh777#H---- a a aJ$$  &U  X`  &`  a  a  a  a  aa	a)	a!a !asI   9AML.	"M.L22M5L26MM	M	$M99,N)(N))rA   rT   rQ   typingr   django.core.management.baser   django.core.management.colorr   "django_extensions.management.utilsr   r   r	   r    r1   r   r   <module>rj      s    				 



        2 2 2 2 2 2 4 4 4 4 4 4 M M M M M M M M? ? ? ? ?j ? ? ?>0a 0a 0a 0a 0ar   