Populate config partially using parsed absl flags. This method should only set configs that are used by this class, and not any child classes, which allows each class to be encapsulated. To read flags recursively, use `utils.from_flags`.
(cls, fv: flags.FlagValues, **kwargs)
| 629 | |
| 630 | @classmethod |
| 631 | def from_flags(cls, fv: flags.FlagValues, **kwargs) -> Config: |
| 632 | """Populate config partially using parsed absl flags. |
| 633 | |
| 634 | This method should only set configs that are used by this class, and not any child classes, |
| 635 | which allows each class to be encapsulated. |
| 636 | |
| 637 | To read flags recursively, use `utils.from_flags`. |
| 638 | """ |
| 639 | cfg: FlagConfigurable.Config = kwargs.pop("prebuilt_cfg", cls.default_config()) |
| 640 | flag_values = {**fv.flag_values_dict(), **kwargs} |
| 641 | return cfg.set( |
| 642 | **{field: flag_values[field] for field in cfg.keys() if field in flag_values} |
| 643 | ) |
| 644 | |
| 645 | @classmethod |
| 646 | def set_defaults(cls, fv: flags.FlagValues): |