https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-breakfast-49010

09/22/2020, 7:15 PM
Python question: is there a concise way to write a
with
block where the presence/absence of the
with
is controllable via a flag?
basically is there a more concise way to write:
Copy code
def run(self, request: InteractiveProcess) -> InteractiveProcessResult:
        if request.capture_signals:
            with ExceptionSink.ignoring_sigint():
                return self._scheduler.run_local_interactive_process(request)
        else:
            return self._scheduler.run_local_interactive_process(request)
h

hundreds-father-404

09/22/2020, 7:17 PM
👍 1
w

witty-crayon-22786

09/22/2020, 7:44 PM
there is an empty context manager
but that looks fine too