Skip to content

Commit cf99708

Browse files
Rename DistInfoMetadata to CoreMetadata (#3699)
## Summary This reflects the change codified in PEP 714.
1 parent fee344d commit cf99708

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

crates/distribution-types/src/file.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use url::Url;
77

88
use pep440_rs::{VersionSpecifiers, VersionSpecifiersParseError};
99
use pep508_rs::split_scheme;
10-
use pypi_types::{DistInfoMetadata, HashDigest, Yanked};
10+
use pypi_types::{CoreMetadata, HashDigest, Yanked};
1111

1212
/// Error converting [`pypi_types::File`] to [`distribution_type::File`].
1313
#[derive(Debug, Error)]
@@ -48,7 +48,7 @@ impl File {
4848
.as_ref()
4949
.or(file.dist_info_metadata.as_ref())
5050
.or(file.data_dist_info_metadata.as_ref())
51-
.is_some_and(DistInfoMetadata::is_available),
51+
.is_some_and(CoreMetadata::is_available),
5252
filename: file.filename,
5353
hashes: file.hashes.into_digests(),
5454
requires_python: file

crates/pypi-types/src/simple_json.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ fn sorted_simple_json_files<'de, D: Deserializer<'de>>(d: D) -> Result<Vec<File>
3939
pub struct File {
4040
// PEP 714-renamed field, followed by PEP 691-compliant field, followed by non-PEP 691-compliant
4141
// alias used by PyPI.
42-
pub core_metadata: Option<DistInfoMetadata>,
43-
pub dist_info_metadata: Option<DistInfoMetadata>,
44-
pub data_dist_info_metadata: Option<DistInfoMetadata>,
42+
pub core_metadata: Option<CoreMetadata>,
43+
pub dist_info_metadata: Option<CoreMetadata>,
44+
pub data_dist_info_metadata: Option<CoreMetadata>,
4545
pub filename: String,
4646
pub hashes: Hashes,
4747
/// There are a number of invalid specifiers on PyPI, so we first try to parse it into a
@@ -73,12 +73,12 @@ where
7373

7474
#[derive(Debug, Clone, Deserialize)]
7575
#[serde(untagged)]
76-
pub enum DistInfoMetadata {
76+
pub enum CoreMetadata {
7777
Bool(bool),
7878
Hashes(Hashes),
7979
}
8080

81-
impl DistInfoMetadata {
81+
impl CoreMetadata {
8282
pub fn is_available(&self) -> bool {
8383
match self {
8484
Self::Bool(is_available) => *is_available,

crates/uv-client/src/html.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use url::Url;
66

77
use pep440_rs::VersionSpecifiers;
88
use pypi_types::LenientVersionSpecifiers;
9-
use pypi_types::{BaseUrl, DistInfoMetadata, File, Hashes, Yanked};
9+
use pypi_types::{BaseUrl, CoreMetadata, File, Hashes, Yanked};
1010

1111
/// A parsed structure from PyPI "HTML" index format for a single package.
1212
#[derive(Debug, Clone)]
@@ -197,9 +197,9 @@ impl SimpleHtml {
197197
let dist_info_metadata = std::str::from_utf8(dist_info_metadata.as_bytes())?;
198198
let dist_info_metadata = html_escape::decode_html_entities(dist_info_metadata);
199199
match dist_info_metadata.as_ref() {
200-
"true" => Some(DistInfoMetadata::Bool(true)),
201-
"false" => Some(DistInfoMetadata::Bool(false)),
202-
fragment => Some(DistInfoMetadata::Hashes(Self::parse_hash(fragment)?)),
200+
"true" => Some(CoreMetadata::Bool(true)),
201+
"false" => Some(CoreMetadata::Bool(false)),
202+
fragment => Some(CoreMetadata::Hashes(Self::parse_hash(fragment)?)),
203203
}
204204
} else {
205205
None

0 commit comments

Comments
 (0)