Skip to content

many bug in python-miio(list will be update) #2027

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

Open
CyberMan571 opened this issue May 15, 2025 · 2 comments
Open

many bug in python-miio(list will be update) #2027

CyberMan571 opened this issue May 15, 2025 · 2 comments

Comments

@CyberMan571
Copy link

CyberMan571 commented May 15, 2025

        def wrap(self, ctx, func):
            gco = ctx.find_object(GlobalContextObject)
            if gco is not None and gco.output is not None:
                output_decorator = gco.output
            elif self.default_output:
                output_decorator = self.default_output
            else:
                output_decorator = format_output(f"Running command {self.command_name}")

            # Remove skip_autodetect before constructing the click.command
            self.kwargs.pop("skip_autodetect", None)

       
            for decorator in self.decorators:
                func = decorator(func)
                func = output_decorator(func)
            return click.command(self.command_name, **self.kwargs)(func)

click_common.py içindeki satırı bu şekilde değiştirince

Command.__init__() got an unexpected keyword argument 'default_output'
bu sorunu çözüldü

"The following issue was resolved by changing default_output=default_output to default_output=format_output: Command.init() got an unexpected keyword argument 'default_output'."

@CyberMan571
Copy link
Author

CyberMan571 commented May 15, 2025

[tool.poetry.group.dev.dependencies]
pytest = ">=6.2.5"
pytest-cov = "*"
pytest-mock = "*"
pytest-asyncio = "*"
pre-commit = "*"
doc8 = "*"
restructuredtext_lint = "*"
tox = "*"
isort = "*"
cffi = "*"
docformatter = "*"
mypy = {version = "*", markers = "platform_python_implementation == 'CPython'"}
coverage = {extras = ["toml"], version = "*"}

[tool.poetry.dev-dependencies] -> [tool.poetry.group.dev.dependencies] şeklinde değiştirildi.

python yeni sürümlerde desteklemeyeceğini söyledi.

@CyberMan571
Copy link
Author

miot_device.py

from enum import Enum, member

# partial is required here for str2bool, see https://stackoverflow.com/a/40339397
class MiotValueType(Enum):
    def _str2bool(x):
        """Helper to convert string to boolean."""
        return x.lower() in ("true", "1")

    Int = int
    Float = float
    Bool = member(partial(_str2bool))
    Str = str
/home/kali/my-venv/lib/python3.13/site-packages/miio/miot_device.py:23: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in enum.member() if you want to preserve the old behavior Bool = partial(_str2bool) 

bu hata duzeltildi 
def cast_miot_value(value_str: str, value_type_name: str):
    """
    Bir dize değeri (string) belirtilen MiotValueType'a dönüştürür (cast eder).
    """
    try:
        miot_type_member = MiotValueType[value_type_name]
        casting_func = miot_type_member.value
        return casting_func(value_str)
    except KeyError:
        raise ValueError(f"Geçersiz MiotValueType adı: {value_type_name}")
    except (ValueError, TypeError) as e:
         raise TypeError(f"'{value_str}' değerini '{value_type_name}' tipine dönüştürülemiyor: {e}")

bunu da ekleyebilirsin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant