Skip to content

Commit 77672e6

Browse files
committed
npm run format
1 parent 4e7a2fd commit 77672e6

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/server/templates/python.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -258,41 +258,41 @@ const PY_TYPE_MAP = {
258258
// Miscellaneous types
259259
void: 'None',
260260
record: 'dict[str, Any]',
261-
} as const;
261+
} as const
262262

263-
type PythonType = (typeof PY_TYPE_MAP)[keyof typeof PY_TYPE_MAP];
263+
type PythonType = (typeof PY_TYPE_MAP)[keyof typeof PY_TYPE_MAP]
264264

265265
function pgTypeToPythonType(pgType: string, nullable: boolean, types: PostgresType[] = []): string {
266-
let pythonType: PythonType | undefined = undefined;
266+
let pythonType: PythonType | undefined = undefined
267267

268268
if (pgType in PY_TYPE_MAP) {
269-
pythonType = PY_TYPE_MAP[pgType as keyof typeof PY_TYPE_MAP];
269+
pythonType = PY_TYPE_MAP[pgType as keyof typeof PY_TYPE_MAP]
270270
}
271271

272272
// Enums
273-
const enumType = types.find((type) => type.name === pgType && type.enums.length > 0);
273+
const enumType = types.find((type) => type.name === pgType && type.enums.length > 0)
274274
if (enumType) {
275-
pythonType = 'str'; // Enums typically map to strings in Python
275+
pythonType = 'str' // Enums typically map to strings in Python
276276
}
277277

278278
if (pythonType) {
279279
// If the type is nullable, append "| None" to the type
280-
return nullable ? `${pythonType} | None` : pythonType;
280+
return nullable ? `${pythonType} | None` : pythonType
281281
}
282282

283283
// Composite types
284-
const compositeType = types.find((type) => type.name === pgType && type.attributes.length > 0);
284+
const compositeType = types.find((type) => type.name === pgType && type.attributes.length > 0)
285285
if (compositeType) {
286286
// In Python, we can map composite types to dictionaries
287-
return nullable ? 'dict[str, Any] | None' : 'dict[str, Any]';
287+
return nullable ? 'dict[str, Any] | None' : 'dict[str, Any]'
288288
}
289289

290290
// Arrays
291291
if (pgType.startsWith('_')) {
292-
const innerType = pgTypeToPythonType(pgType.slice(1), nullable, types);
293-
return `list[${innerType}]`;
292+
const innerType = pgTypeToPythonType(pgType.slice(1), nullable, types)
293+
return `list[${innerType}]`
294294
}
295295

296296
// Fallback
297-
return nullable ? 'Any | None' : 'Any';
297+
return nullable ? 'Any | None' : 'Any'
298298
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy