Skip to content

Commit ee17677

Browse files
committed
py: refactoring
1 parent ce755c5 commit ee17677

2 files changed

Lines changed: 18 additions & 20 deletions

File tree

src/api/writer-generator/python/python.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,24 @@ export class Python extends Writer<PythonGeneratorOptions> {
283283
return baseTypes;
284284
}
285285

286+
private buildImportLine(remaining: string[], maxImportLineLength: number): string {
287+
let line = "";
288+
while (remaining.length > 0 && line.length < maxImportLineLength) {
289+
const entity = remaining.shift();
290+
if (!entity) throw new Error("Unexpected empty entity");
291+
if (line.length > 0) {
292+
line += ", ";
293+
}
294+
line += entity;
295+
}
296+
297+
if (remaining.length > 0) {
298+
line += ", \\";
299+
}
300+
301+
return line;
302+
}
303+
286304
private importResources(
287305
fullPyPackageName: string,
288306
importEmptyResources: boolean,

src/api/writer-generator/writer.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -196,24 +196,4 @@ export abstract class Writer<T extends WriterOptions = WriterOptions> extends Fi
196196
this.deindent();
197197
this.line(`]${endTokens?.filter(Boolean).join(" ") ?? ""}`);
198198
}
199-
200-
// FIXME: python specific
201-
buildImportLine(remaining: string[], maxImportLineLength: number): string {
202-
let line = "";
203-
204-
while (remaining.length > 0 && line.length < maxImportLineLength) {
205-
const entity = remaining.shift();
206-
if (!entity) throw new Error("Unexpected empty entity");
207-
if (line.length > 0) {
208-
line += ", ";
209-
}
210-
line += entity;
211-
}
212-
213-
if (remaining.length > 0) {
214-
line += ", \\";
215-
}
216-
217-
return line;
218-
}
219199
}

0 commit comments

Comments
 (0)