|
@@ 526-541 (lines=16) @@
|
| 523 |
|
def to_JSON(self): |
| 524 |
|
return json.dumps(self.to_JSON_dict(), sort_keys=True, indent=None) |
| 525 |
|
|
| 526 |
|
class DocumentWithURL(object): |
| 527 |
|
|
| 528 |
|
def __init__(self, document, url): |
| 529 |
|
# TODO: throw exception if isinstance(document, Document) is False |
| 530 |
|
self.document = document |
| 531 |
|
# TODO: throw exception if url is invalid |
| 532 |
|
self.url = url |
| 533 |
|
|
| 534 |
|
def to_JSON_dict(self): |
| 535 |
|
jdict = dict() |
| 536 |
|
jdict["document"] = self.document.to_JSON_dict() |
| 537 |
|
jdict["url"] = self.url |
| 538 |
|
return jdict |
| 539 |
|
|
| 540 |
|
def to_JSON(self): |
| 541 |
|
return json.dumps(self.to_JSON_dict(), sort_keys=True, indent=None) |
| 542 |
|
|
|
@@ 510-524 (lines=15) @@
|
| 507 |
|
def to_JSON(self): |
| 508 |
|
return json.dumps(self.to_JSON_dict(), sort_keys=True, indent=None) |
| 509 |
|
|
| 510 |
|
class DocumentWithRules(object): |
| 511 |
|
|
| 512 |
|
def __init__(self, document, rules): |
| 513 |
|
# TODO: throw exception if isinstance(document, Document) is False |
| 514 |
|
self.document = document |
| 515 |
|
self.rules = rules |
| 516 |
|
|
| 517 |
|
def to_JSON_dict(self): |
| 518 |
|
jdict = dict() |
| 519 |
|
jdict["document"] = self.document.to_JSON_dict() |
| 520 |
|
jdict["rules"] = self.rules |
| 521 |
|
return jdict |
| 522 |
|
|
| 523 |
|
def to_JSON(self): |
| 524 |
|
return json.dumps(self.to_JSON_dict(), sort_keys=True, indent=None) |
| 525 |
|
|
| 526 |
|
class DocumentWithURL(object): |
| 527 |
|
|