Rename LazyInitialise to make IDEs recognise it as a property

This commit is contained in:
Kristóf Tóth 2018-06-02 11:48:34 +02:00
parent d5b0bb4d32
commit edc46a8ae6
6 changed files with 10 additions and 10 deletions

View File

@ -4,7 +4,7 @@
from collections import namedtuple
from os import environ
from tfw.decorators import LazyInitialise
from tfw.decorators import lazy_property
class LazyEnvironment:
@ -12,7 +12,7 @@ class LazyEnvironment:
self._prefix = prefix
self._tuple_name = tuple_name
@LazyInitialise
@lazy_property
def environment(self):
return self.prefixed_envvars_to_namedtuple()

View File

@ -2,4 +2,4 @@
# All Rights Reserved. See LICENSE file for details.
from .rate_limiter import RateLimiter
from .lazy_initialise import LazyInitialise
from .lazy_property import lazy_property

View File

@ -2,7 +2,7 @@
# All Rights Reserved. See LICENSE file for details.
class LazyInitialise:
class lazy_property:
"""
Decorator that replaces a function with the value
it calculates on the first call.

View File

@ -3,11 +3,11 @@
from functools import partial
from tfw.decorators import LazyInitialise
from tfw.decorators import lazy_property
class CallbackMixin:
@LazyInitialise
@lazy_property
def _callbacks(self):
return []

View File

@ -3,11 +3,11 @@
from watchdog.observers import Observer
from tfw.decorators import LazyInitialise
from tfw.decorators import lazy_property
class ObserverMixin:
@LazyInitialise
@lazy_property
def observer(self):
return Observer()

View File

@ -6,12 +6,12 @@ from xmlrpc.client import Fault as SupervisorFault
from contextlib import suppress
from os import remove
from tfw.decorators import LazyInitialise
from tfw.decorators import lazy_property
from tfw.config import TFWENV
class SupervisorBaseMixin:
@LazyInitialise
@lazy_property
def supervisor(self):
return xmlrpc.client.ServerProxy(TFWENV.SUPERVISOR_HTTP_URI).supervisor