Skip to content

Commit

Permalink
Merge pull request #15 from vdmit/main
Browse files Browse the repository at this point in the history
Better (python-way) file operations in parseFile
  • Loading branch information
jaraco authored Feb 23, 2022
2 parents 740e940 + ca5ef83 commit f83e54a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cssutils/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ def parseFile(
# href = u'file:' + urllib.pathname2url(os.path.abspath(filename))
href = path2url(filename)

f = open(filename, 'rb')
css = f.read()
f.close()
with open(filename, 'rb') as fd:
css = fd.read()

return self.parseString(
css,
Expand Down

0 comments on commit f83e54a

Please sign in to comment.