bgvdZddlmZmZmZddlZddlZddlZddlm Z m Z m Z ddl m Z ddlmZddlmZd dZ dS) a pasteurize: automatic conversion of Python 3 code to clean 2/3 code =================================================================== ``pasteurize`` attempts to convert existing Python 3 code into source-compatible Python 2 and 3 code. Use it like this on Python 3 code: $ pasteurize --verbose mypython3script.py This removes any Py3-only syntax (e.g. new metaclasses) and adds these import lines: from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from future import standard_library standard_library.install_hooks() from builtins import * To write changes to the files, use the -w flag. It also adds any other wrappers needed for Py2/3 compatibility. Note that separate stages are not available (or needed) when converting from Python 3 with ``pasteurize`` as they are when converting from Python 2 with ``futurize``. The --all-imports option forces adding all ``__future__`` imports, ``builtins`` imports, and standard library aliases, even if they don't seem necessary for the current state of each module. (This can simplify testing, and can reduce the need to think about Py2 compatibility when editing the code further.) )absolute_importprint_functionunicode_literalsN)mainwarnStdoutRefactoringTool)refactor) __version__) fix_namesc* tjd}|dddd|dd dd |d d d gd|dddddd|ddd gd|dddd|dddd|d dd!|d"d#dd$|d%d&dd'd(d'}i}||\}}d)}t}d*|d+<|js|jrtd,|js|jr| d-|j rttd.S|j r4td/t|D]}t||sd.S|s8td0tj1td2tj1d3Sd4|vr&d*}|jrtd5tj1d3S|jr t$jn t$j}t%jd6|7t-} |jD]NJd8vr| fd9|D} t3| dkr>td:d;d<| Dztj1d3St3| d.krtd=tj1d3S| | d.t-} |jrJd>} | | d?z| | d@z| | dAzt-} |jrJd'}|jD]ЊdBkrd*} d8vr| %fdC|D} t3| dkr>td:d;dD| Dztj1d3St3| d.krtd=tj1d3S| | d.t3| | zd.kr@tdEd;dF| | zDztj1d3S|r|| n| }n|| }|| | z z}t=t||t-|j|j }|js|r| nb |!||jdG|j"n>#tBj#$r,|j"dksJtdHtj1YdSwxYw|$tKtM|jS)IzBMain program. Returns a suggested exit status (0, 1, 2). z!pasteurize [options] file|dir ...)usagez-Vz --version store_truez'Report the version number of pasteurize)actionhelpz-az --all-importsz5Adds all __future__ and future imports to each modulez-fz--fixappendz1Each FIX specifies a transformation; default: all)rdefaultrz-jz --processesstoreintzRun 2to3 concurrently)rrtyperz-xz--nofixzPrevent a fixer from being run.z-lz --list-fixeszList available transformationsz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz'Don't write backups for modified files.zlibpasteurize.fixesTrz@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wrz2Available transformations for the -f/--fix option:z1At least one file or directory argument required.)filezUse --help to show usage.-zCan't write to stdin.z%(name)s: %(message)s)formatlevelz.fix_cdg|],}|d*|-Szfix_{0}endswithr.0ffixs c/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/libpasteurize/main.py zmain..}sG;;;1 9#3#3C#8#899;Q;;;zOAmbiguous fixer name. Choose a fully qualified module name instead from these:  c3 K|] }d|zV dSz Nr!myfs r$ zmain..s&<.sNCCC1 ! 9+;+;C+@+@ A ACQCCCr&c3 K|] }d|zV dSr)r*r+s r$r-zmain..s&'D'Dss 'D'D'D'D'D'Dr&z[Conflicting usage: the following fixers have been simultaneously requested and disallowed: c3 K|] }d|zV dSr)r*r+s r$r-zmain..s&NN3D3JNNNNNNr&Nz+Sorry, -j isn't supported on this platform.)'optparse OptionParser add_option parse_argsr writeno_diffsr nobackupserrorversionprintr list_fixessortedsysstderrverboseloggingDEBUGINFO basicConfigsetnofixaddlenjoin all_importsr#unionrerrorsrefactor_stdinr processesMultiprocessingUnsupported summarizerbool)argsparserrPflagsoptions fixer_pkg avail_fixesfixnamerunwanted_fixesfound extra_fixesprefixexplicit all_present requested fixer_namesrtr#s @r$rr3s  ")L M M MF dK DFFF dOLRTTT dGHbNPPP dM'1 '>@@@ dIh<>>> dN<;=== dK 1333 l<@BBB dIl6888 dM,DFFFN E%%d++MGT%IK"E  =QW-Q OPPP =0W.0 ./// kq BCCCk**  G 'NNNN 1  A:     ) ;;;;q d{{ =  ) ; ; ; ;1%_ >GMM',E 6eDDDDUUN})) c>>   s # # # # ;;;; ;;;E5zzA~~:ii<>???uuH{!0 ; + +Ce||" c>>LL%%%% CCCC CCCE5zzA~~B"ii'D'De'D'D'DDDE$'://// !qqUqQ#&://// qqLLq**** x.( ) )A - - ?))NN8n3LNNNNNOz # # # #13>LK%%h///H %%h// kN::K vk22E355&0g6F2F H HB 9            D'-#-////6   (1,,,,4:=*FFFFqq    tBI  s?"V""7WW)N)__doc__ __future__rrrrArDr5 lib2to3.mainrrrlib2to3r futurer libpasteurize.fixesr r*r&r$rks$$LKJJJJJJJJJ ::::::::::))))))Y Y Y Y Y Y r&