Skip to content

Commit d3d9277

Browse files
Format with black
Signed-off-by: Jacob Stopak <[email protected]>
1 parent 9161676 commit d3d9277

File tree

6 files changed

+105
-23
lines changed

6 files changed

+105
-23
lines changed

git_sim/__main__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
import typer
88

99
import git_sim.commands
10-
from git_sim.settings import ColorByOptions, StyleOptions, ImgFormat, VideoFormat, settings
10+
from git_sim.settings import (
11+
ColorByOptions,
12+
StyleOptions,
13+
ImgFormat,
14+
VideoFormat,
15+
settings,
16+
)
1117

1218
app = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]})
1319

git_sim/clean.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ def __init__(self):
2323

2424
def construct(self):
2525
if not settings.stdout and not settings.output_only_path and not settings.quiet:
26-
print(
27-
f"{settings.INFO_STRING} {type(self).__name__.lower()}"
28-
)
26+
print(f"{settings.INFO_STRING} {type(self).__name__.lower()}")
2927

3028
self.show_intro()
3129
self.parse_commits()
@@ -121,6 +119,4 @@ def populate_zones(
121119
if "git-sim_media" not in z:
122120
firstColumnFileNames.add(z)
123121
thirdColumnFileNames.add(z)
124-
firstColumnArrowMap[z] = m.Arrow(
125-
stroke_width=3, color=self.fontColor
126-
)
122+
firstColumnArrowMap[z] = m.Arrow(stroke_width=3, color=self.fontColor)

git_sim/git_sim_base_command.py

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __init__(self):
7272
self.arrow_stroke_width = 10
7373
self.arrow_tip_shape = m.StealthTip
7474
self.font_weight = m.BOLD
75-
75+
7676
def init_repo(self):
7777
try:
7878
self.repo = Repo(search_parent_directories=True)
@@ -292,7 +292,14 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
292292
)
293293
end = self.drawnCommits[commit.hexsha].get_center()
294294

295-
arrow = m.Arrow(start, end, color=self.fontColor, stroke_width=self.arrow_stroke_width, tip_shape=self.arrow_tip_shape, max_stroke_width_to_length_ratio=1000)
295+
arrow = m.Arrow(
296+
start,
297+
end,
298+
color=self.fontColor,
299+
stroke_width=self.arrow_stroke_width,
300+
tip_shape=self.arrow_tip_shape,
301+
max_stroke_width_to_length_ratio=1000,
302+
)
296303

297304
if commit == "dark":
298305
arrow = m.Arrow(
@@ -311,7 +318,13 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
311318
for commitCircle in self.drawnCommits.values():
312319
inter = m.Intersection(lineRect, commitCircle)
313320
if inter.has_points():
314-
arrow = m.CurvedArrow(start, end, color=self.fontColor, stroke_width=self.arrow_stroke_width, tip_shape=self.arrow_tip_shape)
321+
arrow = m.CurvedArrow(
322+
start,
323+
end,
324+
color=self.fontColor,
325+
stroke_width=self.arrow_stroke_width,
326+
tip_shape=self.arrow_tip_shape,
327+
)
315328
if start[1] == end[1]:
316329
arrow.shift(m.UP * 1.25)
317330
if start[0] < end[0] and start[1] == end[1]:
@@ -332,7 +345,10 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
332345
font="Monospace",
333346
font_size=20 if settings.highlight_commit_messages else 14,
334347
color=self.fontColor,
335-
weight=m.BOLD if settings.highlight_commit_messages or settings.style == StyleOptions.THICK else m.NORMAL,
348+
weight=m.BOLD
349+
if settings.highlight_commit_messages
350+
or settings.style == StyleOptions.THICK
351+
else m.NORMAL,
336352
).next_to(circle, m.DOWN)
337353

338354
if settings.animate and commit != "dark" and isNewCommit:
@@ -385,7 +401,13 @@ def get_nonparent_branch_names(self):
385401
def build_commit_id_and_message(self, commit, i):
386402
hide_refs = False
387403
if commit == "dark":
388-
commitId = m.Text("", font="Monospace", font_size=20, color=self.fontColor, weight=self.font_weight)
404+
commitId = m.Text(
405+
"",
406+
font="Monospace",
407+
font_size=20,
408+
color=self.fontColor,
409+
weight=self.font_weight,
410+
)
389411
commitMessage = ""
390412
else:
391413
commitId = m.Text(
@@ -410,7 +432,11 @@ def draw_head(self, commit, i, commitId):
410432
else:
411433
headbox.next_to(commitId, m.UP)
412434
headText = m.Text(
413-
"HEAD", font="Monospace", font_size=20, color=self.fontColor, weight=self.font_weight,
435+
"HEAD",
436+
font="Monospace",
437+
font_size=20,
438+
color=self.fontColor,
439+
weight=self.font_weight,
414440
).move_to(headbox.get_center())
415441

416442
head = m.VGroup(headbox, headText)
@@ -457,7 +483,11 @@ def draw_branch(self, commit, i, make_branches_remote=False):
457483
)
458484

