vscode-common-python-lsp 0.1.1__tar.gz → 0.2.1__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.1 → vscode_common_python_lsp-0.2.1}/PKG-INFO +1 -1
  2. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/pyproject.toml +1 -1
  3. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/__init__.py +4 -0
  4. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/paths.py +21 -0
  5. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp.egg-info/PKG-INFO +1 -1
  6. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/README.md +0 -0
  7. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/setup.cfg +0 -0
  8. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_code_actions.py +0 -0
  9. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_context.py +0 -0
  10. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_debug.py +0 -0
  11. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_diagnostics.py +0 -0
  12. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_formatting.py +0 -0
  13. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_jsonrpc.py +0 -0
  14. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_linting.py +0 -0
  15. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_notebook.py +0 -0
  16. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_package.py +0 -0
  17. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_paths.py +0 -0
  18. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_process_runner.py +0 -0
  19. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_runner.py +0 -0
  20. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_server.py +0 -0
  21. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/tests/test_version.py +0 -0
  22. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/code_actions.py +0 -0
  23. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/context.py +0 -0
  24. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/debug.py +0 -0
  25. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/diagnostics.py +0 -0
  26. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/formatting.py +0 -0
  27. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/jsonrpc.py +0 -0
  28. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/linting.py +0 -0
  29. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/notebook.py +0 -0
  30. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/process_runner.py +0 -0
  31. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/runner.py +0 -0
  32. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/server.py +0 -0
  33. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp/version.py +0 -0
  34. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp.egg-info/SOURCES.txt +0 -0
  35. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp.egg-info/dependency_links.txt +0 -0
  36. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/vscode_common_python_lsp.egg-info/requires.txt +0 -0
  37. {vscode_common_python_lsp-0.1.1 → vscode_common_python_lsp-0.2.1}/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.1
3
+ Version: 0.2.1
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.1"
7
+ version = "0.2.1"
8
8
  description = "Shared Python utilities for VS Code Python tool extensions"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -39,6 +39,7 @@ from .notebook import (
39
39
  CellLike,
40
40
  CellOffset,
41
41
  SyntheticDocument,
42
+ TextDocumentLike,
42
43
  build_notebook_source,
43
44
  get_cell_for_line,
44
45
  remap_diagnostics_to_cells,
@@ -56,6 +57,7 @@ from .paths import (
56
57
  is_match,
57
58
  is_same_path,
58
59
  normalize_path,
60
+ reset_caches,
59
61
  )
60
62
  from .process_runner import run_message_loop, update_sys_path
61
63
  from .runner import CustomIO, RunResult, run_api, run_module, run_path
@@ -76,6 +78,7 @@ __all__ = [
76
78
  "classify_python_file",
77
79
  "PythonFileKind",
78
80
  "is_match",
81
+ "reset_caches",
79
82
  # context
80
83
  "substitute_attr",
81
84
  "redirect_io",
@@ -123,6 +126,7 @@ __all__ = [
123
126
  # notebook
124
127
  "CellLike",
125
128
  "SyntheticDocument",
129
+ "TextDocumentLike",
126
130
  "CellOffset",
127
131
  "MAGIC_LINE_RE",
128
132
  "NOTEBOOK_SYNC_OPTIONS",
@@ -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.1
3
+ Version: 0.2.1
4
4
  Summary: Shared Python utilities for VS Code Python tool extensions
5
5
  Author: Microsoft Corporation
6
6
  License-Expression: MIT