ethereum / ethereum/eth-utils

Provide better type hints for combomethod

Open
#236 0 comments 1 reaction 0 assignees View on GitHub
p3
Dominant language
Python
Stars
335
Forks
167
PR merge metrics
No merged PRs in 30d

Description

## What was wrong?

The decorator `combomethod` is widely used in `web3.py`, `eth-account` packages. However, the language server cannot infer the type of the arguments from function wrapped by `combomethod`.

## How can it be fixed?

Use [ParamSpec](https://docs.python.org/3/library/typing.html#typing.ParamSpec) added in python3.10 could fix this problem. As we need to provide support for versions minor to 3.10, we can import ParamSpec from typing-extensions. [Here](https://github.com/microsoft/pylance-release/issues/3142#issuecomment-1207164159) is a good solution.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.