Skip to content

Commit 1d6fc5c

Browse files
committed
Ban relative imports via flake8-tidy-imports
Adds flake8-tidy-imports as a flake8 dependency and enables --ban-relative-imports=true (I252), per the project's stated preference for absolute imports. I250/I251 (the plugin's other checks) are ignored to keep this change scoped to relative imports only. Fixes the one existing relative import this rule catches: chromadb/utils/embedding_functions/schemas/registry.py. Fixes #2334
1 parent f2cfcc0 commit 1d6fc5c

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

.pre-commit-config.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,15 @@ repos:
2929
hooks:
3030
- id: flake8
3131
args:
32-
- "--extend-ignore=E203,E501,E503"
32+
# I250/I251 (flake8-tidy-imports' import-alias and banned-module
33+
# checks) are ignored here since this only opts into the
34+
# ban-relative-imports rule (I252); enabling the plugin turns on
35+
# all of its checks by default.
36+
- "--extend-ignore=E203,E501,E503,I250,I251"
3337
- "--max-line-length=88"
38+
- "--ban-relative-imports=true"
39+
additional_dependencies:
40+
- "flake8-tidy-imports==4.12.0"
3441

3542
- repo: https://github.com/pre-commit/mirrors-mypy
3643
rev: "v1.10.0"

chromadb/utils/embedding_functions/schemas/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from typing import Dict, List, Set
99
import os
1010
import json
11-
from .schema_utils import SCHEMAS_DIR
11+
from chromadb.utils.embedding_functions.schemas.schema_utils import SCHEMAS_DIR
1212

1313

1414
def get_available_schemas() -> List[str]:

0 commit comments

Comments
 (0)