cyaml.py 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # SPDX-License-Identifier: MIT
  2. __all__ = ['CBaseLoader', 'CSafeLoader', 'CLoader',
  3. 'CBaseDumper', 'CSafeDumper', 'CDumper']
  4. from _yaml import CParser, CEmitter
  5. from .constructor import *
  6. from .serializer import *
  7. from .representer import *
  8. from .resolver import *
  9. class CBaseLoader(CParser, BaseConstructor, BaseResolver):
  10. def __init__(self, stream):
  11. CParser.__init__(self, stream)
  12. BaseConstructor.__init__(self)
  13. BaseResolver.__init__(self)
  14. class CSafeLoader(CParser, SafeConstructor, Resolver):
  15. def __init__(self, stream):
  16. CParser.__init__(self, stream)
  17. SafeConstructor.__init__(self)
  18. Resolver.__init__(self)
  19. class CLoader(CParser, Constructor, Resolver):
  20. def __init__(self, stream):
  21. CParser.__init__(self, stream)
  22. Constructor.__init__(self)
  23. Resolver.__init__(self)
  24. class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver):
  25. def __init__(self, stream,
  26. default_style=None, default_flow_style=None,
  27. canonical=None, indent=None, width=None,
  28. allow_unicode=None, line_break=None,
  29. encoding=None, explicit_start=None, explicit_end=None,
  30. version=None, tags=None):
  31. CEmitter.__init__(self, stream, canonical=canonical,
  32. indent=indent, width=width, encoding=encoding,
  33. allow_unicode=allow_unicode, line_break=line_break,
  34. explicit_start=explicit_start, explicit_end=explicit_end,
  35. version=version, tags=tags)
  36. Representer.__init__(self, default_style=default_style,
  37. default_flow_style=default_flow_style)
  38. Resolver.__init__(self)
  39. class CSafeDumper(CEmitter, SafeRepresenter, Resolver):
  40. def __init__(self, stream,
  41. default_style=None, default_flow_style=None,
  42. canonical=None, indent=None, width=None,
  43. allow_unicode=None, line_break=None,
  44. encoding=None, explicit_start=None, explicit_end=None,
  45. version=None, tags=None):
  46. CEmitter.__init__(self, stream, canonical=canonical,
  47. indent=indent, width=width, encoding=encoding,
  48. allow_unicode=allow_unicode, line_break=line_break,
  49. explicit_start=explicit_start, explicit_end=explicit_end,
  50. version=version, tags=tags)
  51. SafeRepresenter.__init__(self, default_style=default_style,
  52. default_flow_style=default_flow_style)
  53. Resolver.__init__(self)
  54. class CDumper(CEmitter, Serializer, Representer, Resolver):
  55. def __init__(self, stream,
  56. default_style=None, default_flow_style=None,
  57. canonical=None, indent=None, width=None,
  58. allow_unicode=None, line_break=None,
  59. encoding=None, explicit_start=None, explicit_end=None,
  60. version=None, tags=None):
  61. CEmitter.__init__(self, stream, canonical=canonical,
  62. indent=indent, width=width, encoding=encoding,
  63. allow_unicode=allow_unicode, line_break=line_break,
  64. explicit_start=explicit_start, explicit_end=explicit_end,
  65. version=version, tags=tags)
  66. Representer.__init__(self, default_style=default_style,
  67. default_flow_style=default_flow_style)
  68. Resolver.__init__(self)