Skip to content

Commit d63403e

Browse files
authored
Merge branch 'master' into feat/interaction-integrations-methods
2 parents 0d09f96 + 52ee8fb commit d63403e

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ These changes are available on the `master` branch, but have not yet been releas
6464
([#2624](https://github.com/Pycord-Development/pycord/pull/2624))
6565
- Fixed `AttributeError` when accessing `Member.guild_permissions` for user installed
6666
apps. ([#2650](https://github.com/Pycord-Development/pycord/pull/2650))
67+
- Fixed type annotations of cached properties.
68+
([#2635](https://github.com/Pycord-Development/pycord/issues/2635))
6769

6870
### Changed
6971

discord/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ def _handle_ready(self) -> None:
310310

311311
@property
312312
def latency(self) -> float:
313-
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
313+
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. If no websocket
314+
is present, this returns ``nan``, and if no heartbeat has been received yet, this returns ``float('inf')``.
314315
315316
This could be referred to as the Discord WebSocket protocol latency.
316317
"""

discord/gateway.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,9 @@ async def received_message(self, msg, /):
581581

582582
@property
583583
def latency(self) -> float:
584-
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds."""
584+
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. If no heartbeat
585+
has been received yet this returns ``float('inf')``.
586+
"""
585587
heartbeat = self._keep_alive
586588
return float("inf") if heartbeat is None else heartbeat.latency
587589

discord/shard.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ async def connect(self) -> None:
294294

295295
@property
296296
def latency(self) -> float:
297-
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds for this shard."""
297+
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds for this shard. If no heartbeat
298+
has been received yet this returns ``float('inf')``.
299+
"""
298300
return self._parent.ws.latency
299301

300302
def is_ws_ratelimited(self) -> bool:

discord/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
Iterator,
5757
Literal,
5858
Mapping,
59-
NewType,
6059
Protocol,
6160
Sequence,
6261
TypeVar,
@@ -151,7 +150,7 @@ def __get__(self, instance, owner):
151150
class _RequestLike(Protocol):
152151
headers: Mapping[str, Any]
153152

154-
cached_property = NewType("cached_property", property)
153+
cached_property = property
155154

156155
P = ParamSpec("P")
157156

requirements/dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-r _.txt
2-
pylint~=3.3.1
3-
pytest~=8.3.3
2+
pylint~=3.3.2
3+
pytest~=8.3.4
44
pytest-asyncio~=0.23.8
55
# pytest-order~=1.0.1
66
mypy~=1.13.0

requirements/docs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ sphinxext-opengraph==0.9.1
66
sphinx-copybutton==0.5.2
77
furo==2024.8.6
88
sphinx-autodoc-typehints==2.2.3
9-
sphinx-intl==2.3.0
9+
sphinx-intl==2.3.1
1010
typing_extensions==4.12.2
1111
levenshtein==0.26.1

0 commit comments

Comments
 (0)