3434 ValidationInfo ,
3535 field_validator ,
3636 model_validator ,
37+ validation_data ,
3738 validation_error_message ,
3839 get_concrete_types_from_typehint ,
3940)
@@ -1081,7 +1082,7 @@ def validate_execution_project(
10811082 v : t .Optional [str ],
10821083 info : ValidationInfo ,
10831084 ) -> t .Optional [str ]:
1084- if v and not info . data .get ("project" ):
1085+ if v and not validation_data ( info ) .get ("project" ):
10851086 raise ConfigError (
10861087 "If the `execution_project` field is specified, you must also specify the `project` field to provide a default object location."
10871088 )
@@ -1093,7 +1094,7 @@ def validate_quota_project(
10931094 v : t .Optional [str ],
10941095 info : ValidationInfo ,
10951096 ) -> t .Optional [str ]:
1096- if v and not info . data .get ("project" ):
1097+ if v and not validation_data ( info ) .get ("project" ):
10971098 raise ConfigError (
10981099 "If the `quota_project` field is specified, you must also specify the `project` field to provide a default object location."
10991100 )
@@ -2343,35 +2344,28 @@ def init(cursor: t.Any) -> None:
23432344 return init
23442345
23452346
2347+ _CONNECTION_CONFIG_EXCLUDE : t .Set [t .Type [ConnectionConfig ]] = {
2348+ ConnectionConfig , # type: ignore[type-abstract]
2349+ BaseDuckDBConnectionConfig , # type: ignore[type-abstract]
2350+ }
2351+
23462352CONNECTION_CONFIG_TO_TYPE = {
23472353 # Map all subclasses of ConnectionConfig to the value of their `type_` field.
23482354 tpe .all_field_infos ()["type_" ].default : tpe
2349- for tpe in subclasses (
2350- __name__ ,
2351- ConnectionConfig ,
2352- exclude = {ConnectionConfig , BaseDuckDBConnectionConfig },
2353- )
2355+ for tpe in subclasses (__name__ , ConnectionConfig , exclude = _CONNECTION_CONFIG_EXCLUDE )
23542356}
23552357
23562358DIALECT_TO_TYPE = {
23572359 tpe .all_field_infos ()["type_" ].default : tpe .DIALECT
2358- for tpe in subclasses (
2359- __name__ ,
2360- ConnectionConfig ,
2361- exclude = {ConnectionConfig , BaseDuckDBConnectionConfig },
2362- )
2360+ for tpe in subclasses (__name__ , ConnectionConfig , exclude = _CONNECTION_CONFIG_EXCLUDE )
23632361}
23642362
23652363INIT_DISPLAY_INFO_TO_TYPE = {
23662364 tpe .all_field_infos ()["type_" ].default : (
23672365 tpe .DISPLAY_ORDER ,
23682366 tpe .DISPLAY_NAME ,
23692367 )
2370- for tpe in subclasses (
2371- __name__ ,
2372- ConnectionConfig ,
2373- exclude = {ConnectionConfig , BaseDuckDBConnectionConfig },
2374- )
2368+ for tpe in subclasses (__name__ , ConnectionConfig , exclude = _CONNECTION_CONFIG_EXCLUDE )
23752369}
23762370
23772371
0 commit comments