Пример #1
0
def open_sources(args):
    sources = [
        Source(TodoTxt(pathlib.Path(fn).expanduser().resolve()))
        for fn in args.filename
    ]
    for source in sources:
        if source.filename.exists():
            source.parse()
    return sources
Пример #2
0
def prepare(todotxt, config):
    cfg = get_config(config)

    if len(todotxt) == 0:
        todotxt = cfg.get('General', 'todotxt-file')
    if len(todotxt) == 0:
        raise ValueError(f'No todotxt file given nor configured in {config}')

    todo = TodoTxt(todotxt)
    todo.parse()

    if cfg.getboolean('General', 'usetex'):
        plt.rc('text', usetex=True)

    style = cfg.get('General', 'matplotlib-style')
    if len(style) > 0:
        plt.style.use(style)

    return cfg, todo
Пример #3
0
 def setUp(self):
     self.filename = 'tests/todo.test.txt'
     self.todo = TodoTxt(self.filename)
Пример #4
0
 def test_no_file(self):
     with self.assertRaises(IOError):
         TodoTxt('filenotfound.txt')
Пример #5
0
 def setUp(self):
     self.filename = 'tests/todo.wellformatted.txt'
     self.todo = TodoTxt(self.filename)