Now imports follow the following structure:
1. __future__ line: exactly one line allowed:
from __future__ import (unicode_literals, division, absolute_import, print_function)
(powerline.shell is the only exception due to problems with argparse).
2. Standard python library imports in a form `import X`.
3. Standard python library imports in a form `from X import Y`.
4. and 5. 2. and 3. for third-party (non-python and non-powerline imports).
6. 3. for powerline non-test imports.
7. and 8. 2. and 3. for powerline testing module imports.
Each list entry is separated by exactly one newline from another import. If
there is module docstring it goes between `# vim:` comment and `__future__`
import. So the structure containing all items is the following:
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
'''Powerline super module'''
import sys
from argparse import ArgumentParser
import psutil
from colormath.color_diff import delta_e_cie2000
from powerline.lib.unicode import u
import tests.vim as vim_module
from tests import TestCase
.
Target: with long-living Powerline objects periodically reload configuration
recreating renderer. Use file watchers to watch for configuration. Configuration
should be able to be safely reloaded in non-blocking mode in a separate thread
up to the time when it comes to recreating renderer.
This commit does not add anything that actually reloads the configuration,
multiple runs of .create_renderer were not tested.
No need to bother both developers (that need to create class names compatible
with file name, which is not obvious if not looking into main Powerline class)
and computer (that needs to recompute class name each time) if it is possible to
bother only developers (or only computer, but this contributes to higher startup
times).
About not obvious: when you look into zsh_prompt.py and see only
ZshPromptRenderer name you only think that powerline upstream is following
strict code style. You don’t think there is a technical reason for such naming,
like you don’t think there is technical reason for having blank lines. When you
look into zsh_prompt.py and see `renderer = ZshPromptRenderer` it is obvious
that there is technical reason for writing code this way because new variable is
never used in the module itself.
Dynamic configuration tests. Purpose: make sure that default configuration does
not throw. Tests catch only very trivial problems (like missing imports after
refactoring)