403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/fs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/fs/subfs.py
"""Manage a directory in a *parent* filesystem.
"""

from __future__ import print_function, unicode_literals

import typing

import six

from .path import abspath, join, normpath, relpath
from .wrapfs import WrapFS

if typing.TYPE_CHECKING:
    from typing import Text, Tuple

    from .base import FS  # noqa: F401


_F = typing.TypeVar("_F", bound="FS", covariant=True)


@six.python_2_unicode_compatible
class SubFS(WrapFS[_F], typing.Generic[_F]):
    """A sub-directory on a parent filesystem.

    A SubFS is a filesystem object that maps to a sub-directory of
    another filesystem. This is the object that is returned by
    `~fs.base.FS.opendir`.

    """

    def __init__(self, parent_fs, path):  # noqa: D107
        # type: (_F, Text) -> None
        super(SubFS, self).__init__(parent_fs)
        self._sub_dir = abspath(normpath(path))

    def __repr__(self):
        # type: () -> Text
        return "{}({!r}, {!r})".format(
            self.__class__.__name__, self._wrap_fs, self._sub_dir
        )

    def __str__(self):
        # type: () -> Text
        return "{parent}{dir}".format(parent=self._wrap_fs, dir=self._sub_dir)

    def delegate_fs(self):
        # type: () -> _F
        return self._wrap_fs

    def delegate_path(self, path):
        # type: (Text) -> Tuple[_F, Text]
        _path = join(self._sub_dir, relpath(normpath(path)))
        return self._wrap_fs, _path


class ClosingSubFS(SubFS[_F], typing.Generic[_F]):
    """A version of `SubFS` which closes its parent when closed."""

    def close(self):
        # type: () -> None
        self.delegate_fs().close()
        super(ClosingSubFS, self).close()

Youez - 2016 - github.com/yon3zu
LinuXploit