Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@cached_property
def a(self):
return 0
def test_cached_property_property():
class TestClass:
@cached_property
def a(self):
return 0
assert TestClass.a.__class__ == cached_property
@cached_property
def lists_map(self):
return {l.name: l for l in self.lists()}
@cached_property
def formatter(self):
return self.formatter_class(
self.config['main']['date_format'],
self.config['main']['time_format'],
self.config['main']['dt_separator']
)
@cached_property
def path(self):
return os.path.join(self.list.path, self.filename)
@cached_property
def color_ansi(self):
rv = self.color_rgb
if rv:
return '\33[38;2;{!s};{!s};{!s}m'.format(*rv)
@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)
@cached_property
def ui_formatter(self):
return formatters.DefaultFormatter(
self.config['main']['date_format'],
self.config['main']['time_format'],
self.config['main']['dt_separator']
)