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 type hints for Group class #447

Merged
merged 19 commits into from
Mar 8, 2022
Merged

Add type hints for Group class #447

merged 19 commits into from
Mar 8, 2022

Conversation

ggravlingen
Copy link
Member

No description provided.

@ggravlingen
Copy link
Member Author

Notes for myself for tomorrow, check if ID is always an int. If so, we should make necessary changes everywhere.

pytradfri/group.py Outdated Show resolved Hide resolved
@ggravlingen
Copy link
Member Author

Notes for myself for tomorrow, check if ID is always an int. If so, we should make necessary changes everywhere.

id (key 9003) is an int in all our examples, I wonder why path is typed as a list of strings?

pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/resource.py Outdated Show resolved Hide resolved
tests/test_group.py Outdated Show resolved Hide resolved
ggravlingen and others added 2 commits March 6, 2022 20:45
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
@ggravlingen
Copy link
Member Author

Should we just convert the ints to string to fit the current implementation of path and then address this later?

@MartinHjelmare
Copy link
Contributor

Yeah, that's fine.

@ggravlingen
Copy link
Member Author

Yeah, that's fine.

OK, I'll fix and this here and merge the other PR where that has already been done.

pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/group.py Outdated Show resolved Hide resolved
pytradfri/resource.py Outdated Show resolved Hide resolved
Copy link
Contributor

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Great!

