diff --git a/servicex/python_dataset.py b/servicex/python_dataset.py index 5a36fef1..38cd8774 100644 --- a/servicex/python_dataset.py +++ b/servicex/python_dataset.py @@ -28,6 +28,7 @@ import inspect from typing import Optional, Union, Callable from base64 import b64encode +from textwrap import dedent from servicex.configuration import Configuration from servicex.query_core import Query @@ -69,9 +70,9 @@ def generate_selection_string(self) -> str: raise ValueError("You must provide a python function using with_uproot_function") if isinstance(self.python_function, str): - return b64encode(self.python_function.encode("utf-8")).decode("utf-8") + return b64encode(dedent(self.python_function).encode("utf-8")).decode("utf-8") else: - return b64encode(inspect.getsource(self.python_function) + return b64encode(dedent(inspect.getsource(self.python_function)) .encode("utf-8"))\ .decode("utf-8")