Repository: hikari-py/hikari
Pull request #943 (2021-12-23 13:04:08)

Bump mypy from 0.921 to 0.930
Bumps [mypy](https://github.com/python/mypy) from 0.921 to 0.930.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/python/mypy/commit/5d765e71fa1313830b485a4e9f18a6553b221426"><code>5d765e7</code></a> Bump version to 0.930</li>
<li><a href="https://github.com/python/mypy/commit/aaa2685a24b1205e7a5ed28a69614b920c572e5b"><code>aaa2685</code></a> Various small documentation updates (<a href="https://github-redirect.dependabot.com/python/mypy/issues/11817">#11817</a>)</li>
<li><a href="https://github.com/python/mypy/commit/3b913a452dcf870abfac3c41f3119c0d7007144d"><code>3b913a4</code></a> Documents explicit type aliases (<a href="https://github-redirect.dependabot.com/python/mypy/issues/11800">#11800</a>)</li>
<li><a href="https://github.com/python/mypy/commit/768ce5bb66605e298449f4c5626d5a9b1399d455"><code>768ce5b</code></a> Allow calling a function with name '_' (<a href="https://github-redirect.dependabot.com/python/mypy/issues/11810">#11810</a>)</li>
<li><a href="https://github.com/python/mypy/commit/b31b06b7e6b7305efc15a6fdc16317ddffc367da"><code>b31b06b</code></a> Enums with annotations and no values are fine to be subclassed (<a href="https://github-redirect.dependabot.com/python/mypy/issues/11579">#11579</a>)</li>
<li><a href="https://github.com/python/mypy/commit/750b77df67748e22722158ea5fce3fba083ced25"><code>750b77d</code></a> [0.930 backport] update curses stubs, cherry pick fix (<a href="https://github-redirect.dependabot.com/python/mypy/issues/11785">#11785</a>)</li>
<li><a href="https://github.com/python/mypy/commit/7830d6db45986f66bb077dec2792e4dc9e6266d9"><code>7830d6d</code></a> [0.930 backport] Fix PathLike regression (<a href="https://github-redirect.dependabot.com/python/mypy/issues/11775">#11775</a>)</li>
<li><a href="https://github.com/python/mypy/commit/5919e92d94e8186844336d1c886d935dd1811417"><code>5919e92</code></a> Fix tests for Python 3.10.1 (2) (<a href="https://github-redirect.dependabot.com/python/mypy/issues/11756">#11756</a>)</li>
<li><a href="https://github.com/python/mypy/commit/d59546811a47ad42f5c78f11b8cc54163fb25a12"><code>d595468</code></a> Update version to 0.930+dev (<a href="https://github-redirect.dependabot.com/python/mypy/issues/11770">#11770</a>)</li>
<li><a href="https://github.com/python/mypy/commit/22ab84acc3f6174905a05ddadab94b6c2d83f9a1"><code>22ab84a</code></a> Fix inferring constrainta from param spec callable against Any (<a href="https://github-redirect.dependabot.com/python/mypy/issues/11725">#11725</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/python/mypy/compare/v0.921...v0.930">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=mypy&package-manager=pip&previous-version=0.921&new-version=0.930)](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>


Patch:
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 00000000..3ce492ee
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,9 @@
+# Reporting Security Vulnerabilities
+
+**We urge you not to file a bug report in this GitHub repository since they are open for anyone to see**
+
+Instead, we encourage you to reach out to the maintainer team so we can assess the problem and later disclose it
+responsibly.
+
+If you believe you have found a security-related bug, please contact [davfsa](mailto:davfsa@gmail.com) and/or
+[FasterSpeeding](mailto:lucina@lmbyrne.dev).
diff --git a/changes/939.feature.md b/changes/939.feature.md
new file mode 100644
index 00000000..938b247b
--- /dev/null
+++ b/changes/939.feature.md
@@ -0,0 +1,1 @@
+Add `flags` attribute to Application
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 3582c952..6d4c46dc 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -28,7 +28,7 @@ sphobjinv==2.1
 # TYPE CHECKING #
 #################
 
-mypy==0.921
+mypy==0.930
 pyright==0.0.13
 
 #######################
diff --git a/hikari/applications.py b/hikari/applications.py
index 2eb0505e..6566d344 100644
--- a/hikari/applications.py
+++ b/hikari/applications.py
@@ -551,6 +551,9 @@ class Application(guilds.PartialApplication):
     rpc_origins: typing.Optional[typing.Sequence[str]] = attr.field(eq=False, hash=False, repr=False)
     """A collection of this application's RPC origin URLs, if RPC is enabled."""
 
+    flags: ApplicationFlags = attr.field(eq=False, hash=False, repr=False)
+    """The flags for this application."""
+
     public_key: bytes = attr.field(eq=False, hash=False, repr=False)
     """The key used for verifying interaction and GameSDK payload signatures."""
 
diff --git a/hikari/impl/entity_factory.py b/hikari/impl/entity_factory.py
index 134e0c85..1aecadcf 100644
--- a/hikari/impl/entity_factory.py
+++ b/hikari/impl/entity_factory.py
@@ -347,6 +347,7 @@ def deserialize_application(self, payload: data_binding.JSONObject) -> applicati
             rpc_origins=payload.get("rpc_origins"),
             summary=payload["summary"] or None,
             public_key=bytes.fromhex(payload["verify_key"]),
+            flags=application_models.ApplicationFlags(payload["flags"]),
             icon_hash=payload.get("icon"),
             team=team,
             guild_id=snowflakes.Snowflake(payload["guild_id"]) if "guild_id" in payload else None,
diff --git a/hikari/impl/event_manager_base.py b/hikari/impl/event_manager_base.py
index 4711d485..8f972fd2 100644
--- a/hikari/impl/event_manager_base.py
+++ b/hikari/impl/event_manager_base.py
@@ -68,7 +68,7 @@
 
 
 def _generate_weak_listener(
-    reference: weakref.WeakMethod,
+    reference: weakref.WeakMethod[typing.Any],
 ) -> typing.Callable[[event_manager_.EventT], typing.Coroutine[typing.Any, typing.Any, None]]:
     async def call_weak_method(event: event_manager_.EventT) -> None:
         method = reference()
@@ -235,7 +235,7 @@ def open(self) -> None:
             # listener with a weakref then try to close this on deletion. While this may lead to their consoles being
             # spammed, this is a small price to pay as it'll be way more obvious what's wrong than if we just left them
             # with a vague ominous memory leak.
-            reference = weakref.WeakMethod(self._listener)  # type: ignore[arg-type]
+            reference = weakref.WeakMethod(self._listener)
             listener = _generate_weak_listener(reference)
             self._registered_listener = listener
             self._event_manager.subscribe(self._event_type, listener)
diff --git a/hikari/internal/enums.pyi b/hikari/internal/enums.pyi
index 9a4a703a..5633c147 100644
--- a/hikari/internal/enums.pyi
+++ b/hikari/internal/enums.pyi
@@ -63,12 +63,19 @@ class Flag(__enum.IntFlag):
     def __len__(self) -> int: ...
     @staticmethod
     def __new__(cls: __Type[__FlagT], value: int = 0) -> __FlagT: ...
-    isdisjoint = is_disjoint
-    issuperset = is_superset
-    symmetricdifference = symmetric_difference
-    __contains__ = issubset = is_subset
-    __rand__ = __and__ = intersection
-    __ror__ = __or__ = union
-    __rsub__ = __sub__ = difference
-    __rxor__ = __xor__ = symmetric_difference
-    __invert__ = invert
+
+    # Aliases
+    def isdisjoint(self: __FlagT, other: __Union[int, __FlagT]) -> bool: ... # is_disjoint
+    def issuperset(self: __FlagT, other: __Union[int, __FlagT]) -> bool: ... # is_superset
+    def symmetricdifference(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # symmetric_difference
+    def issubset(self: __FlagT, other: __Union[int, __FlagT]) -> bool: ...  # is_subset
+    def __contains__(self: __FlagT, other: __Union[int, __FlagT]) -> bool: ...  # is_subset
+    def __rand__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # intersection
+    def __and__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # intersection
+    def __ror__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # union
+    def __or__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # union
+    def __rsub__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # difference
+    def __sub__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # difference
+    def __rxor__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # symmetric_difference
+    def __xor__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # symmetric_difference
+    def __invert__(self: __FlagT) -> __FlagT: ... # invert


Test patch:
diff --git a/tests/hikari/impl/test_entity_factory.py b/tests/hikari/impl/test_entity_factory.py
index 3fa82441..7a78fb2c 100644
--- a/tests/hikari/impl/test_entity_factory.py
+++ b/tests/hikari/impl/test_entity_factory.py
@@ -202,6 +202,7 @@ def application_payload(self, owner_payload, user_payload):
             "owner": owner_payload,
             "summary": "not a blank string",
             "verify_key": "698c5d0859abb686be1f8a19e0e7634d8471e33817650f9fb29076de227bca90",
+            "flags": 65536,
             "team": {
                 "icon": "hashtag",
                 "id": "202020202",
@@ -237,6 +238,7 @@ def test_deserialize_application(
             application.public_key
             == b'i\x8c]\x08Y\xab\xb6\x86\xbe\x1f\x8a\x19\xe0\xe7cM\x84q\xe38\x17e\x0f\x9f\xb2\x90v\xde"{\xca\x90'
         )
+        assert application.flags == application_models.ApplicationFlags.VERIFICATION_PENDING_GUILD_LIMIT
         assert application.privacy_policy_url == "hahaha://hahaha"
         assert application.terms_of_service_url == "haha2:2h2h2h2"
         assert application.icon_hash == "iwiwiwiwiw"
@@ -271,6 +273,7 @@ def test_deserialize_application_with_unset_fields(self, entity_factory_impl, mo
                 "bot_public": True,
                 "bot_require_code_grant": False,
                 "verify_key": "1232313223",
+                "flags": 0,
                 "owner": owner_payload,
             }
         )
@@ -298,6 +301,7 @@ def test_deserialize_application_with_null_fields(self, entity_factory_impl, moc
                 "bot_public": True,
                 "bot_require_code_grant": False,
                 "verify_key": "1232313223",
+                "flags": 0,
             }
         )