459485
branchText = m.Text(
460-
text, font="Monospace", font_size=20, color=self.fontColor, weight=self.font_weight,
486+
text,
487+
font="Monospace",
488+
font_size=20,
489+
color=self.fontColor,
490+
weight=self.font_weight,
461491
)
462492
branchRec = m.Rectangle(
463493
color=m.GREEN,
@@ -1002,7 +1032,10 @@ def setup_and_draw_parent(
10021032
color=m.RED,
10031033
):
10041034
circle = m.Circle(
1005-
stroke_color=color, stroke_width=self.commit_stroke_width, fill_color=color, fill_opacity=self.ref_fill_opacity
1035+
stroke_color=color,
1036+
stroke_width=self.commit_stroke_width,
1037+
fill_color=color,
1038+
fill_opacity=self.ref_fill_opacity,
10061039
)
10071040
circle.height = 1
10081041
circle.next_to(
@@ -1014,12 +1047,23 @@ def setup_and_draw_parent(
10141047

10151048
start = circle.get_center()
10161049
end = self.drawnCommits[child.hexsha].get_center()
1017-
arrow = m.Arrow(start, end, color=self.fontColor, stroke_width=self.arrow_stroke_width, tip_shape=self.arrow_tip_shape, max_stroke_width_to_length_ratio=1000)
1050+
arrow = m.Arrow(
1051+
start,
1052+
end,
1053+
color=self.fontColor,
1054+
stroke_width=self.arrow_stroke_width,
1055+
tip_shape=self.arrow_tip_shape,
1056+
max_stroke_width_to_length_ratio=1000,
1057+
)
10181058
length = numpy.linalg.norm(start - end) - (1.5 if start[1] == end[1] else 3)
10191059
arrow.set_length(length)
10201060

10211061
commitId = m.Text(
1022-
"abcdef", font="Monospace", font_size=20, color=self.fontColor, weight=self.font_weight,
1062+
"abcdef",
1063+
font="Monospace",
1064+
font_size=20,
1065+
color=self.fontColor,
1066+
weight=self.font_weight,
10231067
).next_to(circle, m.UP)
10241068
self.toFadeOut.add(commitId)
10251069

@@ -1079,7 +1123,13 @@ def get_nondark_commits(self):
10791123
return nondark_commits
10801124

10811125
def draw_ref(self, commit, top, i=0, text="HEAD", color=m.BLUE):
1082-
refText = m.Text(text, font="Monospace", font_size=20, color=self.fontColor, weight=self.font_weight)
1126+
refText = m.Text(
1127+
text,
1128+
font="Monospace",
1129+
font_size=20,
1130+
color=self.fontColor,
1131+
weight=self.font_weight,
1132+
)
10831133
refbox = m.Rectangle(
10841134
color=color,
10851135
fill_color=color,

git_sim/merge.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ def construct(self):
8383
if head_commit.hexsha in self.drawnCommits:
8484
start = self.drawnCommits["abcdef"].get_center()
8585
end = self.drawnCommits[head_commit.hexsha].get_center()
86-
arrow = m.CurvedArrow(start, end, color=self.fontColor, stroke_width=self.arrow_stroke_width, tip_shape=self.arrow_tip_shape)
86+
arrow = m.CurvedArrow(
87+
start,
88+
end,
89+
color=self.fontColor,
90+
stroke_width=self.arrow_stroke_width,
91+
tip_shape=self.arrow_tip_shape,
92+
)
8793
self.draw_arrow(True, arrow)
8894

8995
reset_head_to = "abcdef"

git_sim/rebase.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ def setup_and_draw_parent(
111111
shift=numpy.array([0.0, 0.0, 0.0]),
112112
draw_arrow=True,
113113
):
114-
circle = m.Circle(stroke_color=m.RED, stroke_width=self.commit_stroke_width, fill_color=m.RED, fill_opacity=0.25)
114+
circle = m.Circle(
115+
stroke_color=m.RED,
116+
stroke_width=self.commit_stroke_width,
117+
fill_color=m.RED,
118+
fill_opacity=0.25,
119+
)
115120
circle.height = 1
116121
circle.next_to(
117122
self.drawnCommits[child],
@@ -122,7 +127,14 @@ def setup_and_draw_parent(
122127

123128
start = circle.get_center()
124129
end = self.drawnCommits[child].get_center()
125-
arrow = m.Arrow(start, end, color=self.fontColor, stroke_width=self.arrow_stroke_width, tip_shape=self.arrow_tip_shape, max_stroke_width_to_length_ratio=1000)
130+
arrow = m.Arrow(
131+
start,
132+
end,
133+
color=self.fontColor,
134+
stroke_width=self.arrow_stroke_width,
135+
tip_shape=self.arrow_tip_shape,
136+
max_stroke_width_to_length_ratio=1000,
137+
)
126138
length = numpy.linalg.norm(start - end) - (1.5 if start[1] == end[1] else 3)
127139
arrow.set_length(length)
128140

git_sim/revert.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ def build_commit_id_and_message(self, commit, i):
9191
return commitId, commitMessage, commit, hide_refs
9292

9393
def setup_and_draw_revert_commit(self):
94-
circle = m.Circle(stroke_color=m.RED, stroke_width=self.commit_stroke_width, fill_color=m.RED, fill_opacity=0.25)
94+
circle = m.Circle(
95+
stroke_color=m.RED,
96+
stroke_width=self.commit_stroke_width,
97+
fill_color=m.RED,
98+
fill_opacity=0.25,
99+
)
95100
circle.height = 1
96101
circle.next_to(
97102
self.drawnCommits[self.get_commit().hexsha],
@@ -101,7 +106,14 @@ def setup_and_draw_revert_commit(self):
101106

102107
start = circle.get_center()
103108
end = self.drawnCommits[self.get_commit().hexsha].get_center()
104-
arrow = m.Arrow(start, end, color=self.fontColor, stroke_width=self.arrow_stroke_width, tip_shape=self.arrow_tip_shape, max_stroke_width_to_length_ratio=1000)
109+
arrow = m.Arrow(
110+
start,
111+
end,
112+
color=self.fontColor,
113+
stroke_width=self.arrow_stroke_width,
114+
tip_shape=self.arrow_tip_shape,
115+
max_stroke_width_to_length_ratio=1000,
116+
)
105117
length = numpy.linalg.norm(start - end) - (1.5 if start[1] == end[1] else 3)
106118
arrow.set_length(length)
107119

0 commit comments

Comments
 (0)