Пример #1
0
def load(fp, **kwargs):
    """Like :func:`loads` but reads from a file object.
    """
    _load_arg_defaults(kwargs)
    if not PY2:
        fp = _wrap_reader_for_text(fp, kwargs.pop('encoding', None) or 'utf-8')
    return _json.load(fp, **kwargs)
Пример #2
0
def load(fp, **kwargs):
    """Like :func:`loads` but reads from a file object.
    """
    _load_arg_defaults(kwargs)
    if not PY2:
        fp = _wrap_reader_for_text(fp, kwargs.pop('encoding', None) or 'utf-8')
    return _json.load(fp, **kwargs)
Пример #3
0
def load(fp, app=None, **kwargs):
    """Like :func:`loads` but reads from a file object."""
    _load_arg_defaults(kwargs, app=app)
    if not PY2:
        fp = _wrap_reader_for_text(fp, kwargs.pop("encoding", None) or "utf-8")
    return _json.load(fp, **kwargs)
Пример #4
0
def load_json_config(file):
    assert file.endswith(".json")
    assert os.path.exists(file), "%s profile is missing" % file
    with open(file, "r", encoding="utf-8") as fp:
        data = json.load(fp)
    return ImmutableDict(data)
Пример #5
0
Файл: json.py Проект: avdd/flak
def _load(fp, **kw):
    if not PY2:
        fp = _wrap_reader_for_text(fp, kw.pop('encoding', None) or 'utf-8')
    return _json.load(fp, **kw)
Пример #6
0
def load(fp, **kwargs):
    """类似 :func:`loads` 函数,但从一个文件对象来读取内容."""
    _load_arg_defaults(kwargs)
    if not PY2:
        fp = _wrap_reader_for_text(fp, kwargs.pop('encoding', None) or 'utf-8')
    return _json.load(fp, **kwargs)