Returns a function taking three bools `casing`, `filtr`, `aliasing` and the list `qualify`, all defaulting to None. Returns a list of completers. These parameters specify the allowed values for the corresponding completer parameters, `None` meaning any, i.e.
(self, casing)
| 154 | return self.get_completer() |
| 155 | |
| 156 | def get_completers(self, casing): |
| 157 | """ |
| 158 | Returns a function taking three bools `casing`, `filtr`, `aliasing` and |
| 159 | the list `qualify`, all defaulting to None. |
| 160 | Returns a list of completers. |
| 161 | These parameters specify the allowed values for the corresponding |
| 162 | completer parameters, `None` meaning any, i.e. (None, None, None, None) |
| 163 | results in all 24 possible completers, whereas e.g. |
| 164 | (True, False, True, ['never']) results in the one completer with |
| 165 | casing, without `search_path` filtering of objects, with table |
| 166 | aliasing, and without column qualification. |
| 167 | """ |
| 168 | def _cfg(_casing, filtr, aliasing, qualify): |
| 169 | cfg = {'settings': {}} |
| 170 | if _casing: |
| 171 | cfg['casing'] = casing |
| 172 | cfg['settings']['search_path_filter'] = filtr |
| 173 | cfg['settings']['generate_aliases'] = aliasing |
| 174 | cfg['settings']['qualify_columns'] = qualify |
| 175 | return cfg |
| 176 | |
| 177 | def _cfgs(casing, filtr, aliasing, qualify): |
| 178 | casings = [True, False] if casing is None else [casing] |
| 179 | filtrs = [True, False] if filtr is None else [filtr] |
| 180 | aliases = [True, False] if aliasing is None else [aliasing] |
| 181 | qualifys = qualify or ['always', 'if_more_than_one_table', 'never'] |
| 182 | return [ |
| 183 | _cfg(*p) for p in product(casings, filtrs, aliases, qualifys) |
| 184 | ] |
| 185 | |
| 186 | def completers(casing=None, filtr=None, aliasing=None, qualify=None): |
| 187 | get_comp = self.get_completer |
| 188 | return [ |
| 189 | get_comp(**c) for c in _cfgs(casing, filtr, aliasing, qualify) |
| 190 | ] |
| 191 | |
| 192 | return completers |
| 193 | |
| 194 | def _make_col(self, sch, tbl, col): |
| 195 | defaults = self.metadata.get('defaults', {}).get(sch, {}) |
no outgoing calls
no test coverage detected