(self, key: Key, flag: int)
| 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 | |
| 266 | class NestedDict: |
no outgoing calls