Repository: hikari-py/hikari
Pull request #1560 (2023-03-25 17:00:13)

Add in missed field aliases for imessagebuilder mention fields
### Summary
<!-- Small summary of the merge request -->

### Checklist
<!-- Make sure to tick all the following boxes by putting an `x` in between (like this `[x]`) -->
- [ ] I have run `nox` and all the pipelines have passed.
- [ ] I have made unittests according to the code I have added/modified/deleted.

### Related issues
<!--
To mention an issue use `#issue-id` and to mention a merge request use `!merge-request-id`
To close/fix an issue use `Close #issue-id` or `Fix #issue-id` (depending on the merge request)
-->



Patch:
diff --git a/.github/workflows/fragments-check.yml b/.github/workflows/fragments-check.yml
index 40da0e62..cececdc2 100644
--- a/.github/workflows/fragments-check.yml
+++ b/.github/workflows/fragments-check.yml
@@ -6,10 +6,6 @@ on:
     branches:
       - master
 
-concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: true
-
 jobs:
   check-fragment-added:
     if: github.event.pull_request.user.type != 'Bot' && !contains(github.event.pull_request.labels.*.name, 'skip-fragment-check')
diff --git a/changes/1560.bugfix.md b/changes/1560.bugfix.md
new file mode 100644
index 00000000..7494e257
--- /dev/null
+++ b/changes/1560.bugfix.md
@@ -0,0 +1,1 @@
+Pyright will now let you pass `role_mentions` and `user_mentions` to `InteractionMessageBuilder.__init__`.
diff --git a/changes/1562.feature.md b/changes/1562.feature.md
new file mode 100644
index 00000000..a1899d2d
--- /dev/null
+++ b/changes/1562.feature.md
@@ -0,0 +1,1 @@
+`hikari.iterators.LazyIterator.flatten` method for flattening a lazy iterator of synchronous iterables.
diff --git a/dev-requirements/sphinx.txt b/dev-requirements/sphinx.txt
index cb63536a..d1c9ff2e 100644
--- a/dev-requirements/sphinx.txt
+++ b/dev-requirements/sphinx.txt
@@ -1,7 +1,7 @@
 sphinx==6.1.3
 
 # Theme
-furo==2023.3.23
+furo==2023.3.27
 
 # Autodocumentation
 sphinx-autoapi==2.0.1
diff --git a/hikari/impl/special_endpoints.py b/hikari/impl/special_endpoints.py
index 18ba761b..516a851d 100644
--- a/hikari/impl/special_endpoints.py
+++ b/hikari/impl/special_endpoints.py
@@ -1006,10 +1006,10 @@ class InteractionMessageBuilder(special_endpoints.InteractionMessageBuilder):
     )
     _role_mentions: undefined.UndefinedOr[
         typing.Union[snowflakes.SnowflakeishSequence[guilds.PartialRole], bool]
-    ] = attr.field(default=undefined.UNDEFINED, kw_only=True)
+    ] = attr.field(alias="role_mentions", default=undefined.UNDEFINED, kw_only=True)
     _user_mentions: undefined.UndefinedOr[
         typing.Union[snowflakes.SnowflakeishSequence[users.PartialUser], bool]
-    ] = attr.field(default=undefined.UNDEFINED, kw_only=True)
+    ] = attr.field(alias="user_mentions", default=undefined.UNDEFINED, kw_only=True)
     _attachments: undefined.UndefinedNoneOr[typing.List[files.Resourceish]] = attr.field(
         alias="attachments", default=undefined.UNDEFINED, kw_only=True
     )
diff --git a/hikari/iterators.py b/hikari/iterators.py
index cec73362..21a7ecdf 100644
--- a/hikari/iterators.py
+++ b/hikari/iterators.py
@@ -639,6 +639,10 @@ def iter_mentioned_users(message: hikari.Message) -> typing.Iterable[Snowflake]:
         """
         return _FlatMapLazyIterator(self, flattener)
 
+    def flatten(self: LazyIterator[typing.Iterable[AnotherValueT]]) -> LazyIterator[AnotherValueT]:
+        """Flatten an async iterator of iterables."""
+        return self.flat_map(_flatten)
+
     def awaiting(self, window_size: int = 10) -> LazyIterator[ValueT]:
         """Await each item concurrently in a fixed size window.
 
@@ -733,6 +737,10 @@ def __next__(self) -> typing.NoReturn:
             ) from None
 
 
+def _flatten(value: ValueT) -> ValueT:
+    return value
+
+
 class BufferedLazyIterator(typing.Generic[ValueT], LazyIterator[ValueT], abc.ABC):
     """A special kind of lazy iterator that is used by internal components.
 


Test patch:
diff --git a/tests/hikari/test_iterators.py b/tests/hikari/test_iterators.py
index 9a0c61cb..11067d98 100644
--- a/tests/hikari/test_iterators.py
+++ b/tests/hikari/test_iterators.py
@@ -33,3 +33,9 @@ def lazy_iterator(self):
     def test_asynchronous_only(self, lazy_iterator):
         with pytest.raises(TypeError, match="is async-only, did you mean 'async for' or `anext`?"):
             next(lazy_iterator)
+
+    @pytest.mark.asyncio()
+    async def test_flatten(self):
+        iterator = iterators.FlatLazyIterator([[123, 321, 4352, 123], [], [12343123, 4234432], [543123123]])
+
+        assert await iterator.flatten() == [123, 321, 4352, 123, 12343123, 4234432, 543123123]