From 65914e207360721a755798f07b89b450aa5fa31b Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Sun, 16 May 2021 12:30:49 -0600 Subject: [PATCH] [plugins] meta --> collector --- features/steps/core.py | 2 +- jrnl/args.py | 4 ++-- jrnl/commands.py | 4 ++-- jrnl/jrnl.py | 10 +++++----- jrnl/plugins/{meta.py => collector.py} | 6 ++++-- 5 files changed, 14 insertions(+), 12 deletions(-) rename jrnl/plugins/{meta.py => collector.py} (93%) diff --git a/features/steps/core.py b/features/steps/core.py index ce27ca8f..6609e2b1 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -462,7 +462,7 @@ def load_template(context, filename): full_path = os.path.join("features/data/templates", filename) exporter = plugins.template_exporter.__exporter_from_file(full_path) - plugins.meta.__exporter_types[exporter.names[0]] = exporter + plugins.collector.__exporter_types[exporter.names[0]] = exporter @when('we set the keyring password of "{journal}" to "{password}"') diff --git a/jrnl/args.py b/jrnl/args.py index 52656ad5..9fc44c1f 100644 --- a/jrnl/args.py +++ b/jrnl/args.py @@ -13,8 +13,8 @@ from .commands import preconfig_diagnostic from .commands import preconfig_version from .output import deprecated_cmd from .plugins import util -from .plugins.meta import EXPORT_FORMATS -from .plugins.meta import IMPORT_FORMATS +from .plugins.collector import EXPORT_FORMATS +from .plugins.collector import IMPORT_FORMATS class WrappingFormatter(argparse.RawTextHelpFormatter): diff --git a/jrnl/commands.py b/jrnl/commands.py index f0bb02ca..8da64499 100644 --- a/jrnl/commands.py +++ b/jrnl/commands.py @@ -28,7 +28,7 @@ def preconfig_diagnostic(_): def preconfig_version(_): from jrnl import __title__ from jrnl import __version__ - from jrnl.plugins.meta import ( + from jrnl.plugins.collector import ( IMPORT_FORMATS, EXPORT_FORMATS, get_exporter, @@ -69,7 +69,7 @@ def postconfig_list(config, **kwargs): def postconfig_import(args, config, **kwargs): from .Journal import open_journal - from .plugins.meta import get_importer + from .plugins.collector import get_importer # Requires opening the journal journal = open_journal(args.journal_name, config) diff --git a/jrnl/jrnl.py b/jrnl/jrnl.py index a344e30a..7b5d17ea 100644 --- a/jrnl/jrnl.py +++ b/jrnl/jrnl.py @@ -324,17 +324,17 @@ def _delete_search_results(journal, old_entries, **kwargs): def _display_search_results(args, journal, **kwargs): if args.short or args.export == "short": - print(plugins.meta.get_exporter("short").export(journal)) + print(plugins.collector.get_exporter("short").export(journal)) elif args.tags: - print(plugins.meta.get_exporter("tags").export(journal)) + print(plugins.collector.get_exporter("tags").export(journal)) elif args.export: - exporter = plugins.meta.get_exporter(args.export) + exporter = plugins.collector.get_exporter(args.export) print(exporter.export(journal, args.filename)) elif kwargs["config"].get("display_format"): - exporter = plugins.meta.get_exporter(kwargs["config"]["display_format"]) + exporter = plugins.collector.get_exporter(kwargs["config"]["display_format"]) print(exporter.export(journal, args.filename)) else: # print(journal.pprint()) - print(plugins.meta.get_exporter("default").export(journal)) + print(plugins.collector.get_exporter("default").export(journal)) diff --git a/jrnl/plugins/meta.py b/jrnl/plugins/collector.py similarity index 93% rename from jrnl/plugins/meta.py rename to jrnl/plugins/collector.py index abb88415..f42c25e2 100644 --- a/jrnl/plugins/meta.py +++ b/jrnl/plugins/collector.py @@ -4,8 +4,7 @@ # License: https://www.gnu.org/licenses/gpl-3.0.html """ -This file ("meta") uses that title in the reflexive sense; i.e. it is the -collection of code that allows plugins to deal with themselves. +Code relating to the collecting of plugins and distributing calls to them. In particular, the code here collects the list of imports and exporters, both internal and external, and tells the main program which plugins are available. @@ -14,6 +13,9 @@ functions are importable/callable at predetermined (code) locations. Internal plugins are located in the `jrnl.plugins` namespace, and external plugins are located in the `jrnl.contrib` namespace. + +This file was originally called "meta", using that title in the reflexive sense; +i.e. it is the collection of code that allows plugins to deal with themselves. """ import importlib