@ggravlingen ggravlingen merged commit 92bae26 into master Mar 8, 2022
@ggravlingen ggravlingen deleted the type-hint-group branch March 8, 2022 21:02
MartinHjelmare pushed a commit that referenced this pull request Sep 12, 2022
Bumps [pydantic](https://github.com/pydantic/pydantic) from 1.10.1 to
1.10.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/pydantic/pydantic/releases">pydantic's
releases</a>.</em></p>
<blockquote>
<h2>v1.10.2 (2022-09-05)</h2>
<ul>
<li><strong>Revert Change:</strong> Revert percent encoding of URL parts
which was originally added in <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4224">#4224</a>,
<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4470">#4470</a>
by <a
href="https://github.com/samuelcolvin"><code>@​samuelcolvin</code></a></li>
<li>Prevent long (length &gt; <code>4_300</code>) strings/bytes as input
to int fields, see <a
href="https://github-redirect.dependabot.com/python/cpython/issues/95778">python/cpython#95778</a>
and <a
href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735">CVE-2020-10735</a>,
<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/1477">#1477</a>
by <a
href="https://github.com/samuelcolvin"><code>@​samuelcolvin</code></a></li>
<li>fix: dataclass wrapper was not always called, <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4477">#4477</a>
by <a
href="https://github.com/PrettyWood"><code>@​PrettyWood</code></a></li>
<li>Use <code>tomllib</code> on Python 3.11 when parsing
<code>mypy</code> configuration, <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4476">#4476</a>
by <a
href="https://github.com/hauntsaninja"><code>@​hauntsaninja</code></a></li>
<li>Basic fix of <code>GenericModel</code> cache to detect order of
arguments in <code>Union</code> models, <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4474">#4474</a>
by <a
href="https://github.com/sveinugu"><code>@​sveinugu</code></a></li>
<li>Fix mypy plugin when using bare types like <code>list</code> and
<code>dict</code> as <code>default_factory</code>, <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4457">#4457</a>
by <a
href="https://github.com/samuelcolvin"><code>@​samuelcolvin</code></a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/pydantic/pydantic/compare/v1.10.1...v1.10.2">https://github.com/pydantic/pydantic/compare/v1.10.1...v1.10.2</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pydantic/pydantic/blob/main/HISTORY.md">pydantic's
changelog</a>.</em></p>
<blockquote>
<h2>v1.10.2 (2022-09-05)</h2>
<ul>
<li><strong>Revert Change:</strong> Revert percent encoding of URL parts
which was originally added in <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4224">#4224</a>,
<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4470">#4470</a>
by <a
href="https://github.com/samuelcolvin"><code>@​samuelcolvin</code></a></li>
<li>Prevent long (length &gt; <code>4_300</code>) strings/bytes as input
to int fields, see
<a
href="https://github-redirect.dependabot.com/python/cpython/issues/95778">python/cpython#95778</a>
and
<a
href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735">CVE-2020-10735</a>,
<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/1477">#1477</a>
by <a
href="https://github.com/samuelcolvin"><code>@​samuelcolvin</code></a></li>
<li>fix: dataclass wrapper was not always called, <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4477">#4477</a>
by <a
href="https://github.com/PrettyWood"><code>@​PrettyWood</code></a></li>
<li>Use <code>tomllib</code> on Python 3.11 when parsing
<code>mypy</code> configuration, <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4476">#4476</a>
by <a
href="https://github.com/hauntsaninja"><code>@​hauntsaninja</code></a></li>
<li>Basic fix of <code>GenericModel</code> cache to detect order of
arguments in <code>Union</code> models, <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4474">#4474</a>
by <a
href="https://github.com/sveinugu"><code>@​sveinugu</code></a></li>
<li>Fix mypy plugin when using bare types like <code>list</code> and
<code>dict</code> as <code>default_factory</code>, <a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4457">#4457</a>
by <a
href="https://github.com/samuelcolvin"><code>@​samuelcolvin</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pydantic/pydantic/commit/bc74342b39e2b1d0115364cf2aa90d8f874cb9b5"><code>bc74342</code></a>
prepare for v1.10.2</li>
<li><a
href="https://github.com/pydantic/pydantic/commit/f1e988315722c38a7acb2cdbf08823ee45eb07fb"><code>f1e9883</code></a>
fix: dataclass wrapper was not always called (<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4484">#4484</a>)</li>
<li><a
href="https://github.com/pydantic/pydantic/commit/91bb8d44822a6dfff87ff8881531e894a89692a8"><code>91bb8d4</code></a>
Basic fix of GenericModel cache to detect order of args in Union models
[#447...</li>
<li><a
href="https://github.com/pydantic/pydantic/commit/eccd85e4d012e70ffbd81f379179da900d4621c5"><code>eccd85e</code></a>
prevent long strings as int inputs (<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4480">#4480</a>)</li>
<li><a
href="https://github.com/pydantic/pydantic/commit/a4367c1c5870b3eecdb4ce1ad5dd7865185dbda5"><code>a4367c1</code></a>
Revert percent encoding in URLs. (<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4470">#4470</a>)</li>
<li><a
href="https://github.com/pydantic/pydantic/commit/02cf7f5d7b56795574dd5083224c104ae95aaf2d"><code>02cf7f5</code></a>
fix mypy with <code>default_factory=list</code> etc. (<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4471">#4471</a>)</li>
<li><a
href="https://github.com/pydantic/pydantic/commit/5a2ddec9b2fa31c73b1d3d77ea4336a59427b4de"><code>5a2ddec</code></a>
Use tomllib on Python 3.11 (<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4476">#4476</a>)</li>
<li><a
href="https://github.com/pydantic/pydantic/commit/317bef33b06e05f65f57b1ba009dfd949b462689"><code>317bef3</code></a>
build(deps): bump black from 22.6.0 to 22.8.0 (<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4465">#4465</a>)</li>
<li><a
href="https://github.com/pydantic/pydantic/commit/2add8a94821fb9296aebd66fec22638f1ce6033b"><code>2add8a9</code></a>
build(deps): bump hypothesis from 6.54.3 to 6.54.4 (<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4464">#4464</a>)</li>
<li><a
href="https://github.com/pydantic/pydantic/commit/f1fb4f20b4625278e526d63500110aa908d1353e"><code>f1fb4f2</code></a>
build(deps): bump mkdocs-material from 8.4.0 to 8.4.2 (<a
href="https://github-redirect.dependabot.com/pydantic/pydantic/issues/4463">#4463</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/pydantic/pydantic/compare/v1.10.1...v1.10.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pydantic&package-manager=pip&previous-version=1.10.1&new-version=1.10.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

2 participants