Skip to content

Commit

Permalink
release/0.6.2: Add closing file
Browse files Browse the repository at this point in the history
  • Loading branch information
Darius Morawiec committed Jan 31, 2018
1 parent bdcfb1f commit b5efe78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sklearn_porter/Template.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def temp(self, name, templates=None, n_indents=None, skipping=False):
self.estimator_type, class_name, 'templates',
self.target_language, name + '.txt')
if os.path.isfile(path):
template = open(path, 'r').read()
with open(path, 'r') as file_:
template = file_.read()
if n_indents is not None:
template = self.indent(template, n_indents, skipping)
return template
Expand All @@ -112,4 +113,4 @@ def repr(self, value):
def data(self, dict_):
copy = self.__dict__.copy()
copy.update(dict_) # update and extend dictionary
return copy
return copy

0 comments on commit b5efe78

Please sign in to comment.