-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
ruff 0.7 gives a false positive for SIM115 on something like:
def my_function(filepath, encoding):
return bz2.open(filepath, mode="rt", encoding=encoding)which can be resolved like:
def my_function(filepath, encoding):
with bz2.open(filepath, mode="rt", encoding=encoding) as f:
return fBut this prevents the calling function from being able to work with f because the context manager has closed it. It seems that SIM115 should not trigger when returning a file handler object from a function?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule