# Path: muranoclient/common/exceptions.py
# class BaseException(Exception):
# class InvalidEndpoint(BaseException):
# class CommunicationError(BaseException):
# class ClientException(Exception):
# class HTTPException(ClientException):
# class HTTPMultipleChoices(HTTPException):
# class BadRequest(HTTPException):
# class HTTPBadRequest(BadRequest):
# class Unauthorized(HTTPException):
# class HTTPUnauthorized(Unauthorized):
# class Forbidden(HTTPException):
# class HTTPForbidden(Forbidden):
# class NotFound(HTTPException):
# class HTTPNotFound(NotFound):
# class HTTPMethodNotAllowed(HTTPException):
# class Conflict(HTTPException):
# class HTTPConflict(Conflict):
# class OverLimit(HTTPException):
# class HTTPOverLimit(OverLimit):
# class HTTPInternalServerError(HTTPException):
# class HTTPNotImplemented(HTTPException):
# class HTTPBadGateway(HTTPException):
# class ServiceUnavailable(HTTPException):
# class HTTPServiceUnavailable(ServiceUnavailable):
# class NoTokenLookupException(Exception):
# class EndpointNotFound(Exception):
# class SSLConfigurationError(BaseException):
# class SSLCertificateError(BaseException):
#     def __init__(self, message=None):
#     def __str__(self):
#     def __init__(self, details=None):
#     def __str__(self):
#     def __str__(self):
# def from_response(response):
# def from_code(code):
# 
# Path: muranoclient/common/utils.py
# LOG = logging.getLogger(__name__)
# def arg(*args, **kwargs):
#     def _decorator(func):
# def json_formatter(js):
# def text_wrap_formatter(d):
# def pretty_choice_list(l):
# def print_list(objs, fields, field_labels, formatters=None, sortby=0):
# def print_dict(d, formatters=None):
# def find_resource(manager, name_or_id, *args, **kwargs):
# def string_to_bool(arg):
# def env(*vars, **kwargs):
# def exit(msg=''):
# def getsockopt(self, *args, **kwargs):
# def exception_to_str(exc):
#     def __init__(self, obj):
#     def close(self):
#     def __getattr__(self, name):
#     def __init__(self, name, binary=True):
#     def open(self):
# def to_url(filename, base_url, version='', path='/', extension=''):
#     def __init__(self, file_wrapper):
#     def file(self):
#     def close(self):
#     def save(self, dst, binary=True):
#     def __del__(self):
#     def from_file(file_obj):
#     def fromFile(file_obj):
#     def from_location(name, base_url='', version='', url='', path=None):
#     def validate(self):
#     def contents(self):
#     def manifest(self):
#     def images(self):
#     def resolvers(self):
#     def classes(self):
#     def ui(self):
#     def logo(self):
#     def _get_package_order(self, packages_graph):
#         def topological_sort(graph, start_node):
#             def dfs(node):
#         def transpose_graph(graph):
#         def top_sort_by_components(graph, component_order):
#             def dfs(node):
#     def requirements(self, base_url, path=None, dep_dict=None):
#     def _get_direct_deps(package, base_url, path):
# def save_image_local(image_spec, base_url, dst):
# def ensure_images(glance_client, image_specs, base_url,
#                   local_path=None,
#                   is_package_public=False):
#     def _image_valid(image, keys):
#     def from_file(file_obj):
#     def fromFile(file_obj):
#     def package_specs(self):
#     def packages(self, base_url='', path=None):
# def yaql_constructor(loader, node):
# def traverse_and_replace(obj,
#                          pattern=re.compile(r'^===id(\d+)===$'),
#                          replacements=None):
#     def _maybe_replace(obj, key, value):
#     def __init__(self, namespaces):
#     def resolve_name(self, name, relative=None):
# class NoCloseProxy(object):
# class File(object):
# class FileWrapperMixin(object):
# class Package(FileWrapperMixin):
# class Bundle(FileWrapperMixin):
# class DummyYaqlYamlLoader(yaml.SafeLoader):
# class YaqlYamlLoader(yaml.SafeLoader):
# class NamespaceResolver(object):
# 
# Path: muranoclient/i18n.py



import collections
import yaml
from glanceclient import exc as glance_exc
from muranoclient.common import exceptions as exc
from muranoclient.common import utils
from muranoclient.i18n import _
            filters = {'owner': self.tenant}
        existing = self.list(name=package_draft['name'],
                             version=package_draft['version'], **filters)
        try:
            next(existing)
            raise exc.HTTPConflict("Package already exists")
        except StopIteration:
            pass

        res = self.client.artifacts.create(**package_draft)
        app_id = res.id
        self.client.artifacts.upload_blob(app_id, 'archive', package.file())
        if package.logo is not None:
            self.client.artifacts.upload_blob(app_id, 'logo', package.logo)
        if package.ui is not None:
            self.client.artifacts.upload_blob(app_id, 'ui_definition',
                                              package.ui)
        package.file().close()
        self.client.artifacts.active(app_id)

        return self.client.artifacts.get(app_id)

    @staticmethod
    def _get_local_inheritance(classes, resolvers):
        result = {}
        for class_name, klass in classes.items():
            if 'Extends' not in klass:
                continue
            ns = klass.get('Namespaces')
            if ns:

