JerilynFranz / JerilynFranz/python-simplebench

Add overloads for cache_factory decorated functions to create more friendly tooltips for factory functions

Đang mở
#4 0 bình luận 0 reaction 1 người được giao Được @JerilynFranz nhận Xem trên GitHub
documentation enhancement
Ngôn ngữ chính
Python
Star
1
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

This is a documentation enhancement. By adding overloads modeled on the code here to the factory definitions,
the issue of the cache_factory decorators producing less-than-helpful function signatures in IDE tooltips is addressed (at the expense of the addition of some boilerplate code).

```python
@overload
def session_factory() -> Session:
"""Return a default Session instance for testing purposes.

The Session is initialized with default attributes.

Args:
cache_id (CacheId, default=CACHE_DEFAULT):
An optional identifier to distinguish different cached instances.
If None, caching is disabled for this call.
"""

@overload
def session_factory(*, cache_id: CacheId = CACHE_DEFAULT) -> Session:
"""Return a default Session instance for testing purposes.

The Session is initialized with default attributes.

Args:
cache_id (CacheId, default=CACHE_DEFAULT):
An optional identifier to distinguish different cached instances.
If None, caching is disabled for this call.
"""
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.