Did I find the right examples for you? yes no

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)
Parses raw header string into context

        def parse_header(raw_header):
    """Parses raw header string into context"""

    context = {}
    for line in raw_header.split('\n'):
            (key, value) = line.split(': ', 1)
        except ValueError:
            raise Exception("Header line '%s' is not in a 'variable: value' format" % line)
        context[key] = value
    return context

src/r/e/rejourn-HEAD/core.py   rejourn(Download)
        # Parse the header and populate the context with this
        # information
        self.context = self.__update_context(util.parse_header(raw_header))
        # Get a template ready to write
            with open(target + '.txt', 'r') as infh:
                raw_header, content = infh.read().split('\n' + self.config.get('separator', '---') + '\n', 1)
                header = util.parse_header(raw_header)
                title = header.get('title', 'No Title')
                extensions = ['codehilite', 'html_tidy']

src/r/e/rejourn-HEAD/tests.py   rejourn(Download)
    def test_parse_header(self):
        raw_header = "view: single\npermalink: the-hacker-s-dream-journal-eng\npublished: True\npubdate: 2010-04-21T12:04:36Z\ntitle: The hacker's dream journal engine\nauthor: Ramkumar Ramachandra"
        header = util.parse_header(raw_header)
        assert header['pubdate'] == '2010-04-21T12:04:36Z'