(self, serialized_features, fstyle=None, fstyle_implies=None,
**kwargs)
| 89 | return content |
| 90 | |
| 91 | def gen_table(self, serialized_features, fstyle=None, fstyle_implies=None, |
| 92 | **kwargs): |
| 93 | |
| 94 | if fstyle is None: |
| 95 | fstyle = lambda ft: f'``{ft}``' |
| 96 | if fstyle_implies is None: |
| 97 | fstyle_implies = lambda origin, ft: fstyle(ft) |
| 98 | |
| 99 | rows = [] |
| 100 | have_gather = False |
| 101 | for f, implies, gather in serialized_features: |
| 102 | if gather: |
| 103 | have_gather = True |
| 104 | name = fstyle(f) |
| 105 | implies = ' '.join([fstyle_implies(f, i) for i in implies]) |
| 106 | gather = ' '.join([fstyle_implies(f, i) for i in gather]) |
| 107 | rows.append((name, implies, gather)) |
| 108 | if not rows: |
| 109 | return '' |
| 110 | fields = ["Name", "Implies", "Gathers"] |
| 111 | if not have_gather: |
| 112 | del fields[2] |
| 113 | rows = [(name, implies) for name, implies, _ in rows] |
| 114 | return self.gen_rst_table(fields, rows, **kwargs) |
| 115 | |
| 116 | def gen_rst_table(self, field_names, rows, tab_size=4): |
| 117 | assert(not rows or len(field_names) == len(rows[0])) |
no test coverage detected