[Calypso-commits] [calypso] 01/07: Use 'in' instead of 'has_key'

Guido Guenther agx at moszumanska.debian.org
Thu Jun 22 13:28:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

agx pushed a commit to branch master
in repository calypso.

commit 286d74ca955deef9f52583cfe5fed8eeaa2ee6f4
Author: Guido Günther <agx at sigxcpu.org>
Date:   Sat Apr 8 20:54:55 2017 +0200

    Use 'in' instead of 'has_key'
    
    Makes the code shorter and pyflake happy
---
 calypso/webdav.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/calypso/webdav.py b/calypso/webdav.py
index cdeffe3..f472e1a 100644
--- a/calypso/webdav.py
+++ b/calypso/webdav.py
@@ -82,17 +82,16 @@ class Item(object):
             self.log.exception("Parse error in %s %s", name, path)
             raise
 
-
-        if not self.object.contents.has_key('x-calypso-name'):
+        if 'x-calypso-name' not in self.object.contents:
             if not name:
                 if self.object.name == 'VCARD' or self.object.name == 'VEVENT':
-                    if not self.object.contents.has_key('uid'):
+                    if 'uid' not in self.object.contents:
                         self.object.add('UID').value = hashlib.sha1(text).hexdigest()
                     name = self.object.uid.value
                 else:
                     for child in self.object.getChildren():
                         if child.name == 'VEVENT' or child.name == 'VCARD':
-                            if not child.contents.has_key('uid'):
+                            if 'uid' not in child.contents:
                                 child.add('UID').value = hashlib.sha1(text).hexdigest()
                             name = child.uid.value
                             break
@@ -575,7 +574,7 @@ class Collection(object):
                     for ve in events:
                         # Check for events with both dtstart and duration entries and
                         # delete the duration one
-                        if ve.contents.has_key('dtstart') and ve.contents.has_key('duration'):
+                        if 'dtstart' in ve.contents and 'duration' in ve.contents:
                             del ve.contents['duration']
                         new_ics.vevent_list = [ve]
                         new_item = Item(new_ics.serialize().decode('utf-8'), None, path, self.urlpath)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/calypso/calypso.git



More information about the Calypso-commits mailing list