bazarr/libs/guessit/rules/properties/edition.py

31 lines
823 B
Python
Raw Normal View History

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
edition property
"""
from rebulk import Rebulk
from rebulk.remodule import re
from ..common import dash
2020-05-20 15:29:39 +00:00
from ..common.pattern import is_disabled
from ..common.validators import seps_surround
from ...config import load_config_patterns
2020-05-20 15:29:39 +00:00
def edition(config): # pylint:disable=unused-argument
"""
Builder for rebulk object.
2020-05-20 15:29:39 +00:00
:param config: rule configuration
:type config: dict
:return: Created Rebulk object
:rtype: Rebulk
"""
2020-05-20 15:29:39 +00:00
rebulk = Rebulk(disabled=lambda context: is_disabled(context, 'edition'))
rebulk.regex_defaults(flags=re.IGNORECASE, abbreviations=[dash]).string_defaults(ignore_case=True)
rebulk.defaults(name='edition', validator=seps_surround)
load_config_patterns(rebulk, config.get('edition'))
return rebulk