Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial blueprint support #42469

Merged
merged 20 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
  • Loading branch information
balloob and MartinHjelmare authored Nov 1, 2020
commit 90a8e67a6768d3f3ee82781ac20a95f55474e55f
6 changes: 3 additions & 3 deletions homeassistant/components/blueprint/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _get_community_post_import_url(url: str) -> str:
def _extract_blueprint_from_community_topic(
url,
balloob marked this conversation as resolved.
Show resolved Hide resolved
topic,
) -> ImportedBlueprint:
) -> Optional[ImportedBlueprint]:
"""Extract a blueprint from a community post JSON.

Async friendly.
Expand Down Expand Up @@ -167,9 +167,9 @@ async def fetch_blueprint_from_github_url(

async def fetch_blueprint_from_url(hass: HomeAssistant, url: str) -> ImportedBlueprint:
"""Get a blueprint from a url."""
for meth in (fetch_blueprint_from_community_post, fetch_blueprint_from_github_url):
for func in (fetch_blueprint_from_community_post, fetch_blueprint_from_github_url):
try:
return await meth(hass, url)
return await func(hass, url)
except ValueError:
pass

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/blueprint/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ async def async_get_blueprints(
async with self._load_lock:
return await self.hass.async_add_executor_job(self._load_blueprints)

async def async_get_blueprint(self, blueprint_name: str) -> Blueprint:
async def async_get_blueprint(self, blueprint_path: str) -> Blueprint:
"""Get a blueprint."""
if blueprint_name in self._blueprints:
return self._blueprints[blueprint_name]
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/blueprint/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def is_blueprint_instance_config(config: Any) -> bool:
)


def validate_yaml_suffix(value):
def validate_yaml_suffix(value: str) -> str:
"""Validate value has a YAML suffix."""
if not value.endswith(".yaml"):
raise vol.Invalid("Path needs to end in .yaml")
Expand Down