def __str__()

in torcharrow/expression.py [0:0]


    def __str__(self):
        args = []
        if self._args is not None:
            args = [Call.__str(v) for v in self._args]
        if self._kwargs is not None:
            if all(k.isidentifier() and not iskeyword(k) for k in self._kwargs.keys()):
                args += [f"{str(k)}={Call.__str(v)}" for k, v in self._kwargs.items()]
            else:
                args += (
                    "**{"
                    + ", ".join(
                        f"{k} : {Call.__str(v)}" for k, v in self._kwargs.items()
                    )
                    + "}"
                )
        if (
            isinstance(self._func, type(_dummy_function))
            and self._func.__name__ == "__init__"
        ):
            # from T.__init(self,....) to T(...)
            qualname = self._func.__qualname__
            return f"{qualname[:qualname.rindex('.')]}({', '.join(args[1:])})"
        if isinstance(self._func, type(_dummy_function)) and hasattr(
            self._func, "_is_property"
        ):
            return f"!!{args[0]}.{self._func.__name__}"
        if isinstance(self._func, type(_dummy_function)):
            module = (
                ""
                if self._func.__module__ == "__main__"
                else self._func.__module__ + "."
            )
            return f"{module}{self._func.__qualname__}({', '.join(args)})"
        if isinstance(self._func, GetAttr):
            return f"{Call.__str(self._func)}({', '.join(args)})"
        raise AssertionError(f"unexpected case {type(self._func)} {self._func}")