huggingface_hub
b17ab0ce - [CLI] Drop legacy printing helpers from `_cli_utils.py` (#4285)

Commit
1 day ago
[CLI] Drop legacy printing helpers from `_cli_utils.py` (#4285) * [CLI] Drop legacy printing helpers from `_cli_utils.py` Now that every command has migrated to the `out` singleton, the legacy helpers in `_cli_utils.py` have no callers. The one exception was `api_object_to_dict`, which still served dataclass→dict conversion before `out.table` / JSON serialization — and `_output.py` already exposes the same helper as `_dataclass_to_dict`. So: - Switch every caller (discussions, models, datasets, papers, spaces, collections, _file_listing) from `api_object_to_dict` to `_dataclass_to_dict` from `_output.py`. - Delete from `_cli_utils.py`: `api_object_to_dict`, `_serialize_value`, `print_as_table`, `print_list_output`, `_format_cell`, `_format_value`, `_to_header`, `_MAX_CELL_LENGTH`, plus the legacy option types and enum (`OutputFormat`, `_set_output_mode`, `FormatOpt`, `FormatWithAutoOpt`, `QuietOpt`). Remove now-orphaned imports (`json`, `dataclasses`, `datetime`, `tabulate`, `Union`). - Update `tests/test_cli_output.py` to import `OutputFormatWithAuto` from `_output.py` directly instead of via the `_cli_utils.py` re-export. No behavior change. * [CLI] Rename `OutputFormatWithAuto` to `OutputFormat` (#4286) The legacy `OutputFormat` (table | json) was removed in the previous cleanup PR, freeing up the name. `OutputFormatWithAuto` was always the "real" enum — covering auto/human/agent/json/quiet — so drop the disambiguating suffix. Pure rename, no behavior change. Also removes the now-stale TODO comment in `_output.py` that referenced the (now deleted) legacy enum.
Author
Parents
Loading