Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrectly replaced backticks in strings #1866

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1866.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix incorrectly formatted error strings
8 changes: 4 additions & 4 deletions hikari/impl/entity_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion hikari/internal/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion hikari/internal/ux.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Loading