diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 87c5b7f64..14dfb970a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -17,7 +17,7 @@ repos: exclude: external/.*$ - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v15.0.6 + rev: v21.1.8 hooks: - id: clang-format exclude: external/.*$ @@ -29,7 +29,7 @@ repos: additional_dependencies: [ pyyaml ] # - id: cmake-lint - - repo: https://github.com/psf/black - rev: 22.12.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.1.0 hooks: - id: black diff --git a/macros/REST_CreateHisto.C b/macros/REST_CreateHisto.C index 91159d22b..dc299dc16 100644 --- a/macros/REST_CreateHisto.C +++ b/macros/REST_CreateHisto.C @@ -63,33 +63,33 @@ Int_t REST_CreateHisto(string varName, string rootFileName, TString histoName, i return 0; }; - // - // class REST_CreateHisto :public TRestTask { - // public: - // ClassDef(REST_CreateHisto, 1); - // - // REST_CreateHisto() { fNRequiredArgument = 3; } - // ~REST_CreateHisto() {} - // - // TString varName=""; - // TString rootFileName=""; - // TString histoName=""; - // int startVal = 0; - // int endVal = 1000; - // int bins = 1000; - // Double_t normFactor = 1; - // - // void RunTask(TRestManager*mgr) - // { - // REST_CreateHisto(varName, - // rootFileName, - // histoName, - // startVal, - // endVal, - // bins, - // normFactor); - // } - // - //}; +// +// class REST_CreateHisto :public TRestTask { +// public: +// ClassDef(REST_CreateHisto, 1); +// +// REST_CreateHisto() { fNRequiredArgument = 3; } +// ~REST_CreateHisto() {} +// +// TString varName=""; +// TString rootFileName=""; +// TString histoName=""; +// int startVal = 0; +// int endVal = 1000; +// int bins = 1000; +// Double_t normFactor = 1; +// +// void RunTask(TRestManager*mgr) +// { +// REST_CreateHisto(varName, +// rootFileName, +// histoName, +// startVal, +// endVal, +// bins, +// normFactor); +// } +// +//}; #endif diff --git a/macros/REST_RefitGainMap.C b/macros/REST_RefitGainMap.C index b1532168b..7be3a601f 100644 --- a/macros/REST_RefitGainMap.C +++ b/macros/REST_RefitGainMap.C @@ -104,7 +104,7 @@ class GainMapRefitter { // Class that inherits from TFitEditor to be able to access the protected methods of TFitEditor class TFitEditor2 : public TFitEditor { public: - TFitEditor2(TVirtualPad* pad, TObject* obj) : TFitEditor(pad, obj){}; + TFitEditor2(TVirtualPad* pad, TObject* obj) : TFitEditor(pad, obj) {}; virtual ~TFitEditor2() {} // making public the protected method GetFitObjectListOfFunctions() diff --git a/pull-submodules.py b/pull-submodules.py index 3a0d61149..0d5591049 100644 --- a/pull-submodules.py +++ b/pull-submodules.py @@ -69,8 +69,7 @@ def print_help(): if sys.argv[x + 1] == "--lfna": lfna = True - print( - """\ + print("""\ Adding submodules from lfna repositories. Be aware that you should add your local system public ssh to your GitLab and/or GitHub account! It is usually placed at ~/.ssh/id_rsa.pub. @@ -80,8 +79,7 @@ def print_help(): Once you do that, only repositories where you have access rights will be pulled. If no password is requested everything went fine! - """ - ) + """) if sys.argv[x + 1] == "--sjtu": sjtu = True @@ -89,12 +87,10 @@ def print_help(): "Adding submodules from sjtu repositories. You may be asked to enter password for it." ) if sys.argv[x + 1].find("--latest") >= 0: - print( - """\ + print("""\ Pulling latest submodules from their git repository, instead of the version recorded by REST. This may cause the submodules to be uncompilable. - """ - ) + """) latest = True if sys.argv[x + 1].find("--latest:") >= 0: fbName = sys.argv[x + 1][9:] @@ -128,12 +124,10 @@ def main(): # --recursive'.format(PROJECT_ROOT)) if force and not dontask: - answer = input( - """\ + answer = input("""\ This will override local changes on the files. And will bring your local repository to a clean state Are you sure to proceed? (y/n) - """ - ) + """) if answer != "y": sys.exit(0) diff --git a/scripts/generateVersionHeader.py b/scripts/generateVersionHeader.py index 1d85a9b38..7c098a469 100755 --- a/scripts/generateVersionHeader.py +++ b/scripts/generateVersionHeader.py @@ -53,7 +53,7 @@ p = subprocess.Popen( ["git branch"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True ) -(out, err) = p.communicate() +out, err = p.communicate() if len(str(err)) > 3: print( diff --git a/scripts/installAllTags.py b/scripts/installAllTags.py index bbee13496..0ac841378 100644 --- a/scripts/installAllTags.py +++ b/scripts/installAllTags.py @@ -24,9 +24,9 @@ # You might need to add some environment definitions needed to build REST os.environ["GARFIELD_HOME"] = "/programas/garfield" -os.environ[ - "LD_LIBRARY_PATH" -] = "/programas/root34.32/root/lib:/programas/geant4.10.02.p02-install/lib::/programas/garfield/lib" +os.environ["LD_LIBRARY_PATH"] = ( + "/programas/root34.32/root/lib:/programas/geant4.10.02.p02-install/lib::/programas/garfield/lib" +) os.environ["PATH"] = os.environ["PATH"] + ":/programas/root34.32/root/bin/" # =================================================== diff --git a/scripts/scriptsGUI.py b/scripts/scriptsGUI.py index cc3ec9dd3..f801502f8 100755 --- a/scripts/scriptsGUI.py +++ b/scripts/scriptsGUI.py @@ -11,7 +11,6 @@ import vars import subprocess - version = "0.2" vars.initvar() diff --git a/scripts/vars.py b/scripts/vars.py index bbd0017d0..0a6b2f436 100644 --- a/scripts/vars.py +++ b/scripts/vars.py @@ -6,7 +6,6 @@ import platform import subprocess - opt = { "Install_Path": os.environ["HOME"] + "/REST_Install", "Source_Path": os.path.abspath(".") + "/../", diff --git a/source/framework/analysis/inc/TRestDataSetGainMap.h b/source/framework/analysis/inc/TRestDataSetGainMap.h index 11b2d0d07..a993a46eb 100644 --- a/source/framework/analysis/inc/TRestDataSetGainMap.h +++ b/source/framework/analysis/inc/TRestDataSetGainMap.h @@ -283,12 +283,12 @@ class TRestDataSetGainMap : public TRestMetadata { void Initialize(); Module() {} - Module(const TRestDataSetGainMap& parent) : p(&parent){}; + Module(const TRestDataSetGainMap& parent) : p(&parent) {}; Module(const TRestDataSetGainMap& parent, const Int_t planeId, const Int_t moduleId) : p(&parent) { SetPlaneId(planeId); SetModuleId(moduleId); }; - ~Module(){}; + ~Module() {}; }; }; #endif diff --git a/source/framework/core/inc/TRestTask.h b/source/framework/core/inc/TRestTask.h index 9e2c23339..09328a3ee 100644 --- a/source/framework/core/inc/TRestTask.h +++ b/source/framework/core/inc/TRestTask.h @@ -56,7 +56,7 @@ class TRestTask : public TRestMetadata { // Constructor & Destructor TRestTask(); - ~TRestTask(){}; + ~TRestTask() {}; ClassDefOverride(TRestTask, 1); }; diff --git a/source/framework/core/inc/TRestThread.h b/source/framework/core/inc/TRestThread.h index addfbbce2..cebd754a8 100644 --- a/source/framework/core/inc/TRestThread.h +++ b/source/framework/core/inc/TRestThread.h @@ -73,7 +73,7 @@ class TRestThread { // Constructor & Destructor TRestThread() { Initialize(); } - ~TRestThread(){}; + ~TRestThread() {}; }; #endif diff --git a/source/framework/core/src/TRestProcessRunner.cxx b/source/framework/core/src/TRestProcessRunner.cxx index 2ff4d4ff0..e5b52e9aa 100644 --- a/source/framework/core/src/TRestProcessRunner.cxx +++ b/source/framework/core/src/TRestProcessRunner.cxx @@ -487,8 +487,7 @@ void TRestProcessRunner::RunProcess() { } if (fProcStatus != kIgnore && Console::kbhit()) - while (getchar() != '\n') - ; // clear buffer + while (getchar() != '\n'); // clear buffer RESTEssential << "Waiting for processes to finish ..." << RESTendl; @@ -592,8 +591,7 @@ void TRestProcessRunner::PauseMenu() { Console::CursorUp(1); int c = Console::Read(); if (c != '\n') - while (Console::Read() != '\n') - ; + while (Console::Read() != '\n'); TRestStringOutput::REST_Verbose_Level l; if (c == '0' || c == 's') { l = TRestStringOutput::REST_Verbose_Level::REST_Silent; diff --git a/source/framework/tools/inc/TRestTools.h b/source/framework/tools/inc/TRestTools.h index 649df089b..314139806 100644 --- a/source/framework/tools/inc/TRestTools.h +++ b/source/framework/tools/inc/TRestTools.h @@ -195,7 +195,7 @@ inline void SetInitLevel(T* name, int level) { enum Quantities { ENERGY, LENGTH, TIME }; class ValueWithQuantity { public: - ValueWithQuantity(double value, Quantities quantity) : fValue(value), fQuantity(quantity){}; + ValueWithQuantity(double value, Quantities quantity) : fValue(value), fQuantity(quantity) {}; double GetValue() const { return fValue; } std::string ToString() const;