We're deprecating vim modelines in favor of `.editorconfig`.
Removing vim modelines could be done using two one-liners. Most of the vim modelines
were followed by an empty line, so this one-liner took care of these ones:
```sh
rg '^# vim: .+\n\n' -l | xargs sed -i '/^# vim: /,+1d'
```
Then some of the vim modelines were followed by a pylint configuration line, so running
this one-liner afterwards took care of that:
```sh
rg '^# vim:' -l | xargs sed -i '/^# vim: /d'
```
Mostly pretty lazy fixes. Most of the places in the tests we were
already matching on error message, a couple of places we weren't. The
tick-tock one was the only one that wasn't being used right where it was
raised.
Some of them I just changed to RuntimeError because it was shorter than
adding the pylint directive.
For three reasons:
- There are only 31 of them, and we don't really expect any more to
turn up (last happened in 2013, and we have a test for it happening)
- It makes for nicer debug output
- It always felt strange to only have a small subset in the enum
- Re-add the force_rebuild key which we need internally again. This
partially reverts changes from:
* cd0000f728
* 1a9b59fcfa
* 93ecd8f72f
- Instead of checking self.completion to figure out whether we need to
rebuild anything, check 'self' (i.e. the History table, not the
CompletionHistory table). If something went wrong during the last
rebuild, the CompletionHistory might still be empty, but History is what
actually matters to figure out whether to rebuild.
- Set force_rebuild while rebuilding the history, so that a possible
interruption of the process (e.g. by a killed process or crash)
results in another rebuild from scratch.
- Bump up the user version again, so that we re-add force_rebuild to the
database. This also forces another rebuild which helps with possible
inconsistent data when someone interrupted the earlier rebuild for
v2.0.0.
Fixes#6111
Makes it clearer what the intent is (rather than implicitly falling back
on __len__ via Python) and also happens to be a small (most probably
insignificant) performance improvement.
On my machine, without a __bool__:
Name (time in us) Min Max Median
test_bool_benchmark 144.2940 879.5960 167.2730
With it:
Name (time in us) Min Max Median
test_bool_benchmark 133.3990 876.1080 152.1879
This renames SqlException to SqlError (to be more consistent with how Python
names exceptions), and adds an utility function which logs a few more useful
details about errors.
See #3004