def run(self, func: str, args: Any, _kwargs: Any) -> Diagnostic | None:
        """
        Check for repeated scalar accesses to arrays.

        Args:
            name (str):
                Name of the function being invoked
            args (tuple):
                Any positional arguments the function is being called with
            kwargs (dict):
                Any keyword arguments the function is being called with

        Returns:
            a ``Diagnostic`` in case a new detection at the current location
            is reported, otherwise None

        """
        if func in {"__setitem__", "__getitem__"}:
            ndim: int = args[0].ndim
            if is_scalar_key(args[1], ndim):

                # if we can't find a user frame, then it is probably due to a
                # detection inside cupynumeric itself. Either way, there is no
                # actionable information to provide users, so just punt here.
                if (locator := self.locate()) is None:
                    return None

                self._itemop_counts[locator.lineno] += 1
                if self._itemop_counts[locator.lineno] > self.ITEMOP_THRESHOLD:
                    return self.report(locator)

        return None

        Check for repeated scalar accesses to arrays.

        Args:
            name (str):
                Name of the function being invoked
            args (tuple):
                Any positional arguments the function is being called with
            kwargs (dict):
                Any keyword arguments the function is being called with

        Returns:
            a ``Diagnostic`` in case a new detection at the current location
            is reported, otherwise None

        
cupynumeric/_array/doctor.py