python-tableformatter / tableformatter

Tabular data formatter allowing printing from both arbitrary Iterables of Iterables or Iterables of objects via introspection
https://pypi.org/project/tableformatter/
MIT License
19 stars 3 forks source link

Refactored grid classes to put them in an inheritance hierarchy #13

Closed tleonhardt closed 6 years ago

tleonhardt commented 6 years ago

Refactored grid classes to put them in an inheritance hierarchy with an abstract base class at the root.

generate_table() now takes an instance of a Grid class for grid_style instead of a class type.

There is a global DEFAULT_GRID which can be overriden with the set_default_grid() method.

AlternatingRowGrid now takes two optional arguments in its initializer: bg_primary and bg_alternate for the two alternating colors.

Also:

tleonhardt commented 6 years ago

@anselor Putting the grid styles into an inheritance hierarchy and having the generate_table method and TableFormatter class accept an instance within this hierarchy seems like a good idea to me.

But please review this and make sure it doesn't present a headache or undue burden to you.

codecov-io commented 6 years ago

Codecov Report

Merging #13 into master will decrease coverage by 0.65%. The diff coverage is 93.98%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
- Coverage   78.94%   78.28%   -0.66%     
==========================================
  Files           1        1              
  Lines         798      783      -15     
==========================================
- Hits          630      613      -17     
- Misses        168      170       +2
Impacted Files Coverage Δ
tableformatter.py 78.28% <93.98%> (-0.66%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4adb978...3ee1a47. Read the comment docs.

anselor commented 6 years ago

Looks good to me. API changes are relatively minor.