Implement priority-based clearsnippets.
Code cleanup.

Full tested and does not break and old tests.
Refactor: snippet dictionary does not keep the extend info now.
Add/modify test cases for priority-based clearsnippets.
Some refinements.

1. Add docstrings.
2. Re-implement get_deep_extends().
3. Remove all inners.
Implements clearsnippets by priority.