mirror of
https://github.com/unslothai/unsloth.git
synced 2026-07-09 15:58:41 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
9dc34ac0b3
commit
bf71d41595
1 changed files with 8 additions and 3 deletions
|
|
@ -898,8 +898,13 @@ def _mapping_first_keys(value: ast.AST) -> set[str]:
|
|||
if isinstance(value, ast.Dict):
|
||||
nodes = value.keys
|
||||
elif isinstance(value, ast.Call):
|
||||
nodes = [el.elts[0] for a in value.args if isinstance(a, (ast.List, ast.Tuple))
|
||||
for el in a.elts if isinstance(el, (ast.Tuple, ast.List)) and el.elts]
|
||||
nodes = [
|
||||
el.elts[0]
|
||||
for a in value.args
|
||||
if isinstance(a, (ast.List, ast.Tuple))
|
||||
for el in a.elts
|
||||
if isinstance(el, (ast.Tuple, ast.List)) and el.elts
|
||||
]
|
||||
else:
|
||||
nodes = []
|
||||
return {n.value for n in nodes if isinstance(n, ast.Constant) and isinstance(n.value, str)}
|
||||
|
|
@ -918,7 +923,7 @@ def _config_model_types(tier: str) -> frozenset[str]:
|
|||
if not _safe_is_file(path):
|
||||
continue
|
||||
try:
|
||||
tree = ast.parse(path.read_text(encoding="utf-8"))
|
||||
tree = ast.parse(path.read_text(encoding = "utf-8"))
|
||||
except Exception:
|
||||
continue
|
||||
for node in ast.walk(tree):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue