| 534 | return False |
| 535 | |
| 536 | def keys(self, dotted: bool = False): |
| 537 | if not dotted: |
| 538 | return super().keys() |
| 539 | |
| 540 | if not self._box_config["box_dots"]: |
| 541 | raise BoxError("Cannot return dotted keys as this Box does not have `box_dots` enabled") |
| 542 | |
| 543 | keys = set() |
| 544 | for key, value in self.items(): |
| 545 | added = False |
| 546 | if isinstance(key, str): |
| 547 | if isinstance(value, Box): |
| 548 | for sub_key in value.keys(dotted=True): |
| 549 | keys.add(f"{key}.{sub_key}") |
| 550 | added = True |
| 551 | elif isinstance(value, box.BoxList): |
| 552 | for pos in value._dotted_helper(): |
| 553 | keys.add(f"{key}{pos}") |
| 554 | added = True |
| 555 | if not added: |
| 556 | keys.add(key) |
| 557 | return sorted(keys, key=lambda x: str(x)) |
| 558 | |
| 559 | def items(self, dotted: bool = False): |
| 560 | if not dotted: |