# Path: pgcontents/api_utils.py
# def base_directory_model(path):
#     m = base_model(path)
#     m.update(
#         type='directory',
#         last_modified=DUMMY_CREATED_DATE,
#         created=DUMMY_CREATED_DATE,
#     )
#     return m
# 
# def normalize_api_path(api_path):
#     """
#     Resolve paths with '..' to normalized paths, raising an error if the final
#     result is outside root.
#     """
#     normalized = posixpath.normpath(api_path.strip('/'))
#     if normalized == '.':
#         normalized = ''
#     elif normalized.startswith('..'):
#         raise PathOutsideRoot(normalized)
#     return normalized
# 
# def outside_root_to_404(fn):
#     """
#     Decorator for converting PathOutsideRoot errors to 404s.
#     """
#     @wraps(fn)
#     def wrapped(*args, **kwargs):
#         try:
#             return fn(*args, **kwargs)
#         except PathOutsideRoot as e:
#             raise HTTPError(404, "Path outside root: [%s]" % e.args[0])
#     return wrapped
# 
# Path: pgcontents/utils/ipycompat.py



from six import iteritems
from tornado.web import HTTPError
from .api_utils import (
    base_directory_model,
    normalize_api_path,
    outside_root_to_404,
)
from .utils.ipycompat import ContentsManager, Dict
    @outside_root_to_404
    def get(self, path, content=True, type=None, format=None):
        """
        Special case handling for listing root dir.
        """
        path = normalize_api_path(path)
        if path:
            return self.__get(path, content=content, type=type, format=format)
        if not content:
            return base_directory_model('')

        extra_content = self._extra_root_dirs()
        rm = self.root_manager
        if rm is None:
            root_model = base_directory_model('')
            root_model.update(
                format='json',
                content=extra_content,
            )
        else:
            root_model = rm.get(
                path,
                content=content,
                type=type,
                format=format,
            )
            # Append the extra directories.
            root_model['content'].extend(extra_content)
        return root_model


# Path: pgcontents/api_utils.py
# def base_directory_model(path):
#     m = base_model(path)
#     m.update(
#         type='directory',
#         last_modified=DUMMY_CREATED_DATE,
#         created=DUMMY_CREATED_DATE,
#     )
#     return m
# 
# def normalize_api_path(api_path):
#     """
#     Resolve paths with '..' to normalized paths, raising an error if the final
#     result is outside root.
#     """
#     normalized = posixpath.normpath(api_path.strip('/'))
#     if normalized == '.':
#         normalized = ''
#     elif normalized.startswith('..'):
#         raise PathOutsideRoot(normalized)
#     return normalized
# 
# def outside_root_to_404(fn):
#     """
#     Decorator for converting PathOutsideRoot errors to 404s.
#     """
#     @wraps(fn)
#     def wrapped(*args, **kwargs):
#         try:
#             return fn(*args, **kwargs)
#         except PathOutsideRoot as e:
#             raise HTTPError(404, "Path outside root: [%s]" % e.args[0])
#     return wrapped
# 
# Path: pgcontents/utils/ipycompat.py



# Path: pgcontents/hybridmanager.py
from six import iteritems
from tornado.web import HTTPError
from .api_utils import (
    base_directory_model,
    normalize_api_path,
    outside_root_to_404,
)
from .utils.ipycompat import ContentsManager, Dict

    @outside_root_to_404
    def get(self, path, content=True, type=None, format=None):
        """
        Special case handling for listing root dir.
        """
        path = normalize_api_path(path)
        if path:
            return self.__get(path, content=content, type=type, format=format)
        if not content:
            return base_directory_model('')

        extra_content = self._extra_root_dirs()
        rm = self.root_manager
        if rm is None:
            root_model = base_directory_model('')
            root_model.update(
                format='json',
                content=extra_content,
            )
        else:
            root_model = rm.get(
                path,
                content=content,
                type=type,
                format=format,
            )
            # Append the extra directories.
            root_model['content'].extend(extra_content)
        return root_model


    @outside_root_to_404