changeset 139:23fc7cd1cd53

Py3 cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 28 Feb 2022 18:17:20 +0200
parents d3135eff1bab
children 65d4da73e558
files multimerge.py
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/multimerge.py	Sat Jan 22 23:58:22 2022 +0200
+++ b/multimerge.py	Mon Feb 28 18:17:20 2022 +0200
@@ -149,7 +149,7 @@
             ev_start = event["start"].get("dateTime", event["start"].get("date")) if "start" in event else "?"
             ev_end = event["end"].get("dateTime", event["end"].get("date")) if "end" in event else "?"
             summary = event["summary"] if "summary" in event else "?"
-            status = "*" if event["status"] != u"cancelled" else "!"
+            status = "*" if event["status"] != "cancelled" else "!"
             gcm_print("[{0}] {1:25} - {2:25} : {3} [{4}] [{5}]".format(status, ev_start, ev_end, summary, event["iCalUID"], event["id"]))
 
 
@@ -341,7 +341,7 @@
         if not self.is_str(mvalue):
             return False
         else:
-            return mvalue.lower() in [u"off", "sendmail", "smtp"]
+            return mvalue.lower() in ["off", "sendmail", "smtp"]
 
     def trans_email_state(self, mvalue):
         return mvalue.lower()
@@ -542,7 +542,7 @@
 src_calendars = []
 dst_calendar = None
 for calendar in calendars:
-    if u"summary" in calendar:
+    if "summary" in calendar:
         # Find destination calendar ID if not set
         if not cfg.dst_id and dst_re.match(calendar["summary"]):
             cfg.mset("dst_id", calendar["id"])
@@ -552,7 +552,7 @@
 
         # If summary or summaryOverride match the regexp, add calendar
         mre = src_re.match(calendar["summary"])
-        if not mre and u"summaryOverride" in calendar:
+        if not mre and "summaryOverride" in calendar:
             mre = src_re.match(calendar["summaryOverride"])
             calendar["summary"] = calendar["summaryOverride"]
 
@@ -599,18 +599,18 @@
     if events:
         for event in events:
             # Set summary and color for existing events
-            if event["status"] != u"cancelled":
+            if event["status"] != "cancelled":
                 if c_found != None:
                     event["colorId"] = c_found
                 if "summary" in event:
-                    event["summary"] = u"[{1}] {0}".format(event["summary"], calendar["gcm_id"])
+                    event["summary"] = "[{1}] {0}".format(event["summary"], calendar["gcm_id"])
                 else:
-                    event["summary"] = u"[?] {0}".format(calendar["gcm_id"])
+                    event["summary"] = "[?] {0}".format(calendar["gcm_id"])
 
         # Add to list of source events
         src_events.extend(events)
         if gcm_check_debug(4):
-            gcm_dump_events(events, (lambda ev: ev["status"] != u"cancelled"))
+            gcm_dump_events(events, (lambda ev: ev["status"] != "cancelled"))
 
 
 ## Fetch current events from the target
@@ -647,7 +647,7 @@
         else:
             evn_unchanged += 1
             gcm_debug(4, "No need to update event {0} [{1}]".format(event["id"], event["gcm_id"]))
-    elif event["status"] not in [u"cancelled", "confirmed"]:
+    elif event["status"] not in ["cancelled", "confirmed"]:
         # Event does not seem to exist. Insert new event.
         gcm_debug(4, "Inserting new event {0} [{1}]".format(event["id"], event["gcm_id"]))
         # Remove original id field, otherwise it will clash
@@ -667,7 +667,7 @@
 evn_purged = 0
 for event in dst_events:
     gcm_debug(4, "Checking event {0}".format(event["gcm_id"]))
-    if not event["gcm_id"] in src_ids and event["status"] != u"cancelled":
+    if not event["gcm_id"] in src_ids and event["status"] != "cancelled":
         gcm_debug(4, "Deleting event {0} [{1}]".format(event["id"], event["gcm_id"]))
         evn_purged += 1
         try: