CLN: Styler Types for CSS variables on ctx
object. by attack68 · Pull Request #39660 · pandas-dev/pandas (original) (raw)
- tests changed / passed
- Ensure all linting tests pass, see here for how to run them
Styler
currently has three formats for keeping track of CSS:
A) CSSList type: [('a1', 'v1'), ('a2', 'v2')]
B) List[str] type: ['a1:v1', 'a2:v2']
C) Str type: 'a1:v1; a2:v2;'
C
is only ever used as user input format, and now, as of #39564 C
can be used in all cases for user input (albeit A
remains available for backwards compatibility in .set_table_styles()
)
A
remains the most algorithimcally accessible, and is what C
is already converted to in some cases for internal variables.
B
is only ever used by one internal variable. The ctx
object is updated with B
type converted from C
. For final render this B
type is converted to A
type for looping. In the process, white space is poorly handled.
This PR eliminates B
type and converts C
directly to A
.
Tests using the ctx
object needed updating for new type.