Skip to content

Commit a6e5b7e

Browse files
authored
Add fake __getattribute__ to AbstractSandbox to let type-checkers know it has a bunch of dynamic methods (#4708)
2 parents dc2050e + e3d3e98 commit a6e5b7e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

setuptools/sandbox.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import tempfile
1313
import textwrap
1414
from types import TracebackType
15-
from typing import TYPE_CHECKING, ClassVar
15+
from typing import TYPE_CHECKING, Any, ClassVar
1616

1717
import pkg_resources
1818
from pkg_resources import working_set
@@ -406,6 +406,11 @@ def _remap_pair(self, operation, src, dst, *args, **kw):
406406
self._remap_input(operation + '-to', dst, *args, **kw),
407407
)
408408

409+
if TYPE_CHECKING:
410+
# This is a catch-all for all the dynamically created attributes.
411+
# This isn't public API anyway
412+
def __getattribute__(self, name: str) -> Any: ...
413+
409414

410415
if hasattr(os, 'devnull'):
411416
_EXCEPTIONS = [os.devnull]

0 commit comments

Comments
 (0)