MCPcopy Index your code
hub / github.com/python/cpython / names

Method names

Lib/trace.py:74–115  ·  view source on GitHub ↗
(self, filename, modulename)

Source from the content-addressed store, hash-verified

72 self._ignore = { '<string>': 1 }
73
74 def names(self, filename, modulename):
75 if modulename in self._ignore:
76 return self._ignore[modulename]
77
78 # haven't seen this one before, so see if the module name is
79 # on the ignore list.
80 if modulename in self._mods: # Identical names, so ignore
81 self._ignore[modulename] = 1
82 return 1
83
84 # check if the module is a proper submodule of something on
85 # the ignore list
86 for mod in self._mods:
87 # Need to take some care since ignoring
88 # "cmp" mustn't mean ignoring "cmpcache" but ignoring
89 # "Spam" must also mean ignoring "Spam.Eggs".
90 if modulename.startswith(mod + '.'):
91 self._ignore[modulename] = 1
92 return 1
93
94 # Now check that filename isn't in one of the directories
95 if filename is None:
96 # must be a built-in, so we must ignore
97 self._ignore[modulename] = 1
98 return 1
99
100 # Ignore a file when it contains one of the ignorable paths
101 for d in self._dirs:
102 # The '+ os.sep' is to ensure that d is a parent directory,
103 # as compared to cases like:
104 # d = "/usr/local"
105 # filename = "/usr/local.py"
106 # or
107 # d = "/usr/local.py"
108 # filename = "/usr/local.py"
109 if filename.startswith(d + os.sep):
110 self._ignore[modulename] = 1
111 return 1
112
113 # Tried the different ways, so we don't ignore this module
114 self._ignore[modulename] = 0
115 return 0
116
117def _modname(path):
118 """Return a plausible module name for the path."""

Callers 1

globaltrace_ltMethod · 0.45

Calls 1

startswithMethod · 0.45

Tested by

no test coverage detected