focus.parser.parser.SettingParser

Here are the examples of the python api focus.parser.parser.SettingParser taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: focus Source File: __init__.py
def parse_config(filename, header):
    """ Parses the provided filename and returns ``SettingParser`` if the
        parsing was successful and header matches the header defined in the
        file.

        Returns ``SettingParser`` instance.

        * Raises a ``ParseError`` exception if header doesn't match or parsing
          fails.
        """

    parser = SettingParser(filename)
    if parser.header != header:
        header_value = parser.header or ''
        raise ParseError(u"Unexpected header '{0}', expecting '{1}'"
                         .format(common.from_utf8(header_value), header))

    return parser