Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix[ux]: shorten interface name in error messages #4359

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sandbubbles
Copy link
Collaborator

What I did

Change the string representation of interfaces to a name instead of a path. Fix #4237 and #4299.

How I did it

Use only a part of _id as the interface's string representation.

How to verify it

Test that the interface either shows as name or interface name.

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->


def __repr__(self):
return f"interface {self._id}"
return f"interface {Path(self._id).stem}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we want to change the str implementation, but not repr -- repr should attempt to be injective back to interfaces

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i changed _pp_signature to use str, i think that should be okay cause its only used for error messages

@charles-cooper charles-cooper changed the title fix[ux]: shorten interface string from path to name fix[ux]: shorten interface name in error messages Nov 23, 2024
@@ -79,7 +80,7 @@ def abi_type(self) -> ABIType:
return ABI_Address()

def __str__(self):
return self._id
return Path(self._id).stem
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the type is aliased? e.g.

from ethereum.ercs import IERC20 as BROWNBEAR

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, that would show the ierc20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display of interfaces in errors show full path
2 participants