MCPcopy Create free account
hub / github.com/sissaschool/xmlschema / PythonGenerator

Class PythonGenerator

xmlschema/extras/codegen.py:566–623  ·  view source on GitHub ↗

A Python code generator for XSD schemas.

Source from the content-addressed store, hash-verified

564
565
566class 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 }

Callers 4

test_sample_moduleMethod · 0.90
test_bindings_moduleMethod · 0.90
check_xsd_fileMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_sample_moduleMethod · 0.72
test_bindings_moduleMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…