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

pyupgrade: Modernize syntax for Python >= 3.7 #1080

Closed
wants to merge 1 commit into from

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Jan 23, 2023

@@ -153,14 +153,14 @@ def inspect_member(node, name_prefix=''):
anchorfile = node.find('anchorfile').text
anchor = node.find('anchor').text

url = '%s/%s#%s' % (doxygen_base, anchorfile, anchor)
url = '{}/{}#{}'.format(doxygen_base, anchorfile, anchor)
Copy link
Member

Choose a reason for hiding this comment

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

This could be an f-string


doxygen[name] = {'url': url}

if node.attrib['kind'] == 'function':
ret_type = node.find('type').text
arglist = node.find('arglist').text
sig = '%s %s%s' % (ret_type, name, arglist)
sig = '{} {}{}'.format(ret_type, name, arglist)
Copy link
Member

Choose a reason for hiding this comment

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

This could also be an f-string

@jlaine
Copy link
Member

jlaine commented Jan 23, 2023

I like:

  • dropping the "object" base class
  • removing obsolete u".." markers

The string formatting changes however are quite arbitrary and not even consistent. Sometimes f-string are used, sometimes not..

@cclauss
Copy link
Contributor Author

cclauss commented Jan 23, 2023

https://pypi.org/project/flynt will be more aggressive with f-string conversion while pyupgrade explains why it is intentionally timid https://github.com/asottile/pyupgrade#f-strings

@cclauss
Copy link
Contributor Author

cclauss commented Jan 25, 2023

Should I run flynt also?

@jlaine
Copy link
Member

jlaine commented Oct 30, 2023

I've cherry-picked the changes I'm comfortable with in #1202

@jlaine jlaine closed this Oct 30, 2023
@cclauss cclauss deleted the pyupgrade_--py37-plus branch October 30, 2023 16:31
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.

2 participants