A Python code generator for XSD schemas.
| 564 | |
| 565 | |
| 566 | class PythonGenerator(AbstractGenerator): |
| 567 | """A Python code generator for XSD schemas.""" |
| 568 | |
| 569 | formal_language = 'Python' |
| 570 | |
| 571 | searchpaths = ['templates/python/'] |
| 572 | |
| 573 | builtin_types = { |
| 574 | 'string': 'str', |
| 575 | 'decimal': 'decimal.Decimal', |
| 576 | 'float': 'float', |
| 577 | 'double': 'float', |
| 578 | |
| 579 | 'date': 'datatypes.Date10', |
| 580 | 'dateTime': 'datatypes.DateTime10', |
| 581 | 'gDay': 'datatypes.GregorianDay', |
| 582 | 'gMonth': 'datatypes.GregorianMonth', |
| 583 | 'gMonthDay': 'datatypes.GregorianMonthDay', |
| 584 | 'gYear': 'datatypes.GregorianYear10', |
| 585 | 'gYearMonth': 'datatypes.GregorianYearMonth10', |
| 586 | 'time': 'datatypes.Time', |
| 587 | 'duration': 'datatypes.Duration', |
| 588 | |
| 589 | 'QName': 'datatypes.QName', |
| 590 | 'NOTATION': 'datatypes.DateTime10', |
| 591 | 'anyURI': 'datatypes.AnyURI', |
| 592 | 'boolean': 'bool', |
| 593 | 'base64Binary': 'datatypes.Base64Binary', |
| 594 | 'hexBinary': 'datatypes.HexBinary', |
| 595 | 'normalizedString': 'str', |
| 596 | 'token': 'str', |
| 597 | 'language': 'str', |
| 598 | 'Name': 'str', |
| 599 | 'NCName': 'str', |
| 600 | 'ID': 'str', |
| 601 | 'IDREF': 'str', |
| 602 | 'ENTITY': 'str', |
| 603 | 'NMTOKEN': 'str', |
| 604 | |
| 605 | 'integer': 'int', |
| 606 | 'long': 'int', |
| 607 | 'int': 'int', |
| 608 | 'short': 'int', |
| 609 | 'byte': 'int', |
| 610 | 'nonNegativeInteger': 'int', |
| 611 | 'positiveInteger': 'int', |
| 612 | 'unsignedLong': 'int', |
| 613 | 'unsignedInt': 'int', |
| 614 | 'unsignedShort': 'int', |
| 615 | 'unsignedByte': 'int', |
| 616 | 'nonPositiveInteger': 'int', |
| 617 | 'negativeInteger': 'int', |
| 618 | |
| 619 | # XSD 1.1 built-in types |
| 620 | 'dateTimeStamp': 'datatypes.DateTimeStamp10', |
| 621 | 'dayTimeDuration': 'datatypes.DayTimeDuration', |
| 622 | 'yearMonthDuration': 'datatypes.YearMonthDuration', |
| 623 | } |
no outgoing calls
searching dependent graphs…