huggingface_hub
aa28404e - Add validation warnings for repository limits in upload_large_folder (#3280)

Commit
133 days ago
Add validation warnings for repository limits in upload_large_folder (#3280) * Add validation warnings for repository limits in upload_large_folder * Add tests for upload validation warnings * Update docstring to document validation checks * ruff * Apply ruff formatting to test file * Update src/huggingface_hub/_upload_large_folder.py Co-authored-by: Lucain <lucainp@gmail.com> * Refactor validation logic into separate function and fix GB conversion - Extract validation checks into _validate_upload_limits() function - Fix file size conversion from binary (1024^3) to decimal (10^9) GB - Addresses review comments from @Wauplin and @hanouticelina * Fix subdirectory counting to track immediate children only - Corrects bug where nested subdirs were attributed to grandparents - Now properly tracks each subdir to its immediate parent folder - Addresses @Wauplin's review comment about directory structure * Add comprehensive tests for _validate_upload_limits function - Test subdirectory counting logic - Test decimal GB conversion for file sizes - Test mixed files and subdirectories counting - Test deeply nested structures - All tests passing - Addresses testing requirements from PR review * Apply ruff linting fixes - Remove unused Counter import - Fix whitespace in docstrings and blank lines - All linting checks now pass * Apply make style formatting - Add blank line after import statement - Add blank line after docstring in nested class - All quality checks pass (except pre-existing mypy issues) * Fix mypy type annotation for entries_per_folder - Add Any and Dict to typing imports - Properly annotate entries_per_folder as Dict[str, Any] - Fixes CI mypy errors * Remove old validation tests that are incompatible with refactored code - Remove UploadLargeFolderValidationTest class entirely - These tests relied on mocking internal implementation details - Validation logic is now fully tested in TestValidateUploadLimits - Fixes CI test failures * Update src/huggingface_hub/_upload_large_folder.py Co-authored-by: célina <hanouticelina@gmail.com> * Update src/huggingface_hub/_upload_large_folder.py Co-authored-by: célina <hanouticelina@gmail.com> * Apply style fixes --------- Co-authored-by: célina <hanouticelina@gmail.com> Co-authored-by: Lucain <lucainp@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Author
Parents
Loading