diff --git a/Phys/FunctorCore/python/Functors/grammar.py b/Phys/FunctorCore/python/Functors/grammar.py index 3b8224f2321795ec822d6ce21f9c911405b80976..373a6ad688a677c6a3702b61b85831acca1a8659 100644 --- a/Phys/FunctorCore/python/Functors/grammar.py +++ b/Phys/FunctorCore/python/Functors/grammar.py @@ -69,10 +69,10 @@ def python_to_cpp_str(obj): val_code, val_headers = python_to_cpp_str(val) items.append('{ ' + key_code + ', ' + val_code + ' }') headers += key_headers + val_headers - return '{' + ', '.join(items) + '}', list(set(headers)) + return '{' + ', '.join(items) + '}', sorted(set(headers)) elif (type(obj) == list or type(obj) == tuple): items, headers = list(zip(*[python_to_cpp_str(item) for item in obj])) - return 'std::tuple{' + ', '.join(items) + '}', list( + return 'std::tuple{' + ', '.join(items) + '}', sorted( set(chain(*headers)).union({'<tuple>'})) elif isinstance(obj, BoundFunctor): return obj.code(), obj.headers() @@ -233,7 +233,7 @@ class BoundFunctor(FunctorBase, type( self._strname = nice_name # RUNNUMBER self._code = code # Unique DataHandle objects held by this functor - self._inputs = list(set(inputs or [])) + self._inputs = sorted(set(inputs or []), key=hash) self._headers = headers # Assign an instance-specific docstring, allowing bound functors to # forward the docstring of the base functor. Note that this will *not* @@ -318,7 +318,7 @@ class ComposedBoundFunctor(BoundFunctor): self, code=code, nice_code=nice_code, - headers=list(set(func1.headers() + func2.headers())), + headers=sorted(set(func1.headers() + func2.headers())), inputs=func1.data_dependencies() + func2.data_dependencies()) @@ -361,7 +361,7 @@ class WrappedBoundFunctor(BoundFunctor): [bound_functor.code_repr() for bound_functor in bound_functors]) nice_code = '{wrap}( {args} )'.format( wrap=wrapping_function, args=nice_code_arguments) - headers = list(set(headers)) + headers = sorted(set(headers)) BoundFunctor.__init__( self, @@ -521,7 +521,7 @@ def Functor(representation, return BoundFunctor( code=cpp_str, nice_code=repr_str, - headers=list(set(cpp_headers)), + headers=sorted(set(cpp_headers)), inputs=inputs, nice_name=representation, docs=brief_docs)