id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
34,745 | from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Optional
from .exceptions import UsageError
from .parameters import ParameterSet
from .types import GenericTest
class UsageError(Exception):
"""Incorrect usage of Schemathesis functions."""
GenericTest = Callabl... | null |
34,746 | from __future__ import annotations
import functools
import operator
from contextlib import contextmanager
from inspect import getfullargspec
from pathlib import Path
from typing import (
Any,
Callable,
Generator,
NoReturn,
Union,
)
import pytest
from hypothesis import strategies as st
from hypothesi... | Check whether test is parametrized with schemathesis. |
34,747 | from __future__ import annotations
import functools
import operator
from contextlib import contextmanager
from inspect import getfullargspec
from pathlib import Path
from typing import (
Any,
Callable,
Generator,
NoReturn,
Union,
)
import pytest
from hypothesis import strategies as st
from hypothesi... | null |
34,748 | from __future__ import annotations
import functools
import operator
from contextlib import contextmanager
from inspect import getfullargspec
from pathlib import Path
from typing import (
Any,
Callable,
Generator,
NoReturn,
Union,
)
import pytest
from hypothesis import strategies as st
from hypothesi... | null |
34,749 | from __future__ import annotations
import functools
import operator
from contextlib import contextmanager
from inspect import getfullargspec
from pathlib import Path
from typing import (
Any,
Callable,
Generator,
NoReturn,
Union,
)
import pytest
from hypothesis import strategies as st
from hypothesi... | null |
34,750 | from __future__ import annotations
import functools
import operator
from contextlib import contextmanager
from inspect import getfullargspec
from pathlib import Path
from typing import (
Any,
Callable,
Generator,
NoReturn,
Union,
)
import pytest
from hypothesis import strategies as st
from hypothesi... | null |
34,751 | from __future__ import annotations
import functools
import operator
from contextlib import contextmanager
from inspect import getfullargspec
from pathlib import Path
from typing import (
Any,
Callable,
Generator,
NoReturn,
Union,
)
import pytest
from hypothesis import strategies as st
from hypothesi... | Proxy Hypothesis strategies to ``hypothesis.given``. |
34,752 | from __future__ import annotations
import functools
import operator
from contextlib import contextmanager
from inspect import getfullargspec
from pathlib import Path
from typing import (
Any,
Callable,
Generator,
NoReturn,
Union,
)
import pytest
from hypothesis import strategies as st
from hypothesi... | Merge positional arguments to ``@schema.given`` into a dictionary with keyword arguments. Kwargs are modified inplace. |
34,753 | from __future__ import annotations
import functools
import operator
from contextlib import contextmanager
from inspect import getfullargspec
from pathlib import Path
from typing import (
Any,
Callable,
Generator,
NoReturn,
Union,
)
import pytest
from hypothesis import strategies as st
from hypothesi... | null |
34,754 | from __future__ import annotations
from flask import Flask
from . import _server
The provided code snippet includes necessary dependencies for implementing the `run_server` function. Write a Python function `def run_server(app: Flask, port: int | None = None, timeout: float = 0.05) -> int` to solve the following probl... | Start a thread with the given aiohttp application. |
34,755 | from __future__ import annotations
from dataclasses import dataclass, field
from difflib import get_close_matches
from typing import Any, Generator, NoReturn, Sequence, Union, TYPE_CHECKING
from ...models import APIOperation, Case
from ...parameters import ParameterSet
from ...stateful import ParsedData, StatefulTest
f... | Get `x-links` / `links` definitions from the schema. |
34,756 | from __future__ import annotations
from dataclasses import dataclass, field
from difflib import get_close_matches
from typing import Any, Generator, NoReturn, Sequence, Union, TYPE_CHECKING
from ...models import APIOperation, Case
from ...parameters import ParameterSet
from ...stateful import ParsedData, StatefulTest
f... | Get a container that suppose to store the given parameter. |
34,757 | from __future__ import annotations
from dataclasses import dataclass, field
from difflib import get_close_matches
from typing import Any, Generator, NoReturn, Sequence, Union, TYPE_CHECKING
from ...models import APIOperation, Case
from ...parameters import ParameterSet
from ...stateful import ParsedData, StatefulTest
f... | Normalize runtime expressions. Runtime expressions may have parameter names prefixed with their location - `path.id`. At the same time, parameters could be defined without a prefix - `id`. We need to normalize all parameters to the same form to simplify working with them. |
34,758 | from __future__ import annotations
from dataclasses import dataclass, field
from difflib import get_close_matches
from typing import Any, Generator, NoReturn, Sequence, Union, TYPE_CHECKING
from ...models import APIOperation, Case
from ...parameters import ParameterSet
from ...stateful import ParsedData, StatefulTest
f... | null |
34,759 | from __future__ import annotations
from typing import TYPE_CHECKING
STRING_FORMATS: dict[str, st.SearchStrategy] = {}
The provided code snippet includes necessary dependencies for implementing the `register_string_format` function. Write a Python function `def register_string_format(name: str, strategy: st.SearchStrat... | Register a new strategy for generating data for specific string "format". :param str name: Format name. It should correspond the one used in the API schema as the "format" keyword value. :param strategy: Hypothesis strategy you'd like to use to generate values for this format. |
34,760 | from __future__ import annotations
from typing import TYPE_CHECKING
STRING_FORMATS: dict[str, st.SearchStrategy] = {}
The provided code snippet includes necessary dependencies for implementing the `unregister_string_format` function. Write a Python function `def unregister_string_format(name: str) -> None` to solve th... | Remove format strategy from the registry. |
34,761 | from __future__ import annotations
from typing import Any, TYPE_CHECKING
from ..._lazy_import import lazy_import
def make_validator(schema: dict[str, Any]) -> Validator:
import jsonschema
return jsonschema.validators.validator_for(schema)(schema) | null |
34,762 | from __future__ import annotations
from typing import Any, TYPE_CHECKING
from ..._lazy_import import lazy_import
_imports = {
"SWAGGER_20_VALIDATOR": lambda: make_validator(SWAGGER_20),
"OPENAPI_30_VALIDATOR": lambda: make_validator(OPENAPI_30),
"OPENAPI_31_VALIDATOR": lambda: make_validator(OPENAPI_31),
}
... | null |
34,763 | from __future__ import annotations
import itertools
from collections import defaultdict
from contextlib import ExitStack, contextmanager, suppress
from dataclasses import dataclass, field
from difflib import get_close_matches
from hashlib import sha1
from json import JSONDecodeError
from threading import RLock
from typ... | null |
34,764 | from __future__ import annotations
import itertools
from collections import defaultdict
from contextlib import ExitStack, contextmanager, suppress
from dataclasses import dataclass, field
from difflib import get_close_matches
from hashlib import sha1
from json import JSONDecodeError
from threading import RLock
from typ... | A name under which the resolved reference data will be stored. |
34,765 | from __future__ import annotations
import itertools
from collections import defaultdict
from contextlib import ExitStack, contextmanager, suppress
from dataclasses import dataclass, field
from difflib import get_close_matches
from hashlib import sha1
from json import JSONDecodeError
from threading import RLock
from typ... | Push all available scopes into the resolver. There could be an additional scope change during a schema resolving in `get_response_schema`, so in total there could be a stack of two scopes maximum. This context manager handles both cases (1 or 2 scope changes) in the same way. |
34,766 | from __future__ import annotations
import itertools
from collections import defaultdict
from contextlib import ExitStack, contextmanager, suppress
from dataclasses import dataclass, field
from difflib import get_close_matches
from hashlib import sha1
from json import JSONDecodeError
from threading import RLock
from typ... | null |
34,767 | from __future__ import annotations
import json
from typing import Any, Callable, Dict, Generator, List
from ...utils import compose
DefinitionList = List[Definition]
def compose(*functions: Callable) -> Callable:
"""Compose multiple functions into a single one."""
def noop(x: Any) -> Any:
return x
... | A maker function to avoid code duplication. |
34,768 | from __future__ import annotations
import json
from typing import Any, Callable, Dict, Generator, List
from ...utils import compose
DefinitionList = List[Definition]
def _serialize_path_openapi3(
name: str, type_: str, style: str | None, explode: bool | None
) -> Generator[Callable | None, None, None]:
if style... | Different collection styles for Open API 3.0. |
34,769 | from __future__ import annotations
import json
from typing import Any, Callable, Dict, Generator, List
from ...utils import compose
DefinitionList = List[Definition]
def delimited(item: Generated, name: str, delimiter: str) -> None:
item[name] = delimiter.join(map(str, force_iterable(item[name] or ())))
def to_stri... | Different collection formats for Open API 2.0. |
34,770 | from __future__ import annotations
import json
from typing import Any, Callable, Dict, Generator, List
from ...utils import compose
Generated = Dict[str, Any]
MapFunction = Callable[[Generated], Generated]
def conversion(func: Callable[..., None]) -> Callable:
def _wrapper(name: str, **kwargs: Any) -> MapFunction:... | null |
34,771 | from __future__ import annotations
from typing import TYPE_CHECKING, Any, Generator, NoReturn
from ... import failures
from ...exceptions import (
get_headers_error,
get_malformed_media_type_error,
get_missing_content_type_error,
get_response_type_error,
get_status_code_error,
)
from ...transports.c... | null |
34,772 | from __future__ import annotations
from typing import TYPE_CHECKING, Any, Generator, NoReturn
from ... import failures
from ...exceptions import (
get_headers_error,
get_malformed_media_type_error,
get_missing_content_type_error,
get_response_type_error,
get_status_code_error,
)
from ...transports.c... | null |
34,773 | from __future__ import annotations
from typing import TYPE_CHECKING, Any, Generator, NoReturn
from ... import failures
from ...exceptions import (
get_headers_error,
get_malformed_media_type_error,
get_missing_content_type_error,
get_response_type_error,
get_status_code_error,
)
from ...transports.c... | null |
34,774 | from __future__ import annotations
from typing import TYPE_CHECKING, Any, Generator, NoReturn
from ... import failures
from ...exceptions import (
get_headers_error,
get_malformed_media_type_error,
get_missing_content_type_error,
get_response_type_error,
get_status_code_error,
)
from ...transports.c... | null |
34,775 | from __future__ import annotations
from contextlib import suppress
from dataclasses import dataclass
from functools import lru_cache
from itertools import chain, cycle, islice
from typing import TYPE_CHECKING, Any, Generator, Union, cast
import requests
from hypothesis.strategies import SearchStrategy
from hypothesis_j... | Build a set of strategies that generate test cases based on explicit examples in the schema. |
34,776 | from __future__ import annotations
import json
from dataclasses import dataclass
from typing import Any, ClassVar, Iterable
from ...exceptions import OperationSchemaError
from ...models import APIOperation
from ...parameters import Parameter
from .converter import to_json_schema_recursive
MISSING_SCHEMA_OR_CONTENT_MESS... | Extract `schema` from Open API 3.0 `Parameter`. |
34,777 | from __future__ import annotations
import re
from ...types import Filter
def _ensure_tuple(item: Filter) -> list | set | tuple:
if not isinstance(item, (list, set, tuple)):
return (item,)
return item
Filter = Union[str, List[str], Tuple[str], Set[str], NotSet]
def should_skip_method(method: str, patte... | null |
34,778 | from __future__ import annotations
import re
from ...types import Filter
def _match_any_pattern(target: str, pattern: Filter) -> bool:
Filter = Union[str, List[str], Tuple[str], Set[str], NotSet]
def should_skip_endpoint(endpoint: str, pattern: Filter | None) -> bool:
if pattern is None:
return False
... | null |
34,779 | from __future__ import annotations
import re
from ...types import Filter
def _ensure_tuple(item: Filter) -> list | set | tuple:
if not isinstance(item, (list, set, tuple)):
return (item,)
return item
Filter = Union[str, List[str], Tuple[str], Set[str], NotSet]
def should_skip_by_tag(tags: list[str] | ... | null |
34,780 | from __future__ import annotations
import re
from ...types import Filter
def _match_any_pattern(target: str, pattern: Filter) -> bool:
patterns = _ensure_tuple(pattern)
return any(re.search(item, target) for item in patterns)
Filter = Union[str, List[str], Tuple[str], Set[str], NotSet]
def should_skip_by_oper... | null |
34,781 | from __future__ import annotations
import re
from ...types import Filter
def should_skip_deprecated(is_deprecated: bool, skip_deprecated_operations: bool) -> bool:
return skip_deprecated_operations and is_deprecated | null |
34,782 | from __future__ import annotations
from dataclasses import dataclass
from typing import Any, ClassVar, Generator
from jsonschema import RefResolver
from ...models import APIOperation
from .parameters import OpenAPI20Parameter, OpenAPI30Parameter, OpenAPIParameter
def make_auth_header_schema(definition: dict[str, Any])... | null |
34,783 | from __future__ import annotations
from dataclasses import dataclass
from typing import Any, ClassVar, Generator
from jsonschema import RefResolver
from ...models import APIOperation
from .parameters import OpenAPI20Parameter, OpenAPI30Parameter, OpenAPIParameter
def make_auth_header(**kwargs: Any) -> dict[str, Any]:
... | null |
34,784 | from __future__ import annotations
from dataclasses import dataclass
from typing import Any, ClassVar, Generator
from jsonschema import RefResolver
from ...models import APIOperation
from .parameters import OpenAPI20Parameter, OpenAPI30Parameter, OpenAPIParameter
def make_api_key_schema(definition: dict[str, Any], **k... | null |
34,785 | from __future__ import annotations
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Callable, Dict, Union, overload
from urllib.request import urlopen
import jsonschema
import requests
from ...constants import DEFAULT_RESPONSE_TIMEOUT
from ...internal.copy import fast_deepcopy
f... | Load a schema from the given file. |
34,786 | from __future__ import annotations
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Callable, Dict, Union, overload
from urllib.request import urlopen
import jsonschema
import requests
from ...constants import DEFAULT_RESPONSE_TIMEOUT
from ...internal.copy import fast_deepcopy
f... | Load a schema from the given file uri. |
34,787 | from __future__ import annotations
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Callable, Dict, Union, overload
from urllib.request import urlopen
import jsonschema
import requests
from ...constants import DEFAULT_RESPONSE_TIMEOUT
from ...internal.copy import fast_deepcopy
f... | Load the resource and parse it as YAML / JSON. |
34,788 | from __future__ import annotations
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Callable, Dict, Union, overload
from urllib.request import urlopen
import jsonschema
import requests
from ...constants import DEFAULT_RESPONSE_TIMEOUT
from ...internal.copy import fast_deepcopy
f... | Remove optional parts of the schema that contain references. It covers only the most popular cases, as removing all optional parts is complicated. We might fall back to filtering out invalid cases in the future. |
34,789 | from __future__ import annotations
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Callable, Dict, Union, overload
from urllib.request import urlopen
import jsonschema
import requests
from ...constants import DEFAULT_RESPONSE_TIMEOUT
from ...internal.copy import fast_deepcopy
f... | Implementation is adapted from Rust's `serde-json` crate. Ref: https://github.com/serde-rs/json/blob/master/src/value/mod.rs#L751 |
34,790 | from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Callable, Dict, List
import hypothesis.strategies as st
from requests.structures import CaseInsensitiveDict
from ..links import OpenAPILink, get_all_links
from ..utils import expand_status_code
class Connection:
s... | Gather all connections based on Open API links definitions. |
34,791 | from __future__ import annotations
from functools import lru_cache
from typing import Generator
from . import lexer, nodes
from .errors import RuntimeExpressionError, UnknownToken
def _parse(expr: str) -> Generator[nodes.Node, None, None]:
tokens = lexer.tokenize(expr)
brackets_stack: list[str] = []
for tok... | Parse lexical tokens into concrete expression nodes. |
34,792 | from __future__ import annotations
import enum
from dataclasses import dataclass
from functools import wraps
from typing import Any, Callable, Sequence, TypeVar
from hypothesis import reject
from hypothesis import strategies as st
from hypothesis.strategies._internal.featureflags import FeatureStrategy
from ....interna... | Immediately return FAILURE for schemas with types not from ``allowed_types``. |
34,793 | from __future__ import annotations
from itertools import chain
from typing import Any, Callable
from ...internal.jsonschema import traverse_schema
from ...internal.copy import fast_deepcopy
def to_json_schema(
schema: dict[str, Any], *, nullable_name: str, copy: bool = True, is_response_schema: bool = False
) -> di... | null |
34,794 | from __future__ import annotations
from typing import TYPE_CHECKING, Any, Collection
MEDIA_TYPES: dict[str, st.SearchStrategy[bytes]] = {}
class SerializerContext:
"""The context for serialization process.
:ivar Case case: Generated example that is being processed.
"""
case: Case
def media_type(... | Register a strategy for the given media type. |
34,795 | from __future__ import annotations
from typing import TYPE_CHECKING, Any, Collection
MEDIA_TYPES: dict[str, st.SearchStrategy[bytes]] = {}
def unregister(media_type: str) -> None:
"""Remove registered serializer for the given media type."""
del SERIALIZERS[media_type]
def unregister_all() -> None:
from ..... | null |
34,796 | from __future__ import annotations
import io
import json
import pathlib
import re
from typing import IO, Any, Callable, cast, TYPE_CHECKING
from urllib.parse import urljoin
from ... import experimental, fixups
from ...code_samples import CodeSampleStyle
from ...generation import (
DEFAULT_DATA_GENERATION_METHODS,
... | Load Open API schema via a file from an OS path. :param path: A path to the schema file. :param encoding: The name of the encoding used to decode the file. |
34,797 | from __future__ import annotations
import io
import json
import pathlib
import re
from typing import IO, Any, Callable, cast, TYPE_CHECKING
from urllib.parse import urljoin
from ... import experimental, fixups
from ...code_samples import CodeSampleStyle
from ...generation import (
DEFAULT_DATA_GENERATION_METHODS,
... | Load schema from a ``pytest`` fixture. It is useful if you don't want to make network requests during module loading. With this loader you can defer it to a fixture. Note, the fixture should return a ``BaseSchema`` instance loaded with another loader. :param str fixture_name: The name of a fixture to load. |
34,798 | from __future__ import annotations
import io
import json
import pathlib
import re
from typing import IO, Any, Callable, cast, TYPE_CHECKING
from urllib.parse import urljoin
from ... import experimental, fixups
from ...code_samples import CodeSampleStyle
from ...generation import (
DEFAULT_DATA_GENERATION_METHODS,
... | null |
34,799 | from __future__ import annotations
import string
from base64 import b64encode
from contextlib import suppress
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Callable, Dict, Iterable, Optional
from urllib.parse import quote_plus
from weakref import WeakKeyDictionary
from hypoth... | null |
34,800 | from __future__ import annotations
import enum
from dataclasses import dataclass, field
from difflib import get_close_matches
from enum import unique
from typing import (
Any,
Callable,
Generator,
Sequence,
TypeVar,
cast,
TYPE_CHECKING,
NoReturn,
MutableMapping,
Iterator,
)
from ... | null |
34,801 | from __future__ import annotations
from functools import lru_cache
from typing import TYPE_CHECKING
from ...exceptions import UsageError
CUSTOM_SCALARS: dict[str, st.SearchStrategy[graphql.ValueNode]] = {}
class UsageError(Exception):
"""Incorrect usage of Schemathesis functions."""
The provided code snippet incl... | Register a new strategy for generating custom scalars. :param str name: Scalar name. It should correspond the one used in the schema. :param strategy: Hypothesis strategy you'd like to use to generate values for this scalar. |
34,802 | from __future__ import annotations
from typing import TYPE_CHECKING
__all__ = [ # noqa: F822
"Boolean",
"Enum",
"Float",
"Int",
"List",
"Null",
"Object",
"String",
]
def __getattr__(name: str) -> ValueNode | None:
if name in __all__:
import hypothesis_graphql.nodes
... | null |
34,803 | from __future__ import annotations
import json
import pathlib
from functools import lru_cache
from json import JSONDecodeError
from typing import IO, TYPE_CHECKING, Any, Callable, Dict, NoReturn, cast
from ...code_samples import CodeSampleStyle
from ...constants import WAIT_FOR_SCHEMA_INTERVAL
from ...exceptions import... | Load GraphQL schema via a file from an OS path. :param path: A path to the schema file. :param encoding: The name of the encoding used to decode the file. |
34,804 | from __future__ import annotations
import json
import pathlib
from functools import lru_cache
from json import JSONDecodeError
from typing import IO, TYPE_CHECKING, Any, Callable, Dict, NoReturn, cast
from ...code_samples import CodeSampleStyle
from ...constants import WAIT_FOR_SCHEMA_INTERVAL
from ...exceptions import... | Load GraphQL schema from the network. :param url: Schema URL. :param Optional[str] base_url: Base URL to send requests to. :param Optional[int] port: An optional port if you don't want to pass the ``base_url`` parameter, but only to change port in ``url``. :param app: A WSGI app instance. :return: GraphQLSchema |
34,805 | from __future__ import annotations
import json
import pathlib
from functools import lru_cache
from json import JSONDecodeError
from typing import IO, TYPE_CHECKING, Any, Callable, Dict, NoReturn, cast
from ...code_samples import CodeSampleStyle
from ...constants import WAIT_FOR_SCHEMA_INTERVAL
from ...exceptions import... | null |
34,806 | from __future__ import annotations
from typing import TYPE_CHECKING
from ...hooks import HookContext, register, unregister
def before_add_examples(context: HookContext, examples: list[Case]) -> None:
if not examples and context.operation is not None:
from ..._hypothesis import add_single_example
str... | null |
34,807 | from __future__ import annotations
from typing import TYPE_CHECKING
from ...hooks import HookContext, register, unregister
def before_add_examples(context: HookContext, examples: list[Case]) -> None:
if not examples and context.operation is not None:
from ..._hypothesis import add_single_example
str... | null |
34,808 | FORMAT_NAME = "uuid"
def install() -> None:
from ....specs import openapi
from hypothesis import strategies as st
openapi.format(FORMAT_NAME, st.uuids().map(str)) | null |
34,809 |
def uninstall() -> None:
from ....specs import openapi
openapi.unregister_string_format("uuid") | null |
34,810 | from __future__ import annotations
import warnings
from typing import TYPE_CHECKING
from ..hooks import HookContext, register, unregister
def before_generate_case(context: HookContext, strategy: st.SearchStrategy[Case]) -> st.SearchStrategy[Case]:
seen = set()
def is_not_seen(case: Case) -> bool:
# Calc... | null |
34,811 | from __future__ import annotations
import warnings
from typing import TYPE_CHECKING
from ..hooks import HookContext, register, unregister
def before_generate_case(context: HookContext, strategy: st.SearchStrategy[Case]) -> st.SearchStrategy[Case]:
seen = set()
def is_not_seen(case: Case) -> bool:
# Calc... | null |
34,812 | from __future__ import annotations
import sys
import json
from typing import Union, TYPE_CHECKING, NoReturn, Any
from .._compat import JSONMixin
from werkzeug.wrappers import Response as BaseResponse
GenericResponse = Union["httpxResponse", "requestsResponse", WSGIResponse]
def get_payload(response: GenericResponse) -... | null |
34,813 | from __future__ import annotations
from typing import TYPE_CHECKING
import json
from . import failures
from .exceptions import get_server_error, get_response_parsing_error
from .specs.openapi.checks import (
content_type_conformance,
response_headers_conformance,
response_schema_conformance,
status_code... | A check to verify that the response is not a server-side error. |
34,814 | from __future__ import annotations
from typing import TYPE_CHECKING
import json
from . import failures
from .exceptions import get_server_error, get_response_parsing_error
from .specs.openapi.checks import (
content_type_conformance,
response_headers_conformance,
response_schema_conformance,
status_code... | Register a new check for schemathesis CLI. :param check: A function to validate API responses. .. code-block:: python @schemathesis.check def new_check(response, case): # some awesome assertions! ... |
34,815 | from __future__ import annotations
import inspect
import threading
import time
import warnings
from dataclasses import dataclass, field
from typing import (
TYPE_CHECKING,
Any,
Callable,
Generic,
TypeVar,
overload,
runtime_checkable,
Protocol,
)
from .exceptions import UsageError
from .f... | null |
34,816 | from __future__ import annotations
import datetime
import inspect
import textwrap
from collections import Counter
from contextlib import contextmanager
from dataclasses import dataclass, field
from enum import Enum
from functools import partial, lru_cache
from itertools import chain
from logging import LogRecord
from t... | Prepare request data for generating code samples. |
34,817 | from __future__ import annotations
import datetime
import inspect
import textwrap
from collections import Counter
from contextlib import contextmanager
from dataclasses import dataclass, field
from enum import Enum
from functools import partial, lru_cache
from itertools import chain
from logging import LogRecord
from t... | null |
34,818 | from __future__ import annotations
import datetime
import inspect
import textwrap
from collections import Counter
from contextlib import contextmanager
from dataclasses import dataclass, field
from enum import Enum
from functools import partial, lru_cache
from itertools import chain
from logging import LogRecord
from t... | Check arguments for `requests.Session.request`. Some arguments can be valid for cases like ASGI integration, but at the same time they won't work for the regular `requests` calls. In such cases we need to avoid an obscure error message, that comes from `requests`. |
34,819 | from __future__ import annotations
import datetime
import inspect
import textwrap
from collections import Counter
from contextlib import contextmanager
from dataclasses import dataclass, field
from enum import Enum
from functools import partial, lru_cache
from itertools import chain
from logging import LogRecord
from t... | Set cookies required for a call. |
34,820 | from __future__ import annotations
from dataclasses import dataclass, field
from inspect import signature
from typing import Any, Callable, Generator
import pytest
from _pytest.fixtures import FixtureRequest
from hypothesis.core import HypothesisHandle
from hypothesis.errors import Flaky
from hypothesis.internal.escala... | null |
34,821 | from __future__ import annotations
from dataclasses import dataclass, field
from inspect import signature
from typing import Any, Callable, Generator
import pytest
from _pytest.fixtures import FixtureRequest
from hypothesis.core import HypothesisHandle
from hypothesis.errors import Flaky
from hypothesis.internal.escala... | null |
34,822 | from __future__ import annotations
from dataclasses import dataclass, field
from inspect import signature
from typing import Any, Callable, Generator
import pytest
from _pytest.fixtures import FixtureRequest
from hypothesis.core import HypothesisHandle
from hypothesis.errors import Flaky
from hypothesis.internal.escala... | Make a test node name. For example: test_api[GET /users]. |
34,823 | from __future__ import annotations
from dataclasses import dataclass, field
from inspect import signature
from typing import Any, Callable, Generator
import pytest
from _pytest.fixtures import FixtureRequest
from hypothesis.core import HypothesisHandle
from hypothesis.errors import Flaky
from hypothesis.internal.escala... | Run the given subtest with pytest fixtures. |
34,824 | from __future__ import annotations
from dataclasses import dataclass, field
from inspect import signature
from typing import Any, Callable, Generator
import pytest
from _pytest.fixtures import FixtureRequest
from hypothesis.core import HypothesisHandle
from hypothesis.errors import Flaky
from hypothesis.internal.escala... | Run a failing test, that will show the underlying problem. |
34,825 | from __future__ import annotations
from dataclasses import dataclass, field
from inspect import signature
from typing import Any, Callable, Generator
import pytest
from _pytest.fixtures import FixtureRequest
from hypothesis.core import HypothesisHandle
from hypothesis.errors import Flaky
from hypothesis.internal.escala... | Loads a schema from the fixture. |
34,826 | from __future__ import annotations
from dataclasses import dataclass, field
from inspect import signature
from typing import Any, Callable, Generator
import pytest
from _pytest.fixtures import FixtureRequest
from hypothesis.core import HypothesisHandle
from hypothesis.errors import Flaky
from hypothesis.internal.escala... | Load fixtures, needed for the test function. |
34,827 | from __future__ import annotations
from enum import Enum
from functools import lru_cache
from shlex import quote
from typing import TYPE_CHECKING
from .constants import SCHEMATHESIS_TEST_CASE_HEADER
from .types import Headers
def get_excluded_headers() -> CaseInsensitiveDict:
from requests.structures import CaseIns... | null |
34,828 | from __future__ import annotations
from enum import Enum
from functools import lru_cache
from shlex import quote
from typing import TYPE_CHECKING
from .constants import SCHEMATHESIS_TEST_CASE_HEADER
from .types import Headers
Headers = Dict[str, Any]
The provided code snippet includes necessary dependencies for imple... | Create a cURL command to reproduce an HTTP request. |
34,829 | from __future__ import annotations
from enum import Enum
from functools import lru_cache
from shlex import quote
from typing import TYPE_CHECKING
from .constants import SCHEMATHESIS_TEST_CASE_HEADER
from .types import Headers
def _escape_single_quotes(url: str) -> str:
"""Escape single quotes in a string, so it is ... | Create a Python code to reproduce an HTTP request. |
34,830 | from __future__ import annotations
import enum
import json
import re
import traceback
from dataclasses import dataclass, field
from hashlib import sha1
from json import JSONDecodeError
from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable, Generator, NoReturn
from .constants import SERIALIZERS... | Keep only unique failed checks. |
34,831 | from __future__ import annotations
import enum
import json
import re
import traceback
from dataclasses import dataclass, field
from hashlib import sha1
from json import JSONDecodeError
from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable, Generator, NoReturn
from .constants import SERIALIZERS... | Return new exception for schema validation error. |
34,832 | from __future__ import annotations
import enum
import json
import re
import traceback
from dataclasses import dataclass, field
from hashlib import sha1
from json import JSONDecodeError
from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable, Generator, NoReturn
from .constants import SERIALIZERS... | Request took too long. |
34,833 | from __future__ import annotations
import enum
import json
import re
import traceback
from dataclasses import dataclass, field
from hashlib import sha1
from json import JSONDecodeError
from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable, Generator, NoReturn
from .constants import SERIALIZERS... | null |
34,834 | from __future__ import annotations
import re
from dataclasses import dataclass, field
from functools import partial
from types import SimpleNamespace
from typing import TYPE_CHECKING, Callable, List, Union, Protocol
from .exceptions import UsageError
class HasAPIOperation(Protocol):
operation: APIOperation
def get_... | null |
34,835 | from __future__ import annotations
import re
from dataclasses import dataclass, field
from functools import partial
from types import SimpleNamespace
from typing import TYPE_CHECKING, Callable, List, Union, Protocol
from .exceptions import UsageError
class HasAPIOperation(Protocol):
def get_operation_attribute(operatio... | null |
34,836 | from __future__ import annotations
import re
from dataclasses import dataclass, field
from functools import partial
from types import SimpleNamespace
from typing import TYPE_CHECKING, Callable, List, Union, Protocol
from .exceptions import UsageError
class HasAPIOperation(Protocol):
operation: APIOperation
def get_... | null |
34,837 | from __future__ import annotations
import re
from dataclasses import dataclass, field
from functools import partial
from types import SimpleNamespace
from typing import TYPE_CHECKING, Callable, List, Union, Protocol
from .exceptions import UsageError
MatcherFunc = Callable[[HasAPIOperation], bool]
FilterValue = Union[s... | Attach a filtering function to an object, which allows chaining of filter criteria. For example: >>> def auth(): ... >>> filter_set = FilterSet() >>> attach_filter_chain(auth, "apply_to", filter_set.include) >>> auth.apply_to(method="GET", path="/users/") This will add a new `apply_to` method to `auth` that matches onl... |
34,838 | 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... | null |
34,839 | 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 on a strategy that generates values for ``path_parameters``. |
34,840 | 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 on a strategy that generates values for ``headers``. |
34,841 | 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 on a strategy that generates values for ``cookies``. |
34,842 | 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 on a strategy that generates values for ``query``. |
34,843 | 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 on a strategy that generates values for ``body``. |
34,844 | 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 API path is processed. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.