Skip to content

Commit 47adb66

Browse files
committed
Run black formatting again + a minor variable rename
1 parent 3b526ec commit 47adb66

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

alteza/engine.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import os
2+
import shutil
23
import sys
34
import types
4-
import shutil
5-
import sh # type: ignore
6-
from tap import Tap
7-
from time import time_ns
85
from contextlib import contextmanager
6+
from time import time_ns
97
from typing import Generator, List, Dict, Any, Union, Literal
8+
9+
import sh # type: ignore
1010
from pypage import pypage # type: ignore
11+
from tap import Tap
12+
1113
from .fs import (
1214
FileNode,
1315
DirNode,
@@ -42,22 +44,23 @@ def __init__(self, args: Args, fs: Fs) -> None:
4244
self.nameRegistry: NameRegistry = fs.nameRegistry
4345
self.fixSysPath()
4446

45-
self.linkDepth: Union[Literal[2], Literal[4]] = 2
47+
self.indentSpaces: Union[Literal[2], Literal[4]] = 2
4648

4749
def linkObj(self, srcFile: PyPageNode, dstFile: FileNode) -> str:
4850
assert isinstance(dstFile, FileNode)
4951
dstName = dstFile.getLinkName()
50-
print(" " * self.linkDepth + f"{Fore.grey_42}Linking to:{Style.reset}", dstName)
52+
indentSpaces = " " * self.indentSpaces
53+
print(indentSpaces + f"{Fore.grey_42}Linking to:{Style.reset}", dstName)
5154
dstFile.makePublic() # FixMe: Circular links can make pages public.
5255

5356
dstFileName = dstFile.fileName
5457
if isinstance(dstFile, NonMd):
5558
dstFileName = dstFile.rectifiedFileName
5659
elif isinstance(dstFile, Md):
5760
dstFileName = (
58-
dstFile.realName
59-
# Add a "/" trailing slash if arg requests it
60-
+ ("/" if self.args.trailing_slash else "")
61+
dstFile.realName
62+
# Add a "/" trailing slash if arg requests it
63+
+ ("/" if self.args.trailing_slash else "")
6164
)
6265

6366
srcPath = self.splitPath(srcFile.fullPath)[:-1]
@@ -132,10 +135,10 @@ def linkObj(dstFile: FileNode) -> str:
132135
f" {Fore.purple_3}Applying template...{Style.reset}"
133136
) # TODO (see ideas.md)
134137
templateHtml = Content.getTemplateHtml(env)
135-
self.linkDepth = 4
138+
self.indentSpaces = 4
136139
# Re-process against `templateHtml` with PyPage:
137140
pyPageOutput = pypage(templateHtml, env | {"body": pyPageOutput})
138-
self.linkDepth = 2
141+
self.indentSpaces = 2
139142

140143
fileNode.setPyPageOutput(pyPageOutput)
141144

@@ -243,7 +246,7 @@ def run(args: Args) -> None:
243246

244247
generate(args, content)
245248

246-
elapsedMilliseconds = (time_ns() - startTimeNs) / 10**6
249+
elapsedMilliseconds = (time_ns() - startTimeNs) / 10 ** 6
247250
# pylint: disable=consider-using-f-string
248251
print("\nTime elapsed: %.2f ms" % elapsedMilliseconds)
249252

0 commit comments

Comments
 (0)