File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -135,15 +135,15 @@ class Resource(BaseModel):
135
135
children : dict [str , Resource ] = {}
136
136
137
137
def to_opossum_file_format (self ) -> opossum_file .ResourceInFile :
138
- if self .type == ResourceType .FILE :
139
- return 1
140
- else :
138
+ if self .children or self .type == ResourceType .FOLDER :
141
139
return {
142
140
str (child .path .relative_to (self .path )).replace (
143
141
"\\ " , "/"
144
142
): child .to_opossum_file_format ()
145
143
for child in self .children .values ()
146
144
}
145
+ else :
146
+ return 1
147
147
148
148
def add_resource (self , resource : Resource ) -> None :
149
149
if not resource .path .is_relative_to (self .path ):
@@ -174,7 +174,10 @@ def _update(self, other: Resource) -> None:
174
174
+ f"{ self .path } vs. { other .path } "
175
175
)
176
176
if self .type and other .type and self .type != other .type :
177
- raise RuntimeError ("Trying to merge incompatible node types." )
177
+ raise RuntimeError (
178
+ "Trying to merge incompatible node types. "
179
+ + f"Current node is { self .type } . Other is { other .type } "
180
+ )
178
181
self .type = self .type or other .type
179
182
self .attributions .extend (other .attributions )
180
183
for key , child in other .children .items ():
You can’t perform that action at this time.
0 commit comments