mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-27 04:20:09 +00:00
- Remove all unconditional pytest.skip() calls - Fix file content tests to handle both strict/non-strict modes - Fix missing device_capabilities module in hanzo-network - Fix HanzoNetProvider imports and exports - Fix local_llm.py import errors - Create test helper classes for pagination tests - Fix FastMCP paginator test constructor args - Configure all API keys from ~/.zsh/after.zsh - All tests now pass or skip conditionally based on actual requirements
25 lines
731 B
Python
25 lines
731 B
Python
"""Compatibility layer for tree-sitter 0.24.0."""
|
|
|
|
import importlib
|
|
|
|
from tree_sitter import Language, Parser
|
|
|
|
# Cache of loaded languages
|
|
_language_cache = {}
|
|
|
|
|
|
def get_parser(language):
|
|
"""Get a Parser object for the given language name."""
|
|
if language not in _language_cache:
|
|
# Try to import the language module
|
|
module_name = f"tree_sitter_{language}"
|
|
try:
|
|
module = importlib.import_module(module_name)
|
|
_language_cache[language] = Language(module.language())
|
|
except ImportError:
|
|
raise ValueError(
|
|
f"Language {language} is not supported. Please install {module_name} package."
|
|
)
|
|
|
|
return Parser(_language_cache[language])
|