Skip to content

Commit

Permalink
Merge branch 'master' into fix-help-duplicate-cmds
Browse files Browse the repository at this point in the history
Signed-off-by: Paillat <[email protected]>
  • Loading branch information
Paillat-dev authored Dec 9, 2024
2 parents 14ddc85 + 52ee8fb commit cf810ca
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
- Fixed `BridgeCommand` duplicate in default help command.
([#2656](https://github.com/Pycord-Development/pycord/pull/2656))

Expand Down
3 changes: 2 additions & 1 deletion discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
4 changes: 3 additions & 1 deletion discord/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion discord/shard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions discord/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
Iterator,
Literal,
Mapping,
NewType,
Protocol,
Sequence,
TypeVar,
Expand Down Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 3 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-r _.txt
pylint~=3.3.1
pytest~=8.3.3
pylint~=3.3.2
pytest~=8.3.4
pytest-asyncio~=0.23.8
# pytest-order~=1.0.1
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
2 changes: 1 addition & 1 deletion requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cf810ca

Please sign in to comment.