10#include <boost/python/class.hpp>
11#include <boost/python/list.hpp>
12#include <boost/python/overloads.hpp>
13#include <boost/python/reference_existing_object.hpp>
42 const
bool useExtsOnly) {
44 std::vector<std::string> exts;
45 for (
int i = 0; i < len(exts_list); ++i)
46 exts.emplace_back(extract<std::string>(exts_list[i]));
53 return self.findRuns(hintstr, exts, useExtsOnly);
57 class_<FileFinderImpl, boost::noncopyable>(
"FileFinderImpl", no_init)
59 getFullPathOverloader((arg(
"self"), arg(
"path"), arg(
"ignoreDirs") =
false),
60 "Return a full path to the given file if it can be found within "
61 "datasearch.directories paths. Directories can be ignored with "
62 "ignoreDirs=True. An empty string is returned otherwise."))
64 (arg(
"self"), arg(
"hintstr"), arg(
"exts_list") = list(), arg(
"useExtsOnly") =
false),
65 "Find a list of files file given a hint. "
66 "The hint can be a comma separated list of run numbers and can also "
67 "include ranges of runs, e.g. 123-135 or equivalently 123-35"
68 "If no instrument prefix is given then the current default is used."
69 "exts_list is an optional list containing strings of file "
70 "extensions to search."
71 "useExtsOnly is an optional bool. If it's true then don't use "
74 "Option to get if file finder should be case sensitive.")
76 "Option to set if file finder should be case sensitive.")
77 .def(
"Instance", &FileFinder::Instance, return_value_policy<reference_existing_object>(),
78 "Returns a reference to the FileFinder singleton instance")
79 .staticmethod(
"Instance");
std::vector< std::string > runFinderProxy(const FileFinderImpl &self, const std::string &hintstr, list exts_list, const bool useExtsOnly)
Runs FileFinder.findRuns after releasing the python GIL.
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(valueAsPrettyStrOverloader, valueAsPrettyStr, 0, 2) void export_Property()
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
This class finds data files given an instrument name (optionally) and a run number.
bool getCaseSensitive() const
Option to get if file finder should be case sensitive.
std::string getFullPath(const std::string &filename, const bool ignoreDirs=false) const
Return the full path to the file given its name.
void setCaseSensitive(const bool cs)
Option to set if file finder should be case sensitive.
Manage the lifetime of a class intended to be a singleton.
Defines a structure for releasing the Python GIL using the RAII pattern.