Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion homeassistant/components/foscam/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/foscam",
"iot_class": "local_polling",
"loggers": ["libpyfoscamcgi"],
"requirements": ["libpyfoscamcgi==0.0.6"]
"requirements": ["libpyfoscamcgi==0.0.7"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/holiday/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/holiday",
"iot_class": "local_polling",
"requirements": ["holidays==0.78", "babel==2.15.0"]
"requirements": ["holidays==0.79", "babel==2.15.0"]
}
3 changes: 2 additions & 1 deletion homeassistant/components/mastodon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"integration_type": "service",
"iot_class": "cloud_polling",
"loggers": ["mastodon"],
"requirements": ["Mastodon.py==2.0.1"]
"quality_scale": "bronze",
"requirements": ["Mastodon.py==2.1.0"]
}
5 changes: 1 addition & 4 deletions homeassistant/components/mastodon/quality_scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ rules:
common-modules: done
config-flow-test-coverage: done
config-flow: done
dependency-transparency:
status: todo
comment: |
Mastodon.py does not have CI build/publish.
dependency-transparency: done
docs-actions: done
docs-high-level-description: done
docs-installation-instructions: done
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/renault/renault_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ async def async_initialise_vehicle(
name=vehicle.device_info[ATTR_NAME],
model=vehicle.device_info[ATTR_MODEL],
model_id=vehicle.device_info[ATTR_MODEL_ID],
sw_version=None, # cleanup from PR #125399
)
self._vehicles[vehicle_link.vin] = vehicle

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/workday/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"iot_class": "local_polling",
"loggers": ["holidays"],
"quality_scale": "internal",
"requirements": ["holidays==0.78"]
"requirements": ["holidays==0.79"]
}
38 changes: 27 additions & 11 deletions homeassistant/components/zwave_js/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

from collections.abc import Callable, Mapping
from dataclasses import dataclass
from typing import Any
from typing import Any, cast

import voluptuous as vol
from zwave_js_server.const import CommandClass
from zwave_js_server.const import CommandClass, RssiError
from zwave_js_server.const.command_class.meter import (
RESET_METER_OPTION_TARGET_VALUE,
RESET_METER_OPTION_TYPE,
)
from zwave_js_server.exceptions import BaseZwaveJSServerError
from zwave_js_server.exceptions import BaseZwaveJSServerError, RssiErrorReceived
from zwave_js_server.model.controller import Controller
from zwave_js_server.model.controller.statistics import ControllerStatistics
from zwave_js_server.model.driver import Driver
Expand Down Expand Up @@ -1049,7 +1049,7 @@ def __init__(
self,
config_entry: ZwaveJSConfigEntry,
driver: Driver,
statistics_src: ZwaveNode | Controller,
statistics_src: Controller | ZwaveNode,
description: ZWaveJSStatisticsSensorEntityDescription,
) -> None:
"""Initialize a Z-Wave statistics entity."""
Expand Down Expand Up @@ -1080,13 +1080,31 @@ async def async_poll_value(self, _: bool) -> None:
)

@callback
def statistics_updated(self, event_data: dict) -> None:
def _statistics_updated(self, event_data: dict) -> None:
"""Call when statistics updated event is received."""
self._attr_native_value = self.entity_description.convert(
event_data["statistics_updated"], self.entity_description.key
statistics = cast(
ControllerStatistics | NodeStatistics, event_data["statistics_updated"]
)
self._set_statistics(statistics)
self.async_write_ha_state()

@callback
def _set_statistics(
self, statistics: ControllerStatistics | NodeStatistics
) -> None:
"""Set updated statistics."""
try:
self._attr_native_value = self.entity_description.convert(
statistics, self.entity_description.key
)
except RssiErrorReceived as err:
if err.error is RssiError.NOT_AVAILABLE:
self._attr_available = False
return
self._attr_native_value = None
# Reset available state.
self._attr_available = True

async def async_added_to_hass(self) -> None:
"""Call when entity is added."""
self.async_on_remove(
Expand All @@ -1104,10 +1122,8 @@ async def async_added_to_hass(self) -> None:
)
)
self.async_on_remove(
self.statistics_src.on("statistics updated", self.statistics_updated)
self.statistics_src.on("statistics updated", self._statistics_updated)
)

# Set initial state
self._attr_native_value = self.entity_description.convert(
self.statistics_src.statistics, self.entity_description.key
)
self._set_statistics(self.statistics_src.statistics)
6 changes: 3 additions & 3 deletions requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion script/hassfest/quality_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,6 @@ class Rule:
"manual",
"manual_mqtt",
"map",
"mastodon",
"marytts",
"matrix",
"matter",
Expand Down
42 changes: 31 additions & 11 deletions script/hassfest/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import re
import subprocess
import sys
from typing import Any
from typing import Any, TypedDict

from awesomeversion import AwesomeVersion, AwesomeVersionStrategy
from tqdm import tqdm
Expand Down Expand Up @@ -295,6 +295,9 @@
},
}

FORBIDDEN_FILE_NAMES: set[str] = {
"py.typed", # should be placed inside a package
}
FORBIDDEN_PACKAGE_NAMES: set[str] = {
"doc",
"docs",
Expand Down Expand Up @@ -364,7 +367,15 @@
},
}

_packages_checked_files_cache: dict[str, set[str]] = {}

class _PackageFilesCheckResult(TypedDict):
"""Data structure to store results of package files check."""

top_level: set[str]
file_names: set[str]


_packages_checked_files_cache: dict[str, _PackageFilesCheckResult] = {}


def validate(integrations: dict[str, Integration], config: Config) -> None:
Expand Down Expand Up @@ -733,24 +744,33 @@ def check_dependency_files(
pkg: str,
package_exceptions: Collection[str],
) -> bool:
"""Check dependency files for forbidden package names."""
"""Check dependency files for forbidden files and forbidden package names."""
if (results := _packages_checked_files_cache.get(pkg)) is None:
top_level: set[str] = set()
file_names: set[str] = set()
for file in files(pkg) or ():
top = file.parts[0].lower()
if top.endswith((".dist-info", ".py")):
continue
top_level.add(top)
results = FORBIDDEN_PACKAGE_NAMES & top_level
if not (top := file.parts[0].lower()).endswith((".dist-info", ".py")):
top_level.add(top)
if (name := str(file)).lower() in FORBIDDEN_FILE_NAMES:
file_names.add(name)
results = _PackageFilesCheckResult(
top_level=FORBIDDEN_PACKAGE_NAMES & top_level,
file_names=file_names,
)
_packages_checked_files_cache[pkg] = results
if not results:
if not (results["top_level"] or results["file_names"]):
return True

for dir_name in results:
for dir_name in results["top_level"]:
integration.add_warning_or_error(
pkg in package_exceptions,
"requirements",
f"Package {pkg} has a forbidden top level directory {dir_name} in {package}",
f"Package {pkg} has a forbidden top level directory '{dir_name}' in {package}",
)
for file_name in results["file_names"]:
integration.add_error(
"requirements",
f"Package {pkg} has a forbidden file '{file_name}' in {package}",
)
return False

Expand Down
1 change: 1 addition & 0 deletions tests/components/mastodon/snapshots/test_diagnostics.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
'limited': None,
'locked': False,
'memorial': None,
'moved': None,
'moved_to_account': None,
'mute_expires_at': None,
'noindex': False,
Expand Down
Loading
Loading