-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
custom_components/spook/ectoplasms/homeassistant/templating/typeof.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Spook - Not your homie.""" | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, Any | ||
|
||
from ....templating import AbstractSpookTemplateFunction | ||
|
||
if TYPE_CHECKING: | ||
from collections.abc import Callable | ||
|
||
|
||
class SpookTemplateFunction(AbstractSpookTemplateFunction): | ||
"""Spook template function to debug types.""" | ||
|
||
name = "typeof" | ||
|
||
requires_hass_object = False | ||
is_available_in_limited_environment = True | ||
is_filter = True | ||
is_global = True | ||
|
||
def function(self) -> Callable[..., Any]: | ||
"""Return the python method that runs this template function.""" | ||
return lambda o: o.__class__.__name__ |