Dataset Viewer
Auto-converted to Parquet Duplicate
language
stringclasses
6 values
tier
stringclasses
3 values
quality_score
float64
62
95.9
char_count
int64
56
56.2k
requires_version_context
bool
2 classes
version_context
stringclasses
23 values
code
stringlengths
56
56.2k
metadata
dict
python
timeless
73
5,886
false
{"min_version": "3.6+", "recommended": true}
from rest_framework_gis import serializers from rest_framework import serializers as s from .models import ( Artificialisee2015to2018, Artificielle2018, CommunesSybarval, CouvertureSol, EnveloppeUrbaine2018, Ocsge, Renaturee2018to2015, Sybarval, Voirie2018, ZonesBaties2018, ...
{ "source": "bigcode/the-stack-dedup", "repo_name": "MTES-MCT/sparte", "file_path": "public_data/serializers.py", "licenses": [ "MIT" ], "size_bytes": 5886, "details": "{\"annotation_ratio\": 0.0}" }
python
legacy
85
18,065
true
{"min_version": "3.6", "max_recommended_version": "3.9", "modernization_targets": ["f_strings", "pep_585_604_typing"]}
import asyncio import os import tempfile from contextlib import ExitStack from typing import Text, Optional, List, Union, Dict from rasa.importers.importer import TrainingDataImporter from rasa import model from rasa.model import FingerprintComparisonResult from rasa.core.domain import Domain from rasa.utils.common im...
{ "source": "bigcode/the-stack-dedup", "repo_name": "Amirali-Shirkh/rasa-for-botfront", "file_path": "rasa/train.py", "licenses": [ "Apache-2.0" ], "size_bytes": 18065, "details": "{\"annotation_ratio\": 1.0}" }
python
timeless
65
421
false
{"min_version": "3.6+", "recommended": true}
class Solution: def finalPrices(self, prices: List[int]) -> List[int]: res = [] for i in range(len(prices)): for j in range(i+1,len(prices)): if prices[j]<=prices[i]: res.append(prices[i]-prices[j]) break if j==len(p...
{ "source": "bigcode/the-stack-dedup", "repo_name": "Jahidul007/Python-Bootcamp", "file_path": "coding_intereview/1475. Final Prices With a Special Discount in a Shop.py", "licenses": [ "MIT" ], "size_bytes": 421, "details": "{\"annotation_ratio\": 1.0}" }
python
timeless
70
3,880
false
{"min_version": "3.6+", "recommended": true}
from keras import Model, Input from keras.layers import Dense, concatenate, LSTM, Reshape, Permute, Embedding, Dropout, Convolution1D, Flatten from keras.optimizers import Adam from pypagai.models.base import KerasModel class SimpleLSTM(KerasModel): """ Use a simple lstm neural network """ @staticmet...
{ "source": "bigcode/the-stack-dedup", "repo_name": "gcouti/pypagAI", "file_path": "pypagai/models/model_lstm.py", "licenses": [ "Apache-2.0" ], "size_bytes": 3880, "details": "{\"annotation_ratio\": 0.0}" }
python
timeless
70
844
false
{"min_version": "3.6+", "recommended": true}
"""Utils for criterion.""" import torch import torch.nn.functional as F def normalize(x, axis=-1): """Performs L2-Norm.""" num = x denom = torch.norm(x, 2, axis, keepdim=True).expand_as(x) + 1e-12 return num / denom # Source : https://github.com/earhian/Humpback-Whale-Identification-1st-/blob/master...
{ "source": "bigcode/the-stack-dedup", "repo_name": "Neklaustares-tPtwP/torchflare", "file_path": "torchflare/criterion/utils.py", "licenses": [ "Apache-2.0" ], "size_bytes": 844, "details": "{\"annotation_ratio\": 0.0}" }
python
timeless
70
18,905
false
{"min_version": "3.6+", "recommended": true}
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
{ "source": "bigcode/the-stack-dedup", "repo_name": "MaximovaIrina/transformers", "file_path": "src/transformers/models/mmbt/modeling_mmbt.py", "licenses": [ "Apache-2.0" ], "size_bytes": 18905, "details": "{\"annotation_ratio\": 0.0}" }
python
legacy
77
12,444
true
{"min_version": "3.6", "max_recommended_version": "3.9", "modernization_targets": ["f_strings", "pep_585_604_typing"]}
from abc import ( ABC, abstractmethod, ) import logging from typing import ( TYPE_CHECKING, Tuple, Type, ) from eth._utils.datatypes import ( Configurable, ) from eth.db.backends.base import ( BaseAtomicDB, ) from eth.exceptions import ( BlockNotFound, ) from eth.validation import ( ...
{ "source": "bigcode/the-stack-dedup", "repo_name": "mhchia/trinity", "file_path": "eth2/beacon/chains/base.py", "licenses": [ "MIT" ], "size_bytes": 12444, "details": "{\"annotation_ratio\": 1.0}" }
python
modern
88
3,625
false
{"min_version": "3.8+", "recommended": true}
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
{ "source": "bigcode/the-stack-dedup", "repo_name": "gianscarpe/pytorch-lightning", "file_path": "pytorch_lightning/plugins/environments/slurm_environment.py", "licenses": [ "Apache-2.0" ], "size_bytes": 3625, "details": "{\"annotation_ratio\": 1.0}" }
python
timeless
65
6,417
false
{"min_version": "3.6+", "recommended": true}
# # Copyright (c) 2021 The GPflux Contributors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
{ "source": "bigcode/the-stack-dedup", "repo_name": "francescodonato/GPflux", "file_path": "tests/gpflux/layers/test_latent_variable_layer.py", "licenses": [ "Apache-2.0" ], "size_bytes": 6417, "details": "{\"annotation_ratio\": 0.0}" }
python
legacy
80
2,465
true
{"min_version": "3.6", "max_recommended_version": "3.9", "modernization_targets": ["pep_585_604_typing"]}
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict import torch.nn as nn from classy_vision.generic.util import is_pos_int from classy_visio...
{ "source": "bigcode/the-stack-dedup", "repo_name": "dlegor/ClassyVision", "file_path": "classy_vision/heads/fully_connected_head.py", "licenses": [ "MIT" ], "size_bytes": 2465, "details": "{\"annotation_ratio\": 0.67}" }
python
timeless
70
1,972
false
{"min_version": "3.6+", "recommended": true}
# This source code is part of the Biotite package and is distributed # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further # information. __name__ = "biotite" __author__ = "Patrick Kunzmann" __all__ = ["Copyable"] import abc class Copyable(metaclass=abc.ABCMeta): """ Base class for all obje...
{ "source": "bigcode/the-stack-dedup", "repo_name": "danijoo/biotite", "file_path": "src/biotite/copyable.py", "licenses": [ "BSD-3-Clause" ], "size_bytes": 1972, "details": "{\"annotation_ratio\": 0.0}" }
python
legacy
67.5
3,400
true
{"min_version": "3.6", "max_recommended_version": "3.9", "modernization_targets": ["f_strings", "pep_585_604_typing"]}
import logging import time from datetime import timedelta from typing import List from homeassistant.components.binary_sensor import ( BinarySensorEntity, DEVICE_CLASS_MOTION ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ATTR_ATTRIBUTION from homeassistant.core import H...
{ "source": "bigcode/the-stack-dedup", "repo_name": "np-hacs/ha-wyzeapi", "file_path": "custom_components/wyzeapi/binary_sensor.py", "licenses": [ "Apache-2.0" ], "size_bytes": 3400, "details": "{\"annotation_ratio\": 0.36}" }
python
timeless
70
5,118
false
{"min_version": "3.6+", "recommended": true}
""" Export Submissions Transform module """ #pylint: disable=too-few-public-methods import pandas as pd from .transform import TransformBase from ..resources.field_configs import FieldConfigs from ..resources.field_maps import FieldMaps class ExportSubmissionsTransform(TransformBase): """ Transform for Export Subm...
{ "source": "bigcode/the-stack-dedup", "repo_name": "SFDigitalServices/pts-dispatcher-microservice-py", "file_path": "service/transforms/export_submissions.py", "licenses": [ "MIT" ], "size_bytes": 5118, "details": "{\"annotation_ratio\": 0.0}" }
python
timeless
70
2,567
false
{"min_version": "3.6+", "recommended": true}
from nonebot import CommandSession, on_command from langdetect import detect, detect_langs from aiohttp import ClientSession from nonebot import get_bot from nonebot.argparse import ArgumentParser import time import hmac import random, sys import hashlib import binascii import urllib bot = get_bot() # 百度通用翻译API,不包含词典、...
{ "source": "bigcode/the-stack-dedup", "repo_name": "Pzzzzz5142/animal-forest-QQ-group-bot", "file_path": "Pzzzzz/plugins/wm.py", "licenses": [ "MIT" ], "size_bytes": 2567, "details": "{\"annotation_ratio\": 1.0}" }
python
modern
93
6,899
false
{"min_version": "3.8+", "recommended": true}
import asyncio import logging import time from typing import Set, List, Tuple, Optional, TYPE_CHECKING import uuid import ray from ray.experimental.workflow import workflow_context from ray.experimental.workflow import workflow_storage from ray.experimental.workflow.common import (Workflow, WorkflowStatus, ...
{ "source": "bigcode/the-stack-dedup", "repo_name": "wgifford/ray", "file_path": "python/ray/experimental/workflow/execution.py", "licenses": [ "Apache-2.0" ], "size_bytes": 6899, "details": "{\"annotation_ratio\": 1.0}" }
python
timeless
70
10,912
false
{"min_version": "3.6+", "recommended": true}
from sympy.combinatorics import Permutation from sympy.combinatorics.util import _distribute_gens_by_base rmul = Permutation.rmul def _cmp_perm_lists(first, second): """ Compare two lists of permutations as sets. This is used for testing purposes. Since the array form of a permutation is currently a...
{ "source": "bigcode/the-stack-dedup", "repo_name": "ethankward/sympy", "file_path": "sympy/combinatorics/testutil.py", "licenses": [ "BSD-3-Clause" ], "size_bytes": 10912, "details": "{\"annotation_ratio\": 0.0}" }
python
timeless
63
2,131
false
{"min_version": "3.6+", "recommended": true}
from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.operators.python_operator import PythonOperator, BranchPythonOperator from datetime import datetime, timedelta import pandas as pd import random # Default args definition default_args = { 'owner': 'Rafael', 'depends_o...
{ "source": "bigcode/the-stack-dedup", "repo_name": "rafaelols/airflow", "file_path": "dags/treinos_igti/treino03.py", "licenses": [ "Apache-2.0" ], "size_bytes": 2131, "details": "{\"annotation_ratio\": 0.0}" }
python
legacy
78.2
3,325
true
{"min_version": "3.6", "max_recommended_version": "3.9", "modernization_targets": ["pep_585_604_typing"]}
import logging import json from dataclasses import dataclass from redis import Redis from typing import Iterable, Tuple, List, Iterator, Union, Dict from typing_extensions import TypedDict from backend import settings from caching.scripts import RedisScriptsPool from share.metaclasses import Singleton from radar.model...
{ "source": "bigcode/the-stack-dedup", "repo_name": "me-anton/radar-app", "file_path": "backend/radar/engine/body_objects.py", "licenses": [ "MIT" ], "size_bytes": 3325, "details": "{\"annotation_ratio\": 0.55}" }
python
timeless
70
2,188
false
{"min_version": "3.6+", "recommended": true}
"""Utility functions for plotting. Author: Seth Axen E-mail: seth.axen@gmail.com""" from collections import deque import numpy as np def rgb_to_hsv(rgb): """Convert RGB colors to HSV colors.""" r, g, b = tuple(map(float, rgb)) if any([r > 1, g > 1, b > 1]): r /= 255. g /= 255. b ...
{ "source": "bigcode/the-stack-dedup", "repo_name": "sdaxen/python_utilities", "file_path": "python_utilities/plotting/util.py", "licenses": [ "MIT" ], "size_bytes": 2188, "details": "{\"annotation_ratio\": 0.0}" }
python
legacy
70
6,479
true
{"min_version": "3.6", "max_recommended_version": "3.9", "modernization_targets": ["pep_585_604_typing"]}
import struct from typing import Tuple from ledgercomm import Transport from boilerplate_client.boilerplate_cmd_builder import BoilerplateCommandBuilder, InsType from boilerplate_client.button import Button from boilerplate_client.exception import DeviceException from boilerplate_client.transaction import Transaction...
{ "source": "bigcode/the-stack-dedup", "repo_name": "LedgerHQ/ledger-app-neo3", "file_path": "tests/boilerplate_client/boilerplate_cmd.py", "licenses": [ "MIT" ], "size_bytes": 6479, "details": "{\"annotation_ratio\": 1.0}" }
python
timeless
70
12,904
false
{"min_version": "3.6+", "recommended": true}
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
{ "source": "bigcode/the-stack-dedup", "repo_name": "PatrickSJacobs/qiskit-metal", "file_path": "qiskit_metal/qlibrary/qubits/Transmon_Interdigitated.py", "licenses": [ "Apache-2.0" ], "size_bytes": 12904, "details": "{\"annotation_ratio\": 0.0}" }
python
timeless
70
11,757
false
{"min_version": "3.6+", "recommended": true}
import inspect import numpy as np from pandas._libs import reduction as libreduction from pandas.util._decorators import cache_readonly from pandas.core.dtypes.common import ( is_dict_like, is_extension_array_dtype, is_list_like, is_sequence, ) from pandas.core.dtypes.generic import ABCSeries def f...
{ "source": "bigcode/the-stack-dedup", "repo_name": "AakankshaAshok/pandas", "file_path": "pandas/core/apply.py", "licenses": [ "BSD-3-Clause" ], "size_bytes": 11757, "details": "{\"annotation_ratio\": 0.0}" }
python
timeless
70
882
false
{"min_version": "3.6+", "recommended": true}
import os.path from collections import Counter import pytest INPUT_TXT = os.path.join(os.path.dirname(__file__), 'input.txt') def compute(s: str) -> int: lines = s.splitlines() numbers = Counter(int(f) for f in lines[0].split(",")) for d in range(80): numbers2 = Counter({8: numbers[0], 6: numbe...
{ "source": "bigcode/the-stack-dedup", "repo_name": "bugra-yilmaz/adventofcode2021", "file_path": "day06/part1.py", "licenses": [ "MIT" ], "size_bytes": 882, "details": "{\"annotation_ratio\": 1.0}" }
python
modern
78
1,996
false
{"min_version": "3.8+", "recommended": true}
from pathlib import Path root = Path(__file__).parent.absolute() import envo envo.add_source_roots([root]) from pathlib import Path from typing import Any, Dict, List, Optional, Tuple from envo import Env, Namespace, env_var, logger, run from env_comm import StickybeakCommEnv as ParentEnv p = Namespace("p") cl...
{ "source": "bigcode/the-stack-dedup", "repo_name": "reloadware/stickybeak", "file_path": "env_ci.py", "licenses": [ "Apache-2.0" ], "size_bytes": 1996, "details": "{\"annotation_ratio\": 1.0}" }
python
legacy
85
10,408
true
{"min_version": "3.6", "max_recommended_version": "3.9", "modernization_targets": ["pep_585_604_typing"]}
"""Strip/reset AST in-place to match state after semantic analysis pass 1. Fine-grained incremental mode reruns semantic analysis (passes 2 and 3) and type checking for *existing* AST nodes (targets) when changes are propagated using fine-grained dependencies. AST nodes attributes are often changed during semantic an...
{ "source": "bigcode/the-stack-dedup", "repo_name": "mmaryada27/mypy", "file_path": "mypy/server/aststrip.py", "licenses": [ "PSF-2.0" ], "size_bytes": 10408, "details": "{\"annotation_ratio\": 1.0}" }
python
timeless
63
834
false
{"min_version": "3.6+", "recommended": true}
# def mul(a): # return lambda b:b*a # singler = mul(1) # addition = lambda b:b*1 # doubler = mul(2) # addition = lambda b:b*2 # tripler = mul(3) # addition = lambda b:b*3 # print(doubler(7)) # 7*2 = 14 # print(tripler(7)) # 7*3 = 21 # print(singler(7)) # 7*1 = 7 class Student: def __init__(self, fna...
{ "source": "bigcode/the-stack-dedup", "repo_name": "Yash-s-Code-Camp/Python-Day-4", "file_path": "main.py", "licenses": [ "MIT" ], "size_bytes": 834, "details": "{\"annotation_ratio\": 0.0}" }
python
timeless
63
1,758
false
{"min_version": "3.6+", "recommended": true}
import crypto_tools from itertools import cycle def vigenere_little_doc(): return "encrypt/decrypt using vigenere cypher" def vigenere_full_doc(): return """ Advanced caesar we change dict on each char """ def vigenere_str_to_list(string, vigenere_dict): result = list() for char in string:...
{ "source": "bigcode/the-stack-dedup", "repo_name": "dkushche/Crypto", "file_path": "algo/vigenere.py", "licenses": [ "MIT" ], "size_bytes": 1758, "details": "{\"annotation_ratio\": 0.0}" }
python
legacy
70
974
true
{"min_version": "3.6", "max_recommended_version": "3.9", "modernization_targets": ["pep_585_604_typing"]}
from typing import Tuple import click from .cmd import KiwiCommandType, KiwiCommand from .decorators import kiwi_command from ..executable import COMPOSE_EXE from ..instance import Instance from ..project import Project @click.argument( "compose_args", metavar="[ARG]...", nargs=-1, ) @click.argument( ...
{ "source": "bigcode/the-stack-dedup", "repo_name": "yavook/kiwi-scp", "file_path": "kiwi_scp/commands/cmd_cmd.py", "licenses": [ "MIT" ], "size_bytes": 974, "details": "{\"annotation_ratio\": 1.0}" }
python
timeless
63
1,405
false
{"min_version": "3.6+", "recommended": true}
import json import aiohttp async def request(url, payload=None, params=None, headers=None): headers = {'content-type': 'application/json', **(headers or {})} data = payload and json.dumps(payload) async with aiohttp.ClientSession() as client: async with client.post( url, data=data...
{ "source": "bigcode/the-stack-dedup", "repo_name": "dmrz/baymax", "file_path": "baymax/api.py", "licenses": [ "MIT" ], "size_bytes": 1405, "details": "{\"annotation_ratio\": 0.0}" }
python
timeless
70
3,479
false
{"min_version": "3.6+", "recommended": true}
"""Unit tests for nautobot_device_onboarding.netdev_keeper module and its classes. (c) 2020-2021 Network To Code Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICE...
{ "source": "bigcode/the-stack-dedup", "repo_name": "pszulczewski/nautobot-plugin-device-onboarding", "file_path": "nautobot_device_onboarding/tests/test_netdev_keeper.py", "licenses": [ "Apache-2.0" ], "size_bytes": 3479, "details": "{\"annotation_ratio\": 0.0}" }
End of preview. Expand in Data Studio

Bookbearer Modern Code

A curated, token-balanced, version-aware multi-language code corpus built for continued pretraining (CPT) and code-modernization workflows for Bookbearer.

Derived from bigcode/the-stack-dedup, every file is filtered for auto-generated boilerplate and hardcoded secrets, scored on intrinsic quality and runtime compatibility (0–100, cutoff >= 62.0), deduplicated via whitespace-normalized SHA-256 hashing, and classified into version-aware tiers rather than filtered by publication date alone.

Corpus Summary

  • Total Files: 97,767
  • Estimated Tokens: ~91.0M
  • Metadata Coverage: 100% (repo_name and licenses retained on all 97,767 records)
  • Tier Distribution:
    • modern: 66,746 (68.3%) — Idiomatic contemporary practices
    • timeless: 26,998 (27.6%) — Clean, stable, well-supported code
    • legacy: 4,023 (4.1%) — Valid older-system code explicitly tagged with modernization_targets
    • obsolete: Rejected during curation

Language Breakdown

Language Files Est. Tokens Avg Quality Score Score >= 80
Python 14,418 17,501,565 70.6 1,820
JavaScript 28,731 17,500,005 72.7 3,925
TypeScript 26,581 17,500,007 70.6 4,701
Rust 13,989 17,501,180 75.2 4,048
Java 12,081 17,500,500 69.4 107
C++ 1,967 3,468,491 71.1 423
Total 97,767 ~90,971,748 71.6 15,024

Note: Languages were balanced by character budget (70M chars / ~17.5M tokens per language). C++ reached its scan cap early due to strict rejection of C-style memory management (malloc/free) and NULL macros.

Schema

Field Type Description
language string One of python, javascript, typescript, rust, java, cpp
tier string Version-aware classification: modern, timeless, or legacy
quality_score float Composite quality & compatibility score (62.0–100.0)
char_count int Character length of code
requires_version_context bool true for legacy samples requiring explicit version context
version_context string JSON-encoded object containing version/edition bounds and modernization_targets
code string Raw source code
metadata struct Upstream source, repo_name, file_path, licenses, size_bytes, and JSON-encoded details

Usage

import json
from datasets import load_dataset

ds = load_dataset("Sm0r3s/bookbearer-modern-code", split="train", streaming=True)
sample = next(iter(ds))

version_ctx = json.loads(sample["version_context"])
details = json.loads(sample["metadata"]["details"])

print(sample["language"], sample["tier"], sample["quality_score"])
print("Version context:", version_ctx)
print("Repo:", sample["metadata"]["repo_name"], "| Licenses:", sample["metadata"]["licenses"])

Filtering & Curation Highlights

  • Global Pre-Filters: Removes auto-generated files (@generated, DO NOT EDIT, swagger-codegen, protoc-gen, Jupyter nbconvert dumps), minified blobs, and hardcoded secrets/credentials.
  • Python: Iterative ast.walk parsing (Python 3.12+ syntax verified), rejects Python 2 shims (six, izip, legacy __future__ imports, % string formatting), Bazel Starlark .bzl files, and deprecated TensorFlow 1.x APIs.
  • JavaScript / TypeScript: Separates Node.js CommonJS (module_format) from code age, and treats excessive TypeScript any as a type-safety quality penalty rather than a version indicator.
  • Rust / Java / C++: Rejects deprecated idioms (try!, failure crate, Vector/Hashtable, malloc/free, NULL) while rewarding modern idioms (?, async/.await, streams/records, RAII smart pointers, nullptr).

Licensing & Provenance

All code originates from permissively licensed repositories in bigcode/the-stack-dedup. Each row preserves its original repo_name, file_path, and licenses list in metadata for downstream attribution and license filtering.

Downloads last month
-