MCPcopy
hub / github.com/numpy/numpy / check_items

Function check_items

tools/refguide_check.py:314–385  ·  view source on GitHub ↗

Check that `all_dict` is consistent with the `names` in `module_name` For instance, that there are no deprecated or extra objects. Parameters ---------- all_dict : list names : set deprecated : list others : list module_name : ModuleType dots : bool

(all_dict, names, deprecated, others, module_name, dots=True)

Source from the content-addressed store, hash-verified

312
313
314def check_items(all_dict, names, deprecated, others, module_name, dots=True):
315 """
316 Check that `all_dict` is consistent with the `names` in `module_name`
317 For instance, that there are no deprecated or extra objects.
318
319 Parameters
320 ----------
321 all_dict : list
322
323 names : set
324
325 deprecated : list
326
327 others : list
328
329 module_name : ModuleType
330
331 dots : bool
332 Whether to print a dot for each check
333
334 Returns
335 -------
336 list
337 List of [(name, success_flag, output)...]
338 """
339 num_all = len(all_dict)
340 num_ref = len(names)
341
342 output = ""
343
344 output += f"Non-deprecated objects in __all__: {num_all}\n"
345 output += f"Objects in refguide: {num_ref}\n\n"
346
347 only_all, only_ref, missing = compare(all_dict, others, names, module_name)
348 dep_in_ref = only_ref.intersection(deprecated)
349 only_ref = only_ref.difference(deprecated)
350
351 if len(dep_in_ref) > 0:
352 output += "Deprecated objects in refguide::\n\n"
353 for name in sorted(deprecated):
354 output += " " + name + "\n"
355
356 if len(only_all) == len(only_ref) == len(missing) == 0:
357 if dots:
358 output_dot('.')
359 return [(None, True, output)]
360 else:
361 if len(only_all) > 0:
362 output += f"ERROR: objects in {module_name}.__all__ but not in refguide::\n\n" # noqa: E501
363 for name in sorted(only_all):
364 output += " " + name + "\n"
365
366 output += "\nThis issue can be fixed by adding these objects to\n"
367 output += "the function listing in __init__.py for this module\n"
368
369 if len(only_ref) > 0:
370 output += f"ERROR: objects in refguide but not in {module_name}.__all__::\n\n" # noqa: E501
371 for name in sorted(only_ref):

Callers 1

mainFunction · 0.85

Calls 2

output_dotFunction · 0.85
compareFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…