File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 66
77from PIL import __version__
88
9+ TYPE_CHECKING = False
10+
11+ if TYPE_CHECKING :
12+ from importlib .metadata import PackageMetadata
13+
914pyroma = pytest .importorskip ("pyroma" , reason = "Pyroma not installed" )
1015
1116
12- def map_metadata_keys (md ) :
17+ def map_metadata_keys (md : PackageMetadata ) -> dict [ str , str | list [ str ] | None ] :
1318 # Convert installed wheel metadata into canonical Core Metadata 2.4 format.
1419 # This was a utility method in pyroma 4.3.3; it was removed in 5.0.
1520 # This implementation is constructed from the relevant logic from
1621 # Pyroma 5.0's `build_metadata()` implementation. This has been submitted
1722 # upstream to Pyroma as https://github.com/regebro/pyroma/pull/116,
1823 # so it may be possible to simplify this test in future.
1924 data = {}
20- for key in set (md . keys () ):
25+ for key in set (md ):
2126 value = md .get_all (key )
2227 key = pyroma .projectdata .normalize (key )
2328
24- if len (value ) == 1 :
25- value = value [0 ]
26- if value .strip () = = "UNKNOWN" :
27- continue
28-
29- data [key ] = value
29+ if value is not None and len (value ) == 1 :
30+ first_value = value [0 ]
31+ if first_value .strip () ! = "UNKNOWN" :
32+ data [ key ] = first_value
33+ else :
34+ data [key ] = value
3035 return data
3136
3237
Original file line number Diff line number Diff line change @@ -217,6 +217,7 @@ testpaths = [
217217python_version = " 3.10"
218218pretty = true
219219disallow_any_generics = true
220+ disallow_untyped_defs = true
220221enable_error_code = " ignore-without-code"
221222extra_checks = true
222223follow_imports = " silent"
You can’t perform that action at this time.
0 commit comments