Skip to content

Commit aebae3a

Browse files
committed
added name attributes
1 parent 81e62df commit aebae3a

File tree

7 files changed

+17
-7
lines changed

7 files changed

+17
-7
lines changed

appdaemon/adbase.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
from pathlib import Path
55
from typing import TYPE_CHECKING, Any
66

7-
from appdaemon import adapi
8-
from appdaemon import utils
9-
from appdaemon.models.config.app import AppConfig, AllAppConfig
10-
7+
from appdaemon import adapi, utils
8+
from appdaemon.models.config.app import AllAppConfig, AppConfig
119

1210
# Check if the module is being imported using the legacy method
1311
if __name__ == Path(__file__).name:
@@ -79,7 +77,6 @@ class ADBase:
7977
args: dict
8078
"""Dictionary of the app configuration
8179
"""
82-
8380
_namespace: str
8481

8582
logger: Logger

appdaemon/admin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212

1313
class Admin:
14+
name: str = "_admin"
15+
1416
def __init__(self, config_dir, logger, ad: "AppDaemon", **kwargs):
1517
#
1618
# Set Defaults

appdaemon/plugins/mqtt/mqttplugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class MqttPlugin(PluginBase):
2424
mqtt_wildcards: list[str]
2525
mqtt_binary_topics: list[str]
2626
mqtt_lock: Lock
27+
name: str = "_mqtt"
2728

2829
def __init__(self, ad: "AppDaemon", name: str, config: MQTTConfig):
2930
"""Initialize MQTT Plugin."""

appdaemon/scheduler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class Scheduler:
4141

4242
schedule: dict[str, dict[str, Any]]
4343

44+
name: str = "_scheduler"
4445
active: bool = False
4546
realtime: bool = True
4647
stopping: bool = False

appdaemon/stream/adstream.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515

1616
class ADStream:
17+
name: str = "_adstream"
18+
1719
def __init__(self, ad: AppDaemon, app, transport):
1820
self.AD = ad
1921
self.logger = ad.logging.get_child("_stream")
@@ -80,6 +82,8 @@ async def process_event(self, data): # noqa: C901
8082
## directly. Only Create public methods here if you wish to make them
8183
## stream commands.
8284
class RequestHandler:
85+
name: str = "_request_handler"
86+
8387
def __init__(self, ad: AppDaemon, adstream, handle, request):
8488
self.AD = ad
8589
self.handle = handle

appdaemon/stream/sockjs_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import traceback
21
import json
2+
import traceback
3+
34
import sockjs
45

56
from appdaemon import utils as utils
@@ -49,6 +50,8 @@ def makeStream(self, ad, request, **kwargs):
4950

5051

5152
class SockJSStream:
53+
name: str = "_sockjsstream"
54+
5255
def __init__(self, ad, session, **kwargs):
5356
self.AD = ad
5457
self.session = session

appdaemon/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class PersistentDict(shelve.DbfilenameShelf):
9191
Dict-like object that uses a Shelf to persist its contents.
9292
"""
9393

94-
def __init__(self, filename: Path, safe: bool, *args, **kwargs):
94+
def __init__(self, filename: str | Path, safe: bool, *args, **kwargs):
9595
filename = Path(filename).resolve().as_posix()
9696
# writeback=True allows for mutating objects in place, like with a dict.
9797
super().__init__(filename, writeback=True)
@@ -523,6 +523,8 @@ class Subsystem(Protocol):
523523
AD: "AppDaemon"
524524
"""Reference to the top-level AppDaemon object"""
525525
logger: Logger
526+
name: str
527+
"""Used for registering futures, and maybe other things?"""
526528

527529

528530
def executor_decorator(func: Callable[..., R]) -> Callable[..., Coroutine[Any, Any, R]]:

0 commit comments

Comments
 (0)