# Path: contrail_api_cli/utils.py
# CONFIG_DIR = os.path.expanduser('~/.config/contrail-api-cli')
# class FQName(collections.Sequence):
# class Observable(object):
# class Singleton(type):
# class APIFlavour(_PosixFlavour):
# class Path(PurePosixPath):
# class classproperty(object):
#     def __init__(self, init=None):
#     def __getitem__(self, idx):
#     def __len__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __repr__(self):
#     def __str__(self):
#     def __bytes__(self):
#     def __lt__(self, b):
#     def __gt__(self, b):
#     def __new__(cls, *args, **kwargs):
#     def register(cls, event, callback):
#     def unregister(cls, event, callback):
#     def emit(cls, event, data):
#     def __init__(cls, name, bases, dict):
#     def __call__(cls, *args, **kw):
#     def parse_parts(self, parts):
#     def _from_parsed_parts(cls, drv, root, parts, init=True):
#     def __init__(self, *args):
#     def base(self):
#     def is_root(self):
#     def is_fq_name(self):
#     def is_uuid(self):
#     def is_resource(self):
#     def is_collection(self):
#     def relative_to(self, path):
#     def __init__(self, f):
#     def __get__(self, instance, klass):
# def eventloop():
#     def inputhook(context):
# def continue_prompt(message=""):
# def all_subclasses(cls):
# def to_json(resource_dict, cls=None):
# def highlight_json(json_data):
# def md5(fname):
# def to_unicode(value):
# def printo(msg, encoding=None, errors='replace', std_type='stdout'):
# def format_table(rows, sep='  '):
# def format_tree(tree):
#     def _traverse_tree(tree, parents=None):
#     def _get_rows_data(tree, rows):
# def parallel_map(func, iterable, args=None, kwargs=None, workers=None):


import unittest
import sys
import io
from contrail_api_cli import utils
        FAKE_STRING_NEW_LINE = b"fake string\n"
        FAKE_STRING_NO_NEW_LINE = "fake string"
        orig_stdout = sys.stdout
        orig_stderr = sys.stdout
        fake_stdout = io.BytesIO()
        fake_stderr = io.BytesIO()
        sys.stdout = fake_stdout
        sys.stderr = fake_stderr

        def clear_buffers():
            fake_stdout.truncate(0)
            fake_stdout.seek(0)
            fake_stderr.truncate(0)
            fake_stderr.seek(0)

        utils.printo(FAKE_STRING_NO_NEW_LINE)
        self.assertEqual(fake_stdout.getvalue(), FAKE_STRING_NEW_LINE)
        self.assertEqual(fake_stderr.getvalue(), b'')
        clear_buffers()

        utils.printo(FAKE_STRING_NO_NEW_LINE, std_type='stdout')
        self.assertEqual(fake_stdout.getvalue(), FAKE_STRING_NEW_LINE)
        self.assertEqual(fake_stderr.getvalue(), b'')
        clear_buffers()

        utils.printo(FAKE_STRING_NO_NEW_LINE, std_type='stderr')
        self.assertEqual(fake_stdout.getvalue(), b'')
        self.assertEqual(fake_stderr.getvalue(), FAKE_STRING_NEW_LINE)
        clear_buffers()


# Path: contrail_api_cli/utils.py
# CONFIG_DIR = os.path.expanduser('~/.config/contrail-api-cli')
# class FQName(collections.Sequence):
# class Observable(object):
# class Singleton(type):
# class APIFlavour(_PosixFlavour):
# class Path(PurePosixPath):
# class classproperty(object):
#     def __init__(self, init=None):
#     def __getitem__(self, idx):
#     def __len__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __repr__(self):
#     def __str__(self):
#     def __bytes__(self):
#     def __lt__(self, b):
#     def __gt__(self, b):
#     def __new__(cls, *args, **kwargs):
#     def register(cls, event, callback):
#     def unregister(cls, event, callback):
#     def emit(cls, event, data):
#     def __init__(cls, name, bases, dict):
#     def __call__(cls, *args, **kw):
#     def parse_parts(self, parts):
#     def _from_parsed_parts(cls, drv, root, parts, init=True):
#     def __init__(self, *args):
#     def base(self):
#     def is_root(self):
#     def is_fq_name(self):
#     def is_uuid(self):
#     def is_resource(self):
#     def is_collection(self):
#     def relative_to(self, path):
#     def __init__(self, f):
#     def __get__(self, instance, klass):
# def eventloop():
#     def inputhook(context):
# def continue_prompt(message=""):
# def all_subclasses(cls):
# def to_json(resource_dict, cls=None):
# def highlight_json(json_data):
# def md5(fname):
# def to_unicode(value):
# def printo(msg, encoding=None, errors='replace', std_type='stdout'):
# def format_table(rows, sep='  '):
# def format_tree(tree):
#     def _traverse_tree(tree, parents=None):
#     def _get_rows_data(tree, rows):
# def parallel_map(func, iterable, args=None, kwargs=None, workers=None):


# Path: contrail_api_cli/tests/test_utils.py
import unittest
import sys
import io
from contrail_api_cli import utils

        FAKE_STRING_NEW_LINE = b"fake string\n"
        FAKE_STRING_NO_NEW_LINE = "fake string"
        orig_stdout = sys.stdout
        orig_stderr = sys.stdout
        fake_stdout = io.BytesIO()
        fake_stderr = io.BytesIO()
        sys.stdout = fake_stdout
        sys.stderr = fake_stderr

        def clear_buffers():
            fake_stdout.truncate(0)
            fake_stdout.seek(0)
            fake_stderr.truncate(0)
            fake_stderr.seek(0)

        utils.printo(FAKE_STRING_NO_NEW_LINE)
        self.assertEqual(fake_stdout.getvalue(), FAKE_STRING_NEW_LINE)
        self.assertEqual(fake_stderr.getvalue(), b'')
        clear_buffers()

        utils.printo(FAKE_STRING_NO_NEW_LINE, std_type='stdout')
        self.assertEqual(fake_stdout.getvalue(), FAKE_STRING_NEW_LINE)
        self.assertEqual(fake_stderr.getvalue(), b'')
        clear_buffers()

        utils.printo(FAKE_STRING_NO_NEW_LINE, std_type='stderr')
        self.assertEqual(fake_stdout.getvalue(), b'')
        self.assertEqual(fake_stderr.getvalue(), FAKE_STRING_NEW_LINE)
        clear_buffers()


        utils.printo(FAKE_STRING_NO_NEW_LINE, std_type='fake_std')