From 3db7fd9967262aff9255056f859d8ebb520370a5 Mon Sep 17 00:00:00 2001 From: Abraham Toriz Date: Tue, 24 Oct 2023 11:40:20 -0600 Subject: [PATCH] normalize imports, since datapusher is a package --- datapusher/config.py | 10 +++++----- datapusher/jobs.py | 6 +++--- datapusher/main.py | 4 ++-- datapusher/settings.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/datapusher/config.py b/datapusher/config.py index de0686b..e7427b0 100644 --- a/datapusher/config.py +++ b/datapusher/config.py @@ -68,21 +68,21 @@ class DataPusherPlusConfig(MutableMapping): PREFER_DMY: bool = False PREVIEW_ROWS: int = 0 - + AUTO_INDEX_THRESHOLD: int = 3 AUTO_UNIQUE_INDEX:bool = True AUTO_INDEX_DATES: bool = True - + SORT_AND_DUPE_CHECK: bool = True DEDUP: bool = False DEFAULT_EXCEL_SHEET: int = 0 - + UNSAFE_PREFIX: str = "unsafe_" RESERVED_COLNAMES: str = "_id" - + ADD_SUMMARY_STATS_RESOURCE: bool = False SUMMARY_STATS_OPTIONS: str = "" - + AUTO_ALIAS: bool = True AUTO_ALIAS_UNIQUE: bool = False diff --git a/datapusher/jobs.py b/datapusher/jobs.py index 8a321fa..bf72c6a 100644 --- a/datapusher/jobs.py +++ b/datapusher/jobs.py @@ -29,7 +29,7 @@ # CKAN-related imports from ckanserviceprovider import web -from datapusher.config import config +from .config import config if locale.getdefaultlocale()[0]: @@ -372,7 +372,7 @@ def push_to_datastore(task_id, input, dry_run=False): with tempfile.TemporaryDirectory() as temp_dir: return _push_to_datastore(task_id, input, dry_run=dry_run, temp_dir=temp_dir) - + def _push_to_datastore(task_id, input, dry_run=False, temp_dir=None): handler = util.StoringHandler(task_id, input) logger = logging.getLogger(task_id) @@ -669,7 +669,7 @@ def _push_to_datastore(task_id, input, dry_run=False, temp_dir=None): # using uchardet to determine encoding file_encoding = subprocess.run( [ - "uchardet", + "uchardet", tmp.name ], check=True, diff --git a/datapusher/main.py b/datapusher/main.py index 0768047..11dffc6 100644 --- a/datapusher/main.py +++ b/datapusher/main.py @@ -1,8 +1,8 @@ import os import ckanserviceprovider.web as web -from datapusher import jobs -from config import config +import .jobs +from .config import config # check whether jobs have been imported properly assert jobs.push_to_datastore diff --git a/datapusher/settings.py b/datapusher/settings.py index d74ba74..27c9ec6 100644 --- a/datapusher/settings.py +++ b/datapusher/settings.py @@ -1 +1 @@ -from datapusher.config import * +from .config import *