MNT: Privatize Formatter attributes#31416
Conversation
e4c6d63 to
fec1f04
Compare
fec1f04 to
7059dc8
Compare
7059dc8 to
310092b
Compare
QuLogic
left a comment
There was a problem hiding this comment.
Many internal uses are still not fixed and breaking tests/docs, so I'll mark this as draft.
| '%Y-%b-%d', | ||
| '%Y-%b-%d %H:%M'] | ||
| self.offset_string = '' | ||
| self._offset_string = '' |
There was a problem hiding this comment.
There are still all the internal users of this that aren't converted and will raise a warning.
|
hey, I looked into why the tests were failing and it's because the internal usages in ticker.py still reference the old attribute names. I updated all of them locally: self.locs → self._locs across ScalarFormatter, LogitFormatter, EngFormatter and PercentFormatter, self.orderOfMagnitude → self._orderOfMagnitude, and self.format → self._format in ScalarFormatter. sankey.py doesn't need changes since that format attribute belongs to a completely different class. would it be okay if I pushed these fixes to your branch or would you prefer a follow up PR? |
|
@buddy0452004 Thanks for looking into this. Pushing the changes as an additional commit to this branch is welcome. |
These attributes are internal state and users should not access them:
ScalarFormatter.orderOfMagnitude
ScalarFormatter.format
ConciseDateFormatter.offset_format
Formatter.locs
Making them private will allow rearchitecting the handling of tick context (i.e. information extracted from a group of ticks, that may influence their formatting) in the future.
This works towards #31396.