def archive(projects_list, archive_list): save_projects = False if isinstance(projects_list, str): projects_list = topy.from_file(projects_path) save_projects = True save_archive = False if isinstance(archive_list, str): archive_list = topy.from_file(archive_path) save_archive = True topy.archive(projects_list, archive_list) if save_projects: projects_list.to_file(projects_path) if save_archive: archive_list.to_file(archive_list) return projects_list, archive_list
def _test_on_files(self, input_list, out_path, query=''): os.path.abspath(out_path) if isinstance(input_list, str): input_list = tp.from_file(input_list) input_list = input_list.filter(query) in_txt = input_list.as_plain_text() out_txt = open(out_path, 'r').read().strip() open('m' + out_path, 'w').write(in_txt) # print in_txt # print out_txt self.assertEqual(in_txt.strip(), out_txt.strip())
#!/usr/bin/python from config import projects_path, inbox_path, onhold_path # archive_path import topy # from archive import archive from update_lists import update_daily, update_weekly, update_waiting from tvcal import tvcal from log_to_day_one import log_to_day_one all_lists = topy.from_files(topy.lists.to_list()) inbox_file = open(inbox_path, 'a') # archive_list = topy.from_file(archive_path) onhold_list = topy.from_file(onhold_path) log_to_day_one(all_lists.deep_copy()) tvcal(inbox_file) update_weekly(onhold_list, inbox_file) update_waiting(onhold_list, inbox_file) # inbox_file.close() update_daily(all_lists) # archive(all_lists, archive_list) # archive_list.to_file(archive_path) topy.save(all_lists)
#!/usr/bin/python from config import should_print_path as should_print from config import projects_path import topy t = topy.from_file(projects_path) if int(open(should_print).read()): print t.as_plain_text(colored=True, indent=True) else: print 'BLA'
#!/usr/bin/python from datetime import date from topy import from_file, archive from config import days_of_the_week, projects_path, onhold_path, inbox_path, daily_project_title, remove_waiting_from_onhold projects = from_file(projects_path) onhold = from_file(onhold_path) def update_daily(projects): daily = projects.filter('project = ' + daily_project_title) daily.remove_tag('done') def update_weekly(onhold, inbox): today = days_of_the_week[date.today().weekday()] waiting = onhold.filter('@weekly = ' + today + ' +d') inbox.write('\n' + waiting.as_plain_text()) def update_waiting(onhold, inbox): today = date.today().isoformat() waiting = onhold.filter('@waiting <= ' + today + ' +d', remove=remove_waiting_from_onhold) inbox.write('\n' + waiting.as_plain_text()) if __name__ == '__main__': update_daily(projects) with open(inbox_path, 'a') as inbox: update_weekly(onhold, inbox) update_waiting(onhold, inbox) projects.to_file(projects_path)
#!/usr/bin/python from datetime import date from topy import from_file, archive from config import days_of_the_week, projects_path, onhold_path, inbox_path, daily_project_title, remove_waiting_from_onhold projects = from_file(projects_path) onhold = from_file(onhold_path) def update_daily(projects): daily = projects.filter('project = ' + daily_project_title) daily.remove_tag('done') def update_weekly(onhold, inbox): today = days_of_the_week[date.today().weekday()] waiting = onhold.filter('@weekly = ' + today + ' +d') inbox.write('\n' + waiting.as_plain_text()) def update_waiting(onhold, inbox): today = date.today().isoformat() waiting = onhold.filter('@waiting <= ' + today + ' +d', remove=remove_waiting_from_onhold) inbox.write('\n' + waiting.as_plain_text()) if __name__ == '__main__': update_daily(projects) with open(inbox_path, 'a') as inbox: update_weekly(onhold, inbox)
def load_big(): return tp.from_file('in/big.todo')