formate.mini_hooks¶
Small but mighty hooks.
Functions:
|
Check the source can be parsed as a Python Abstract Syntax Tree. |
|
Removes newlines immediately after equals signs. |
|
Pull |
|
Squash type stubs by removing unnecessary blank lines. |
-
check_ast(source)[source]¶ Check the source can be parsed as a Python Abstract Syntax Tree.
- Parameters
source (
str) – The source to check.- Raises
SyntaxError – If the source is not valid Python.
- Return type
- Returns
The source unchanged.
-
newline_after_equals(source)[source]¶ Removes newlines immediately after equals signs.
New in version 1.1.0.
-
noqa_reformat(source)[source]¶ Pull
# noqa: ...comments that immediately follow docstrings back up to the end of the correct line.