MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / in_project_scope

Method in_project_scope

pydevd.py:1255–1316  ·  view source on GitHub ↗

Note: in general this method should not be used (apply_files_filter should be used in most cases as it also handles the project scope check). :param frame: The frame we want to check. :param absolute_filename: Must be the result from get_abs

(self, frame, absolute_filename=None)

Source from the content-addressed store, hash-verified

1253 return self.plugin
1254
1255 def in_project_scope(self, frame, absolute_filename=None):
1256 """
1257 Note: in general this method should not be used (apply_files_filter should be used
1258 in most cases as it also handles the project scope check).
1259
1260 :param frame:
1261 The frame we want to check.
1262
1263 :param absolute_filename:
1264 Must be the result from get_abs_path_real_path_and_base_from_frame(frame)[0] (can
1265 be used to speed this function a bit if it's already available to the caller, but
1266 in general it's not needed).
1267 """
1268 try:
1269 if absolute_filename is None:
1270 try:
1271 # Make fast path faster!
1272 abs_real_path_and_basename = NORM_PATHS_AND_BASE_CONTAINER[frame.f_code.co_filename]
1273 except:
1274 abs_real_path_and_basename = get_abs_path_real_path_and_base_from_frame(frame)
1275
1276 absolute_filename = abs_real_path_and_basename[0]
1277
1278 cache_key = (frame.f_code.co_firstlineno, absolute_filename, frame.f_code)
1279
1280 return self._in_project_scope_cache[cache_key]
1281 except KeyError:
1282 cache = self._in_project_scope_cache
1283 try:
1284 abs_real_path_and_basename # If we've gotten it previously, use it again.
1285 except NameError:
1286 abs_real_path_and_basename = get_abs_path_real_path_and_base_from_frame(frame)
1287
1288 # pydevd files are never considered to be in the project scope.
1289 file_type = self.get_file_type(frame, abs_real_path_and_basename)
1290 if file_type == self.PYDEV_FILE:
1291 cache[cache_key] = False
1292
1293 elif IS_PY314_OR_GREATER and frame.f_code.co_name == "__annotate__":
1294 # Special handling for __annotate__ functions (PEP 649 in Python 3.14+).
1295 # These are compiler-generated functions that can raise NotImplementedError
1296 # when called with unsupported format arguments by inspect.call_annotate_function.
1297 # They should be treated as library code to avoid false positives in exception handling.
1298 # Note: PEP 649 reserves the __annotate__ name for compiler-generated functions,
1299 # so user-defined functions with this name are discouraged and will also be treated
1300 # as library code to maintain consistency with the language design.
1301 cache[cache_key] = False
1302
1303 elif absolute_filename == "<string>":
1304 # Special handling for '<string>'
1305 if file_type == self.LIB_FILE:
1306 cache[cache_key] = False
1307 else:
1308 cache[cache_key] = True
1309
1310 elif self.source_mapping.has_mapping_entry(absolute_filename):
1311 cache[cache_key] = True
1312

Callers 7

apply_files_filterMethod · 0.95
__call__Method · 0.80
full_functionFunction · 0.80

Calls 4

get_file_typeMethod · 0.95
has_mapping_entryMethod · 0.80
in_project_rootsMethod · 0.80

Tested by

no test coverage detected