From d90c41cdd9f32b2598a7761b14c459c57002d4fd Mon Sep 17 00:00:00 2001 From: beagold <86345081+beagold@users.noreply.github.com> Date: Mon, 1 Apr 2024 20:55:36 +0200 Subject: [PATCH] Fix incorrectly replaced backticks in strings (#1866) --- changes/1866.bugfix.md | 1 + hikari/impl/entity_factory.py | 8 ++++---- hikari/internal/enums.py | 2 +- hikari/internal/ux.py | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 changes/1866.bugfix.md diff --git a/changes/1866.bugfix.md b/changes/1866.bugfix.md new file mode 100644 index 0000000000..60eaec5c96 --- /dev/null +++ b/changes/1866.bugfix.md @@ -0,0 +1 @@ +Fix incorrectly formatted error strings diff --git a/hikari/impl/entity_factory.py b/hikari/impl/entity_factory.py index 3d17441cc2..7e6764f882 100644 --- a/hikari/impl/entity_factory.py +++ b/hikari/impl/entity_factory.py @@ -1655,27 +1655,27 @@ def serialize_embed( # noqa: C901 - Function too complex # Yep, these are technically two unreachable branches. However, this is an incredibly # common mistake to make when working with embeds and not using a static type # checker, so I have added these as additional safeguards for UX and ease - # of debugging. The case that there are [`None`][] should be detected immediately by + # of debugging. The case that there are `None` should be detected immediately by # static type checkers, regardless. name = str(field.name) if field.name is not None else None value = str(field.value) if field.value is not None else None if name is None: - raise TypeError(f"in embed.fields[{i}].name - cannot have [`None`][]") + raise TypeError(f"in embed.fields[{i}].name - cannot have `None`") if not name: raise TypeError(f"in embed.fields[{i}].name - cannot have empty string") if not name.strip(): raise TypeError(f"in embed.fields[{i}].name - cannot have only whitespace") if value is None: - raise TypeError(f"in embed.fields[{i}].value - cannot have [`None`][]") + raise TypeError(f"in embed.fields[{i}].value - cannot have `None`") if not value: raise TypeError(f"in embed.fields[{i}].value - cannot have empty string") if not value.strip(): raise TypeError(f"in embed.fields[{i}].value - cannot have only whitespace") # Name and value always have to be specified; we can always - # send a default [`inline`][] value also just to keep this simpler. + # send a default `inline` value also just to keep this simpler. field_payloads.append({"name": name, "value": value, "inline": field.is_inline}) payload["fields"] = field_payloads diff --git a/hikari/internal/enums.py b/hikari/internal/enums.py index 63d154231e..4a0c3e7a51 100644 --- a/hikari/internal/enums.py +++ b/hikari/internal/enums.py @@ -232,7 +232,7 @@ def __prepare__( return _EnumNamespace(object) try: - # Fails if Enum is not defined. We check this in [`__new__`][] properly. + # Fails if Enum is not defined. We check this in `__new__` properly. base, enum_type = bases if isinstance(base, _EnumMeta): diff --git a/hikari/internal/ux.py b/hikari/internal/ux.py index cd60ddc657..0f3a470123 100644 --- a/hikari/internal/ux.py +++ b/hikari/internal/ux.py @@ -330,7 +330,7 @@ def warn_if_not_optimized(suppress: bool) -> None: if __debug__ and not suppress: _LOGGER.warning( "You are running on optimization level 0 (no optimizations), which may slow down your application. " - "For production, consider using at least level 1 optimization by passing [-O][] to the python " + "For production, consider using at least level 1 optimization by passing `-O` to the python " "interpreter call" )