summaryrefslogtreecommitdiff
path: root/tools/format_docs_code.py
Commit message (Collapse)AuthorAgeFilesLines
* refactor code generation tools , include --check commandMike Bayer2023-01-181-0/+3
| | | | | | | | | | | | | | | | | in particular it looks like CI was not picking up on the "git diff" oriented commands, which were failing to run due to pathing issues. As we were setting cwd for black/zimports relative to sqlalchemy library, and tox installs it in the venv, black/zimports would fail to run from tox, and since these are subprocess.run we didn't pick up the failure. This overall locks down how zimports/black are run so that we are definitely from the source root, by using the location of tools/ to determine the root. Fixes: #8892 Change-Id: I7c54b747edd5a80e0c699b8456febf66d8b62375
* Improve sql formattingFederico Caselli2023-01-111-2/+4
| | | | | | change {opensql} to {printsql} in prints, add missing markers Change-Id: I07b72e6620bb64e329d6b641afa27631e91c4f16
* Add new script to sync test files adding future annotationFederico Caselli2022-11-261-0/+7
| | | | | | | | | | | Create a new test file test_tm_future_annotations_sync.py that's obtained from test_tm_future_annotations.py by using the new script sync_test_files. This files includes the ``from __future__ import annotations`` It also turns out we had some bugs in there and we can also support some additional typing things Change-Id: Iac005df206d45a55345d9d88d67a80ce799d449f
* Try running pyupgrade on the codeFederico Caselli2022-11-161-2/+2
| | | | | | | | command run is "pyupgrade --py37-plus --keep-runtime-typing --keep-percent-format <files...>" pyupgrade will change assert_ to assertTrue. That was reverted since assertTrue does not exists in sqlalchemy fixtures Change-Id: Ie1ed2675c7b11d893d78e028aad0d1576baebb55
* update executemany for new featuresMike Bayer2022-10-111-4/+10
| | | | | | | | 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
* Add format docs to pre-commitsFederico Caselli2022-10-061-22/+36
| | | | Change-Id: Ia41399155ee0ec1b878aebf18967eabe38f5afd1
* Remove all formatting errorsFederico Caselli2022-10-031-155/+123
| | | | | | Improve format docs script, replace {sql} with {opensql} Change-Id: Ie1aaa8f3d8ff8f8e89b7b5149a1876d9f8a211ed
* detect {opensql} and {stop} sectionsMike Bayer2022-10-021-15/+77
| | | | | | | | | | | | | this so that I can still have {opensql} and {stop} sections in non-console python. this isn't the norm but I would prefer if I dont have to be 100% strict about it also maintaining {sql} / {stop} being at the start of a code line. this is more prevalent in 1.4. Change-Id: Iaf748b7ff1120e21f729c2fd794d9b8a33d83170
* Add proper code block formattingFederico Caselli2022-10-021-0/+2
| | | | Change-Id: I63585eeae0b0bc78109da64520696928dfb3982c
* Improvements to code formatterFederico Caselli2022-10-021-64/+109
| | | | Change-Id: I75cf7143f3ed3bbc09aa8bc18edbce5c8af0f0be
* Format code in the rst docs fileFederico Caselli2022-09-301-0/+289
Added script to format code in the rst documentation using black. This is also added to the lint tox job to ensure that the code in the docs is properly formatted. Change-Id: I799444f22da153484ca5f095d57755762348da40