public string ToPythonString(bool ignoreAlias = false) { if (!ignoreAlias && Alias != null) { return(Alias); } if (IsNamedTypeParameter) { return($"{Namespace}_{Name}".Replace('.', '_')); } var str = ""; if (Namespace != null) { str += $"{Namespace}."; } str += Name; if (TypeParameters.Count == 0) { return(str); } str += "["; // Callable requires Callable[[ParameterType1, ParameterType2, ...], ReturnType] if (Namespace == "typing" && Name == "Callable") { if (IsAction) { str += "["; str += string.Join(", ", TypeParameters.Select(type => type.ToPythonString())); str += "], None"; } else { str += "["; str += string.Join( ", ", TypeParameters.SkipLast(1).Select(type => type.ToPythonString())); str += "], "; str += TypeParameters.Last().ToPythonString(); } } else { str += string.Join(", ", TypeParameters.Select(type => type.ToPythonString())); } str += "]"; return(str); }