@@ -628,10 +628,10 @@ class WorkingSet:
628
628
def __init__ (self , entries : Iterable [str ] | None = None ):
629
629
"""Create working set from list of path entries (default=sys.path)"""
630
630
self .entries : list [str ] = []
631
- self .entry_keys = {}
632
- self .by_key = {}
633
- self .normalized_to_canonical_keys = {}
634
- self .callbacks = []
631
+ self .entry_keys : dict [ str | None , list [ str ]] = {}
632
+ self .by_key : dict [ str , Distribution ] = {}
633
+ self .normalized_to_canonical_keys : dict [ str , str ] = {}
634
+ self .callbacks : list [ Callable [[ Distribution ], object ]] = []
635
635
636
636
if entries is None :
637
637
entries = sys .path
@@ -1087,7 +1087,15 @@ def _added_new(self, dist):
1087
1087
for callback in self .callbacks :
1088
1088
callback (dist )
1089
1089
1090
- def __getstate__ (self ):
1090
+ def __getstate__ (
1091
+ self ,
1092
+ ) -> tuple [
1093
+ list [str ],
1094
+ dict [str | None , list [str ]],
1095
+ dict [str , Distribution ],
1096
+ dict [str , str ],
1097
+ list [Callable [[Distribution ], object ]],
1098
+ ]:
1091
1099
return (
1092
1100
self .entries [:],
1093
1101
self .entry_keys .copy (),
@@ -1096,7 +1104,7 @@ def __getstate__(self):
1096
1104
self .callbacks [:],
1097
1105
)
1098
1106
1099
- def __setstate__ (self , e_k_b_n_c ):
1107
+ def __setstate__ (self , e_k_b_n_c ) -> None :
1100
1108
entries , keys , by_key , normalized_to_canonical_keys , callbacks = e_k_b_n_c
1101
1109
self .entries = entries [:]
1102
1110
self .entry_keys = keys .copy ()
@@ -3163,7 +3171,7 @@ def __str__(self):
3163
3171
version = version or "[unknown version]"
3164
3172
return "%s %s" % (self .project_name , version )
3165
3173
3166
- def __getattr__ (self , attr ):
3174
+ def __getattr__ (self , attr : str ):
3167
3175
"""Delegate all unrecognized public attributes to .metadata provider"""
3168
3176
if attr .startswith ('_' ):
3169
3177
raise AttributeError (attr )
0 commit comments