Code Duplication    Length = 15-16 lines in 2 locations

processors/odin.py 2 locations

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