MCPcopy Create free account
hub / github.com/numpy/numpy / check_items

Function check_items

tools/refguide_check.py:359–430  ·  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

357
358
359def check_items(all_dict, names, deprecated, others, module_name, dots=True):
360 """
361 Check that `all_dict` is consistent with the `names` in `module_name`
362 For instance, that there are no deprecated or extra objects.
363
364 Parameters
365 ----------
366 all_dict : list
367
368 names : set
369
370 deprecated : list
371
372 others : list
373
374 module_name : ModuleType
375
376 dots : bool
377 Whether to print a dot for each check
378
379 Returns
380 -------
381 list
382 List of [(name, success_flag, output)...]
383 """
384 num_all = len(all_dict)
385 num_ref = len(names)
386
387 output = ""
388
389 output += "Non-deprecated objects in __all__: %i\n" % num_all
390 output += "Objects in refguide: %i\n\n" % num_ref
391
392 only_all, only_ref, missing = compare(all_dict, others, names, module_name)
393 dep_in_ref = only_ref.intersection(deprecated)
394 only_ref = only_ref.difference(deprecated)
395
396 if len(dep_in_ref) > 0:
397 output += "Deprecated objects in refguide::\n\n"
398 for name in sorted(deprecated):
399 output += " " + name + "\n"
400
401 if len(only_all) == len(only_ref) == len(missing) == 0:
402 if dots:
403 output_dot('.')
404 return [(None, True, output)]
405 else:
406 if len(only_all) > 0:
407 output += "ERROR: objects in %s.__all__ but not in refguide::\n\n" % module_name
408 for name in sorted(only_all):
409 output += " " + name + "\n"
410
411 output += "\nThis issue can be fixed by adding these objects to\n"
412 output += "the function listing in __init__.py for this module\n"
413
414 if len(only_ref) > 0:
415 output += "ERROR: objects in refguide but not in %s.__all__::\n\n" % module_name
416 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