Skip to content

Commit 572c016

Browse files
vyasrclaude
andcommitted
Add types-ujson to mypy dependencies for proper ujson type checking
Instead of ignoring import-untyped errors, install types-ujson stubs to enable proper type checking for ujson imports. This requires adding type: ignore[no-redef] to the fallback json imports since mypy now sees both import branches. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent c568d29 commit 572c016

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repos:
3434
rev: 'v1.13.0'
3535
hooks:
3636
- id: mypy
37-
additional_dependencies: [types-cachetools, pyarrow-stubs, numpy, pandas-stubs]
37+
additional_dependencies: [types-cachetools, types-ujson, pyarrow-stubs, numpy, pandas-stubs]
3838
args: ["--config-file=pyproject.toml",
3939
"python/cudf/cudf",
4040
"python/pylibcudf/pylibcudf",

python/cudf/cudf/io/orc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
from cudf.utils.dtypes import cudf_dtype_from_pa_type, dtype_to_pylibcudf_type
2727

2828
try:
29-
import ujson as json # type: ignore[import-untyped]
29+
import ujson as json
3030
except ImportError:
31-
import json
31+
import json # type: ignore[no-redef]
3232

3333
if TYPE_CHECKING:
3434
from cudf.core.column import ColumnBase

python/cudf/cudf/io/parquet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
from cudf.utils.performance_tracking import _performance_tracking
4242

4343
try:
44-
import ujson as json # type: ignore[import-untyped]
44+
import ujson as json
4545
except ImportError:
46-
import json
46+
import json # type: ignore[no-redef]
4747

4848
if TYPE_CHECKING:
4949
from collections.abc import Callable, Hashable, Sequence

0 commit comments

Comments
 (0)