huggingface_hub
098091fe - [CLI] Better CLI errors formatting (#3889)

Commit
43 days ago
[CLI] Better CLI errors formatting (#3889) * Better CLI errors * Fix label capitalization consistency: lowercase when mid-sentence In _format_entry_not_found, the label appeared mid-sentence ('File not found in Dataset ...') but was capitalized. Apply the rule consistently: capitalize when starting a sentence, lowercase otherwise. Update tests to match the corrected casing. Co-authored-by: Lucain <Wauplin@users.noreply.github.com> * Fix mypy errors: make _format() generic to preserve subclass types Use TypeVar to make _format() return the specific HfHubHTTPError subclass type, so mypy recognizes attributes like repo_type, repo_id, and bucket_id on the returned error objects. Co-authored-by: Lucain <Wauplin@users.noreply.github.com> * Fix mypy: use distinct variable names per error branch in hf_raise_for_status Mypy narrows the type of 'err' on the first assignment and then rejects reassignments to different subclass types in later elif branches. Use unique names (revision_err, entry_err, gated_err, bucket_err, repo_err) to avoid cross-branch type conflicts. Co-authored-by: Lucain <Wauplin@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Lucain <Wauplin@users.noreply.github.com>
Author
Parents
Loading