fork of hey-api/openapi-ts because I need some additional things
1import type { PyNodeBase } from '../base';
2import type { PyExpression } from '../expression';
3import { PyNodeKind } from '../kinds';
4import type { PyStatement } from '../statement';
5import { createBlock, type PyBlock } from './block';
6import type { PyWithItem } from './withItem';
7
8export interface PyWithStatement extends PyNodeBase {
9 body: PyBlock;
10 items: ReadonlyArray<PyWithItem>;
11 kind: PyNodeKind.WithStatement;
12 modifiers?: ReadonlyArray<PyExpression>;
13}
14
15export function createWithStatement(
16 items: ReadonlyArray<PyWithItem>,
17 body: ReadonlyArray<PyStatement>,
18 modifiers?: ReadonlyArray<PyExpression>,
19 leadingComments?: ReadonlyArray<string>,
20 trailingComments?: ReadonlyArray<string>,
21): PyWithStatement {
22 return {
23 body: createBlock(body),
24 items,
25 kind: PyNodeKind.WithStatement,
26 leadingComments,
27 modifiers,
28 trailingComments,
29 };
30}