def __init__(self, cls: type, **kwargs: Unpack[StatementOptions]) -> None:
self.cls = cls
self.cls_module = sys.modules.get(cls.__module__)
if "dialect" in kwargs:
self.dialect = kwargs["dialect"]
else:
self.dialect = None
self.params = kwargs
setattr(cls, self._PARAMS, self.params)
if cls.__module__ in sys.modules:
self.globals = sys.modules[cls.__module__].__dict__
else:
# Theoretically this can happen if someone writes
# a custom string to cls.__module__. In which case
# such dataclass won't be fully introspectable
# (w.r.t. typing.get_type_hints) but will still function
# correctly.
self.globals: dict[str, Any] = {}
# analysis state, used by scan_field, etc.
self.fields = StatementFields()
self.has_statement_bases = False
self.kw_only = self.params.get("kw_only", False)
self.KW_ONLY_seen = False