Skip to content

Commit

Permalink
refactoring: remove comments && dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-lebleu committed Nov 28, 2024
1 parent 195ff64 commit f6125ec
Show file tree
Hide file tree
Showing 312 changed files with 279,134 additions and 4 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Metadata-Version: 2.1
Name: debugpy
Version: 1.8.8
Summary: An implementation of the Debug Adapter Protocol for Python
Home-page: https://aka.ms/debugpy
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT
Project-URL: Source, https://github.com/microsoft/debugpy
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Debuggers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

debugpy is an implementation of the Debug Adapter Protocol for Python.

The source code and the issue tracker is [hosted on GitHub](https://github.com/microsoft/debugpy/).
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"/usr/local","last_check":"2024-11-27T13:29:55.849209+00:00","pypi_version":"24.3.1"}
9 changes: 9 additions & 0 deletions .local/bin/debugpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/local/bin/python3.12
import re
import sys

from debugpy.server.cli import main

if __name__ == "__main__":
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
sys.exit(main())
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
debugpy

Copyright (c) Microsoft Corporation
All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Metadata-Version: 2.1
Name: debugpy
Version: 1.8.8
Summary: An implementation of the Debug Adapter Protocol for Python
Home-page: https://aka.ms/debugpy
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT
Project-URL: Source, https://github.com/microsoft/debugpy
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Debuggers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

debugpy is an implementation of the Debug Adapter Protocol for Python.

