Skip to content

Commit 25e8f50

Browse files
author
Alistair Turnbull
committed
Rename Trees.output_path to Trees.output by analogy with Trees.inputs
1 parent 0e573cf commit 25e8f50

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

nancy/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,22 @@ class Trees:
124124
Fields:
125125
inputs (list[Path]): a list of filesystem `Path`s to overlay to
126126
make an abstract input tree
127-
output_path (Path): the filesystem `Path` of the output directory
127+
output (Path): the filesystem `Path` of the output directory
128128
build_path (Path): the subtree of `inputs` to process.
129129
Defaults to the whole tree.
130130
process_hidden (bool): `True` to process hidden files (those whose
131131
names begin with ".")
132132
"""
133133

134134
inputs: list[Path]
135-
output_path: Path
135+
output: Path
136136
build_path: Path
137137
process_hidden: bool
138138

139139
def __init__(
140140
self,
141141
inputs: list[Path],
142-
output_path: Path,
142+
output: Path,
143143
process_hidden: bool,
144144
build_path: Optional[Path] = None,
145145
):
@@ -151,7 +151,7 @@ def __init__(
151151
if not root.is_dir():
152152
raise ValueError(f"input '{root}' is not a directory")
153153
self.inputs = inputs
154-
self.output_path = output_path
154+
self.output = output
155155
self.process_hidden = process_hidden
156156
if build_path is None:
157157
build_path = Path()
@@ -193,12 +193,12 @@ def process_path(self, obj: Path) -> None:
193193
if found is None:
194194
raise ValueError(f"'{obj}' matches no path in the inputs")
195195
if found.is_dir():
196-
if self.output_path == Path("-"):
196+
if self.output == Path("-"):
197197
raise ValueError("cannot output multiple files to stdout ('-')")
198198
debug(f"Entering directory '{obj}'")
199199
os.makedirs(
200-
self.output_path, exist_ok=True
201-
) # FIXME: `Trees.output_path` vs `Expand.output_file`
200+
self.output, exist_ok=True
201+
) # FIXME: `Trees.output` vs `Expand.output_file`
202202
for child in self.scandir(obj):
203203
if child[0] != "." or self.process_hidden:
204204
self.process_path(obj / child)
@@ -211,11 +211,11 @@ def process_path(self, obj: Path) -> None:
211211
# TODO: Inline into callers, and remove.
212212
def expand(
213213
inputs: list[Path],
214-
output_path: Path,
214+
output: Path,
215215
process_hidden: bool,
216216
build_path: Optional[Path] = None,
217217
) -> None:
218-
trees = Trees(inputs, output_path, process_hidden, build_path)
218+
trees = Trees(inputs, output, process_hidden, build_path)
219219
trees.process_path(trees.build_path)
220220

221221

@@ -257,7 +257,7 @@ def __init__(
257257
re.sub(TEMPLATE_REGEX, "", output_file.name)
258258
)
259259
output_file = os.fsdecode(self.expand(bytes(output_file)))
260-
self._output_file = self.trees.output_path / output_file
260+
self._output_file = self.trees.output / output_file
261261

262262
def output_file(self):
263263
"""Returns the (computed) filesystem output `Path`.
@@ -405,13 +405,13 @@ def process_file(self) -> None:
405405
debug(f"Expanding '{self.path}' to '{self.output_file()}'")
406406
output = self.include(self.file_path)
407407
if not re.search(NO_COPY_REGEX, str(self.output_file())):
408-
if self.trees.output_path == Path("-"):
408+
if self.trees.output == Path("-"):
409409
sys.stdout.buffer.write(output)
410410
else:
411411
with open(self.output_file(), "wb") as fh:
412412
fh.write(output)
413413
elif not re.search(NO_COPY_REGEX, self.file_path.name):
414-
if self.trees.output_path == Path("-"):
414+
if self.trees.output == Path("-"):
415415
file_contents = self.file_path.read_bytes()
416416
sys.stdout.buffer.write(file_contents)
417417
else:

0 commit comments

Comments
 (0)