当前位置: 首页>>代码示例>>Python>>正文


Python Config.config函数代码示例

本文整理汇总了Python中topydo.lib.Config.config函数的典型用法代码示例。如果您正苦于以下问题:Python config函数的具体用法?Python config怎么用?Python config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了config函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_priority_color4

    def test_priority_color4(self):
        config("test/data/ColorsTest4.conf")
        color = Colors().get_priority_colors()

        self.assertEqual(color['A'], NEUTRAL_COLOR)
        self.assertEqual(color['B'], NEUTRAL_COLOR)
        self.assertEqual(color['C'], NEUTRAL_COLOR) 
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:ColorsTest.py

示例2: test_priority_color2

    def test_priority_color2(self):
        config("test/data/ColorsTest2.conf")
        color = Colors().get_priority_colors()

        self.assertEqual(color['A'], '\033[0;35m')
        self.assertEqual(color['B'], '\033[0;1;36m')
        self.assertEqual(color['C'], '\033[0;37m')
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:ColorsTest.py

示例3: test_alias_default_cmd02

    def test_alias_default_cmd02(self):
        config("test/data/aliases.conf", {('topydo', 'default_command'): 'foo'})

        args = []
        real_cmd, final_args = get_subcommand(args)
        self.assertTrue(issubclass(real_cmd, DeleteCommand))
        self.assertEqual(final_args, ["-f", "test"])
开发者ID:MinchinWeb,项目名称:topydo,代码行数:7,代码来源:test_get_sub_command.py

示例4: test_uid3

    def test_uid3(self):
        """
        Must be able to handle integers when text identifiers are enabled.
        """

        config("test/data/todolist-uid.conf")
        self.assertRaises(InvalidTodoException, self.todolist.todo, 1)
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoListTest.py

示例5: test_importance_ignore_weekends_due_not_next_monday

 def test_importance_ignore_weekends_due_not_next_monday(self):
     # Today is sunday
     # due on a monday, but over a month away.
     # So 2 + 0 (no priority) + 0 (no star) + 0 (due > 14 days)
     config(p_overrides={('sort', 'ignore_weekends'): '1'})
     todo = Todo("Foo " + config().tag_due() + ":" + "2016-11-28")
     self.assertEqual(importance(todo), 2)
开发者ID:rcraggs,项目名称:topydo,代码行数:7,代码来源:test_importance.py

示例6: _process_flags

    def _process_flags(self):
        args = sys.argv[1:]

        if PY2:
            args = [arg.decode('utf-8') for arg in args]

        try:
            opts, args = getopt.getopt(args, MAIN_OPTS)
        except getopt.GetoptError as e:
            error(str(e))
            sys.exit(1)

        alt_config_path = None
        overrides = {}

        for opt, value in opts:
            if opt == "-a":
                self.do_archive = False
            elif opt == "-c":
                alt_config_path = value
            elif opt == "-t":
                overrides[('topydo', 'filename')] = value
            elif opt == "-d":
                overrides[('topydo', 'archive_filename')] = value
            elif opt == "-v":
                version()
            else:
                self._usage()

        if alt_config_path:
            config(alt_config_path, overrides)
        elif len(overrides):
            config(p_overrides=overrides)

        return args
开发者ID:netimen,项目名称:topydo,代码行数:35,代码来源:CLIApplicationBase.py

示例7: filter

    def filter(self, p_todo_str, p_todo):
        """ Applies the colors. """
        if config().colors():
            p_todo_str = TopydoString(p_todo_str, p_todo)

            priority_color = config().priority_color(p_todo.priority())

            colors = [
                (r'\[email protected](\S*\w)', AbstractColor.CONTEXT),
                (r'\B\+(\S*\w)', AbstractColor.PROJECT),
                (r'\b\S+:[^/\s]\S*\b', AbstractColor.META),
                (r'(^|\s)(\w+:){1}(//\S+)', AbstractColor.LINK),
            ]

            # color by priority
            p_todo_str.set_color(0, priority_color)

            for pattern, color in colors:
                for match in re.finditer(pattern, p_todo_str.data):
                    p_todo_str.set_color(match.start(), color)
                    p_todo_str.set_color(match.end(), priority_color)

            p_todo_str.append('', AbstractColor.NEUTRAL)

        return p_todo_str
