aboutsummaryrefslogtreecommitdiffhomepage
path: root/libs/guessit/monkeypatch.py
blob: 14ddf6e89bfdf8371110b719fd70f52de3436951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Monkeypatch initialisation functions
"""

from collections import OrderedDict

from rebulk.match import Match


def monkeypatch_rebulk():
    """Monkeypatch rebulk classes"""

    @property
    def match_advanced(self):
        """
        Build advanced dict from match
        :param self:
        :return:
        """

        ret = OrderedDict()
        ret['value'] = self.value
        if self.raw:
            ret['raw'] = self.raw
        ret['start'] = self.start
        ret['end'] = self.end
        return ret

    Match.advanced = match_advanced