Datasets:
Improve dataset card: document schema, measured stats and limitations
Browse files
README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
configs:
|
| 3 |
+
- config_name: default
|
| 4 |
+
data_files:
|
| 5 |
+
- split: train
|
| 6 |
+
path: data/train-*
|
| 7 |
+
dataset_info:
|
| 8 |
+
features:
|
| 9 |
+
- name: repo_name
|
| 10 |
+
dtype: string
|
| 11 |
+
- name: path
|
| 12 |
+
dtype: string
|
| 13 |
+
- name: copies
|
| 14 |
+
dtype: string
|
| 15 |
+
- name: size
|
| 16 |
+
dtype: string
|
| 17 |
+
- name: content
|
| 18 |
+
dtype: string
|
| 19 |
+
- name: license
|
| 20 |
+
dtype: string
|
| 21 |
+
- name: hash
|
| 22 |
+
dtype: int64
|
| 23 |
+
- name: line_mean
|
| 24 |
+
dtype: float64
|
| 25 |
+
- name: line_max
|
| 26 |
+
dtype: int64
|
| 27 |
+
- name: alpha_frac
|
| 28 |
+
dtype: float64
|
| 29 |
+
- name: autogenerated
|
| 30 |
+
dtype: bool
|
| 31 |
+
- name: ratio
|
| 32 |
+
dtype: float64
|
| 33 |
+
- name: config_test
|
| 34 |
+
dtype: bool
|
| 35 |
+
- name: has_no_keywords
|
| 36 |
+
dtype: bool
|
| 37 |
+
- name: few_assignments
|
| 38 |
+
dtype: bool
|
| 39 |
+
splits:
|
| 40 |
+
- name: train
|
| 41 |
+
num_bytes: 432490836
|
| 42 |
+
num_examples: 45961
|
| 43 |
+
download_size: 159490243
|
| 44 |
+
dataset_size: 432490836
|
| 45 |
+
license: other
|
| 46 |
+
language:
|
| 47 |
+
- code
|
| 48 |
+
tags:
|
| 49 |
+
- code
|
| 50 |
+
- python
|
| 51 |
+
- filtered
|
| 52 |
+
size_categories:
|
| 53 |
+
- 10K<n<100K
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
# code-valid
|
| 57 |
+
|
| 58 |
+
45,961 Python files that passed a code-quality filtering pass, each kept with its
|
| 59 |
+
source repository, file path, declared licence, and the filter values that were
|
| 60 |
+
computed on it.
|
| 61 |
+
|
| 62 |
+
## At a glance
|
| 63 |
+
|
| 64 |
+
| | |
|
| 65 |
+
|---|---|
|
| 66 |
+
| Rows | 45,961 (single `train` split) |
|
| 67 |
+
| File type | Python only — `.py` for **100%** of rows |
|
| 68 |
+
| Columns | 15 (see below) |
|
| 69 |
+
| Parquet on disk | 159.5 MB (432.5 MB uncompressed) |
|
| 70 |
+
| Row groups | 5 |
|
| 71 |
+
|
| 72 |
+
## Columns
|
| 73 |
+
|
| 74 |
+
| Column | Type | What it holds |
|
| 75 |
+
|---|---|---|
|
| 76 |
+
| `repo_name` | string | source repository, e.g. `pansapiens/mytardis` |
|
| 77 |
+
| `path` | string | file path in the repository, e.g. `tardis/apps/mx_views/views.py` |
|
| 78 |
+
| `content` | string | the file's full source text (mean 9,272 chars, median 3,937, max 644,045) |
|
| 79 |
+
| `license` | string | SPDX-style licence string of the repository |
|
| 80 |
+
| `size` | string | file size in bytes, as a string (1,024 – 895,755; mean 9,231) |
|
| 81 |
+
| `copies` | string | in how many repositories the same content was found (1 for 44,880 rows, up to 11) |
|
| 82 |
+
| `hash` | int64 | content hash used for the duplicate check |
|
| 83 |
+
| `line_mean` | float64 | mean line length (6.5 – 99.9, mean 33.8) |
|
| 84 |
+
| `line_max` | int64 | longest line |
|
| 85 |
+
| `alpha_frac` | float64 | fraction of alphabetic characters (0.25 – 0.96, mean 0.60) |
|
| 86 |
+
| `ratio` | float64 | filter ratio value (1.50 – 13.56, mean 3.70) |
|
| 87 |
+
| `autogenerated` | bool | `False` in **every** row of this snapshot |
|
| 88 |
+
| `config_test` | bool | `True` in 5,104 rows (11%) |
|
| 89 |
+
| `has_no_keywords` | bool | `True` in 301 rows |
|
| 90 |
+
| `few_assignments` | bool | `False` in **every** row of this snapshot |
|
| 91 |
+
|
| 92 |
+
## Licence distribution
|
| 93 |
+
|
| 94 |
+
Counted over all 45,961 rows — 15 distinct values, no nulls:
|
| 95 |
+
|
| 96 |
+
| Licence | Rows |
|
| 97 |
+
|---|---|
|
| 98 |
+
| `mit` | 14,285 |
|
| 99 |
+
| `apache-2.0` | 8,216 |
|
| 100 |
+
| `gpl-3.0` | 8,188 |
|
| 101 |
+
| `gpl-2.0` | 4,708 |
|
| 102 |
+
| `bsd-3-clause` | 4,650 |
|
| 103 |
+
| `agpl-3.0` | 2,307 |
|
| 104 |
+
| `bsd-2-clause` | 1,224 |
|
| 105 |
+
| `lgpl-3.0` | 806 |
|
| 106 |
+
| `lgpl-2.1` | 580 |
|
| 107 |
+
| `unlicense` | 328 |
|
| 108 |
+
| `mpl-2.0` | 273 |
|
| 109 |
+
| `isc` | 162 |
|
| 110 |
+
| `cc0-1.0` | 135 |
|
| 111 |
+
| `epl-1.0` | 77 |
|
| 112 |
+
| `artistic-2.0` | 22 |
|
| 113 |
+
|
| 114 |
+
## Usage
|
| 115 |
+
|
| 116 |
+
```python
|
| 117 |
+
from datasets import load_dataset
|
| 118 |
+
|
| 119 |
+
ds = load_dataset("razhan/code-valid", split="train")
|
| 120 |
+
row = ds[0]
|
| 121 |
+
print(row["repo_name"], row["path"], row["license"])
|
| 122 |
+
print(row["content"][:300])
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
If you need only permissively licensed code, filter on `license` in
|
| 126 |
+
`{"mit", "apache-2.0", "bsd-2-clause", "bsd-3-clause", "isc", "unlicense", "cc0-1.0"}`
|
| 127 |
+
— that keeps exactly 29,000 rows. Copyleft licences account for the remaining 16,589.
|
| 128 |
+
|
| 129 |
+
## Known limitations
|
| 130 |
+
|
| 131 |
+
- **Licence is per repository, not per file.** Rows inherit the repository's
|
| 132 |
+
declared licence; verify before redistribution, and note that 16,589 rows carry
|
| 133 |
+
copyleft licences (`gpl-*`, `agpl-3.0`, `lgpl-*`).
|
| 134 |
+
- Duplicate content is not removed: `copies` > 1 for 1,081 rows, and those rows
|
| 135 |
+
appear once per repository.
|
| 136 |
+
- The flag columns record a single filtering pass from 2022; `autogenerated` and
|
| 137 |
+
`few_assignments` are constant `False` here, so they carry no signal in this
|
| 138 |
+
snapshot.
|
| 139 |
+
- No language/version metadata beyond "it parses as Python", and no repository
|
| 140 |
+
snapshot date — code drift between the crawl and today is not tracked.
|
| 141 |
+
- Some files are minified, generated, or vendor dumps that survived the filters
|
| 142 |
+
applied at the time.
|