当前位置: 首页>>代码示例>>Python>>正文


Python rapidjson.load方法代码示例

本文整理汇总了Python中rapidjson.load方法的典型用法代码示例。如果您正苦于以下问题:Python rapidjson.load方法的具体用法?Python rapidjson.load怎么用?Python rapidjson.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rapidjson的用法示例。


在下文中一共展示了rapidjson.load方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_public_key

# 需要导入模块: import rapidjson [as 别名]
# 或者: from rapidjson import load [as 别名]
def load_public_key(key_string: str) -> _RSAPublicKey:
    """
    Load a public key from a string, which may be base64 encoded.

    Parameters
    ----------
    key_string : str
        String containing the key, optionally base64 encoded

    Returns
    -------
    _RSAPublicKey
        The public key
    """

    try:
        return serialization.load_pem_public_key(
            key_string.encode(), backend=default_backend()
        )
    except (ValueError, TypeError):
        try:
            return load_public_key(base64.b64decode(key_string).decode())
        except (binascii.Error, ValueError):
            raise ValueError("Failed to load key.") 
开发者ID:Flowminder,项目名称:FlowKit,代码行数:26,代码来源:jwt.py

示例2: create_daijin_validator

# 需要导入模块: import rapidjson [as 别名]
# 或者: from rapidjson import load [as 别名]
def create_daijin_validator(simple=True):

    cname = resource_filename("Mikado.configuration", "configuration_blueprint.json")

    # We have to repeate twice the ending configuration (bug in jsonref?)
    baseuri = "file://" +  os.path.join(os.path.dirname(cname), os.path.basename(os.path.dirname(cname)))
    with io.TextIOWrapper(resource_stream("Mikado.configuration",
                                          "daijin_schema.json")) as blue:
        blue_print = jsonref.load(blue,
                                  jsonschema=True,
                                  base_uri=baseuri)

    # _substitute_conf(blue_print)
    validator = extend_with_default(jsonschema.Draft7Validator,
                                    simple=simple)
    validator = validator(blue_print)

    return validator 
开发者ID:EI-CoreBioinformatics,项目名称:mikado,代码行数:20,代码来源:daijin_configurator.py

示例3: open

# 需要导入模块: import rapidjson [as 别名]
# 或者: from rapidjson import load [as 别名]
def open(self, path, font=None):
        with open(path, 'r') as file:
            d = json.load(file)
        assert self.version >= d.pop(".formatVersion")
        if font is not None:
            self._font = font
        return self.structure(d, Font) 
开发者ID:trufont,项目名称:tfont,代码行数:9,代码来源:tfontConverter.py

示例4: load_labels

# 需要导入模块: import rapidjson [as 别名]
# 或者: from rapidjson import load [as 别名]
def load_labels(index):
    """index labels and return predicted output."""

    labels_map = rjson.load(open("./data/labels_map.txt"))
    labels = (labels_map[str(i)] for i in range(1000))
    return next(islice(labels, index, None)) 
开发者ID:intel,项目名称:stacks-usecase,代码行数:8,代码来源:main.py

示例5: load

# 需要导入模块: import rapidjson [as 别名]
# 或者: from rapidjson import load [as 别名]
def load(stream: bytes, *args, **kwargs) -> Dict:
    kwargs = add_settings_to_kwargs(kwargs)
    return rapidjson.load(stream, *args, **kwargs) 
开发者ID:alexferl,项目名称:falcon-boilerplate,代码行数:5,代码来源:json.py

示例6: decompress_claims

# 需要导入模块: import rapidjson [as 别名]
# 或者: from rapidjson import load [as 别名]
def decompress_claims(claims):
    in_ = io.BytesIO()
    in_.write(base64.decodebytes(claims.encode()))
    in_.seek(0)
    with gzip.GzipFile(fileobj=in_, mode="rb") as fo:
        return json.load(fo)


# Duplicated in FlowAuth (cannot use this implementation there because
# this module is outside the docker build context for FlowAuth). 
开发者ID:Flowminder,项目名称:FlowKit,代码行数:12,代码来源:jwt.py

示例7: load_private_key

# 需要导入模块: import rapidjson [as 别名]
# 或者: from rapidjson import load [as 别名]
def load_private_key(key_string: str) -> _RSAPrivateKey:
    """
    Load a private key from a string, which may be base64 encoded.

    Parameters
    ----------
    key_string : str
        String containing the key, optionally base64 encoded

    Returns
    -------
    _RSAPrivateKey
        The private key
    """
    try:
        return serialization.load_pem_private_key(
            key_string.encode(), password=None, backend=default_backend()
        )
    except ValueError:
        try:
            return load_private_key(base64.b64decode(key_string).decode())
        except (binascii.Error, ValueError):
            raise ValueError("Failed to load key.")


# Duplicated in FlowAPI (cannot use this implementation there because
# this module is outside the docker build context for FlowAuth). 
开发者ID:Flowminder,项目名称:FlowKit,代码行数:29,代码来源:jwt.py


注:本文中的rapidjson.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。