Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ lint.per-file-ignores."tests/**" = [
lint.unfixable = [
"ERA001",
]
lint.flake8-tidy-imports.banned-api."typing.cast".msg = "typing.cast is banned: use explicit type narrowing or a typed variable instead."
lint.pydocstyle.convention = "google"

[tool.pylint]
Expand Down Expand Up @@ -242,6 +243,17 @@ MASTER.per-file-ignores = [
"docs/source/doccmd_*.py:invalid-name",
"doccmd_README_rst_*.py:invalid-name",
]
DEPRECATED_BUILTINS.bad-functions = [
# Use Pylint until Ruff can ban bare builtin calls, or until custom rules
# make this removable:
# https://github.com/astral-sh/ruff/issues/10079
# https://github.com/astral-sh/ruff/issues/970
"filter",
"getattr",
"hasattr",
"map",
"setattr",
]
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
Expand Down
10 changes: 8 additions & 2 deletions src/mock_vws/_requests_mock_server/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def wrapped(
# req_kwargs is added dynamically by the responses
# library onto PreparedRequest objects - it is not
# in the requests type stubs.
req_kwargs: dict[str, Any] = getattr(request, "req_kwargs", {})
req_kwargs: dict[str, Any] = request.__dict__.get(
"req_kwargs",
{},
)
timeout: tuple[float, float] | float | int | None = req_kwargs.get(
"timeout"
)
Expand Down Expand Up @@ -221,7 +224,10 @@ def __enter__(self) -> Self:
compiled_url_pattern = re.compile(pattern=url_pattern)

for http_method in route.http_methods:
original_callback = getattr(api, route.route_name)
original_callback = object.__getattribute__(
api,
route.route_name,
)
mock.add_callback(
method=http_method,
url=compiled_url_pattern,
Expand Down
5 changes: 4 additions & 1 deletion src/mock_vws/_respx_mock_server/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ def start_respx_router(
compiled_url_pattern = re.compile(pattern=url_pattern)

for http_method in route.http_methods:
original_callback = getattr(api, route.route_name)
original_callback = object.__getattribute__(
api,
route.route_name,
)
router.route(
method=http_method,
url=compiled_url_pattern,
Expand Down
2 changes: 1 addition & 1 deletion tests/mock_vws/test_target_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_validate_target_id_exists_uses_correct_path_segment(
"""
database = _database_with_target(target_id=target_id)

monkeypatch.setattr(
monkeypatch.setattr( # pylint: disable=bad-builtin
target=target_validators,
name="get_database_matching_server_keys",
value=partial(_always_match_database, database=database),
Expand Down
Loading