mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Merge branch 'integration' into memory_api
This commit is contained in:
		| @@ -299,7 +299,6 @@ class APIConnection : public APIServerConnection { | ||||
|   void complete_authentication_(); | ||||
|  | ||||
| #ifdef USE_API_HOMEASSISTANT_STATES | ||||
|   // Process state subscriptions efficiently | ||||
|   void process_state_subscriptions_(); | ||||
| #endif  // USE_API_HOMEASSISTANT_STATES | ||||
|  | ||||
|   | ||||
| @@ -51,8 +51,7 @@ DISPLAY_ROTATIONS = { | ||||
|  | ||||
| def validate_rotation(value): | ||||
|     value = cv.string(value) | ||||
|     if value.endswith("°"): | ||||
|         value = value[:-1] | ||||
|     value = value.removesuffix("°") | ||||
|     return cv.enum(DISPLAY_ROTATIONS, int=True)(value) | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -409,7 +409,7 @@ def validate_printf(value): | ||||
|     [cCdiouxXeEfgGaAnpsSZ]             # type | ||||
|     ) | ||||
|     """  # noqa | ||||
|     matches = re.findall(cfmt, value[CONF_FORMAT], flags=re.X) | ||||
|     matches = re.findall(cfmt, value[CONF_FORMAT], flags=re.VERBOSE) | ||||
|     if len(matches) != len(value[CONF_ARGS]): | ||||
|         raise cv.Invalid( | ||||
|             f"Found {len(matches)} printf-patterns ({', '.join(matches)}), but {len(value[CONF_ARGS])} args were given!" | ||||
|   | ||||
| @@ -33,7 +33,7 @@ def validate_printf(value): | ||||
|     [cCdiouxXeEfgGaAnpsSZ]             # type | ||||
|     ) | ||||
|     """  # noqa | ||||
|     matches = re.findall(cfmt, value[CONF_FORMAT], flags=re.X) | ||||
|     matches = re.findall(cfmt, value[CONF_FORMAT], flags=re.VERBOSE) | ||||
|     if len(matches) != len(value[CONF_ARGS]): | ||||
|         raise cv.Invalid( | ||||
|             f"Found {len(matches)} printf-patterns ({', '.join(matches)}), but {len(value[CONF_ARGS])} args were given!" | ||||
|   | ||||
| @@ -155,8 +155,7 @@ def _read_audio_file_and_type(file_config): | ||||
|     import puremagic | ||||
|  | ||||
|     file_type: str = puremagic.from_string(data) | ||||
|     if file_type.startswith("."): | ||||
|         file_type = file_type[1:] | ||||
|     file_type = file_type.removeprefix(".") | ||||
|  | ||||
|     media_file_type = audio.AUDIO_FILE_TYPE_ENUM["NONE"] | ||||
|     if file_type in ("wav"): | ||||
|   | ||||
| @@ -27,8 +27,7 @@ SetDecelerationAction = stepper_ns.class_("SetDecelerationAction", automation.Ac | ||||
| def validate_acceleration(value): | ||||
|     value = cv.string(value) | ||||
|     for suffix in ("steps/s^2", "steps/s*s", "steps/s/s", "steps/ss", "steps/(s*s)"): | ||||
|         if value.endswith(suffix): | ||||
|             value = value[: -len(suffix)] | ||||
|         value = value.removesuffix(suffix) | ||||
|  | ||||
|     if value == "inf": | ||||
|         return 1e6 | ||||
| @@ -48,8 +47,7 @@ def validate_acceleration(value): | ||||
| def validate_speed(value): | ||||
|     value = cv.string(value) | ||||
|     for suffix in ("steps/s", "steps/s"): | ||||
|         if value.endswith(suffix): | ||||
|             value = value[: -len(suffix)] | ||||
|         value = value.removesuffix(suffix) | ||||
|  | ||||
|     if value == "inf": | ||||
|         return 1e6 | ||||
|   | ||||
| @@ -771,8 +771,7 @@ class MockObj(Expression): | ||||
|         if attr.startswith("P") and self.op not in ["::", ""]: | ||||
|             attr = attr[1:] | ||||
|             next_op = "->" | ||||
|         if attr.startswith("_"): | ||||
|             attr = attr[1:] | ||||
|         attr = attr.removeprefix("_") | ||||
|         return MockObj(f"{self.base}{self.op}{attr}", next_op) | ||||
|  | ||||
|     def __call__(self, *args: SafeExpType) -> "MockObj": | ||||
|   | ||||
| @@ -76,7 +76,7 @@ def get_include_text(): | ||||
|  | ||||
|  | ||||
| def replace_file_content(text, pattern, repl): | ||||
|     content_new, count = re.subn(pattern, repl, text, flags=re.M) | ||||
|     content_new, count = re.subn(pattern, repl, text, flags=re.MULTILINE) | ||||
|     return content_new, count | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -113,6 +113,7 @@ exclude = ['generated'] | ||||
| select = [ | ||||
|   "E",    # pycodestyle | ||||
|   "F",    # pyflakes/autoflake | ||||
|   "FURB", # refurb | ||||
|   "I",    # isort | ||||
|   "PERF", # performance | ||||
|   "PL",   # pylint | ||||
|   | ||||
| @@ -64,8 +64,10 @@ def main(): | ||||
|         for line in lines: | ||||
|             if line.startswith("BOARDS = {"): | ||||
|                 f.write("BOARDS = {\n") | ||||
|                 for board, info in sorted(boards.items()): | ||||
|                     f.write(TEMPLATE % (board, info["name"], info["variant"])) | ||||
|                 f.writelines( | ||||
|                     TEMPLATE % (board, info["name"], info["variant"]) | ||||
|                     for board, info in sorted(boards.items()) | ||||
|                 ) | ||||
|                 f.write("}\n") | ||||
|                 break | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user