Ñò
"Hc @ s@ d Z d d k Z d d k Z e i d e i ƒ Z d „ Z d S( s* Parse a Python source code encoding stringiÿÿÿÿNs( [ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)c
C sõ yæ | d } | i t i ƒ } | o | t t i ƒ } n t i | ƒ } | pV y d d k } | i | ƒ Wn t t f j
o q© X| d } t i | ƒ } n | o | o t d ƒ ‚ n d S| o | i
d ƒ Sd SWn d SXd S( s& Deduce the encoding of a source file from magic comment.
It does this in the same way as the `Python interpreter`__
.. __: http://docs.python.org/ref/encodings.html
The ``lines`` argument should be a list of the first 2 lines of the
source code.
(From Jeff Dairiki)
i iÿÿÿÿNi s\ python refuses to compile code with both a UTF8 byte-order-mark and a magic encoding commentt utf_8( t
startswitht codecst BOM_UTF8t lent PYTHON_MAGIC_COMMENT_ret matcht parsert suitet ImportErrort SyntaxErrort groupt None( t linest line1t has_bomt mR t line2( ( sA /usr/lib/python2.6/site-packages/weberror/util/source_encoding.pyt parse_encoding s0
( t __doc__R t ret compilet VERBOSER R ( ( ( sA /usr/lib/python2.6/site-packages/weberror/util/source_encoding.pyt