UNPKG

@graphql-codegen/python-common

Version:

Shared Python-specific helpers (reserved keywords, scalar mapping, identifier naming) for @graphql-codegen/python and @graphql-codegen/python-operations.

15 lines (14 loc) • 690 B
/** * Python reserved keywords (from the CPython `keyword` module, incl. the soft * keywords `match`/`case`). Names matching one of these get a trailing `_` * wherever they'd otherwise be used as a Python identifier. */ export declare const PYTHON_KEYWORDS: Set<string>; /** A valid Python identifier (matches the GraphQL Name grammar plus keywords). */ export declare const PY_IDENT_RE: RegExp; /** * Whether `name` can be used as a plain Python class/dict attribute: it must * be a valid identifier AND not a reserved keyword. When it cannot, the * containing `TypedDict` must be emitted with functional syntax. */ export declare function isValidClassAttr(name: string): boolean;