From d66fcc9dcef74ab7cafee718cbb9fa78fec92d03 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sun, 9 Aug 2015 01:32:49 +0200 Subject: [PATCH 1/1] Fix various import issues --- tasklib/backends.py | 8 +++++--- tasklib/filters.py | 3 ++- tasklib/serializing.py | 1 + tasklib/task.py | 7 ++++--- tasklib/tests.py | 4 +++- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tasklib/backends.py b/tasklib/backends.py index 3b14ec0..edf9ac3 100644 --- a/tasklib/backends.py +++ b/tasklib/backends.py @@ -1,12 +1,14 @@ import abc +import datetime import json import os import re +import six import subprocess -from tasklib.task import TaskQuerySet -from tasklib.filters import TaskWarriorFilter -from tasklib.serializing import local_zone +from .task import Task, TaskQuerySet +from .filters import TaskWarriorFilter +from .serializing import local_zone DATE_FORMAT_CALC = '%Y-%m-%dT%H:%M:%S' diff --git a/tasklib/filters.py b/tasklib/filters.py index 7b44e98..0a74c3c 100644 --- a/tasklib/filters.py +++ b/tasklib/filters.py @@ -1,5 +1,6 @@ import abc -from tasklib.serializing import SerializingObject +import six +from .serializing import SerializingObject class TaskFilter(object): diff --git a/tasklib/serializing.py b/tasklib/serializing.py index e980c58..ee04d38 100644 --- a/tasklib/serializing.py +++ b/tasklib/serializing.py @@ -1,3 +1,4 @@ +import datetime import json import pytz import six diff --git a/tasklib/task.py b/tasklib/task.py index e343583..18acfe5 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -1,14 +1,14 @@ from __future__ import print_function import copy import datetime +import importlib import json import logging import os import six import sys -from backends import TaskWarrior, TaskWarriorException -from serializing import SerializingObject +from .serializing import SerializingObject DATE_FORMAT = '%Y%m%dT%H%M%SZ' REPR_OUTPUT_SIZE = 10 @@ -225,8 +225,9 @@ class Task(TaskResource): # Create the TaskWarrior instance if none passed if warrior is None: + backends = importlib.import_module('.backends') hook_parent_dir = os.path.dirname(os.path.dirname(sys.argv[0])) - warrior = TaskWarrior(data_location=hook_parent_dir) + warrior = backends.TaskWarrior(data_location=hook_parent_dir) # TaskWarrior instance is set to None task = cls(warrior) diff --git a/tasklib/tests.py b/tasklib/tests.py index af79fae..0dee2d2 100644 --- a/tasklib/tests.py +++ b/tasklib/tests.py @@ -11,7 +11,9 @@ import sys import tempfile import unittest -from .task import TaskWarrior, Task, ReadOnlyDictView, local_zone, DATE_FORMAT +from .backends import TaskWarrior +from .task import Task, ReadOnlyDictView +from .serializing import DATE_FORMAT, local_zone # http://taskwarrior.org/docs/design/task.html , Section: The Attributes TASK_STANDARD_ATTRS = ( -- 2.39.5