當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。