MCPcopy Create free account
hub / github.com/ActiveState/code / dir

Function dir

recipes/Python/577774_Enhancing_dir_with_globs/recipe-577774.py:5–13  ·  view source on GitHub ↗
(obj=_sentinel, glob=None)

Source from the content-addressed store, hash-verified

3_sentinel = object()
4
5def dir(obj=_sentinel, glob=None):
6 from fnmatch import fnmatchcase
7 if obj is _sentinel:
8 # Get the locals of the caller, not our locals.
9 names = sorted(sys._getframe(1).f_locals)
10 else:
11 names = _dir(obj)
12 if glob is None: return names
13 return [name for name in names if fnmatchcase(name, glob)]

Callers 15

flattenlistFunction · 0.85
filter_builtinsFunction · 0.85
_dirFunction · 0.85
_moduleFunction · 0.85
_exportFunction · 0.85
oaFunction · 0.85
oarFunction · 0.85
show_builtinsFunction · 0.85
__getattr__Method · 0.85
dumpObjFunction · 0.85
direFunction · 0.85
lsFunction · 0.85

Calls 2

_dirFunction · 0.85
sortedFunction · 0.50

Tested by 1

test_listFunction · 0.68