Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add_provenance(provenance_table, method_name):
d = provenance.get_provenance_dict({"command": "tsutil.{}".format(method_name)})
provenance_table.add_row(json.dumps(d))
def decode(self, prov):
builder = pjs.ObjectBuilder(tskit.provenance.get_schema())
ns = builder.build_classes()
return ns.TskitProvenance.from_json(prov)
def test_provenance_creation(self):
record = pyslim.make_pyslim_provenance_dict()
tskit.provenance.validate_provenance(record)
record = pyslim.make_slim_provenance_dict("nonWF", 100)
tskit.provenance.validate_provenance(record)
def add_provenance(provenance_table, method_name):
d = provenance.get_provenance_dict({"command": "tsutil.{}".format(method_name)})
provenance_table.add_row(json.dumps(d))
def test_provenance_creation(self):
record = pyslim.make_pyslim_provenance_dict()
tskit.provenance.validate_provenance(record)
record = pyslim.make_slim_provenance_dict("nonWF", 100)
tskit.provenance.validate_provenance(record)
def _get_upgrade_provenance(root):
"""
Returns the provenance string from upgrading the specified HDF5 file.
"""
# TODO add more parameters here like filename, etc.
parameters = {
"command": "upgrade",
"source_version": list(map(int, root.attrs["format_version"]))
}
s = json.dumps(provenance.get_provenance_dict(parameters))
return s.encode()
def _get_upgrade_provenance(root):
"""
Returns the provenance string from upgrading the specified HDF5 file.
"""
# TODO add more parameters here like filename, etc.
parameters = {
"command": "upgrade",
"source_version": list(map(int, root.attrs["format_version"]))
}
s = json.dumps(provenance.get_provenance_dict(parameters))
return s.encode()
Returns the V2 tree provenance attributes reformatted as a provenance record.
"""
environment = {}
parameters = {}
# Try to get the provenance strings. Malformed JSON should not prevent us
# from finishing the conversion.
try:
environment = json.loads(str(attrs["environment"]))
except ValueError:
logging.warn("Failed to convert environment provenance")
try:
parameters = json.loads(str(attrs["parameters"]))
except ValueError:
logging.warn("Failed to convert parameters provenance")
parameters["command"] = command
provenance_dict = provenance.get_provenance_dict(parameters)
provenance_dict["version"] = environment.get("msprime_version", "Unknown_version")
provenance_dict["environment"] = environment
return json.dumps(provenance_dict).encode()
def _get_environment():
gsl_version = ".".join(map(str, _msprime.get_gsl_version()))
libraries = {"gsl": {"version": gsl_version}}
return tskit.provenance.get_environment(extra_libs=libraries)