Repository: hikari-py/hikari
Pull request #1719 (2023-09-18 13:15:09)

Bump flake8-isort from 6.0.0 to 6.1.0
Bumps [flake8-isort](https://github.com/gforcada/flake8-isort) from 6.0.0 to 6.1.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/gforcada/flake8-isort/blob/master/CHANGES.rst">flake8-isort's changelog</a>.</em></p>
<blockquote>
<h2>6.1.0 (2023-09-15)</h2>
<ul>
<li>
<p>Drop python 3.7 support.
[gforcada]</p>
</li>
<li>
<p>Add preliminary support to Python 3.12.
[gforcada]</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/gforcada/flake8-isort/commit/3164974e341a67e620364d80c14db45a91f5c029"><code>3164974</code></a> Preparing release 6.1.0</li>
<li><a href="https://github.com/gforcada/flake8-isort/commit/7eda85c2eaaaf611eed41c43d779ea2569142a79"><code>7eda85c</code></a> Merge pull request <a href="https://redirect.github.com/gforcada/flake8-isort/issues/143">#143</a> from gforcada/test-python-3-12-support</li>
<li><a href="https://github.com/gforcada/flake8-isort/commit/85d68d67cdbd1d2777b21b9fe49df7d73dadb9d2"><code>85d68d6</code></a> Update CHANGES</li>
<li><a href="https://github.com/gforcada/flake8-isort/commit/2d7e97fb28ede805c01b2b188e45f23ef54bec93"><code>2d7e97f</code></a> Use importlib.metadata</li>
<li><a href="https://github.com/gforcada/flake8-isort/commit/64d83fc1fdd70e5642088abb73ccb2aca28dd66b"><code>64d83fc</code></a> Test against python 3.12</li>
<li><a href="https://github.com/gforcada/flake8-isort/commit/873886950628e2eaddbda66b42ac97b9e2496dc9"><code>8738869</code></a> Merge pull request <a href="https://redirect.github.com/gforcada/flake8-isort/issues/146">#146</a> from gforcada/bump-dependencies</li>
<li><a href="https://github.com/gforcada/flake8-isort/commit/1f88ff3af9c78f6f3104454dd41aaecbc60a64f8"><code>1f88ff3</code></a> chore: increase verbosity of warnings</li>
<li><a href="https://github.com/gforcada/flake8-isort/commit/855c1d0224fce1a719080b1b442b4162a3faf88a"><code>855c1d0</code></a> fix: update dependencies</li>
<li><a href="https://github.com/gforcada/flake8-isort/commit/5853974ab331dcc9ba5af120544b6ce1954c071c"><code>5853974</code></a> Merge pull request <a href="https://redirect.github.com/gforcada/flake8-isort/issues/144">#144</a> from gforcada/drop-python-3-7</li>
<li><a href="https://github.com/gforcada/flake8-isort/commit/5a40b6e1e11bc6c3773aecbf99a46e65fb684517"><code>5a40b6e</code></a> Update CHANGES</li>
<li>Additional commits viewable in <a href="https://github.com/gforcada/flake8-isort/compare/6.0.0...6.1.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=flake8-isort&package-manager=pip&previous-version=6.0.0&new-version=6.1.0)](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 show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@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>


Patch:
diff --git a/changes/1720.bugfix.md b/changes/1720.bugfix.md
new file mode 100644
index 00000000..8fd9ed81
--- /dev/null
+++ b/changes/1720.bugfix.md
@@ -0,0 +1,1 @@
+Fix optional connection "revoked" field KeyError when fetching connections.
diff --git a/dev-requirements/flake8.txt b/dev-requirements/flake8.txt
index d9a8845d..54cecdf0 100644
--- a/dev-requirements/flake8.txt
+++ b/dev-requirements/flake8.txt
@@ -13,7 +13,7 @@ flake8-executable==2.1.3                # shebangs
 flake8-fixme==1.1.1                     # "fix me" counter
 flake8-functions==0.0.8                 # function linting
 flake8-html==0.4.3                      # html output
-flake8-isort==6.0.0                     # runs isort
+flake8-isort==6.1.0                     # runs isort
 flake8-mutable==1.2.0                   # mutable default argument detection
 flake8-pep3101==2.0.0                   # new-style format strings only
 flake8-print==5.0.0                     # complain about print statements in code
diff --git a/hikari/impl/entity_factory.py b/hikari/impl/entity_factory.py
index b5358e2a..a5f6cebf 100644
--- a/hikari/impl/entity_factory.py
+++ b/hikari/impl/entity_factory.py
@@ -572,7 +572,7 @@ def deserialize_own_connection(self, payload: data_binding.JSONObject) -> applic
             id=payload["id"],
             name=payload["name"],
             type=payload["type"],
-            is_revoked=payload["revoked"],
+            is_revoked=payload.get("revoked", False),
             integrations=integrations,
             is_verified=payload["verified"],
             is_friend_sync_enabled=payload["friend_sync"],


Test patch:
diff --git a/tests/hikari/impl/test_entity_factory.py b/tests/hikari/impl/test_entity_factory.py
index 47fd133c..35d07ed1 100644
--- a/tests/hikari/impl/test_entity_factory.py
+++ b/tests/hikari/impl/test_entity_factory.py
@@ -872,8 +872,11 @@ def test_deserialize_own_connection(self, entity_factory_impl, own_connection_pa
         assert own_connection.visibility == application_models.ConnectionVisibility.NONE
         assert isinstance(own_connection, application_models.OwnConnection)
 
-    def test_deserialize_own_connection_when_integrations_is_None(self, entity_factory_impl, own_connection_payload):
+    def test_deserialize_own_connection_with_nullable_and_optional_fields(
+        self, entity_factory_impl, own_connection_payload
+    ):
         del own_connection_payload["integrations"]
+        del own_connection_payload["revoked"]
         own_connection = entity_factory_impl.deserialize_own_connection(own_connection_payload)
         assert own_connection.id == "2513849648abc"
         assert own_connection.name == "FS"