开发者ID:bram85,项目名称:topydo,代码行数:25,代码来源:Colors.py

示例8: test_priority_color1

    def test_priority_color1(self):
        config("test/data/ColorsTest1.conf")
        color = Colors().get_priority_colors()

        self.assertEqual(color['A'], '\033[0;38;5;1m')
        self.assertEqual(color['B'], '\033[0;38;5;2m')
        self.assertEqual(color['C'], '\033[0;38;5;3m')
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:ColorsTest.py

示例9: test_alias_default_cmd03

    def test_alias_default_cmd03(self):
        config("test/data/aliases.conf", {('topydo', 'default_command'): 'nonexisting_default'})

        args = ['nonexisting']
        real_cmd, final_args = get_subcommand(args)
        self.assertFalse(real_cmd)
        self.assertEqual(final_args, ['nonexisting'])
开发者ID:MinchinWeb,项目名称:topydo,代码行数:7,代码来源:test_get_sub_command.py

示例10: test_new_uid

    def test_new_uid(self):
        """ Make sure that item has new text ID after append. """
        config("test/data/todolist-uid.conf")
        todo = self.todolist.todo('t5c')
        self.todolist.append(todo, "A")

        self.assertNotEqual(self.todolist.number(todo), 't5c')
开发者ID:rameshg87,项目名称:topydo,代码行数:7,代码来源:test_todo_list.py

示例11: test_alias04

    def test_alias04(self):
        config("test/data/aliases.conf")

        args = ["star", "foo"]
        real_cmd, final_args = get_subcommand(args)
        self.assertTrue(issubclass(real_cmd, TagCommand))
        self.assertEqual(final_args, ["foo", "star", "1"])
开发者ID:MinchinWeb,项目名称:topydo,代码行数:7,代码来源:test_get_sub_command.py

示例12: test_alias01

    def test_alias01(self):
        config("test/data/aliases.conf")

        args = ["foo"]
        real_cmd, final_args = get_subcommand(args)
        self.assertTrue(issubclass(real_cmd, DeleteCommand))
        self.assertEqual(final_args, ["-f", "test"])
开发者ID:MinchinWeb,项目名称:topydo,代码行数:7,代码来源:test_get_sub_command.py

示例13: test_alias02

    def test_alias02(self):
        config("test/data/aliases.conf")

        args = ["format"]
        real_cmd, final_args = get_subcommand(args)
        self.assertTrue(issubclass(real_cmd, ListCommand))
        self.assertEqual(final_args, ["-F", "|I| x c d {(}p{)} s k", "-n", "25"])
开发者ID:MinchinWeb,项目名称:topydo,代码行数:7,代码来源:test_get_sub_command.py

示例14: _post_execute

    def _post_execute(self):
        """
        Should be called when executing the user requested command has been
        completed. It will do some maintenance and write out the final result
        to the todo.txt file.
        """

        if self.todolist.dirty:
            # do not archive when the value of the filename is an empty string
            # (i.e. explicitly left empty in the configuration
            if self.do_archive and config().archive():
                self._archive()
            elif config().archive() and self.backup:
                archive = _retrieve_archive()[0]
                self.backup.add_archive(archive)

            self._post_archive_action()

            if config().keep_sorted():
                from topydo.commands.SortCommand import SortCommand
                self._execute(SortCommand, [])

            if self.backup:
                self.backup.save(self.todolist)

            self.todofile.write(self.todolist.print_todos())
            self.todolist.dirty = False

        self.backup = None
开发者ID:bram85,项目名称:topydo,代码行数:29,代码来源:CLIApplicationBase.py

示例15: test_uid2

    def test_uid2(self):
        """ Changing the priority should not change the identifier. """
        config("test/data/todolist-uid.conf")

        todo = self.todolist.todo("t5c")
        self.todolist.set_priority(todo, "B")
        self.assertEqual(self.todolist.todo("t5c").source(), "(B) Foo @Context2 [email protected] +Project1 Not+Project")
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoListTest.py


注:本文中的topydo.lib.Config.config函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。