diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2014-07-25 15:57:12 +0200 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2014-07-25 15:57:12 +0200 |
commit | 6895584b2b3cb9cb128804048f826d3b077d1d1b (patch) | |
tree | dfada18a16627cd82b9f0ae1041803f79f5f2c3f /builder.py | |
parent | 320d0ae58cde934193f83428fb1149f097a4bec2 (diff) | |
download | astroid-git-6895584b2b3cb9cb128804048f826d3b077d1d1b.tar.gz |
pylint source code
Diffstat (limited to 'builder.py')
-rw-r--r-- | builder.py | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -42,12 +42,12 @@ if sys.version_info >= (3, 0): from tokenize import detect_encoding def open_source_file(filename): - with open(filename, 'bU') as byte_stream: + with open(filename, 'rb') as byte_stream: encoding = detect_encoding(byte_stream.readline)[0] - stream = open(filename, 'U', encoding=encoding) + stream = open(filename, 'rU', encoding=encoding) try: data = stream.read() - except UnicodeError, uex: # wrong encodingg + except UnicodeError: # wrong encodingg # detect_encoding returns utf-8 if no encoding specified msg = 'Wrong (%s) or no encoding specified' % encoding raise AstroidBuildingException(msg) @@ -56,7 +56,7 @@ if sys.version_info >= (3, 0): else: import re - _ENCODING_RGX = re.compile("\s*#+.*coding[:=]\s*([-\w.]+)") + _ENCODING_RGX = re.compile(r"\s*#+.*coding[:=]\s*([-\w.]+)") def _guess_encoding(string): """get encoding from a python file as string or return None if not found @@ -115,7 +115,7 @@ class AstroidBuilder(InspectBuilder): path is expected to be a python source file """ try: - stream, encoding, data = open_source_file(path) + _, encoding, data = open_source_file(path) except IOError, exc: msg = 'Unable to load file %r (%s)' % (path, exc) raise AstroidBuildingException(msg) |