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

Method is_

Lib/tomllib/_parser.py:248–263  ·  view source on GitHub ↗
(self, key: Key, flag: int)

Source from the content-addressed store, hash-verified

246 cont[key_stem]["recursive_flags" if recursive else "flags"].add(flag)
247
248 def is_(self, key: Key, flag: int) -> bool:
249 if not key:
250 return False # document root has no flags
251 cont = self._flags
252 for k in key[:-1]:
253 if k not in cont:
254 return False
255 inner_cont = cont[k]
256 if flag in inner_cont["recursive_flags"]:
257 return True
258 cont = inner_cont["nested"]
259 key_stem = key[-1]
260 if key_stem in cont:
261 inner_cont = cont[key_stem]
262 return flag in inner_cont["flags"] or flag in inner_cont["recursive_flags"]
263 return False
264
265
266class NestedDict:

Callers 6

parse_inline_tableFunction · 0.95
test_operatorMethod · 0.80
test_isMethod · 0.80
create_dict_ruleFunction · 0.80
create_list_ruleFunction · 0.80
key_value_ruleFunction · 0.80

Calls

no outgoing calls

Tested by 2

test_operatorMethod · 0.64
test_isMethod · 0.64