Consolidate intake.core into intake.source
No point having a submodule for one function
This commit is contained in:
parent
381de535f7
commit
e72f9aa349
|
@ -18,7 +18,6 @@ from flask import (
|
||||||
current_app,
|
current_app,
|
||||||
)
|
)
|
||||||
|
|
||||||
from intake.core import intake_data_dir
|
|
||||||
from intake.crontab import update_crontab_entries
|
from intake.crontab import update_crontab_entries
|
||||||
from intake.source import (
|
from intake.source import (
|
||||||
LocalSource,
|
LocalSource,
|
||||||
|
@ -26,6 +25,7 @@ from intake.source import (
|
||||||
Item,
|
Item,
|
||||||
fetch_items,
|
fetch_items,
|
||||||
update_items,
|
update_items,
|
||||||
|
intake_data_dir,
|
||||||
)
|
)
|
||||||
from intake.types import InvalidConfigException, SourceUpdateException
|
from intake.types import InvalidConfigException, SourceUpdateException
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,14 @@ import pwd
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from intake.core import intake_data_dir
|
|
||||||
from intake.crontab import update_crontab_entries
|
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
|
from intake.types import InvalidConfigException, SourceUpdateException
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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")
|
|
|
@ -12,6 +12,16 @@ import sys
|
||||||
from intake.types import InvalidConfigException, SourceUpdateException
|
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:
|
class Item:
|
||||||
"""
|
"""
|
||||||
A wrapper for an item object.
|
A wrapper for an item object.
|
||||||
|
|
Loading…
Reference in New Issue