MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.4/site-packages/mx/Tools/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.4/site-packages/mx/Tools/Tools.pyc
m
M5?c@sdZdkTdklZdkZdkZdkZdkZdkZdkZdk	Z	dZ
dZdZei
eidZdZd	Zd
d
jZd
djZeedZd
ZeZddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd	d
ddd
fZeeeidZedeeeiieiiei dZ!dfdYZ"e"Z#e	i$dZ%e	i$dZ&ei'e%e&dZ(eedZ)edZ*ddZ+dZ,eedZ-dZ.dZ/dZ0dei1dZ2dZ3d Z4eed!Z5eed"Z6ed#Z7d$Z8d%Z9d&ei:d'Z;ee;d(Z<dd)Z=d*Z>d+fd,YZ?d
d-Z@d.ZAd
d/ZBd0ZChZDeeDeieiEd1ZFd2ZGeHd3ZIeHd4ZJeHeKeLeMd5ZNeIeieOd6ZPeiQd7ZReiQd8ZSeiiTeiiUeiieiVd9ZWd:d;ZXd<d=d>ZYd?ZZei[d@Z\ei[dAZ]dS(Bs> Tools - Add-ons for Python written in C for performance.

    Copyright (c) 2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2001, eGenix.com Software GmbH; mailto:info@egenix.com
    See the documentation for further information on copyrights,
    or contact the author. All Rights Reserved.

(t*(s__version__NcGsjt|djogSnttttt|||f}|i	t
t|dt|S(s sortedby(sequence,*indices)
    
        Returns a list representing the sequence sorted ascending by
        the fields pointed to by the additional arguments
        (indices). sequence must be at least two-dimensional, e.g. a
        list of tuples.

    iiN(i(tlentsequencetapplyttuplesttupletextracttliststindicestxtsorttmaptget(RRR	((t2/usr/lib/python2.4/site-packages/mx/Tools/Tools.pytsortedbys	+
cGsat|djogSnt|djot||dSnttt||SdS(sF projection(sequence,*indices)

        Experimental function that extracts columns from tables
        (sequence of sequences). If only one index is given, a list of
        all elements in that dimension is returned. For more indices,
        the list will contain tuples with entries for each given
        dimension.

    iiN(RRRRRR(RR((R
t
projection&s
cCs^|g|}t|d}||}x0t|D]"\}}||||||<q4W|S(sfrange(x,y,ticks)

       Returns a list of ticks equidistant floating point values from
       the interval [x,y] such that the first is equal to x and the
       last equal to y.

    iN(
R	ttickstltfloattftickstytdifftirangetitvalue(R	RRRRRRR((R
tfrange8s


cCs=||}|o&t||jot|d}n|S(sissequence(obj)

       Returns 1 iff obj defines the sequence protocol, o
       otherwise. For instances at least __getitem__ must be defined.
    
    t__getitem__N(tisSequenceTypetobjtrcttypetInstanceTypethasattr(RRRR((R
t
issequenceIs

cCsNtid}|ii|p#|ii|p|ii|}~|S(sy defined(name)

        Return 1/0 depending on whether name is a defined symbol
        in the caller's namespace.

    iN(	tsyst	cur_frametframetf_localsthas_keytnamet	f_globalst
f_builtinstok(R'R$R*((R
tdefinedYs
8cCs?g}|i}x|o|||i}qW|i|S(s acqchain(obj)

        Returns a list of object representing the acquisition
        chain that the new builtin acquire() would scan.

        The order is top to bottom, with obj always being the
        last entry in the list.

    N(RtappendRtbaseobjtreverse(RRR,((R
tacqchainis
	

iicCsD|dj	o||hdh<|Sn||hdh<SdS(s Restricted execution eval().

        After a suggestion by Tim Peters on comp.lang.python.  locals
        can be given as local namespace to use when evaluating the
        codestring.

    t__builtins__N(tlocalstNonetevalt
codestring(R4R1R3((R
trevals

cCstdiidS(s Returns the doc string of the calling function.

        Note that this only works for Python functions since it relies
        on the code object of the calling function.

    iiN(R#tf_codet	co_consts(((R
t	docstringst00t01t02t03t04t05t06t07t08t09t0at0bt0ct0dt0et0ft10t11t12t13t14t15t16t17t18t19t1at1bt1ct1dt1et1ft20t21t22t23t24t25t26t27t28t29t2at2bt2ct2dt2et2ft30t31t32t33t34t35t36t37t38t39t3at3bt3ct3dt3et3ft40t41t42t43t44t45t46t47t48t49t4at4bt4ct4dt4et4ft50t51t52t53t54t55t56t57t58t59t5at5bt5ct5dt5et5ft60t61t62t63t64t65t66t67t68t69t6at6bt6ct6dt6et6ft70t71t72t73t74t75t76t77t78t79t7at7bt7ct7dt7et7ft80t81t82t83t84t85t86t87t88t89t8at8bt8ct8dt8et8ft90t91t92t93t94t95t96t97t98t99t9at9bt9ct9dt9et9fta0ta1ta2ta3ta4ta5ta6ta7ta8ta9taatabtactadtaetaftb0tb1tb2tb3tb4tb5tb6tb7tb8tb9tbatbbtbctbdtbetbftc0tc1tc2tc3tc4tc5tc6tc7tc8tc9tcatcbtcctcdtcetcftd0td1td2td3td4td5td6td7td8td9tdatdbtdctddtdetdfte0te1te2te3te4te5te6te7te8te9teatebtectedteeteftf0tf1tf2tf3tf4tf5tf6tf7tf8tf9tfatfbtfctfdtfetffcCsAg}|i}x"|D]}||||qW||dS(s HEX encode a data string.

        Encoding is done character per character using two byte
        lower-case HEX characters.

    tN(RR,tdatatcthexcodetordtjoin(R:R<R=R>R;RR,((R
t	hexencodes		cCs"|p|Sn|djoti}n|djoh}d}nd}g}	xo|D]g}|||}
||
o|	i|
q\|dj	o|i|
djoq\q\d||
<q\W|djo5x2|	D]&}t||||d||qWn|p|iSndS(s Build a list of filenames starting with the filenames and
        directories given in files.

        The filenames in are made absolute relative to dir. dir
        defaults to the current working directory if not given.

        If levels is greater than 0, directories in the files list are
        recursed into up the given number of levels.

        If filefilter is given, as re match object, then all filenames
        (the absolute names) are matched against it. Filenames which
        do not match the criteria are removed from the list.

        Note that directories are not included in the resulting list.
        All filenames are non-directories.

    iiN(tfilestdirR2tostgetcwdtfiledictt	recursingtdirstfileR>tabspathtisdirR,t
filefiltertmatchtlevelst	scanfilestlistdirtkeys(R@RARLRJRDR>RIRNRGRFRHRE((R
RMs0



#
(tDictScancBs8tZdZdZdZedZedZRS(s Forward iterator for Python dictionaries.

        Note that no precaution is taken to insure that the dictionary
        is not modified in between calls to the __getitem__ method. It
        is the user's responsibility to ensure that the dictionary is
        neither modified, nor changed in size, since this would result
        in skipping entries or double occurance of items in the scan.

        The iterator inherits all methods from the underlying
        dictionary for convenience.

    cCs||_d|_dS(Ni(t
dictionarytselftposition(RRRQ((R
t__init__s	cCs
d|_dS(s6 Resets the iterator to its initial position.
        iN(RRRS(RR((R
tresetscCs+||i|i\}}|_||fS(sn "for x in iterator" interface.

            Note: for loops are cancelled by raising an IndexError.

        N(tdictscanRRRQRStktv(RRtindexRVRWRX((R
Rs!cCs||i|S(sC Inherit all other methods from the underlying dictionary.
        N(tgetattrRRRQR'(RRR'RZ((R
t__getattr__*s(	t__name__t
__module__t__doc__RTRURVRRZR[(((R
RPs

		s\s*(-?\d+)\s*$s\s*(-?\d+)\s*-\s*(-?\d+)\s*$c
Csg}|i}	x||dD]}|i|}|o!|	t|i	dqn|i|}|o<tt|i	\}}t||d|t|)qqW|S(s Converts a textual representation of integer numbers and ranges
        to a Python list.

        Supported formats: 2,3,4,2-10,-1 - -3, 5 - -2

        Values are appended to the created list in the order specified
        in the string.

    t,iiN(RR,tsplittstentrytintegerRKtmtinttgroupstintegerRangeRtstarttendtrangeR(
RaR`RcRgRiRhRdRRbR,((R
tsrange8s
	%cCsy
dk}WnZtj
oN|djotiidd}n|djo
d}n||fSnXyZ|djo'|djo
d}n|i}n|i	|}|i
|d}Wn|ij
onX||fS(s Tries to return the fully qualified (hostname, ip) for the
        given hostname.

        If hostname is None, the default name of the local host is
        chosen. ip then defaults to '127.0.0.1' if not given.

        The function modifies the input data according to what it
        finds using the socket module. If that doesn't work the input
        data is returned unchanged.

    NtHOSTNAMEs	127.0.0.1i(tsockettImportErrorthostnameR2RBtenvironRtiptgethostnamet
gethostbynamet
gethostbyaddrterror(RoRqRm((R
t
fqhostnameSs&






cCsRt|\}}ti|dd}t|djo|dfSnt|S(s Tries to determine the domain name of the given hostname and
        returns a tuple (host, domain).

        If hostname is not given, the default name of the local host
        is chosen as reference.

    t.iR9N(RvRoRqtstringR`RRR(RoRqR((R
tsplitdomainssR9cCs)dk}y|iSWn|SnXdS(s Return the user name of the user running the current process.

        If no user name can be determined, default is returned.

    N(tgetpasstgetusertdefault(R|Rz((R
tusernames	cCs|ii}|i}|i}|i}d}x^tdt|dD]D}|t||}||joPn|t||d}qFW|S(s^ Calculate the correct line number of the
        traceback given in tb (even with -O on)
    iiiN(ttbttb_frameR6R;t	co_lnotabttabtco_firstlinenotlinettb_lastitstopattaddrRjRRR=(R~R;RRRRR((R
t	tb_linenos			
cBsBdk}e|d}|id|i|}|||UdS(s? Execute a byte compiled file filename in globals, locals 
    Ntrbi(	tmarshaltopentfilenametftreadtloadtcodetglobalsR1(RRR1RRR((R
texecpycs	
cCs2dk}t|d}|id|i|S(s\ Load the code from a byte compiled file filename and return it
        as code object.
    NRi(RRRRRR(RRR((R
tloadpycs
	
cBs_dk}dk}|ii|o|i|Sn|i|}||iU||i|<|S(sA Imports a code object as module name.

        Returns the previously registered module in case the module
        name was already imported. name has to be the full package
        name (pkg.pkg.mod) for the module; package local names are not
        supported and will result in top-level modules to be created.

    N(	timpR"tmodulesR&R't
new_moduleRdRt__dict__(R'RR"RRd((R
timport_codes	
cCsStd|d |ddt|d}td|}td|}|S(	s Format a sequence of adjancent pairs into a list
        of 2-tuples, e.g. 'abcdef' gives [('a','b'),('c','d'),
        ('e','f')]
    iiiicCs|dS(Ni(R	(R	((R
t<lambda>scCs|d S(Ni(R	(R	((R
RsN(ii(RR2RRRtfilter(RR((R
tpairs2tupless
+cCsXyddWn|dii}nX|o$x!t|D]}|i}q=Wn|S(s Return the execution frame level positions up the
        execution stack (defaulting to the current frame).

        WARNING: Storing the frame in variables will cause
        circular references which could result in the frames
        and associated objects to live forever.
    iiiN(texc_infoRtf_backR$tlevelttrangeR(RRRR$((R
t
exec_frames

cCsB|i}|idodSn|it|d|d<dS(s Add all known attributes of base classes to classobj's
        attribute dictionary
        - does not overwrite attributes
    t
__frozen__Ni(tclassobjRtdictR&tupdatetfrozen(RR((R
tfreezes	cCsph}xSt|iD]B}|i}|idpt|}n|}|i
|qW|i
|i|S(s| Return a dictionary that contains all known attributes
        of classobj
        - uses cached versions if available
    RN(RR.Rt	__bases__R;Rt	otherdictR&Rt
frozendictR(RRR;RR((R
Rs	cCs|djo
h}nt|dd}|dj	ot|||n|dj	oBxO|iiD]*\}}t||o|||<qgqgWn|i|i|S(s Find all attributes that are accessible through obj
        and return them as dictionary. 

        If of_class is given, only those attributes are returned that
        are instances of that class. The function mimics the
        inheritance scheme used by Python.

    t	__class__N(
tdR2RZRRtclass_attributestof_classRtitemsRWRXt
isinstanceR(RRRRRWRX((R
t
attributes
s




cCs|djo
h}nt|dd}|dj	o+x(t|D]}t|||qCWn|dj	oBxO|i	i
D]*\}}t
||o|||<q~q~Wn|iti	|S(s Find all attributes that are accessible through classobj
        and return them as dictionary. 

        If of_class is given, only those attributes are returned that
        are instances of that class. The function mimics the
        inheritance scheme used by Python.

    RN(RR2RZRtbasesR.tbRRRRRWRXRRR(RRRRRWRRX((R
R's





cCsch}|oBxO|iiD]*\}}t||o|||<qqWn|i|i|S(sp Find all instance attributes of obj that are instances of
        of_class and return them as dictionary.

    N(	RRRRRRWRXRR(RRRRWRX((R
tinst_attributesBscCsx|i}|f|i}|i}xO|D]G}x>|iiD]-}|i
|pt||||<q?q?Wq)WdS(s Add all known attributes of the instance's class and direct
        base classes to its attribute dictionary, binding methods if
        necessary
        - only one level deep
        - does not overwrite attributes

        *WARNING:* this function introduces lots of circular
        references (one for each method) !!!  Be sure to clear
        instance.__dict__ before unscoping instance !!!

    N(tinstanceRRRtclassesRRR;ROtaR&RZ(RRR;RRR((R
tlocalizeQs		cCs~|i}|f|i}|ii}xO|D]G}x>|ii	D]-}|i|pt||||<qEqEWq/W|S(sZ Add all known attributes of the instance's class and direct
        base classes to a dictionary, binding methods if necessary, and
        return it.
        - only one level deep

        *WARNING:* this function introduces lots of circular
        references !!!  Be sure to clear the returned dictionars
        before unscoping it !!!

    N(
RRRRRRtcopyRR;RORR&RZ(RRR;RRR((R
t	localizedfs	i
cCs#y|||SWndSnXdS(s Convert a string to an integer.

        Works like string.atoi except that in case of an error no
        exception raised but 0 is returned; this makes it useful in
        conjunction with map().

    iN(t	orig_atoitstrtbase(RRR((R
t	ascii2int{s

c	Cs|i|i}|dd!}|dd!}y\ti|}t|djodSnti	|dd}ti	|dd}t|djot|d	jodSnt||}t|d	jo|idn"t|djo|d }nt|}nd}t|djot|djod
Sn|ittti|}|ddjo|df|dd!}q|ddjoQ|ddjo d
|df|dd!}qd|df|dd!}qndt|jot|jnodSny|i||d}WndSnX|i|ddjo|d}n|SWndSnXdS(s Convert a textual representation of date/time into an internal
        time.time() value using some assumptions on abbreviations.
        - returns negative numbers to indictate errors
        - knows about DST (makes small errors near the time of switching)
        - centuries can be omitted: 0-69 becomes 20xx, 70-99 19xx

        Known formats:
        - 1.1.90, 01.01.90, 1.1.1990 (date only, time defaults to 0:00:00)
        - 1.1. (current year is appended, 0:00:00)
        - 1.1.90 14:00
        - 14:00 (today is used as date)
    iiiiRwit:iiiidiFiiliiiiN(iii(iii(ttimet	localtimetnowttiRRxR`R	RtsplitfieldsRttRRR,RR.tatoitmktimettm(	R	RRRRRRRR((R
tstr2timesT


 $*cCsGyt|d}Wntj
o|SnX|i}|i|S(sU Return the file's content as a string, default in case
        there's an error
    RN(RRRtIOErrorR|RR;tclose(RR|R;R((R
tfilecontents	
cCsD|d@|d?d@|d?d@|d?d@f}titt|S(s) Convert long integer x to a string.
    iiiiN(R	RRxR>Rtchr(R	R((R
tlong2strs.tModuleFinalizationcBstZdZdZRS(NcCs
||_dS(N(tfunctionRRtfini(RRR((R
RTscCs|idS(N(RRR(RR((R
t__del__s(R\R]RTR(((R
Rs	cCsnyddWnUtidi}xt|D]}|i}q2W|ii	}|ii}~nX||fS(ss func_info()

        Returns a tuple (name,filename) giving the name of the calling
        function (*) and the filename where it is defined.

        Note that this only works if the calling function is a Python
        function or method (because only these create new execution
        frames). When called from e.g. a builtin function like map(),
        it will return information about the function from where the
        builtin function was called.

        (*) level indicates how far up the calling stack to look for
        the information. Default is one level meaning: the calling
        function.
        
    iiiN(
R"RRR$RRRRR6tco_nameR'tco_filenameR(RR'RR$R((R
t	func_infos

c	Cst|do
|i}n|i}|i}|i}t	|i
| }|iot
|t
|i}x|iD]}yt|}Wn
d}nXt
|djo|d d}n||}|ddjo
d}nd||f||<|d	}qxWn|id
@o&|id|i
||d	}n|id@o&|id
|i
||d	}nd|ti|dfS(sfunc_sig(func)

       Returns the signature of a Python function/method as string.
       Keyword initializers are also shown using
       repr(). Representations longer than 100 bytes are truncated.

       XXX Anonymous argument ((a,b,c)=(1,2,3)) are not supported and
           probably never will be since they require disassembling the
           byte code which is bound to fail once byte code optimizers find
           their way into every Pythoneers home...

    tim_funcs<repr-error>ids...iRws(...)s%s=%siiRis**s%s(%s)s, N(R tfuncRt	func_codeRRtfnametco_argcounttcallargstlisttco_varnamestargst
func_defaultsRRR|treprtrtargtco_flagsR,RxR>(	RRRRRR|RRR((R
tfunc_sigs:

			




c
CssyddWntidi}nXxt|D]}|i}q6W|i}|i
}g}|i
}|id@o|d}n|id@o|d}nxx|i| D]i}yt|i|}Wn
d}nXt|djo|d d}n|id	||fqW|io#d
|iii|iif}	nd}	~~d|ti|d
|	fS(sU func_call()

        Returns a string explaining which parameters where passed to
        the calling function (*) and from which file and line number it
        was invoked.  Same comments as for func_info(). Note that
        line number information is only correct when running Python
        in non-optimized mode (i.e. without -O). Sample return string:

        'test(a=1, b=2, c=3, args=()) # called from "Tools.py":353'

        (*) level indicates how far up the calling stack to look for
        the information. Default is one level meaning: the calling
        function.
        
    iiiiis<repr-error>ids...s%s=%ss# called from "%s":%is# called from <toplevel>s	%s(%s) %ss, N(R"RRR$RRRRR6RRRRRRRRRXRR%RRR,Rtf_linenotwhereRxR>(
RRRR$RXRRRRR((R
t	func_call<s<

			

#cCsyddWntidii}nX|i}|i}x8|i	D]*\}}|i|p|||<qKqKW~~~dS(sb Copy all builtins to the caller's locals. This is done
        in a non-overwriting fashion.
    iiiN(
R"RRRR$R)tbuiltinsR%R1RRWRXR&(RR$RXRWR1((R
tlocalize_builtinsms		
cCs|djo|}|i}n|i}|i}t||jo
|i
}n't||jo
|}n
|i}||f}|i|d}|dj	oPt||ip5to*tiid|||||ifqq|Sn|g}
x`|
p
t|n|
d}	|
d=|	iot|	i|
dd+n|	|joPqqWx[|
p
t|n|
d}	t|	|d}|dj	o|||<|Sn|
d=qbWtd|dS(s Return the unbound method that is defined *after* method in the
        inheritance order of object with the same name as method
        (usually called base method or overridden method).

        object can be an instance, class or bound method. method, if
        given, may be a bound or unbound method. If it is not given,
        object must be bound method.

        Note: Unbound methods must be called with an instance as first
        argument.

        The function uses a cache to speed up processing. Changes done
        to the class structure after the first hit will not be noticed
        by the function.

        XXX Rewrite in C to increase performance.

    s<basemethod(%s, %s): cached version (%s) mismatch: %s !-> %s
iis	method %sN(tmethodR2tobjecttim_selftim_classtdefclassR\R'RRRtobjclasst	ClassTypet
cacheentrytcacheRt
basemethodt
issubclasst	__debug__R"tstderrtwritetpathtAttributeErrorR;RRRZ(RRRRRR'RRRR;RR((R
RsP

		

	
.	








cCs|g}xstt|D]_\}}|ioIg}x'|iD]}t	||t
|)qBW|||d|d+qqW|S(s Return a list representing the lookup path taken by getattr()
        whenever an attribute from classobj is requested.

        The path consists of all class objects passed during lookup in
        the right order.
        
    iN(RRR.RRR;RRRtlookup_pathR(RR;RRRR((R
Rs	

t$0123456789abcdefghijklmnopqrstuvwxyzs@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/icCss|djodSng}|i}x5|djo'|||\}}|||q'W|i||dS(s Return a string representation of integer x in base b.

        Uses code as encoding table (defaults to an extended HEX
        table).
        
    it0R9N(	R	RR,tdivmodRRRR.R>(R	RRR>RRRR,((R
Rs	
	

cCs$dkl}|i||dS(si Return the modification date/time as DateTime instance.

        Needs mxDateTime to be installed.

    (sDateTimeiN(tmxtDateTimeRtstatR(RRR((R
tfiledates
cCs||dS(s# Return the file size in bytes
    iN(RR(RR((R
tfilesizescCs\y||}Wntj
onXy||}Wntj
onX|||S(s Return the corresponding absolute path for path.

        path is expanded in the usual shell ways before
        joining it with the current working directory.

    N(t
expandvarsRRt
expanduserR>RC(RRRR>RC((R
RHs
s
c	Csydkl}||}|}|i}|i}||}x,|o$||||||}qCW|i
S(s{ Break data into multiple lines at column.

        Uses linebreak as end-of-line indicator (defaults to LF).
        
    (sStringION(t	cStringIOtStringIOR:tinfiletoutfileRRtcolumntchunkt	linebreaktgetvalue(	R:RR	RRRRRR((R
t_addlinebreaks!s
			

s<data>ic
Csdkl}dkl}||}	|}|	i}|i}|d|d@|f|d}x(|o ||||d}qhW|d|iS(N(sStringIO(sb2a_uusbegin %o %s
ii-s 
end
(
RRtbinasciitb2a_uuR:RRRRtmodeRRR
(
R:RRRRRRRR
R((R
t
_uu_encode4s

			
c
Cs6dkl}dkl}|t}	|}|	i}|i}x@|}dG|G|p
t
dn|d djoPqDqDWx|}|p
|djoPny||}WnLtij
o=}t|d	d
d@ddd
}||| }nX||qW|p
t
dn|iS(N(sStringIO(sa2b_uuis...s"Missing "begin" line in input dataitbeginsend
ii i?iisTruncated input data(RRRta2b_uutinputRRtreadlineRRat
ValueErrorR:tErrorRXR=tnbytesR
(
R:RRRRRaRRXRR((R
t
_uu_decodeEs8

				

	$
c	Csk||}|djodk}|i|Sn5|djp
|djoHdkl}dk}||}|djot	|dSn|Sn|djodk
}tidt
d	@tftid
}x=t|djo)ti|i|tid
}qWtid|i|Sn5y|i|SWn tj
otd
|nXdS(sm Encode data using the given encoding.

        Possible values for encoding include:
        'base64'   - BASE 64 encoding
        'hex'      - HEX encoding (no line breaks)
        'hexlines' - HEX encoding (with CR line breaks)

        In Python 2.0 and up, encoding may also be an encoding
        supported natively by Python via the codec registry.
    
    tbase64Nthexthexlines(sstr2hexiHtuusbegin %o %s
ii-is 
end
sunknown encoding "%s"(tlowertencodingRtencodestringR:tmx.TextToolststr2hexRtresultRRtout_fileRRR'tin_fileRRRR
tencodeRR(	R:RRRR RRR!R((R
t
encodedatajs4
	
	

	
cCs||}|djodk}|i|Sn|djp
|djo<dkl}ti|}ti
|d}||SnOydkl}Wn t
j
otd|nX||d	}||SdS(
sm Decode data using the given encoding.

        Possible values for encoding include:
        'base64'   - BASE 64 encoding
        'hex'      - HEX encoding (no line breaks)
        'hexlines' - HEX encoding (with CR line breaks)

        In Python 2.0 and up, encoding may also be an encoding
        supported natively by Python via the codec registry.
    
    RNRR(shex2strR9(slookupsunknown encoding "%s"i(RRRtdecodestringR:Rthex2strRxR`RR>tcodecstlookupRnRtdecode(R:RRRRR'R*R)((R
t
decodedatas 
	
(^R^tmxToolst__version__toperatorttypesRxRR"RBtreRRRRRR!R+R/tTruetFalseR2R3R5R8ttruthtnonzerot_hexcodeR=R>R?RRIRNRMRPt	DictItemstcompilet
_integerREt_integerRangeRER`RkRvRyR}RRRRRRRRRRRRRRRRRRRRRRRRt_basemethod_cacheRRRRR<tcode64RRRjtcode256RRRRRRRRCRHRRRRR%R+(CRR9RRkRR+RRR8R5RR<RMRR.RRRRRRR4RvRRRRR5R/R0RRRR-R1RR}R;RxRRHR+R8R"RR%RPR:R/RRR2RRRR?R!RRR<R6RRRRBRRy((R
t?s
?							-50 	
	
						?
		-1	N	*	%1

Anon7 - 2021