Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Run pyupgrade on codebase#1856

Closed
iamonuwa wants to merge 1 commit intoethereum:mainfrom
iamonuwa:master
Closed

Run pyupgrade on codebase#1856
iamonuwa wants to merge 1 commit intoethereum:mainfrom
iamonuwa:master

Conversation

@iamonuwa
Copy link
Contributor

What was wrong?

Fixes #1814

How was it fixed?

Run pyupgrade against the repo

To-Do

  • Clean up commit history

Cute Animal Picture

put a cute animal picture link inside the parentheses

return getattr(module, class_name)
except AttributeError:
msg = 'Module "%s" does not define a "%s" attribute/class' % (
msg = 'Module "{}" does not define a "{}" attribute/class'.format(
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this could become an f-string, too?

except AttributeError:
raise ImportError(
"Unable to derive appropriate import path for {0}".format(
"Unable to derive appropriate import path for {}".format(
Copy link
Contributor

Choose a reason for hiding this comment

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

This could also become an f-string

if value < 0:
raise ValueError(
"Value cannot be negative: Got: {0}".format(
"Value cannot be negative: Got: {}".format(
Copy link
Contributor

Choose a reason for hiding this comment

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

All of the above could become f-strings

public_key = signature.recover_public_key_from_msg(message)
except BadSignature as e:
raise ValidationError("Bad Signature: {0}".format(str(e)))
raise ValidationError("Bad Signature: {}".format(str(e)))
Copy link
Contributor

Choose a reason for hiding this comment

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

This could also become an f-string

Copy link
Contributor

@cburgdorf cburgdorf left a comment

Choose a reason for hiding this comment

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

Nice cleanup! There are still a lot of places that could become f-strings. I commented some of them. Not sure how py-ugrade decides when to automatically turn things into f-string or not but as you are already on it, mind changing the missing ones?

@pacrob pacrob mentioned this pull request Dec 20, 2023
3 tasks
@pacrob pacrob closed this in #2128 Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run pyupgrade on the codebase and clean things up.

2 participants