Coder Social home page Coder Social logo

homeassistant-stubs's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar kapji avatar loopj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

loopj

homeassistant-stubs's Issues

Syntax errors in generated stubs

Hi there,

I've noticed this problem in recent versions:

/nix/store/cm7xda19nh3bb326y5qv56750ni3dz49-python3.10-homeassistant-stubs-2022.10.4/lib/python3.10/site-packages/homeassistant-stubs/components/bluetooth/models.pyi:27: error: invalid syntax
Found 1 error in 1 file (errors prevented further checking)                   

This appears to be due to python/mypy#12441, so not really a bug in this project (hence feel free to just close the issue), but I thought I should note it.

I managed to work around it with the following hacky sed commands on the installed .pyi files:

find $out -name "*.pyi" -print0 | xargs -0 sed -i 's/, \*,/, *args,/g'                                                                                                                                                            
find $out -name "*.pyi" -print0 | xargs -0 sed -i 's/, \*\*)/, **kwargs)/g'    

`Generic[_T]` lost on `DataUpdateCoordinator`

https://github.com/home-assistant/core/blob/3d8e8293d67094da383bb57f518802784e1fe3a5/homeassistant/helpers/update_coordinator.py#L55 vs

class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol):
-- Generic[_T] got lost.

I suppose this is why for something like https://github.com/scop/home-assistant-jatekukko/blob/66ceb35160f20026d3f638e7696513a585a5436f/custom_components/jatekukko/coordinator.py#L42, mypy gives:

custom_components/jatekukko/coordinator.py:42: error: "DataUpdateCoordinator" expects no type arguments, but 1 given  [type-arg]

Similarly for BaseCoordinatorEntity.

This is with homeassistant-stubs 2023.2.4.

Check installation on Windows

FYI, when I try to use the current packages on a windows Python 3.11 installation, I run into the issue that aiohttp==3.8.1 requires compilation that does "fails".
I can install 3.7.4,3.8.2,3.8.3 but not 3.8.0 or 3.8.1

`total=False` lost on `DeviceInfo`

Perhaps the same issue as #290, but thought I'd report it anyway:

https://github.com/home-assistant/core/blob/d0a9d658754b5c106571a92a79afdf4c7c8488a7/homeassistant/helpers/entity.py#L163 vs


-- total=False got lost.

I suppose this is why for something like https://github.com/scop/home-assistant-jatekukko/blob/66ceb35160f20026d3f638e7696513a585a5436f/custom_components/jatekukko/coordinator.py#L30, mypy gives:

custom_components/jatekukko/coordinator.py:30: error: Missing keys ("connections", "default_name", "manufacturer", "model", "suggested_area", "sw_version", "hw_version", "via_device") for TypedDict "DeviceInfo"  [typeddict-item]

This is with homeassistant-stubs 2023.2.4.

`homeassistant.components.text` missing library stubs or py.typed marker

Thanks for creating these stubs.

I'm seeing the following error when running mypy on my custom_component:

Skipping analyzing "homeassistant.components.text": module is installed, but missing library stubs or py.typed marker\

It seems that stubs aren't being generated for some reason for this module, any ideas why?

mypy: error: expected '(' with 2023.8.2

I use homeassistant-stubs in the https://github.com/custom-components/feedparser repository.

I have bumped into an issue with the latest version of stubs.
https://github.com/custom-components/feedparser/actions/runs/5876164929/job/15933776158?pr=91#step:4:145

 /home/runner/.cache/pre-commit/repoa5dodlk1/py_env-python3.11/lib/python3.11/site-packages/homeassistant-stubs/components/sensor/__init__.pyi:26: error: expected '('  [syntax]

The issue seems to be in stubs itself.

Syntax error in latest

Note init.pyi

py311: commands[0]> mypy -p custom_components.hassmpris
.tox/py311/lib/python3.11/site-packages/homeassistant-stubs/components/media_player/__init__.pyi:77: error: expected '('  [syntax]
Found 1 error in 1 file (errors prevented further checking)
py311: exit 2 (0.30 seconds) /home/user/Projects/homeassistant-hassmpris> mypy -p custom_components.hassmpris pid=146189
  py311: FAIL code 2 (5.18=setup[4.88]+cmd[0.30] seconds)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.