repo_full_name
stringlengths
6
93
repo_url
stringlengths
25
112
repo_api_url
stringclasses
28 values
owner
stringclasses
28 values
repo_name
stringclasses
28 values
description
stringclasses
28 values
stars
int64
617
98.8k
forks
int64
31
355
watchers
int64
990
999
license
stringclasses
2 values
default_branch
stringclasses
2 values
repo_created_at
timestamp[s]date
2012-07-24 23:12:50
2025-06-16 08:07:28
repo_updated_at
timestamp[s]date
2026-02-23 15:23:15
2026-05-03 18:52:12
repo_topics
listlengths
0
13
repo_languages
unknown
is_fork
bool
1 class
open_issues
int64
3
104
file_path
stringlengths
3
208
file_name
stringclasses
509 values
file_extension
stringclasses
1 value
file_size_bytes
int64
101
84k
file_url
stringclasses
627 values
file_raw_url
stringclasses
627 values
file_sha
stringclasses
624 values
language
stringclasses
8 values
parsed_at
stringdate
2026-05-04 01:12:36
2026-05-04 19:41:55
text
stringlengths
100
102k
CarperAI/trlx
https://github.com/CarperAI/trlx
null
null
null
null
4,745
null
null
mit
null
null
null
null
null
null
null
tests/test_configs.py
null
null
null
null
null
null
Python
2026-05-04T01:54:47.835301
import os from typing import List from trlx.data.configs import TRLConfig def _get_config_dirs(dir: str, config_dir_name: str = "configs") -> List[str]: """Returns all sub-directories of `dir` named `configs`.""" config_dirs = [] for root, dirs, _ in os.walk(dir): for d in dirs: if d ...
CarperAI/trlx
https://github.com/CarperAI/trlx
null
null
null
null
4,745
null
null
mit
null
null
null
null
null
null
null
tests/test_minibatch.py
null
null
null
null
null
null
Python
2026-05-04T01:54:47.916916
import unittest from dataclasses import dataclass, is_dataclass import torch from torch.utils.data import DataLoader, Dataset from transformers import AutoTokenizer from trlx.pipeline import MiniBatchIterator from trlx.pipeline.offline_pipeline import ( ILQLRolloutStorage, ILQLSeq2SeqRolloutStorage, Promp...
CarperAI/trlx
https://github.com/CarperAI/trlx
null
null
null
null
4,745
null
null
mit
null
null
null
null
null
null
null
tests/test_models.py
null
null
null
null
null
null
Python
2026-05-04T01:54:48.061687
import copy import gc import tempfile import unittest from functools import lru_cache import torch import transformers from hypothesis import given, settings from hypothesis import strategies as st from trlx.data.default_configs import default_ilql_config from trlx.models.modeling_ilql import ( AutoModelForCausal...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
setup.py
null
null
null
null
null
null
Python
2026-05-04T01:54:52.850396
import re from itertools import chain from os.path import basename from os.path import dirname from os.path import join from os.path import splitext from distutils.core import setup from distutils.command.build import build from setuptools.command.develop import develop from setuptools.command.easy_install import easy_...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
better_exceptions/__main__.py
null
null
null
null
null
null
Python
2026-05-04T01:54:52.854824
import argparse import os try: import importlib.machinery import importlib.util def load_module(name, filepath): loader = importlib.machinery.SourceFileLoader(name, filepath) spec = importlib.util.spec_from_loader(loader.name, loader) mod = importlib.util.module_from_spec(spec) ...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
better_exceptions/formatter.py
null
null
null
null
null
null
Python
2026-05-04T01:54:52.855940
from __future__ import absolute_import import ast import inspect import keyword import linecache import os import re import sys import traceback from .color import ENCODING, STREAM, SUPPORTS_COLOR, to_byte, to_unicode from .repl import get_repl PIPE_CHAR = u'\u2502' CAP_CHAR = u'\u2514' try: PIPE_CHAR.encode(E...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
better_exceptions/color.py
null
null
null
null
null
null
Python
2026-05-04T01:54:52.876327
"""Checks if the current terminal supports colors. Also specifies the stream to write to. On Windows, this is a wrapped stream. """ from __future__ import absolute_import import codecs import os import sys STREAM = sys.stderr ENCODING = getattr(STREAM, "encoding", None) or "utf-8" SHOULD_ENCODE = True SUPPORTS_COL...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
better_exceptions/log.py
null
null
null
null
null
null
Python
2026-05-04T01:54:52.878150
from __future__ import absolute_import import sys from logging import Logger, StreamHandler def patch(): import logging from . import format_exception logging_format_exception = lambda exc_info: u''.join(format_exception(*exc_info)) if hasattr(logging, '_defaultFormatter'): logging._defaul...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
better_exceptions/repl.py
null
null
null
null
null
null
Python
2026-05-04T01:54:52.879351
from code import InteractiveConsole import sys REPL_ID_PREFIX = '@@@REPL@@@' repl = None class BetterExceptionsConsole(InteractiveConsole, object): def __init__(self): super(BetterExceptionsConsole, self).__init__() self.last_command = None self.entries = dict() self.last_code =...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test.py
null
null
null
null
null
null
Python
2026-05-04T01:54:52.882921
import better_exceptions better_exceptions.hook() foo = 52 def shallow(a, b): deep(a + b) def deep(val): global foo assert val > 10 and foo == 60 bar = foo - 50 shallow(bar, 15) shallow(bar, 2)
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
better_exceptions/integrations/django.py
null
null
null
null
null
null
Python
2026-05-04T01:54:52.886287
from sys import exc_info from better_exceptions import excepthook def skip_errors_filter(record): return not record.exc_info class BetterExceptionsMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): return self.get_response(request) ...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
better_exceptions/__init__.py
null
null
null
null
null
null
Python
2026-05-04T01:54:52.889434
"""Beautiful and helpful exceptions Just set your `BETTER_EXCEPTIONS` environment variable. It handles the rest. Name: better_exceptions Author: Josh Junon Email: josh@junon.me URL: github.com/qix-/better-exceptions License: Copyright (c) 2017 Josh Junon, licensed under the MIT license """ from __future__...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_chaining.py
null
null
null
null
null
null
Python
2026-05-04T01:54:53.430659
# -*- coding:utf-8 -*- import better_exceptions better_exceptions.hook() def div(x, y): x / y def cause(x, y): try: div(x, y) except Exception: raise ValueError("Division error") def context(x, y): try: cause(x, y) except Exception as e: raise ValueError("Cause er...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_color.py
null
null
null
null
null
null
Python
2026-05-04T01:54:53.453733
from __future__ import print_function from better_exceptions import color print(color.SUPPORTS_COLOR)
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_encoding.py
null
null
null
null
null
null
Python
2026-05-04T01:54:53.480896
# -*- coding:utf-8 -*- import better_exceptions better_exceptions.hook() def _deep(val): return 1 / val def div(): return _deep("天") div()
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_indentation_error.py
null
null
null
null
null
null
Python
2026-05-04T01:54:53.509723
# -*- coding:utf-8 -*- import better_exceptions better_exceptions.hook() code = """ if True: a = 5 print("foobar") #intentional faulty indentation here. b = 7 """ exec(code)
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_truncating.py
null
null
null
null
null
null
Python
2026-05-04T01:54:53.518162
# -*- coding:utf-8 -*- import better_exceptions better_exceptions.hook() better_exceptions.MAX_LENGTH = 10 def div(): var = "9" * 150 return 1 / var div()
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_logging.py
null
null
null
null
null
null
Python
2026-05-04T01:54:53.518634
import better_exceptions import logging better_exceptions.hook() logging.basicConfig() logger = logging.getLogger(__name__) logging.raiseExceptions = True qux = 15 def foo(cb): qix = 20 try: cb() except: logger.exception('callback failed') def bar1(): baz = 80.5 logger.info('H...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_syntax_error.py
null
null
null
null
null
null
Python
2026-05-04T01:54:53.521092
# -*- coding:utf-8 -*- import better_exceptions better_exceptions.hook() code = """ if True: a = 5 b = 7 * """ exec(code)
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_truncating_disabled.py
null
null
null
null
null
null
Python
2026-05-04T01:54:53.527498
# -*- coding:utf-8 -*- import better_exceptions better_exceptions.hook() better_exceptions.MAX_LENGTH = None def div(): var = "9" * 150 return 1 / var div()
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_unittest_patch.py
null
null
null
null
null
null
Python
2026-05-04T01:54:53.527986
import io import sys import unittest import better_exceptions STREAM = io.BytesIO() if sys.version_info[0] == 2 else io.StringIO() def add(a, b): return a + b class MyTestCase(unittest.TestCase): def test_add(self): self.assertEqual(add(1, "2"), 3) class SilentTestRunner(unittest.TextTestRunner):...
Qix-/better-exceptions
https://github.com/Qix-/better-exceptions
null
null
null
null
4,727
null
null
mit
null
null
null
null
null
null
null
test/test_util/quiet_console.py
null
null
null
null
null
null
Python
2026-05-04T01:54:59.175514
import code class QuietConsole(code.InteractiveConsole, object): def __init__(self): super(self.__class__, self).__init__() def interact(self): return super(self.__class__, self).interact('') if __name__ == '__main__': QuietConsole().interact()
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
hooks/pre_gen_project.py
null
null
null
null
null
null
Python
2026-05-04T01:55:01.802246
import logging import re import sys logging.basicConfig() _logger = logging.getLogger(__name__) MODULE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]+$" class bcolors: WARNING = "\033[93m" ENDC = "\033[0m" BOLD = "\033[1m" def colorize(escape_code, text): code = getattr(bcolors, escape_code) return "{code}{t...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
hooks/post_gen_project.py
null
null
null
null
null
null
Python
2026-05-04T01:55:01.805045
"""Post gen hook to ensure that the generated project has only one package management, either pipenv or pip.""" import logging import os import shutil import sys _logger = logging.getLogger() def clean_extra_package_management_files(): """Removes either requirements files and folder or the Pipfile.""" use_pi...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
cookiecutter_spec.py
null
null
null
null
null
null
Python
2026-05-04T01:55:01.807659
import argparse from typing import List import columbo from cookiecutter.main import cookiecutter from packaging.utils import canonicalize_name def handle_cli_input(): parser = argparse.ArgumentParser(description="Generate a cookiecutter project") parser.add_argument("template") parser.add_argument("--no...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/tests/conftest.py
null
null
null
null
null
null
Python
2026-05-04T01:55:01.809504
# -*- coding: utf-8 -*- """Defines fixtures available to all tests.""" import logging import pytest from webtest import TestApp from {{cookiecutter.app_name}}.app import create_app from {{cookiecutter.app_name}}.database import db as _db from .factories import UserFactory @pytest.fixture def app(): """Create ...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
tasks.py
null
null
null
null
null
null
Python
2026-05-04T01:55:01.810582
"""Invoke tasks.""" import os import shutil from typing import Iterator # isort: off # Temporary monkeypatch; see https://github.com/pyinvoke/invoke/issues/833 import inspect if not hasattr(inspect, "getargspec"): inspect.getargspec = inspect.getfullargspec from invoke import task # isort: on HERE = os.path.ab...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/autoapp.py
null
null
null
null
null
null
Python
2026-05-04T01:55:01.812023
# -*- coding: utf-8 -*- """Create an application instance.""" from {{cookiecutter.app_name}}.app import create_app app = create_app()
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/tests/settings.py
null
null
null
null
null
null
Python
2026-05-04T01:55:01.813137
"""Settings module for test app.""" ENV = "development" TESTING = True SQLALCHEMY_DATABASE_URI = "sqlite://" SECRET_KEY = "not-so-secret-in-tests" BCRYPT_LOG_ROUNDS = ( 4 # For faster tests; needs at least 4 to avoid "ValueError: Invalid rounds" ) DEBUG_TB_ENABLED = False CACHE_TYPE = "flask_caching.backends.Simp...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/tests/factories.py
null
null
null
null
null
null
Python
2026-05-04T01:55:01.813994
# -*- coding: utf-8 -*- """Factories to help in tests.""" from factory import Sequence from factory.alchemy import SQLAlchemyModelFactory from {{cookiecutter.app_name}}.database import db from {{cookiecutter.app_name}}.user.models import User class BaseFactory(SQLAlchemyModelFactory): """Base factory.""" cl...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/tests/test_database.py
null
null
null
null
null
null
Python
2026-05-04T01:55:02.471843
# -*- coding: utf-8 -*- """Database unit tests.""" import pytest from flask_login import UserMixin from sqlalchemy import text from sqlalchemy.orm.exc import ObjectDeletedError from {{cookiecutter.app_name}}.database import Column, PkModel, db class ExampleUserModel(UserMixin, PkModel): """Example model class fo...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/app.py
null
null
null
null
null
null
Python
2026-05-04T01:55:02.477777
# -*- coding: utf-8 -*- """The app module, containing the app factory function.""" import logging import sys from flask import Flask, render_template from {{cookiecutter.app_name}} import commands, public, user from {{cookiecutter.app_name}}.extensions import ( bcrypt, cache, csrf_protect, db, deb...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/compat.py
null
null
null
null
null
null
Python
2026-05-04T01:55:02.479223
# -*- coding: utf-8 -*- """Python 2/3 compatibility module.""" import sys PY2 = int(sys.version[0]) == 2 if PY2: text_type = unicode # noqa binary_type = str string_types = (str, unicode) # noqa unicode = unicode # noqa basestring = basestring # noqa else: text_type = str binary_type =...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/commands.py
null
null
null
null
null
null
Python
2026-05-04T01:55:02.488724
# -*- coding: utf-8 -*- """Click commands.""" import os from glob import glob from subprocess import call import click HERE = os.path.abspath(os.path.dirname(__file__)) PROJECT_ROOT = os.path.join(HERE, os.pardir) TEST_PATH = os.path.join(PROJECT_ROOT, "tests") @click.command() @click.option( "-c/-C", "--co...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py
null
null
null
null
null
null
Python
2026-05-04T01:55:02.492490
# -*- coding: utf-8 -*- """Database module, including the SQLAlchemy database object and DB-related utilities.""" from typing import Optional, Type, TypeVar from .compat import basestring from .extensions import db T = TypeVar("T", bound="PkModel") # Alias common SQLAlchemy names Column = db.Column relationship = db...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/tests/test_models.py
null
null
null
null
null
null
Python
2026-05-04T01:55:02.493731
# -*- coding: utf-8 -*- """Model unit tests.""" import datetime as dt import pytest from {{cookiecutter.app_name}}.user.models import Role, User from .factories import UserFactory @pytest.mark.usefixtures("db") class TestUser: """User tests.""" def test_get_by_id(self): """Get user by ID.""" ...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/tests/test_functional.py
null
null
null
null
null
null
Python
2026-05-04T01:55:02.499237
# -*- coding: utf-8 -*- """Functional tests using WebTest. See: http://webtest.readthedocs.org/ """ from flask import url_for from {{cookiecutter.app_name}}.user.models import User from .factories import UserFactory class TestLoggingIn: """Login.""" def test_can_log_in_returns_200(self, user, testapp): ...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/extensions.py
null
null
null
null
null
null
Python
2026-05-04T01:55:02.506163
# -*- coding: utf-8 -*- """Extensions module. Each extension is initialized in the app factory located in app.py.""" from flask_bcrypt import Bcrypt from flask_caching import Cache from flask_debugtoolbar import DebugToolbarExtension from flask_login import LoginManager from flask_migrate import Migrate from flask_sqla...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/tests/test_forms.py
null
null
null
null
null
null
Python
2026-05-04T01:55:02.507108
# -*- coding: utf-8 -*- """Test forms.""" from {{cookiecutter.app_name}}.public.forms import LoginForm from {{cookiecutter.app_name}}.user.forms import RegisterForm class TestRegisterForm: """Register form.""" def test_validate_user_already_registered(self, user): """Enter username that is already r...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/public/views.py
null
null
null
null
null
null
Python
2026-05-04T01:55:03.338996
# -*- coding: utf-8 -*- """Public section, including homepage and signup.""" from flask import ( Blueprint, current_app, flash, redirect, render_template, request, url_for, ) from flask_login import login_required, login_user, logout_user from {{cookiecutter.app_name}}.extensions import log...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/utils.py
null
null
null
null
null
null
Python
2026-05-04T01:55:03.339923
# -*- coding: utf-8 -*- """Helper utilities and decorators.""" from flask import flash def flash_errors(form, category="warning"): """Flash all errors for a form.""" for field, errors in form.errors.items(): for error in errors: flash(f"{getattr(form, field).label.text} - {error}", categor...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/settings.py
null
null
null
null
null
null
Python
2026-05-04T01:55:03.340456
# -*- coding: utf-8 -*- """Application configuration. Most configuration is set via environment variables. For local development, use a .env file to set environment variables. """ from environs import Env env = Env() env.read_env() ENV = env.str("FLASK_ENV", default="production") DEBUG = ENV == "development" SQLALC...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/public/forms.py
null
null
null
null
null
null
Python
2026-05-04T01:55:03.371086
# -*- coding: utf-8 -*- """Public forms.""" from flask_wtf import FlaskForm from wtforms import PasswordField, StringField from wtforms.validators import DataRequired from {{cookiecutter.app_name}}.user.models import User class LoginForm(FlaskForm): """Login form.""" username = StringField("Username", valid...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/public/__init__.py
null
null
null
null
null
null
Python
2026-05-04T01:55:03.483484
# -*- coding: utf-8 -*- """The public module, including the homepage and user auth.""" from . import views # noqa
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/user/forms.py
null
null
null
null
null
null
Python
2026-05-04T01:55:03.593789
# -*- coding: utf-8 -*- """User forms.""" from flask_wtf import FlaskForm from wtforms import PasswordField, StringField from wtforms.validators import DataRequired, Email, EqualTo, Length from .models import User class RegisterForm(FlaskForm): """Register form.""" username = StringField( "Username"...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/user/views.py
null
null
null
null
null
null
Python
2026-05-04T01:55:03.596504
# -*- coding: utf-8 -*- """User views.""" from flask import Blueprint, render_template from flask_login import login_required blueprint = Blueprint("user", __name__, url_prefix="/users", static_folder="../static") @blueprint.route("/") @login_required def members(): """List members.""" return render_template...
cookiecutter-flask/cookiecutter-flask
https://github.com/cookiecutter-flask/cookiecutter-flask
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/user/models.py
null
null
null
null
null
null
Python
2026-05-04T01:55:04.053550
# -*- coding: utf-8 -*- """User models.""" import datetime as dt from flask_login import UserMixin from sqlalchemy.ext.hybrid import hybrid_property from {{cookiecutter.app_name}}.database import Column, PkModel, db, reference_col, relationship from {{cookiecutter.app_name}}.extensions import bcrypt class Role(PkMo...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
methods/getbuddhist.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.334711
buddhist_dict = [ { "tag": "软件", "img": "", "name": "闪豆多平台视频批量下载器", "short_describe": "支持下载60多个平台视频的下载器", "describe": "闪豆视频下载器是一款PC" "端网页流媒体获取工具,\n工具实现的原理和登录网站看视频是一样的," "用户能看到什么清晰度的视频,就能缓存对应的视频,\n" "同样的会员视频需要登录对应的账号才...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
methods/video2ascii.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.336127
import os import cv2 from PIL import Image, ImageFont, ImageDraw ascii_char = list( "$B%314567890*WM#oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:oa+>!:+. " ) class VideoToAscii: # VideoToAscii("../end_video.mp4", "d://", print).video_to_ascii() def __init__( self, input_file_name, outpu...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
settings.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.337305
from flet import icons navigation_tabs = [ [icons.HOME_OUTLINED, "首页", "main"], [icons.TERRAIN_OUTLINED, "观山", "mountain"], [icons.WATER_DROP_OUTLINED, "听雨", "rain"], [icons.FAVORITE_BORDER, "修仙", "immortality"], # [icons.LOCAL_FIRE_DEPARTMENT_OUTLINED, "焚香", "cense"], # 这个功能没有用 [icons.LYRICS_...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
methods/getorrent.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.344089
# --coding:utf-8-- from dataclasses import dataclass, field from typing import List from urllib.parse import quote from utils import HTMLSession class Base: name = "" base_url = "" @classmethod def search(cls, keyword, page_count, fuzzy_match=False): raise NotImplementedError @classmeth...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
statics.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.369550
import flet from flet import Image, Container TAICHI = Image(src="imgs/taichi.svg", width=40, height=40, fit="cover") BIG_TAICHI = Image(src="imgs/taichi.svg", width=200, height=200, fit="cover") CLOUD = Image(src="imgs/cloud.svg", fit="cover") GONGZHONGHAO = Container()
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
methods/getmusics.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.370934
import json import re import time from dataclasses import dataclass, field from hashlib import md5 from typing import Optional, Generator, List from urllib.parse import quote from utils import HTMLSession @dataclass class DataSong: photo_url: str # 图片链接 big_photo_url: str # 大图链接 music_name: str # 歌曲名称...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
methods/getimages.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.391272
import random from typing import List, Generator, Optional from utils import HTMLSession class _Base: base_url = "" page_url = "" page_num = None max_page = 0 page_list = Optional[list] # 默认如果是个列表的话,子类会继承父类的列表,所以父类用None表示,子类重新初始化为列表 @classmethod def set_page(cls, page_num: int): ...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
methods/getcovareas.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.428474
import hashlib import os import requests import time import sys import json import csv # 显示某等级地区的小计 def show_level_count(x_list): j = 0 for i in range(len(x_list)): j += len(x_list[i]["communitys"]) print(j) return j def writer_to_csv(risk_txt): risk_json = json.loads(risk_txt) so_f...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
methods/getbooks.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.447023
import re from dataclasses import dataclass, field from typing import List, Generator, Literal from utils import HTMLSession @dataclass class DataChapter: name: str # 章节名称 url: str # 章节链接 class DataNovelInfo: def __init__( self, img_url="", name="", author="", ...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
ui.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.931229
from importlib import import_module import flet try: from views import cense, immortality, lyra, main, mountain, rain, treasure, buddhist from views.treasure_dialogs import pdf2word except: pass from flet import Tabs, Tab, Page, Stack, ProgressBar from settings import navigation_tabs class NavigationBa...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
test.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.967042
import flet as ft def main(page: ft.Page): page.add(ft.ListView( [ft.DataTable( columns=[ ft.DataColumn(ft.Text("First name")), ft.DataColumn(ft.Text("Last name")), ft.DataColumn(ft.Text("Age"), numeric=True), ], rows=[ ...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/buddhist.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.976058
import flet as ft from methods.getbuddhist import buddhist_dict from utils import snack_bar class Card(ft.Card): def __init__(self, **kwargs): self.tag = kwargs.get("tag", "") self.img = kwargs.get("img", "") self.name = kwargs.get("name", "") self.short_describe = kwargs.get("sho...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/immortality.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.977662
# --coding:utf-8-- from typing import List, Optional import flet as ft from flet import ( Container, Column, Row, TextField, Stack, FloatingActionButton, ElevatedButton, TextButton, ListView, Dropdown, dropdown, Text, Card, alignment, ) from methods.getbooks imp...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/cense.py
null
null
null
null
null
null
Python
2026-05-04T01:55:06.985106
import json import flet as ft from methods.video2ascii import VideoToAscii from utils import snack_bar, DESKTOP class ViewPage(ft.Row): def __init__(self, page): self.input_file = ft.TextField( disabled=True, width=300, height=40, content_padding=1 ) self.choose_input_file_bt...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/lyra.py
null
null
null
null
null
null
Python
2026-05-04T01:55:07.043543
import flet as ft from flet import padding from methods.getorrent import DataBTDetail, BTSow, TorrentKitty, DataBT from utils import snack_bar class SearchComponent(ft.Row): def __init__(self, search_callback): self.search_callback = search_callback self.title = ft.Text("聚合磁力搜索", size=30, text_al...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/mountain.py
null
null
null
null
null
null
Python
2026-05-04T01:55:07.044581
from flet import ( Container, Stack, FloatingActionButton, Row, alignment, Column, Image, Page, margin, icons, Dropdown, dropdown, ) from methods.getimages import CiYuanDao, ToMeinv, APIS from utils import snack_bar, download_named_image class ViewPage(Stack): def ...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/main.py
null
null
null
null
null
null
Python
2026-05-04T01:55:07.397596
from functools import partial from math import pi from random import randint from flet import Container, alignment, animation, transform, Stack, Text from flet import Switch, Page from statics import BIG_TAICHI, CLOUD, GONGZHONGHAO from utils import one_shot_thread LIGHT = ("light", "光明") DARK = ("dark", "黑暗") cla...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
utils.py
null
null
null
null
null
null
Python
2026-05-04T01:55:07.689542
# coding:utf-8 import base64 import os import re import time from pathlib import Path from threading import Thread from typing import Optional from flet import SnackBar, Text, Image as _Image from requests_html import HTMLSession as _HTMLSession, HTMLResponse """""" CURR_PATH = Path(__file__).absolute().parent DESKTO...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/treasure_dialogs/base.py
null
null
null
null
null
null
Python
2026-05-04T01:55:08.060385
import flet as ft class BaseDialog(ft.AlertDialog): def open_dlg(self, e): self.open = True self.update() def close_dlg(self, e): self.open = False self.update()
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/rain.py
null
null
null
null
null
null
Python
2026-05-04T01:55:12.498409
from typing import Optional from flet import ( Container, Row, Text, Image, ListView, colors, Stack, border, TextField, FloatingActionButton, Column, Card, IconButton, icons, Audio, audio, Slider, PopupMenuButton, PopupMenuItem, ) from method...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/treasure_dialogs/checkcovareas.py
null
null
null
null
null
null
Python
2026-05-04T01:55:12.537759
import json import os.path import flet as ft import pdf2docx from utils import snack_bar, DESKTOP from views.treasure_dialogs.base import BaseDialog from methods.getcovareas import get_risk_area_data class Dialog(BaseDialog): def __init__(self): self.province_dd = ft.Dropdown( options=[], ...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/treasure.py
null
null
null
null
null
null
Python
2026-05-04T01:55:12.545068
import flet as ft from views.treasure_dialogs.pdf2word import Dialog as pdf2wordDialog from views.treasure_dialogs.checkcovareas import Dialog as covAreaDialog class ViewPage(ft.Stack): def __init__(self, page): self.grid = ft.GridView( expand=1, runs_count=5, max_exte...
moshstudio/TAICHI-flet
https://github.com/moshstudio/TAICHI-flet
null
null
null
null
4,726
null
null
mit
null
null
null
null
null
null
null
views/treasure_dialogs/pdf2word.py
null
null
null
null
null
null
Python
2026-05-04T01:55:12.627318
import json import os.path import flet as ft import pdf2docx from utils import snack_bar, DESKTOP from views.treasure_dialogs.base import BaseDialog class Dialog(BaseDialog): def __init__(self): self.close_btn = ft.IconButton( icon=ft.icons.CLOSE_OUTLINED, on_click=self.close_dlg ) ...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
examples/pydantic_schema.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.328709
"""Repair malformed JSON with Pydantic v2 schema guidance.""" from __future__ import annotations import sys from pydantic import BaseModel, Field from json_repair import repair_json BAD_OUTPUT = """ { "customer_id": "42", "sentiment": "positive", "summary": "Customer confirmed the fix worked", "tags": , } ...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
examples/repair_llm_output.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.332414
"""Repair JSON wrapped in extra prose from an LLM response.""" from __future__ import annotations import json import sys from json_repair import loads LLM_OUTPUT = """ I analyzed the ticket and extracted the fields you asked for. ```json { customer_id: 42, "sentiment": "positive", "summary": "Customer confir...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
docs/app.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.336766
from flask import Flask, jsonify, request from flask_cors import CORS from werkzeug.exceptions import BadRequest from json_repair import loads app = Flask(__name__) CORS(app) # This will enable CORS for all routes @app.route("/api/repair-json", methods=["POST"]) def format_json(): try: data = request.g...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
examples/fastapi_app.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.338205
"""Repair and validate LLM output inside a FastAPI endpoint.""" from __future__ import annotations from fastapi import FastAPI, HTTPException from pydantic import BaseModel, Field from json_repair import loads app = FastAPI() class IncomingLLMResponse(BaseModel): raw_output: str class SupportTicket(BaseMode...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
examples/stream_stable.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.343013
"""Keep a stable snapshot while a JSON response is still streaming.""" from __future__ import annotations import json import sys from json_repair import repair_json CHUNKS = [ '{"items":[{"id":1,"name":"Ada"},', '{"id":2,"name":"Grace"},', '{"id":3,"name":"Linus"', '],"complete":tr', "ue}", ] ...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/__init__.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.347465
from .json_repair import from_file, load, loads, repair_json from .utils.constants import JSONReturnType __all__ = ["JSONReturnType", "from_file", "load", "loads", "repair_json"]
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
examples/chinese_llm_output.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.351669
"""Repair Chinese-language LLM output and preserve the original characters.""" from __future__ import annotations import json import sys from json_repair import loads LLM_OUTPUT = """ 以下是整理后的结构化结果: ```json { 标题: "退款申请处理结果", "摘要": "客户确认已经收到退款", "标签": ["账单", "已解决",], "是否升级": false, } ``` 如果你需要, 我也可以补充英文摘要。 ...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/json_parser.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.960155
from collections.abc import Callable from contextlib import ExitStack from typing import TYPE_CHECKING, Any, TextIO from .parse_array import parse_array as _parse_array from .parse_comment import parse_comment as _parse_comment from .parse_number import parse_number as _parse_number from .parse_object import parse_obj...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parse_comment.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.962360
from typing import TYPE_CHECKING from .utils.constants import JSONReturnType from .utils.json_context import ContextValues if TYPE_CHECKING: from .json_parser import JSONParser def parse_comment(self: "JSONParser") -> JSONReturnType: """ Parse code-like comments: - "# comment": A line comment that ...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/json_repair.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.975022
""" This module will parse the JSON file following the BNF definition: <json> ::= <container> <primitive> ::= <number> | <string> | <boolean> ; Where: ; <number> is a valid real number expressed in one of a number of given formats ; <string> is a string of valid characters enclosed in quotes ;...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parse_array.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.975541
from typing import TYPE_CHECKING, Any, cast from .parser_schema import ArraySchemaConfig, resolve_parser_array_schema from .utils.constants import STRING_DELIMITERS, JSONReturnType from .utils.json_context import ContextValues from .utils.object_comparer import ObjectComparer if TYPE_CHECKING: from .json_parser i...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parse_string.py
null
null
null
null
null
null
Python
2026-05-04T01:55:17.980428
from dataclasses import dataclass, field from typing import TYPE_CHECKING, cast from .parse_string_helpers.object_value_context import classify_object_value_comma, update_inline_container_stack from .parse_string_helpers.parse_boolean_or_null import parse_boolean_or_null from .parse_string_helpers.parse_json_llm_block...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parse_object.py
null
null
null
null
null
null
Python
2026-05-04T01:55:18.007815
from typing import TYPE_CHECKING, Any, cast from .parser_schema import ObjectSchemaConfig, resolve_parser_object_schema from .utils.constants import MISSING_VALUE, STRING_DELIMITERS, JSONReturnType from .utils.json_context import ContextValues from .utils.pattern_properties import match_pattern_properties if TYPE_CHE...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parse_number.py
null
null
null
null
null
null
Python
2026-05-04T01:55:18.021697
from typing import TYPE_CHECKING from .utils.constants import JSONReturnType from .utils.json_context import ContextValues NUMBER_CHARS: set[str] = set("0123456789-.eE/,_") if TYPE_CHECKING: from .json_parser import JSONParser def parse_number(self: "JSONParser") -> JSONReturnType: # <number> is a valid r...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parse_string_helpers/parse_boolean_or_null.py
null
null
null
null
null
null
Python
2026-05-04T01:55:18.052212
from typing import TYPE_CHECKING if TYPE_CHECKING: from ..json_parser import JSONParser # noqa: TID252 def parse_boolean_or_null(parser: "JSONParser") -> bool | str | None: # <boolean> is one of the literal strings 'true', 'false', or 'null' (unquoted) char = (parser.get_char_at() or "").lower() val...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parse_string_helpers/object_value_context.py
null
null
null
null
null
null
Python
2026-05-04T01:55:18.061319
from typing import TYPE_CHECKING, Literal from ..utils.constants import STRING_DELIMITERS # noqa: TID252 if TYPE_CHECKING: from ..json_parser import JSONParser # noqa: TID252 ObjectValueCommaClassification = Literal["container", "member", "string"] def classify_object_value_comma(parser: "JSONParser") -> Ob...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/utils/object_comparer.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.337840
from typing import Any class ObjectComparer: # pragma: no cover def __init__(self) -> None: pass # No operation performed in the constructor @staticmethod def is_same_object(obj1: Any, obj2: Any) -> bool: """ Recursively compares two objects and ensures that: - Their typ...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/utils/constants.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.339094
from typing import Any class MissingValueType: def __repr__(self) -> str: return "<MISSING_VALUE>" def __deepcopy__(self, memo: dict[int, Any]) -> "MissingValueType": return self MISSING_VALUE = MissingValueType() JSONReturnType = dict[str, Any] | list[Any] | str | float | int | bool | Non...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parser_schema.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.340531
from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from .schema_repair import SchemaRepairer @dataclass(frozen=True) class ObjectSchemaConfig: properties: dict[str, Any] pattern_properties: dict[str, Any] additional_properties...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/utils/json_context.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.341396
from enum import Enum, auto from types import TracebackType from typing import Literal class ContextValues(Enum): OBJECT_KEY = auto() OBJECT_VALUE = auto() ARRAY = auto() class _JsonContextEntry: __slots__ = ("context", "value") def __init__(self, context: "JsonContext", value: ContextValues) -...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parser_parenthesized.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.342371
from typing import TYPE_CHECKING from .utils.constants import STRING_DELIMITERS if TYPE_CHECKING: from .json_parser import JSONParser def parenthesized_is_explicit_tuple(parser: "JSONParser") -> bool: """ Return True when the current '(' starts an explicit Python tuple literal. Empty parentheses co...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/schema_repair.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.344831
from __future__ import annotations import copy import importlib from typing import Any, Literal, cast from .parser_schema import array_schema_config, object_schema_config from .utils.constants import MISSING_VALUE, JSONReturnType, MissingValueType from .utils.pattern_properties import match_pattern_properties Schema...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/parse_string_helpers/parse_json_llm_block.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.513833
from typing import TYPE_CHECKING from ..utils.constants import JSONReturnType # noqa: TID252 if TYPE_CHECKING: from ..json_parser import JSONParser # noqa: TID252 def parse_json_llm_block(parser: "JSONParser") -> JSONReturnType: """ Extracts and normalizes JSON enclosed in ```json ... ``` blocks. ...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/utils/string_file_wrapper.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.515263
import os from typing import TextIO class StringFileWrapper: # This is a trick to simplify the code, transform the filedescriptor handling into a string handling def __init__(self, fd: TextIO, chunk_length: int) -> None: """ Initialize the StringFileWrapper with a file descriptor and chunk len...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
src/json_repair/utils/pattern_properties.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.770075
from collections.abc import Mapping from typing import Any _UNSUPPORTED_REGEX_TOKENS = frozenset({".", "^", "$", "*", "+", "?", "{", "}", "[", "]", "|", "(", ")", "\\"}) def match_pattern_properties( pattern_properties: Mapping[str, Any], key: str, ) -> tuple[list[Any], list[str]]: """Match JSON Schema p...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
tests/profiler.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.940673
import sys from pathlib import Path sys.path.append(str(Path(__file__).resolve().parent.parent)) import pstats import time from cProfile import Profile from pstats import SortKey, Stats from src.json_repair.json_repair import repair_json # Hack: Monkey patch pstats to change the formatting method and increase preci...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
tests/test_json_repair.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.955344
import importlib import sys import pytest from src.json_repair.json_parser import JSONParser from src.json_repair.json_repair import loads, repair_json json_repair_module = importlib.import_module("src.json_repair.json_repair") def test_valid_json(): assert ( repair_json('{"name": "John", "age": 30, "c...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
tests/test_parse_comment.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.967246
from src.json_repair.json_repair import repair_json def test_parse_comment(): assert repair_json("/") == "" assert repair_json('/* comment */ {"key": "value"}') assert ( repair_json('{ "key": { "key2": "value2" // comment }, "key3": "value3" }') == '{"key": {"key2": "value2"}, "key3": "val...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
tests/test_parse_number.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.971873
from src.json_repair.json_repair import repair_json def test_parse_number(): assert repair_json("1", return_objects=True) == 1 assert repair_json("1.2", return_objects=True) == 1.2 assert repair_json('{"value": 82_461_110}', return_objects=True) == {"value": 82461110} assert repair_json('{"value": 1_2...
mangiucugna/json_repair
https://github.com/mangiucugna/json_repair
null
null
null
null
4,698
null
null
mit
null
null
null
null
null
null
null
tests/test_parse_array.py
null
null
null
null
null
null
Python
2026-05-04T01:55:19.983292
from src.json_repair.json_parser import JSONParser from src.json_repair.json_repair import repair_json def test_parse_array(): assert repair_json("[]", return_objects=True) == [] assert repair_json("[1, 2, 3, 4]", return_objects=True) == [1, 2, 3, 4] assert repair_json("[", return_objects=True) == [] ...