11import json
22from pathlib import Path
3- from typing import Any , Optional
3+ from typing import Any , ClassVar , Optional
44
55from cmake_file_api .kinds .common import CMakeSourceBuildPaths , VersionMajorMinor
66from cmake_file_api .kinds .kind import ObjectKind
@@ -18,7 +18,7 @@ def __init__(self, name: str):
1818 self .targets : list [CMakeTarget ] = []
1919
2020 @classmethod
21- def from_dict (cls , dikt : dict [str , str ]) -> "CMakeProject" :
21+ def from_dict (cls , dikt : dict [str , Any ]) -> "CMakeProject" :
2222 name = dikt ["name" ]
2323 return cls (name )
2424
@@ -43,7 +43,7 @@ def __repr__(self) -> str:
4343class CMakeDirectory :
4444 __slots__ = ("source" , "build" , "parentDirectory" , "childDirectories" , "project" , "targets" , "minimumCMakeVersion" , "hasInstallRule" )
4545
46- def __init__ (self , source : Path , build : Path , minimumCMakeVersion : Optional [str ], hasInstallRule : bool ):
46+ def __init__ (self , source : Path , build : Path , minimumCMakeVersion : Optional [str ], hasInstallRule : bool ) -> None :
4747 self .source = source
4848 self .build = build
4949 self .parentDirectory : Optional [CMakeDirectory ] = None
@@ -57,7 +57,10 @@ def __init__(self, source: Path, build: Path, minimumCMakeVersion: Optional[str]
5757 def from_dict (cls , dikt : dict [str , Any ]) -> "CMakeDirectory" :
5858 source = Path (dikt ["source" ])
5959 build = Path (dikt ["build" ])
60- minimumCMakeVersion = dikt .get ("minimumCMakeVersion" , None )
60+ if dikt .get ("minimumCMakeVersion" , None ) is not None :
61+ minimumCMakeVersion = dikt ["minimumCMakeVersion" ]["string" ]
62+ else :
63+ minimumCMakeVersion = None
6164 hasInstallRule = dikt .get ("hasInstallRule" , False )
6265 return cls (source , build , minimumCMakeVersion , hasInstallRule )
6366
@@ -154,7 +157,7 @@ def __repr__(self) -> str:
154157
155158
156159class CodemodelV2 :
157- KIND = ObjectKind .CODEMODEL
160+ KIND : ClassVar = ObjectKind .CODEMODEL
158161
159162 __slots__ = ("version" , "paths" , "configurations" )
160163
0 commit comments