You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB

4 years ago
  1. __all__ = ['BaseLoader', 'FullLoader', 'SafeLoader', 'Loader', 'UnsafeLoader']
  2. from .reader import *
  3. from .scanner import *
  4. from .parser import *
  5. from .composer import *
  6. from .constructor import *
  7. from .resolver import *
  8. class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver):
  9. def __init__(self, stream):
  10. Reader.__init__(self, stream)
  11. Scanner.__init__(self)
  12. Parser.__init__(self)
  13. Composer.__init__(self)
  14. BaseConstructor.__init__(self)
  15. BaseResolver.__init__(self)
  16. class FullLoader(Reader, Scanner, Parser, Composer, FullConstructor, Resolver):
  17. def __init__(self, stream):
  18. Reader.__init__(self, stream)
  19. Scanner.__init__(self)
  20. Parser.__init__(self)
  21. Composer.__init__(self)
  22. FullConstructor.__init__(self)
  23. Resolver.__init__(self)
  24. class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver):
  25. def __init__(self, stream):
  26. Reader.__init__(self, stream)
  27. Scanner.__init__(self)
  28. Parser.__init__(self)
  29. Composer.__init__(self)
  30. SafeConstructor.__init__(self)
  31. Resolver.__init__(self)
  32. class Loader(Reader, Scanner, Parser, Composer, Constructor, Resolver):
  33. def __init__(self, stream):
  34. Reader.__init__(self, stream)
  35. Scanner.__init__(self)
  36. Parser.__init__(self)
  37. Composer.__init__(self)
  38. Constructor.__init__(self)
  39. Resolver.__init__(self)
  40. # UnsafeLoader is the same as Loader (which is and was always unsafe on
  41. # untrusted input). Use of either Loader or UnsafeLoader should be rare, since
  42. # FullLoad should be able to load almost all YAML safely. Loader is left intact
  43. # to ensure backwards compatibility.
  44. class UnsafeLoader(Reader, Scanner, Parser, Composer, Constructor, Resolver):
  45. def __init__(self, stream):
  46. Reader.__init__(self, stream)
  47. Scanner.__init__(self)
  48. Parser.__init__(self)
  49. Composer.__init__(self)
  50. Constructor.__init__(self)
  51. Resolver.__init__(self)