The source code and the issue tracker is [hosted on GitHub](https://github.com/microsoft/debugpy/).
537 changes: 537 additions & 0 deletions .local/lib/python3.12/site-packages/debugpy-1.8.8.dist-info/RECORD

Large diffs are not rendered by default.

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Wheel-Version: 1.0
Generator: setuptools (75.3.0)
Root-Is-Purelib: false
Tag: cp312-cp312-manylinux_2_5_x86_64
Tag: cp312-cp312-manylinux1_x86_64
Tag: cp312-cp312-manylinux_2_17_x86_64
Tag: cp312-cp312-manylinux2014_x86_64

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[console_scripts]
debugpy = debugpy.server.cli:main
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debugpy
499 changes: 499 additions & 0 deletions .local/lib/python3.12/site-packages/debugpy/ThirdPartyNotices.txt

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions .local/lib/python3.12/site-packages/debugpy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.

"""An implementation of the Debug Adapter Protocol (DAP) for Python.
https://microsoft.github.io/debug-adapter-protocol/
"""

# debugpy stable public API consists solely of members of this module that are
# enumerated below.
__all__ = [ # noqa
"__version__",
"breakpoint",
"configure",
"connect",
"debug_this_thread",
"is_client_connected",
"listen",
"log_to",
"trace_this_thread",
"wait_for_client",
]

import sys

assert sys.version_info >= (3, 7), (
"Python 3.6 and below is not supported by this version of debugpy; "
"use debugpy 1.5.1 or earlier."
)


# Actual definitions are in a separate file to work around parsing issues causing
# SyntaxError on Python 2 and preventing the above version check from executing.
from debugpy.public_api import * # noqa
from debugpy.public_api import __version__

del sys
70 changes: 70 additions & 0 deletions .local/lib/python3.12/site-packages/debugpy/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.

import sys

if __name__ == "__main__":
# There are three ways to run debugpy:
#
# 1. Installed as a module in the current environment (python -m debugpy ...)
# 2. Run as a script from source code (python <repo_root>/src/debugpy ...)
# 3. Installed as a module in a random directory
#
# -----
#
# In the first case, no extra work is needed. Importing debugpy will work as expected.
# Also, running 'debugpy' instead of 'python -m debugpy' will work because of the entry point
# defined in setup.py.
#
# -----
#
# In the second case, sys.path[0] is the one added automatically by Python for the directory
# containing this file. 'import debugpy' will not work since we need the parent directory
# of debugpy/ to be in sys.path, rather than debugpy/ itself. So we need to modify sys.path[0].
# Running 'debugpy' will not work because the entry point is not defined in this case.
#
# -----
#
# In the third case, running 'python -m debugpy' will not work because the module is not installed
# in any environment. Running 'python <install_dir>/debugpy' will work, just like the second case.
# But running the entry point will not work because python doesn't know where to find the debugpy module.
#
# In this case, no changes to sys.path are required. You just have to do the following before calling
# the entry point:
# 1. Add <install_dir> to PYTHONPATH.
# On Windows, this is set PYTHONPATH=%PYTHONPATH%;<install_dir>
# 2. Add <install_dir>/bin to PATH. (OPTIONAL)
# On Windows, this is set PATH=%PATH%;<install_dir>\bin
# 3. Run the entry point from a command prompt
# On Windows, this is <install_dir>\bin\debugpy.exe, or just 'debugpy' if you did the previous step.
#
# -----
#
# If we modify sys.path, 'import debugpy' will work, but it will break other imports
# because they will be resolved relative to debugpy/ - e.g. `import debugger` will try
# to import debugpy/debugger.py.
#
# To fix both problems, we need to do the following steps:
# 1. Modify sys.path[0] to point at the parent directory of debugpy/ instead of debugpy/ itself.
# 2. Import debugpy.
# 3. Remove sys.path[0] so that it doesn't affect future imports.
#
# For example, suppose the user did:
#
# python /foo/bar/debugpy ...
#
# At the beginning of this script, sys.path[0] will contain "/foo/bar/debugpy".
# We want to replace it with "/foo/bar', then 'import debugpy', then remove the replaced entry.
# The imported debugpy module will remain in sys.modules, and thus all future imports of it
# or its submodules will resolve accordingly.
if "debugpy" not in sys.modules:
# Do not use dirname() to walk up - this can be a relative path, e.g. ".".
sys.path[0] = sys.path[0] + "/../"
import debugpy # noqa

del sys.path[0]

from debugpy.server import cli

cli.main()
125 changes: 125 additions & 0 deletions .local/lib/python3.12/site-packages/debugpy/_vendored/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.

import contextlib
import os
import sys
from importlib import import_module

from . import _util

VENDORED_ROOT = os.path.dirname(os.path.abspath(__file__))
# TODO: Move the "pydevd" git submodule to the debugpy/_vendored directory
# and then drop the following fallback.
if "pydevd" not in os.listdir(VENDORED_ROOT):
VENDORED_ROOT = os.path.dirname(VENDORED_ROOT)


def list_all(resolve=False):
"""Return the list of vendored projects."""
# TODO: Derive from os.listdir(VENDORED_ROOT)?
projects = ["pydevd"]
if not resolve:
return projects
return [project_root(name) for name in projects]


def project_root(project):
"""Return the path the root dir of the vendored project.
If "project" is an empty string then the path prefix for vendored
projects (e.g. "debugpy/_vendored/") will be returned.
"""
if not project:
project = ""
return os.path.join(VENDORED_ROOT, project)


def iter_project_files(project, relative=False, **kwargs):
"""Yield (dirname, basename, filename) for all files in the project."""
if relative:
with _util.cwd(VENDORED_ROOT):
for result in _util.iter_all_files(project, **kwargs):
yield result
else:
root = project_root(project)
for result in _util.iter_all_files(root, **kwargs):
yield result


def iter_packaging_files(project):
"""Yield the filenames for all files in the project.
The filenames are relative to "debugpy/_vendored". This is most
useful for the "package data" in a setup.py.
"""
# TODO: Use default filters? __pycache__ and .pyc?
prune_dir = None
exclude_file = None
try:
mod = import_module(f"._{project}_packaging", __name__)
except ImportError:
pass
else:
prune_dir = getattr(mod, "prune_dir", prune_dir)
exclude_file = getattr(mod, "exclude_file", exclude_file)
results = iter_project_files(
project, relative=True, prune_dir=prune_dir, exclude_file=exclude_file
)
for _, _, filename in results:
yield filename


def prefix_matcher(*prefixes):
"""Return a module match func that matches any of the given prefixes."""
assert prefixes

def match(name, module):
for prefix in prefixes:
if name.startswith(prefix):
return True
else:
return False

return match


def check_modules(project, match, root=None):
"""Verify that only vendored modules have been imported."""
if root is None:
root = project_root(project)
extensions = []
unvendored = {}
for modname, mod in list(sys.modules.items()):
if not match(modname, mod):
continue
try:
filename = getattr(mod, "__file__", None)
except: # In theory it's possible that any error is raised when accessing __file__
filename = None
if not filename: # extension module
extensions.append(modname)
elif not filename.startswith(root):
unvendored[modname] = filename
return unvendored, extensions


@contextlib.contextmanager
def vendored(project, root=None):
"""A context manager under which the vendored project will be imported."""
if root is None:
root = project_root(project)
# Add the vendored project directory, so that it gets tried first.
sys.path.insert(0, root)
try:
yield root
finally:
sys.path.remove(root)


def preimport(project, modules, **kwargs):
"""Import each of the named modules out of the vendored project."""
with vendored(project, **kwargs):
for name in modules:
import_module(name)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.

from . import VENDORED_ROOT
from ._util import cwd, iter_all_files

INCLUDES = [
"setup_pydevd_cython.py",
]


def iter_files():
# From the root of pydevd repo, we want only scripts and
# subdirectories that constitute the package itself (not helper
# scripts, tests etc). But when walking down into those
# subdirectories, we want everything below.

with cwd(VENDORED_ROOT):
return iter_all_files("pydevd", prune_dir, exclude_file)


def prune_dir(dirname, basename):
if basename == "__pycache__":
return True
elif dirname != "pydevd":
return False
elif basename.startswith("pydev"):
return False
elif basename.startswith("_pydev"):
return False
return True


def exclude_file(dirname, basename):
if dirname == "pydevd":
if basename in INCLUDES:
return False
elif not basename.endswith(".py"):
return True
elif "pydev" not in basename:
return True
return False

if basename.endswith(".pyc"):
return True
return False
Loading

0 comments on commit f6125ec

Please sign in to comment.