| --- |
| configs: |
| - config_name: default |
| data_files: |
| - split: train |
| path: data/train-* |
| dataset_info: |
| features: |
| - name: repo_name |
| dtype: string |
| - name: path |
| dtype: string |
| - name: copies |
| dtype: string |
| - name: size |
| dtype: string |
| - name: content |
| dtype: string |
| - name: license |
| dtype: string |
| - name: hash |
| dtype: int64 |
| - name: line_mean |
| dtype: float64 |
| - name: line_max |
| dtype: int64 |
| - name: alpha_frac |
| dtype: float64 |
| - name: autogenerated |
| dtype: bool |
| - name: ratio |
| dtype: float64 |
| - name: config_test |
| dtype: bool |
| - name: has_no_keywords |
| dtype: bool |
| - name: few_assignments |
| dtype: bool |
| splits: |
| - name: train |
| num_bytes: 432490836 |
| num_examples: 45961 |
| download_size: 159490243 |
| dataset_size: 432490836 |
| license: other |
| language: |
| - code |
| tags: |
| - code |
| - python |
| - filtered |
| size_categories: |
| - 10K<n<100K |
| --- |
| |
| # code-valid |
|
|
| 45,961 Python files that passed a code-quality filtering pass, each kept with its |
| source repository, file path, declared licence, and the filter values that were |
| computed on it. |
|
|
| ## At a glance |
|
|
| | | | |
| |---|---| |
| | Rows | 45,961 (single `train` split) | |
| | File type | Python only — `.py` for **100%** of rows | |
| | Columns | 15 (see below) | |
| | Parquet on disk | 159.5 MB (432.5 MB uncompressed) | |
| | Row groups | 5 | |
|
|
| ## Columns |
|
|
| | Column | Type | What it holds | |
| |---|---|---| |
| | `repo_name` | string | source repository, e.g. `pansapiens/mytardis` | |
| | `path` | string | file path in the repository, e.g. `tardis/apps/mx_views/views.py` | |
| | `content` | string | the file's full source text (mean 9,272 chars, median 3,937, max 644,045) | |
| | `license` | string | SPDX-style licence string of the repository | |
| | `size` | string | file size in bytes, as a string (1,024 – 895,755; mean 9,231) | |
| | `copies` | string | in how many repositories the same content was found (1 for 44,880 rows, up to 11) | |
| | `hash` | int64 | content hash used for the duplicate check | |
| | `line_mean` | float64 | mean line length (6.5 – 99.9, mean 33.8) | |
| | `line_max` | int64 | longest line | |
| | `alpha_frac` | float64 | fraction of alphabetic characters (0.25 – 0.96, mean 0.60) | |
| | `ratio` | float64 | filter ratio value (1.50 – 13.56, mean 3.70) | |
| | `autogenerated` | bool | `False` in **every** row of this snapshot | |
| | `config_test` | bool | `True` in 5,104 rows (11%) | |
| | `has_no_keywords` | bool | `True` in 301 rows | |
| | `few_assignments` | bool | `False` in **every** row of this snapshot | |
|
|
| ## Licence distribution |
|
|
| Counted over all 45,961 rows — 15 distinct values, no nulls: |
|
|
| | Licence | Rows | |
| |---|---| |
| | `mit` | 14,285 | |
| | `apache-2.0` | 8,216 | |
| | `gpl-3.0` | 8,188 | |
| | `gpl-2.0` | 4,708 | |
| | `bsd-3-clause` | 4,650 | |
| | `agpl-3.0` | 2,307 | |
| | `bsd-2-clause` | 1,224 | |
| | `lgpl-3.0` | 806 | |
| | `lgpl-2.1` | 580 | |
| | `unlicense` | 328 | |
| | `mpl-2.0` | 273 | |
| | `isc` | 162 | |
| | `cc0-1.0` | 135 | |
| | `epl-1.0` | 77 | |
| | `artistic-2.0` | 22 | |
|
|
| ## Usage |
|
|
| ```python |
| from datasets import load_dataset |
| |
| ds = load_dataset("razhan/code-valid", split="train") |
| row = ds[0] |
| print(row["repo_name"], row["path"], row["license"]) |
| print(row["content"][:300]) |
| ``` |
|
|
| If you need only permissively licensed code, filter on `license` in |
| `{"mit", "apache-2.0", "bsd-2-clause", "bsd-3-clause", "isc", "unlicense", "cc0-1.0"}` |
| — that keeps exactly 29,000 rows. Copyleft licences account for the remaining 16,589. |
|
|
| ## Known limitations |
|
|
| - **Licence is per repository, not per file.** Rows inherit the repository's |
| declared licence; verify before redistribution, and note that 16,589 rows carry |
| copyleft licences (`gpl-*`, `agpl-3.0`, `lgpl-*`). |
| - Duplicate content is not removed: `copies` > 1 for 1,081 rows, and those rows |
| appear once per repository. |
| - The flag columns record a single filtering pass from 2022; `autogenerated` and |
| `few_assignments` are constant `False` here, so they carry no signal in this |
| snapshot. |
| - No language/version metadata beyond "it parses as Python", and no repository |
| snapshot date — code drift between the crawl and today is not tracked. |
| - Some files are minified, generated, or vendor dumps that survived the filters |
| applied at the time. |
|
|