Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- lib/python3.10/site-packages/debugpy/__pycache__/__init__.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/__pycache__/__main__.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/__pycache__/_version.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/__pycache__/public_api.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/__init__.py +126 -0
- lib/python3.10/site-packages/debugpy/_vendored/__pycache__/__init__.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/__pycache__/_pydevd_packaging.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/__pycache__/_util.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/__pycache__/force_pydevd.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/_pydevd_packaging.py +48 -0
- lib/python3.10/site-packages/debugpy/_vendored/_util.py +59 -0
- lib/python3.10/site-packages/debugpy/_vendored/force_pydevd.py +81 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydev_app_engine_debug_startup.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydev_coverage.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydev_pysrc.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydev_run_in_console.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydevconsole.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydevd.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydevd_file_utils.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydevd_tracing.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/setup_pydevd_cython.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__init__.py +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/__init__.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_calltip_util.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_completer.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_execfile.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_filesystem_encoding.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_getopt.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_imports_tipper.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_jy_imports_tipper.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_log.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_saved_modules.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_sys_patch.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_tipper_common.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_console_utils.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_import_hook.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_imports.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_ipython_console.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_ipython_console_011.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_is_thread_alive.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_localhost.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_log.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_monkey.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_monkey_qt.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_override.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_umd.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_versioncheck.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_calltip_util.py +153 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_completer.py +267 -0
- lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_execfile.py +16 -0
lib/python3.10/site-packages/debugpy/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (662 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/__pycache__/__main__.cpython-310.pyc
ADDED
|
Binary file (339 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/__pycache__/_version.cpython-310.pyc
ADDED
|
Binary file (466 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/__pycache__/public_api.cpython-310.pyc
ADDED
|
Binary file (6.96 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/__init__.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License. See LICENSE in the project root
|
| 3 |
+
# for license information.
|
| 4 |
+
|
| 5 |
+
import contextlib
|
| 6 |
+
from importlib import import_module
|
| 7 |
+
import os
|
| 8 |
+
import sys
|
| 9 |
+
|
| 10 |
+
from . import _util
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
VENDORED_ROOT = os.path.dirname(os.path.abspath(__file__))
|
| 14 |
+
# TODO: Move the "pydevd" git submodule to the debugpy/_vendored directory
|
| 15 |
+
# and then drop the following fallback.
|
| 16 |
+
if "pydevd" not in os.listdir(VENDORED_ROOT):
|
| 17 |
+
VENDORED_ROOT = os.path.dirname(VENDORED_ROOT)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def list_all(resolve=False):
|
| 21 |
+
"""Return the list of vendored projects."""
|
| 22 |
+
# TODO: Derive from os.listdir(VENDORED_ROOT)?
|
| 23 |
+
projects = ["pydevd"]
|
| 24 |
+
if not resolve:
|
| 25 |
+
return projects
|
| 26 |
+
return [project_root(name) for name in projects]
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def project_root(project):
|
| 30 |
+
"""Return the path the root dir of the vendored project.
|
| 31 |
+
|
| 32 |
+
If "project" is an empty string then the path prefix for vendored
|
| 33 |
+
projects (e.g. "debugpy/_vendored/") will be returned.
|
| 34 |
+
"""
|
| 35 |
+
if not project:
|
| 36 |
+
project = ""
|
| 37 |
+
return os.path.join(VENDORED_ROOT, project)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def iter_project_files(project, relative=False, **kwargs):
|
| 41 |
+
"""Yield (dirname, basename, filename) for all files in the project."""
|
| 42 |
+
if relative:
|
| 43 |
+
with _util.cwd(VENDORED_ROOT):
|
| 44 |
+
for result in _util.iter_all_files(project, **kwargs):
|
| 45 |
+
yield result
|
| 46 |
+
else:
|
| 47 |
+
root = project_root(project)
|
| 48 |
+
for result in _util.iter_all_files(root, **kwargs):
|
| 49 |
+
yield result
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def iter_packaging_files(project):
|
| 53 |
+
"""Yield the filenames for all files in the project.
|
| 54 |
+
|
| 55 |
+
The filenames are relative to "debugpy/_vendored". This is most
|
| 56 |
+
useful for the "package data" in a setup.py.
|
| 57 |
+
"""
|
| 58 |
+
# TODO: Use default filters? __pycache__ and .pyc?
|
| 59 |
+
prune_dir = None
|
| 60 |
+
exclude_file = None
|
| 61 |
+
try:
|
| 62 |
+
mod = import_module("._{}_packaging".format(project), __name__)
|
| 63 |
+
except ImportError:
|
| 64 |
+
pass
|
| 65 |
+
else:
|
| 66 |
+
prune_dir = getattr(mod, "prune_dir", prune_dir)
|
| 67 |
+
exclude_file = getattr(mod, "exclude_file", exclude_file)
|
| 68 |
+
results = iter_project_files(
|
| 69 |
+
project, relative=True, prune_dir=prune_dir, exclude_file=exclude_file
|
| 70 |
+
)
|
| 71 |
+
for _, _, filename in results:
|
| 72 |
+
yield filename
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def prefix_matcher(*prefixes):
|
| 76 |
+
"""Return a module match func that matches any of the given prefixes."""
|
| 77 |
+
assert prefixes
|
| 78 |
+
|
| 79 |
+
def match(name, module):
|
| 80 |
+
for prefix in prefixes:
|
| 81 |
+
if name.startswith(prefix):
|
| 82 |
+
return True
|
| 83 |
+
else:
|
| 84 |
+
return False
|
| 85 |
+
|
| 86 |
+
return match
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def check_modules(project, match, root=None):
|
| 90 |
+
"""Verify that only vendored modules have been imported."""
|
| 91 |
+
if root is None:
|
| 92 |
+
root = project_root(project)
|
| 93 |
+
extensions = []
|
| 94 |
+
unvendored = {}
|
| 95 |
+
for modname, mod in list(sys.modules.items()):
|
| 96 |
+
if not match(modname, mod):
|
| 97 |
+
continue
|
| 98 |
+
try:
|
| 99 |
+
filename = getattr(mod, "__file__", None)
|
| 100 |
+
except: # In theory it's possible that any error is raised when accessing __file__
|
| 101 |
+
filename = None
|
| 102 |
+
if not filename: # extension module
|
| 103 |
+
extensions.append(modname)
|
| 104 |
+
elif not filename.startswith(root):
|
| 105 |
+
unvendored[modname] = filename
|
| 106 |
+
return unvendored, extensions
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
@contextlib.contextmanager
|
| 110 |
+
def vendored(project, root=None):
|
| 111 |
+
"""A context manager under which the vendored project will be imported."""
|
| 112 |
+
if root is None:
|
| 113 |
+
root = project_root(project)
|
| 114 |
+
# Add the vendored project directory, so that it gets tried first.
|
| 115 |
+
sys.path.insert(0, root)
|
| 116 |
+
try:
|
| 117 |
+
yield root
|
| 118 |
+
finally:
|
| 119 |
+
sys.path.remove(root)
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
def preimport(project, modules, **kwargs):
|
| 123 |
+
"""Import each of the named modules out of the vendored project."""
|
| 124 |
+
with vendored(project, **kwargs):
|
| 125 |
+
for name in modules:
|
| 126 |
+
import_module(name)
|
lib/python3.10/site-packages/debugpy/_vendored/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (3.47 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/__pycache__/_pydevd_packaging.cpython-310.pyc
ADDED
|
Binary file (949 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/__pycache__/_util.cpython-310.pyc
ADDED
|
Binary file (1.62 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/__pycache__/force_pydevd.cpython-310.pyc
ADDED
|
Binary file (1.75 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/_pydevd_packaging.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License. See LICENSE in the project root
|
| 3 |
+
# for license information.
|
| 4 |
+
|
| 5 |
+
from . import VENDORED_ROOT
|
| 6 |
+
from ._util import cwd, iter_all_files
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
INCLUDES = [
|
| 10 |
+
'setup_pydevd_cython.py',
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def iter_files():
|
| 15 |
+
# From the root of pydevd repo, we want only scripts and
|
| 16 |
+
# subdirectories that constitute the package itself (not helper
|
| 17 |
+
# scripts, tests etc). But when walking down into those
|
| 18 |
+
# subdirectories, we want everything below.
|
| 19 |
+
|
| 20 |
+
with cwd(VENDORED_ROOT):
|
| 21 |
+
return iter_all_files('pydevd', prune_dir, exclude_file)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def prune_dir(dirname, basename):
|
| 25 |
+
if basename == '__pycache__':
|
| 26 |
+
return True
|
| 27 |
+
elif dirname != 'pydevd':
|
| 28 |
+
return False
|
| 29 |
+
elif basename.startswith('pydev'):
|
| 30 |
+
return False
|
| 31 |
+
elif basename.startswith('_pydev'):
|
| 32 |
+
return False
|
| 33 |
+
return True
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def exclude_file(dirname, basename):
|
| 37 |
+
if dirname == 'pydevd':
|
| 38 |
+
if basename in INCLUDES:
|
| 39 |
+
return False
|
| 40 |
+
elif not basename.endswith('.py'):
|
| 41 |
+
return True
|
| 42 |
+
elif 'pydev' not in basename:
|
| 43 |
+
return True
|
| 44 |
+
return False
|
| 45 |
+
|
| 46 |
+
if basename.endswith('.pyc'):
|
| 47 |
+
return True
|
| 48 |
+
return False
|
lib/python3.10/site-packages/debugpy/_vendored/_util.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License. See LICENSE in the project root
|
| 3 |
+
# for license information.
|
| 4 |
+
|
| 5 |
+
import contextlib
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
@contextlib.contextmanager
|
| 10 |
+
def cwd(dirname):
|
| 11 |
+
"""A context manager for operating in a different directory."""
|
| 12 |
+
orig = os.getcwd()
|
| 13 |
+
os.chdir(dirname)
|
| 14 |
+
try:
|
| 15 |
+
yield orig
|
| 16 |
+
finally:
|
| 17 |
+
os.chdir(orig)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def iter_all_files(root, prune_dir=None, exclude_file=None):
|
| 21 |
+
"""Yield (dirname, basename, filename) for each file in the tree.
|
| 22 |
+
|
| 23 |
+
This is an alternative to os.walk() that flattens out the tree and
|
| 24 |
+
with filtering.
|
| 25 |
+
"""
|
| 26 |
+
pending = [root]
|
| 27 |
+
while pending:
|
| 28 |
+
dirname = pending.pop(0)
|
| 29 |
+
for result in _iter_files(dirname, pending, prune_dir, exclude_file):
|
| 30 |
+
yield result
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def iter_tree(root, prune_dir=None, exclude_file=None):
|
| 34 |
+
"""Yield (dirname, files) for each directory in the tree.
|
| 35 |
+
|
| 36 |
+
The list of files is actually a list of (basename, filename).
|
| 37 |
+
|
| 38 |
+
This is an alternative to os.walk() with filtering."""
|
| 39 |
+
pending = [root]
|
| 40 |
+
while pending:
|
| 41 |
+
dirname = pending.pop(0)
|
| 42 |
+
files = []
|
| 43 |
+
for _, b, f in _iter_files(dirname, pending, prune_dir, exclude_file):
|
| 44 |
+
files.append((b, f))
|
| 45 |
+
yield dirname, files
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def _iter_files(dirname, subdirs, prune_dir, exclude_file):
|
| 49 |
+
for basename in os.listdir(dirname):
|
| 50 |
+
filename = os.path.join(dirname, basename)
|
| 51 |
+
if os.path.isdir(filename):
|
| 52 |
+
if prune_dir is not None and prune_dir(dirname, basename):
|
| 53 |
+
continue
|
| 54 |
+
subdirs.append(filename)
|
| 55 |
+
else:
|
| 56 |
+
# TODO: Use os.path.isfile() to narrow it down?
|
| 57 |
+
if exclude_file is not None and exclude_file(dirname, basename):
|
| 58 |
+
continue
|
| 59 |
+
yield dirname, basename, filename
|
lib/python3.10/site-packages/debugpy/_vendored/force_pydevd.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License. See LICENSE in the project root
|
| 3 |
+
# for license information.
|
| 4 |
+
|
| 5 |
+
from importlib import import_module
|
| 6 |
+
import os
|
| 7 |
+
import warnings
|
| 8 |
+
|
| 9 |
+
from . import check_modules, prefix_matcher, preimport, vendored
|
| 10 |
+
|
| 11 |
+
# Ensure that pydevd is our vendored copy.
|
| 12 |
+
_unvendored, _ = check_modules('pydevd',
|
| 13 |
+
prefix_matcher('pydev', '_pydev'))
|
| 14 |
+
if _unvendored:
|
| 15 |
+
_unvendored = sorted(_unvendored.values())
|
| 16 |
+
msg = 'incompatible copy of pydevd already imported'
|
| 17 |
+
# raise ImportError(msg)
|
| 18 |
+
warnings.warn(msg + ':\n {}'.format('\n '.join(_unvendored)))
|
| 19 |
+
|
| 20 |
+
# If debugpy logging is enabled, enable it for pydevd as well
|
| 21 |
+
if "DEBUGPY_LOG_DIR" in os.environ:
|
| 22 |
+
os.environ[str("PYDEVD_DEBUG")] = str("True")
|
| 23 |
+
os.environ[str("PYDEVD_DEBUG_FILE")] = os.environ["DEBUGPY_LOG_DIR"] + str("/debugpy.pydevd.log")
|
| 24 |
+
|
| 25 |
+
# Disable pydevd frame-eval optimizations only if unset, to allow opt-in.
|
| 26 |
+
if "PYDEVD_USE_FRAME_EVAL" not in os.environ:
|
| 27 |
+
os.environ[str("PYDEVD_USE_FRAME_EVAL")] = str("NO")
|
| 28 |
+
|
| 29 |
+
# Constants must be set before importing any other pydevd module
|
| 30 |
+
# # due to heavy use of "from" in them.
|
| 31 |
+
with warnings.catch_warnings():
|
| 32 |
+
warnings.simplefilter("ignore", category=DeprecationWarning)
|
| 33 |
+
with vendored('pydevd'):
|
| 34 |
+
pydevd_constants = import_module('_pydevd_bundle.pydevd_constants')
|
| 35 |
+
# We limit representation size in our representation provider when needed.
|
| 36 |
+
pydevd_constants.MAXIMUM_VARIABLE_REPRESENTATION_SIZE = 2 ** 32
|
| 37 |
+
|
| 38 |
+
# Now make sure all the top-level modules and packages in pydevd are
|
| 39 |
+
# loaded. Any pydevd modules that aren't loaded at this point, will
|
| 40 |
+
# be loaded using their parent package's __path__ (i.e. one of the
|
| 41 |
+
# following).
|
| 42 |
+
with warnings.catch_warnings():
|
| 43 |
+
warnings.simplefilter("ignore", category=DeprecationWarning)
|
| 44 |
+
preimport('pydevd', [
|
| 45 |
+
'_pydev_bundle',
|
| 46 |
+
'_pydev_runfiles',
|
| 47 |
+
'_pydevd_bundle',
|
| 48 |
+
'_pydevd_frame_eval',
|
| 49 |
+
'pydev_ipython',
|
| 50 |
+
'pydevd_plugins',
|
| 51 |
+
'pydevd',
|
| 52 |
+
])
|
| 53 |
+
|
| 54 |
+
# When pydevd is imported it sets the breakpoint behavior, but it needs to be
|
| 55 |
+
# overridden because by default pydevd will connect to the remote debugger using
|
| 56 |
+
# its own custom protocol rather than DAP.
|
| 57 |
+
import pydevd # noqa
|
| 58 |
+
import debugpy # noqa
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def debugpy_breakpointhook():
|
| 62 |
+
debugpy.breakpoint()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
pydevd.install_breakpointhook(debugpy_breakpointhook)
|
| 66 |
+
|
| 67 |
+
# Ensure that pydevd uses JSON protocol
|
| 68 |
+
from _pydevd_bundle import pydevd_constants
|
| 69 |
+
from _pydevd_bundle import pydevd_defaults
|
| 70 |
+
pydevd_defaults.PydevdCustomization.DEFAULT_PROTOCOL = pydevd_constants.HTTP_JSON_PROTOCOL
|
| 71 |
+
|
| 72 |
+
# Enable some defaults related to debugpy such as sending a single notification when
|
| 73 |
+
# threads pause and stopping on any exception.
|
| 74 |
+
pydevd_defaults.PydevdCustomization.DEBUG_MODE = 'debugpy-dap'
|
| 75 |
+
|
| 76 |
+
# This is important when pydevd attaches automatically to a subprocess. In this case, we have to
|
| 77 |
+
# make sure that debugpy is properly put back in the game for users to be able to use it.
|
| 78 |
+
pydevd_defaults.PydevdCustomization.PREIMPORT = '%s;%s' % (
|
| 79 |
+
os.path.dirname(os.path.dirname(debugpy.__file__)),
|
| 80 |
+
'debugpy._vendored.force_pydevd'
|
| 81 |
+
)
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydev_app_engine_debug_startup.cpython-310.pyc
ADDED
|
Binary file (633 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydev_coverage.cpython-310.pyc
ADDED
|
Binary file (2.31 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydev_pysrc.cpython-310.pyc
ADDED
|
Binary file (267 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydev_run_in_console.cpython-310.pyc
ADDED
|
Binary file (3.2 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydevconsole.cpython-310.pyc
ADDED
|
Binary file (12.8 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydevd.cpython-310.pyc
ADDED
|
Binary file (92 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydevd_file_utils.cpython-310.pyc
ADDED
|
Binary file (20.7 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/pydevd_tracing.cpython-310.pyc
ADDED
|
Binary file (8.85 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/__pycache__/setup_pydevd_cython.cpython-310.pyc
ADDED
|
Binary file (6.04 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__init__.py
ADDED
|
File without changes
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (172 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_calltip_util.cpython-310.pyc
ADDED
|
Binary file (3.74 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_completer.cpython-310.pyc
ADDED
|
Binary file (6.67 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_execfile.cpython-310.pyc
ADDED
|
Binary file (547 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_filesystem_encoding.cpython-310.pyc
ADDED
|
Binary file (957 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_getopt.cpython-310.pyc
ADDED
|
Binary file (3.46 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_imports_tipper.cpython-310.pyc
ADDED
|
Binary file (6.75 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_jy_imports_tipper.cpython-310.pyc
ADDED
|
Binary file (9.64 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_log.cpython-310.pyc
ADDED
|
Binary file (1.25 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_saved_modules.cpython-310.pyc
ADDED
|
Binary file (3.74 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_sys_patch.cpython-310.pyc
ADDED
|
Binary file (1.94 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/_pydev_tipper_common.cpython-310.pyc
ADDED
|
Binary file (1.16 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_console_utils.cpython-310.pyc
ADDED
|
Binary file (18.4 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_import_hook.cpython-310.pyc
ADDED
|
Binary file (1.39 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_imports.cpython-310.pyc
ADDED
|
Binary file (541 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_ipython_console.cpython-310.pyc
ADDED
|
Binary file (3.41 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_ipython_console_011.cpython-310.pyc
ADDED
|
Binary file (11.7 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_is_thread_alive.cpython-310.pyc
ADDED
|
Binary file (821 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_localhost.cpython-310.pyc
ADDED
|
Binary file (1.68 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_log.cpython-310.pyc
ADDED
|
Binary file (6.09 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_monkey.cpython-310.pyc
ADDED
|
Binary file (25.6 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_monkey_qt.cpython-310.pyc
ADDED
|
Binary file (6.25 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_override.cpython-310.pyc
ADDED
|
Binary file (940 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_umd.cpython-310.pyc
ADDED
|
Binary file (5.05 kB). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/__pycache__/pydev_versioncheck.cpython-310.pyc
ADDED
|
Binary file (550 Bytes). View file
|
|
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_calltip_util.py
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
License: Apache 2.0
|
| 3 |
+
Author: Yuli Fitterman
|
| 4 |
+
"""
|
| 5 |
+
import types
|
| 6 |
+
|
| 7 |
+
from _pydevd_bundle.pydevd_constants import IS_JYTHON
|
| 8 |
+
|
| 9 |
+
try:
|
| 10 |
+
import inspect
|
| 11 |
+
except:
|
| 12 |
+
import traceback
|
| 13 |
+
|
| 14 |
+
traceback.print_exc() # Ok, no inspect available (search will not work)
|
| 15 |
+
|
| 16 |
+
from _pydev_bundle._pydev_imports_tipper import signature_from_docstring
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def is_bound_method(obj):
|
| 20 |
+
if isinstance(obj, types.MethodType):
|
| 21 |
+
return getattr(obj, "__self__", getattr(obj, "im_self", None)) is not None
|
| 22 |
+
else:
|
| 23 |
+
return False
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def get_class_name(instance):
|
| 27 |
+
return getattr(getattr(instance, "__class__", None), "__name__", None)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def get_bound_class_name(obj):
|
| 31 |
+
my_self = getattr(obj, "__self__", getattr(obj, "im_self", None))
|
| 32 |
+
if my_self is None:
|
| 33 |
+
return None
|
| 34 |
+
return get_class_name(my_self)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def get_description(obj):
|
| 38 |
+
try:
|
| 39 |
+
ob_call = obj.__call__
|
| 40 |
+
except:
|
| 41 |
+
ob_call = None
|
| 42 |
+
|
| 43 |
+
if isinstance(obj, type) or type(obj).__name__ == "classobj":
|
| 44 |
+
fob = getattr(obj, "__init__", lambda: None)
|
| 45 |
+
if not isinstance(fob, (types.FunctionType, types.MethodType)):
|
| 46 |
+
fob = obj
|
| 47 |
+
elif is_bound_method(ob_call):
|
| 48 |
+
fob = ob_call
|
| 49 |
+
else:
|
| 50 |
+
fob = obj
|
| 51 |
+
|
| 52 |
+
argspec = ""
|
| 53 |
+
fn_name = None
|
| 54 |
+
fn_class = None
|
| 55 |
+
if isinstance(fob, (types.FunctionType, types.MethodType)):
|
| 56 |
+
spec_info = inspect.getfullargspec(fob)
|
| 57 |
+
argspec = inspect.formatargspec(*spec_info)
|
| 58 |
+
fn_name = getattr(fob, "__name__", None)
|
| 59 |
+
if isinstance(obj, type) or type(obj).__name__ == "classobj":
|
| 60 |
+
fn_name = "__init__"
|
| 61 |
+
fn_class = getattr(obj, "__name__", "UnknownClass")
|
| 62 |
+
elif is_bound_method(obj) or is_bound_method(ob_call):
|
| 63 |
+
fn_class = get_bound_class_name(obj) or "UnknownClass"
|
| 64 |
+
|
| 65 |
+
else:
|
| 66 |
+
fn_name = getattr(fob, "__name__", None)
|
| 67 |
+
fn_self = getattr(fob, "__self__", None)
|
| 68 |
+
if fn_self is not None and not isinstance(fn_self, types.ModuleType):
|
| 69 |
+
fn_class = get_class_name(fn_self)
|
| 70 |
+
|
| 71 |
+
doc_string = get_docstring(ob_call) if is_bound_method(ob_call) else get_docstring(obj)
|
| 72 |
+
return create_method_stub(fn_name, fn_class, argspec, doc_string)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def create_method_stub(fn_name, fn_class, argspec, doc_string):
|
| 76 |
+
if fn_name and argspec:
|
| 77 |
+
doc_string = "" if doc_string is None else doc_string
|
| 78 |
+
fn_stub = create_function_stub(fn_name, argspec, doc_string, indent=1 if fn_class else 0)
|
| 79 |
+
if fn_class:
|
| 80 |
+
expr = fn_class if fn_name == "__init__" else fn_class + "()." + fn_name
|
| 81 |
+
return create_class_stub(fn_class, fn_stub) + "\n" + expr
|
| 82 |
+
else:
|
| 83 |
+
expr = fn_name
|
| 84 |
+
return fn_stub + "\n" + expr
|
| 85 |
+
elif doc_string:
|
| 86 |
+
if fn_name:
|
| 87 |
+
restored_signature, _ = signature_from_docstring(doc_string, fn_name)
|
| 88 |
+
if restored_signature:
|
| 89 |
+
return create_method_stub(fn_name, fn_class, restored_signature, doc_string)
|
| 90 |
+
return create_function_stub("unknown", "(*args, **kwargs)", doc_string) + "\nunknown"
|
| 91 |
+
|
| 92 |
+
else:
|
| 93 |
+
return ""
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def get_docstring(obj):
|
| 97 |
+
if obj is not None:
|
| 98 |
+
try:
|
| 99 |
+
if IS_JYTHON:
|
| 100 |
+
# Jython
|
| 101 |
+
doc = obj.__doc__
|
| 102 |
+
if doc is not None:
|
| 103 |
+
return doc
|
| 104 |
+
|
| 105 |
+
from _pydev_bundle import _pydev_jy_imports_tipper
|
| 106 |
+
|
| 107 |
+
is_method, infos = _pydev_jy_imports_tipper.ismethod(obj)
|
| 108 |
+
ret = ""
|
| 109 |
+
if is_method:
|
| 110 |
+
for info in infos:
|
| 111 |
+
ret += info.get_as_doc()
|
| 112 |
+
return ret
|
| 113 |
+
|
| 114 |
+
else:
|
| 115 |
+
doc = inspect.getdoc(obj)
|
| 116 |
+
if doc is not None:
|
| 117 |
+
return doc
|
| 118 |
+
except:
|
| 119 |
+
pass
|
| 120 |
+
else:
|
| 121 |
+
return ""
|
| 122 |
+
try:
|
| 123 |
+
# if no attempt succeeded, try to return repr()...
|
| 124 |
+
return repr(obj)
|
| 125 |
+
except:
|
| 126 |
+
try:
|
| 127 |
+
# otherwise the class
|
| 128 |
+
return str(obj.__class__)
|
| 129 |
+
except:
|
| 130 |
+
# if all fails, go to an empty string
|
| 131 |
+
return ""
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
def create_class_stub(class_name, contents):
|
| 135 |
+
return "class %s(object):\n%s" % (class_name, contents)
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def create_function_stub(fn_name, fn_argspec, fn_docstring, indent=0):
|
| 139 |
+
def shift_right(string, prefix):
|
| 140 |
+
return "".join(prefix + line for line in string.splitlines(True))
|
| 141 |
+
|
| 142 |
+
fn_docstring = shift_right(inspect.cleandoc(fn_docstring), " " * (indent + 1))
|
| 143 |
+
ret = '''
|
| 144 |
+
def %s%s:
|
| 145 |
+
"""%s"""
|
| 146 |
+
pass
|
| 147 |
+
''' % (fn_name, fn_argspec, fn_docstring)
|
| 148 |
+
ret = ret[1:] # remove first /n
|
| 149 |
+
ret = ret.replace("\t", " ")
|
| 150 |
+
if indent:
|
| 151 |
+
prefix = " " * indent
|
| 152 |
+
ret = shift_right(ret, prefix)
|
| 153 |
+
return ret
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_completer.py
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import namedtuple
|
| 2 |
+
from string import ascii_letters, digits
|
| 3 |
+
|
| 4 |
+
from _pydevd_bundle import pydevd_xml
|
| 5 |
+
import pydevconsole
|
| 6 |
+
|
| 7 |
+
import builtins as __builtin__ # Py3
|
| 8 |
+
|
| 9 |
+
try:
|
| 10 |
+
import java.lang # @UnusedImport
|
| 11 |
+
from _pydev_bundle import _pydev_jy_imports_tipper
|
| 12 |
+
|
| 13 |
+
_pydev_imports_tipper = _pydev_jy_imports_tipper
|
| 14 |
+
except ImportError:
|
| 15 |
+
IS_JYTHON = False
|
| 16 |
+
from _pydev_bundle import _pydev_imports_tipper
|
| 17 |
+
|
| 18 |
+
dir2 = _pydev_imports_tipper.generate_imports_tip_for_module
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# =======================================================================================================================
|
| 22 |
+
# _StartsWithFilter
|
| 23 |
+
# =======================================================================================================================
|
| 24 |
+
class _StartsWithFilter:
|
| 25 |
+
"""
|
| 26 |
+
Used because we can't create a lambda that'll use an outer scope in jython 2.1
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
def __init__(self, start_with):
|
| 30 |
+
self.start_with = start_with.lower()
|
| 31 |
+
|
| 32 |
+
def __call__(self, name):
|
| 33 |
+
return name.lower().startswith(self.start_with)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
# =======================================================================================================================
|
| 37 |
+
# Completer
|
| 38 |
+
#
|
| 39 |
+
# This class was gotten from IPython.completer (dir2 was replaced with the completer already in pydev)
|
| 40 |
+
# =======================================================================================================================
|
| 41 |
+
class Completer:
|
| 42 |
+
def __init__(self, namespace=None, global_namespace=None):
|
| 43 |
+
"""Create a new completer for the command line.
|
| 44 |
+
|
| 45 |
+
Completer([namespace,global_namespace]) -> completer instance.
|
| 46 |
+
|
| 47 |
+
If unspecified, the default namespace where completions are performed
|
| 48 |
+
is __main__ (technically, __main__.__dict__). Namespaces should be
|
| 49 |
+
given as dictionaries.
|
| 50 |
+
|
| 51 |
+
An optional second namespace can be given. This allows the completer
|
| 52 |
+
to handle cases where both the local and global scopes need to be
|
| 53 |
+
distinguished.
|
| 54 |
+
|
| 55 |
+
Completer instances should be used as the completion mechanism of
|
| 56 |
+
readline via the set_completer() call:
|
| 57 |
+
|
| 58 |
+
readline.set_completer(Completer(my_namespace).complete)
|
| 59 |
+
"""
|
| 60 |
+
|
| 61 |
+
# Don't bind to namespace quite yet, but flag whether the user wants a
|
| 62 |
+
# specific namespace or to use __main__.__dict__. This will allow us
|
| 63 |
+
# to bind to __main__.__dict__ at completion time, not now.
|
| 64 |
+
if namespace is None:
|
| 65 |
+
self.use_main_ns = 1
|
| 66 |
+
else:
|
| 67 |
+
self.use_main_ns = 0
|
| 68 |
+
self.namespace = namespace
|
| 69 |
+
|
| 70 |
+
# The global namespace, if given, can be bound directly
|
| 71 |
+
if global_namespace is None:
|
| 72 |
+
self.global_namespace = {}
|
| 73 |
+
else:
|
| 74 |
+
self.global_namespace = global_namespace
|
| 75 |
+
|
| 76 |
+
def complete(self, text):
|
| 77 |
+
"""Return the next possible completion for 'text'.
|
| 78 |
+
|
| 79 |
+
This is called successively with state == 0, 1, 2, ... until it
|
| 80 |
+
returns None. The completion should begin with 'text'.
|
| 81 |
+
|
| 82 |
+
"""
|
| 83 |
+
if self.use_main_ns:
|
| 84 |
+
# In pydev this option should never be used
|
| 85 |
+
raise RuntimeError("Namespace must be provided!")
|
| 86 |
+
self.namespace = __main__.__dict__ # @UndefinedVariable
|
| 87 |
+
|
| 88 |
+
if "." in text:
|
| 89 |
+
return self.attr_matches(text)
|
| 90 |
+
else:
|
| 91 |
+
return self.global_matches(text)
|
| 92 |
+
|
| 93 |
+
def global_matches(self, text):
|
| 94 |
+
"""Compute matches when text is a simple name.
|
| 95 |
+
|
| 96 |
+
Return a list of all keywords, built-in functions and names currently
|
| 97 |
+
defined in self.namespace or self.global_namespace that match.
|
| 98 |
+
|
| 99 |
+
"""
|
| 100 |
+
|
| 101 |
+
def get_item(obj, attr):
|
| 102 |
+
return obj[attr]
|
| 103 |
+
|
| 104 |
+
a = {}
|
| 105 |
+
|
| 106 |
+
for dict_with_comps in [__builtin__.__dict__, self.namespace, self.global_namespace]: # @UndefinedVariable
|
| 107 |
+
a.update(dict_with_comps)
|
| 108 |
+
|
| 109 |
+
filter = _StartsWithFilter(text)
|
| 110 |
+
|
| 111 |
+
return dir2(a, a.keys(), get_item, filter)
|
| 112 |
+
|
| 113 |
+
def attr_matches(self, text):
|
| 114 |
+
"""Compute matches when text contains a dot.
|
| 115 |
+
|
| 116 |
+
Assuming the text is of the form NAME.NAME....[NAME], and is
|
| 117 |
+
evaluatable in self.namespace or self.global_namespace, it will be
|
| 118 |
+
evaluated and its attributes (as revealed by dir()) are used as
|
| 119 |
+
possible completions. (For class instances, class members are are
|
| 120 |
+
also considered.)
|
| 121 |
+
|
| 122 |
+
WARNING: this can still invoke arbitrary C code, if an object
|
| 123 |
+
with a __getattr__ hook is evaluated.
|
| 124 |
+
|
| 125 |
+
"""
|
| 126 |
+
import re
|
| 127 |
+
|
| 128 |
+
# Another option, seems to work great. Catches things like ''.<tab>
|
| 129 |
+
m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text) # @UndefinedVariable
|
| 130 |
+
|
| 131 |
+
if not m:
|
| 132 |
+
return []
|
| 133 |
+
|
| 134 |
+
expr, attr = m.group(1, 3)
|
| 135 |
+
try:
|
| 136 |
+
obj = eval(expr, self.namespace)
|
| 137 |
+
except:
|
| 138 |
+
try:
|
| 139 |
+
obj = eval(expr, self.global_namespace)
|
| 140 |
+
except:
|
| 141 |
+
return []
|
| 142 |
+
|
| 143 |
+
filter = _StartsWithFilter(attr)
|
| 144 |
+
|
| 145 |
+
words = dir2(obj, filter=filter)
|
| 146 |
+
|
| 147 |
+
return words
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
def generate_completions(frame, act_tok):
|
| 151 |
+
"""
|
| 152 |
+
:return list(tuple(method_name, docstring, parameters, completion_type))
|
| 153 |
+
|
| 154 |
+
method_name: str
|
| 155 |
+
docstring: str
|
| 156 |
+
parameters: str -- i.e.: "(a, b)"
|
| 157 |
+
completion_type is an int
|
| 158 |
+
See: _pydev_bundle._pydev_imports_tipper for TYPE_ constants
|
| 159 |
+
"""
|
| 160 |
+
if frame is None:
|
| 161 |
+
return []
|
| 162 |
+
|
| 163 |
+
# Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329
|
| 164 |
+
# (Names not resolved in generator expression in method)
|
| 165 |
+
# See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html
|
| 166 |
+
updated_globals = {}
|
| 167 |
+
updated_globals.update(frame.f_globals)
|
| 168 |
+
updated_globals.update(frame.f_locals) # locals later because it has precedence over the actual globals
|
| 169 |
+
|
| 170 |
+
if pydevconsole.IPYTHON:
|
| 171 |
+
completions = pydevconsole.get_completions(act_tok, act_tok, updated_globals, frame.f_locals)
|
| 172 |
+
else:
|
| 173 |
+
completer = Completer(updated_globals, None)
|
| 174 |
+
# list(tuple(name, descr, parameters, type))
|
| 175 |
+
completions = completer.complete(act_tok)
|
| 176 |
+
|
| 177 |
+
return completions
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
def generate_completions_as_xml(frame, act_tok):
|
| 181 |
+
completions = generate_completions(frame, act_tok)
|
| 182 |
+
return completions_to_xml(completions)
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
def completions_to_xml(completions):
|
| 186 |
+
valid_xml = pydevd_xml.make_valid_xml_value
|
| 187 |
+
quote = pydevd_xml.quote
|
| 188 |
+
msg = ["<xml>"]
|
| 189 |
+
|
| 190 |
+
for comp in completions:
|
| 191 |
+
msg.append('<comp p0="')
|
| 192 |
+
msg.append(valid_xml(quote(comp[0], "/>_= \t")))
|
| 193 |
+
msg.append('" p1="')
|
| 194 |
+
msg.append(valid_xml(quote(comp[1], "/>_= \t")))
|
| 195 |
+
msg.append('" p2="')
|
| 196 |
+
msg.append(valid_xml(quote(comp[2], "/>_= \t")))
|
| 197 |
+
msg.append('" p3="')
|
| 198 |
+
msg.append(valid_xml(quote(comp[3], "/>_= \t")))
|
| 199 |
+
msg.append('"/>')
|
| 200 |
+
msg.append("</xml>")
|
| 201 |
+
|
| 202 |
+
return "".join(msg)
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
identifier_start = ascii_letters + "_"
|
| 206 |
+
identifier_part = ascii_letters + "_" + digits
|
| 207 |
+
|
| 208 |
+
identifier_start = set(identifier_start)
|
| 209 |
+
identifier_part = set(identifier_part)
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def isidentifier(s):
|
| 213 |
+
return s.isidentifier()
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
TokenAndQualifier = namedtuple("TokenAndQualifier", "token, qualifier")
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
def extract_token_and_qualifier(text, line=0, column=0):
|
| 220 |
+
"""
|
| 221 |
+
Extracts the token a qualifier from the text given the line/colum
|
| 222 |
+
(see test_extract_token_and_qualifier for examples).
|
| 223 |
+
|
| 224 |
+
:param unicode text:
|
| 225 |
+
:param int line: 0-based
|
| 226 |
+
:param int column: 0-based
|
| 227 |
+
"""
|
| 228 |
+
# Note: not using the tokenize module because text should be unicode and
|
| 229 |
+
# line/column refer to the unicode text (otherwise we'd have to know
|
| 230 |
+
# those ranges after converted to bytes).
|
| 231 |
+
if line < 0:
|
| 232 |
+
line = 0
|
| 233 |
+
if column < 0:
|
| 234 |
+
column = 0
|
| 235 |
+
|
| 236 |
+
if isinstance(text, bytes):
|
| 237 |
+
text = text.decode("utf-8")
|
| 238 |
+
|
| 239 |
+
lines = text.splitlines()
|
| 240 |
+
try:
|
| 241 |
+
text = lines[line]
|
| 242 |
+
except IndexError:
|
| 243 |
+
return TokenAndQualifier("", "")
|
| 244 |
+
|
| 245 |
+
if column >= len(text):
|
| 246 |
+
column = len(text)
|
| 247 |
+
|
| 248 |
+
text = text[:column]
|
| 249 |
+
token = ""
|
| 250 |
+
qualifier = ""
|
| 251 |
+
|
| 252 |
+
temp_token = []
|
| 253 |
+
for i in range(column - 1, -1, -1):
|
| 254 |
+
c = text[i]
|
| 255 |
+
if c in identifier_part or isidentifier(c) or c == ".":
|
| 256 |
+
temp_token.append(c)
|
| 257 |
+
else:
|
| 258 |
+
break
|
| 259 |
+
temp_token = "".join(reversed(temp_token))
|
| 260 |
+
if "." in temp_token:
|
| 261 |
+
temp_token = temp_token.split(".")
|
| 262 |
+
token = ".".join(temp_token[:-1])
|
| 263 |
+
qualifier = temp_token[-1]
|
| 264 |
+
else:
|
| 265 |
+
qualifier = temp_token
|
| 266 |
+
|
| 267 |
+
return TokenAndQualifier(token, qualifier)
|
lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_execfile.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# We must redefine it in Py3k if it's not already there
|
| 2 |
+
def execfile(file, glob=None, loc=None):
|
| 3 |
+
if glob is None:
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
glob = sys._getframe().f_back.f_globals
|
| 7 |
+
if loc is None:
|
| 8 |
+
loc = glob
|
| 9 |
+
|
| 10 |
+
import tokenize
|
| 11 |
+
|
| 12 |
+
with tokenize.open(file) as stream:
|
| 13 |
+
contents = stream.read()
|
| 14 |
+
|
| 15 |
+
# execute the script (note: it's important to compile first to have the filename set in debug mode)
|
| 16 |
+
exec(compile(contents + "\n", file, "exec"), glob, loc)
|