Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Workaround to preserve original PyYAML module behavior #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pyraml/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__author__ = 'ad'

import mimetypes
import yaml
import imp
try:
from collections import OrderedDict
except ImportError:
Expand All @@ -11,6 +11,10 @@
from .raml_elements import ParserRamlInclude
from .constants import RAML_CONTENT_MIME_TYPES


yaml = imp.load_module('pyraml_yaml', *imp.find_module('yaml'))


class ValidationError(Exception):
def __init__(self, validation_errors):
self.errors = validation_errors
Expand Down
3 changes: 2 additions & 1 deletion pyraml/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import mimetypes
import os.path
import codecs
import yaml
import imp
import json
try:
from collections import OrderedDict
Expand All @@ -28,6 +28,7 @@

__all__ = ["RamlException", "RamlNotFoundException", "RamlParseException",
"ParseContext", "load", "parse"]
yaml = imp.load_module('pyraml_yaml', *imp.find_module('yaml'))


class RamlException(Exception):
Expand Down
5 changes: 4 additions & 1 deletion pyraml/raml_elements.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__author__ = 'ad'

import yaml
import imp


yaml = imp.load_module('pyraml_yaml', *imp.find_module('yaml'))


class ParserRamlInclude(yaml.YAMLObject):
Expand Down