class_docstr: Finds relevant Lightning objects in files in the file system.
  
  Attributes
  ----------
  visitor_classes: List[Type]
      List of visitor classes to use when traversing files.
  Parameters
  ----------
  path: str
      Path to file, or directory where to look for files to scan.
  glob_pattern: str
      Glob pattern to use when looking for files in the path,
      applied when path is a directory. Default is "**/*.py".
class_docstr_tok: ["Finds","relevant","Lightning","objects","in","files","in","the","file","system",".","Attributes","--","--","--","--","--","visitor_classes",":","List","[","Type","]","List","of","visitor","classes","to","use","when","traversing","files",".","Parameters","--","--","--","--","--","path",":","str","Path","to","file",",","or","directory","where","to","look","for","files","to","scan",".","glob_pattern",":","str","Glob","pattern","to","use","when","looking","for","files","in","the","path",",","applied","when","path","is","a","directory",".","Default","is","``","*","*","\/","*",".py","''","."]
docstr: Finds Lightning modules in files, returning importable objects.
  
  Returns
  -------
  List[Dict[str, Any]]
      List of dicts containing all metadata required
      to import modules found.
docstr_tok: ["Finds","Lightning","modules","in","files",",","returning","importable","objects",".","Returns","--","--","--","-","List","[","Dict","[","str",",","Any","]","]","List","of","dicts","containing","all","metadata","required","to","import","modules","found","."]
code: def scan(self) -> List[Dict[str, str]]:
      """Finds Lightning modules in files, returning importable objects.
  
      Returns
      -------
      List[Dict[str, Any]]
          List of dicts containing all metadata required
          to import modules found.
  
      """
      modules_found: Dict[str, List[Dict[str, Any]]] = {}
  
      for path in self.paths:
          try:
              module = ast.parse(path.open().read())
          except SyntaxError:
              print(f"Error while parsing {path}: SKIPPING")
              continue
          for visitor_class in self.visitor_classes:
              visitor = visitor_class()
              visitor.visit(module)
              if not visitor.found:
                  continue
              _path = str(path)
              ns_info = {
                  "file": _path,
                  "namespace": _path.replace("/", ".").replace(
                      ".py", ""
                  ),
              }
              modules_found[visitor_class.class_name] = [
                  {**entry, **ns_info} for entry in visitor.found
              ]
  
      return modules_found
  
imports: import ast
  import inspect
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Type, Union
label_desc: Use image node_id 3 for calling the Scanner obj's underlying member method code with example usage: obj.scan() and returns: modules_found