MCPcopy Create free account
hub / github.com/astanin/python-tabulate / _expand_numparse

Function _expand_numparse

tabulate/__init__.py:2524–2538  ·  view source on GitHub ↗

Return a list of bools of length `column_count` which indicates whether number parsing should be used on each column. If `disable_numparse` is a list of indices, each of those indices are False, and everything else is True. If `disable_numparse` is a bool, then the returned list

(disable_numparse, column_count)

Source from the content-addressed store, hash-verified

2522
2523
2524def _expand_numparse(disable_numparse, column_count):
2525 """
2526 Return a list of bools of length `column_count` which indicates whether
2527 number parsing should be used on each column.
2528 If `disable_numparse` is a list of indices, each of those indices are False,
2529 and everything else is True.
2530 If `disable_numparse` is a bool, then the returned list is all the same.
2531 """
2532 if isinstance(disable_numparse, Iterable):
2533 numparses = [True] * column_count
2534 for index in disable_numparse:
2535 numparses[index] = False
2536 return numparses
2537 else:
2538 return [not disable_numparse] * column_count
2539
2540
2541def _expand_iterable(original, num_desired, default):

Callers 1

tabulateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected