Mercurial > p > roundup > code
diff test/memorydb.py @ 5381:0942fe89e82e
Python 3 preparation: change "x.has_key(y)" to "y in x".
(Also likewise "not in" where appropriate.) Tool-generated patch.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 22:08:17 +0000 |
| parents | 35ea9b1efc14 |
| children | e9fb7c539a52 |
line wrap: on
line diff
--- a/test/memorydb.py Tue Jul 24 21:43:32 2018 +0000 +++ b/test/memorydb.py Tue Jul 24 22:08:17 2018 +0000 @@ -265,13 +265,13 @@ # def __getattr__(self, classname): """A convenient way of calling self.getclass(classname).""" - if self.classes.has_key(classname): + if classname in self.classes: return self.classes[classname] raise AttributeError(classname) def addclass(self, cl): cn = cl.classname - if self.classes.has_key(cn): + if cn in self.classes: raise ValueError(cn) self.classes[cn] = cl if cn not in self.items: @@ -392,9 +392,9 @@ class FileClass(back_anydbm.FileClass): def __init__(self, db, classname, **properties): - if not properties.has_key('content'): + if 'content' not in properties: properties['content'] = hyperdb.String(indexme='yes') - if not properties.has_key('type'): + if 'type' not in properties: properties['type'] = hyperdb.String() back_anydbm.Class.__init__(self, db, classname, **properties) @@ -412,7 +412,7 @@ f.close() mime_type = None props = self.getprops() - if props.has_key('type'): + if 'type' in props: mime_type = self.get(nodeid, 'type') if not mime_type: mime_type = self.default_mime_type @@ -429,17 +429,17 @@ dictionary attempts to specify any of these properties or a "creation" or "activity" property, a ValueError is raised. """ - if not properties.has_key('title'): + if 'title' not in properties: properties['title'] = hyperdb.String(indexme='yes') - if not properties.has_key('messages'): + if 'messages' not in properties: properties['messages'] = hyperdb.Multilink("msg") - if not properties.has_key('files'): + if 'files' not in properties: properties['files'] = hyperdb.Multilink("file") - if not properties.has_key('nosy'): + if 'nosy' not in properties: # note: journalling is turned off as it really just wastes # space. this behaviour may be overridden in an instance properties['nosy'] = hyperdb.Multilink("user", do_journal="no") - if not properties.has_key('superseder'): + if 'superseder' not in properties: properties['superseder'] = hyperdb.Multilink(classname) Class.__init__(self, db, classname, **properties)
