diff --git a/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs index 765dc76942..abcf7d2327 100644 --- a/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs @@ -36,11 +36,12 @@ public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWrit } var abcClass = !codeElement.Implements.Any() ? string.Empty : $"{codeElement.Implements.Select(static x => x.Name).Aggregate((x, y) => x + ", " + y)}"; - var derivation = codeElement.Inherits is CodeType inheritType && + var baseClass = codeElement.Inherits is CodeType inheritType && conventions.GetTypeString(inheritType, codeElement) is string inheritSymbol && !string.IsNullOrEmpty(inheritSymbol) ? inheritSymbol : - abcClass; + string.Empty; + var derivation = string.IsNullOrEmpty(baseClass) ? abcClass : string.IsNullOrEmpty(abcClass) ? baseClass : $"{baseClass}, {abcClass}"; writer.WriteLine($"class {codeElement.Name}({derivation}):"); writer.IncreaseIndent(); if (codeElement.Parent is CodeClass parent)