# 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):


import io
import json
import os.path
import tempfile
import zipfile
import requests
import requests_mock
import testtools
import yaml
from unittest import mock
from muranoclient.common import utils
# Copyright (c) 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.





class FileTest(testtools.TestCase):

    def test_file_object_from_file(self):
        f_obj = tempfile.NamedTemporaryFile(delete=True)

# 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/tests/unit/test_utils.py
import io
import json
import os.path
import tempfile
import zipfile
import requests
import requests_mock
import testtools
import yaml
from unittest import mock
from muranoclient.common import utils

# Copyright (c) 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.





class FileTest(testtools.TestCase):

    def test_file_object_from_file(self):
        f_obj = tempfile.NamedTemporaryFile(delete=True)

        new_f_obj = utils.File(f_obj).open()