diff options
author | Guido van Rossum <guido@python.org> | 2006-08-21 00:21:47 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-08-21 00:21:47 +0000 |
commit | 2043513bd584a08cc7d748562bd8011b989b3659 (patch) | |
tree | a2f33ad9469d3aa1bfb32fa6e003f7e24dc6af7e /Lib/bsddb/dbtables.py | |
parent | Get rid of a bunch more has_key() uses. We *really* need a tool for this. (diff) | |
download | cpython-2043513bd584a08cc7d748562bd8011b989b3659.tar.gz cpython-2043513bd584a08cc7d748562bd8011b989b3659.tar.bz2 cpython-2043513bd584a08cc7d748562bd8011b989b3659.zip |
Fixed to the point that all unit tests pass again. (However, I get 4
"exception in thread" messages, one about a killed locker, and three
assertions.) Details:
test/test_dbshelve.py:
- kill reference to InstanceType
test/test_basics.py:
- use // for int division
- use 'in' instead of has_key
dbshelve.py:
- fix bug in previous has_key fix, use self.db.has_key instead of self.has_key
dbtables.py:
- use 'in' instead of has_key
dbutils.py:
- fix bug in previous has_key fix, test for 'max_retries', not 'max_tries'
Diffstat (limited to 'Lib/bsddb/dbtables.py')
-rw-r--r-- | Lib/bsddb/dbtables.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py index 492d5fdfac2..655fb96120a 100644 --- a/Lib/bsddb/dbtables.py +++ b/Lib/bsddb/dbtables.py @@ -323,7 +323,7 @@ class bsdTableDB : # column names newcolumnlist = copy.copy(oldcolumnlist) for c in columns: - if not oldcolumnhash.has_key(c): + if c not in oldcolumnhash: newcolumnlist.append(c) # store the table's new extended column list @@ -389,7 +389,7 @@ class bsdTableDB : raise TableDBError, "unknown table" # check the validity of each column name - if not self.__tablecolumns.has_key(table): + if table not in self.__tablecolumns: self.__load_column_info(table) for column in rowdict.keys() : if not self.__tablecolumns[table].count(column): @@ -521,7 +521,7 @@ class bsdTableDB : argument and returning a boolean. """ try: - if not self.__tablecolumns.has_key(table): + if table not in self.__tablecolumns: self.__load_column_info(table) if columns is None: columns = self.__tablecolumns[table] @@ -542,7 +542,7 @@ class bsdTableDB : argument and returning a boolean. """ # check the validity of each column name - if not self.__tablecolumns.has_key(table): + if table not in self.__tablecolumns: self.__load_column_info(table) if columns is None: columns = self.tablecolumns[table] @@ -601,16 +601,16 @@ class bsdTableDB : # extract the rowid from the key rowid = key[-_rowid_str_len:] - if not rejected_rowids.has_key(rowid): + if rowid not in rejected_rowids: # if no condition was specified or the condition # succeeds, add row to our match list. if not condition or condition(data): - if not matching_rowids.has_key(rowid): + if rowid not in matching_rowids: matching_rowids[rowid] = {} if savethiscolumndata: matching_rowids[rowid][column] = data else: - if matching_rowids.has_key(rowid): + if rowid in matching_rowids: del matching_rowids[rowid] rejected_rowids[rowid] = rowid @@ -631,7 +631,7 @@ class bsdTableDB : if len(columns) > 0: for rowid, rowdata in matching_rowids.items(): for column in columns: - if rowdata.has_key(column): + if column in rowdata: continue try: rowdata[column] = self.db.get( @@ -697,7 +697,7 @@ class bsdTableDB : txn.commit() txn = None - if self.__tablecolumns.has_key(table): + if table in self.__tablecolumns: del self.__tablecolumns[table] except DBError, dberror: |