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
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/logging_wrapper.py
null
null
null
null
null
null
Python
2026-05-04T02:25:19.232674
from contextlib import contextmanager import time import pytz from datetime import datetime # Define California timezone CALIFORNIA_TZ = pytz.timezone("America/Los_Angeles") class EventLog: def __init__(self, event_name): self.event_name = event_name self.start_time = None self.end_time =...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/encoder.py
null
null
null
null
null
null
Python
2026-05-04T02:25:19.313276
import os import numpy as np from concurrent.futures import ThreadPoolExecutor, as_completed from typing import List, Tuple, Union, Optional, Dict, Literal from pathlib import Path try: import warnings with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=UserWarning) ...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/collaborative_storm/modules/warmstart_hierarchical_chat.py
null
null
null
null
null
null
Python
2026-05-04T02:25:19.428680
""" Warm starts the Co-STORM system by conducting a background information search to establish a shared conceptual space with the user. This stage functions as a mini-STORM, where multiple LLM agents are spawned with different perspectives to engage in multi-round conversations. The knowledge base (represented a...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/interface.py
null
null
null
null
null
null
Python
2026-05-04T02:25:19.429268
import concurrent.futures import dspy import functools import hashlib import json import logging import time from abc import ABC, abstractmethod from collections import OrderedDict from typing import Dict, List, Optional, Union, TYPE_CHECKING from .utils import ArticleTextProcessing logging.basicConfig( level=log...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/modules/callback.py
null
null
null
null
null
null
Python
2026-05-04T02:25:20.404930
class BaseCallbackHandler: """Base callback handler that can be used to handle callbacks from the STORM pipeline.""" def on_identify_perspective_start(self, **kwargs): """Run when the perspective identification starts.""" pass def on_identify_perspective_end(self, perspectives: list[str], ...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/modules/knowledge_curation.py
null
null
null
null
null
null
Python
2026-05-04T02:25:20.405603
import concurrent.futures import logging import os from concurrent.futures import as_completed from typing import Union, List, Tuple, Optional, Dict import dspy from .callback import BaseCallbackHandler from .persona_generator import StormPersonaGenerator from .storm_dataclass import DialogueTurn, StormInformationTab...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/lm.py
null
null
null
null
null
null
Python
2026-05-04T02:25:20.517280
import backoff import dspy import functools import logging import os import random import requests import threading from typing import Optional, Literal, Any import ujson from pathlib import Path from dsp import ERRORS, backoff_hdlr, giveup_hdlr from dsp.modules.hf import openai_to_hf from dsp.modules.hf_client impor...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/modules/outline_generation.py
null
null
null
null
null
null
Python
2026-05-04T02:25:20.557648
from typing import Union, Optional, Tuple import dspy from .callback import BaseCallbackHandler from .storm_dataclass import StormInformationTable, StormArticle from ...interface import OutlineGenerationModule from ...utils import ArticleTextProcessing class StormOutlineGenerationModule(OutlineGenerationModule): ...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/engine.py
null
null
null
null
null
null
Python
2026-05-04T02:25:20.838053
import json import logging import os from dataclasses import dataclass, field from typing import Union, Literal, Optional import dspy from .modules.article_generation import StormArticleGenerationModule from .modules.article_polish import StormArticlePolishingModule from .modules.callback import BaseCallbackHandler f...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/modules/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:25:20.866291
from .knowledge_curation import * from .persona_generator import * from .retriever import * from .storm_dataclass import *
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/modules/article_generation.py
null
null
null
null
null
null
Python
2026-05-04T02:25:20.935236
import concurrent.futures import copy import logging from concurrent.futures import as_completed from typing import List, Union import dspy from .callback import BaseCallbackHandler from .storm_dataclass import StormInformationTable, StormArticle from ...interface import ArticleGenerationModule, Information from ...u...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/modules/persona_generator.py
null
null
null
null
null
null
Python
2026-05-04T02:25:20.997083
import logging import re from typing import Union, List import dspy import requests from bs4 import BeautifulSoup def get_wiki_page_title_and_toc(url): """Get the main title and table of contents from an url of a Wikipedia page.""" response = requests.get(url) soup = BeautifulSoup(response.content, "htm...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/modules/retriever.py
null
null
null
null
null
null
Python
2026-05-04T02:25:21.031681
from typing import Union, List from urllib.parse import urlparse import dspy from ...interface import Retriever, Information from ...utils import ArticleTextProcessing # Internet source restrictions according to Wikipedia standard: # https://en.wikipedia.org/wiki/Wikipedia:Reliable_sources/Perennial_sources GENERALL...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/modules/storm_dataclass.py
null
null
null
null
null
null
Python
2026-05-04T02:25:21.051732
import copy import re from collections import OrderedDict from typing import Union, Optional, Any, List, Tuple, Dict import numpy as np from sentence_transformers import SentenceTransformer from sklearn.metrics.pairwise import cosine_similarity from ...interface import Information, InformationTable, Article, ArticleS...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/rm.py
null
null
null
null
null
null
Python
2026-05-04T02:25:23.223774
import logging import os from typing import Callable, Union, List import backoff import dspy import requests from dsp import backoff_hdlr, giveup_hdlr from .utils import WebPageHelper class YouRM(dspy.Retrieve): def __init__(self, ydc_api_key=None, k=3, is_valid_source: Callable = None): super().__init_...
stanford-oval/storm
https://github.com/stanford-oval/storm
null
null
null
null
28,156
null
null
mit
null
null
null
null
null
null
null
knowledge_storm/storm_wiki/modules/article_polish.py
null
null
null
null
null
null
Python
2026-05-04T02:25:24.965078
import copy from typing import Union import dspy from .storm_dataclass import StormArticle from ...interface import ArticlePolishingModule from ...utils import ArticleTextProcessing class StormArticlePolishingModule(ArticlePolishingModule): """ The interface for article generation stage. Given topic, collec...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
benchmarks/dispatch.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.364758
""" This file contains a benchmark to validate the performance of Locust itself. More precisely, the performance of the `UsersDispatcher` class which is responsible for calculating the distribution of users on each worker. This benchmark is to be used by people working on Locust's development. """ from locust import U...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/browse_docs_sequence_test.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.376473
# This locust test script example will simulate a user # browsing the Locust documentation on https://docs.locust.io/ from locust import HttpUser, SequentialTaskSet, between, task import random from pyquery import PyQuery class BrowseDocumentationSequence(SequentialTaskSet): def on_start(self): self.ur...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/basic.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.388108
from locust import HttpUser, TaskSet, between, task def index(l): l.client.get("/") def stats(l): l.client.get("/stats/requests") class UserTasks(TaskSet): # one can specify tasks like this tasks = [index, stats] # but it might be convenient to use the @task decorator @task def page40...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/add_command_line_argument.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.391135
from locust import HttpUser, events, task @events.init_command_line_parser.add_listener def _(parser): parser.add_argument("--my-argument", type=str, env_var="LOCUST_MY_ARGUMENT", default="", help="It's working") # Choices will validate command line input and show a dropdown in the web UI parser.add_argum...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/bottlenecked_server.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.400649
""" This example uses extensions in Locust's own WebUI to simulate a bottlenecked server and runs a test against itself. The purpose of this is mainly to generate nice graphs in the UI to teach new users how to interpret load test results. See https://docs.locust.io/en/stable/quickstart.html#locust-s-web-interface ""...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/browse_docs_test.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.412634
# This locust test script example will simulate a user # browsing the Locust documentation on https://docs.locust.io/ from locust import HttpUser, TaskSet, between, task import random from pyquery import PyQuery class BrowseDocumentation(TaskSet): def on_start(self): # assume all users arrive at the in...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/custom_shape/double_wave.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.413891
from locust import HttpUser, LoadTestShape, TaskSet, constant, task import math class UserTasks(TaskSet): @task def get_root(self): self.client.get("/") class WebsiteUser(HttpUser): wait_time = constant(0.5) tasks = [UserTasks] class DoubleWave(LoadTestShape): """ A shape to imita...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/csrf_form_authentication.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.415425
from locust import HttpUser, between, task import re class WebsiteUser(HttpUser): host = "http://127.0.0.1:8089" wait_time = between(2, 5) @task def authenticate(self): with self.client.get("/sign-in", catch_response=True) as response: match = re.search( r'<form.*...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
docs/conf.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.418327
# # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable (module imports are okay, they're removed automatically). # # All configuration values have a default value; values that are comment...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/custom_messages.py
null
null
null
null
null
null
Python
2026-05-04T02:25:27.429471
from locust import HttpUser, between, events, task from locust.runners import LocalRunner, MasterRunner, WorkerRunner import gevent usernames = [] def setup_test_users(environment, msg, **kwargs): # Fired when the worker receives a message of type 'test_users' usernames.extend(map(lambda u: u["name"], msg.d...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/custom_xmlrpc_client/server.py
null
null
null
null
null
null
Python
2026-05-04T02:25:28.563042
import random import time from xmlrpc.server import SimpleXMLRPCServer def get_time(): time.sleep(random.random()) return time.time() def get_random_number(low, high): time.sleep(random.random()) return random.randint(low, high) server = SimpleXMLRPCServer(("localhost", 8877)) print("Listening on ...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/custom_shape/wait_user_count.py
null
null
null
null
null
null
Python
2026-05-04T02:25:28.564557
from locust import HttpUser, LoadTestShape, TaskSet, constant, task import random import time from collections import namedtuple class UserTasks(TaskSet): @task def get_root(self): self.client.get("/") class WebsiteUser(HttpUser): wait_time = constant(0.5) tasks = [UserTasks] def __ini...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/custom_xmlrpc_client/xmlrpc_locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:28.566319
from locust import User, task import time from xmlrpc.client import Fault, ServerProxy class XmlRpcClient(ServerProxy): """ XmlRpcClient is a wrapper around the standard library's ServerProxy. It proxies any function calls and fires the *request* event when they finish, so that the calls get recorded...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/debugging.py
null
null
null
null
null
null
Python
2026-05-04T02:25:28.567554
from locust import HttpUser, run_single_user, task class QuickstartUser(HttpUser): host = "http://localhost" @task def hello_world(self): with self.client.get("/hello", catch_response=True) as resp: pass # maybe set a breakpoint here to analyze the resp object? # if launched direct...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/custom_wait_function.py
null
null
null
null
null
null
Python
2026-05-04T02:25:28.568800
from locust import HttpUser, TaskSet, task import random def index(l): l.client.get("/") def stats(l): l.client.get("/stats/requests") class UserTasks(TaskSet): # one can specify tasks like this tasks = [index, stats] # but it might be convenient to use the @task decorator @task def ...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/debugging_advanced.py
null
null
null
null
null
null
Python
2026-05-04T02:25:28.569779
from locust import HttpUser, run_single_user, task from locust.exception import StopUser class User1(HttpUser): host = "http://localhost" @task def hello_world(self): with self.client.get("/hello1", catch_response=True) as resp: pass raise StopUser() class User2(HttpUser): ...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/custom_shape/stages.py
null
null
null
null
null
null
Python
2026-05-04T02:25:28.741411
from locust import HttpUser, LoadTestShape, TaskSet, constant, task class UserTasks(TaskSet): @task def get_root(self): self.client.get("/") class WebsiteUser(HttpUser): wait_time = constant(0.5) tasks = [UserTasks] class StagesShape(LoadTestShape): """ A simply load test shape cla...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/custom_shape/step_load.py
null
null
null
null
null
null
Python
2026-05-04T02:25:29.180107
from locust import HttpUser, LoadTestShape, TaskSet, constant, task import math class UserTasks(TaskSet): @task def get_root(self): self.client.get("/") class WebsiteUser(HttpUser): wait_time = constant(0.5) tasks = [UserTasks] class StepLoadShape(LoadTestShape): """ A step load s...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/dispatch_test_scripts/locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:29.267807
from locust import HttpUser, LoadTestShape, constant, task class UserA(HttpUser): wait_time = constant(600) # host = "https://example.com" @task def get_root(self): self.client.get("/", name="UserA") class UserB(HttpUser): wait_time = constant(600) # host = "https://example.com" ...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/custom_shape/staging_user_classes.py
null
null
null
null
null
null
Python
2026-05-04T02:25:29.336961
from locust import HttpUser, LoadTestShape, TaskSet, constant, task class UserTasks(TaskSet): @task def get_root(self): self.client.get("/") class WebsiteUserA(HttpUser): wait_time = constant(0.5) tasks = [UserTasks] class WebsiteUserB(HttpUser): wait_time = constant(0.5) tasks = [...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/extend_web_ui.py
null
null
null
null
null
null
Python
2026-05-04T02:25:29.391444
""" This is an example of a locustfile that uses Locust's built in event and web UI extension hooks to track the sum of the content-length header in all successful HTTP responses and display them in the web UI. """ from locust import HttpUser, TaskSet, between, events, task import json import os from time import time...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/grpc/grpc_user.py
null
null
null
null
null
null
Python
2026-05-04T02:25:29.425386
from locust import User from locust.exception import LocustError import time from collections.abc import Callable from typing import Any import grpc import grpc.experimental.gevent as grpc_gevent from grpc_interceptor import ClientInterceptor # patch grpc so that it uses gevent instead of asyncio grpc_gevent.init_ge...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/fast_http_locust.py
null
null
null
null
null
null
Python
2026-05-04T02:25:29.426740
from locust import FastHttpUser, task class WebsiteUser(FastHttpUser): """ User class that does requests to the locust web server running on localhost, using the fast HTTP client """ host = "http://127.0.0.1:8089" # some things you can configure on FastHttpUser # connection_timeout = 60.0...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/grpc/hello_server.py
null
null
null
null
null
null
Python
2026-05-04T02:25:29.852121
import logging import time from concurrent import futures import grpc import hello_pb2 import hello_pb2_grpc logger = logging.getLogger(__name__) class HelloServiceServicer(hello_pb2_grpc.HelloServiceServicer): def SayHello(self, request, context): name = request.name time.sleep(1) retur...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/grpc/locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:29.968139
from locust import events, task import gevent import grpc_user import hello_pb2 import hello_pb2_grpc from hello_server import start_server # Start the dummy server. This is not something you would do in a real test. @events.init.add_listener def run_grpc_server(environment, **_kwargs): gevent.spawn(start_server...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:29.981726
from locust import HttpUser, between, task import time class QuickstartUser(HttpUser): wait_time = between(1, 2) @task def hello_world(self): self.client.get("/hello") self.client.get("/world") @task(3) def view_item(self): for item_id in range(10): self.clie...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/markov_taskset.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.017545
from locust import MarkovTaskSet, User, constant, transition, transitions """ This example demonstrates the different ways to specify transitions in a MarkovTaskSet. The MarkovTaskSet class supports several ways to define transitions between tasks: 1. Using @transition decorator for a single transition 2. Stacking mu...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/milvus/locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.065547
""" Minimal example demonstrating Milvus load testing with Locust. """ from locust import between, task from locust.contrib.milvus import MilvusUser import random from pymilvus import CollectionSchema, DataType, FieldSchema from pymilvus.milvus_client import IndexParams class SimpleMilvusUser(MilvusUser): """M...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/manual_stats_reporting.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.080452
""" Example of a manual_report() function that can be used either as a context manager (with statement), or a decorator, to manually add entries to Locust's statistics. Usage as a context manager: with manual_report("stats entry name"): # Run time of this block will be reported under a stats entry called ...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/dynamic_user_credentials.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.198056
# locustfile.py from locust import HttpUser, TaskSet, between, task USER_CREDENTIALS = [ ("user1", "password"), ("user2", "password"), ("user3", "password"), ] class UserBehaviour(TaskSet): def on_start(self): if len(USER_CREDENTIALS) > 0: user, passw = USER_CREDENTIALS.pop() ...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/dns_ex.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.298669
from locust import run_single_user, task from locust.contrib.dns import DNSUser import time import dns.message import dns.rdatatype class MyDNSUser(DNSUser): @task def t(self): message = dns.message.make_query("example.com", dns.rdatatype.A) # self.client wraps all dns.query methods https://...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/events.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.308053
""" This is an example of a locustfile that uses Locust's built in event hooks to track the sum of the content-length header in all successful HTTP responses """ from locust import HttpUser, TaskSet, between, events, task class MyTaskSet(TaskSet): @task(2) def index(l): l.client.get("/") @task(1...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/mongodb/locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.391014
from locust import task from locust.contrib.mongodb import MongoDBUser import os class MongoUser(MongoDBUser): conn_string = os.getenv("MONGODB_URI", "mongodb://localhost:27017/defaultdb") db_name = "test" # change to your db name @task def db_query(self): self.client.execute_query("collect...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/mqtt/locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.427995
from locust import task from locust.contrib.mqtt import MqttUser from locust.user.wait_time import between import time class MyUser(MqttUser): host = "localhost" port = 1883 # We could uncomment below to use the WebSockets transport # transport = "websockets" # ws_path = "/mqtt/custom/path" ...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/mqtt/locustfile_custom_mqtt_client.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.540335
from locust import task from locust.contrib.mqtt import MqttClient, MqttUser from locust.user.wait_time import between import time # extend the MqttClient class with your own custom implementation class MyMqttClient(MqttClient): # you can override the event name with your custom implementation def _generate_...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/nested_inline_tasksets.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.575978
from locust import HttpUser, TaskSet, between, task class WebsiteUser(HttpUser): """ Example of the ability of inline nested TaskSet classes """ host = "http://127.0.0.1:8089" wait_time = between(2, 5) @task class TopLevelTaskSet(TaskSet): @task class IndexTaskSet(TaskSet...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/multiple_hosts.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.599319
from locust import HttpUser, TaskSet, between, task from locust.clients import HttpSession import os class MultipleHostsUser(HttpUser): abstract = True def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.api_client = HttpSession( base_url=os.environ["API_H...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/open_closed_workload.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.620300
from locust import HttpUser, constant, constant_pacing, task class ClosedWorkload(HttpUser): wait_time = constant(10) # sleep 10s after each task, regardless of execution time @task def t(self): pass class OpenWorkload(HttpUser): wait_time = constant_pacing(10) # sleep just enough so that...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/openai_ex.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.670155
# You need to install the openai package and set OPENAI_API_KEY env var to run this # OpenAIUser tracks the number of output tokens in the response_length field, # because it is more useful than the actual payload size. This field is available to event handlers. from locust import run_single_user, task from locust.co...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/postgres/locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.811232
from locust import task from locust.contrib.postgres import PostgresUser import os import random class MyUser(PostgresUser): @task def run_select_query(self): self.client.execute_query( "SELECT * FROM loadtesting.invoice WHERE amount > 500", ) @task def run_update_query(s...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/response_validations.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.862608
""" This shows some useful ways to validate responses and how to exit tasks early on failure. """ from locust import FastHttpUser, events, run_single_user, task from locust.exception import RescheduleTask class BadUser(FastHttpUser): @task def t(self): self.client.request("POST", "/authenticate", jso...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/qdrant/locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.894692
""" Minimal example demonstrating Qdrant load testing with Locust. """ from locust import between, task from locust.contrib.qdrant import QdrantUser import random from qdrant_client.models import Distance, PointStruct, VectorParams class SimpleQdrantUser(QdrantUser): """Minimal Qdrant user for load testing."""...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/sdk_session_patching/session_patch_locustfile.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.974500
import locust from locust.user import task from archivist.archivist import Archivist # Example library under test class ArchivistUser(locust.HttpUser): def on_start(self): AUTH_TOKEN = None with open("auth.text") as f: AUTH_TOKEN = f.read() # Start an instance of of the lib...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/rest.py
null
null
null
null
null
null
Python
2026-05-04T02:25:30.975017
from locust import FastHttpUser, run_single_user, task from locust.contrib.fasthttp import RestResponseContextManager from locust.user.wait_time import constant from collections.abc import Generator from contextlib import contextmanager class MyUser(FastHttpUser): host = "https://postman-echo.com" wait_time ...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/semaphore_wait.py
null
null
null
null
null
null
Python
2026-05-04T02:25:31.795562
from locust import HttpUser, events, task from gevent.lock import Semaphore all_users_spawned = Semaphore() all_users_spawned.acquire() @events.spawning_complete.add_listener def on_spawning_complete(**kw): all_users_spawned.release() class WebsiteUser(HttpUser): host = "http://127.0.0.1:8089" def on...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/socketio/echo_server.py
null
null
null
null
null
null
Python
2026-05-04T02:25:31.796419
# Used by socketio_ex.py as a mock target. Requires installing gevent-websocket import gevent.monkey gevent.monkey.patch_all() import time import socketio from flask import Flask from gevent import pywsgi from geventwebsocket.handler import WebSocketHandler # Create a Socket.IO server sio = socketio.Server(async_mod...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/stop_on_threshold.py
null
null
null
null
null
null
Python
2026-05-04T02:25:31.863262
# An example of how to stop locust if a threshold (in this case the fail ratio) is exceeded from locust import HttpUser, events, task from locust.runners import STATE_CLEANUP, STATE_STOPPED, STATE_STOPPING, WorkerRunner import time import gevent class MyUser(HttpUser): host = "http://www.google.com" @task ...
locustio/locust
https://github.com/locustio/locust
null
null
null
null
27,749
null
null
mit
null
null
null
null
null
null
null
examples/socketio/socketio_ex.py
null
null
null
null
null
null
Python
2026-05-04T02:25:31.897472
from locust import HttpUser, task from locust.contrib.socketio import SocketIOUser from threading import Event import gevent from socketio import Client class MySIOHttpUser(SocketIOUser, HttpUser): options = { # "logger": True, # "engineio_logger": True, } event: Event def on_start(...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/benchmarks/nested_schema.py
null
null
null
null
null
null
Python
2026-05-04T02:25:34.560809
from __future__ import annotations from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from pydantic_core import core_schema as cs N = 5 # arbitrary number that takes ~0.05s per run class MyModel: # __slots__ is not required, but it avoids __pydantic_fields_set__ falling into __dict__ __slots__ = ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/python/pydantic_core/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:25:34.563017
from __future__ import annotations import sys as _sys from typing import Any as _Any from typing_extensions import Sentinel from ._pydantic_core import ( ArgsKwargs, MultiHostUrl, PydanticCustomError, PydanticKnownError, PydanticOmit, PydanticSerializationError, PydanticSerializationUnexp...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
docs/plugins/algolia.py
null
null
null
null
null
null
Python
2026-05-04T02:25:34.564018
# pyright: reportUnknownMemberType=false # pyright: reportAttributeAccessIssue=false # pyright: reportOptionalMemberAccess=false from __future__ import annotations as _annotations import os import sys from pathlib import Path from typing import TYPE_CHECKING, cast from bs4 import Tag from typing_extensions import Typ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
docs/plugins/conversion_table.py
null
null
null
null
null
null
Python
2026-05-04T02:25:34.565234
from __future__ import annotations as _annotations import collections import typing from collections import deque from collections.abc import Callable, Iterable, Mapping, Sequence from dataclasses import dataclass from datetime import date, datetime, time, timedelta from decimal import Decimal from enum import Enum, I...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
.github/actions/people/people.py
null
null
null
null
null
null
Python
2026-05-04T02:25:34.566348
"""Use the github API to get lists of people who have contributed in various ways to Pydantic. This logic is inspired by that of @tiangolo's [FastAPI people script](https://github.com/tiangolo/fastapi/blob/master/.github/actions/people/app/main.py). """ # ruff: noqa: D101 # ruff: noqa: D103 import logging import sub...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
docs/plugins/main.py
null
null
null
null
null
null
Python
2026-05-04T02:25:35.514840
from __future__ import annotations as _annotations import json import logging import os import re import textwrap from pathlib import Path from textwrap import indent import autoflake import pyupgrade._main as pyupgrade_main # type: ignore import requests import tomli import yaml from build.__main__ import ( bui...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/benchmarks/test_nested_benchmark.py
null
null
null
null
null
null
Python
2026-05-04T02:25:35.569641
""" Benchmarks for nested / recursive schemas using definitions. """ from collections.abc import Callable from pydantic_core import SchemaValidator from .nested_schema import inlined_schema, input_data_valid, schema_using_defs def test_nested_schema_using_defs(benchmark: Callable[..., None]) -> None: v = Schem...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/benchmarks/test_serialization_micro.py
null
null
null
null
null
null
Python
2026-05-04T02:25:35.578831
import json from dataclasses import dataclass from datetime import date, datetime from uuid import UUID import pytest from pydantic_core import SchemaSerializer, SchemaValidator, core_schema, to_json class TestBenchmarkSimpleModel: @pytest.fixture(scope='class') def core_schema(self): class CoreMode...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/benchmarks/test_micro_benchmarks.py
null
null
null
null
null
null
Python
2026-05-04T02:25:35.580370
""" Numerous benchmarks of specific functionality. """ import decimal import json import platform import sys from datetime import date, datetime, timedelta, timezone from decimal import Decimal from enum import Enum from typing import Any from uuid import UUID import pytest from dirty_equals import IsStr import pyda...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/benchmarks/complete_schema.py
null
null
null
null
null
null
Python
2026-05-04T02:25:35.637390
from __future__ import annotations from decimal import Decimal from typing import TYPE_CHECKING if TYPE_CHECKING: from pydantic_core import CoreSchema def schema(*, strict: bool = False) -> CoreSchema: class MyModel: # __slots__ is not required, but it avoids __pydantic_fields_set__ falling into __d...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
docs/plugins/using_update.py
null
null
null
null
null
null
Python
2026-05-04T02:25:35.699454
from pathlib import Path from time import sleep import requests import tomli THIS_DIR = Path(__file__).parent session = requests.Session() def update_lib(lib, *, retry=0): repo = lib['repo'] url = f'https://api.github.com/repos/{repo}' resp = session.get(url) if resp.status_code == 403 and retry < ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_any.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.077127
import dataclasses import ipaddress import json import platform import re import sys from collections import namedtuple from datetime import date, datetime, time, timedelta, timezone from decimal import Decimal from enum import Enum from math import inf, isinf, isnan, nan from pathlib import Path from typing import Cla...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_bytes.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.082717
import base64 import json from enum import Enum import pytest from pydantic_core import PydanticSerializationError, SchemaSerializer, core_schema, to_json def test_bytes(): s = SchemaSerializer(core_schema.bytes_schema()) assert s.to_python(b'foobar') == b'foobar' assert s.to_python('emoji 💩'.encode())...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/benchmarks/test_complete_benchmark.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.110843
""" General benchmarks that attempt to cover all field types, through by no means all uses of all field types. """ import json from datetime import date, datetime, time from decimal import Decimal from uuid import UUID import pytest from pydantic_core import SchemaSerializer, SchemaValidator, ValidationError from ....
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_complex.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.144855
import math import pytest from pydantic_core import SchemaSerializer, core_schema @pytest.mark.parametrize( 'value,expected', [ (complex(-1.23e-4, 567.89), '-0.000123+567.89j'), (complex(0, -1.23), '-1.23j'), (complex(1.5, 0), '1.5+0j'), (complex(1.5, -0.0), '1.5-0j'), ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_dataclasses.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.158728
import dataclasses import json import platform from typing import ClassVar import pytest from pydantic_core import SchemaSerializer, SchemaValidator, core_schema on_pypy = platform.python_implementation() == 'PyPy' # pypy doesn't seem to maintain order of `__dict__` if on_pypy: IsStrictDict = dict else: from...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_datetime.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.187073
from datetime import date, datetime, time, timedelta, timezone import pytest from pydantic_core import SchemaSerializer, core_schema def test_datetime(): v = SchemaSerializer(core_schema.datetime_schema()) assert v.to_python(datetime(2022, 12, 2, 12, 13, 14)) == datetime(2022, 12, 2, 12, 13, 14) assert...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/conftest.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.188443
from __future__ import annotations as _annotations import functools import gc import importlib.util import json import os import re import sys from collections.abc import Callable from dataclasses import dataclass from pathlib import Path from time import sleep, time from typing import Any, Literal import hypothesis ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_decimal.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.206289
from decimal import Decimal import pytest from pydantic_core import SchemaSerializer, core_schema def test_decimal(): v = SchemaSerializer(core_schema.decimal_schema()) assert v.to_python(Decimal('123.456')) == Decimal('123.456') assert v.to_python(Decimal('123.456'), mode='json') == '123.456' asse...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_definitions.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.311201
import pytest from pydantic_core import SchemaError, SchemaSerializer, core_schema def test_custom_ser(): s = SchemaSerializer( core_schema.definitions_schema( core_schema.list_schema(core_schema.definition_reference_schema('foobar')), [core_schema.int_schema(ref='foobar', seriali...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_definitions_recursive.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.578109
import pytest from pydantic_core import SchemaSerializer, core_schema def test_branch_nullable(): s = SchemaSerializer( core_schema.definitions_schema( core_schema.definition_reference_schema('Branch'), [ core_schema.typed_dict_schema( { ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_dict.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.687030
import json import pytest from dirty_equals import IsStrictDict from pydantic_core import SchemaSerializer, core_schema def test_dict_str_int(): v = SchemaSerializer(core_schema.dict_schema(core_schema.str_schema(), core_schema.int_schema())) assert v.to_python({'a': 1, 'b': 2, 'c': 3}) == {'a': 1, 'b': 2, ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_enum.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.688563
from enum import Enum import pytest from pydantic_core import SchemaSerializer, core_schema def test_plain_enum(): class MyEnum(Enum): a = 1 b = 2 v = SchemaSerializer(core_schema.enum_schema(MyEnum, list(MyEnum.__members__.values()))) # debug(v) assert v.to_python(MyEnum.a) is MyE...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_format.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.694027
import json import re from datetime import date from uuid import UUID import pytest from pydantic_core import PydanticSerializationError, SchemaSerializer, core_schema @pytest.mark.parametrize( 'value,formatting_string,expected_python,expected_json', [ (42.12345, '0.4f', 42.12345, b'"42.1234"'), ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_functions.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.703338
import json import os import platform import re import sys from collections import deque from operator import attrgetter from pathlib import Path import pytest from pydantic_core import ( PydanticOmit, PydanticSerializationError, PydanticSerializationUnexpectedValue, SchemaSerializer, core_schema,...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_generator.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.756613
import pytest from dirty_equals import IsStr from pydantic_core import SchemaSerializer, core_schema def gen_ok(*things): yield from things def gen_error(*things): yield from things raise ValueError('oops') def test_generator_any_iter(): s = SchemaSerializer(core_schema.generator_schema(core_sche...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_infer.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.778332
from enum import Enum from pydantic_core import SchemaSerializer, core_schema # serializing enum calls methods in serializers::infer def test_infer_to_python(): class MyEnum(Enum): complex_ = complex(1, 2) v = SchemaSerializer(core_schema.enum_schema(MyEnum, list(MyEnum.__members__.values()))) a...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_json.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.779516
from pydantic_core import SchemaSerializer, core_schema def test_json_int(): s = SchemaSerializer(core_schema.json_schema(core_schema.int_schema())) assert s.to_python(1) == 1 assert s.to_python(1, round_trip=True) == '1' assert s.to_python(1, mode='json') == 1 assert s.to_python(1, mode='json', ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_json_or_python.py
null
null
null
null
null
null
Python
2026-05-04T02:25:36.799695
from enum import Enum from pydantic_core import SchemaSerializer, core_schema def test_json_or_python(): def s1(v: int) -> int: return v + 1 def s2(v: int) -> int: return v + 2 s = SchemaSerializer( core_schema.json_or_python_schema( core_schema.int_schema(serializat...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_list_tuple.py
null
null
null
null
null
null
Python
2026-05-04T02:25:37.144942
import json from functools import partial import pytest from pydantic_core import ( PydanticSerializationError, SchemaSerializer, core_schema, ) def test_list_any(): v = SchemaSerializer(core_schema.list_schema(core_schema.any_schema())) assert v.to_python(['a', 'b', 'c']) == ['a', 'b', 'c'] ...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_literal.py
null
null
null
null
null
null
Python
2026-05-04T02:25:37.615962
from dataclasses import dataclass from enum import Enum from typing import Literal import pytest from pydantic_core import SchemaError, SchemaSerializer, core_schema from ..conftest import plain_repr def test_int_literal(): s = SchemaSerializer(core_schema.literal_schema([1, 2, 3])) r = plain_repr(s) a...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_none.py
null
null
null
null
null
null
Python
2026-05-04T02:25:37.830134
import pytest from pydantic_core import SchemaSerializer, core_schema all_scalars = ( 'int', 'bool', 'float', 'none', 'str', 'bytes', 'datetime', 'date', 'time', 'timedelta', 'url', 'multi-host-url', ) all_types = all_scalars + ('list', 'dict', 'set', 'frozenset') @py...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_model_root.py
null
null
null
null
null
null
Python
2026-05-04T02:25:37.831278
import json import os import platform from pathlib import Path from typing import Any import pytest from pydantic_core import SchemaSerializer, core_schema from ..conftest import plain_repr on_pypy = platform.python_implementation() == 'PyPy' # pypy doesn't seem to maintain order of `__dict__` if on_pypy: IsStr...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_serialize_as_any.py
null
null
null
null
null
null
Python
2026-05-04T02:25:37.832952
from collections.abc import Callable from dataclasses import dataclass from typing import Optional import pytest from typing_extensions import TypedDict from pydantic_core import SchemaSerializer, SchemaValidator, core_schema class ParentModel: x: int class ChildModel(ParentModel): y: str ParentModel.__...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_other.py
null
null
null
null
null
null
Python
2026-05-04T02:25:37.842646
import pytest from pydantic_core import SchemaSerializer, SchemaValidator, core_schema from ..conftest import plain_repr def test_chain(): s = SchemaSerializer(core_schema.chain_schema([core_schema.str_schema(), core_schema.int_schema()])) # insert_assert(plain_repr(s)) assert plain_repr(s) == 'SchemaS...
pydantic/pydantic
https://github.com/pydantic/pydantic
null
null
null
null
27,670
null
null
mit
null
null
null
null
null
null
null
pydantic-core/tests/serializers/test_model.py
null
null
null
null
null
null
Python
2026-05-04T02:25:37.843996
import dataclasses import json import platform import warnings from functools import cached_property from random import randint from typing import Any, ClassVar import pytest from dirty_equals import IsJson from pydantic_core import ( PydanticSerializationError, SchemaSerializer, SchemaValidator, core...