mirror of https://github.com/astral-sh/uv
Remove trailing commas before brackets (#10740)
This commit is contained in:
parent
ae366ccd0e
commit
c306e46e1d
|
|
@ -111,7 +111,7 @@ mod tests {
|
||||||
fn single_specifiers() {
|
fn single_specifiers() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
CommaSeparatedRequirements::from_str("requests>=2.1,<3").unwrap(),
|
CommaSeparatedRequirements::from_str("requests>=2.1,<3").unwrap(),
|
||||||
CommaSeparatedRequirements(vec!["requests>=2.1,<3".to_string(),])
|
CommaSeparatedRequirements(vec!["requests>=2.1,<3".to_string()])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -695,7 +695,7 @@ mod tests {
|
||||||
vec![CacheControlDirective {
|
vec![CacheControlDirective {
|
||||||
name: "max-age".to_string(),
|
name: "max-age".to_string(),
|
||||||
value: b"60".to_vec(),
|
value: b"60".to_vec(),
|
||||||
},]
|
}]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,17 +34,17 @@ impl DependencyMetadata {
|
||||||
.iter()
|
.iter()
|
||||||
.find(|v| v.version.as_ref() == Some(version))
|
.find(|v| v.version.as_ref() == Some(version))
|
||||||
.inspect(|_| {
|
.inspect(|_| {
|
||||||
debug!("Found dependency metadata entry for `{package}=={version}`",);
|
debug!("Found dependency metadata entry for `{package}=={version}`");
|
||||||
})
|
})
|
||||||
.or_else(|| versions.iter().find(|v| v.version.is_none()))
|
.or_else(|| versions.iter().find(|v| v.version.is_none()))
|
||||||
.inspect(|_| {
|
.inspect(|_| {
|
||||||
debug!("Found global metadata entry for `{package}`",);
|
debug!("Found global metadata entry for `{package}`");
|
||||||
});
|
});
|
||||||
let Some(metadata) = metadata else {
|
let Some(metadata) = metadata else {
|
||||||
warn!("No dependency metadata entry found for `{package}=={version}`");
|
warn!("No dependency metadata entry found for `{package}=={version}`");
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
debug!("Found dependency metadata entry for `{package}=={version}`",);
|
debug!("Found dependency metadata entry for `{package}=={version}`");
|
||||||
Some(ResolutionMetadata {
|
Some(ResolutionMetadata {
|
||||||
name: metadata.name.clone(),
|
name: metadata.name.clone(),
|
||||||
version: version.clone(),
|
version: version.clone(),
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use std::{
|
||||||
#[derive(Eq, Ord, PartialEq, PartialOrd, Debug, Hash, Clone, Copy)]
|
#[derive(Eq, Ord, PartialEq, PartialOrd, Debug, Hash, Clone, Copy)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "rkyv",
|
feature = "rkyv",
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize,)
|
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug, Eq, PartialEq, PartialOrd, Ord)))]
|
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug, Eq, PartialEq, PartialOrd, Ord)))]
|
||||||
pub enum Operator {
|
pub enum Operator {
|
||||||
|
|
@ -1458,7 +1458,7 @@ impl Deref for Release<'_> {
|
||||||
#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy, Ord, PartialOrd)]
|
#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy, Ord, PartialOrd)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "rkyv",
|
feature = "rkyv",
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize,)
|
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug, Eq, PartialEq, PartialOrd, Ord)))]
|
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug, Eq, PartialEq, PartialOrd, Ord)))]
|
||||||
pub struct Prerelease {
|
pub struct Prerelease {
|
||||||
|
|
@ -1474,7 +1474,7 @@ pub struct Prerelease {
|
||||||
#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy, Ord, PartialOrd)]
|
#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy, Ord, PartialOrd)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "rkyv",
|
feature = "rkyv",
|
||||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize,)
|
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug, Eq, PartialEq, PartialOrd, Ord)))]
|
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug, Eq, PartialEq, PartialOrd, Ord)))]
|
||||||
pub enum PrereleaseKind {
|
pub enum PrereleaseKind {
|
||||||
|
|
|
||||||
|
|
@ -2890,7 +2890,7 @@ mod test {
|
||||||
fn test_is_false() {
|
fn test_is_false() {
|
||||||
assert!(m("python_version < '3.10' and python_version >= '3.10'").is_false());
|
assert!(m("python_version < '3.10' and python_version >= '3.10'").is_false());
|
||||||
assert!(m("(python_version < '3.10' and python_version >= '3.10') \
|
assert!(m("(python_version < '3.10' and python_version >= '3.10') \
|
||||||
or (python_version < '3.9' and python_version >= '3.9')",)
|
or (python_version < '3.9' and python_version >= '3.9')")
|
||||||
.is_false());
|
.is_false());
|
||||||
|
|
||||||
assert!(!m("python_version < '3.10'").is_false());
|
assert!(!m("python_version < '3.10'").is_false());
|
||||||
|
|
@ -3150,7 +3150,7 @@ mod test {
|
||||||
|
|
||||||
assert!(m("
|
assert!(m("
|
||||||
(os_name == 'Linux' and extra == 'foo')
|
(os_name == 'Linux' and extra == 'foo')
|
||||||
or (os_name != 'Linux' and extra == 'bar')",)
|
or (os_name != 'Linux' and extra == 'bar')")
|
||||||
.without_extras()
|
.without_extras()
|
||||||
.is_true());
|
.is_true());
|
||||||
|
|
||||||
|
|
@ -3183,7 +3183,7 @@ mod test {
|
||||||
);
|
);
|
||||||
assert!(m("
|
assert!(m("
|
||||||
(os_name == 'foo' and extra == 'foo')
|
(os_name == 'foo' and extra == 'foo')
|
||||||
or (os_name == 'bar' and extra != 'foo')",)
|
or (os_name == 'bar' and extra != 'foo')")
|
||||||
.only_extras()
|
.only_extras()
|
||||||
.is_true());
|
.is_true());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
||||||
|
|
@ -397,7 +397,7 @@ pub async fn upload(
|
||||||
if UvRetryableStrategy.handle(&result) == Some(Retryable::Transient) {
|
if UvRetryableStrategy.handle(&result) == Some(Retryable::Transient) {
|
||||||
let retry_decision = retry_policy.should_retry(start_time, n_past_retries);
|
let retry_decision = retry_policy.should_retry(start_time, n_past_retries);
|
||||||
if let reqwest_retry::RetryDecision::Retry { execute_after } = retry_decision {
|
if let reqwest_retry::RetryDecision::Retry { execute_after } = retry_decision {
|
||||||
warn_user!("Transient failure while handling response for {registry}; retrying...",);
|
warn_user!("Transient failure while handling response for {registry}; retrying...");
|
||||||
reporter.on_download_complete(idx);
|
reporter.on_download_complete(idx);
|
||||||
let duration = execute_after
|
let duration = execute_after
|
||||||
.duration_since(SystemTime::now())
|
.duration_since(SystemTime::now())
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ impl std::fmt::Display for SysconfigData {
|
||||||
self.0.serialize(&mut serializer).unwrap();
|
self.0.serialize(&mut serializer).unwrap();
|
||||||
String::from_utf8(buf).unwrap()
|
String::from_utf8(buf).unwrap()
|
||||||
};
|
};
|
||||||
write!(f, "{output}",)
|
write!(f, "{output}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ impl ReportFormatter<PubGrubPackage, Range<Version>, UnavailableReason>
|
||||||
match reason {
|
match reason {
|
||||||
UnavailableReason::Package(reason) => {
|
UnavailableReason::Package(reason) => {
|
||||||
let message = reason.singular_message();
|
let message = reason.singular_message();
|
||||||
format!("{}{}", package, Padded::new(" ", &message, ""),)
|
format!("{}{}", package, Padded::new(" ", &message, ""))
|
||||||
}
|
}
|
||||||
UnavailableReason::Version(reason) => {
|
UnavailableReason::Version(reason) => {
|
||||||
let range = self.compatible_range(package, set);
|
let range = self.compatible_range(package, set);
|
||||||
|
|
@ -1543,7 +1543,7 @@ impl std::fmt::Display for PubGrubHint {
|
||||||
let option = match option {
|
let option = match option {
|
||||||
NoBuild::All => "for all packages (i.e., with `--no-build`)".to_string(),
|
NoBuild::All => "for all packages (i.e., with `--no-build`)".to_string(),
|
||||||
NoBuild::Packages(_) => {
|
NoBuild::Packages(_) => {
|
||||||
format!("for `{package}` (i.e., with `--no-build-package {package}`)",)
|
format!("for `{package}` (i.e., with `--no-build-package {package}`)")
|
||||||
}
|
}
|
||||||
NoBuild::None => unreachable!(),
|
NoBuild::None => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
@ -1559,7 +1559,7 @@ impl std::fmt::Display for PubGrubHint {
|
||||||
let option = match option {
|
let option = match option {
|
||||||
NoBinary::All => "for all packages (i.e., with `--no-binary`)".to_string(),
|
NoBinary::All => "for all packages (i.e., with `--no-binary`)".to_string(),
|
||||||
NoBinary::Packages(_) => {
|
NoBinary::Packages(_) => {
|
||||||
format!("for `{package}` (i.e., with `--no-binary-package {package}`)",)
|
format!("for `{package}` (i.e., with `--no-binary-package {package}`)")
|
||||||
}
|
}
|
||||||
NoBinary::None => unreachable!(),
|
NoBinary::None => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1348,7 +1348,7 @@ mod test {
|
||||||
split_specifiers("flask[dotenv]>=1.0"),
|
split_specifiers("flask[dotenv]>=1.0"),
|
||||||
("flask[dotenv]", ">=1.0")
|
("flask[dotenv]", ">=1.0")
|
||||||
);
|
);
|
||||||
assert_eq!(split_specifiers("flask[dotenv]",), ("flask[dotenv]", ""));
|
assert_eq!(split_specifiers("flask[dotenv]"), ("flask[dotenv]", ""));
|
||||||
assert_eq!(split_specifiers("flask @ https://files.pythonhosted.org/packages/af/47/93213ee66ef8fae3b93b3e29206f6b251e65c97bd91d8e1c5596ef15af0a/flask-3.1.0-py3-none-any.whl"), ("flask", "@ https://files.pythonhosted.org/packages/af/47/93213ee66ef8fae3b93b3e29206f6b251e65c97bd91d8e1c5596ef15af0a/flask-3.1.0-py3-none-any.whl"));
|
assert_eq!(split_specifiers("flask @ https://files.pythonhosted.org/packages/af/47/93213ee66ef8fae3b93b3e29206f6b251e65c97bd91d8e1c5596ef15af0a/flask-3.1.0-py3-none-any.whl"), ("flask", "@ https://files.pythonhosted.org/packages/af/47/93213ee66ef8fae3b93b3e29206f6b251e65c97bd91d8e1c5596ef15af0a/flask-3.1.0-py3-none-any.whl"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -340,7 +340,7 @@ fn format_chain(name: &PackageName, version: Option<&Version>, chain: &Derivatio
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// Ex) `flask>=1.0.0`
|
// Ex) `flask>=1.0.0`
|
||||||
format!("`{}{}`", step.name.cyan(), range.cyan(),)
|
format!("`{}{}`", step.name.cyan(), range.cyan())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -354,7 +354,7 @@ fn format_chain(name: &PackageName, version: Option<&Version>, chain: &Derivatio
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// Ex) `flask[dotenv]`
|
// Ex) `flask[dotenv]`
|
||||||
format!("`{}`", format!("{}[{}]", step.name, extra).cyan(),)
|
format!("`{}`", format!("{}[{}]", step.name, extra).cyan())
|
||||||
}
|
}
|
||||||
} else if let Some(group) = &step.group {
|
} else if let Some(group) = &step.group {
|
||||||
if let Some(version) = step.version.as_ref() {
|
if let Some(version) = step.version.as_ref() {
|
||||||
|
|
@ -366,7 +366,7 @@ fn format_chain(name: &PackageName, version: Option<&Version>, chain: &Derivatio
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// Ex) `flask:dev`
|
// Ex) `flask:dev`
|
||||||
format!("`{}`", format!("{}:{}", step.name, group).cyan(),)
|
format!("`{}`", format!("{}:{}", step.name, group).cyan())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let Some(version) = step.version.as_ref() {
|
if let Some(version) = step.version.as_ref() {
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ pub(crate) async fn install(
|
||||||
Either::Left(installation)
|
Either::Left(installation)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug!("No installation found for request `{}`", request.cyan(),);
|
debug!("No installation found for request `{}`", request.cyan());
|
||||||
|
|
||||||
Either::Right(request)
|
Either::Right(request)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue