code: def addLagsForTraining(self, df, cycle_residue, iNeedExogenous=False):
      logger = tsutil.get_pyaf_logger()
      add_lag_start_time = time.time()
      for autoreg in self.mARList[cycle_residue]:
          autoreg.mInputNames = []
          P = autoreg.mNbLags
          for p in range(1, P + 1):
              # signal lags ... plain old AR model
              self.addLagForTraining(
                  df, self.mARFrame, cycle_residue, autoreg, p
              )
          # Exogenous variables lags
          if autoreg.mExogenousInfo is not None:
              P1 = P
              lExogCount = len(autoreg.mExogenousInfo.mEncodedExogenous)
              lNbVars = P * lExogCount
              if lNbVars >= self.mOptions.mMaxFeatureForAutoreg:
                  P1 = self.mOptions.mMaxFeatureForAutoreg // lExogCount
              autoreg.mNbExogenousLags = P1
              for p in range(1, P1 + 1):
                  # print(autoreg.mExogenousInfo.mEncodedExogenous);
                  # print(df.columns);
                  for ex in autoreg.mExogenousInfo.mEncodedExogenous:
                      self.addLagForTraining(
                          df, self.mARFrame, ex, autoreg, p
                      )
          # print("AUTOREG_DETAIL" , P , len(autoreg.mInputNames));
          if autoreg.mExogenousInfo is not None:
              assert (
                  P + P * len(autoreg.mExogenousInfo.mEncodedExogenous)
              ) >= len(autoreg.mInputNames)
          else:
              assert P >= len(autoreg.mInputNames)
      if self.mOptions.mDebugProfile:
          logger.info(
              "LAG_TIME_IN_SECONDS "
              + self.mTimeInfo.mSignal
              + " "
              + str(len(self.mARFrame.columns))
              + " "
              + str(time.time() - add_lag_start_time)
          )
  
imports: import pandas
  import numpy
  from .None import Time
  from .None import Perf
  from .None import Plots
  from .None import Utils
  import time
label_desc: Use image node_id 6 for calling the cAutoRegressiveEstimator obj's underlying member method code with example usage: obj.addLagsForTraining(df, cycle_residue, iNeedExogenous) without return types