File size: 682 Bytes
4265aea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Data handling for NexForge Tokenizer."""
import os
from pathlib import Path
from typing import Optional

def get_data_path() -> Path:
    """Get the path to the package data directory."""
    return Path(__file__).parent

def get_sample_data_path() -> Optional[Path]:
    """Get the path to the sample Python code file."""
    data_path = get_data_path() / "python_code_sample.txt"
    return data_path if data_path.exists() else None

def load_sample_data() -> Optional[str]:
    """Load and return the sample Python code as a string."""
    sample_path = get_sample_data_path()
    if sample_path is None:
        return None
    return sample_path.read_text(encoding='utf-8')