Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.23.102.79
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/argcomplete/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /lib/python3/dist-packages/argcomplete/_check_console_script.py
"""
Utility for locating the module (or package's __init__.py)
associated with a given console_script name
and verifying it contains the PYTHON_ARGCOMPLETE_OK marker.

Such scripts are automatically generated and cannot contain
the marker themselves, so we defer to the containing module or package.

For more information on setuptools console_scripts, see
https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation

Intended to be invoked by argcomplete's global completion function.
"""
import os
import sys

try:
    from importlib.metadata import entry_points as importlib_entry_points
except ImportError:
    from importlib_metadata import entry_points as importlib_entry_points

from ._check_module import ArgcompleteMarkerNotFound, find


def main():
    # Argument is the full path to the console script.
    script_path = sys.argv[1]

    # Find the module and function names that correspond to this
    # assuming it is actually a console script.
    name = os.path.basename(script_path)
    entry_points = [ep for ep in importlib_entry_points()["console_scripts"] if ep.name == name]
    if not entry_points:
        raise ArgcompleteMarkerNotFound('no entry point found matching script')
    entry_point = entry_points[0]
    module_name, function_name = entry_point.value.split(":", 1)

    # Check this looks like the script we really expected.
    with open(script_path) as f:
        script = f.read()
    if 'from {} import {}'.format(module_name, function_name) not in script:
        raise ArgcompleteMarkerNotFound('does not appear to be a console script')
    if 'sys.exit({}())'.format(function_name) not in script:
        raise ArgcompleteMarkerNotFound('does not appear to be a console script')

    # Look for the argcomplete marker in the script it imports.
    with open(find(module_name, return_package=True)) as f:
        head = f.read(1024)
    if 'PYTHON_ARGCOMPLETE_OK' not in head:
        raise ArgcompleteMarkerNotFound('marker not found')


if __name__ == '__main__':
    try:
        main()
    except ArgcompleteMarkerNotFound as e:
        sys.exit(e)

Anon7 - 2022
AnonSec Team