2323from itertools import chain , starmap
2424from pathlib import Path
2525from tempfile import TemporaryDirectory
26+ from types import TracebackType
2627from typing import TYPE_CHECKING , Iterable , Iterator , Mapping , Protocol , TypeVar , cast
2728
2829from .. import Command , _normalization , _path , errors , namespaces
@@ -383,7 +384,13 @@ def __call__(self, wheel: WheelFile, files: list[str], mapping: dict[str, str]):
383384
384385 def __enter__ (self ) -> Self : ...
385386
386- def __exit__ (self , _exc_type , _exc_value , _traceback ): ...
387+ def __exit__ (
388+ self ,
389+ exc_type : type [BaseException ] | None ,
390+ exc_value : BaseException | None ,
391+ traceback : TracebackType | None ,
392+ / ,
393+ ) -> object : ...
387394
388395
389396class _StaticPth :
@@ -397,15 +404,21 @@ def __call__(self, wheel: WheelFile, files: list[str], mapping: dict[str, str]):
397404 contents = _encode_pth (f"{ entries } \n " )
398405 wheel .writestr (f"__editable__.{ self .name } .pth" , contents )
399406
400- def __enter__ (self ):
407+ def __enter__ (self ) -> Self :
401408 msg = f"""
402409 Editable install will be performed using .pth file to extend `sys.path` with:
403410 { list (map (os .fspath , self .path_entries ))!r}
404411 """
405412 _logger .warning (msg + _LENIENT_WARNING )
406413 return self
407414
408- def __exit__ (self , _exc_type , _exc_value , _traceback ): ...
415+ def __exit__ (
416+ self ,
417+ _exc_type : object ,
418+ _exc_value : object ,
419+ _traceback : object ,
420+ ) -> None :
421+ pass
409422
410423
411424class _LinkTree (_StaticPth ):
@@ -463,12 +476,17 @@ def _create_links(self, outputs, output_mapping):
463476 for relative , src in mappings .items ():
464477 self ._create_file (relative , src , link = link_type )
465478
466- def __enter__ (self ):
479+ def __enter__ (self ) -> Self :
467480 msg = "Strict editable install will be performed using a link tree.\n "
468481 _logger .warning (msg + _STRICT_WARNING )
469482 return self
470483
471- def __exit__ (self , _exc_type , _exc_value , _traceback ):
484+ def __exit__ (
485+ self ,
486+ _exc_type : object ,
487+ _exc_value : object ,
488+ _traceback : object ,
489+ ) -> None :
472490 msg = f"""\n
473491 Strict editable installation performed using the auxiliary directory:
474492 { self .auxiliary_dir }
@@ -524,12 +542,17 @@ def __call__(self, wheel: WheelFile, files: list[str], mapping: dict[str, str]):
524542 for file , content in self .get_implementation ():
525543 wheel .writestr (file , content )
526544
527- def __enter__ (self ):
545+ def __enter__ (self ) -> Self :
528546 msg = "Editable install will be performed using a meta path finder.\n "
529547 _logger .warning (msg + _LENIENT_WARNING )
530548 return self
531549
532- def __exit__ (self , _exc_type , _exc_value , _traceback ):
550+ def __exit__ (
551+ self ,
552+ _exc_type : object ,
553+ _exc_value : object ,
554+ _traceback : object ,
555+ ) -> None :
533556 msg = """\n
534557 Please be careful with folders in your working directory with the same
535558 name as your package as they may take precedence during imports.
0 commit comments