Commit 2b9d07c
authored
chore: stop running generated Python though
Running `black` on the generated source is slow... And generating
*properly* formatted code is faster. This removes `black` invocations
and instead tries to generate Python that is closer to the prescriptions
of PEP8 (more specifically, closer to the output of `black`).
There are some minor changes introduced by this change in the generated
Python files, compared to when `black` was post-processing, which are
hopefully acceptable degradations:
- Some long type signatures are single-lined now where `black` would
have broken them down into multiple lines. Reproducing the `black`
behavior is too close to requiring a full blown python parser.
- Certain lines that `black` chose not to break down into multiple lines
are now split. I could not understand the mechanisms `black` uses to
make it's choice and decided the broken down lines are readable
enough.
- Some `pass` statements used to be generated in proxies when there were
no members, although there existed a synthetic member. Those
statements were not sparking joy and were gently disposed of.
- Alphanumerically ordered elements in piecemeal import declarations, so
as to reduce the likelyhood of fake changes if the order of processing
changes (resulting in a different creation/registration order).
Fixes #1856
---
By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].
[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0black (#1864)1 parent 5431262 commit 2b9d07c
7 files changed
Lines changed: 503 additions & 461 deletions
File tree
- packages
- codemaker/lib
- jsii-pacmak
- lib/targets
- test
- __snapshots__
- targets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | | - | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
105 | | - | |
| 109 | + | |
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
| |||
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
| 125 | + | |
| 126 | + | |
121 | 127 | | |
122 | | - | |
| 128 | + | |
123 | 129 | | |
124 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
125 | 133 | | |
126 | 134 | | |
127 | 135 | | |
| |||
170 | 178 | | |
171 | 179 | | |
172 | 180 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
179 | 185 | | |
180 | | - | |
| 186 | + | |
181 | 187 | | |
182 | 188 | | |
0 commit comments