mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-26 01:45:28 +00:00
Move URL matching regex to method definition.
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
parent
c8f4489fa5
commit
5172605c49
|
@ -201,8 +201,6 @@ class ChangeLog:
|
||||||
# a version that is not yet released. Something like "3.1a" is accepted.
|
# a version that is not yet released. Something like "3.1a" is accepted.
|
||||||
_version_number_re = re.compile(br'[0-9]+\.[0-9A-Za-z.]+')
|
_version_number_re = re.compile(br'[0-9]+\.[0-9A-Za-z.]+')
|
||||||
_incomplete_version_number_re = re.compile(br'.*\.[A-Za-z]')
|
_incomplete_version_number_re = re.compile(br'.*\.[A-Za-z]')
|
||||||
_only_url_re = re.compile(br'^\s*\w+://\S+\s*$')
|
|
||||||
_has_url_re = re.compile(br'.*://.*')
|
|
||||||
|
|
||||||
def add_categories_from_text(self, filename, line_offset,
|
def add_categories_from_text(self, filename, line_offset,
|
||||||
text, allow_unknown_category):
|
text, allow_unknown_category):
|
||||||
|
@ -221,12 +219,14 @@ class ChangeLog:
|
||||||
category.name.decode('utf8'))
|
category.name.decode('utf8'))
|
||||||
|
|
||||||
body_split = category.body.splitlines()
|
body_split = category.body.splitlines()
|
||||||
|
_only_url_re = re.compile(br'^\s*\w+://\S+\s*$')
|
||||||
|
_has_url_re = re.compile(br'.*://.*')
|
||||||
for line_number, line in enumerate(body_split, 1):
|
for line_number, line in enumerate(body_split, 1):
|
||||||
if not self.__class__._only_url_re.match(line) and \
|
if not _only_url_re.match(line) and \
|
||||||
len(line) > MAX_LINE_LENGTH:
|
len(line) > MAX_LINE_LENGTH:
|
||||||
long_url_msg = '. URL exceeding length limit must be ' \
|
long_url_msg = '. URL exceeding length limit must be ' \
|
||||||
'alone in it\'s line.' if \
|
'alone in it\'s line.' if _has_url_re.match(line) \
|
||||||
self.__class__._has_url_re.match(line) else ""
|
else ""
|
||||||
raise InputFormatError(filename,
|
raise InputFormatError(filename,
|
||||||
category.body_line + line_number,
|
category.body_line + line_number,
|
||||||
'Line is longer than allowed: '
|
'Line is longer than allowed: '
|
||||||
|
|
Loading…
Reference in a new issue