|
21 | 21 |
|
22 | 22 | from pydantic import ValidationError |
23 | 23 |
|
24 | | - |
25 | 24 | from appdaemon.dependency import DependencyResolutionFail, find_all_dependents, get_full_module_name |
26 | 25 | from appdaemon.dependency_manager import DependencyManager |
27 | 26 | from appdaemon.models.config import AllAppConfig, AppConfig, GlobalModule |
|
33 | 32 | from .models.internal.app_management import LoadingActions, ManagedObject, UpdateActions, UpdateMode |
34 | 33 |
|
35 | 34 | if TYPE_CHECKING: |
36 | | - from .appdaemon import AppDaemon |
37 | | - from .adbase import ADBase |
38 | 35 | from .adapi import ADAPI |
| 36 | + from .adbase import ADBase |
| 37 | + from .appdaemon import AppDaemon |
39 | 38 | from .plugin_management import PluginBase |
40 | 39 |
|
41 | 40 | T = TypeVar("T") |
@@ -87,7 +86,6 @@ class AppManagement: |
87 | 86 |
|
88 | 87 | def __init__(self, ad: "AppDaemon"): |
89 | 88 | self.AD = ad |
90 | | - self.ext = self.AD.config.ext |
91 | 89 | self.logger = ad.logging.get_child(self.name) |
92 | 90 | self.error = ad.logging.get_error() |
93 | 91 | self.diag = ad.logging.get_diag() |
@@ -527,12 +525,11 @@ async def safe_create(self: "AppManagement"): |
527 | 525 | module_name, |
528 | 526 | ) |
529 | 527 |
|
530 | | - if (pin := cfg.pin_thread) and pin >= self.AD.threading.total_threads: |
| 528 | + if (pin := cfg.pin_thread) is not None and pin >= self.AD.threading.total_threads: |
531 | 529 | raise ade.PinOutofRange(pin_thread=pin, total_threads=self.AD.threading.total_threads) |
532 | | - elif (obj := self.objects.get(app_name)) and obj.pin_thread is not None: |
| 530 | + if (obj := self.objects.get(app_name)) and obj.pin_thread is not None: |
533 | 531 | pin = obj.pin_thread |
534 | | - else: |
535 | | - pin = -1 |
| 532 | + # else pin is already None from cfg.pin_thread |
536 | 533 |
|
537 | 534 | # This module should already be loaded and stored in sys.modules |
538 | 535 | mod_obj = await utils.run_in_executor(self, importlib.import_module, module_name) |
@@ -585,7 +582,7 @@ def add_plugin_object(self, name: str, object: "PluginBase") -> None: |
585 | 582 | type="plugin", |
586 | 583 | object=object, |
587 | 584 | pin_app=False, |
588 | | - pin_thread=-1, |
| 585 | + pin_thread=None, |
589 | 586 | running=False, |
590 | 587 | ) |
591 | 588 |
|
@@ -1047,8 +1044,8 @@ def get_app_config_files(self) -> set[Path]: |
1047 | 1044 | return set( |
1048 | 1045 | utils.recursive_get_files( |
1049 | 1046 | base=self.AD.app_dir.resolve(), |
1050 | | - suffix=self.ext, |
1051 | | - exclude=set(self.AD.exclude_dirs), |
| 1047 | + suffix={".yaml", ".toml"}, |
| 1048 | + exclude=set(self.AD.exclude_dirs) | {"ruff.toml", "pyproject.toml", "secrets.yaml"}, |
1052 | 1049 | ) |
1053 | 1050 | ) |
1054 | 1051 |
|
@@ -1323,7 +1320,7 @@ def create_app(self, app: str = None, **kwargs): |
1323 | 1320 | return False |
1324 | 1321 |
|
1325 | 1322 | app_directory: Path = self.AD.app_dir / kwargs.pop("app_dir", "ad_apps") |
1326 | | - app_file: Path = app_directory / kwargs.pop("app_file", f"{app}{self.ext}") |
| 1323 | + app_file: Path = app_directory / kwargs.pop("app_file", f"{app}{self.AD.config.ext}") |
1327 | 1324 | app_directory = app_file.parent # in case the given app_file is multi level |
1328 | 1325 |
|
1329 | 1326 | try: |
|
0 commit comments