No more Tuple, List, Dict (#38797)

* No more Tuple, List, Dict

* make fixup

* More style fixes

* Docstring fixes with regex replacement

* Trigger tests

* Redo fixes after rebase

* Fix copies

* [test all]

* update

* [test all]

* update

* [test all]

* make style after rebase

* Patch the hf_argparser test

* Patch the hf_argparser test

* style fixes

* style fixes

* style fixes

* Fix docstrings in Cohere test

* [test all]

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Matt
2025-06-17 19:37:18 +01:00
committed by GitHub
parent a396f4324b
commit 508a704055
1291 changed files with 14906 additions and 14941 deletions

View File

@@ -39,7 +39,7 @@ import collections
import os
import re
from pathlib import Path
from typing import Dict, List, Optional, Tuple
from typing import Optional
# Path is set with the intent you should run this script from the root of the repo.
@@ -89,7 +89,7 @@ def find_backend(line: str) -> Optional[str]:
return "_and_".join(backends)
def parse_init(init_file) -> Optional[Tuple[Dict[str, List[str]], Dict[str, List[str]]]]:
def parse_init(init_file) -> Optional[tuple[dict[str, list[str]], dict[str, list[str]]]]:
"""
Read an init_file and parse (per backend) the `_import_structure` objects defined and the `TYPE_CHECKING` objects
defined.
@@ -232,7 +232,7 @@ def parse_init(init_file) -> Optional[Tuple[Dict[str, List[str]], Dict[str, List
return import_dict_objects, type_hint_objects
def analyze_results(import_dict_objects: Dict[str, List[str]], type_hint_objects: Dict[str, List[str]]) -> List[str]:
def analyze_results(import_dict_objects: dict[str, list[str]], type_hint_objects: dict[str, list[str]]) -> list[str]:
"""
Analyze the differences between _import_structure objects and TYPE_CHECKING objects found in an init.
@@ -279,7 +279,7 @@ def analyze_results(import_dict_objects: Dict[str, List[str]], type_hint_objects
return errors
def get_transformers_submodules() -> List[str]:
def get_transformers_submodules() -> list[str]:
"""
Returns the list of Transformers submodules.
"""