Skip to content

Commit 8c46b51

Browse files
dhellmannclaude
andcommitted
fix(packagesettings): restore frozenset default for serialize exclude parameter
The serialize() method should default to a frozenset as it was before. - Change exclude parameter type to set[str] | frozenset[str] - Default to frozenset({'name', 'has_config'}) - Convert frozenset to set when calling model_dump() to satisfy Pydantic's IncEx type 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ab94285 commit 8c46b51

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/fromager/packagesettings.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,19 +546,17 @@ def serialize(
546546
mode: str = "python",
547547
exclude_defaults: bool = True,
548548
exclude_unset: bool = True,
549-
exclude: typing.Any = None,
549+
exclude: set[str] | frozenset[str] = frozenset({"name", "has_config"}),
550550
**kwargs: typing.Any,
551551
) -> dict[str, typing.Any]:
552552
"""Serialize package configuration"""
553-
if exclude is None:
554-
exclude = {"name", "has_config"}
555553
return self.model_dump(
556554
mode=mode,
557555
# exclude defaults
558556
exclude_defaults=exclude_defaults,
559557
exclude_unset=exclude_unset,
560558
# name and has_config are not serialized
561-
exclude=exclude,
559+
exclude=set(exclude),
562560
**kwargs,
563561
)
564562

0 commit comments

Comments
 (0)