forked from platypush/platypush
Added support for generic kwargs to publish_entities
.
This commit is contained in:
parent
ca7c89949b
commit
841a28066b
1 changed files with 3 additions and 2 deletions
|
@ -34,7 +34,7 @@ class EntityManager(ABC):
|
||||||
return super().__new__(cls)
|
return super().__new__(cls)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def transform_entities(self, entities: Collection[Any]) -> Collection[Entity]:
|
def transform_entities(self, entities: Collection[Any], **_) -> Collection[Entity]:
|
||||||
"""
|
"""
|
||||||
This method takes a list of entities in any (plugin-specific)
|
This method takes a list of entities in any (plugin-specific)
|
||||||
format and converts them into a standardized collection of
|
format and converts them into a standardized collection of
|
||||||
|
@ -86,6 +86,7 @@ class EntityManager(ABC):
|
||||||
self,
|
self,
|
||||||
entities: Optional[Collection[Any]],
|
entities: Optional[Collection[Any]],
|
||||||
callback: Optional[EntitySavedCallback] = None,
|
callback: Optional[EntitySavedCallback] = None,
|
||||||
|
**kwargs,
|
||||||
) -> Collection[Entity]:
|
) -> Collection[Entity]:
|
||||||
"""
|
"""
|
||||||
Publishes a list of entities. The downstream consumers include:
|
Publishes a list of entities. The downstream consumers include:
|
||||||
|
@ -106,7 +107,7 @@ class EntityManager(ABC):
|
||||||
from platypush.entities import publish_entities
|
from platypush.entities import publish_entities
|
||||||
|
|
||||||
transformed_entities = self._normalize_entities(
|
transformed_entities = self._normalize_entities(
|
||||||
self.transform_entities(entities or [])
|
self.transform_entities(entities or [], **kwargs)
|
||||||
)
|
)
|
||||||
|
|
||||||
publish_entities(transformed_entities, callback=callback)
|
publish_entities(transformed_entities, callback=callback)
|
||||||
|
|
Loading…
Reference in a new issue