JerilynFranz / JerilynFranz/python-simplebench

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

オープン
#4 コメント 0 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。