Skip to content

Commit fdae1ed

Browse files
committed
Remove "# coding: utf-8" from output files.
1 parent 6e1e36b commit fdae1ed

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

notebook2script/__main__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import warnings
2929
from typing import Iterable, Union
3030

31+
# 3rd party
32+
from pre_commit_hooks.fix_encoding_pragma import fix_encoding_pragma
33+
3134
# this package
3235
from notebook2script.ipynb2py import convert_notebook
3336
from notebook2script.pointless import Pointless
@@ -110,6 +113,8 @@ def process_notebook(notebook, outfile: Union[str, pathlib.Path, os.PathLike]) -
110113

111114
convert_notebook(notebook, outfile)
112115
linter.process_file(outfile)
116+
with open(outfile, "r+b") as f:
117+
fix_encoding_pragma(f, remove=True, expected_pragma=b"# coding: utf-8")
113118

114119

115120
if __name__ == "__main__":

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ domdf-python-tools>=1.0.0
33
ipython>=7.14.0
44
isort>=5.5.2
55
nbconvert>=5.6.1
6+
pre-commit-hooks>=3.3.0
67
pylint>=2.5.2
78
yapf-isort>=0.3.3

0 commit comments

Comments
 (0)