Oh, here we go. We're back to talking about the diagram entries as if these are chords in a key signature. Very well.
Nothing is absolute about this stuff.
When writing for orchestra or big band, I may very well write notes with sharps in a flatted key signature. Why? Well, I don't want to be changing the key signature all the time, but a certain section (even a few bars) may have a different tonal center (example: we are humming along in Eb, but for four bars, it apparently modulates to A. Is it worth changing the key signature for four bars? I think No). The players will understand as long as you're consistent.
Another general rule is to write sharps if it's an ascending line, flats if it's a descending line. But I break that rule all the time. Pick your poison: you'll often not be able to comply with every guideline out there.
I personally don't like key signature changes for just a few bars. I would rather just read the accidentals, especially if I am sight reading something and didn't even get the time to look it over enough to see those key changes. But, as I had said before, for me it doesn't really make much difference if you write Cb I still know where it is and what it is even if it is not normally written that way.