仅通过最脏的方法来模拟其他人的脏屁股不符合pep的代码的健全性。
pysanit的Python项目详细描述
仅通过最脏的方法来模拟其他人的脏屁股不符合pep的代码的健全性。
使用Python2.7、3.5进行测试。
那意味着?
嗨!我是侏儒
importlogginglog=logging.getLogger(__name__)
更不用说大脑麻木:
frompysanityimportlogginglog=logging.get_logger(__name__)
所有的同时保持您宝贵的代码完成工作,因为不严重的过度动态性质预期。
不必欢迎我在PyPI上生存。记录你说的?
提示:尝试一下,不要再接受代码中不必要的样板文件,stdlib与否:
importloggingimportlogging.configimportinspectdef_namespace_from_calling_context():""" Derive a namespace from the module containing the caller's caller. :return str: the fully qualified python name of a module. """returninspect.currentframe().f_back.f_back.f_globals['__name__']defget_logger(name=None):""" Gets a logger instance with sensible defaults according to caller context. :param str name: Logger name. Defaults to caller's `__name__`. :return logging.Logger: Logger instance """ifnotname:name=_namespace_from_calling_context()returnlogging.getLogger(name)
安装
pip install pysanity
运行测试
tox用于测试多个python版本。
tox