MCPcopy Index your code
hub / github.com/RustPython/RustPython / visiblename

Function visiblename

Lib/pydoc.py:326–350  ·  view source on GitHub ↗

Decide whether to show documentation on a variable.

(name, all=None, obj=None)

Source from the content-addressed store, hash-verified

324_future_feature_names = set(__future__.all_feature_names)
325
326def visiblename(name, all=None, obj=None):
327 """Decide whether to show documentation on a variable."""
328 # Certain special names are redundant or internal.
329 # XXX Remove __initializing__?
330 if name in {'__author__', '__builtins__', '__cached__', '__credits__',
331 '__date__', '__doc__', '__file__', '__spec__',
332 '__loader__', '__module__', '__name__', '__package__',
333 '__path__', '__qualname__', '__slots__', '__version__',
334 '__static_attributes__', '__firstlineno__',
335 '__annotate_func__', '__annotations_cache__'}:
336 return 0
337 # Private names are hidden, but special names are displayed.
338 if name.startswith('__') and name.endswith('__'): return 1
339 # Namedtuples have public fields and methods with a single leading underscore
340 if name.startswith('_') and hasattr(obj, '_fields'):
341 return True
342 # Ignore __future__ imports.
343 if obj is not __future__ and name in _future_feature_names:
344 if isinstance(getattr(obj, name, None), __future__._Feature):
345 return False
346 if all is not None:
347 # only document that which the programmer exported in __all__
348 return name in all
349 else:
350 return not name.startswith('_')
351
352def classify_class_attrs(object):
353 """Wrap inspect.classify_class_attrs, with fixup for data descriptors and bound methods."""

Callers 4

docmoduleMethod · 0.85
docclassMethod · 0.85
docmoduleMethod · 0.85
docclassMethod · 0.85

Calls 5

hasattrFunction · 0.85
isinstanceFunction · 0.85
getattrFunction · 0.85
startswithMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected