Repository: hikari-py/hikari
Pull request #1567 (2023-03-29 13:58:27)

Bump black from 23.1.0 to 23.3.0
Bumps [black](https://github.com/psf/black) from 23.1.0 to 23.3.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/psf/black/releases">black's releases</a>.</em></p>
<blockquote>
<h2>23.3.0</h2>
<h3>Highlights</h3>
<p>This release fixes a longstanding confusing behavior in Black's GitHub action, where the
version of the action did not determine the version of Black being run (issue <a href="https://redirect.github.com/psf/black/issues/3382">#3382</a>). In
addition, there is a small bug fix around imports and a number of improvements to the
preview style.</p>
<p>Please try out the
<a href="https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#preview-style">preview style</a>
with <code>black --preview</code> and tell us your feedback. All changes in the preview style are
expected to become part of Black's stable style in January 2024.</p>
<h3>Stable style</h3>
<ul>
<li>Import lines with <code># fmt: skip</code> and <code># fmt: off</code> no longer have an extra blank line
added when they are right after another import line (<a href="https://redirect.github.com/psf/black/issues/3610">#3610</a>)</li>
</ul>
<h3>Preview style</h3>
<ul>
<li>Add trailing commas to collection literals even if there's a comment after the last
entry (<a href="https://redirect.github.com/psf/black/issues/3393">#3393</a>)</li>
<li><code>async def</code>, <code>async for</code>, and <code>async with</code> statements are now formatted consistently
compared to their non-async version. (<a href="https://redirect.github.com/psf/black/issues/3609">#3609</a>)</li>
<li><code>with</code> statements that contain two context managers will be consistently wrapped in
parentheses (<a href="https://redirect.github.com/psf/black/issues/3589">#3589</a>)</li>
<li>Let string splitters respect <a href="https://www.unicode.org/reports/tr11/">East Asian Width</a>
(<a href="https://redirect.github.com/psf/black/issues/3445">#3445</a>)</li>
<li>Now long string literals can be split after East Asian commas and periods (<code>、</code> U+3001
IDEOGRAPHIC COMMA, <code>。</code> U+3002 IDEOGRAPHIC FULL STOP, &amp; <code>，</code> U+FF0C FULLWIDTH COMMA)
besides before spaces (<a href="https://redirect.github.com/psf/black/issues/3445">#3445</a>)</li>
<li>For stubs, enforce one blank line after a nested class with a body other than just
<code>...</code> (<a href="https://redirect.github.com/psf/black/issues/3564">#3564</a>)</li>
<li>Improve handling of multiline strings by changing line split behavior (<a href="https://redirect.github.com/psf/black/issues/1879">#1879</a>)</li>
</ul>
<h3>Parser</h3>
<ul>
<li>Added support for formatting files with invalid type comments (<a href="https://redirect.github.com/psf/black/issues/3594">#3594</a>)</li>
</ul>
<h3>Integrations</h3>
<ul>
<li>Update GitHub Action to use the version of Black equivalent to action's version if
version input is not specified (<a href="https://redirect.github.com/psf/black/issues/3543">#3543</a>)</li>
<li>Fix missing Python binary path in autoload script for vim (<a href="https://redirect.github.com/psf/black/issues/3508">#3508</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Document that only the most recent release is supported for security issues;
vulnerabilities should be reported through Tidelift (<a href="https://redirect.github.com/psf/black/issues/3612">#3612</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/psf/black/blob/main/CHANGES.md">black's changelog</a>.</em></p>
<blockquote>
<h2>23.3.0</h2>
<h3>Highlights</h3>
<p>This release fixes a longstanding confusing behavior in Black's GitHub action, where the
version of the action did not determine the version of Black being run (issue <a href="https://redirect.github.com/psf/black/issues/3382">#3382</a>). In
addition, there is a small bug fix around imports and a number of improvements to the
preview style.</p>
<p>Please try out the
<a href="https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#preview-style">preview style</a>
with <code>black --preview</code> and tell us your feedback. All changes in the preview style are
expected to become part of Black's stable style in January 2024.</p>
<h3>Stable style</h3>
<ul>
<li>Import lines with <code># fmt: skip</code> and <code># fmt: off</code> no longer have an extra blank line
added when they are right after another import line (<a href="https://redirect.github.com/psf/black/issues/3610">#3610</a>)</li>
</ul>
<h3>Preview style</h3>
<ul>
<li>Add trailing commas to collection literals even if there's a comment after the last
entry (<a href="https://redirect.github.com/psf/black/issues/3393">#3393</a>)</li>
<li><code>async def</code>, <code>async for</code>, and <code>async with</code> statements are now formatted consistently
compared to their non-async version. (<a href="https://redirect.github.com/psf/black/issues/3609">#3609</a>)</li>
<li><code>with</code> statements that contain two context managers will be consistently wrapped in
parentheses (<a href="https://redirect.github.com/psf/black/issues/3589">#3589</a>)</li>
<li>Let string splitters respect <a href="https://www.unicode.org/reports/tr11/">East Asian Width</a>
(<a href="https://redirect.github.com/psf/black/issues/3445">#3445</a>)</li>
<li>Now long string literals can be split after East Asian commas and periods (<code>、</code> U+3001
IDEOGRAPHIC COMMA, <code>。</code> U+3002 IDEOGRAPHIC FULL STOP, &amp; <code>，</code> U+FF0C FULLWIDTH COMMA)
besides before spaces (<a href="https://redirect.github.com/psf/black/issues/3445">#3445</a>)</li>
<li>For stubs, enforce one blank line after a nested class with a body other than just
<code>...</code> (<a href="https://redirect.github.com/psf/black/issues/3564">#3564</a>)</li>
<li>Improve handling of multiline strings by changing line split behavior (<a href="https://redirect.github.com/psf/black/issues/1879">#1879</a>)</li>
</ul>
<h3>Parser</h3>
<ul>
<li>Added support for formatting files with invalid type comments (<a href="https://redirect.github.com/psf/black/issues/3594">#3594</a>)</li>
</ul>
<h3>Integrations</h3>
<ul>
<li>Update GitHub Action to use the version of Black equivalent to action's version if
version input is not specified (<a href="https://redirect.github.com/psf/black/issues/3543">#3543</a>)</li>
<li>Fix missing Python binary path in autoload script for vim (<a href="https://redirect.github.com/psf/black/issues/3508">#3508</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Document that only the most recent release is supported for security issues;
vulnerabilities should be reported through Tidelift (<a href="https://redirect.github.com/psf/black/issues/3612">#3612</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/psf/black/commit/bf7a16254ec96b084a6caf3d435ec18f0f245cc7"><code>bf7a162</code></a> Fixup the changelog (<a href="https://redirect.github.com/psf/black/issues/3628">#3628</a>)</li>
<li><a href="https://github.com/psf/black/commit/9b2b048692f0bd642f38230b4e61c778a4653f91"><code>9b2b048</code></a> Prepare release 23.3.0 (<a href="https://redirect.github.com/psf/black/issues/3625">#3625</a>)</li>
<li><a href="https://github.com/psf/black/commit/bf5abdb0b6cf6644628977230736a0a6478c1bff"><code>bf5abdb</code></a> Specify Python exec path with minor version if available (<a href="https://redirect.github.com/psf/black/issues/3508">#3508</a>)</li>
<li><a href="https://github.com/psf/black/commit/b542f589a5c4041f54847591104cd51684849f2e"><code>b542f58</code></a> Use GH action version when version argument not specified (<a href="https://redirect.github.com/psf/black/issues/3543">#3543</a>)</li>
<li><a href="https://github.com/psf/black/commit/f3b1a3b9d2fc6de8f0845399cb80d8bdfd6400fd"><code>f3b1a3b</code></a> Bump furo from 2022.12.7 to 2023.3.23 in /docs (<a href="https://redirect.github.com/psf/black/issues/3624">#3624</a>)</li>
<li><a href="https://github.com/psf/black/commit/ef6e079901d53a42dfae4ab10b081ce7a73a47b5"><code>ef6e079</code></a> Let string splitters respect <code>East_Asian_Width</code> property (<a href="https://redirect.github.com/psf/black/issues/3445">#3445</a>)</li>
<li><a href="https://github.com/psf/black/commit/5c064a986c388e2be1e448c3e4b28e5f5ba7ce5a"><code>5c064a9</code></a> Bump sphinx from 5.3.0 to 6.1.3 in /docs (<a href="https://redirect.github.com/psf/black/issues/3499">#3499</a>)</li>
<li><a href="https://github.com/psf/black/commit/3a9d6f0a5f9013b97676f3d24246bd34d93fce4c"><code>3a9d6f0</code></a> Bump myst-parser from 0.18.1 to 1.0.0 in /docs (<a href="https://redirect.github.com/psf/black/issues/3601">#3601</a>)</li>
<li><a href="https://github.com/psf/black/commit/53c23e62df9b182edf9e7ccf726acdcf8c25846f"><code>53c23e6</code></a> Support files with type comment syntax errors (<a href="https://redirect.github.com/psf/black/issues/3594">#3594</a>)</li>
<li><a href="https://github.com/psf/black/commit/dba3c2695c59fdb11825dbdf8f3b0ab6e0b368b2"><code>dba3c26</code></a> Fix bug introduced in <a href="https://redirect.github.com/psf/black/issues/3564">#3564</a>. (<a href="https://redirect.github.com/psf/black/issues/3615">#3615</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/psf/black/compare/23.1.0...23.3.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=black&package-manager=pip&previous-version=23.1.0&new-version=23.3.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/changes/1528.feature.md b/changes/1528.feature.md
new file mode 100644
index 00000000..d0eb6116
--- /dev/null
+++ b/changes/1528.feature.md
@@ -0,0 +1,1 @@
+`Role.mention` now returns `"@everyone"` for the `@everyone` role.
diff --git a/dev-requirements/formatting.txt b/dev-requirements/formatting.txt
index 369de29f..72fde7f1 100644
--- a/dev-requirements/formatting.txt
+++ b/dev-requirements/formatting.txt
@@ -1,2 +1,2 @@
-black==23.1.0
+black==23.3.0
 isort==5.12.0
diff --git a/hikari/guilds.py b/hikari/guilds.py
index 34893db9..d143bb1f 100644
--- a/hikari/guilds.py
+++ b/hikari/guilds.py
@@ -1022,6 +1022,18 @@ def icon_url(self) -> typing.Optional[files.URL]:
         """Role icon URL, if there is one."""
         return self.make_icon_url()
 
+    @property
+    def mention(self) -> str:
+        """Return a raw mention string for the role.
+
+        When this role represents @everyone mentions will only work if
+        `mentions_everyone` is `True`.
+        """
+        if self.guild_id == self.id:
+            return "@everyone"
+
+        return super().mention
+
     def make_icon_url(self, *, ext: str = "png", size: int = 4096) -> typing.Optional[files.URL]:
         """Generate the icon URL for this role, if set.
 


Test patch:
diff --git a/tests/hikari/test_guilds.py b/tests/hikari/test_guilds.py
index b64e5ad6..37567d50 100644
--- a/tests/hikari/test_guilds.py
+++ b/tests/hikari/test_guilds.py
@@ -157,6 +157,13 @@ def test_icon_url_property(self, model):
 
             model.make_icon_url.assert_called_once_with()
 
+    def test_mention_property(self, model):
+        assert model.mention == "<@&979899100>"
+
+    def test_mention_property_when_is_everyone_role(self, model):
+        model.id = model.guild_id
+        assert model.mention == "@everyone"
+
     def test_make_icon_url_when_hash_is_None(self, model):
         model.icon_hash = None