Can't be sure, but that would be rather frightening if cloudflare is just injecting JS willynilly
Now, are _you_ serving from Cloudflare and you're seeing this in production? Or is this coming from the output?
But to your main question - the resultant HTML is occurring after running a python script fully locally, no hosting, prod, dev server, or anything related to Cloudflare coming into play.
They provide a lot of this type of thing - rewriting HTML responses with optimizations "at the edge" instead of you doing it at your origin.
[1] https://developers.cloudflare.com/analytics/web-analytics/ge...