config.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:dactyl 作者: ripple 项目源码 文件源码
def get_es_template(self, filename):
        """Loads an ElasticSearch template (as JSON)"""
        template_path = os.path.join(self.config["template_path"], filename)
        try:
            with open(template_path) as f:
                es_template = json.load(f)
        except (FileNotFoundError, json.decoder.JSONDecodeError) as e:
            if type(e) == FileNotFoundError:
                logger.debug("Didn't find ES template (%s), falling back to default" %
                    template_path)
            elif type(e) == json.decoder.JSONDecodeError:
                recoverable_error(("Error JSON-decoding ES template (%s)" %
                    template_path), self.bypass_errors)
            with resource_stream(__name__, BUILTIN_ES_TEMPLATE) as f:
                es_template = json.load(f)
        return es_template
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号