Skip to content
Snippets Groups Projects
Commit 837cbb1e authored by Eduardo Rodrigues's avatar Eduardo Rodrigues
Browse files

Remove non-needed DaVinci/utils.py file

parent a86e6229
No related branches found
No related tags found
2 merge requests!1103Draft: Add AnalysisHelpers to DaVinci Stack,!787Remove non-needed DaVinci/utils.py file
Pipeline #4770349 passed
###############################################################################
# (c) Copyright 2022 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
import os, XRootD.client
def load_file(fname):
if not fname: return None
if fname.startswith("root://eoslhcb.cern.ch//"):
with XRootD.client.File() as f:
status, _ = f.open(str(fname))
if not status.ok:
raise RuntimeError(f"could not open {fname}: {status.message}")
status, data = f.read()
if not status.ok:
raise RuntimeError(f"could not read {fname}: {status.message}")
return data.decode('utf-8')
else:
with open(os.path.expandvars(fname)) as f:
data = f.read()
return data.decode('utf-8')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment