Enhance repo_type_and_id_from_hf_id of hf_api (#3507)
* Enhance repo_type_and_id_from_hf_id of hf_api
* Add missing line
* Fix failed tests
* Format code
* Fix tests and format code
* Apply suggestions from code review
* Optimize code
---------
Co-authored-by: Lucain <lucain@huggingface.co>
Co-authored-by: Lucain <lucainp@gmail.com>