[Blends-commit] [SCM] website branch, master, updated. dfc07f392e21ae03ffb4409694713f5bb765038e

Ole Streicher olebole at debian.org
Mon Mar 7 21:03:38 UTC 2016


The following commit has been merged in the master branch:
commit df2cd9afa84d003d298fd5a3ccbd98316880779e
Author: Ole Streicher <olebole at debian.org>
Date:   Mon Mar 7 21:55:43 2016 +0100

    Replace dict.has_key(x) with 'x in dict' and similar

diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index 8d5a5de..4cd833b 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -545,24 +545,24 @@ def ReadConfig(blendname=''):
                                                     # for instance at www.debian.org or wiki.debian.org
         ret['aliothurl']   = stanza['aliothurl']    # Link to the Alioth page of the project
         ret['projectlist'] = stanza['projectlist']  # Mailinglist of the project
-        if stanza.has_key('pkglist'):
+        if 'pkglist' in stanza:
     	    ret['pkglist'] = stanza['pkglist']      # Packaging Mailinglist = Maintainer of group maintained packages
-        if stanza.has_key('logourl'):
+        if 'logourl' in stanza:
             ret['logourl'] = stanza['logourl']      # URL to logo image (might be missing
         ret['css']         = stanza['css']          # (relative) URL to CSS file
         ret['outputdir']   = stanza['outputdir']    # Dir for storing output HTML files
         ret['datadir']     = stanza['datadir']      # Dir for storing SVN information about project
         ret['vcsdir']      = stanza['vcsdir']       # Path to Blend information files at svn.debian.org
-        if stanza.has_key('advertising'):
+        if 'advertising' in stanza:
             # we have to remove the gettext _() call which was inserted into the config
             # file to enable easy input for config file editors - but the call has to
             # be made explicitely in the python code
             advertising = re.sub('_\(\W(.+)\W\)', '\\1', stanza['advertising'])
             # gettext needs to escape '"' thus we need to remove the escape character '\'
             ret['advertising'] = re.sub('\\\\"', '"', advertising)
-        if stanza.has_key('ubuntuhome'):
+        if 'ubuntuhome' in stanza:
             ret['ubuntuhome'] = stanza['ubuntuhome']
-        if stanza.has_key('projectubuntu'):
+        if 'projectubuntu' in stanza:
             ret['projectubuntu'] = stanza['projectubuntu']
 
     return ret
@@ -827,9 +827,9 @@ class DependantPackage:
                         else:
                             logger.debug("Author string changed in %s: '%s' -> '%s'", self.pkg, row[pub], authors_string)
                             row[pub] = authors_string
-                if not self.properties.has_key('published'):
+                if 'published' not in self.properties:
                     self.properties['published'] = {}
-                if self.properties['published'].has_key(pub):
+                if pub in self.properties['published']:
                     if self.properties['published'][pub] == row[pub]:
                         rmpub.write("%s: %s: Published-%s: %s" % (self.taskname, self.pkg, pub, row[pub]))
             		logger.info("%s/%s: Publication-%s = %s can be removed"  % (self.taskname, self.pkg, pub, row[pub]))
@@ -923,7 +923,7 @@ class Tasks:
             td = TaskDependencies(self.blendname, task=task, tasksdir=self.tasksdir)
             pkgname = prefix + task
             translations = None
-            if metapkg_translations.has_key(pkgname):
+            if pkgname in metapkg_translations:
                 translations = metapkg_translations[pkgname]
             td.SetMetapackageInfo(pkgname, translations)
             if td.GetTaskDependencies(source):
@@ -968,7 +968,7 @@ class Tasks:
             for dep in use_dependencystatus:
                 for tdep in tdeps.dependencies[dep]:
             	    if tdep.outdated != {}:
-                        if tdep.properties.has_key('last_uploader_simple'):
+                        if 'last_uploader_simple' in tdep.properties:
                             last_uploader = tdep.properties['last_uploader_simple']
                         else:
                             last_uploader = None
@@ -1372,7 +1372,7 @@ class TaskDependencies:
                         # There is no need to specify the Vcs-{Git,SVN} field in the tasks file but property 'vcs-type' should be set in
                         # any case - so set it here in case it was not set before.  If an apropriate field is set later it becomes
                         # overriden anyway
-                        if not dep.properties.has_key('vcs-url'):
+                        if 'vcs-url' not in dep.properties:
                             dep.properties['vcs-url'] = dep.properties['vcs-browser']
                     else:
                         logger.error("Dep not initiated before Vcs-Browser %s -> something is wrong." \
@@ -1387,7 +1387,7 @@ class TaskDependencies:
                               % (key, stanza[key.lower()]))
                 elif key == 'License':
                     if dep != None:
-                        if dep.vcs_found == 1 and dep.properties.has_key(key.lower()):
+                        if dep.vcs_found == 1 and key.lower() in dep.properties:
                             fields_obsolete.append(key)
                             continue
                         dep.properties[key.lower()]  = stanza[key.lower()]
@@ -1408,7 +1408,7 @@ class TaskDependencies:
                               % (key, stanza[key.lower()]))
                 elif key.startswith('Published-'):
                     if dep != None:
-                        if not dep.properties.has_key('published'):
+                        if 'published' not in dep.properties:
                             dep.properties['published'] = {}
                         ptype = key.replace('Published-','').lower()
                         dep.properties['published'][ptype] = stanza[key.lower()]
@@ -1417,7 +1417,7 @@ class TaskDependencies:
                               % (key, stanza[key.lower()]))
                 elif key == 'WNPP':
                     if dep != None:
