JerilynFranz / JerilynFranz/python-simplebench

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

Open
#4 0 comments 0 reactions 1 assignee Claimed by @JerilynFranz View on GitHub
documentation enhancement
Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.