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

Function effective

Lib/bdb.py:1124–1172  ·  view source on GitHub ↗

Return (active breakpoint, delete temporary flag) or (None, None) as breakpoint to act upon. The "active breakpoint" is the first entry in bplist[line, file] (which must exist) that is enabled, for which checkfuncname is True, and that has neither a False condition nor a

(file, line, frame)

Source from the content-addressed store, hash-verified

1122
1123
1124def effective(file, line, frame):
1125 """Return (active breakpoint, delete temporary flag) or (None, None) as
1126 breakpoint to act upon.
1127
1128 The "active breakpoint" is the first entry in bplist[line, file] (which
1129 must exist) that is enabled, for which checkfuncname is True, and that
1130 has neither a False condition nor a positive ignore count. The flag,
1131 meaning that a temporary breakpoint should be deleted, is False only
1132 when the condiion cannot be evaluated (in which case, ignore count is
1133 ignored).
1134
1135 If no such entry exists, then (None, None) is returned.
1136 """
1137 possibles = Breakpoint.bplist[file, line]
1138 for b in possibles:
1139 if not b.enabled:
1140 continue
1141 if not checkfuncname(b, frame):
1142 continue
1143 # Count every hit when bp is enabled
1144 b.hits += 1
1145 if not b.cond:
1146 # If unconditional, and ignoring go on to next, else break
1147 if b.ignore > 0:
1148 b.ignore -= 1
1149 continue
1150 else:
1151 # breakpoint and marker that it's ok to delete if temporary
1152 return (b, True)
1153 else:
1154 # Conditional bp.
1155 # Ignore count applies only to those bpt hits where the
1156 # condition evaluates to true.
1157 try:
1158 val = eval(b.cond, frame.f_globals, frame.f_locals)
1159 if val:
1160 if b.ignore > 0:
1161 b.ignore -= 1
1162 # continue
1163 else:
1164 return (b, True)
1165 # else:
1166 # continue
1167 except:
1168 # if eval fails, most conservative thing is to stop on
1169 # breakpoint regardless of ignore count. Don't delete
1170 # temporary, as another hint to user.
1171 return (b, False)
1172 return (None, None)
1173
1174
1175# -------------------- testing --------------------

Callers 1

break_hereMethod · 0.85

Calls 2

checkfuncnameFunction · 0.85
evalFunction · 0.50

Tested by

no test coverage detected