Commit 3a52e9dc authored by Bram Schoenmakers's avatar Bram Schoenmakers

Sorted import statements

parent 751105ea
[settings]
skip=topydo/ui/CLIApplicationBase.py
import codecs
import os
import re
import codecs
from setuptools import setup, find_packages
from setuptools import find_packages, setup
_HERE = os.path.abspath(os.path.dirname(__file__))
......
......@@ -16,6 +16,7 @@
import os
from test.topydo_testcase import TopydoTest
from topydo.lib.Utils import escape_ansi
......
......@@ -17,8 +17,8 @@
import unittest
from datetime import date
from io import StringIO
from test.command_testcase import CommandTest
from topydo.commands import AddCommand, ListCommand
from topydo.lib import TodoList
from topydo.lib.Config import config
......
......@@ -16,8 +16,8 @@
import unittest
from datetime import date
from test.command_testcase import CommandTest
from topydo.commands.AppendCommand import AppendCommand
from topydo.lib.TodoList import TodoList
......
......@@ -15,9 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.command_testcase import CommandTest
from test.facilities import load_file_to_todolist
from topydo.commands.ArchiveCommand import ArchiveCommand
from topydo.lib.TodoList import TodoList
......
......@@ -17,13 +17,12 @@
""" Tests for the colorscheme functionality. """
import unittest
from test.topydo_testcase import TopydoTest
from topydo.lib.Color import Color
from topydo.lib.Config import config
from topydo.lib.Todo import Todo
NEUTRAL_COLOR = '\033[0m'
......
......@@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.topydo_testcase import TopydoTest
from topydo.lib.Config import config
......
......@@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.command_testcase import CommandTest
from topydo.commands.DeleteCommand import DeleteCommand
from topydo.lib.Config import config
from topydo.lib.TodoList import TodoList
......
......@@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.command_testcase import CommandTest
from topydo.commands.DepCommand import DepCommand
from topydo.lib.TodoList import TodoList
......
......@@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.command_testcase import CommandTest
from topydo.commands.DepriCommand import DepriCommand
from topydo.lib.TodoList import TodoList
......
......@@ -16,8 +16,8 @@
import unittest
from datetime import date, timedelta
from test.command_testcase import CommandTest
from topydo.commands.DoCommand import DoCommand
from topydo.lib.TodoList import TodoList
......
......@@ -16,8 +16,8 @@
import os
import unittest
from test.command_testcase import CommandTest
from topydo.commands.EditCommand import EditCommand
from topydo.lib.Config import config
from topydo.lib.Todo import Todo
......
......@@ -18,10 +18,10 @@
import unittest
from datetime import date, timedelta
from test.facilities import (load_file, load_file_to_todolist,
todolist_to_string)
from test.topydo_testcase import TopydoTest
from topydo.lib import Filter
from topydo.lib.Todo import Todo
......
......@@ -15,14 +15,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.topydo_testcase import TopydoTest
from topydo.Commands import get_subcommand
from topydo.commands.AddCommand import AddCommand
from topydo.commands.DeleteCommand import DeleteCommand
from topydo.commands.ListCommand import ListCommand
from topydo.commands.TagCommand import TagCommand
from topydo.lib.Config import config, ConfigError
from topydo.lib.Config import ConfigError, config
class GetSubcommandTest(TopydoTest):
def test_normal_cmd(self):
......
......@@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.topydo_testcase import TopydoTest
from topydo.lib.Graph import DirectedGraph
......
......@@ -16,9 +16,10 @@
import unittest
from datetime import date
from test.topydo_testcase import TopydoTest
from freezegun import freeze_time
from test.topydo_testcase import TopydoTest
from topydo.lib.Config import config
from topydo.lib.Importance import importance
from topydo.lib.Todo import Todo
......
......@@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.topydo_testcase import TopydoTest
from topydo.lib.printers.Json import JsonPrinter
from topydo.lib.Todo import Todo
......
......@@ -15,15 +15,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import codecs
import re
import os
import re
import sys
import unittest
from collections import namedtuple
from freezegun import freeze_time
from test.command_testcase import CommandTest
from test.facilities import load_file_to_todolist
from freezegun import freeze_time
from topydo.commands.ListCommand import ListCommand
from topydo.lib.Config import config
from topydo.lib.TodoList import TodoList
......
......@@ -15,9 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.command_testcase import CommandTest
from test.facilities import load_file_to_todolist
from topydo.commands.ListContextCommand import ListContextCommand
......
......@@ -15,12 +15,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from collections import namedtuple
from freezegun import freeze_time
from test.command_testcase import CommandTest
from test.facilities import load_file_to_todolist
from freezegun import freeze_time
from topydo.commands.ListCommand import ListCommand
from topydo.lib.Config import config
from topydo.lib.TodoListBase import TodoListBase
......
......@@ -15,9 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.command_testcase import CommandTest
from test.facilities import load_file_to_todolist
from topydo.commands.ListProjectCommand import ListProjectCommand
......
......@@ -16,8 +16,8 @@
import unittest
from datetime import date, timedelta
from test.command_testcase import CommandTest
from topydo.commands.PostponeCommand import PostponeCommand
from topydo.lib.TodoList import TodoList
......
......@@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.command_testcase import CommandTest
from topydo.commands.PriorityCommand import PriorityCommand
from topydo.lib.TodoList import TodoList
......
......@@ -14,15 +14,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from freezegun import freeze_time
import unittest
from test.topydo_testcase import TopydoTest
from freezegun import freeze_time
from topydo.lib.Config import config
from topydo.lib.ProgressColor import progress_color
from topydo.lib.Todo import Todo
from topydo.lib.TodoList import TodoList
def set_256_colors():
config(p_overrides={('topydo', 'colors'): '256'})
......
......@@ -16,8 +16,8 @@
import unittest
from datetime import date, timedelta
from test.topydo_testcase import TopydoTest
from topydo.lib.Config import config
from topydo.lib.Recurrence import NoRecurrenceException, advance_recurring_todo
from topydo.lib.Todo import Todo
......
......@@ -16,9 +16,10 @@
import unittest
from datetime import date
from test.topydo_testcase import TopydoTest
from freezegun import freeze_time
from test.topydo_testcase import TopydoTest
from topydo.lib.RelativeDate import relative_date_to_date
......
......@@ -17,12 +17,11 @@
import os
import tempfile
import unittest
from datetime import date
from glob import glob
from test.command_testcase import CommandTest
from uuid import uuid4
from test.command_testcase import CommandTest
from topydo.commands.AddCommand import AddCommand
from topydo.commands.ArchiveCommand import ArchiveCommand
from topydo.commands.DeleteCommand import DeleteCommand
......@@ -33,6 +32,7 @@ from topydo.lib.Config import config
from topydo.lib.TodoFile import TodoFile
from topydo.lib.TodoList import TodoList
class RevertCommandTest(CommandTest):
def setUp(self):
super().setUp()
......
......@@ -15,9 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.command_testcase import CommandTest
from test.facilities import load_file_to_todolist
from topydo.commands.SortCommand import SortCommand
from topydo.lib.Config import config
......
......@@ -14,12 +14,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from freezegun import freeze_time
import unittest
from test.facilities import (load_file, load_file_to_todolist, print_view,
todolist_to_string)
from test.topydo_testcase import TopydoTest
from freezegun import freeze_time
from topydo.lib.Config import config
from topydo.lib.Sorter import Sorter
......
......@@ -14,10 +14,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from freezegun import freeze_time
import unittest
from test.command_testcase import CommandTest
from freezegun import freeze_time
from topydo.commands.TagCommand import TagCommand
from topydo.lib.TodoList import TodoList
......
......@@ -16,8 +16,8 @@
import unittest
from datetime import date, timedelta
from test.topydo_testcase import TopydoTest
from topydo.lib.Todo import Todo
......
......@@ -19,8 +19,8 @@
import re
import unittest
from datetime import date, timedelta
from test.topydo_testcase import TopydoTest
from topydo.lib.TodoBase import TodoBase
......
......@@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.facilities import load_file
from test.topydo_testcase import TopydoTest
......
......@@ -18,8 +18,8 @@
import re
import unittest
from test.topydo_testcase import TopydoTest
from topydo.lib.Config import config
from topydo.lib.Todo import Todo
from topydo.lib.TodoFile import TodoFile
......
......@@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.topydo_testcase import TopydoTest
from topydo.lib.Utils import translate_key_to_config
......
......@@ -15,9 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from test.facilities import load_file, print_view, todolist_to_string
from test.topydo_testcase import TopydoTest
from topydo.lib import Filter
from topydo.lib.Sorter import Sorter
from topydo.lib.TodoFile import TodoFile
......
......@@ -21,7 +21,7 @@ instance based on an argument list.
import sys
from topydo.lib.Config import config, ConfigError
from topydo.lib.Config import ConfigError, config
SUBCOMMAND_MAP = {
'add': 'AddCommand',
......
......@@ -22,9 +22,9 @@ from datetime import date
from os.path import expanduser
from sys import stdin
from topydo.lib.WriteCommand import WriteCommand
from topydo.lib.Config import config
from topydo.lib.prettyprinters.Numbers import PrettyPrinterNumbers
from topydo.lib.WriteCommand import WriteCommand
class AddCommand(WriteCommand):
......
......@@ -14,12 +14,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from topydo.lib.Config import config
from topydo.lib.Command import InvalidCommandArgument
from topydo.lib.WriteCommand import WriteCommand
from topydo.lib.Config import config
from topydo.lib.prettyprinters.Numbers import PrettyPrinterNumbers
from topydo.lib.TodoListBase import InvalidTodoException
from topydo.lib.TodoParser import parse_line
from topydo.lib.WriteCommand import WriteCommand
class AppendCommand(WriteCommand):
def __init__(self, p_args, p_todolist, #pragma: no branch
......
......@@ -14,10 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import codecs
import tempfile
import os
import shlex
import tempfile
from subprocess import CalledProcessError, check_call
from topydo.lib.Config import config
......@@ -25,6 +25,7 @@ from topydo.lib.MultiCommand import MultiCommand
from topydo.lib.prettyprinters.Numbers import PrettyPrinterNumbers
from topydo.lib.Todo import Todo
def _get_file_mtime(p_file):
return os.stat(p_file.name).st_mtime
......
......@@ -14,18 +14,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import re
import sys
import os
from topydo.lib.Config import config
from topydo.lib.ExpressionCommand import ExpressionCommand
from topydo.lib.Filter import HiddenTagFilter, InstanceFilter
from topydo.lib.ListFormat import ListFormatError
from topydo.lib.printers.PrettyPrinter import pretty_printer_factory
from topydo.lib.prettyprinters.Format import PrettyPrinterFormatFilter
from topydo.lib.TodoListBase import InvalidTodoException
from topydo.lib.printers.PrettyPrinter import pretty_printer_factory
from topydo.lib.Sorter import Sorter
from topydo.lib.TodoListBase import InvalidTodoException
from topydo.lib.Utils import get_terminal_size
from topydo.lib.View import View
......
......@@ -14,12 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from topydo.lib.Command import Command
from topydo.lib import TodoFile, TodoList
from topydo.lib.ChangeSet import ChangeSet
from topydo.lib import TodoFile
from topydo.lib import TodoList
from topydo.lib.Command import Command
from topydo.lib.Config import config
class RevertCommand(Command):
def __init__(self, p_args, p_todolist, #pragma: no branch
p_out=lambda a: None,
......
......@@ -19,7 +19,6 @@
import json
import time
import zlib
from copy import deepcopy
from hashlib import sha1
from os import path
......@@ -27,6 +26,7 @@ from os import path
from topydo.lib.Config import config
from topydo.lib.TodoList import TodoList
def hash_todolist(p_todolist):
""" Calculates hash for TodoList.TodoList object. """
todolist_hash = sha1(p_todolist.print_todos().encode('utf-8')).hexdigest()
......
......@@ -15,17 +15,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import configparser
from functools import lru_cache
import os
import re
import shlex
from collections import OrderedDict
from functools import lru_cache
from itertools import accumulate
from string import ascii_lowercase
from topydo.lib.Color import Color
def home_config_path(p_filename):
return os.path.join(os.path.expanduser('~'), p_filename)
......
......@@ -17,8 +17,8 @@
import re
from topydo.lib.MultiCommand import MultiCommand
from topydo.lib.printers.PrettyPrinter import PrettyPrinter
from topydo.lib.prettyprinters.Numbers import PrettyPrinterNumbers
from topydo.lib.printers.PrettyPrinter import PrettyPrinter
class DCommand(MultiCommand):
......
......@@ -16,12 +16,13 @@
""" Utilities for formatting output with "list_format" option."""
import arrow
import re
import arrow
from topydo.lib.Config import config
from topydo.lib.ProgressColor import progress_color
from topydo.lib.Utils import get_terminal_size, escape_ansi, humanize_date
from topydo.lib.Utils import escape_ansi, get_terminal_size, humanize_date
MAIN_PATTERN = (r'^({{(?P<before>.+?)}})?'
r'(?P<placeholder>{ph}|\[{ph}\])'
......
......@@ -20,7 +20,6 @@ from topydo.lib.Color import Color
from topydo.lib.Config import config
from topydo.lib.Recurrence import relative_date_to_date
# when a todo item has not enough information to determine the length, assume
# this length
ASSUMED_TODO_LENGTH = 14 # days
......
......@@ -16,16 +16,15 @@
""" This module provides functionality to sort lists with todo items. """
from collections import OrderedDict, namedtuple
from itertools import groupby
import re
from collections import OrderedDict, namedtuple
from datetime import date
from itertools import groupby
from topydo.lib.Config import config
from topydo.lib.Importance import average_importance, importance
from topydo.lib.Utils import date_string_to_date, humanize_date
Field = namedtuple('Field', ['sort', 'group', 'label'])
FIELDS = {
......@@ -269,4 +268,3 @@ class Sorter(object):
result[key] = self.sort(_group)
return result
......@@ -20,8 +20,10 @@ changes.
"""
import os.path
from watchdog.events import (FileCreatedEvent, FileModifiedEvent,
FileSystemEventHandler)
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler, FileModifiedEvent, FileCreatedEvent
from topydo.lib.TodoFile import TodoFile
......
......@@ -18,6 +18,7 @@
import collections
class TopydoString(collections.UserString):
"""
Represents a string that also contains color information. A combination of
......@@ -50,4 +51,3 @@ class TopydoString(collections.UserString):
def set_color(self, p_pos, p_color):
""" Start using a color at the given position. """
self.colors[p_pos] = p_color
......@@ -18,12 +18,12 @@
Various utility functions.
"""
import arrow
import re
from collections import namedtuple
from datetime import date
import arrow
def date_string_to_date(p_date):
"""
......@@ -116,4 +116,3 @@ def humanize_date(p_datetime):
now = arrow.now()
date = now.replace(day=p_datetime.day, month=p_datetime.month, year=p_datetime.year)
return date.humanize(now).replace('just now', 'today')
......@@ -56,4 +56,3 @@ class PrettyPrinterColorFilter(PrettyPrinterFilter):
p_todo_str.append('', AbstractColor.NEUTRAL)
return p_todo_str
......@@ -19,8 +19,8 @@ Provides a pretty printer filter that generates a todo string based on a format
string.
"""
from topydo.lib.PrettyPrinterFilter import PrettyPrinterFilter
from topydo.lib.ListFormat import ListFormatParser
from topydo.lib.PrettyPrinterFilter import PrettyPrinterFilter
class PrettyPrinterFormatFilter(PrettyPrinterFilter):
......
......@@ -29,4 +29,3 @@ class PrettyPrinterNumbers(PrettyPrinterFilter):
def filter(self, p_todo_str, p_todo):
""" Prepends the number to the todo string. """
return "|{:>3}| {}".format(self.todolist.number(p_todo), p_todo_str)
......@@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
from functools import lru_cache
from topydo.Commands import SUBCOMMAND_MAP
......
......@@ -20,7 +20,7 @@ import getopt
import sys
from topydo.ui.cli.CLI import CLIApplication
from topydo.ui.CLIApplicationBase import MAIN_OPTS, MAIN_LONG_OPTS, error
from topydo.ui.CLIApplicationBase import MAIN_LONG_OPTS, MAIN_OPTS, error
# enable color on windows CMD
if "win32" in sys.platform:
......
......@@ -18,9 +18,10 @@
import sys
from topydo.Commands import get_subcommand
from topydo.lib import TodoFile, TodoList
from topydo.lib.Config import ConfigError, config
from topydo.ui.CLIApplicationBase import CLIApplicationBase, error
from topydo.lib import TodoFile
from topydo.lib.Config import config, ConfigError
# First thing is to poke the configuration and check whether it's sane
# The modules below may already read in configuration upon import, so
......@@ -31,8 +32,6 @@ except ConfigError as config_error:
error(str(config_error))
sys.exit(1)
from topydo.Commands import get_subcommand
from topydo.lib import TodoList
class CLIApplication(CLIApplicationBase):
......
......@@ -14,10 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from configparser import RawConfigParser, NoOptionError
from configparser import NoOptionError, RawConfigParser
from os.path import expanduser
from topydo.lib.Config import home_config_path, config
from topydo.lib.Config import config, home_config_path
def columns(p_alt_layout_path=None):
......
......@@ -14,10 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import urwid
from os.path import commonprefix
import urwid
from topydo.ui.columns.CompletionBoxWidget import CompletionBoxWidget
......
......@@ -19,30 +19,32 @@ import getopt
import shlex
import sys
import time
import urwid
from collections import namedtuple
from string import ascii_uppercase
import urwid
from topydo.Commands import get_subcommand
from topydo.lib.Config import config, ConfigError
from topydo.ui.columns.ColumnCompleter import ColumnCompleter
from topydo.lib import TodoList
from topydo.lib.Config import ConfigError, config
from topydo.lib.Filter import (DependencyFilter, HiddenTagFilter,
RelevanceFilter, get_filter_list)
from topydo.lib.Sorter import Sorter
from topydo.lib.Filter import get_filter_list, RelevanceFilter, DependencyFilter, HiddenTagFilter
from topydo.lib.TodoFileWatched import TodoFileWatched
from topydo.lib.Utils import get_terminal_size
from topydo.lib.View import View
from topydo.lib.TodoFileWatched import TodoFileWatched
from topydo.lib import TodoList
from topydo.ui.CLIApplicationBase import CLIApplicationBase, error, GENERIC_HELP
from topydo.ui.CLIApplicationBase import (GENERIC_HELP, CLIApplicationBase,
error)
from topydo.ui.columns.ColumnCompleter import ColumnCompleter
from topydo.ui.columns.ColumnLayout import columns
from topydo.ui.columns.CommandLineWidget import CommandLineWidget
from topydo.ui.columns.ConsoleWidget import ConsoleWidget
from topydo.ui.columns.KeystateWidget import KeystateWidget
from topydo.ui.columns.TodoWidget import TodoWidget
from topydo.ui.columns.TodoListWidget import TodoListWidget
from topydo.ui.columns.TodoWidget import TodoWidget
from topydo.ui.columns.Transaction import Transaction
from topydo.ui.columns.Utils import PaletteItem, to_urwid_color
from topydo.ui.columns.ViewWidget import ViewWidget
from topydo.ui.columns.ColumnLayout import columns
class UIView(View):
......
......@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
import urwid
from topydo.lib.Config import config
......@@ -195,4 +196,3 @@ class TodoWidget(urwid.WidgetWrap):
def wipe_cache(p_class):
""" Wipes the cache """
p_class.cache = {}
......@@ -18,6 +18,7 @@ import urwid
from topydo.lib.Config import config
class ViewWidget(urwid.LineBox):
def __init__(self, p_todolist):
self._todolist = p_todolist
......
......@@ -19,12 +19,15 @@
import shlex
import sys
from topydo.ui.CLIApplicationBase import CLIApplicationBase, error, GENERIC_HELP
from topydo.ui.prompt.PromptCompleter import PromptCompleter
from prompt_toolkit.shortcuts import prompt
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit.shortcuts import prompt
from topydo.lib.Config import config, ConfigError
from topydo.Commands import get_subcommand
from topydo.lib.Config import ConfigError, config
from topydo.lib.TodoFileWatched import TodoFileWatched
from topydo.ui.CLIApplicationBase import (GENERIC_HELP, CLIApplicationBase,
error)
from topydo.ui.prompt.PromptCompleter import PromptCompleter
# First thing is to poke the configuration and check whether it's sane
# The modules below may already read in configuration upon import, so
......@@ -35,8 +38,6 @@ except ConfigError as config_error:
error(str(config_error))
sys.exit(1)
from topydo.Commands import get_subcommand
from topydo.lib.TodoFileWatched import TodoFileWatched
class PromptApplication(CLIApplicationBase):
......
......@@ -22,9 +22,10 @@ by the prompt toolkit.
import re
from prompt_toolkit.completion import Completer, Completion
from topydo.ui.CompleterBase import CompleterBase, date_suggestions
from topydo.lib.Config import config
from topydo.lib.RelativeDate import relative_date_to_date
from topydo.ui.CompleterBase import CompleterBase, date_suggestions
def _dates(p_word_before_cursor):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment