本文整理汇总了Python中sphinx.util.jsdump.dumps函数的典型用法代码示例。如果您正苦于以下问题:Python dumps函数的具体用法?Python dumps怎么用?Python dumps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dumps函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_jsdump
def test_jsdump():
from sphinx.util.jsdump import dumps
assert dumps({'1a': 1}) == '{"1a":1}'
assert dumps({'a1': 1}) == '{a1:1}'
assert dumps({u'a\xe8': 1}) == '{"a\\u00e8":1}'
示例2: context_for_searchtool
def context_for_searchtool(self):
return dict(
search_language_stemming_code = self.lang.js_stemmer_code,
search_language_stop_words =
jsdump.dumps(sorted(self.lang.stopwords)),
search_scorer_tool = self.js_scorer_code,
)
示例3: context_for_searchtool
def context_for_searchtool(self):
# type: () -> Dict[unicode, Any]
return dict(
search_language_stemming_code = self.lang.js_stemmer_code,
search_language_stop_words = jsdump.dumps(sorted(self.lang.stopwords)),
search_scorer_tool = self.js_scorer_code,
search_word_splitter_code = self.js_splitter_code,
)
示例4: context_for_searchtool
def context_for_searchtool(self):
# type: () -> Dict[str, Any]
return {
'search_language_stemming_code': self.lang.js_stemmer_code,
'search_language_stop_words': jsdump.dumps(sorted(self.lang.stopwords)),
'search_scorer_tool': self.js_scorer_code,
'search_word_splitter_code': self.js_splitter_code,
}
示例5: test_jsdump
def test_jsdump():
data = {'1a': 1}
assert dumps(data) == '{"1a":1}'
assert data == loads(dumps(data))
data = {'a1': 1}
assert dumps(data) == '{a1:1}'
assert data == loads(dumps(data))
data = {u'a\xe8': 1}
assert dumps(data) == '{"a\\u00e8":1}'
assert data == loads(dumps(data))
data = {'_foo': 1}
assert dumps(data) == '{_foo:1}'
assert data == loads(dumps(data))
示例6: dumps
def dumps(self, data):
# type: (Any) -> unicode
return self.PREFIX + jsdump.dumps(data) + self.SUFFIX