mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-05 14:31:21 +00:00
Rename LazyInitialise to make IDEs recognise it as a property
This commit is contained in:
parent
d5b0bb4d32
commit
edc46a8ae6
@ -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()
|
||||
|
||||
|
@ -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
|
||||
|
@ -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.
|
@ -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 []
|
||||
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user