

from .meta import LanguageMeta, DocumentContext
from .import_ import ImportContext

# Import languages to register them
import semantix.utils.lang.yaml


class SemantixLangLoaderError(Exception):
    pass


def load(filename, context=None):
    (lang, filename) = LanguageMeta.recognize_file(filename)
    if lang:
        with open(filename) as f:
            result = lang.load(f, context)
            for d in result:
                yield d
        return

    raise SemantixLangLoaderError('unable to load file:  %s' % filename)



from .meta import LanguageMeta, DocumentContext
from .import_ import ImportContext

# Import languages to register them
from semantix.utils.lang import yaml


class SemantixLangLoaderError(Exception):
    pass


def load(filename, context=None):
    (lang, filename) = LanguageMeta.recognize_file(filename)
    if lang:
        with open(filename) as f:
            result = lang.load(f, context)
            for d in result:
                yield d
        return

    raise SemantixLangLoaderError('unable to load file:  %s' % filename)

Add support for data URI scheme
caos: Add support for data URI scheme

It is now possible to use `data:' backend URIs:

    meta_backend_uri = 'data:application/x-yaml,<YAML DOCUMENT DATA>'

  
  
  from .meta import LanguageMeta, DocumentContext
  from .import_ import ImportContext
  
  # Import languages to register them
- import semantix.utils.lang.yaml
+ from semantix.utils.lang import yaml
  
  
  class SemantixLangLoaderError(Exception):
      pass
  
  
  def load(filename, context=None):
      (lang, filename) = LanguageMeta.recognize_file(filename)
      if lang:
          with open(filename) as f:
              result = lang.load(f, context)
              for d in result:
                  yield d
          return
  
      raise SemantixLangLoaderError('unable to load file:  %s' % filename)
  
Add support for data URI scheme
## Code Before:


from .meta import LanguageMeta, DocumentContext
from .import_ import ImportContext

# Import languages to register them
import semantix.utils.lang.yaml


class SemantixLangLoaderError(Exception):
    pass


def load(filename, context=None):
    (lang, filename) = LanguageMeta.recognize_file(filename)
    if lang:
        with open(filename) as f:
            result = lang.load(f, context)
            for d in result:
                yield d
        return

    raise SemantixLangLoaderError('unable to load file:  %s' % filename)

## Instruction:
Add support for data URI scheme
## Code After:


from .meta import LanguageMeta, DocumentContext
from .import_ import ImportContext

# Import languages to register them
from semantix.utils.lang import yaml


class SemantixLangLoaderError(Exception):
    pass


def load(filename, context=None):
    (lang, filename) = LanguageMeta.recognize_file(filename)
    if lang:
        with open(filename) as f:
            result = lang.load(f, context)
            for d in result:
                yield d
        return

    raise SemantixLangLoaderError('unable to load file:  %s' % filename)
