def __eq__()

in samcli/lib/build/build_graph.py [0:0]


    def __eq__(self, other: Any) -> bool:
        """
        Checks equality of the function build definition

        Parameters
        ----------
        other: Any
            other function build definition to compare

        Returns
        -------
        bool
            True if both function build definitions has same following properties, False otherwise
        """
        if not isinstance(other, FunctionBuildDefinition):
            return False

        # each build with custom Makefile definition should be handled separately
        if self.metadata and self.metadata.get("BuildMethod", None) == "makefile":
            return False

        if self.metadata and self.metadata.get("BuildMethod", None) == "esbuild":
            # For esbuild, we need to check if handlers within the same CodeUri are the same
            # if they are different, it should create a separate build definition
            if self.handler != other.handler:
                return False

        if self.runtime in COMPILED_RUNTIMES:
            # For compiled languages, we need to check if handlers within the same CodeUri are the same
            # if they are different, it should create a separate build definition
            if self.handler != other.handler:
                return False

        return (
            self.runtime == other.runtime
            and self.codeuri == other.codeuri
            and self.imageuri == other.imageuri
            and self.packagetype == other.packagetype
            and self.metadata == other.metadata
            and self.env_vars == other.env_vars
            and self.architecture == other.architecture
        )