Skip to content

Commit dcfb6c8

Browse files
xclaessedcbaker
authored andcommitted
cargo: Convert PackageState into a dataclass
1 parent 0dd5c13 commit dcfb6c8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mesonbuild/cargo/interpreter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,13 @@ def _extra_deps_varname() -> str:
458458
return 'extra_deps'
459459

460460

461+
@dataclasses.dataclass
461462
class PackageState:
462-
def __init__(self, manifest: Manifest, downloaded: bool) -> None:
463-
self.manifest = manifest
464-
self.downloaded = downloaded
465-
self.features: T.Set[str] = set()
466-
self.required_deps: T.Set[str] = set()
467-
self.optional_deps_features: T.Dict[str, T.Set[str]] = collections.defaultdict(set)
463+
manifest: Manifest
464+
downloaded: bool = False
465+
features: T.Set[str] = dataclasses.field(default_factory=set)
466+
required_deps: T.Set[str] = dataclasses.field(default_factory=set)
467+
optional_deps_features: T.Dict[str, T.Set[str]] = dataclasses.field(default_factory=lambda: collections.defaultdict(set))
468468

469469

470470
@dataclasses.dataclass(frozen=True)

0 commit comments

Comments
 (0)