MartinThoma / flake8-simplify

❄ A flake8 plugin that helps you to simplify code
MIT License
187 stars 19 forks source link

[Adjust Rule] SIM115 false positive in a complex with statement #152

Open danny0838 opened 2 years ago

danny0838 commented 2 years ago

The following case gets a SIM115 error, while it shouldn't.

file = '/path/to/file'
with (open(file, 'rb') if file is not None else nullcontext(sys.stdin)) as fh:
    text = fh.read()