class_docstr: Plugin which implements the --lf (run last-failing) option 
class_docstr_tok: ["Plugin","which","implements","the","--","lf","(","run","last-failing",")","option"]
code: def pytest_collection_modifyitems(self, session, config, items):
      if not self.active:
          return
  
      if self.lastfailed:
          previously_failed = []
          previously_passed = []
          for item in items:
              if item.nodeid in self.lastfailed:
                  previously_failed.append(item)
              else:
                  previously_passed.append(item)
          self._previously_failed_count = len(previously_failed)
  
          if not previously_failed:
              # Running a subset of all tests with recorded failures
              # only outside of it.
              self._report_status = (
                  "%d known failures not in selected tests"
                  % (len(self.lastfailed),)
              )
          else:
              if self.config.getoption("lf"):
                  items[:] = previously_failed
                  config.hook.pytest_deselected(items=previously_passed)
              else:  # --failedfirst
                  items[:] = previously_failed + previously_passed
  
              noun = (
                  "failure"
                  if self._previously_failed_count == 1
                  else "failures"
              )
              suffix = (
                  " first"
                  if self.config.getoption("failedfirst")
                  else ""
              )
              self._report_status = (
                  "rerun previous {count} {noun}{suffix}".format(
                      count=self._previously_failed_count,
                      suffix=suffix,
                      noun=noun,
                  )
              )
  
          if self._skipped_files > 0:
              files_noun = (
                  "file" if self._skipped_files == 1 else "files"
              )
              self._report_status += (
                  " (skipped {files} {files_noun})".format(
                      files=self._skipped_files, files_noun=files_noun
                  )
              )
      else:
          self._report_status = "no previously failed tests, "
          if self.config.getoption("last_failed_no_failures") == "none":
              self._report_status += "deselecting all items."
              config.hook.pytest_deselected(items=items)
              items[:] = []
          else:
              self._report_status += "not deselecting items."
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  import os
  from collections import OrderedDict
  import attr
  import py
  import six
  import pytest
  from .compat import _PY2
  from .pathlib import Path
  from .pathlib import resolve_from_str
  from .pathlib import rm_rf
label_desc: Use image node_id 7 for calling the LFPlugin obj's underlying member method code with example usage: obj.pytest_collection_modifyitems(session, config, items) without return types