Replace dict.has_key(x) with x in dict for performance gain

svn: r10874
This commit is contained in:
Gerald Britton
2008-07-17 18:10:32 +00:00
parent a6a264d1ce
commit 882199f1c2
80 changed files with 188 additions and 188 deletions

View File

@@ -132,7 +132,7 @@ def paperstyle_to_pagesetup(paper_style):
# All sizes not included in the translation table (even if a standard size)
# are handled as custom format, because we are not intelligent enough.
if gramps_to_gtk.has_key(gramps_paper_name):
if gramps_paper_name in gramps_to_gtk:
paper_size = gtk.PaperSize(gramps_to_gtk[gramps_paper_name])
log.debug("Selected paper size: %s" % gramps_to_gtk[gramps_paper_name])
else:
@@ -257,7 +257,7 @@ class PrintPreview:
##log.debug("Page number %d doesn't exist." % page_no)
##page_no = 0
##if not self._page_surfaces.has_key(page_no):
##if page_no not in self._page_surfaces:
##surface = self.create_surface()
##cr = cairo.Context(surface)

View File

@@ -100,11 +100,11 @@ class RTFDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
style = style_sheet.get_paragraph_style(style_name)
fgcolor = style.get_font().get_color()
bgcolor = style.get_background_color()
if not self.color_map.has_key(fgcolor):
if fgcolor not in self.color_map:
self.color_map[fgcolor] = index
self.f.write('\\red%d\\green%d\\blue%d;' % fgcolor)
index = index + 1
if not self.color_map.has_key(bgcolor):
if bgcolor not in self.color_map:
self.f.write('\\red%d\\green%d\\blue%d;' % bgcolor)
self.color_map[bgcolor] = index
index = index + 1