# Path: muranoclient/common/exceptions.py
# class BaseException(Exception):
# class InvalidEndpoint(BaseException):
# class CommunicationError(BaseException):
# class ClientException(Exception):
# class HTTPException(ClientException):
# class HTTPMultipleChoices(HTTPException):
# class BadRequest(HTTPException):
# class HTTPBadRequest(BadRequest):
# class Unauthorized(HTTPException):
# class HTTPUnauthorized(Unauthorized):
# class Forbidden(HTTPException):
# class HTTPForbidden(Forbidden):
# class NotFound(HTTPException):
# class HTTPNotFound(NotFound):
# class HTTPMethodNotAllowed(HTTPException):
# class Conflict(HTTPException):
# class HTTPConflict(Conflict):
# class OverLimit(HTTPException):
# class HTTPOverLimit(OverLimit):
# class HTTPInternalServerError(HTTPException):
# class HTTPNotImplemented(HTTPException):
# class HTTPBadGateway(HTTPException):
# class ServiceUnavailable(HTTPException):
# class HTTPServiceUnavailable(ServiceUnavailable):
# class NoTokenLookupException(Exception):
# class EndpointNotFound(Exception):
# class SSLConfigurationError(BaseException):
# class SSLCertificateError(BaseException):
#     def __init__(self, message=None):
#     def __str__(self):
#     def __init__(self, details=None):
#     def __str__(self):
#     def __str__(self):
# def from_response(response):
# def from_code(code):
# 
# Path: muranoclient/common/utils.py
# LOG = logging.getLogger(__name__)
# def arg(*args, **kwargs):
#     def _decorator(func):
# def json_formatter(js):
# def text_wrap_formatter(d):
# def pretty_choice_list(l):
# def print_list(objs, fields, field_labels, formatters=None, sortby=0):
# def print_dict(d, formatters=None):
# def find_resource(manager, name_or_id, *args, **kwargs):
# def string_to_bool(arg):
# def env(*vars, **kwargs):
# def exit(msg=''):
# def getsockopt(self, *args, **kwargs):
# def exception_to_str(exc):
#     def __init__(self, obj):
#     def close(self):
#     def __getattr__(self, name):
#     def __init__(self, name, binary=True):
#     def open(self):
# def to_url(filename, base_url, version='', path='/', extension=''):
#     def __init__(self, file_wrapper):
#     def file(self):
#     def close(self):
#     def save(self, dst, binary=True):
#     def __del__(self):
#     def from_file(file_obj):
#     def fromFile(file_obj):
#     def from_location(name, base_url='', version='', url='', path=None):
#     def validate(self):
#     def contents(self):
#     def manifest(self):
#     def images(self):
#     def resolvers(self):
#     def classes(self):
#     def ui(self):
#     def logo(self):
#     def _get_package_order(self, packages_graph):
#         def topological_sort(graph, start_node):
#             def dfs(node):
#         def transpose_graph(graph):
#         def top_sort_by_components(graph, component_order):
#             def dfs(node):
#     def requirements(self, base_url, path=None, dep_dict=None):
#     def _get_direct_deps(package, base_url, path):
# def save_image_local(image_spec, base_url, dst):
# def ensure_images(glance_client, image_specs, base_url,
#                   local_path=None,
#                   is_package_public=False):
#     def _image_valid(image, keys):
#     def from_file(file_obj):
#     def fromFile(file_obj):
#     def package_specs(self):
#     def packages(self, base_url='', path=None):
# def yaql_constructor(loader, node):
# def traverse_and_replace(obj,
#                          pattern=re.compile(r'^===id(\d+)===$'),
#                          replacements=None):
#     def _maybe_replace(obj, key, value):
#     def __init__(self, namespaces):
#     def resolve_name(self, name, relative=None):
# class NoCloseProxy(object):
# class File(object):
# class FileWrapperMixin(object):
# class Package(FileWrapperMixin):
# class Bundle(FileWrapperMixin):
# class DummyYaqlYamlLoader(yaml.SafeLoader):
# class YaqlYamlLoader(yaml.SafeLoader):
# class NamespaceResolver(object):
# 
# Path: muranoclient/i18n.py



# Path: muranoclient/v1/artifact_packages.py
import collections
import yaml
from glanceclient import exc as glance_exc
from muranoclient.common import exceptions as exc
from muranoclient.common import utils
from muranoclient.i18n import _

            filters = {'owner': self.tenant}
        existing = self.list(name=package_draft['name'],
                             version=package_draft['version'], **filters)
        try:
            next(existing)
            raise exc.HTTPConflict("Package already exists")
        except StopIteration:
            pass

        res = self.client.artifacts.create(**package_draft)
        app_id = res.id
        self.client.artifacts.upload_blob(app_id, 'archive', package.file())
        if package.logo is not None:
            self.client.artifacts.upload_blob(app_id, 'logo', package.logo)
        if package.ui is not None:
            self.client.artifacts.upload_blob(app_id, 'ui_definition',
                                              package.ui)
        package.file().close()
        self.client.artifacts.active(app_id)

        return self.client.artifacts.get(app_id)

    @staticmethod
    def _get_local_inheritance(classes, resolvers):
        result = {}
        for class_name, klass in classes.items():
            if 'Extends' not in klass:
                continue
            ns = klass.get('Namespaces')
            if ns:

                resolver = utils.NamespaceResolver(ns)