/usr/lib/python2.6/site-packages/sos
NameSizeModeActions
plugins/-0755rm
policies/-0755rm
archive.py165040644editdlrm
archive.pyc186210644editdlrm
archive.pyo185860644editdlrm
reporting.py40460644editdlrm
reporting.pyc66880644editdlrm
reporting.pyo66880644editdlrm
sosreport.py550230644editdlrm
sosreport.pyc496120644editdlrm
sosreport.pyo496120644editdlrm
utilities.py88170644editdlrm
utilities.pyc100950644editdlrm
utilities.pyo100950644editdlrm
__init__.py11150644editdlrm
__init__.pyc6580644editdlrm
__init__.pyo6580644editdlrm
Edit: /usr/lib/python2.6/site-packages/sos/utilities.pyc (10095B)
R]c@sSddklZddkZddkZddkZddklZlZlZddk Z ddk Z ddk Z ddk Z ddk Z ddkZddkZddklZddklZdZddZdddddZdddZdZdZdddZddZd ddZdefdYZdS(i(twith_statementN(tPopentPIPEtSTDOUT(tclosing(tStringIOcCsht|dii}zE|~}ti|i|jo|i| dn|iSWdQXdS(s,Returns the last number_of_bytes of filenametrbiN(topent__exit__t __enter__toststattst_sizetseektread(tfilenametnumber_of_bytest_[1]tf((s1/usr/lib/python2.6/site-packages/sos/utilities.pyttail"s&trcCsgt|toIyt||SWqctid}|id|ttSXn t|SdS(s@Returns a file-like object that can be used as a context managertsossfileobj: %s could not be openedN(t isinstancet basestringRtloggingt getLoggertdebugRR(t path_or_filetmodetlog((s1/usr/lib/python2.6/site-packages/sos/utilities.pytfileobj*sii iii(cCst|}||jo d||S||jo d||S||jo d||S||jo d||Sd|SdS(sCConverts a number of bytes to a shorter, more human friendly formats%.1fTs%.1fGs%.1fMs%.1fKs%dN(tfloat(tbytes_tKtMtGtTtfn((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt convert_bytes7s         c cs|o/tii|itii}||7}nxti|D]\}}}|o$|itii|jo|2n|oti|| oqFnx.ti||D]}tii||VqWqFWdS(sgenerator function to find files recursively. Usage: for filename in find("*.properties", "/var/log/foobar"): print filename N( R tpathtdirnametcounttseptwalktfnmatchtfiltertjoin( t file_patternttop_dirt max_deptht path_patternt base_depthR'tdirlisttfilelisttname((s1/usr/lib/python2.6/site-packages/sos/utilities.pytfindFs!#c sag}xT|D]L}t|ii}z*|~}|ifd|DWdQXq W|S(sReturns lines matched in fnames, where fnames can either be pathnames to files to grep through or open file objects to grep through line by linec3s0x)|]"}ti|o |VqqWdS(N(tretmatch(t.0tline(tpattern(s1/usr/lib/python2.6/site-packages/sos/utilities.pys bs N(RRR textend(R<tfiles_or_pathstmatchestfopRtfo((R<s1/usr/lib/python2.6/site-packages/sos/utilities.pytgrep[s #'cCsotiidditii}|gg}|D]}|tii||q5~}td|DS(s6Returns if a command matches an executable on the PATHtPATHtcss(x!|]}ti|tiVqWdS(N(R taccesstX_OK(R:R'((s1/usr/lib/python2.6/site-packages/sos/utilities.pys ls (R tenvirontgettsplitR'tpathsepR.tany(tcommandtpathsRtpt candidates((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt is_executablegs$7i,c sfd}ti}d|d<|o!tdod||f}n|idd}ti|}g}xB|D]:}ti|}|o|i|qx|i|qxWy:t |dt d t d t d d d |dt d|} WnAtj o5} | itijohdd6dd6S| nX| i\} } | idjp| idjo d} nh| id6| iddd6S(sExecute a command through the system shell. First checks to see if the requested command is executable. Returns (returncode, stdout, 0)cs;o0ytiWq7tidq7XndS(Nsfailed to chdir to '%s'(R tchdirtselft log_error((trunat(s1/usr/lib/python2.6/site-packages/sos/utilities.pyt _child_chdirrs tCtLC_ALLttimeoutstimeout %ds %ssutf-8tignoretshelltstdouttstderrtbufsizeitenvt close_fdst preexec_fnitstatusRDtoutputi~(R RGRPtencodetshlexRItglobR=tappendRtFalseRRtTruetOSErrorterrnotENOENTt communicatet returncodetdecode( RLRXRTRUtcmd_envtargst expanded_argstargt expanded_argRNteR[R\((RTs1/usr/lib/python2.6/site-packages/sos/utilities.pytsos_get_command_outputos8       c Cs|idd}t|tt|g}g}ti|tiD]'\}}|i|jo ||qKqK~}|o9g}|D]!} t| |o || qq~}n|S(sImports the module module_fqname and returns a list of defined classes from that module. If superclasses is defined then the classes returned will be subclasses of the specified superclass or superclasses. If superclasses is plural it must be a tuple of classes.t.i( t rpartitiont __import__tglobalstlocalstinspectt getmemberstisclasst __module__t issubclass( t module_fqnamet superclassest module_nametmoduleRtcnametclass_tmodulest_[2]tm((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt import_modules$9cCst|d|d|dS(seShell out to an external command and return the output or the empty string in case of error. RXRTRb(Ru(tcmdRXRT((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt shell_outstImporterHelpercBsPeZdZdZdZdZdZddZdZ dZ RS( sProvides a list of modules that can be imported in a package. Importable modules are located along the module __path__ list and modules are files that end in .py. This class will read from PKZip archives as well for listing out jar and egg contents.cCs ||_dS(sopackage is a package module import my.package.module helper = ImporterHelper(my.package.module)N(tpackage(RRR((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt__init__scCs.tii|}tii|\}}|S(s-Returns the plugin module name given the path(R R'tbasenametsplitext(RRR'tbaseR6text((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt _plugin_namescCsYg}|D]7}d|jo$|ido||i|q q ~}|i|S(NRs.py(tendswithRtsort(RRtlist_Rtplugintplugins((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt_get_plugins_from_lists   - cCsOtii|o8ttd|}|i|}|o|SgSndS(Ns*.py(R R'texiststlistR7R(RRR'tpy_filestpnames((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt_find_plugins_in_dirs cCs|p dg}n|ido|tii|fStii|\}}|id|||jotdn|i||SdS(NRDs.jars.zips.eggisnot a zip file(s.jars.zips.egg(RR R'R.RItinsertt Exceptiont_get_path_to_zip(RRR't tail_listtheadR((s1/usr/lib/python2.6/site-packages/sos/utilities.pyRs  c Csy|i|\}}ti|}|itiid}g}|iD]}||jo ||qPqP~}|i|}|i |o|SgSWnt t fj ogSXdS(Nt/( RtzipfiletZipFiletreplaceR R'R*tnamelistRtclosetIOErrorR( RRR't path_to_zipRtzfRR6t root_namesRO((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt_find_plugins_in_zipfiles8 cCsqg}xd|iiD]V}tii|p |djo|i|i|q|i|i|qW|S(sQReturns the list of importable modules in the configured python package. RD(Rt__path__R R'tisdirR=RR(RRRR'((s1/usr/lib/python2.6/site-packages/sos/utilities.pyt get_moduless  N( t__name__R~t__doc__RRRRtNoneRRR(((s1/usr/lib/python2.6/site-packages/sos/utilities.pyRs     iii@l(t __future__RR R8R{t subprocessRRRRthashlibRR,RjRdRet contextlibRRRRR&RR7RBRPRuRRtobjectR(((s1/usr/lib/python2.6/site-packages/sos/utilities.pyts.             2