diff --git a/intake/app.py b/intake/app.py index 6ec7f18..d757e3e 100644 --- a/intake/app.py +++ b/intake/app.py @@ -18,7 +18,6 @@ from flask import ( current_app, ) -from intake.core import intake_data_dir from intake.crontab import update_crontab_entries from intake.source import ( LocalSource, @@ -26,6 +25,7 @@ from intake.source import ( Item, fetch_items, update_items, + intake_data_dir, ) from intake.types import InvalidConfigException, SourceUpdateException diff --git a/intake/cli.py b/intake/cli.py index c83c758..62149e3 100644 --- a/intake/cli.py +++ b/intake/cli.py @@ -10,9 +10,14 @@ import pwd import subprocess import sys -from intake.core import intake_data_dir from intake.crontab import update_crontab_entries -from intake.source import fetch_items, LocalSource, update_items, execute_action +from intake.source import ( + fetch_items, + LocalSource, + update_items, + execute_action, + intake_data_dir, +) from intake.types import InvalidConfigException, SourceUpdateException diff --git a/intake/core.py b/intake/core.py deleted file mode 100644 index d0782b5..0000000 --- a/intake/core.py +++ /dev/null @@ -1,12 +0,0 @@ -from pathlib import Path -import os - - -def intake_data_dir() -> Path: - if intake_data := os.environ.get("INTAKE_DATA"): - return Path(intake_data) - if xdg_data_home := os.environ.get("XDG_DATA_HOME"): - return Path(xdg_data_home) / "intake" - if home := os.environ.get("HOME"): - return Path(home) / ".local" / "share" / "intake" - raise Exception("No intake data directory defined") diff --git a/intake/source.py b/intake/source.py index eec6590..c1e05d2 100644 --- a/intake/source.py +++ b/intake/source.py @@ -12,6 +12,16 @@ import sys from intake.types import InvalidConfigException, SourceUpdateException +def intake_data_dir() -> Path: + if intake_data := os.environ.get("INTAKE_DATA"): + return Path(intake_data) + if xdg_data_home := os.environ.get("XDG_DATA_HOME"): + return Path(xdg_data_home) / "intake" + if home := os.environ.get("HOME"): + return Path(home) / ".local" / "share" / "intake" + raise Exception("No intake data directory defined") + + class Item: """ A wrapper for an item object.