mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 16:31:32 +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 collections import namedtuple
|
||||||
from os import environ
|
from os import environ
|
||||||
|
|
||||||
from tfw.decorators import LazyInitialise
|
from tfw.decorators import lazy_property
|
||||||
|
|
||||||
|
|
||||||
class LazyEnvironment:
|
class LazyEnvironment:
|
||||||
@ -12,7 +12,7 @@ class LazyEnvironment:
|
|||||||
self._prefix = prefix
|
self._prefix = prefix
|
||||||
self._tuple_name = tuple_name
|
self._tuple_name = tuple_name
|
||||||
|
|
||||||
@LazyInitialise
|
@lazy_property
|
||||||
def environment(self):
|
def environment(self):
|
||||||
return self.prefixed_envvars_to_namedtuple()
|
return self.prefixed_envvars_to_namedtuple()
|
||||||
|
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
# All Rights Reserved. See LICENSE file for details.
|
# All Rights Reserved. See LICENSE file for details.
|
||||||
|
|
||||||
from .rate_limiter import RateLimiter
|
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.
|
# All Rights Reserved. See LICENSE file for details.
|
||||||
|
|
||||||
|
|
||||||
class LazyInitialise:
|
class lazy_property:
|
||||||
"""
|
"""
|
||||||
Decorator that replaces a function with the value
|
Decorator that replaces a function with the value
|
||||||
it calculates on the first call.
|
it calculates on the first call.
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from tfw.decorators import LazyInitialise
|
from tfw.decorators import lazy_property
|
||||||
|
|
||||||
|
|
||||||
class CallbackMixin:
|
class CallbackMixin:
|
||||||
@LazyInitialise
|
@lazy_property
|
||||||
def _callbacks(self):
|
def _callbacks(self):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
from watchdog.observers import Observer
|
from watchdog.observers import Observer
|
||||||
|
|
||||||
from tfw.decorators import LazyInitialise
|
from tfw.decorators import lazy_property
|
||||||
|
|
||||||
|
|
||||||
class ObserverMixin:
|
class ObserverMixin:
|
||||||
@LazyInitialise
|
@lazy_property
|
||||||
def observer(self):
|
def observer(self):
|
||||||
return Observer()
|
return Observer()
|
||||||
|
|
||||||
|
@ -6,12 +6,12 @@ from xmlrpc.client import Fault as SupervisorFault
|
|||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from os import remove
|
from os import remove
|
||||||
|
|
||||||
from tfw.decorators import LazyInitialise
|
from tfw.decorators import lazy_property
|
||||||
from tfw.config import TFWENV
|
from tfw.config import TFWENV
|
||||||
|
|
||||||
|
|
||||||
class SupervisorBaseMixin:
|
class SupervisorBaseMixin:
|
||||||
@LazyInitialise
|
@lazy_property
|
||||||
def supervisor(self):
|
def supervisor(self):
|
||||||
return xmlrpc.client.ServerProxy(TFWENV.SUPERVISOR_HTTP_URI).supervisor
|
return xmlrpc.client.ServerProxy(TFWENV.SUPERVISOR_HTTP_URI).supervisor
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user