mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
Default to UTF-8 encoding in open() calls
This commit is contained in:
parent
1be4e4f82e
commit
e272c219fd
8 changed files with 26 additions and 18 deletions
|
|
@ -3,13 +3,14 @@ from __future__ import unicode_literals
|
|||
|
||||
import collections
|
||||
import contextlib
|
||||
import io
|
||||
import os.path
|
||||
import re
|
||||
import sys
|
||||
|
||||
import six
|
||||
|
||||
from pre_commit import util
|
||||
|
||||
|
||||
class ValidationError(ValueError):
|
||||
def __init__(self, error_msg, ctx=None):
|
||||
|
|
@ -266,7 +267,7 @@ def load_from_filename(filename, schema, load_strategy, exc_tp):
|
|||
if not os.path.exists(filename):
|
||||
raise ValidationError('{} does not exist'.format(filename))
|
||||
|
||||
with io.open(filename) as f:
|
||||
with util.open(filename) as f:
|
||||
contents = f.read()
|
||||
|
||||
with validate_context('File {}'.format(filename)):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue