Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
parametersnapshot definition
#Copyright (c) mostafa el ayoubi , 2016
#Data-Shapes ,
#This code was inspired by Jeremy Tammik @Jeremytammik
def parametersnapshot(x):
parameters = x.Parameters
paramnames = [p.Definition.Name for p in parameters]
#Sorting is important because the parameters are queried in random order.
#We need to make sure the snapshots are ordered in the same way so we can compare them.
sortedindex = sorted(range(len(paramnames)), key = lambda k : paramnames[k])
sortedparameters = [paramnames[i] for i in sortedindex]
paramvalues = []
for p in parameters:
if p.AsString() != None:
else :
sortedvalues = [paramvalues[i] for i in sortedindex]
return ', '.join(['%s : %s' % (param,value) for param,value in zip(sortedparameters,sortedvalues)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment