Explorar o código

chore(pre-commit.ci): pre-commit autoupdate (#446)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
pre-commit-ci[bot] hai 3 días
pai
achega
bdde342692
Modificáronse 3 ficheiros con 4 adicións e 18 borrados
  1. 2 2
      .pre-commit-config.yaml
  2. 0 1
      pyproject.toml
  3. 2 15
      switchbot/enum.py

+ 2 - 2
.pre-commit-config.yaml

@@ -9,7 +9,7 @@ ci:
 
 repos:
   - repo: https://github.com/commitizen-tools/commitizen
-    rev: v4.12.0
+    rev: v4.13.8
     hooks:
       - id: commitizen
         stages: [commit-msg]
@@ -38,7 +38,7 @@ repos:
       - id: pyupgrade
         args: [--py311-plus]
   - repo: https://github.com/astral-sh/ruff-pre-commit
-    rev: v0.14.13
+    rev: v0.15.2
     hooks:
       - id: ruff
         args: [--fix]

+ 0 - 1
pyproject.toml

@@ -25,7 +25,6 @@ ignore = [
     "S110", # `try`-`except`-`pass` detected, consider logging the exception
     "D106", # Missing docstring in public nested class
     "UP007", # typer needs Optional syntax
-    "UP038", # Use `X | Y` in `isinstance` is slower
     "S603", #  check for execution of untrusted input
     "S105", # possible hard coded creds
     "TID252", # not for this lib

+ 2 - 15
switchbot/enum.py

@@ -2,19 +2,6 @@
 
 from __future__ import annotations
 
-from enum import Enum
-from typing import Any, Self
+from enum import StrEnum
 
-
-class StrEnum(str, Enum):
-    """Partial backport of Python 3.11's StrEnum for our basic use cases."""
-
-    def __new__(cls, value: str, *args: Any, **kwargs: Any) -> Self:
-        """Create a new StrEnum instance."""
-        if not isinstance(value, str):
-            raise TypeError(f"{value!r} is not a string")
-        return super().__new__(cls, value, *args, **kwargs)
-
-    def __str__(self) -> str:
-        """Return self.value."""
-        return str(self.value)
+__all__ = ["StrEnum"]