Skip to content

Commit 8c0f417

Browse files
committed
simplified append
1 parent b508fe3 commit 8c0f417

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

alembic/command.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ def init(
152152
file_path,
153153
toml_path,
154154
script_location=toml_script_location_directory,
155-
append_delimiter=b"\n\n",
156155
)
157156
else:
158157
script._generate_template(

alembic/util/pyfiles.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def template_to_file(
2727
output_encoding: str,
2828
*,
2929
append: bool = False,
30-
append_delimiter: Optional[bytes] = None,
3130
**kw: Any,
3231
) -> None:
3332
template = Template(filename=_preserving_path_as_str(template_file))
@@ -46,13 +45,9 @@ def template_to_file(
4645
"template-oriented traceback." % fname
4746
)
4847
else:
49-
if append and append_delimiter:
50-
if os.path.exists(dest):
51-
with open(dest, "rb") as f:
52-
_exsiting = f.read()
53-
if not _exsiting.endswith(append_delimiter):
54-
output = append_delimiter + output
5548
with open(dest, "ab" if append else "wb") as f:
49+
if append:
50+
f.write(b"\n\n")
5651
f.write(output)
5752

5853

0 commit comments

Comments
 (0)