Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 56c4800

Browse files
claudeCarreau
authored andcommitted
Fix ruff and mypy issues in MonkeyType annotations
- ipstruct.py: remove duplicate `from typing import Any` (ruff F811) - skipdoctest.py: type skip_doctest param/return as Any since Callable doesn't allow arbitrary attribute assignment (__skip_doctest__) - path.py: fix get_xdg_dir return type str -> str | None (function returns None on non-posix or non-writable xdg dir) https://claude.ai/code/session_01L2i6WEqHEX3HyCMWgimmEp
1 parent 74904ca commit 56c4800

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

IPython/testing/skipdoctest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
numpy and sympy if they're present. Since this decorator is used in core parts
55
of IPython, it's in a separate module so that running IPython doesn't trigger
66
those imports."""
7-
from typing import Callable
7+
from typing import Any, Callable
88

99
# Copyright (C) IPython Development Team
1010
# Distributed under the terms of the Modified BSD License.
1111

1212

13-
def skip_doctest(f: Callable) -> Callable:
13+
def skip_doctest(f: Any) -> Any:
1414
"""Decorator - mark a function or method for skipping its doctest.
1515
1616
This decorator allows you to mark a function whose docstring you wish to

IPython/utils/ipstruct.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* Brian Granger (refactoring to a dict subclass)
88
"""
99
from typing import Any
10-
from typing import Any
1110

1211
#-----------------------------------------------------------------------------
1312
# Copyright (C) 2008-2011 The IPython Development Team

IPython/utils/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def get_home_dir(require_writable: bool=False) -> str:
196196
raise HomeDirError('%s is not a writable dir, '
197197
'set $HOME environment variable to override' % homedir)
198198

199-
def get_xdg_dir() -> str:
199+
def get_xdg_dir() -> str | None:
200200
"""Return the XDG_CONFIG_HOME, if it is defined and exists, else None.
201201
202202
This is only for non-OS X posix (Linux,Unix,etc.) systems.

0 commit comments

Comments
 (0)