# Path: pyftpdlib/_compat.py
# PY3 = sys.version_info[0] == 3
# 
# Path: pyftpdlib/_compat.py
# def u(s):
#     return s
# 
# Path: pyftpdlib/_compat.py
# PY3 = sys.version_info[0] == 3
# _SENTINEL = object()
#     def u(s):
#     def b(s):
#     def u(s):
#     def b(s):
#     def callable(obj):
#     def _instance_checking_exception(base_exception=Exception):
#         def wrapped(instance_checker):
#                 def __init__(self, *args, **kwargs):
#                     def __instancecheck__(cls, inst):
#                     def __subclasscheck__(cls, classinfo):
#     def FileNotFoundError(inst):
#     def FileExistsError(inst):
#     def super(type_=_SENTINEL, type_or_obj=_SENTINEL, framedepth=1):
#             class TemporaryClass(base_exception):
#                 class __metaclass__(type):


import os
import stat
import tempfile
import time
    import grp
    import pwd
    from stat import filemode as _filemode  # PY 3.3
    from tarfile import filemode as _filemode
    from os import scandir  # py 3.5
        from scandir import scandir  # requires "pip install scandir"
from ._compat import PY3
from ._compat import u
from ._compat import unicode
class AbstractedFS(object):
    """A class used to interact with the file system, providing a
    cross-platform interface compatible with both Windows and
    UNIX style filesystems where all paths use "/" separator.

    AbstractedFS distinguishes between "real" filesystem paths and
    "virtual" ftp paths emulating a UNIX chroot jail where the user
    can not escape its home directory (example: real "/home/user"
    path will be seen as "/" by the client)

    It also provides some utility methods and wraps around all os.*
    calls involving operations against the filesystem like creating
    files or removing directories.

    FilesystemError exception can be raised from within any of
    the methods below in order to send a customized error string
    to the client.
    """

    def __init__(self, root, cmd_channel):
        """
         - (str) root: the user "real" home directory (e.g. '/home/user')
         - (instance) cmd_channel: the FTPHandler class instance
        """
        assert isinstance(root, unicode)
        # Set initial current working directory.
        # By default initial cwd is set to "/" to emulate a chroot jail.
        # If a different behavior is desired (e.g. initial cwd = root,
        # to reflect the real filesystem) users overriding this class
        # are responsible to set _cwd attribute as necessary.

# Path: pyftpdlib/_compat.py
# PY3 = sys.version_info[0] == 3
# 
# Path: pyftpdlib/_compat.py
# def u(s):
#     return s
# 
# Path: pyftpdlib/_compat.py
# PY3 = sys.version_info[0] == 3
# _SENTINEL = object()
#     def u(s):
#     def b(s):
#     def u(s):
#     def b(s):
#     def callable(obj):
#     def _instance_checking_exception(base_exception=Exception):
#         def wrapped(instance_checker):
#                 def __init__(self, *args, **kwargs):
#                     def __instancecheck__(cls, inst):
#                     def __subclasscheck__(cls, classinfo):
#     def FileNotFoundError(inst):
#     def FileExistsError(inst):
#     def super(type_=_SENTINEL, type_or_obj=_SENTINEL, framedepth=1):
#             class TemporaryClass(base_exception):
#                 class __metaclass__(type):


# Path: pyftpdlib/filesystems.py
import os
import stat
import tempfile
import time
    import grp
    import pwd
    from stat import filemode as _filemode  # PY 3.3
    from tarfile import filemode as _filemode
    from os import scandir  # py 3.5
        from scandir import scandir  # requires "pip install scandir"
from ._compat import PY3
from ._compat import u
from ._compat import unicode

class AbstractedFS(object):
    """A class used to interact with the file system, providing a
    cross-platform interface compatible with both Windows and
    UNIX style filesystems where all paths use "/" separator.

    AbstractedFS distinguishes between "real" filesystem paths and
    "virtual" ftp paths emulating a UNIX chroot jail where the user
    can not escape its home directory (example: real "/home/user"
    path will be seen as "/" by the client)

    It also provides some utility methods and wraps around all os.*
    calls involving operations against the filesystem like creating
    files or removing directories.

    FilesystemError exception can be raised from within any of
    the methods below in order to send a customized error string
    to the client.
    """

    def __init__(self, root, cmd_channel):
        """
         - (str) root: the user "real" home directory (e.g. '/home/user')
         - (instance) cmd_channel: the FTPHandler class instance
        """
        assert isinstance(root, unicode)
        # Set initial current working directory.
        # By default initial cwd is set to "/" to emulate a chroot jail.
        # If a different behavior is desired (e.g. initial cwd = root,
        # to reflect the real filesystem) users overriding this class
        # are responsible to set _cwd attribute as necessary.

        self._cwd = u('/')