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
2 changes: 1 addition & 1 deletion src/fastapi_toolsets/crud/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ async def dependency(**kwargs: Any) -> dict[str, list[str]]:
return {k: v for k, v in kwargs.items() if v is not None}

dependency.__name__ = f"{cls.model.__name__}FilterParams"
dependency.__signature__ = inspect.Signature( # type: ignore[attr-defined]
dependency.__signature__ = inspect.Signature( # type: ignore[attr-defined] # ty:ignore[unresolved-attribute]
parameters=[
inspect.Parameter(
k,
Expand Down
2 changes: 1 addition & 1 deletion src/fastapi_toolsets/exceptions/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def init_exceptions_handlers(app: FastAPI) -> FastAPI:
"""
_register_exception_handlers(app)
_original_openapi = app.openapi
app.openapi = lambda: _patched_openapi(app, _original_openapi) # type: ignore[method-assign]
app.openapi = lambda: _patched_openapi(app, _original_openapi) # type: ignore[method-assign] # ty:ignore[invalid-assignment]
return app


Expand Down
2 changes: 1 addition & 1 deletion src/fastapi_toolsets/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def configure_logging(
_SENTINEL = object()


def get_logger(name: str | None = _SENTINEL) -> logging.Logger: # type: ignore[assignment]
def get_logger(name: str | None = _SENTINEL) -> logging.Logger: # type: ignore[assignment] # ty:ignore[invalid-parameter-default]
"""Return a logger with the given *name*.

A thin convenience wrapper around :func:`logging.getLogger` that keeps
Expand Down
3 changes: 2 additions & 1 deletion src/fastapi_toolsets/pytest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ async def db_session(worker_db_url):
worker_url = worker_database_url(
database_url=database_url, default_test_db=default_test_db
)
worker_db_name: str = make_url(worker_url).database # type: ignore[assignment]
worker_db_name = make_url(worker_url).database
assert worker_db_name is not None

engine = create_async_engine(database_url, isolation_level="AUTOCOMMIT")
try:
Expand Down
6 changes: 3 additions & 3 deletions src/fastapi_toolsets/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,18 @@ class PaginatedResponse(BaseResponse, Generic[DataT]):

_discriminated_union_cache: ClassVar[dict[Any, Any]] = {}

def __class_getitem__( # type: ignore[invalid-method-override]
def __class_getitem__( # ty:ignore[invalid-method-override]
cls, item: type[Any] | tuple[type[Any], ...]
) -> type[Any]:
if cls is PaginatedResponse and not isinstance(item, TypeVar):
cached = cls._discriminated_union_cache.get(item)
if cached is None:
cached = Annotated[
Union[CursorPaginatedResponse[item], OffsetPaginatedResponse[item]], # type: ignore[invalid-type-form]
Union[CursorPaginatedResponse[item], OffsetPaginatedResponse[item]], # ty:ignore[invalid-type-form]
Field(discriminator="pagination_type"),
]
cls._discriminated_union_cache[item] = cached
return cached # type: ignore[invalid-return-type]
return cached # ty:ignore[invalid-return-type]
return super().__class_getitem__(item)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -2566,7 +2566,7 @@ async def test_unknown_pagination_type_raises(self, db_session: AsyncSession):
db_session,
pagination_type="unknown",
schema=RoleRead,
) # type: ignore[no-matching-overload]
) # type: ignore[no-matching-overload] # ty:ignore[no-matching-overload]

@pytest.mark.anyio
async def test_offset_include_total_false(self, db_session: AsyncSession):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_crud_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ def test_dependency_name_includes_model_name(self):
UserFacetCrud = CrudFactory(User, facet_fields=[User.username])
dep = UserFacetCrud.filter_params()

assert dep.__name__ == "UserFilterParams" # type: ignore[union-attr]
assert dep.__name__ == "UserFilterParams" # type: ignore[union-attr] # ty:ignore[unresolved-attribute]

@pytest.mark.anyio
async def test_integration_with_offset_paginate(self, db_session: AsyncSession):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ async def test_creates_database(self):
.set(database="test_create_db_general")
.render_as_string(hide_password=False)
)
expected_db: str = make_url(target_url).database # type: ignore[assignment]
expected_db = make_url(target_url).database
assert expected_db is not None

engine = create_async_engine(DATABASE_URL, isolation_level="AUTOCOMMIT")
try:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

async def mock_get_db() -> AsyncGenerator[AsyncSession, None]:
"""Mock session dependency for testing."""
yield None
yield None # type: ignore[misc] # ty:ignore[invalid-yield]


MockSessionDep = Annotated[AsyncSession, Depends(mock_get_db)]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_init_metrics_stub_raises_without_prometheus(self):
with patch("builtins.__import__", side_effect=blocking_import):
mod = importlib.import_module("fastapi_toolsets.metrics")
with pytest.raises(ImportError, match="prometheus_client"):
mod.init_metrics(None, None) # type: ignore[arg-type]
mod.init_metrics(None, None) # type: ignore[arg-type] # ty:ignore[invalid-argument-type]
finally:
for key in list(sys.modules):
if key.startswith("fastapi_toolsets.metrics"):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def test_pagination_type_default_cannot_be_overridden_to_cursor(self):
pagination=OffsetPagination(
total_count=0, items_per_page=10, page=1, has_more=False
),
pagination_type=PaginationType.CURSOR, # type: ignore[arg-type]
pagination_type=PaginationType.CURSOR, # type: ignore[arg-type] # ty:ignore[invalid-argument-type]
)

def test_filter_attributes_defaults_to_none(self):
Expand Down Expand Up @@ -638,7 +638,7 @@ def test_pagination_type_default_cannot_be_overridden_to_offset(self):
pagination=CursorPagination(
next_cursor=None, items_per_page=10, has_more=False
),
pagination_type=PaginationType.OFFSET, # type: ignore[arg-type]
pagination_type=PaginationType.OFFSET, # type: ignore[arg-type] # ty:ignore[invalid-argument-type]
)

def test_full_serialization(self):
Expand Down
36 changes: 18 additions & 18 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading