Skip to content

Commit 67defbc

Browse files
refactor to make shorter literals
why was I using complex(NN, NN) when I could just write NN+NNj?
1 parent c86233d commit 67defbc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

schemascii/components/battery.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def render(self, **options) -> str:
2727
(t2, mid + rect(-0.5, angle)),
2828
*_utils.deep_transform(
2929
[
30-
(complex(0.5, 0.5), complex(-0.5, 0.5)),
31-
(complex(0.25, 0.16), complex(-0.25, 0.16)),
32-
(complex(0.5, -0.16), complex(-0.5, -0.16)),
33-
(complex(0.25, -0.5), complex(-0.25, -0.5)),
30+
(.5+.5j, -.5+.5j),
31+
(.25+.16j, -.25+.16j),
32+
(.5-.16j, -.5-.16j),
33+
(.25-.5j, -.25-.5j),
3434
],
3535
mid,
3636
angle)

schemascii/components/capacitor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def render(self, **options) -> str:
2626
(t1, mid + rect(1/4, angle)),
2727
(t2, mid + rect(-1/4, angle)),
2828
*_utils.deep_transform([
29-
(complex(2/5, 1/4), complex(-2/5, 1/4)),
30-
(complex(2/5, -1/4), complex(-2/5, -1/4)),
29+
(.4+.25j, -.4+.25j),
30+
(.4-.25j, -.4-.25j)
3131
], mid, angle)
3232
]
3333
return (_utils.bunch_o_lines(lines, **options)

0 commit comments

Comments
 (0)