class_docstr: Class for an `Op` with an external C implementation.
  
  One can inherit from this class, provide its constructor with a path to
  an external C source file and the name of a function within it, and define
  an `Op` for said function.
docstr: Sections are loaded from files in order with sections in later
  files overriding sections in previous files.
docstr_tok: ["Sections","are","loaded","from","files","in","order","with","sections","in","later","files","overriding","sections","in","previous","files","."]
code: def __init__(
      self,
      func_files: Union[str, list[str]],
      func_name: Optional[str] = None,
  ):
      """
      Sections are loaded from files in order with sections in later
      files overriding sections in previous files.
  
      """
      if not isinstance(func_files, list):
          self.func_files = [func_files]
      else:
          self.func_files = func_files
  
      self.func_codes: list[str] = []
      # Keep the original name. If we reload old pickle, we want to
      # find the new path and new version of the file in PyTensor.
      self.func_name = func_name
      self.code_sections: dict[str, str] = dict()
  
      self.load_c_code(self.func_files)
  
      if len(self.code_sections) == 0:
          raise ValueError("No sections where defined in the C files")
  
      if self.func_name is not None:
          if "op_code" in self.code_sections:
              # maybe a warning instead (and clearing the key)
              raise ValueError(
                  "Cannot have an `op_code` section and specify `func_name`"
              )
          if "op_code_cleanup" in self.code_sections:
              # maybe a warning instead (and clearing the key)
              raise ValueError(
                  "Cannot have an `op_code_cleanup` section and specify `func_name`"
              )
  
imports: import inspect
  import os
  import re
  import warnings
  from collections.abc import Collection
  from re import Pattern
  from typing import TYPE_CHECKING, Any, Callable, ClassVar, Optional, Union, cast
  import numpy
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Apply, Variable
  from pytensor.graph.op import ComputeMapType, Op, StorageMapType, ThunkType
  from pytensor.graph.type import HasDataType
  from pytensor.graph.utils import MethodNotDefined
  from pytensor.link.c.interface import CLinkerOp
  from pytensor.link.c.params_type import ParamsType
  from pytensor.utils import hash_from_code
label_desc: Use image node_id 2 to create a new ExternalCOp object from inherited base classes: COp with example: obj = ExternalCOp(func_files, func_name)