Merge pull request #11802 from mhilbrunner/docstatus-todo-filter

doc_status.py: Add -t (--todo) option, show only non-empty items
This commit is contained in:
Julian Murgia 2017-10-04 11:07:36 +02:00 committed by GitHub
commit f4ddbc024c

View file

@ -23,6 +23,7 @@ flags = {
'o': True, 'o': True,
'i': False, 'i': False,
'a': True, 'a': True,
'e': False,
} }
flag_descriptions = { flag_descriptions = {
'c': 'Toggle colors when outputting.', 'c': 'Toggle colors when outputting.',
@ -35,6 +36,7 @@ flag_descriptions = {
'o': 'Toggle overall column.', 'o': 'Toggle overall column.',
'i': 'Toggle collapse of class items columns.', 'i': 'Toggle collapse of class items columns.',
'a': 'Toggle showing all items.', 'a': 'Toggle showing all items.',
'e': 'Toggle hiding empty items.',
} }
long_flags = { long_flags = {
'colors': 'c', 'colors': 'c',
@ -64,6 +66,8 @@ long_flags = {
'collapse': 'i', 'collapse': 'i',
'all': 'a', 'all': 'a',
'empty': 'e',
} }
table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals'] table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals']
table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals'] table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals']
@ -192,6 +196,14 @@ class ClassStatus:
ok = ok and self.progresses[k].is_ok() ok = ok and self.progresses[k].is_ok()
return ok return ok
def is_empty(self):
sum = 0
for k in self.progresses:
if self.progresses[k].is_ok():
continue
sum += self.progresses[k].total
return sum < 1
def make_output(self): def make_output(self):
output = {} output = {}
output['name'] = color('name', self.name) output['name'] = color('name', self.name)
@ -396,6 +408,9 @@ for cn in filtered_classes:
if (flags['b'] and status.is_ok()) or (flags['g'] and not status.is_ok()) or (not flags['a']): if (flags['b'] and status.is_ok()) or (flags['g'] and not status.is_ok()) or (not flags['a']):
continue continue
if flags['e'] and status.is_empty():
continue
out = status.make_output() out = status.make_output()
row = [] row = []
for column in table_columns: for column in table_columns: