Code Duplication    Length = 15-16 lines in 2 locations

processors/odin.py 2 locations

@@ 105-120 (lines=16) @@
102
103
    def to_JSON(self):
104
        return json.dumps(self.to_JSON_dict(), sort_keys=True, indent=4)
105
106
class DocumentWithURL(object):
107
108
    def __init__(self, document, url):
109
        # TODO: throw exception if isinstance(document, Document) is False
110
        self.document = document
111
        # TODO: throw exception if url is invalid
112
        self.url = url
113
114
    def to_JSON_dict(self):
115
        jdict = dict()
116
        jdict["document"] = self.document.to_JSON_dict()
117
        jdict["url"] = self.url
118
        return jdict
119
120
    def to_JSON(self):
121
        return json.dumps(self.to_JSON_dict(), sort_keys=True, indent=4)
122
123
class Mention(object):
@@ 89-103 (lines=15) @@
86
87
    def to_JSON(self):
88
        return json.dumps(self.to_JSON_dict(), sort_keys=True, indent=4)
89
90
class DocumentWithRules(object):
91
92
    def __init__(self, document, rules):
93
        # TODO: throw exception if isinstance(document, Document) is False
94
        self.document = document
95
        self.rules = rules
96
97
    def to_JSON_dict(self):
98
        jdict = dict()
99
        jdict["document"] = self.document.to_JSON_dict()
100
        jdict["rules"] = self.rules
101
        return jdict
102
103
    def to_JSON(self):
104
        return json.dumps(self.to_JSON_dict(), sort_keys=True, indent=4)
105
106
class DocumentWithURL(object):