Wrapper to strip each member of the output of `method`. Parameters ---------- method : function Function that takes a single argument and returns a sequence of strings. Returns ------- wrapped : function T
(self, method)
| 147 | """ |
| 148 | |
| 149 | def autostrip(self, method): |
| 150 | """ |
| 151 | Wrapper to strip each member of the output of `method`. |
| 152 | |
| 153 | Parameters |
| 154 | ---------- |
| 155 | method : function |
| 156 | Function that takes a single argument and returns a sequence of |
| 157 | strings. |
| 158 | |
| 159 | Returns |
| 160 | ------- |
| 161 | wrapped : function |
| 162 | The result of wrapping `method`. `wrapped` takes a single input |
| 163 | argument and returns a list of strings that are stripped of |
| 164 | white-space. |
| 165 | |
| 166 | """ |
| 167 | return lambda input: [_.strip() for _ in method(input)] |
| 168 | |
| 169 | def __init__(self, delimiter=None, comments='#', autostrip=True, |
| 170 | encoding=None): |