-                        if dep.vcs_found == 1 and dep.properties.has_key(key.lower()):
+                        if dep.vcs_found == 1 and key.lower() in dep.properties:
                             fields_obsolete.append(key)
                             continue
                         wnpp = stanza['wnpp'].strip()
@@ -1480,7 +1480,7 @@ class TaskDependencies:
                 # first check those packages where some work was just done
                 for status in ['pkgvcs', 'unofficial', 'wnpp', 'prospective']:
                     for field in pkgstatus[status]['fields-set']:
-                        if dep.properties.has_key(field):
+                        if field in dep.properties:
                             if field in HOMEPAGENONEFIELDS and dep.properties[field] == HOMEPAGENONE :
                                 continue
                             dep.pkgstatus = status
@@ -1589,7 +1589,7 @@ class TaskDependencies:
                     taglist = []
                     for debtag in row['debtags']:
                         (tag,value) = debtag.split('::')
-                        if tagdict.has_key(tag):
+                        if tag in tagdict:
                             tagdict[tag] += ', ' + value
                         else:
                             tagdict[tag]  = value
@@ -1636,7 +1636,7 @@ class TaskDependencies:
                         dep.desc[l]['short'] = MarkupString(row['description_'+l], dep.pkg, 'ShortDesc')
                         if row['long_description_'+l]:
                             dep.desc[l]['long']  = Markup(render_longdesc(row['long_description_'+l].splitlines()))
-                if not dep.desc['en'].has_key('short'):
+                if 'short' not in dep.desc['en']:
                     logger.error("Dep has no English short description: %s", dep.pkg)
                     dep.desc['en']['short'] = "??? missing short description for package %s :-(" % dep.pkg
                 (_name, _url) = email.Utils.parseaddr(row['maintainer'])
@@ -1808,7 +1808,7 @@ class TaskDependencies:
                             logger.error("Package %s neither in pool nor new and has no description - ignored" % dep.pkg)
                 else:
                     # prevent printing WNPP of packages inside Debian
-                    if dep.properties.has_key('wnpp') and dep.pkgstatus != 'wnpp':
+                    if 'wnpp' in dep.properties and dep.pkgstatus != 'wnpp':
                         del dep.properties['wnpp']
 
         for dependency in self.dependencies.keys():
@@ -1847,7 +1847,7 @@ class TaskDependencies:
             self.pkgstatus = 'experimental'
 
 
-        if self.properties.has_key('source'):
+        if 'source' in self.properties:
             query = "EXECUTE src_vcs ('%s')" % (self.properties['source'])
             _execute_udd_query(query)
             if curs.rowcount > 0:
@@ -1858,13 +1858,13 @@ class TaskDependencies:
                 for prop in row.keys():
                     if row[prop]:
                         self.properties[prop] = row[prop]
-                if not self.properties.has_key('vcs-browser') or self.properties['vcs-browser'] == HOMEPAGENONE:
+                if self.properties.get('vcs-browser', HOMEPAGENONE) == HOMEPAGENONE:
                     try:
                         self.properties['vcs-browser'] = BrowserFromVcsURL(self.properties['vcs-type'], self.properties['vcs-url'])
                     except KeyError, err:
                         logger.warning("Vcs Property missing in Database:", self.properties, err)
-                if not self.properties.has_key('vcs-type') or not self.properties['vcs-type']:
-                    if self.properties.has_key('vcs-browser') and self.properties['vcs-browser'] != HOMEPAGENONE:
+                if not self.properties.get('vcs-type'):
+                    if self.properties.get('vcs-browser', HOMEPAGENONE) != HOMEPAGENONE:
                         self.properties['vcs-type']    = VcsTypeFromBrowserURL(self.properties['vcs-browser'])
             # We are only interested in source packages (for instance for Bugs page)
             if source == 1:
diff --git a/webtools/bugs.py b/webtools/bugs.py
index 33b05fe..af89f36 100755
--- a/webtools/bugs.py
+++ b/webtools/bugs.py
@@ -186,7 +186,7 @@ def main():
     bugs = {}
     if curs.rowcount > 0:
         for bug in RowDictionaries(curs):
-            if not bugs.has_key(bug['source']):
+            if bug['source'] not in bugs:
                 bugs[bug['source']] = {}
                 bugs[bug['source']]['severities'] = {}
                 for s in SEVERITIES:
@@ -290,7 +290,7 @@ def main():
     data={}
     data['projectname'] = blendname
     data['bugs_data']   = bugs_data
-    if config.has_key('advertising') and config['advertising'] != None:
+    if config.get('advertising') is not None:
         # we have to remove the gettext _() call which was inserted into the config
         # file to enable easy input for config file editors - but the call has to
         # be made explicitely in the python code
@@ -372,7 +372,7 @@ the right shows the tasks of %s.""" ) \
             for task in bugs_data:
                 print >>f, "*** %s ***" % task
                 for status in STATES:
-                    if bugs_data[task].has_key(status):
+                    if status in bugs_data[task]:
                         print >>f, status
                         print >>f, json.dumps(bugs_data[task][status])
                 print >>f
diff --git a/webtools/thermometer.py b/webtools/thermometer.py
index 5ad16f1..5a3ed73 100755
--- a/webtools/thermometer.py
+++ b/webtools/thermometer.py
@@ -361,7 +361,7 @@ def main():
     data={}
     data['projectname'] = blendname
     data['blend_data']  = blend_data
-    if config.has_key('advertising') and config['advertising'] != None:
+    if config.get('advertising') != None:
         # we have to remove the gettext _() call which was inserted into the config
         # file to enable easy input for config file editors - but the call has to
         # be made explicitely in the python code

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list