cyaml.py 3.8 KB

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