mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
16 lines
403 B
Python
16 lines
403 B
Python
"""Defines parser helpers."""
|
|
|
|
from mozilla_version.errors import MissingFieldError
|
|
|
|
|
|
def get_value_matched_by_regex(field_name, regex_matches, string):
|
|
"""Ensure value stored in regex group exists."""
|
|
try:
|
|
value = regex_matches.group(field_name)
|
|
if value is not None:
|
|
return value
|
|
except IndexError:
|
|
pass
|
|
|
|
raise MissingFieldError(string, field_name)
|