mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 19:46:54 +00:00
Use open built-in to open files
* This makes Python 3 not raise UnicodeDecodeError when reading files
This commit is contained in:
parent
9573c13884
commit
51f8cc8ff0
6 changed files with 9 additions and 14 deletions
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import io
|
||||
import os.path
|
||||
|
||||
|
||||
|
|
@ -14,5 +13,5 @@ def get_resource_path(path):
|
|||
|
||||
def write_file(filename, contents):
|
||||
"""Hax because coveragepy chokes on nested context managers."""
|
||||
with io.open(filename, 'w', newline='') as file_obj:
|
||||
with open(filename, 'w', newline='') as file_obj:
|
||||
file_obj.write(contents)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue