File size: 2,207 Bytes
11161d9 |
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
---
license: apache-2.0
task_categories:
- text-generation
language:
- en
tags:
- code
- python
- doctest
- transpilation
- rust
size_categories:
- n<1K
---
# Python Doctest Corpus
A curated corpus of Python doctest examples designed for training Python-to-Rust transpilers and testing code translation systems.
## Dataset Description
This dataset contains Python function signatures, doctest inputs, and expected outputs that serve as high-quality training data for:
- **Transpilation training**: Teaching models to translate Python patterns to Rust
- **Test validation**: Verifying that transpiled code produces correct outputs
- **Code understanding**: Benchmarking code comprehension systems
## Schema
| Column | Type | Description |
|--------|------|-------------|
| `source` | string | Source project identifier |
| `version` | string | Git commit SHA or version |
| `module` | string | Module path (e.g., `example_math.math_tool`) |
| `function` | string | Function name being tested |
| `input` | string | Python doctest input (e.g., `>>> square(5)`) |
| `expected` | string | Expected output value |
| `signature` | string | Full Python function signature with type hints |
## Quality Score
Quality score validated using `alimentar quality score --profile doctest-corpus`:
- **Grade**: B (90.3%)
- **Critical Checks**: All passing
- **High Priority Checks**: All passing
## Example
```python
def square(x: int) -> int:
"""
>>> square(5)
25
>>> square(0)
0
"""
return x * x
```
Becomes:
```json
{
"source": "reprorusted-python-cli",
"function": "square",
"input": ">>> square(5)",
"expected": "25",
"signature": "def square(x: int) -> int"
}
```
## Usage
```python
from datasets import load_dataset
dataset = load_dataset("paiml/python-doctest-corpus")
for example in dataset["train"]:
print(f"{example['function']}: {example['input']} -> {example['expected']}")
```
## License
Apache 2.0
## Citation
```bibtex
@dataset{python_doctest_corpus,
author = {PAIML},
title = {Python Doctest Corpus},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/datasets/paiml/python-doctest-corpus}
}
```
|