Skip to content

Commit da6c53e

Browse files
authored
refector: renamed file glob to cache to make it clearer (huggingface#45711)
renamed file glob to cache to make it clearer
1 parent 0d28dff commit da6c53e

21 files changed

Lines changed: 46 additions & 40 deletions

tests/repo_utils/test_checkers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def patch_checkers_paths(repo_root: Path):
3737
stack.enter_context(patch.object(checkers, "REPO_ROOT", repo_root))
3838
stack.enter_context(patch.object(checkers, "CACHE_PATH", cache_path))
3939
stack.enter_context(patch.object(checkers, "CHECKERS", {"demo": ("Demo checker", "fake_checker.py", [], [])}))
40-
stack.enter_context(patch.object(checkers, "CHECKER_FILE_GLOBS", {"demo": ["tracked/**/*.txt"]}))
40+
stack.enter_context(patch.object(checkers, "CHECKER_CACHE_GLOBS", {"demo": ["tracked/**/*.txt"]}))
4141
yield cache_path
4242

4343

utils/add_dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"label": "Model dates",
1717
# Approximate: also reads docs/source/en/model_doc/*.md and uses git log + network
1818
# calls to GitHub/HuggingFace for commit dates and paper metadata.
19-
"file_globs": ["src/transformers/models/**/__init__.py", "docs/source/en/model_doc/**/*.md"],
19+
"cache_globs": ["src/transformers/models/**/__init__.py", "docs/source/en/model_doc/**/*.md"],
2020
"check_args": ["--check-only"],
2121
"fix_args": [],
2222
}

utils/check_auto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
CHECKER_CONFIG = {
3333
"name": "auto_mappings",
3434
"label": "Generate auto mappings",
35-
"file_globs": [],
35+
"cache_globs": [],
3636
"check_args": [],
3737
"fix_args": ["--fix_and_overwrite"],
3838
}

utils/check_config_attributes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"label": "Config attributes",
2626
# Approximate: iterates CONFIG_MAPPING at runtime and also reads modeling_*.py files
2727
# in each config's directory via os.listdir(). Deprecated models are skipped.
28-
"file_globs": ["src/transformers/models/**/configuration_*.py", "src/transformers/models/**/modeling_*.py"],
28+
"cache_globs": ["src/transformers/models/**/configuration_*.py", "src/transformers/models/**/modeling_*.py"],
2929
"check_args": [],
3030
"fix_args": None,
3131
}

utils/check_config_docstrings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
CHECKER_CONFIG = {
2222
"name": "config_docstrings",
2323
"label": "Config docstrings",
24-
# Approximate: iterates CONFIG_MAPPING at runtime via inspect.getsource(), not file globs.
24+
# Approximate: iterates CONFIG_MAPPING at runtime via inspect.getsource(), not cache globs.
2525
# Only configs registered in CONFIG_MAPPING are checked; deprecated models are skipped.
26-
"file_globs": ["src/transformers/models/**/configuration_*.py"],
26+
"cache_globs": ["src/transformers/models/**/configuration_*.py"],
2727
"check_args": [],
2828
"fix_args": None,
2929
}

utils/check_copies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"name": "copies",
5050
"label": "Copied code consistency",
5151
# Actual scope: all of src/transformers/**/*.py and tests/models/**/*.py via glob.glob().
52-
"file_globs": ["src/transformers/**/*.py", "tests/models/**/*.py"],
52+
"cache_globs": ["src/transformers/**/*.py", "tests/models/**/*.py"],
5353
"check_args": [],
5454
"fix_args": ["--fix_and_overwrite"],
5555
}

utils/check_doc_toc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"name": "doc_toc",
4242
"label": "Documentation table of contents",
4343
# Also reads docs/source/en/_toctree.yml; the .md glob catches new/renamed doc files.
44-
"file_globs": ["docs/**/*.md", "docs/source/en/_toctree.yml"],
44+
"cache_globs": ["docs/**/*.md", "docs/source/en/_toctree.yml"],
4545
"check_args": [],
4646
"fix_args": ["--fix_and_overwrite"],
4747
}

utils/check_docstrings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"label": "Docstring formatting",
6868
# Approximate: at runtime the checker also introspects the live transformers module for
6969
# @auto_docstring-decorated objects. These globs cover the files it reads via glob.glob().
70-
"file_globs": [
70+
"cache_globs": [
7171
"src/transformers/models/**/modeling_*.py",
7272
"src/transformers/models/**/modular_*.py",
7373
"src/transformers/models/**/configuration_*.py",

utils/check_doctest_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"label": "Doctest list",
4040
# Over-approximation: the checker validates that paths in .txt list files exist and are
4141
# sorted. The broad globs ensure cache invalidation when source files are added/removed.
42-
"file_globs": [
42+
"cache_globs": [
4343
"utils/not_doctested.txt",
4444
"utils/slow_documentation_tests.txt",
4545
"src/transformers/**/*.py",

utils/check_dummies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"label": "Dummy objects",
4444
# Over-approximation: only reads __init__.py and utils/dummy_*_objects.py, but any
4545
# new public object added anywhere could require a dummy update.
46-
"file_globs": ["src/transformers/**/*.py"],
46+
"cache_globs": ["src/transformers/**/*.py"],
4747
"check_args": [],
4848
"fix_args": ["--fix_and_overwrite"],
4949
}

0 commit comments

Comments
 (0)