From d06e4fc8dbba528c2c4d7d28026cd726196d92a7 Mon Sep 17 00:00:00 2001 From: Sebastian Kreft Date: Sat, 12 Dec 2015 18:58:44 -0300 Subject: [PATCH] Added support for python 3.5 It replaces the use of attrfind in favor of attrfind_tolerant, as the former was removed in python 3.5. Fixes deezer/html-linter#8. --- .travis.yml | 1 + html_linter.py | 7 ++++--- setup.py | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6ecffd7..53fd90e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ python: - "2.7" - "3.3" - "3.4" + - "3.5" - "pypy" - "pypy3" # command to install dependencies diff --git a/html_linter.py b/html_linter.py index 4dbfe85..9d55878 100644 --- a/html_linter.py +++ b/html_linter.py @@ -461,7 +461,7 @@ def get_attribute_line_column(tag_definition, line, column, attribute): Return: A (line, column) tuple representing the position of the attribute. """ - for match in HTMLParser.attrfind.finditer(tag_definition): + for match in HTMLParser.attrfind_tolerant.finditer(tag_definition): if match.group(1).lower() == attribute: return get_line_column(tag_definition, line, column, match.start(1)) @@ -480,7 +480,7 @@ def get_value_line_column(tag_definition, line, column, attribute): Return: A (line, column) tuple representing the position of the value. """ - for match in HTMLParser.attrfind.finditer(tag_definition): + for match in HTMLParser.attrfind_tolerant.finditer(tag_definition): if match.group(1).lower() == attribute: if not match.group(3): pos = match.end(1) @@ -797,7 +797,8 @@ def _check_starttag_capitalization(self, tag): def _check_attributes_case_quotation_entities(self, tag, unused_attrs): original_def = self.get_starttag_text() - for match in HTMLParser.attrfind.finditer(original_def, len(tag) + 1): + for match in HTMLParser.attrfind_tolerant.finditer(original_def, + len(tag) + 1): # We do not use islower() due to http://bugs.python.org/issue13822. if match.group(1) != match.group(1).lower(): line, column = self.get_attribute_line_column( diff --git a/setup.py b/setup.py index 2d0cfce..bb34927 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ setup( name='html-linter', - version='0.1.9', + version='0.2.0', description='Lints an HTML5 file using Google\'s style guide', long_description=open('README.rst').read(), author='Sebastian Kreft', @@ -39,6 +39,7 @@ 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development', ],