From 5355945e48820585536f31c3df1230350dbd55a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 00:12:10 +0100 Subject: [PATCH 1/7] chore(deps-dev): bump bandit from 1.7.10 to 1.8.0 in the minor-version-bumps group (#2657) chore(deps-dev): bump bandit in the minor-version-bumps group Bumps the minor-version-bumps group with 1 update: [bandit](https://github.com/PyCQA/bandit). Updates `bandit` from 1.7.10 to 1.8.0 - [Release notes](https://github.com/PyCQA/bandit/releases) - [Commits](https://github.com/PyCQA/bandit/compare/1.7.10...1.8.0) --- updated-dependencies: - dependency-name: bandit dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor-version-bumps ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index b2a24b831c..83961bbfdc 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -7,5 +7,5 @@ mypy~=1.13.0 coverage~=7.6 pre-commit==4.0.1 codespell==2.3.0 -bandit==1.7.10 +bandit==1.8.0 flake8==7.1.1 From 1b2972be2bb9c2af9f2831c4af597ff2a05f4c87 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 00:20:50 +0100 Subject: [PATCH 2/7] chore(deps): update setuptools requirement from <=75.5.0,>=62.6 to >=62.6,<=75.6.0 (#2654) chore(deps): update setuptools requirement Updates the requirements on [setuptools](https://github.com/pypa/setuptools) to permit the latest version. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v72.2.0...v75.6.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9b9c93be52..97095f7fc0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "setuptools>=62.6,<=75.5.0", + "setuptools>=62.6,<=75.6.0", "setuptools-scm>=6.2,<=8.1.0", ] build-backend = "setuptools.build_meta" From da90e3375f5d86e1c223aabad90da90954b70949 Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 28 Nov 2024 22:08:36 +0100 Subject: [PATCH 3/7] docs: :memo: Better documentation for latency properties (#2653) :memo: Better documentation for latency methods --- discord/client.py | 3 ++- discord/gateway.py | 4 +++- discord/shard.py | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/discord/client.py b/discord/client.py index cbc22813fd..4db53e33e3 100644 --- a/discord/client.py +++ b/discord/client.py @@ -310,7 +310,8 @@ def _handle_ready(self) -> None: @property def latency(self) -> float: - """Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. + """Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. If no websocket + is present, this returns ``nan``, and if no heartbeat has been received yet, this returns ``float('inf')``. This could be referred to as the Discord WebSocket protocol latency. """ diff --git a/discord/gateway.py b/discord/gateway.py index 47d4853a65..4af59f3864 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -581,7 +581,9 @@ async def received_message(self, msg, /): @property def latency(self) -> float: - """Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.""" + """Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. If no heartbeat + has been received yet this returns ``float('inf')``. + """ heartbeat = self._keep_alive return float("inf") if heartbeat is None else heartbeat.latency diff --git a/discord/shard.py b/discord/shard.py index 8e84f5b8f2..fd6a08a047 100644 --- a/discord/shard.py +++ b/discord/shard.py @@ -294,7 +294,9 @@ async def connect(self) -> None: @property def latency(self) -> float: - """Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds for this shard.""" + """Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds for this shard. If no heartbeat + has been received yet this returns ``float('inf')``. + """ return self._parent.ws.latency def is_ws_ratelimited(self) -> bool: From f3fc4b12788ad5f97cc62086461a4363dc50e9de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 01:19:54 +0100 Subject: [PATCH 4/7] chore(deps): bump sphinx-intl from 2.3.0 to 2.3.1 in the patch-version-bumps group (#2663) chore(deps): bump sphinx-intl in the patch-version-bumps group Bumps the patch-version-bumps group with 1 update: [sphinx-intl](https://github.com/sphinx-doc/sphinx-intl). Updates `sphinx-intl` from 2.3.0 to 2.3.1 - [Release notes](https://github.com/sphinx-doc/sphinx-intl/releases) - [Changelog](https://github.com/sphinx-doc/sphinx-intl/blob/master/CHANGES.rst) - [Commits](https://github.com/sphinx-doc/sphinx-intl/compare/2.3.0...2.3.1) --- updated-dependencies: - dependency-name: sphinx-intl dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-version-bumps ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/docs.txt b/requirements/docs.txt index 335b420074..d1adea5fc0 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -6,6 +6,6 @@ sphinxext-opengraph==0.9.1 sphinx-copybutton==0.5.2 furo==2024.8.6 sphinx-autodoc-typehints==2.2.3 -sphinx-intl==2.3.0 +sphinx-intl==2.3.1 typing_extensions==4.12.2 levenshtein==0.26.1 From 397edcbcfec8e57219ec4a0e17b632929d403584 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 01:20:48 +0100 Subject: [PATCH 5/7] chore(deps-dev): update pytest requirement from ~=8.3.3 to ~=8.3.4 (#2664) Updates the requirements on [pytest](https://github.com/pytest-dev/pytest) to permit the latest version. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.3.3...8.3.4) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 83961bbfdc..8a57a39e0d 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,6 +1,6 @@ -r _.txt pylint~=3.3.1 -pytest~=8.3.3 +pytest~=8.3.4 pytest-asyncio~=0.23.8 # pytest-order~=1.0.1 mypy~=1.13.0 From db5b466a2f104032cbc1b80cb777b4b896ad4df4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 01:28:58 +0100 Subject: [PATCH 6/7] chore(deps-dev): update pylint requirement from ~=3.3.1 to ~=3.3.2 (#2665) Updates the requirements on [pylint](https://github.com/pylint-dev/pylint) to permit the latest version. - [Release notes](https://github.com/pylint-dev/pylint/releases) - [Commits](https://github.com/pylint-dev/pylint/compare/v3.3.1...v3.3.2) --- updated-dependencies: - dependency-name: pylint dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/dev.txt b/requirements/dev.txt index 8a57a39e0d..83326ccb3e 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,5 +1,5 @@ -r _.txt -pylint~=3.3.1 +pylint~=3.3.2 pytest~=8.3.4 pytest-asyncio~=0.23.8 # pytest-order~=1.0.1 From 52ee8fbfe293735f0d90044dc763249eab0b4878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A4ssin=20Aouani?= <123012687+probablyjassin@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:59:39 +0100 Subject: [PATCH 7/7] fix: use `property` instead of `NewType(...)` to fix type annotations for ApplicationContext attributes (#2636) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jässin Aouani <123012687+probablyjassin@users.noreply.github.com> Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Paillat Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Co-authored-by: Lala Sabathil --- CHANGELOG.md | 2 ++ discord/utils.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9547fbafc..1bda9a0ecc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2624](https://github.com/Pycord-Development/pycord/pull/2624)) - Fixed `AttributeError` when accessing `Member.guild_permissions` for user installed apps. ([#2650](https://github.com/Pycord-Development/pycord/pull/2650)) +- Fixed type annotations of cached properties. + ([#2635](https://github.com/Pycord-Development/pycord/issues/2635)) ### Changed diff --git a/discord/utils.py b/discord/utils.py index fbcf9c1f31..c04ef0b0bd 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -56,7 +56,6 @@ Iterator, Literal, Mapping, - NewType, Protocol, Sequence, TypeVar, @@ -151,7 +150,7 @@ def __get__(self, instance, owner): class _RequestLike(Protocol): headers: Mapping[str, Any] - cached_property = NewType("cached_property", property) + cached_property = property P = ParamSpec("P")