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

functions using context managers wrongly detected as not pure #17

Open
martinResearch opened this issue Sep 26, 2021 · 0 comments
Open
Labels
bug Something isn't working

Comments

@martinResearch
Copy link

Describe the bug
Variables assigned from contextmanager are not detected as local variables.

To Reproduce
run

from contextlib import contextmanager
from mr_proper.main import check_file


@contextmanager
def foo():
    yield "foobar"


def main():
    with foo() as f:
        return f


if __name__ == "__main__":
    check_file(__file__, recursive=True)

This gives the ouput

foo is pure!
main is not pure because of:
        it uses external name (f)

Expected behavior
main should be detected a pure

@martinResearch martinResearch added the bug Something isn't working label Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant