Analysis *before* situation: The loop after the __find call did not really match the __find call before - it was looking only for non-disabled sources, but then had an if case for disabled ones to enable them if the components match - which was never reached.
Now, I think the patch is slightly wrong: The if case is reachable now, so it would enable an existing disabled source even if we passed disabled=True. The for loop thus needs 4 cases now, the existing ones corresponding to disabled=False and two variants of them for disabled=True (might be possible to write with less cases).
Analysis *before* situation: The loop after the __find call did not really match the __find call before - it was looking only for non-disabled sources, but then had an if case for disabled ones to enable them if the components match - which was never reached.
Now, I think the patch is slightly wrong: The if case is reachable now, so it would enable an existing disabled source even if we passed disabled=True. The for loop thus needs 4 cases now, the existing ones corresponding to disabled=False and two variants of them for disabled=True (might be possible to write with less cases).