-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmigration.py
More file actions
50 lines (38 loc) · 1.6 KB
/
migration.py
File metadata and controls
50 lines (38 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
"""
Migration script to help transition from the old single-file structure to the new modular structure.
This script provides backward compatibility by exposing the same functionality
as the original code_bert_indexing_system_example.py but using the refactored components.
"""
import sys
import argparse
import logging
from pathlib import Path
# Import refactored components
from models.code_models import CodeFile, CodeEmbedding
from parsers.code_parser import CodeParser
from indexers.codebert_indexer import CodeBERTIndexer
from cli import main as cli_main
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
def print_migration_message():
"""Print a message encouraging users to migrate to the new structure"""
print("=" * 80)
print("MIGRATION NOTICE:")
print("This script provides backward compatibility with code_bert_indexing_system_example.py")
print("We recommend using the new refactored structure:")
print(" - CLI usage: python cli.py --scan /path/to/codebase")
print(" - Module usage: from indexers.codebert_indexer import CodeBERTIndexer")
print("=" * 80)
def main():
"""Main function to provide backward compatibility"""
print_migration_message()
# Call the refactored CLI with the same arguments
cli_main()
if __name__ == "__main__":
# Force the display of the migration message even when imported
print_migration_message()
# Only run main() if called directly
if sys.argv[0].endswith("migration.py"):
main()