Skip to content
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

Add stubs for influxdb-client #9429

Merged
merged 11 commits into from Dec 30, 2022
Merged

Add stubs for influxdb-client #9429

merged 11 commits into from Dec 30, 2022

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Dec 30, 2022

Except for client.util.date_utils, the stubs were auto-generated and then manually fixed/cleaned up. This is best reviewed commit by commit, where the first commit is just the output of create_baseline_stubs.

Upstream annotations were cleaned up, but not reviewed. I'm sure that the many dict/list annotations could be made more lenient, but I didn't check review that.

srittau added 6 commits Dec 30, 2022
* Fix broken imports
* Use built-in generics, pipe unions, and collection.abc
* Add missing generics
* Fix duplicate definitions
@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator Author

srittau commented Dec 30, 2022

The homeassistant primer warning is genuine. The kwargs dict needs a proper type annotation in the source code.

@github-actions

This comment has been minimized.

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Looks good, two nits

| bytes
| Iterable[bytes]
| _Observable
| NamedTuple
Copy link
Member

@JelleZijlstra JelleZijlstra Dec 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mypy accepts NamedTuple as a type annotation but I'm not sure that's a feature we can rely on in typeshed.

Copy link
Collaborator Author

@srittau srittau Dec 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used a type alias to tuple[Any, ...] for now, similar to what I did to dataclass.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2022

Diff from mypy_primer, showing the effect of this PR on open source code:

core (https://github.com/home-assistant/core)
+ homeassistant/components/influxdb/__init__.py:352: error: Argument 1 to "InfluxDBClient" has incompatible type "**Dict[str, int]"; expected "Optional[str]"  [arg-type]
+ homeassistant/components/influxdb/__init__.py:352: error: Argument 1 to "InfluxDBClient" has incompatible type "**Dict[str, int]"; expected "bool"  [arg-type]
+ homeassistant/components/influxdb/__init__.py:352: error: Argument 1 to "InfluxDBClient" has incompatible type "**Dict[str, int]"; expected "Optional[Dict[Any, Any]]"  [arg-type]

@JelleZijlstra JelleZijlstra merged commit 3e00c01 into python:main Dec 30, 2022
44 checks passed
@srittau srittau deleted the influx branch Jan 1, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants