vscode-common-python-lsp 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/PKG-INFO +1 -1
  2. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/pyproject.toml +1 -1
  3. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/__init__.py +2 -0
  4. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/paths.py +21 -0
  5. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp.egg-info/PKG-INFO +1 -1
  6. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/README.md +0 -0
  7. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/setup.cfg +0 -0
  8. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_code_actions.py +0 -0
  9. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_context.py +0 -0
  10. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_debug.py +0 -0
  11. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_diagnostics.py +0 -0
  12. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_formatting.py +0 -0
  13. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_jsonrpc.py +0 -0
  14. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_linting.py +0 -0
  15. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_notebook.py +0 -0
  16. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_package.py +0 -0
  17. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_paths.py +0 -0
  18. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_process_runner.py +0 -0
  19. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_runner.py +0 -0
  20. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_server.py +0 -0
  21. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/tests/test_version.py +0 -0
  22. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/code_actions.py +0 -0
  23. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/context.py +0 -0
  24. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/debug.py +0 -0
  25. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/diagnostics.py +0 -0
  26. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/formatting.py +0 -0
  27. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/jsonrpc.py +0 -0
  28. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/linting.py +0 -0
  29. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/notebook.py +0 -0
  30. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/process_runner.py +0 -0
  31. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/runner.py +0 -0
  32. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/server.py +0 -0
  33. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp/version.py +0 -0
  34. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp.egg-info/SOURCES.txt +0 -0
  35. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp.egg-info/dependency_links.txt +0 -0
  36. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp.egg-info/requires.txt +0 -0
  37. {vscode_common_python_lsp-0.1.0 → vscode_common_python_lsp-0.2.0}/vscode_common_python_lsp.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vscode-common-python-lsp
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Shared Python utilities for VS Code Python tool extensions
5
5
  Author: Microsoft Corporation
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vscode-common-python-lsp"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "Shared Python utilities for VS Code Python tool extensions"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -56,6 +56,7 @@ from .paths import (
56
56
  is_match,
57
57
  is_same_path,
58
58
  normalize_path,
59
+ reset_caches,
59
60
  )
60
61
  from .process_runner import run_message_loop, update_sys_path
61
62
  from .runner import CustomIO, RunResult, run_api, run_module, run_path
@@ -76,6 +77,7 @@ __all__ = [
76
77
  "classify_python_file",
77
78
  "PythonFileKind",
78
79
  "is_match",
80
+ "reset_caches",
79
81
  # context
80
82
  "substitute_attr",
81
83
  "redirect_io",
@@ -186,6 +186,27 @@ def classify_python_file(file_path: str) -> PythonFileKind | None:
186
186
  return None
187
187
 
188
188
 
189
+ def reset_caches() -> None:
190
+ """Clear all ``lru_cache`` caches in this module.
191
+
192
+ Useful in tests that need to mock ``site.getusersitepackages()`` or
193
+ other underlying functions and have the change take effect immediately.
194
+
195
+ Example::
196
+
197
+ from vscode_common_python_lsp import reset_caches
198
+
199
+ reset_caches()
200
+ with patch.object(site, "getusersitepackages", return_value=None):
201
+ reset_caches()
202
+ assert classify_python_file("/some/path") is None
203
+ reset_caches() # restore real values
204
+ """
205
+ _get_stdlib_roots.cache_clear()
206
+ _get_user_site_root.cache_clear()
207
+ _get_system_site_roots.cache_clear()
208
+
209
+
189
210
  # ---------------------------------------------------------------------------
190
211
  # Path comparison and normalization
191
212
  # ---------------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vscode-common-python-lsp
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Shared Python utilities for VS Code Python tool extensions
5
5
  Author: Microsoft Corporation
6
6
  License-Expression: MIT