
    o'e                     z    d dl Z d dlZd dlmZmZmZmZmZmZ ddl	T d Z
d Zd Zd Zed	k    r e             dS dS )
    N)PYQT_VERSION_STRQDirQFile	QFileInfo	QIODeviceQTextStream   )*c                  D    t           j                            d           d S )Na  Usage:
    pylupdate5 [options] project-file
    pylupdate5 [options] source-files -ts ts-files

Options:
    -help  Display this information and exit
    -version
           Display the version of pylupdate5 and exit
    -verbose
           Explain what is being done
    -noobsolete
           Drop all obsolete strings
    -tr-function name
           name() may be used instead of tr()
    -translate-function name
           name() may be used instead of translate()
)sysstderrwrite     4lib/python3.11/site-packages/PyQt5/pylupdate_main.py
printUsager      s+    J9: : : : :r   c           	         t                      }|D ]}|                    |          }t                      }t                      }	|                    |           |r|                    |           t          || |	|||           |r|	                                 |	                                 |	                    |          s"t          j
                            d|z             d S )Nz#pylupdate5 error: Cannot save '%s'
)r   relativeFilePathMetaTranslatorloadsetCodecmergestripObsoleteMessagesstripEmptyContextssaver   r   r   )

fetchedTortsFileNames
codecForTr
noObsoleteverbosedirtfntorouts
             r   updateTsFilesr&   0   s    
&&C J J!!!$$ 	%LL$$$c:sJ<<< 	(%%'''   xx{{ 	JJCbHIII%J Jr   c                 Z    |                      t          j                    d                   S )Nr	   )encodelocalegetdefaultlocale)paths    r   _encoded_pathr,   H   s"    ;;v.003444r   c                     d} t                      }d}d}g }g }d}d}d}d}	d}
d}d }d }t          j        dd          D ]
}|dk    rd}
t          t          j                  }d}||k     rCt          j        |         }|dz  }|dk    r"t	                       t          j        d           |d	k    r;t          j                            d
t          z             t          j        d           |dk    rd}|dk    rd}|dk    rd}|dk    rQ||k    r3t          j                            d           t          j        d           t          j        |         }|dz  }|dk    rR||k    r3t          j                            d           t          j        d           t          j        |         }|dz  }Q|	dz  }	d}|st          |          }|
                    t          j                  s6t          j                            d|z             t          j        d           t          |          }|                                }|                                 |
r!t!          j                    }t!          j        t'          |                                                     t                      }d}d}g }g }t+          |                                          D ]\  }}|                    d          D ]}|dk    rIt1          t3          t!          j                                        |                    || d|||           d}R|dk    r<|                    t!          j                                        |                     d}|dv r|}|                    |           |dk    r|}|dk    rCt=          t3          t!          j                                        |                    || d           !t?          |||||           |s#t          j                            d|z             n5t          |          dk    r"t          j                            d|z             t!          j        |           n*|r|                                 !                    d          rpt'          |          }|"                                r|#                                r|                    |           nt          j                            d|z             nt          j                            d|z             nnt'          |          }t3          |                                          }|$                                dv rt1          ||| d|||           nt=          ||| d           ||k     C|
st?          |||||           |	dk    r$t	                       t          j        d           d S d S )Nz@default Fr   Tr	   z-tsz-helpz-versionzpylupdate5 v%s
z-noobsoletez-verbosez-tr-functionz,pylupdate5 error: missing -tr-function name
   z-translate-functionz3pylupdate5 error: missing -translate-function name
z(pylupdate5 error: Cannot open file '%s'
 SOURCESTRANSLATIONS)CODECDEFAULTCODEC
CODECFORTRCODECFORSRCFORMSz@pylupdate5 warning: File '%s' does not look like a project file
zEpylupdate5 warning: Met no 'TRANSLATIONS' entry in project file '%s'
z.tsz8pylupdate5 warning: For some reason, I cannot save '%s'
z0pylupdate5 error: File '%s' lacks .ts extension
)pypyw)%r   r   argvlenr   exitr   r   r   r   openr   ReadOnlyr   readAllcloser   currentPath
setCurrentr   r+   proFileTagMapitemssplit
fetchtr_pyr,   currentabsoluteFilePathappendr   
fetchtr_uir&   lowerendswithexists
isWritablesuffix)defaultContextr   r   codecForSourcer   uiFileNamesr    r   metSomethingnumFilesstandardSyntax	metTsFlagtr_functranslate_funcargargcifullTextfr"   oldDirkeyvaluefir+   s                            r   mainrb   L   sp     N!!JJNKKGJLHNIGN x| # #%<<"Nsx==D	A
d((hqk	Q'>>LLLHQKKK*J/2BBCCCHQKKK-J*G%<<I.  Dyy
  GI I IhqkGFA'''Dyy
  NP P P Xa[NFAA 
	c

A66),-- 
  CcIK K KAAyy{{HGGIII H	G%''FOIcNN//11222'))JJNKK+H55;;== B B
US)) B BAi''" -(,(G(G(J(J!L !L *ND .	I I I
 (,..#**4<>>+J+J1+M+MNNN'+ GGG%&
"++J7777--)*" -(,(G(G(J(J!L !L *NDB B B+B4 *k:z     5
  )+./0 0 0 0 [!!Q&&
  .0345 5 5 OF#### G99;;''.. W"3B99;; <"--// <#**3////
((!57:!;< < < < J$$ORUUW W W W s^^$R%8%8%:%:;;99;;-//tZ*G^E E E E tZFFFI d((L  Pj+z:wOOO1}} }r   __main__)r)   r   PyQt5.QtCorer   r   r   r   r   r   	pylupdater   r&   r,   rb   __name__r   r   r   <module>rg      s   &  



                   ; ; ;(J J J05 5 5g g gT zDFFFFF r   