config root man

Current Path : /compat/linux/proc/self/root/usr/local/lib/python2.5/bsddb/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //compat/linux/proc/self/root/usr/local/lib/python2.5/bsddb/dbtables.pyc

³ò
h”Rc@sÑdZddkZddkZddkZddkZddkZddklZlZddk	Z
yddkTWnej
oddk
TnXyeWn)ej
odefd„ƒYZnXdefd„ƒYZd	efd
„ƒYZdd#d„ƒYZd
efd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdZdZd„ZdZdZdZd„Zd„Z d„Z!d„Z"d„Z#d „Z$d!d$d"„ƒYZ%dS(%s=$Id: dbtables.py 58760 2007-11-01 21:22:40Z gregory.p.smith $iÿÿÿÿN(tListTypet
StringType(t*tDBIncompleteErrorcBseZRS((t__name__t
__module__(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR'stTableDBErrorcBseZRS((RR(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR*stTableAlreadyExistscBseZRS((RR(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR,stCondcBseZdZd„ZRS(s!This condition matches everythingcCsdS(Ni((tselfts((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt__call__2s(RRt__doc__R(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR0st	ExactCondcBs eZdZd„Zd„ZRS(s)Acts as an exact match condition functioncCs
||_dS(N(t
strtomatch(R	R((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt__init__7scCs
||ijS(N(R(R	R
((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR9s(RRRRR(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR
5s	t
PrefixCondcBs eZdZd„Zd„ZRS(s9Acts as a condition function for matching a string prefixcCs
||_dS(N(tprefix(R	R((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR>scCs|t|iƒ |ijS(N(tlenR(R	R
((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR@s(RRRRR(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR<s	tPostfixCondcBs eZdZd„Zd„ZRS(s:Acts as a condition function for matching a string postfixcCs
||_dS(N(tpostfix(R	R((s*/usr/local/lib/python2.5/bsddb/dbtables.pyREscCs|t|iƒ|ijS(N(RR(R	R
((s*/usr/local/lib/python2.5/bsddb/dbtables.pyRGs(RRRRR(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyRCs	tLikeCondcBs&eZdZeid„Zd„ZRS(sÇ
    Acts as a function that will match using an SQL 'LIKE' style
    string.  Case insensitive and % signs are wild cards.
    This isn't perfect but it should work for the simple common cases.
    cCsfd}x$|D]}|i|d|ƒ}q
W|iddƒ|_tid|id|ƒ|_dS(Ns.*+()[]?s\t%s.*t^t$(treplacetlikestrtretcompile(R	Rtre_flagstchars_to_escapetchar((s*/usr/local/lib/python2.5/bsddb/dbtables.pyRPscCs|ii|ƒS(N(Rtmatch(R	R
((s*/usr/local/lib/python2.5/bsddb/dbtables.pyRXs(RRRRt
IGNORECASERR(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyRJst__TABLE_NAMES__s._COLUMNS__cCs|tS(N(t_columns(ttable((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt_columns_keyass._DATA_.s	._ROWID_.icCs|t|t|S(N(t_data(R$tcoltrowid((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt	_data_keylscCs|t|tS(N(R&(R$R'((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt_search_col_data_keyoscCs|tS(N(R&(R$((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt_search_all_data_keyrscCs|t|tS(N(t_rowid(R$R(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt
_rowid_keyuscCs|tS(N(R,(R$((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt_search_rowid_keyxscCsh|itƒdjpB|itƒdjp,|itƒdjp|itƒdjodSndSdS(s‚Verify that the given string does not contain any
    metadata strings that might interfere with dbtables database operation.
    iiN(tfindt_table_names_keyR#R&R,(R
((s*/usr/local/lib/python2.5/bsddb/dbtables.pytcontains_metastrings{st
bsdTableDBcBsÈeZdddddd„Zd„Zd„Zdd„Zd„Zd„Zd„Zd	„Z	d
„Z
d„Zd„Zd
„Z
d„Zhhd„Zhd„Zhd„Zd„Zd„ZRS(ii€cCs“d|_t}|o|tO}nttBtBtB|B}	y|tO}Wnt	j
onX|o|	t
B}	ntƒ|_|ii
tƒ|ii|||	Bƒ|o|tO}nt|iƒ|_|iidƒ|iitƒ|ii|t||B|ƒ||_|iiƒ}
yC|iit|
ƒp)|iittigdƒd|
ƒnWn|
iƒ‚nX|
iƒh|_dS(sÃbsdTableDB(filename, dbhome, create=0, truncate=0, mode=0600)

        Open database name in the dbhome BerkeleyDB directory.
        Use keyword arguments when calling this constructor.
        ittxnN( tNonetdbt	DB_THREADt	DB_CREATEt
DB_INIT_MPOOLtDB_INIT_LOCKtDB_INIT_LOGtDB_INIT_TXNtDB_AUTO_COMMITtAttributeErrort
DB_RECOVERtDBEnvtenvt
set_lk_detecttDB_LOCK_DEFAULTtopentDB_TRUNCATEtDBtset_get_returns_nonet	set_flagstDB_DUPtDB_BTREEt
dbfilenamet	txn_beginthas_keyR0tputtpickletdumpstaborttcommitt_bsdTableDB__tablecolumns(R	tfilenametdbhometcreatettruncatetmodetrecovertdbflagstmyflagstflagsforenvR3((s*/usr/local/lib/python2.5/bsddb/dbtables.pyRŠs<		-

cCs|iƒdS(N(tclose(R	((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt__del__ºscCsX|idj	o|iiƒd|_n|idj	o|iiƒd|_ndS(N(R5R4R\R@(R	((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR\½s


cCs.y|ii|ƒWntj
onXdS(N(R@ttxn_checkpointR(R	tmins((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt
checkpointÅscCs+y|iiƒWntj
onXdS(N(R5tsyncR(R	((s*/usr/local/lib/python2.5/bsddb/dbtables.pyRaËscCs™dGH|iiƒ}ya|iƒ\}}xHth||<ƒGH|iƒ}|o|\}}q,|iƒdSq,Wntj
o|iƒnXdS(s*Print the database to stdout for debuggings5******** Printing raw database for debugging ********N(R5tcursortfirsttreprtnextR\tDBNotFoundError(R	tcurtkeytdataRe((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt	_db_printÑs
cCs†t|tƒpt‚d}y+t|ƒotdƒ‚nx+|D]#}t|ƒotdƒ‚qDqDWt|ƒ}|ii|ƒo
t	d‚n|i
iƒ}|ii|t
i|dƒd|ƒt
i|iitd|dtƒƒ}|i|ƒ|iit|ƒ|iitt
i|dƒd|ƒ|iƒd}Wn7tj
o+}|o|iƒnt|d‚nXdS(s”CreateTable(table, columns) - Create a new table in the database.

        raises TableDBError if it already exists or for other DB errors.
        s-bad table name: contains reserved metastringss.bad column name: contains reserved metastringsstable already existsiR3tflagsN(t
isinstanceRtAssertionErrorR4R1t
ValueErrorR%R5RLRR@RKRMRNROtloadstgetR0tDB_RMWtappendtdeleteRQtDBErrorRPR(R	R$tcolumnsR3tcolumntcolumnlist_keyt	tablelisttdberror((s*/usr/local/lib/python2.5/bsddb/dbtables.pytCreateTableãs6



%
%

cCsŠt|tƒpt‚t|ƒo
td‚nt|ƒ}|ii|ƒpgSn|ii|ƒ}|ot	i
|ƒSngSdS(s\Return a list of columns in the given table.
        [] if the table doesn't exist.
        s-bad table name: contains reserved metastringsN(RlRRmR1RnR%R5RLRpRNRo(R	R$Rwtpickledcolumnlist((s*/usr/local/lib/python2.5/bsddb/dbtables.pytListTableColumns
s

cCs2|iitƒ}|oti|ƒSngSdS(s)Return a list of tables in this database.N(R5RpR0RNRo(R	tpickledtablelist((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt
ListTablessc
Cs“t|tƒpt‚y|i||ƒWnatj
oUd}yt|ƒ}|iiƒ}t	i
|ii|d|dt
ƒƒ}h}x|D]}|||<q”Wti|ƒ}x/|D]'}|i|ƒp|i|ƒq¾q¾W||jo<|ii||ƒ|ii|t	i|dƒd|ƒn|iƒd}|i|ƒWqtj
o+}	|o|iƒnt|	d‚qXnXdS(sCreateOrExtendTable(table, columns)

        Create a new table in the database.

        If a table of this name already exists, extend it to have any
        additional columns present in the given list as well as
        all of its current columns.
        R3RkiN(RlRRmRzRR4R%R@RKRNRoR5RpRqtcopyRLRrRsRMRORQt_bsdTableDB__load_column_infoRtRPR(
R	R$RuR3Rwt
oldcolumnlistt
oldcolumnhashtct
newcolumnlistRy((s*/usr/local/lib/python2.5/bsddb/dbtables.pytCreateOrExtendTable&s>	!

cCswy|iit|ƒƒ}Wn#tj
otd|f‚nX|ptd|f‚nti|ƒ|i|<dS(s'initialize the self.__tablecolumns dictsunknown table: %rN(R5RpR%RfRRNRoRR(R	R$ttcolpickles((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt__load_column_info[scCs­d}x |p˜g}x-ttƒD]}|itiddƒƒq#Wtidt|Œ}y,|iit	||ƒdd|dtƒWntj
oq	Xd}q	W|S(s"Create a new unique row identifieriiÿtBR3RkiN(
txranget_rowid_str_lenRrtrandomtrandinttstructtpackR5RMR-R4tDB_NOOVERWRITEtDBKeyExistError(R	R$R3tuniquetblisttxtnewid((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt__new_rowidfs
!c	Csvd}y|iit|ƒƒp
td‚n|ii|ƒp|i|ƒnx?|iƒD]1}|i|i|ƒptd|f‚q`q`W|i	i
ƒ}|i|d|ƒ}x?|iƒD]1\}}|ii
t|||ƒ|d|ƒqÆW|iƒd}Wnctj
oW}tiƒ}|o'|iƒ|iit||ƒƒnt|d|d‚nXdS(sƒInsert(table, datadict) - Insert a new row into the table
        using the keys+values from rowdict as the column values.
        s
unknown tablesunknown column: %rR3iiN(R4R5RLR%RRRR€tkeystcountR@RKt_bsdTableDB__new_rowidtitemsRMR)RQRttsystexc_infoRPRsR-(	R	R$trowdictR3RvR(tdataitemRytinfo((s*/usr/local/lib/python2.5/bsddb/dbtables.pytInsert~s.


)


cCsjyA|i|g|ƒ}|iƒ}x|iƒD]}d}yÝxÖ|D]Î}|iiƒ}yG|iit|||ƒd|ƒ}	|iit|||ƒ|ƒWnt	j
o
d}	nX|||	ƒ}	|	djo)|ii
t|||ƒ|	d|ƒn|iƒd}qGWWq1|o|iƒn‚q1Xq1WWn"t
j
o}
t|
d‚nXdS(sModify(table, conditions={}, mappings={}) - Modify items in rows matching 'conditions' using mapping functions in 'mappings'

        * table - the table name
        * conditions - a dictionary keyed on column names containing
          a condition callable expecting the data string as an
          argument and returning a boolean.
        * mappings - a dictionary keyed on column names containing a
          condition callable expecting the data string as an argument and
          returning the new string for that column.
        R3iN(t_bsdTableDB__SelectR–R4R@RKR5RpR)RsRfRMRQRPRtR(R	R$t
conditionstmappingstmatching_rowidsRuR(R3RvRRy((s*/usr/local/lib/python2.5/bsddb/dbtables.pytModify¦s@
			
	
c	Cs?y|i|g|ƒ}|i|}xí|iƒD]ß}d}y£|iiƒ}xG|D]?}y#|iit|||ƒ|ƒWqWt	j
oqWXqWWy |iit
||ƒ|ƒWnt	j
onX|iƒd}Wq2tj
o!}|o|i
ƒn‚q2Xq2WWn"tj
o}t|d‚nXdS(sDelete(table, conditions) - Delete items matching the given
        conditions from the table.

        * conditions - a dictionary keyed on column names containing
          condition functions expecting the data string as an
          argument and returning a boolean.
        iN(R RRR–R4R@RKR5RsR)RfR-RQRtRPR(	R	R$R¡R£RuR(R3RvRy((s*/usr/local/lib/python2.5/bsddb/dbtables.pytDeleteØs6

	 

cCsŠy[|ii|ƒp|i|ƒn|djo|i|}n|i|||ƒ}Wn"tj
o}t|d‚nX|iƒS(s²Select(table, columns, conditions) - retrieve specific row data
        Returns a list of row column->value mapping dictionaries.

        * columns - a list of which column data to return.  If
          columns is None, all columns will be returned.
        * conditions - a dictionary keyed on column names
          containing callable conditions expecting the data string as an
          argument and returning a boolean.
        iN(RRRLR€R4R RtRtvalues(R	R$RuR¡R£Ry((s*/usr/local/lib/python2.5/bsddb/dbtables.pytSelects

cCsö|ii|ƒp|i|ƒn|djo|i|}nxC||iƒD]1}|i|i|ƒptd|f‚qSqSWh}h}d„}|iƒ}|i	|ƒ|i
iƒ}	d}
x[|D]S\}}|
d}
t||ƒ}||jo
d}
nd}
yÞ|	i
|ƒ\}}xÂ|t|ƒ |joª|t}|i|ƒpy|p
||ƒo;|i|ƒph||<n|
o||||<qÖqÚ|i|ƒo||=n|||<n|	iƒ\}}q/WWqÒtj
o$}|dtjo‚qÒqÒqÒXqÒW|	iƒ~t|ƒdjo©x¦|iƒD]”\}}x…|D]}}|i|ƒoqiny&|i
it|||ƒƒ||<Wqitj
o+}|dtjo‚nd||<qiXqiWqVWn|S(s™__Select() - Used to implement Select and Delete (above)
        Returns a dictionary keyed on rowids containing dicts
        holding the row data for columns listed in the columns param
        that match the given conditions.
        * conditions is a dictionary keyed on column names
        containing callable conditions expecting the data string as an
        argument and returning a boolean.
        sunknown column: %rcSs|d}|d}t|ƒt|ƒjoŽt|tƒo3t|tƒo#tt|iƒt|iƒƒSnt|tƒo3t|tƒo#tt|iƒt|iƒƒSndSnt|tƒodSnt|tƒodSnt|tƒodSnt|tƒodSndS(Niiiÿÿÿÿ(	ttypeRlRtcmpRRRRR
(tatupletbtupletatb((s*/usr/local/lib/python2.5/bsddb/dbtables.pytcmp_conditions1s"

 # #iÿÿÿÿiiN(RRRLR€R4ttablecolumnsR–R—RR™tsortR5RbR*t	set_rangeRRŠReRttDB_NOTFOUNDR\RpR)(R	R$RuR¡RvR£trejected_rowidsR®t
conditionlistRgt
column_numt	conditiont	searchkeytsavethiscolumndataRhRiR(Rytrowdata((s*/usr/local/lib/python2.5/bsddb/dbtables.pyt__Selectst

	





	c	Csd}yÏ|iiƒ}|iit|ƒ|ƒ|ii|ƒ}t|ƒ}xYy|i|ƒ\}}Wnt	j
oPnX|t
|ƒ |joPn|iƒqRt|ƒ}xYy|i|ƒ\}}Wnt	j
oPnX|t
|ƒ |joPn|iƒqº|iƒt
i|iitd|dtƒƒ}y|i|ƒWntj
onX|iit|ƒ|iitt
i|dƒd|ƒ|iƒd}|ii|ƒo|i|=nWn7tj
o+}|o|iƒnt|d‚nXdS(s(Remove an entire table from the databaseR3RkiN(R4R@RKR5RsR%RbR+R±RfRR.R\RNRoRpR0RqtremoveRnRMRORQRRRLRtRPR(	R	R$R3Rgt	table_keyRhRiRxRy((s*/usr/local/lib/python2.5/bsddb/dbtables.pytDropˆsP


!%
(RRRR]R\R`RaRjRzR|R~R…R€R˜RŸR¤R¥R§R R½(((s*/usr/local/lib/python2.5/bsddb/dbtables.pyR2‰s&	/					*			5			(2)	q(((&t_cvsidRRšRRR‹ttypesRRtcPickleRNt	bsddb3.dbtImportErrortbsddb.dbRt	NameErrort	Exceptiont
StandardErrorRRRR
RRRR0R#R%R&R,RŠR)R*R+R-R.R1R2(((s*/usr/local/lib/python2.5/bsddb/dbtables.pys<module>sF							

Man Man