23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct
Dataset Card for LLMcoder-GitHub-Python-Mix-Direct Python target autocomplete suggestions in the format of conversations for OpenAI's fine-tuning. Dataset Details Dataset Description Curated by: [More Information Needed] Funded by [optional]: [More Information Needed] Shared by [optional]: [More Information Needed] Language(s) (NLP): [More Information Needed] License: [More Information Needed] Dataset Sources [optional] The data… See the full description on the dataset page: https://huggingface.co/datasets/23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct.
0216
1#!/usr/bin/env python32"""3A script to create C code-coverage reports based on the output of4valgrind's callgrind tool.5 6"""7import os8import re9import sys10from xml.sax.saxutils import quoteattr, escape11 12try:13 import pygments14 if tuple([int(x) for x in pygments.__version__.split('.')]) < (0, 11):15 raise ImportError()16 from pygments import highlight17 from pygments.lexers import CLexer18 from pygments.formatters import HtmlFormatter19 has_pygments = True20except ImportError:21 print("This script requires pygments 0.11 or greater to generate HTML")22 has_pygments = False23 24 25class FunctionHtmlFormatter(HtmlFormatter):26 """Custom HTML formatter to insert extra information with the lines."""27 def __init__(self, lines, **kwargs):28 HtmlFormatter.__init__(self, **kwargs)29 self.lines = lines30 31 def wrap(self, source, outfile):32 for i, (c, t) in enumerate(HtmlFormatter.wrap(self, source, outfile)):33 as_functions = self.lines.get(i-1, None)34 if as_functions is not None:35 yield 0, ('<div title=%s style="background: #ccffcc">[%2d]' %36 (quoteattr('as ' + ', '.join(as_functions)),37 len(as_functions)))38 else:39 yield 0, ' '40 yield c, t41 if as_functions is not None:42 yield 0, '</div>'43 44 45class SourceFile:46 def __init__(self, path):47 self.path = path48 self.lines = {}49 50 def mark_line(self, lineno, as_func=None):51 line = self.lines.setdefault(lineno, set())52 if as_func is not None:53 as_func = as_func.split("'", 1)[0]54 line.add(as_func)55 56 def write_text(self, fd):57 source = open(self.path, "r")58 for i, line in enumerate(source):59 if i + 1 in self.lines:60 fd.write("> ")61 else:62 fd.write("! ")63 fd.write(line)64 source.close()65 66 def write_html(self, fd):67 source = open(self.path, 'r')68 code = source.read()69 lexer = CLexer()70 formatter = FunctionHtmlFormatter(71 self.lines,72 full=True,73 linenos='inline')74 fd.write(highlight(code, lexer, formatter))75 source.close()76 77 78class SourceFiles:79 def __init__(self):80 self.files = {}81 self.prefix = None82 83 def get_file(self, path):84 if path not in self.files:85 self.files[path] = SourceFile(path)86 if self.prefix is None:87 self.prefix = path88 else:89 self.prefix = os.path.commonprefix([self.prefix, path])90 return self.files[path]91 92 def clean_path(self, path):93 path = path[len(self.prefix):]94 return re.sub(r"[^A-Za-z0-9\.]", '_', path)95 96 def write_text(self, root):97 for path, source in self.files.items():98 fd = open(os.path.join(root, self.clean_path(path)), "w")99 source.write_text(fd)100 fd.close()101 102 def write_html(self, root):103 for path, source in self.files.items():104 fd = open(os.path.join(root, self.clean_path(path) + ".html"), "w")105 source.write_html(fd)106 fd.close()107 108 fd = open(os.path.join(root, 'index.html'), 'w')109 fd.write("<html>")110 paths = sorted(self.files.keys())111 for path in paths:112 fd.write('<p><a href="%s.html">%s</a></p>' %113 (self.clean_path(path), escape(path[len(self.prefix):])))114 fd.write("</html>")115 fd.close()116 117 118def collect_stats(files, fd, pattern):119 # TODO: Handle compressed callgrind files120 line_regexs = [121 re.compile(r"(?P<lineno>[0-9]+)(\s[0-9]+)+"),122 re.compile(r"((jump)|(jcnd))=([0-9]+)\s(?P<lineno>[0-9]+)")123 ]124 125 current_file = None126 current_function = N