File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1307,7 +1307,13 @@ async def nmembers(
13071307 # check if we can use consolidated metadata, which requires that we have non-None
13081308 # consolidated metadata at all points in the hierarchy.
13091309 if self .metadata .consolidated_metadata is not None :
1310- return len ([x for x in self .metadata .consolidated_metadata .flattened_metadata if x .count ("/" ) <= max_depth ])
1310+ if max_depth is not None and max_depth < 0 :
1311+ raise ValueError (f"max_depth must be None or >= 0. Got '{ max_depth } ' instead" )
1312+ if max_depth is None :
1313+ return len (self .metadata .consolidated_metadata .flattened_metadata )
1314+ else :
1315+ return len ([x for x in self .metadata .consolidated_metadata .flattened_metadata if x .count ("/" ) <= max_depth ])
1316+
13111317 # TODO: consider using aioitertools.builtins.sum for this
13121318 # return await aioitertools.builtins.sum((1 async for _ in self.members()), start=0)
13131319 n = 0
You can’t perform that action at this time.
0 commit comments