Skip to content

Commit

Permalink
Trim trailing whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
17451k committed Mar 11, 2020
1 parent 88edf41 commit 7a53f64
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions eventb_to_txt/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ def _print_comment(self, data, f):
f.write(data['comment'])

f.write('\n')

def _trim_trailing_whitespaces(self, path):
lines = ''.join([line.rstrip() + '\n' for line in open(path).readlines()])

with open(path, 'w') as f:
f.writelines(lines)
2 changes: 2 additions & 0 deletions eventb_to_txt/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def to_txt(self, out_path, merge=False):

f.write('end\n')

self._trim_trailing_whitespaces(out_path)

def __print_context_head(self, f):
f.write('context ' + self.get_component_name())

Expand Down
2 changes: 2 additions & 0 deletions eventb_to_txt/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def to_txt(self, out_path, merge=False):

f.write('end\n')

self._trim_trailing_whitespaces(out_path)

def __print_machine_head(self, f):
f.write('machine ' + self.get_component_name())

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name='eventb-to-txt',
version='1.3',
version='1.3.1',
author='Ilya Shchepetkov',
author_email='ilya.shchepetkov@yandex.ru',
license='LICENSE.txt',
Expand Down

0 comments on commit 7a53f64

Please sign in to comment.