From f5874420a859207255b7214c9744be923ded4436 Mon Sep 17 00:00:00 2001 From: boyska Date: Tue, 24 Aug 2021 18:17:22 +0200 Subject: [PATCH] style --- ics2mdwn.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ics2mdwn.py b/ics2mdwn.py index c86ebed..4b7d336 100755 --- a/ics2mdwn.py +++ b/ics2mdwn.py @@ -70,7 +70,7 @@ class Converter: self.rooms = [] self.talks = {} self.talk_room = {} # map talk uid to room name - self.talk_location = {} # same, but see --trust-location + self.talk_location = {} # same, but see --trust-location self.changed_files = [] def _fname_to_room(self, fpath: str) -> str: @@ -95,7 +95,9 @@ class Converter: self.talk_location[uid] = room if fpath in self.args.trust_location: try: - self.talk_location[uid] = ev.decoded('location').decode('utf8') + self.talk_location[uid] = ev.decoded("location").decode( + "utf8" + ) except: pass @@ -119,20 +121,18 @@ class HugoConverter(Converter): fpath = self.args.out_md_dir / fname self.changed_files.append(fpath) frontmatter = dict( - key=uid, - title=talk.decoded("SUMMARY").decode("utf8"), - format="conference", - start=talk.decoded("DTSTART"), - end=talk.decoded("DTEND"), - location=self.talk_location[uid], - duration=int( - ( - talk.decoded("DTEND") - talk.decoded("DTSTART") - ).total_seconds() - // 60 - ), - tags=[], - ) + key=uid, + title=talk.decoded("SUMMARY").decode("utf8"), + format="conference", + start=talk.decoded("DTSTART"), + end=talk.decoded("DTEND"), + location=self.talk_location[uid], + duration=int( + (talk.decoded("DTEND") - talk.decoded("DTSTART")).total_seconds() + // 60 + ), + tags=[], + ) if "CATEGORIES" in talk: try: vobject = talk.get("CATEGORIES") @@ -143,8 +143,8 @@ class HugoConverter(Converter): frontmatter["tags"] = [str(vobject)] except Exception as exc: logging.warning("Error parsing categories: %s", str(exc)) - if 'base' in frontmatter['tags']: - frontmatter['level'] = 'beginner' + if "base" in frontmatter["tags"]: + frontmatter["level"] = "beginner" with open(str(fpath), "w") as buf: buf.write("---\n") yaml.safe_dump(frontmatter, buf)