From f0caf3592573663c4a15aa62325f9504863e6ac9 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 22 Dec 2022 21:10:42 +0100 Subject: [PATCH] Refactor plugin to remove carrying config around --- extract/extract.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extract/extract.py b/extract/extract.py index bcf3dcb..5a3704f 100644 --- a/extract/extract.py +++ b/extract/extract.py @@ -29,7 +29,7 @@ class ExtractPlugin(PapersPlugin): def __init__(self, conf, ui): self.ui = ui - self.conf = conf + self.note_extension = conf["main"]["note_extension"] self.repository = repo.Repository(conf) self.pubsdir = os.path.expanduser(conf["main"]["pubsdir"]) self.broker = self.repository.databroker @@ -74,7 +74,7 @@ class ExtractPlugin(PapersPlugin): return all_annotations = self.extract(citekeys) if args.write: - self._to_notes(all_annotations, conf["main"]["note_extension"], args.edit) + self._to_notes(all_annotations, self.note_extension, args.edit) else: self._to_stdout(all_annotations) self.repository.close() @@ -210,5 +210,5 @@ def modify_event(event): if plg.onimport: all_annotations = plg.extract([event.citekey]) if all_annotations[0][1]: - plg._to_notes(all_annotations, plg.conf["main"]["note_extension"]) + plg._to_notes(all_annotations, plg.note_extension) plg.ui.info(f"Imported {event.citekey} annotations.")