# Path: grace/error.py
# class WrongFormatError(Error):
#     pass
# 
# class MissingKeyError(Error):
#     pass
# 
# class FileNotFoundError(Error):
#     pass
# 
# class KeyNotAllowedError(Error):
#     pass
# 
# Path: grace/utils.py
# def update(d, u):
#     for k, v in u.items():
#         if isinstance(v, collections.Mapping):
#             r = update(d.get(k, {}), v)
#             d[k] = r
#         else:
#             d[k] = u[k]
#     return d
# 
# def load_json(string):
#     obj = {}
# 
#     try:
#         obj = json.loads(string)
#     except ValueError as e:
#         raise e
# 
#     if sys.version_info.major < 3:
#         return _json_decode(obj)
# 
#     # if sys.version_info.major < 3:
#     #     d = _json_decode(obj)
#     #     if 'dizmo_settings' in d:
#     #         print(isinstance(d['dizmo_settings']['display_name'], str))
#     #         print(isinstance(d['dizmo_settings']['display_name'], unicode))
#     #         print(type(d['dizmo_settings']['display_name']))
#     #     return d
# 
#     return obj
# 
# def isstring(string):
#     if isinstance(string, str):
#         return True
# 
#     if sys.version_info.major < 3:
#         if isinstance(string, newstr):
#             return True
#         if isinstance(string, basestring):
#             return True
# 
#     return False


from builtins import object
from .error import WrongFormatError, MissingKeyError, FileNotFoundError, KeyNotAllowedError
from .utils import update, load_json, isstring
import os
import re

        for index, project in enumerate(self._config['embedded_projects']):
            if 'source' in project:
                if isinstance(project['source'], dict):
                    if 'url' not in project['source']:
                        raise MissingKeyError('The provided source is a dict but no url was defined under it.')
                    if 'type' not in project['source']:
                        url = project['source']['url']
                        urltype = 'git'
                        if url.endswith('tar.gz'):
                            urltype = 'tar.gz'
                        if url.endswith('tar'):
                            urltype = 'tar'
                        if url.endswith('zip'):
                            urltype = 'zip'
                        if url.endswith('git'):
                            urltype = 'git'
                        if os.path.exists(url):
                            urltype = 'file'

                        self._config['embedded_projects'][index]['source']['type'] = urltype
                    else:
                        urltype = project['source']['type']
                        if not (urltype == 'tar.gz' or urltype == 'tar' or urltype == 'zip' or urltype == 'git'):
                            raise WrongFormatError('The provided url type is not either zip, tar, tar.gz or git.')
                    if 'branch' not in project['source']:
                        self._config['embedded_projects'][index]['source']['branch'] = 'master'
                    else:
                        if not isstring(project['source']['branch']):
                            raise WrongFormatError('The provided branch to check out is not a string.')

# Path: grace/error.py
# class WrongFormatError(Error):
#     pass
# 
# class MissingKeyError(Error):
#     pass
# 
# class FileNotFoundError(Error):
#     pass
# 
# class KeyNotAllowedError(Error):
#     pass
# 
# Path: grace/utils.py
# def update(d, u):
#     for k, v in u.items():
#         if isinstance(v, collections.Mapping):
#             r = update(d.get(k, {}), v)
#             d[k] = r
#         else:
#             d[k] = u[k]
#     return d
# 
# def load_json(string):
#     obj = {}
# 
#     try:
#         obj = json.loads(string)
#     except ValueError as e:
#         raise e
# 
#     if sys.version_info.major < 3:
#         return _json_decode(obj)
# 
#     # if sys.version_info.major < 3:
#     #     d = _json_decode(obj)
#     #     if 'dizmo_settings' in d:
#     #         print(isinstance(d['dizmo_settings']['display_name'], str))
#     #         print(isinstance(d['dizmo_settings']['display_name'], unicode))
#     #         print(type(d['dizmo_settings']['display_name']))
#     #     return d
# 
#     return obj
# 
# def isstring(string):
#     if isinstance(string, str):
#         return True
# 
#     if sys.version_info.major < 3:
#         if isinstance(string, newstr):
#             return True
#         if isinstance(string, basestring):
#             return True
# 
#     return False


# Path: grace/config.py
from builtins import object
from .error import WrongFormatError, MissingKeyError, FileNotFoundError, KeyNotAllowedError
from .utils import update, load_json, isstring
import os
import re


        for index, project in enumerate(self._config['embedded_projects']):
            if 'source' in project:
                if isinstance(project['source'], dict):
                    if 'url' not in project['source']:
                        raise MissingKeyError('The provided source is a dict but no url was defined under it.')
                    if 'type' not in project['source']:
                        url = project['source']['url']
                        urltype = 'git'
                        if url.endswith('tar.gz'):
                            urltype = 'tar.gz'
                        if url.endswith('tar'):
                            urltype = 'tar'
                        if url.endswith('zip'):
                            urltype = 'zip'
                        if url.endswith('git'):
                            urltype = 'git'
                        if os.path.exists(url):
                            urltype = 'file'

                        self._config['embedded_projects'][index]['source']['type'] = urltype
                    else:
                        urltype = project['source']['type']
                        if not (urltype == 'tar.gz' or urltype == 'tar' or urltype == 'zip' or urltype == 'git'):
                            raise WrongFormatError('The provided url type is not either zip, tar, tar.gz or git.')
                    if 'branch' not in project['source']:
                        self._config['embedded_projects'][index]['source']['branch'] = 'master'
                    else:
                        if not isstring(project['source']['branch']):
                            raise WrongFormatError('The provided branch to check out is not a string.')

                elif isstring(project['source']):