Conversation
…sion bump to v0.0.41 (#133) Major updates: - Adding `process_receipts_typed` that returns a dataclass typed event when given a transaction receipt. - Adding `combomethod_typed` that allows for combomethods that preserve types, and propagating the change throughout. - Similar to solution in eth-utils here: ethereum/eth-utils#264 - Renaming `get_typed_logs` to `get_logs_typed` for consistency. - Adding `BaseEventArgs` and frozen dataclass attribute for arg subclassing. This also ensures the `arg` field exists in all event types.
|
@kclowes hi, would know if this change could get merged or if anything more needs to do? |
|
Thanks for this, @darwintree. We'd need to hold this for our next breaking release cycle since it's used by other of our libs. When I import your update into |
Hi, thank you for reply. I would inspect this might be a mypy version issue and would first check if current mypy version supports the used feature. It can currently work well in default pylance and bring expected hint, but sorry for I did not check mypy compatibility yet. I would later check simple cases in mypy and tell you if there is any progress |
|
There is another possibility that eth_account is actually not a well type -hinted lib. Some type error is masked by legacy combomethod and now they are revealed |
|
@pacrob Hi, I just confirmed that after mypy 1.0.0, the
dependency versions: |
|
Hey, guys! Any updates on that one? @combomethod decorator causes any IDE to ignore type hints of functions that use it (such as any web3.Web3 methods). Would you consider one-liner solution if I was to propose it instead of this solution? if TYPE_CHECKING:
combomethod = Callable[[T], T]
else:
class combomethod:
def __init__(self, method: Callable[..., Any]) -> None:
self.method = method
def __get__(
self, obj: Optional[T] = None, objtype: Optional[Type[T]] = None
) -> Callable[..., Any]:
@functools.wraps(self.method)
def _wrapper(*args: Any, **kwargs: Any) -> Any:
if obj is not None:
return self.method(obj, *args, **kwargs)
else:
return self.method(objtype, *args, **kwargs)
return _wrapper |


What was wrong?
Related to Issue #236
Closes #236
How was it fixed?
This commit adopts the solution from here. It uses
ParamSpecandConcatenateadded in python3.10. And in order to use this feature minor to 3.10,typing-extensionsdependency is added insetup.pyTodo:
Clean up commit history
Add or update documentation related to these changes
Add entry to the release notes
Cute Animal Picture