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

[Adjust Rule] SIM908 doesn't work for python 3.7 #159

Open
kasium opened this issue Oct 24, 2022 · 0 comments
Open

[Adjust Rule] SIM908 doesn't work for python 3.7 #159

kasium opened this issue Oct 24, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@kasium
Copy link

kasium commented Oct 24, 2022

Desired change

  • Rule(s): SIM908
  • Adjustment: should work reliable across different python versions

Explanation

For python3.7 the rule doesn't work when f-strings are somehow used in functions. However, in pyrhon3.11 it works as expected

Example

import os

def get_framework_info():
    if f"foo" in os.environ:
        port = os.environ[f"foo"]

python3.7: nothing
python3.11: Use 'os.environ.get(f"""foo""")' instead of 'if f"""foo""" in os.environ: os.environ[f"""foo"""]'

@kasium kasium added the enhancement New feature or request label Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants