JerilynFranz / JerilynFranz/python-simplebench

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

未关闭
#4 0 条评论 0 个 reaction 已指派 1 人 已被 @JerilynFranz 认领 在 GitHub 查看
documentation enhancement
主要语言
Python
星标
1
派生
0
PR 合并指标
30 天内没有已合并 PR

描述

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.
"""
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。