Skip to content

Context

This module contains functions relative to the context file and content.

read_context(context_file)

Parse the context file.

Parameters:

Name Type Description Default
context_file file-like object

the context file.

required

Returns:

Type Description
ConfigParser

ConfigParser instance.

Source code in kcg/context.py
11
12
13
14
15
16
17
18
19
20
21
22
def read_context(context_file: typing.TextIO) -> configparser.ConfigParser:
    """Parse the context file.

    Args:
        context_file (file-like object): the context file.

    Returns:
        ConfigParser instance.
    """
    config = configparser.ConfigParser()
    config.read_file(context_file)
    return config