I use this lines a lot in several projects.
import matplotlib
import numpy as np
matplotlib.use("Agg")
from matplotlib import pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
There's no other way that I know to set the matplotlib backend. But by doing so this will trigger E402.
isort has some ways of handling that (see here).
Of course I can fill lots of # noqa: E402 but this is so ugly.
Ideally, Ruff/isort should be smart enough to know these cases.
Also, perhaps, page E402 (and all others when reasonable) should show how to silence this warning if the user knows what's doing.
I use this lines a lot in several projects.
There's no other way that I know to set the matplotlib backend. But by doing so this will trigger E402.
isorthas some ways of handling that (see here).Of course I can fill lots of
# noqa: E402but this is so ugly.Ideally, Ruff/isort should be smart enough to know these cases.
Also, perhaps, page E402 (and all others when reasonable) should show how to silence this warning if the user knows what's doing.