ó
    ¼RjŠ<  ã                   óÖ   • S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKJr  S SK	J
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  S SKJrJr  S SKJr  S S	KJr  S S
KJr   " S S\5      rg)é    N)Úimport_module)Úbuild_opener)Úsettings)ÚBaseCommandÚCommandError)Úfind_formattersÚhandle_extensionsÚrun_formatters)ÚContextÚEngine)Úarchive)Úparse_header_parameters)Úget_docs_versionc                   ól   • \ rS rSrSr/ r/ SQrSrS rSS jr	S r
SS	 jrS
 rS rS rS rS rS rSrg)ÚTemplateCommandé   a»  
Copy either a Django application layout template or a Django project
layout template into the specified directory.

:param style: A color style object (see django.core.management.color).
:param app_or_project: The string 'app' or 'project'.
:param name: The name of the application or project.
:param directory: The directory to which the template should be copied.
:param options: The additional variables passed to project or app templates
)ÚhttpÚhttpsÚftp))z.py-tplz.pyc           
      óþ   • UR                  SSS9  UR                  SSSS9  UR                  SS	S9  UR                  S
SSSS/SS9  UR                  SSSS/ SS9  UR                  SSS[        R                  SSSS9  g )NÚnamez#Name of the application or project.)ÚhelpÚ	directoryÚ?zOptional destination directory)Únargsr   z
--templatez*The path or URL to load the template from.z--extensionz-eÚ
extensionsÚappendÚpyztThe file extension(s) to render (default: "py"). Separate multiple extensions with commas, or use -e multiple times.)ÚdestÚactionÚdefaultr   z--namez-nÚfilesz_The file name(s) to render. Separate multiple file names with commas, or use -n multiple times.z	--excludez-xÚ zbThe directory name(s) to exclude, in addition to .git and __pycache__. Can be used multiple times.)r    r!   r   Úconstr   )Úadd_argumentÚargparseÚSUPPRESS)ÚselfÚparsers     ÚLD:\diplom_project\venv\Lib\site-packages\django/core/management/templates.pyÚadd_argumentsÚTemplateCommand.add_arguments.   sÒ   € Ø×Ñ˜FÐ)NÐÑOØ×ÑØ˜sÐ)Ið 	ñ 	
ð 	×ÑØÐKð 	ñ 	
ð 	×ÑØØØØØ�Fð!ð 	ñ 		
ð 	×ÑØØØØØð5ð 	ñ 	
ð 	×ÑØØØÜ×%Ñ%ØØð;ð 	ò 	
ó    Nc                 ó"  • Xl         US:X  a  SOSU l        / U l        US   U l        U R	                  U5        UcK  [
        R                  R                  [
        R                  " 5       U5      n [
        R                  " U5        O£[
        R                  R                  [
        R                  R                  U5      5      nUS:X  a/  U R	                  [
        R                  R                  U5      S5        [
        R                  R!                  U5      (       d  [        SU-  5      e[#        5       n[%        ['        US   5      5      n/ n	S	S
/n
US    H.  nU	R)                  [+        S UR-                  S5      5      5        M0     UR/                  S5      =n(       a(  U H"  nU
R1                  UR3                  5       5        M$     U R                  S:¼  ad  U R4                  R7                  SU< SSR                  U5      < 35        U R4                  R7                  SU< SSR                  U	5      < 35        SU-  nSU-  nSU-  nSU-  nSR                  S UR9                  5        5       5      n[;        0 UEXâUUUUS[=        5       S[>        R@                  0ESS9n[B        RD                  (       d*  [B        RF                  " 5         [>        RH                  " 5         U RK                  US   U5      n[M        U5      S-   n[
        RN                  " U5       GH¦  u  nnnUUS  nURQ                  Xâ5      nU(       a5  [
        R                  R                  UU5      n[
        R                  " US S!9  US S   HS  nSU;  a1  URS                  S"5      (       d  US
:X  a  URU                  U5        M8  M:  UU
;   d  MB  URU                  U5        MU     U GHé  nURW                  S#5      (       a  M  [
        R                  R                  UU5      n[
        R                  R                  UUURQ                  Xâ5      5      nU RX                   H0  u  n n!URW                  U 5      (       d  M  US [M        U 5      *  U!-   n  O   [
        R                  R!                  U5      (       a!  [        U< S$U R                  < S%U< S&35      eURW                  U5      (       d  UU	;   as  [[        US'S(9 n"U"R]                  5       n#S S S 5        [_        5       Ra                  W#5      n$U$Rc                  U5      n#[[        US)S'S(9 n%U%R7                  U#5        S S S 5        O[d        Rf                  " UU5        U R                  S:¼  a  U R4                  R7                  S*U-  5         U Ri                  UU5        U Rk                  U5        GMì     GM©     U R                  (       a�  U R                  S:¼  a  U R4                  R7                  S,5        U R                   HU  n&[
        R                  Rs                  U&5      (       a  [
        RT                  " U&5        M?  [d        Rt                  " U&5        MW     [w        U/40 UD6  g ! [         a    [        SU-  5      e[         a  n[        U5      eS nAff = f! , (       d  f       GNµ= f! , (       d  f       GN`= f! [         a8    U Rl                  R7                  S+U-  U Rn                  Rp                  5         GM;  f = f)-NÚappÚanÚaÚ	verbosityz'%s' already existsr   zBDestination directory '%s' does not exist, please create it first.r   z.gitÚ__pycache__r"   c                 ó"   • U R                  5       $ ©N)Ústrip)Úxs    r*   Ú<lambda>Ú(TemplateCommand.handle.<locals>.<lambda>y   s
   € ¨Q¯W©W¬Yr-   Ú,Úexcludeé   z
Rendering z! template files with extensions: z, z  template files with filenames: z%s_namez%s_templatez%s_directoryzcamel_case_%s_namer#   c              3   ó4   #   • U  H  oS :w  d  M
  Uv •  M     g7f)Ú_N© )Ú.0r7   s     r*   Ú	<genexpr>Ú)TemplateCommand.handle.<locals>.<genexpr>Š   s   é € Ð"Gªl¨À3¹h§1¡1ªlùs   ‚	�	Údocs_versionÚdjango_versionF)Ú
autoescapeÚtemplateé   T)Úexist_okÚ.)z.pyoz.pycz	.py.classz already exists. Overlaying Ú z< into an existing directory won't replace conflicting files.zutf-8)ÚencodingÚwzCreating %szkNotice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.zCleaning up temporary files.)<Úapp_or_projectÚa_or_anÚpaths_to_remover2   Úvalidate_nameÚosÚpathÚjoinÚgetcwdÚmakedirsÚFileExistsErrorr   ÚOSErrorÚabspathÚ
expanduserÚbasenameÚexistsr   Útupler	   ÚextendÚmapÚsplitÚgetr   r6   ÚstdoutÚwriteÚtitler   r   ÚdjangoÚ__version__r   Ú
configuredÚ	configureÚsetupÚhandle_templateÚlenÚwalkÚreplaceÚ
startswithÚremoveÚendswithÚrewrite_template_suffixesÚopenÚreadr   Úfrom_stringÚrenderÚshutilÚcopyfileÚapply_umaskÚmake_writeableÚstderrÚstyleÚNOTICEÚisfileÚrmtreer
   )'r(   rM   r   ÚtargetÚoptionsÚtop_dirÚeÚformatter_pathsr   Úextra_filesÚexcluded_directoriesÚfiler;   r   Ú	base_nameÚbase_subdirÚbase_directoryÚcamel_case_nameÚcamel_case_valueÚcontextÚtemplate_dirÚprefix_lengthÚrootÚdirsr"   Ú	path_restÚrelative_dirÚ
target_dirÚdirnameÚfilenameÚold_pathÚnew_pathÚ
old_suffixÚ
new_suffixÚtemplate_fileÚcontentrF   Únew_fileÚpath_to_removes'                                          r*   ÚhandleÚTemplateCommand.handleV   sò  € Ø,ÔØ-°Ó6‘t¸CˆŒØ!ˆÔØ  Ñ-ˆŒà×Ñ˜4Ô ð ‰>Ü—g‘g—l‘l¤2§9¢9£;°Ó5ˆGð&Ü—’˜GÕ$ô —g‘g—o‘o¤b§g¡g×&8Ñ&8¸Ó&@ÓAˆGØ Ó&Ø×"Ñ"¤2§7¡7×#3Ñ#3°GÓ#<¸kÔJÜ—7‘7—>‘> '×*Ñ*Ü"ð5Ø7>ñ?óð ô *Ó+ˆäÔ,¨W°\Ñ-BÓCÓDˆ
ØˆØ &¨Ð6ÐØ˜GÔ$ˆDØ×ÑœsÑ#6¸¿
¹
À3»ÓHÖIñ %à—k‘k )Ó,Ð,ˆ7Õ,Û$�	Ø$×+Ñ+¨I¯O©OÓ,=Ö>ñ %à�>‰>˜QÓØ�K‰K×Òã! 4§9¡9¨ZÕ#8ð:ôð �K‰K×Òã! 4§9¡9¨[Õ#9ð;ôð  Ñ.ˆ	Ø# nÑ4ˆØ'¨.Ñ8ˆØ.°Ñ?ˆØŸ7™7Ñ"G¨d¯j©j¬lÓ"GÓGÐäðØðàØ ØÐ!1ØÔ 0Ó 2Ø ¤&×"4Ñ"4ñð ñ

ˆô ×"×"Ü×ÒÔ Ü�LŠLŒNà×+Ñ+¨G°JÑ,?ÀÓMˆÜ˜LÓ)¨AÑ-ˆä!#§¢¨×!6ÑˆD�$˜Ø˜]˜^Ð,ˆIØ$×,Ñ,¨YÓ=ˆLÞÜŸW™WŸ\™\¨'°<Ó@�
Ü—’˜J°Ò6à¡›7�Ø GÓ+Ø×)Ñ)¨#×.Ñ.°'¸]Ó2JØŸ™ GÖ,ñ 3KàÐ 4Õ4Ø—K‘K Ö(ñ #ô "�Ø×$Ñ$Ð%B×CÑCáÜŸ7™7Ÿ<™<¨¨hÓ7�ÜŸ7™7Ÿ<™<Ø˜\¨8×+;Ñ+;¸IÓ+Ló�ð /3×.LÔ.LÑ*�J 
Ø×(Ñ(¨×4Ó4Ø#+Ð,>¬s°:«Ð.>Ð#?À*Ñ#L˜Ùñ /Mô
 —7‘7—>‘> (×+Ñ+Ü&ó %Ø ŸLœLÛ*ðóð ð ×$Ñ$ Z×0Ñ0°HÀÓ4KÜ˜h°Ò9¸]Ø"/×"4Ñ"4Ó"6˜÷ :ä%›x×3Ñ3°GÓ<�HØ&Ÿo™o¨gÓ6�GÜ˜h¨°gÒ>À(Ø Ÿ™ wÔ/÷ ?Ð>ô —O’O H¨hÔ7à—>‘> QÓ&Ø—K‘K×%Ñ% m°hÑ&>Ô?ð	Ø×$Ñ$ X¨xÔ8Ø×'Ñ'¨×1ôQ "ñ "7ð~ ××Ø�~‰~ Ó"Ø—‘×!Ñ!Ð"@ÔAØ"&×"6Ô"6�Ü—7‘7—>‘> .×1Ñ1Ü—I’I˜nÖ-ä—M’M .Ö1ñ	 #7ô 	˜�yÑ4 OÓ4øôK #ó DÜ"Ð#8¸7Ñ#BÓCÐCÜó &Ü" 1“oÐ%ûð&ú÷H :Ö9ú÷ ?Ö>ûô ó Ø—K‘K×%Ñ%ð#à%-ñ.ð Ÿ
™
×)Ñ)÷	ð ðúsB   Á/Y4 Ó)Z(Ô7Z:Ö#[Ù4!Z%ÚZ Ú Z%Ú(
Z7Ú:
[	Û=\Ü\c                 óž  • Uc2  [         R                  R                  [        R                  S   SU5      $ UR                  S5      (       a  USS n[         R                  R                  U5      n[         R                  R                  U5      n[         R                  R                  U5      (       a  U$ U R                  U5      (       a  U R                  U5      nO[         R                  R                  U5      n[         R                  R                  U5      (       a  U R                  U5      $ [        SU R                  < SU< S35      e)	z‹
Determine where the app or project templates are.
Use django.__path__[0] as the default because the Django install
directory isn't known.
Nr   Úconfzfile://é   zcouldn't handle z
 template rI   )rQ   rR   rS   rd   Ú__path__rm   rY   ÚnormpathÚisdirÚis_urlÚdownloadrX   r[   Úextractr   rM   )r(   rF   ÚsubdirÚexpanded_templateÚabsolute_paths        r*   ri   ÚTemplateCommand.handle_templateê   sø   € ð ÑÜ—7‘7—<‘<¤§¡°Ñ 2°F¸FÓCÐCà×"Ñ" 9×-Ñ-Ø# A B˜<�Ü "§¡× 2Ñ 2°8Ó <ÐÜ "§¡× 0Ñ 0Ð1BÓ CÐÜ�w‰w�}‰}Ð.×/Ñ/Ø(Ð(Ø�{‰{˜8×$Ñ$à $§¡¨hÓ 7‘ä "§¡§¡Ð0AÓ B�Ü�w‰w�~‰~˜m×,Ñ,Ø—|‘| MÓ2Ð2åØ15×1DÔ1DÃhÐOó
ð 	
r-   c           	      ój  • Uc-  [        SR                  U R                  U R                  S95      eUR	                  5       (       d$  [        SR                  UU R                  US95      e [        U5        [        SR                  UU R                  U R                  US95      e! [         a     g f = f)Nz you must provide {an} {app} name)r0   r/   zX'{name}' is not a valid {app} {type}. Please make sure the {type} is a valid identifier.)r   r/   Útypez�'{name}' conflicts with the name of an existing Python module and cannot be used as {an} {app} {type}. Please try another {type}.)r   r0   r/   r­   )r   ÚformatrN   rM   Úisidentifierr   ÚImportError)r(   r   Úname_or_dirs      r*   rP   ÚTemplateCommand.validate_name  sÒ   € Ø‰<ÜØ2×9Ñ9Ø—|‘|Ø×+Ñ+ð :ð óð ð × Ñ ×"Ñ"Üð0ß06±ØØ×+Ñ+Ø$ð 17ð 1óð ð	Ü˜$Ôô ð"ç"(¡&ØØ—|‘|Ø×+Ñ+Ø$ð	 #)ð #ó	ð 	øô ó 	Ùð	ús   Á+B% Â%
B2Â1B2c           	      ó|  • S nSU R                   -  n[        R                  " USS9nU R                  R	                  U5        U" U5      u  pVU R
                  S:¼  a  U R                  R                  SU-  5        [        R                  R                  XE5      n[        5       nSS[        R                   34/Ul         UR                  U5       n	[        US	5       n
U	R!                  5       nU
R                  U	R#                  5       5        S
S
S
5        S
S
S
5        UR)                  S5      S   nWS   nU(       a)  [+        U5      u  nnUR-                  S5      =(       d    UnOUnU R/                  U5      S   nUS   nU(       d)  U(       a"  [0        R2                  " U5      nU(       a  UU-  nUU:w  a9  [        R                  R                  UU5      n[4        R6                  " UU5        U$ U$ ! , (       d  f       Në= f! , (       d  f       Nô= f! [$         a  n['        SU< SU< SU< 35      eS
nAff = f)z2
Download the given URL and return the file name.
c                 ó’   • U R                  S5      nUR                  S5      S   nU R                  S5      (       a  US-   nX#4$ U nX#4$ )NÚ/éÿÿÿÿ)Úrstripr_   ro   )ÚurlÚtmpr”   Údisplay_urls       r*   Úcleanup_urlÚ-TemplateCommand.download.<locals>.cleanup_url-  sT   € Ø—*‘*˜S“/ˆCØ—y‘y “~ bÑ)ˆHØ�|‰|˜C× Ñ Ø! C™i�ð Ð(Ð(ð "�ØÐ(Ð(r-   údjango_%s_template_Ú	_download©ÚprefixÚsuffixr<   zDownloading %sz
User-AgentzDjango/ÚwbNzcouldn't download URL ú to ú: rµ   r¶   zcontent-dispositionr”   rG   zcontent-type)rM   ÚtempfileÚmkdtemprO   r   r2   ra   rb   rQ   rR   rS   r   rd   re   Ú
addheadersrq   Úinforr   rW   r   r_   r   r`   ÚsplitextÚ	mimetypesÚguess_extensionru   Úmove)r(   r¸   r»   rÀ   Útempdirr”   rº   Úthe_pathÚopenerÚsourcer~   Úheadersr�   Ú	used_nameÚcontent_dispositionr>   ÚparamsÚguessed_filenameÚextÚcontent_typeÚguessed_paths                        r*   r¦   ÚTemplateCommand.download(  sò  € ò
	)ð '¨×)<Ñ)<Ñ<ˆÜ×"Ò"¨&¸ÑEˆØ×Ñ×#Ñ# GÔ,Ù +¨CÓ 0Ñˆà�>‰>˜QÓØ�K‰K×ÑÐ.°Ñ<Ô=ä—7‘7—<‘< Ó2ˆÜ“ˆØ*¨g´f×6HÑ6HÐ5IÐ,JÐKÐLˆÔð	Ø—‘˜SÔ! V¬T°(¸DÔ-AÀVØ Ÿ+™+›-�Ø—‘˜VŸ[™[›]Ô+÷ .B×!ð —N‘N 3Ó'¨Ñ+ˆ	ð &Ð&;Ñ<ÐÞÜ/Ð0CÓD‰IˆAˆvØ%Ÿz™z¨*Ó5×B¸Ñà(Ðð �m‰mÐ,Ó-¨aÑ0ˆØ˜~Ñ.ˆÞ–|Ü×+Ò+¨LÓ9ˆCÞØ  CÑ'Ð ð Ð(Ó(ÜŸ7™7Ÿ<™<¨Ð1AÓBˆLÜ�KŠK˜ ,Ô/ØÐð ˆ÷E .BÕ-Aú×!Õ!ûô ó 	ÝÛ8;»XÂqÐIóð ûð	úsN   Ã H ÃHÃ0G3ÄHÄH Ç3
H	Ç=HÈ
HÈH ÈH È
H;ÈH6È6H;c                 óš   • [         R                  " U5      u  p#UR                  5       R                  S5      (       a  USS U-   nUSS nX#4$ )z0
Like os.path.splitext, but takes off .tar, too
z.taréüÿÿÿN)Ú	posixpathrÉ   Úlowerro   )r(   rÎ   ÚbaserÖ   s       r*   rÉ   ÚTemplateCommand.splitextf  sO   € ô ×&Ò& xÓ0‰	ˆØ�:‰:‹<× Ñ  ×(Ñ(Ø�r�s�)˜c‘/ˆCØ˜˜�9ˆDØˆyÐr-   c           	      ó€  • SU R                   -  n[        R                  " USS9nU R                  R	                  U5        U R
                  S:¼  a  U R                  R                  SU-  5         [        R                  " X5        U$ ! [        R                  [        4 a  n[        SU< SU< SU< 35      eS	nAff = f)
zr
Extract the given file to a temporary directory and return
the path of the directory with the extracted content.
r½   Ú_extractr¿   r<   zExtracting %szcouldn't extract file rÃ   rÄ   N)rM   rÅ   rÆ   rO   r   r2   ra   rb   r   r§   ÚArchiveExceptionrW   r   )r(   r”   rÀ   rÍ   r�   s        r*   r§   ÚTemplateCommand.extractp  s¥   € ð
 '¨×)<Ñ)<Ñ<ˆÜ×"Ò"¨&¸ÑDˆØ×Ñ×#Ñ# GÔ,Ø�>‰>˜QÓØ�K‰K×Ñ˜o°Ñ8Ô9ð	Ü�OŠO˜HÔ.ØˆNøÜ×(Ñ(¬'Ð2ó 	ÝÛ8@Ã'Ê1ÐMóð ûð	ús   Á/B ÂB=Â!B8Â8B=c                 ór   • SU;  a  gUR                  SS5      S   R                  5       nX R                  ;   $ )z)Return True if the name looks like a URL.Ú:FrG   r   )r_   rÝ   Úurl_schemes)r(   rF   Úschemes      r*   r¥   ÚTemplateCommand.is_url‚  s:   € à�hÓØØ—‘  QÓ'¨Ñ*×0Ñ0Ó2ˆØ×)Ñ)Ñ)Ð)r-   c                 óø   • [         R                  " S5      n[         R                  " U5        [        R                  " [         R                  " U5      R                  5      n[         R
                  " X$U) -  5        g )Nr   )rQ   ÚumaskÚstatÚS_IMODEÚst_modeÚchmod)r(   r•   r–   Úcurrent_umaskÚcurrent_modes        r*   rw   ÚTemplateCommand.apply_umask‰  sK   € ÜŸš ›ˆÜ
�Š�ÔÜ—|’|¤B§G¢G¨HÓ$5×$=Ñ$=Ó>ˆÜ
�Š�¨=¨.Ñ8Õ9r-   c                 ó  • [         R                  " U[         R                  5      (       d^  [         R                  " U5      n[        R                  " UR
                  5      [        R                  -  n[         R                  " X5        gg)zJ
Make sure that the file is writeable.
Useful if our source is read-only.
N)rQ   ÚaccessÚW_OKrë   rì   rí   ÚS_IWUSRrî   )r(   r”   ÚstÚnew_permissionss       r*   rx   ÚTemplateCommand.make_writeable�  sS   € ô
 �yŠy˜¤2§7¡7×+Ñ+Ü—’˜Ó"ˆBÜ"Ÿlšl¨2¯:©:Ó6¼¿¹ÑEˆOÜ�HŠH�XÕ/ð ,r-   )rN   rM   rO   r2   r5   )r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úrequires_system_checksræ   rp   r+   r�   ri   rP   r¦   rÉ   r§   r¥   rw   rx   Ú__static_attributes__r?   r-   r*   r   r      sS   † ñ	ð  Ðâ*€Kð!Ðò
&
ôPR5òh
ô6!òF<ò|òò$*ò:õ0r-   r   )r&   rÊ   rQ   rÜ   ru   rë   rÅ   Ú	importlibr   Úurllib.requestr   rd   Údjango.confr   Údjango.core.management.baser   r   Údjango.core.management.utilsr   r	   r
   Údjango.templater   r   Údjango.utilsr   Údjango.utils.httpr   Údjango.utils.versionr   r   r?   r-   r*   Ú<module>r	     sO   ðÛ Û Û 	Û Û Û Û Ý #Ý 'ã Ý  ß A÷ñ ÷
 ,Ý  Ý 5Ý 1ô~0�kõ ~0r-   