### Description
Type-annotations were added to the "Don't Generate Empty Migrations with Autogenerate" cookbook recipe in commit
3e48ed0. Later, in commit
222e4ba, the type of the `revision` argument to `process_revision_directives()` was changed from `tuple[str, str]` to `str | Iterable[str | None] | Iterable[str]`, but the recipe was not updated. This PR updates the recipe so that it will type-check.
### Checklist
This pull request is:
- [x] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [ ] A short code fix
- please include the issue number, and create an issue if none exists, which
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests. one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.
Closes: #1340
Pull-request: https://github.com/sqlalchemy/alembic/pull/1340
Pull-request-sha:
254b4cbe06befaa61a7e11fef5020766f129c7a5
Change-Id: I1697c1d8a3965dae8e696c9f33c179d9f20ef09c
any operations::
# for typing purposes
+ from collections.abc import Iterable
from alembic.environment import MigrationContext
# this typing-only import requires alembic 1.12.1 or above
def process_revision_directives(
context: MigrationContext,
- revision: tuple[str, str],
+ revision: str | Iterable[str | None] | Iterable[str],
directives: list[MigrationScript],
):
assert config.cmd_opts is not None