Merge pull request #280 from pre-commit/no__rebase_on_pull
pull with --no-rebase
diff --git a/.gitignore b/.gitignore
index fc72fdb..c00e966 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,5 @@
/venv*
coverage-html
dist
+# SublimeText project/workspace files
+*.sublime-*
diff --git a/pre_commit_hooks/autopep8_wrapper.py b/pre_commit_hooks/autopep8_wrapper.py
index 52aaebe..b2d2d0c 100644
--- a/pre_commit_hooks/autopep8_wrapper.py
+++ b/pre_commit_hooks/autopep8_wrapper.py
@@ -14,12 +14,12 @@
retv = 0
for filename in args.files:
- original_contents = io.open(filename).read()
+ original_contents = io.open(filename, encoding='UTF-8').read()
new_contents = autopep8.fix_code(original_contents, args)
if original_contents != new_contents:
print('Fixing {}'.format(filename))
retv = 1
- with io.open(filename, 'w') as output_file:
+ with io.open(filename, 'w', encoding='UTF-8') as output_file:
output_file.write(new_contents)
return retv
diff --git a/pre_commit_hooks/check_docstring_first.py b/pre_commit_hooks/check_docstring_first.py
index f2f5b72..0896812 100644
--- a/pre_commit_hooks/check_docstring_first.py
+++ b/pre_commit_hooks/check_docstring_first.py
@@ -58,7 +58,7 @@
retv = 0
for filename in args.filenames:
- contents = io.open(filename).read()
+ contents = io.open(filename, encoding='UTF-8').read()
retv |= check_docstring_first(contents, filename=filename)
return retv
diff --git a/pre_commit_hooks/string_fixer.py b/pre_commit_hooks/string_fixer.py
index 3523e8a..f73f09d 100644
--- a/pre_commit_hooks/string_fixer.py
+++ b/pre_commit_hooks/string_fixer.py
@@ -32,7 +32,7 @@
def fix_strings(filename):
- contents = io.open(filename).read()
+ contents = io.open(filename, encoding='UTF-8').read()
line_offsets = get_line_offsets_by_line_no(contents)
# Basically a mutable string
@@ -52,7 +52,7 @@
new_contents = ''.join(splitcontents)
if contents != new_contents:
- with io.open(filename, 'w') as write_handle:
+ with io.open(filename, 'w', encoding='UTF-8') as write_handle:
write_handle.write(new_contents)
return 1
else:
diff --git a/testing/util.py b/testing/util.py
index 837a3cb..c5e4547 100644
--- a/testing/util.py
+++ b/testing/util.py
@@ -14,5 +14,5 @@
def write_file(filename, contents):
"""Hax because coveragepy chokes on nested context managers."""
- with io.open(filename, 'w', newline='') as file_obj:
+ with io.open(filename, 'w', encoding='UTF-8', newline='') as file_obj:
file_obj.write(contents)
diff --git a/tests/meta_test.py b/tests/meta_test.py
index 29e06a8..e5d068f 100644
--- a/tests/meta_test.py
+++ b/tests/meta_test.py
@@ -12,9 +12,9 @@
def test_legacy_hooks():
- with io.open('hooks.yaml') as legacy_file:
+ with io.open('hooks.yaml', encoding='UTF-8') as legacy_file:
legacy = yaml.load(legacy_file.read())
- with io.open('.pre-commit-hooks.yaml') as hooks_file:
+ with io.open('.pre-commit-hooks.yaml', encoding='UTF-8') as hooks_file:
hooks = yaml.load(hooks_file.read())
# The same set of hooks should be defined in both files