id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
34,845 | from __future__ import annotations
import inspect
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass, field
from enum import Enum, unique
from functools import partial
from typing import TYPE_CHECKING, Any, Callable, ClassVar, DefaultDict, cast
from .types import GenericTest... | Decide whether testing of this particular API operation should be skipped or not. |
34,846 | from __future__ import annotations
import inspect
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass, field
from enum import Enum, unique
from functools import partial
from typing import TYPE_CHECKING, Any, Callable, ClassVar, DefaultDict, cast
from .types import GenericTest... | Called after schema instance is created. |
34,847 | from __future__ import annotations
import inspect
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass, field
from enum import Enum, unique
from functools import partial
from typing import TYPE_CHECKING, Any, Callable, ClassVar, DefaultDict, cast
from .types import GenericTest... | Allows you to customize a newly created API operation. |
34,848 | from __future__ import annotations
import inspect
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass, field
from enum import Enum, unique
from functools import partial
from typing import TYPE_CHECKING, Any, Callable, ClassVar, DefaultDict, cast
from .types import GenericTest... | Creates an additional test per API operation. If this hook returns None, no additional test created. Called with a copy of the original case object and the server's response to the original case. |
34,849 | from __future__ import annotations
import inspect
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass, field
from enum import Enum, unique
from functools import partial
from typing import TYPE_CHECKING, Any, Callable, ClassVar, DefaultDict, cast
from .types import GenericTest... | Called before every network call in CLI tests. Use cases: - Modification of `case`. For example, adding some pre-determined value to its query string. - Logging |
34,850 | from typing import Any, Type, Callable
from ._lazy_import import lazy_import
IS_WERKZEUG_BELOW_2_1 = WERKZEUG_VERSION < version.parse("2.1.0")
def _load_json_mixin() -> Type:
from ._dependency_versions import IS_WERKZEUG_BELOW_2_1
if IS_WERKZEUG_BELOW_2_1:
from werkzeug.wrappers.json import JSONMixin... | null |
34,851 | from typing import Any, Type, Callable
from ._lazy_import import lazy_import
def _load_infer_type() -> Type:
try:
from hypothesis.utils.conventions import InferType
return InferType
except ImportError:
return type(...) | null |
34,852 | from typing import Any, Type, Callable
from ._lazy_import import lazy_import
def _load_get_interesting_origin() -> Callable:
try:
from hypothesis.internal.escalation import get_interesting_origin
return get_interesting_origin
except ImportError:
from hypothesis.internal.escalation impo... | null |
34,853 | from typing import Any, Type, Callable
from ._lazy_import import lazy_import
def _load_multiple_failures() -> Type:
try:
return BaseExceptionGroup # type: ignore
except NameError:
from exceptiongroup import BaseExceptionGroup as MultipleFailures # type: ignore
return MultipleFailures | null |
34,854 | from typing import Any, Type, Callable
from ._lazy_import import lazy_import
def _load_get_signature() -> Callable:
from hypothesis.internal.reflection import get_signature
return get_signature | null |
34,855 | from typing import Any, Type, Callable
from ._lazy_import import lazy_import
_imports = {
"JSONMixin": _load_json_mixin,
"InferType": _load_infer_type,
"MultipleFailures": _load_multiple_failures,
"get_signature": _load_get_signature,
"get_interesting_origin": _load_get_interesting_origin,
}
def la... | null |
34,856 | from __future__ import annotations
import binascii
import os
from dataclasses import dataclass
from io import BytesIO
from typing import (
TYPE_CHECKING,
Any,
Callable,
Collection,
Dict,
Generator,
Protocol,
cast,
runtime_checkable,
)
from ._xml import _to_xml
from .internal.copy imp... | null |
34,857 | from __future__ import annotations
import binascii
import os
from dataclasses import dataclass
from io import BytesIO
from typing import (
TYPE_CHECKING,
Any,
Callable,
Collection,
Dict,
Generator,
Protocol,
cast,
runtime_checkable,
)
from ._xml import _to_xml
from .internal.copy imp... | null |
34,858 | from __future__ import annotations
import binascii
import os
from dataclasses import dataclass
from io import BytesIO
from typing import (
TYPE_CHECKING,
Any,
Callable,
Collection,
Dict,
Generator,
Protocol,
cast,
runtime_checkable,
)
from ._xml import _to_xml
from .internal.copy imp... | Make the generated data suitable for sending as multipart. If the schema is loose, Schemathesis can generate data that can't be sent as multipart. In these cases, we convert it to bytes and send it as-is, ignoring any conversion errors. NOTE. This behavior might change in the future. |
34,859 | from __future__ import annotations
import binascii
import os
from dataclasses import dataclass
from io import BytesIO
from typing import (
TYPE_CHECKING,
Any,
Callable,
Collection,
Dict,
Generator,
Protocol,
cast,
runtime_checkable,
)
from ._xml import _to_xml
from .internal.copy imp... | Random boundary name. |
34,860 | from __future__ import annotations
import binascii
import os
from dataclasses import dataclass
from io import BytesIO
from typing import (
TYPE_CHECKING,
Any,
Callable,
Collection,
Dict,
Generator,
Protocol,
cast,
runtime_checkable,
)
from ._xml import _to_xml
from .internal.copy imp... | Encode any value as multipart. NOTE. It doesn't aim to be 100% correct multipart payload, but rather a way to send data which is not intended to be used as multipart, in cases when the API schema dictates so. |
34,861 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | Detect what kind the input schema is. |
34,862 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,863 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,864 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,865 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,866 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,867 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,868 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,869 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,870 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,871 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,872 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,873 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,874 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,875 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,876 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,877 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,878 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,879 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,880 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,881 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,882 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,883 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,884 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,885 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,886 | from __future__ import annotations
import codecs
import enum
import os
import re
import traceback
from contextlib import contextmanager
from functools import partial
from typing import Generator, TYPE_CHECKING, Callable
from urllib.parse import urlparse
import click
from click.types import LazyFile
from .. import exce... | null |
34,887 | from __future__ import annotations
import base64
import os
import platform
import shutil
import textwrap
import time
from importlib import metadata
from itertools import groupby
from queue import Queue
from typing import Any, Generator, cast
import click
from ... import service
from ...code_samples import CodeSampleSty... | null |
34,888 | from __future__ import annotations
import base64
import os
import platform
import shutil
import textwrap
import time
from importlib import metadata
from itertools import groupby
from queue import Queue
from typing import Any, Generator, cast
import click
from ... import service
from ...code_samples import CodeSampleSty... | Display information about the test session. |
34,889 | from __future__ import annotations
import base64
import os
import platform
import shutil
import textwrap
import time
from importlib import metadata
from itertools import groupby
from queue import Queue
from typing import Any, Generator, cast
import click
from ... import service
from ...code_samples import CodeSampleSty... | null |
34,890 | from __future__ import annotations
import base64
import os
import platform
import shutil
import textwrap
import time
from importlib import metadata
from itertools import groupby
from queue import Queue
from typing import Any, Generator, cast
import click
from ... import service
from ...code_samples import CodeSampleSty... | null |
34,891 | from __future__ import annotations
import base64
import os
import platform
import shutil
import textwrap
import time
from importlib import metadata
from itertools import groupby
from queue import Queue
from typing import Any, Generator, cast
import click
from ... import service
from ...code_samples import CodeSampleSty... | Display what method / path will be tested next. |
34,892 | from __future__ import annotations
import base64
import os
import platform
import shutil
import textwrap
import time
from importlib import metadata
from itertools import groupby
from queue import Queue
from typing import Any, Generator, cast
import click
from ... import service
from ...code_samples import CodeSampleSty... | Display the execution result + current progress at the same line with the method / path names. |
34,893 | from __future__ import annotations
import base64
import os
import platform
import shutil
import textwrap
import time
from importlib import metadata
from itertools import groupby
from queue import Queue
from typing import Any, Generator, cast
import click
from ... import service
from ...code_samples import CodeSampleSty... | Show the outcome of the whole testing session. |
34,894 | from __future__ import annotations
import base64
import os
import platform
import shutil
import textwrap
import time
from importlib import metadata
from itertools import groupby
from queue import Queue
from typing import Any, Generator, cast
import click
from ... import service
from ...code_samples import CodeSampleSty... | null |
34,895 | from __future__ import annotations
import base64
import os
import platform
import shutil
import textwrap
import time
from importlib import metadata
from itertools import groupby
from queue import Queue
from typing import Any, Generator, cast
import click
from ... import service
from ...code_samples import CodeSampleSty... | null |
34,896 | import click
from ...runner import events
from ..context import ExecutionContext
from ..handlers import EventHandler
from . import default
class ExecutionContext:
"""Storage for the current context of the execution."""
hypothesis_settings: hypothesis.settings
hypothesis_output: list[str] = field(default_f... | null |
34,897 | import click
from ...runner import events
from ..context import ExecutionContext
from ..handlers import EventHandler
from . import default
class ExecutionContext:
def show_errors_tracebacks(self) -> bool:
def handle_after_execution(context: ExecutionContext, event: events.AfterExecution) -> None:
context.ope... | null |
34,898 | from __future__ import annotations
import base64
import json
import re
import sys
import threading
from dataclasses import dataclass, field
from queue import Queue
from typing import IO, Any, Generator, Iterator, cast, TYPE_CHECKING
from ..constants import SCHEMATHESIS_VERSION
from ..runner import events
from ..types i... | Write YAML to a file in an incremental manner. This implementation doesn't use `pyyaml` package and composes YAML manually as string due to the following reasons: - It is much faster. The string-based approach gives only ~2.5% time overhead when `yaml.CDumper` has ~11.2%; - Implementation complexity. We have a quite si... |
34,899 | from __future__ import annotations
import base64
import json
import re
import sys
import threading
from dataclasses import dataclass, field
from queue import Queue
from typing import IO, Any, Generator, Iterator, cast, TYPE_CHECKING
from ..constants import SCHEMATHESIS_VERSION
from ..runner import events
from ..types i... | Replay saved interactions. |
34,900 | from __future__ import annotations
import time
import re
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Callable, ClassVar
from hypothesis.errors import InvalidDefinition
from hypothesis.stateful import RuleBasedStateMachine
from .._dependency_versions import HYPOTHESIS_HAS_STATEFUL_NAMING_IMP... | null |
34,901 | from __future__ import annotations
import time
import re
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Callable, ClassVar
from hypothesis.errors import InvalidDefinition
from hypothesis.stateful import RuleBasedStateMachine
from .._dependency_versions import HYPOTHESIS_HAS_STATEFUL_NAMING_IMP... | null |
34,902 | from __future__ import annotations
import logging
import re
from dataclasses import dataclass, field
from typing import Any, TYPE_CHECKING, cast
from ..transports import serialize_payload
from ..code_samples import get_excluded_headers
from ..exceptions import (
FailureContext,
InternalError,
make_unique_by... | null |
34,903 | from __future__ import annotations
import logging
import re
from dataclasses import dataclass, field
from typing import Any, TYPE_CHECKING, cast
from ..transports import serialize_payload
from ..code_samples import get_excluded_headers
from ..exceptions import (
FailureContext,
InternalError,
make_unique_by... | null |
34,904 | from __future__ import annotations
import logging
import re
from dataclasses import dataclass, field
from typing import Any, TYPE_CHECKING, cast
from ..transports import serialize_payload
from ..code_samples import get_excluded_headers
from ..exceptions import (
FailureContext,
InternalError,
make_unique_by... | null |
34,905 | from __future__ import annotations
import logging
import re
from dataclasses import dataclass, field
from typing import Any, TYPE_CHECKING, cast
from ..transports import serialize_payload
from ..code_samples import get_excluded_headers
from ..exceptions import (
FailureContext,
InternalError,
make_unique_by... | null |
34,906 | from __future__ import annotations
import logging
import re
import threading
import time
import unittest
import uuid
from contextlib import contextmanager
from dataclasses import dataclass, field
from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, List, Literal, cast
fr... | null |
34,907 | from __future__ import annotations
import logging
import re
import threading
import time
import unittest
import uuid
from contextlib import contextmanager
from dataclasses import dataclass, field
from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, List, Literal, cast
fr... | Discover capabilities of the tested app. |
34,908 | from __future__ import annotations
import logging
import re
import threading
import time
import unittest
import uuid
from contextlib import contextmanager
from dataclasses import dataclass, field
from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, List, Literal, cast
fr... | Check if all responses are 404. |
34,909 | from __future__ import annotations
import ctypes
import queue
import threading
import time
from dataclasses import dataclass
from queue import Queue
from typing import Any, Callable, Generator, Iterable, cast
import hypothesis
from ..._hypothesis import create_test
from ...generation import DataGenerationMethod, Genera... | A single task, that threads do. Pretty similar to the default one-thread flow, but includes communication with the main thread via the events queue. |
34,910 | from __future__ import annotations
import ctypes
import queue
import threading
import time
from dataclasses import dataclass
from queue import Queue
from typing import Any, Callable, Generator, Iterable, cast
import hypothesis
from ..._hypothesis import create_test
from ...generation import DataGenerationMethod, Genera... | null |
34,911 | from __future__ import annotations
import ctypes
import queue
import threading
import time
from dataclasses import dataclass
from queue import Queue
from typing import Any, Callable, Generator, Iterable, cast
import hypothesis
from ..._hypothesis import create_test
from ...generation import DataGenerationMethod, Genera... | null |
34,912 | from __future__ import annotations
import ctypes
import queue
import threading
import time
from dataclasses import dataclass
from queue import Queue
from typing import Any, Callable, Generator, Iterable, cast
import hypothesis
from ..._hypothesis import create_test
from ...generation import DataGenerationMethod, Genera... | Raise an error in a thread, so it is possible to asynchronously stop thread execution. |
34,913 | from __future__ import annotations
import enum
import os
from dataclasses import asdict, dataclass
from typing import Protocol, runtime_checkable
class Environment(Protocol):
def is_set(cls) -> bool:
def from_env(cls) -> Environment:
def asdict(self) -> dict[str, str | None]:
def as_env(self) -> dic... | null |
34,914 | from __future__ import annotations
from dataclasses import asdict
from typing import Any, Callable, Dict, Optional, TypeVar, cast
from ..models import Response
from ..runner import events
from ..runner.serialization import SerializedCase
from ..internal.transformation import merge_recursively
def serialize_initialized... | null |
34,915 | from __future__ import annotations
from dataclasses import asdict
from typing import Any, Callable, Dict, Optional, TypeVar, cast
from ..models import Response
from ..runner import events
from ..runner.serialization import SerializedCase
from ..internal.transformation import merge_recursively
def serialize_before_prob... | null |
34,916 | from __future__ import annotations
from dataclasses import asdict
from typing import Any, Callable, Dict, Optional, TypeVar, cast
from ..models import Response
from ..runner import events
from ..runner.serialization import SerializedCase
from ..internal.transformation import merge_recursively
def serialize_after_probi... | null |
34,917 | from __future__ import annotations
from dataclasses import asdict
from typing import Any, Callable, Dict, Optional, TypeVar, cast
from ..models import Response
from ..runner import events
from ..runner.serialization import SerializedCase
from ..internal.transformation import merge_recursively
def serialize_before_exec... | null |
34,918 | from __future__ import annotations
from dataclasses import asdict
from typing import Any, Callable, Dict, Optional, TypeVar, cast
from ..models import Response
from ..runner import events
from ..runner.serialization import SerializedCase
from ..internal.transformation import merge_recursively
def _serialize_case(case: ... | null |
34,919 | from __future__ import annotations
from dataclasses import asdict
from typing import Any, Callable, Dict, Optional, TypeVar, cast
from ..models import Response
from ..runner import events
from ..runner.serialization import SerializedCase
from ..internal.transformation import merge_recursively
def serialize_interrupted... | null |
34,920 | from __future__ import annotations
from dataclasses import asdict
from typing import Any, Callable, Dict, Optional, TypeVar, cast
from ..models import Response
from ..runner import events
from ..runner.serialization import SerializedCase
from ..internal.transformation import merge_recursively
def serialize_internal_er... | null |
34,921 | from __future__ import annotations
from dataclasses import asdict
from typing import Any, Callable, Dict, Optional, TypeVar, cast
from ..models import Response
from ..runner import events
from ..runner.serialization import SerializedCase
from ..internal.transformation import merge_recursively
def serialize_finished(ev... | null |
34,922 | from __future__ import annotations
from dataclasses import asdict
from typing import Any, Callable, Dict, Optional, TypeVar, cast
from ..models import Response
from ..runner import events
from ..runner.serialization import SerializedCase
from ..internal.transformation import merge_recursively
SerializeFunc = Callable[[... | Turn an event into JSON-serializable structure. |
34,923 | from __future__ import annotations
import enum
import json
import os
import tarfile
import threading
import time
from contextlib import suppress
from dataclasses import asdict, dataclass, field
from io import BytesIO
from queue import Queue
from typing import Any, TYPE_CHECKING
import click
from ..cli.handlers import E... | Create a compressed ``tar.gz`` file during the run & upload it to Schemathesis.io when the run is finished. |
34,924 | from __future__ import annotations
import enum
import json
import os
import tarfile
import threading
import time
from contextlib import suppress
from dataclasses import asdict, dataclass, field
from io import BytesIO
from queue import Queue
from typing import Any, TYPE_CHECKING
import click
from ..cli.handlers import E... | null |
34,925 | from __future__ import annotations
import enum
import tempfile
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import tomli
import tomli_w
from ..types import PathLike
from .constants import DEFAULT_HOSTNAME, DEFAULT_HOSTS_PATH, HOSTS_FORMAT_VERSION
def load(path: PathLike) -> dict[str... | Store a new token for a host. |
34,926 | from __future__ import annotations
import enum
import tempfile
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import tomli
import tomli_w
from ..types import PathLike
from .constants import DEFAULT_HOSTNAME, DEFAULT_HOSTS_PATH, HOSTS_FORMAT_VERSION
def load_for_host(hostname: str = DE... | Load a token for a host. |
34,927 | from __future__ import annotations
import hashlib
import http
from dataclasses import asdict
from typing import Any
from urllib.parse import urljoin
import requests
from requests.adapters import HTTPAdapter, Retry
from ..constants import USER_AGENT
from .ci import CIProvider
from .constants import CI_PROVIDER_HEADER, R... | null |
34,928 | from __future__ import annotations
import sys
from typing import Any
import click
from click.types import StringParamType
from .. import cli, hooks
def _collect_option(option: str, option_type: click.Parameter, used_headers: list[str], value: Any) -> dict[str, Any]:
entry = {}
if isinstance(option_type.type, (S... | Collect anonymized CLI usage data. |
34,929 | from . import metadata
from .constants import DEFAULT_HOSTNAME, DEFAULT_PROTOCOL
DEFAULT_HOSTNAME = "api.schemathesis.io"
DEFAULT_PROTOCOL = "https"
class ServiceClient(requests.Session):
"""A more convenient session to send requests to Schemathesis.io."""
def __init__(self, base_url: str, token: str | None,... | Make a login request to SaaS. |
34,930 | from __future__ import annotations
from typing import Any
from ..hooks import HookContext
from ..hooks import is_installed as global_is_installed
from ..hooks import register, unregister
from ..internal.jsonschema import traverse_schema
def before_load_schema(context: HookContext, schema: dict[str, Any]) -> None:
a... | null |
34,931 | from __future__ import annotations
from typing import Any
from ..hooks import HookContext
from ..hooks import is_installed as global_is_installed
from ..hooks import register, unregister
from ..internal.jsonschema import traverse_schema
def before_load_schema(context: HookContext, schema: dict[str, Any]) -> None:
unre... | null |
34,932 | from __future__ import annotations
from typing import Any
from ..hooks import HookContext
from ..hooks import is_installed as global_is_installed
from ..hooks import register, unregister
from ..internal.jsonschema import traverse_schema
def before_load_schema(context: HookContext, schema: dict[str, Any]) -> None:
a... | null |
34,933 | from typing import TYPE_CHECKING
from ..constants import BOM_MARK
from ..hooks import HookContext
from ..hooks import is_installed as global_is_installed
from ..hooks import register, unregister
def after_call(context: HookContext, case: "Case", response: "GenericResponse") -> None:
from requests import Response
... | null |
34,934 | from typing import TYPE_CHECKING
from ..constants import BOM_MARK
from ..hooks import HookContext
from ..hooks import is_installed as global_is_installed
from ..hooks import register, unregister
def after_call(context: HookContext, case: "Case", response: "GenericResponse") -> None:
from requests import Response
... | null |
34,935 | from typing import TYPE_CHECKING
from ..constants import BOM_MARK
from ..hooks import HookContext
from ..hooks import is_installed as global_is_installed
from ..hooks import register, unregister
def after_call(context: HookContext, case: "Case", response: "GenericResponse") -> None:
from requests import Response
... | null |
34,936 | from __future__ import annotations
from io import StringIO
from typing import Any, Dict, List, Union
from xml.etree import ElementTree
from .exceptions import UnboundPrefixError
from .internal.copy import fast_deepcopy
def is_valid_xml(data: str) -> bool:
try:
_from_string(f"<root xmlns:smp='{NAMESPACE_URL}... | Serialize a generated Python object as an XML string. Schemas may contain additional information for fine-tuned XML serialization. :param value: Generated value :param raw_schema: The payload definition with not resolved references. :param resolved_schema: The payload definition with all references resolved. |
34,937 | from datetime import datetime, timezone
def current_datetime() -> str:
return datetime.now(timezone.utc).astimezone().isoformat() | null |
34,938 | import warnings
from typing import Callable, Any
def _warn_deprecation(*, kind: str, thing: str, removed_in: str, replacement: str) -> None:
warnings.warn(
f"{kind} `{thing}` is deprecated and will be removed in Schemathesis {removed_in}. "
f"Use `{replacement}` instead.",
DeprecationWarning... | null |
34,939 | import warnings
from typing import Callable, Any
def _warn_deprecation(*, kind: str, thing: str, removed_in: str, replacement: str) -> None:
warnings.warn(
f"{kind} `{thing}` is deprecated and will be removed in Schemathesis {removed_in}. "
f"Use `{replacement}` instead.",
DeprecationWarning... | null |
34,940 | import os
import time
from flask import Flask, jsonify, request, Response
import sqlalchemy.exc
from flask_sqlalchemy import SQLAlchemy
def improper_unicode_encoding():
data = request.json
if "text" not in data:
return jsonify({"success": False, "error": "Missing text"}), 400
try:
# Simula... | null |
34,941 | import os
import time
from flask import Flask, jsonify, request, Response
import sqlalchemy.exc
from flask_sqlalchemy import SQLAlchemy
def improper_input_type_handling():
data = request.json
if not isinstance(data, dict) or "number" not in data:
return jsonify({"success": False}), 400
# Potential... | null |
34,942 | import os
import time
from flask import Flask, jsonify, request, Response
import sqlalchemy.exc
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy(app)
class Message(db.Model):
id = db.Column(db.Integer, primary_key=True)
# Column with restricted size
text = db.Column(db.String(16), sqlalchemy.CheckCon... | null |
34,943 | import os
import time
from flask import Flask, jsonify, request, Response
import sqlalchemy.exc
from flask_sqlalchemy import SQLAlchemy
def malformed_json():
return "{success: true}", 200, {"Content-Type": "application/json"} | null |
34,944 | import os
import time
from flask import Flask, jsonify, request, Response
import sqlalchemy.exc
from flask_sqlalchemy import SQLAlchemy
def incorrect_content_type():
# This response does not conform to the OpenAPI schema
return "Success!", 200, {"Content-Type": "text/plain"} | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.