Skip to content
Snippets Groups Projects

TCKs for HLT1

Merged Roel Aaij requested to merge standalone_property_default_values into master
2 files
+ 21
7
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -11,7 +11,7 @@ from collections import OrderedDict
from AlgorithmTraversalLibClang import AlgorithmTraversal
import argparse
import pickle
import json
def get_clang_so_location():
"""Function that fetches location of detected clang so."""
@@ -132,10 +132,23 @@ class AllenCore():
s += AllenCore.prefix(i) + param.typename + " = AllenDataHandle(\"" + param.scope + "\", " + dependencies + ", \"" + param.typename + "\", \"" \
+ AllenCore.create_var_type(param.kind) + \
"\", \"" + str(param.typedef) + "\"),\n"
# Properties
for prop in algorithm.properties:
# Use the python JSON parser to turn the JSON
# representation of default values into appropriate Python
# objects
pn = prop.name[1:-1]
s += f'{AllenCore.prefix(i)}{pn} = "{default_properties[pn]}",\n'
s = s[:-2]
dv = json.loads(default_properties[pn])
# Quotes have to be added for properties that hold a string
if type(dv) is str:
dv = f'"{dv}"'
# Write the code for the property and include the C++ type
# as a comment
s += f'{AllenCore.prefix(i)}{pn} = {dv}, # {prop.typedef}\n'
s = s[:-1]
i -= 1
s += "\n" + AllenCore.prefix(i) + ")\n"
@@ -589,8 +602,10 @@ class AllenCore():
@staticmethod
def write_algorithms_view(algorithms, filename, default_properties):
from subprocess import (PIPE, run)
import json
# Run the default_properties executable to get a JSON
# representation of the default values of all properties of
# all algorithms
p = run([default_properties], stdout=PIPE,
input=';'.join(["{}::{}".format(a.namespace, a.name) for a in parsed_algorithms]),
encoding='ascii')
Loading