Skip to content

Commit 8c5c30a

Browse files
author
Alistair Turnbull
committed
Inline expand_file() into its only caller.
1 parent 60eb64e commit 8c5c30a

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

nancy/__init__.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,6 @@ def expand_bytes(
157157
) -> bytes:
158158
return Expand(self, base_file, file_path, output_file).expand_bytes(text)
159159

160-
# TODO: Inline into callers, and remove.
161-
def expand_file(self, base_file: Path, file_path: Path, output_file: Path) -> bytes:
162-
"""Expand a file given its filesystem `Path`.
163-
164-
Args:
165-
base_file (Path): the filesystem input `Path`
166-
file_path (Path): the `inputs`-relative `Path`
167-
output_file (Path): the filesystem output `Path`
168-
"""
169-
debug(f"expand_file {base_file} on path {file_path} to {output_file}")
170-
return self.expand_bytes(file_path.read_bytes(), base_file, file_path, output_file)
171-
172160
def get_output_path(self, base_file: Path, file_path: Path) -> Path:
173161
"""Compute the output path of an input file.
174162
@@ -201,7 +189,8 @@ def process_file(self, base_file: Path, file_path: Path) -> None:
201189
debug(f"Processing file '{file_path}'")
202190
if re.search(TEMPLATE_REGEX, file_path.name):
203191
debug(f"Expanding '{base_file}' to '{output_file}'")
204-
output = self.expand_file(base_file, file_path, output_file)
192+
text = file_path.read_bytes()
193+
output = self.expand_bytes(text, base_file, file_path, output_file)
205194
if not re.search(NO_COPY_REGEX, str(output_file)):
206195
if output_file == Path("-"):
207196
sys.stdout.buffer.write(output)

0 commit comments

Comments
 (0)