diff --git a/src/bagit/__init__.py b/src/bagit/__init__.py index c17b1f2..890dbd8 100755 --- a/src/bagit/__init__.py +++ b/src/bagit/__init__.py @@ -133,7 +133,7 @@ def find_locale_dir(): #: Convenience function used everywhere we want to open a file to read text #: rather than undecoded bytes: -open_text_file = partial(codecs.open, encoding="utf-8", errors="strict") +open_text_file = partial(open, encoding="utf-8", errors="strict") # This is the same as decoding the byte values in codecs.BOM: UNICODE_BYTE_ORDER_MARK = "\ufeff" @@ -1423,8 +1423,8 @@ def _encode_filename(s): def _decode_filename(s): - s = re.sub(r"%0D", "\r", s, re.IGNORECASE) - s = re.sub(r"%0A", "\n", s, re.IGNORECASE) + s = re.sub(r"%0D", "\r", s, flags=re.IGNORECASE) + s = re.sub(r"%0A", "\n", s, flags=re.IGNORECASE) return s