ret.append(match.span) return ret _id_regexps = Rebulk().functional( _id_regexps_function, name='regexpId', disabled=lambda context: not context.get('id_regexps') ) def rules_builder(config): rebulk = rebulk_builder(config) rebulk.rebulk(_id_regexps) return rebulk guessit_api = GuessItApi() guessit_api.configure(options={}, rules_builder=rules_builder, force=True) def normalize_component(data): if data is None: return [] if isinstance(data, list): return [d.lower().replace('-', '') for d in data] return [data.lower().replace('-', '')] try: preferred_clock = time.process_time except AttributeError:
def _id_regexps_function(input_string, context): ret = [] for regexp in context.get('id_regexps'): for match in RePattern(regexp, children=True).matches(input_string, context): ret.append(match.span) return ret _id_regexps = Rebulk().functional( _id_regexps_function, name='regexpId', disabled=lambda context: not context.get('id_regexps')) guessit_api = GuessItApi(rebulk_builder().rebulk(_id_regexps)) class ParserGuessit(object): def _guessit_options(self, options): settings = { 'name_only': True, 'allowed_languages': ['en', 'fr'], 'allowed_countries': ['us', 'uk', 'gb'] } # 'clean_function': clean_value options['episode_prefer_number'] = not options.get( 'identified_by') == 'ep' if options.get('allow_groups'): options['expected_group'] = options['allow_groups'] if 'date_yearfirst' in options:
return ret _id_regexps = Rebulk().functional( _id_regexps_function, name='regexpId', disabled=lambda context: not context.get('id_regexps')) def rules_builder(config): rebulk = rebulk_builder(config) rebulk.rebulk(_id_regexps) return rebulk guessit_api = GuessItApi() guessit_api.configure(options={}, rules_builder=rules_builder, force=True) def normalize_component(data): if data is None: return [] if isinstance(data, list): return [d.lower().replace('-', '') for d in data] return [data.lower().replace('-', '')] try: preferred_clock = time.process_time except AttributeError: