summaryrefslogtreecommitdiff
path: root/tools/format_docs_code.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-10-11 15:29:15 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-10-11 15:29:15 -0400
commitd4b8b41832267918e74c114c26def5b38d15e9e2 (patch)
treea081448d9b201c46a73cbde0b1ca3aded822955b /tools/format_docs_code.py
parent5443bcd38b735d2879f1b38f40f42c0073c5ae2f (diff)
downloadsqlalchemy-d4b8b41832267918e74c114c26def5b38d15e9e2.tar.gz
update executemany for new features
also fixes issue in format_docs_code which didn't work with pre-commit for more than one file. will backport Fixes: #8597 Change-Id: I21b2625514987b1cd90f7c00f06e72e57e257390
Diffstat (limited to 'tools/format_docs_code.py')
-rw-r--r--tools/format_docs_code.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/format_docs_code.py b/tools/format_docs_code.py
index 31a5b8e2f..05e5e01f1 100644
--- a/tools/format_docs_code.py
+++ b/tools/format_docs_code.py
@@ -283,9 +283,11 @@ def iter_files(directory: str) -> Iterator[Path]:
)
-def main(file: str | None, directory: str, exit_on_error: bool, check: bool):
+def main(
+ file: list[str] | None, directory: str, exit_on_error: bool, check: bool
+):
if file is not None:
- result = [format_file(Path(file), exit_on_error, check)]
+ result = [format_file(Path(f), exit_on_error, check) for f in file]
else:
result = [
format_file(doc, exit_on_error, check)
@@ -327,7 +329,10 @@ Use --report-doctest to ignore errors on plain code blocks.
formatter_class=RawDescriptionHelpFormatter,
)
parser.add_argument(
- "-f", "--file", help="Format only this file instead of all docs"
+ "-f",
+ "--file",
+ help="Format only this file instead of all docs",
+ nargs="+",
)
parser.add_argument(
"-d",
@@ -357,7 +362,8 @@ Use --report-doctest to ignore errors on plain code blocks.
action="store_true",
)
parser.add_argument(
- "-rd", "--report-doctest",
+ "-rd",
+ "--report-doctest",
help="Report errors only when running doctest blocks. When active "
"exit-on-error will be valid only on doctest blocks",
action="store_true",