

def serialize(self, highlight_code=False):
    '\n        Convert the codelet into a dictionary that can be sent as JSON.\n\n        :param highlight_code: Whether to return code as pygments-highlighted\n            HTML or as plain source.\n        :type highlight_code: bool\n\n        :return: The codelet as a dictionary.\n        :rtype: str\n        '
    lang = LANGS[self.language]
    code = self.code
    if highlight_code:
        lexer = (find_lexer_class(lang)() or get_lexer_by_name('text'))
        symbols = reduce(concat, self.symbols.values(), [])
        lines = reduce(concat, [[loc[0] for loc in (sym[1] + sym[2])] for sym in symbols], [])
        formatter = HtmlFormatter(linenos=True, hl_lines=lines)
        code = highlight(code, lexer, formatter)
    return {
        'name': self.name,
        'code': code,
        'lang': lang,
        'authors': self.authors,
        'url': self.url,
        'created': self.date_created.isoformat(),
        'modified': lang.date_modified.isoformat(),
        'origin': self.origin,
    }

dataset/ETHPy150Open earwig/bitshift/bitshift/codelet.py Codelet.serialize/VarMisuse@179/322 `self`->`lang`