MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / names

Method names

tools/python-3.11.9-amd64/Lib/trace.py:76–117  ·  view source on GitHub ↗
(self, filename, modulename)

Source from the content-addressed store, hash-verified

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

Callers 1

globaltrace_ltMethod · 0.45

Calls 1

startswithMethod · 0.80

Tested by

no test coverage detected