tool/gen-template.py
Code
import os
import os.path as path
import re
import sys
import progReader
rootDir = path.join(os.path.dirname(__file__), "../")
templatePrototypeFile = path.join(rootDir, "export/template-prototype.cpp")
templateFile = path.join(rootDir, "export/template.cpp")
def genTemplate():
with open(templatePrototypeFile, 'r') as f:
lines = f.readlines()
templatePrototypeDir = path.dirname(templatePrototypeFile)
userIncludeRegex = re.compile(r'^\s*#\s*include\s+"(.*)"')
for line in lines:
res = userIncludeRegex.match(line)
if res:
includeFile = path.join(templatePrototypeDir, res.group(1))
includeContent = progReader.linesBelowDoc(includeFile)
sys.stdout.write("".join(includeContent))
else:
sys.stdout.write(line)
pass
if __name__ == '__main__':
genTemplate()
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
File "/opt/hostedtoolcache/Python/3.9.2/x64/lib/python3.9/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
raise NotImplementedError
NotImplementedError
Back to top page