Files
zeekay ea3116aac9 Fix all test issues and achieve 100% test pass rate
- 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
2025-08-12 16:19:34 -05:00

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])