How to use the todoman.model.cached_property function in todoman

To help you get started, we’ve selected a few todoman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pimutils / todoman / tests / test_model.py View on Github external
def test_cached_property_property():
    class TestClass:
        @cached_property
        def a(self):
            return 0

    assert TestClass.a.__class__ == cached_property
github pimutils / todoman / todoman / model.py View on Github external
    @cached_property
    def lists_map(self):
        return {l.name: l for l in self.lists()}
github pimutils / todoman / todoman / cli.py View on Github external
    @cached_property
    def formatter(self):
        return self.formatter_class(
            self.config['main']['date_format'],
            self.config['main']['time_format'],
            self.config['main']['dt_separator']
        )
github pimutils / todoman / todoman / model.py View on Github external
    @cached_property
    def path(self):
        return os.path.join(self.list.path, self.filename)
github pimutils / todoman / todoman / model.py View on Github external
    @cached_property
    def color_ansi(self):
        rv = self.color_rgb
        if rv:
            return '\33[38;2;{!s};{!s};{!s}m'.format(*rv)
github pimutils / todoman / todoman / model.py View on Github external
    @cached_property
    def color_rgb(self):
        color = self.colour
        if not color or not color.startswith('#'):
            return

        r = color[1:3]
        g = color[3:5]
        b = color[5:8]

        if len(r) == len(g) == len(b) == 2:
            return int(r, 16), int(g, 16), int(b, 16)
github pimutils / todoman / todoman / cli.py View on Github external
    @cached_property
    def ui_formatter(self):
        return formatters.DefaultFormatter(
            self.config['main']['date_format'],
            self.config['main']['time_format'],
            self.config['main']['dt_separator']
        )