与mro相关的各种cli工具。用于调试复杂的类限制。
mro-tools的Python项目详细描述
与mro相关的各种cli工具。用于调试复杂的类限制。
- 自由软件:麻省理工学院许可证
- github:https://github.com/miki725/mro-tools
安装
您可以使用pip:
安装mro-tools。$ pip install mro-tools
为什么?
遗产是美好的。除非不是。 您需要多少次调试mro为>;30个类的复杂类? 你就会知道这不愉快。 编辑器没有多大帮助,因为一旦你跳转到基类,所有的编辑器 继承计算是相对于跳跃类的,而不是原始子类。 这使得我们可以看到 不插入pdb的代码执行。 这个一揽子计划旨在帮助解决这些问题。 它有一组cli工具,可以帮助排除复杂类的故障 有大的mro树。
使用
mro工具通过一个组命令公开所有工具。 通过执行mro-toolscommand可以看到所有可用的命令:
❯❯❯ mro-tools Usage: mro-tools [OPTIONS] COMMAND [ARGS]... Options: --help Show this message and exit. Commands: method Get all method definitions within all classes... version Print version of mro-tools
每个子命令都有更多文档:
❯❯❯ mro-tools version --help Usage: mro-tools version [OPTIONS] Print version of mro-tools Options: --help Show this message and exit.
mro-tools也可以作为python模块访问:
❯❯❯ python -m mro_tools
示例
❯❯❯ python -m mro_tools method django.views.generic:FormView.get_context_data ======== Full MRO ======== django.views.generic.edit.FormView django.views.generic.base.TemplateResponseMixin django.views.generic.edit.BaseFormView django.views.generic.edit.FormMixin django.views.generic.base.ContextMixin django.views.generic.edit.ProcessFormView django.views.generic.base.View builtins.object ---------------------------------------------------- django.views.generic.edit.FormMixin.get_context_data ---------------------------------------------------- def get_context_data(self, **kwargs): """Insert the form into the context dict.""" if 'form' not in kwargs: kwargs['form'] = self.get_form() return super().get_context_data(**kwargs) ------------------------------------------------------- django.views.generic.base.ContextMixin.get_context_data ------------------------------------------------------- def get_context_data(self, **kwargs): if 'view' not in kwargs: kwargs['view'] = self if self.extra_context is not None: kwargs.update(self.extra_context) return kwargs
历史记录
0.3.0(2019-02-08)
- 添加了--no-color选项。 这允许在其他编辑器中打开语法突出显示: mro-tools klass ... | vim -R - +'set syntax=python'
- 在klass命令中将文件添加到类标题
0.2.0(2018-09-22)
- 添加了klass命令
0.1.3(2018-09-13)
- 将pygments代码突出显示添加到method
0.1.2(2018-02-13)
- 添加了--django-configurations选项
0.1.1(2018-01-05)
- 修复自述文件中的rst标记
0.1.0(2018-01-05)
- pypi上的第一个版本。
许可证
麻省理工学院许可证(MIT)
版权所有(c)2018,Miroslav Shubernetskiy
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.