mirror of https://github.com/astral-sh/uv
Fix typos & add pre-commit configuration (#1487)
Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
parent
e4389e537d
commit
bc14ed1613
|
|
@ -0,0 +1,39 @@
|
||||||
|
fail_fast: true
|
||||||
|
|
||||||
|
exclude: |
|
||||||
|
(?x)^(
|
||||||
|
.*/(snapshots)/.*|
|
||||||
|
)$
|
||||||
|
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/abravalheri/validate-pyproject
|
||||||
|
rev: v0.16
|
||||||
|
hooks:
|
||||||
|
- id: validate-pyproject
|
||||||
|
|
||||||
|
- repo: https://github.com/crate-ci/typos
|
||||||
|
rev: v1.18.2
|
||||||
|
hooks:
|
||||||
|
- id: typos
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: cargo-fmt
|
||||||
|
name: cargo fmt
|
||||||
|
entry: cargo fmt --
|
||||||
|
language: system
|
||||||
|
types: [rust]
|
||||||
|
pass_filenames: false # This makes it a lot faster
|
||||||
|
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: v3.1.0
|
||||||
|
hooks:
|
||||||
|
- id: prettier
|
||||||
|
types: [yaml]
|
||||||
|
|
||||||
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
|
rev: v0.2.1
|
||||||
|
hooks:
|
||||||
|
- id: ruff-format
|
||||||
|
- id: ruff
|
||||||
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
[files]
|
||||||
|
extend-exclude = [
|
||||||
|
"**/resources/**/*",
|
||||||
|
"**/snapshots/**/*",
|
||||||
|
"scripts/**/*.in",
|
||||||
|
]
|
||||||
|
|
||||||
|
[default.extend-words]
|
||||||
|
BA = "BA" # acronym for "Bad Allowed", used in testing.
|
||||||
|
Nd = "Nd" # secret codeword used by friendly bards
|
||||||
|
borken = "borken" # the word is borken :(
|
||||||
|
seeked = "seeked" # special term used for streams
|
||||||
|
|
@ -349,7 +349,7 @@ impl Version {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the pre-relase part of this version, if it exists.
|
/// Returns the pre-release part of this version, if it exists.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn pre(&self) -> Option<PreRelease> {
|
pub fn pre(&self) -> Option<PreRelease> {
|
||||||
match *self.inner {
|
match *self.inner {
|
||||||
|
|
@ -755,7 +755,7 @@ impl FromStr for Version {
|
||||||
/// pre-release numeric value.
|
/// pre-release numeric value.
|
||||||
/// * Byte 0 corresponds to the dev-release segment. If there is no dev-release
|
/// * Byte 0 corresponds to the dev-release segment. If there is no dev-release
|
||||||
/// segment, then byte 0 is set to 0xFF. This makes "no dev-release" sort after
|
/// segment, then byte 0 is set to 0xFF. This makes "no dev-release" sort after
|
||||||
/// "has dev-release." The dev-release value (constrainted to be <u8::MAX) is
|
/// "has dev-release." The dev-release value (constrained to be <u8::MAX) is
|
||||||
/// stored in byte 0 as-is.
|
/// stored in byte 0 as-is.
|
||||||
///
|
///
|
||||||
/// The order of the encoding above is significant. For example, the
|
/// The order of the encoding above is significant. For example, the
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ impl Tags {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the [`TagCompatiblity`] of the given tags.
|
/// Returns the [`TagCompatibility`] of the given tags.
|
||||||
///
|
///
|
||||||
/// If compatible, includes the score of the most-compatible platform tag.
|
/// If compatible, includes the score of the most-compatible platform tag.
|
||||||
/// If incompatible, includes the tag part which was a closest match.
|
/// If incompatible, includes the tag part which was a closest match.
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ impl<'a> FlatIndexClient<'a> {
|
||||||
match File::try_from(file, base.as_url().as_str()) {
|
match File::try_from(file, base.as_url().as_str()) {
|
||||||
Ok(file) => Some(file),
|
Ok(file) => Some(file),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
// Ignore files with unparseable version specifiers.
|
// Ignore files with unparsable version specifiers.
|
||||||
warn!("Skipping file in {url}: {err}");
|
warn!("Skipping file in {url}: {err}");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -685,7 +685,7 @@ mod tests {
|
||||||
<a href="https://storage.googleapis.com/jax-releases/cuda100/jaxlib-0.1.52+cuda100-cp36-none-manylinux2010_x86_64.whl">cuda100/jaxlib-0.1.52+cuda100-cp36-none-manylinux2010_x86_64.whl</a><br>
|
<a href="https://storage.googleapis.com/jax-releases/cuda100/jaxlib-0.1.52+cuda100-cp36-none-manylinux2010_x86_64.whl">cuda100/jaxlib-0.1.52+cuda100-cp36-none-manylinux2010_x86_64.whl</a><br>
|
||||||
<a href="https://storage.googleapis.com/jax-releases/cuda100/jaxlib-0.1.52+cuda100-cp37-none-manylinux2010_x86_64.whl">cuda100/jaxlib-0.1.52+cuda100-cp37-none-manylinux2010_x86_64.whl</a><br>
|
<a href="https://storage.googleapis.com/jax-releases/cuda100/jaxlib-0.1.52+cuda100-cp37-none-manylinux2010_x86_64.whl">cuda100/jaxlib-0.1.52+cuda100-cp37-none-manylinux2010_x86_64.whl</a><br>
|
||||||
</body>
|
</body>
|
||||||
</hmtl>
|
</html>
|
||||||
"#;
|
"#;
|
||||||
let base = Url::parse("https://storage.googleapis.com/jax-releases/jax_cuda_releases.html")
|
let base = Url::parse("https://storage.googleapis.com/jax-releases/jax_cuda_releases.html")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ impl FromIterator<CacheControlDirective> for CacheControl {
|
||||||
/// The parser is mostly defined across multiple parts of multiple RFCs.
|
/// The parser is mostly defined across multiple parts of multiple RFCs.
|
||||||
/// Namely, [RFC 9110 S5.6.2] says how to parse the names (or "keys") of each
|
/// Namely, [RFC 9110 S5.6.2] says how to parse the names (or "keys") of each
|
||||||
/// directive (whose format is a "token"). [RFC 9110 S5.6.4] says how to parse
|
/// directive (whose format is a "token"). [RFC 9110 S5.6.4] says how to parse
|
||||||
/// quoted values. And finally, [RFC 9111 Appendex A] gives the ABNF for the
|
/// quoted values. And finally, [RFC 9111 Appendix A] gives the ABNF for the
|
||||||
/// overall header value.
|
/// overall header value.
|
||||||
///
|
///
|
||||||
/// This parser accepts an iterator of anything that can be cheaply converted
|
/// This parser accepts an iterator of anything that can be cheaply converted
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ think we can do a quick overview here.
|
||||||
Let's start with the obvious. HTTP caching exists to avoid network requests,
|
Let's start with the obvious. HTTP caching exists to avoid network requests,
|
||||||
and, if a request is unavoidable, bandwidth. The central actor in HTTP
|
and, if a request is unavoidable, bandwidth. The central actor in HTTP
|
||||||
caching is the `Cache-Control` header, which can exist on *both* requests and
|
caching is the `Cache-Control` header, which can exist on *both* requests and
|
||||||
resonses. The value of this header is a list of directives that control caching
|
responses. The value of this header is a list of directives that control caching
|
||||||
behavior. They can outright disable it (`no-store`), force cache invalidation
|
behavior. They can outright disable it (`no-store`), force cache invalidation
|
||||||
(`no-cache`) or even permit the cache to return responses that are explicitly
|
(`no-cache`) or even permit the cache to return responses that are explicitly
|
||||||
stale (`max-stale`).
|
stale (`max-stale`).
|
||||||
|
|
|
||||||
|
|
@ -625,7 +625,7 @@ impl SimpleMetadata {
|
||||||
let file = match File::try_from(file, base) {
|
let file = match File::try_from(file, base) {
|
||||||
Ok(file) => file,
|
Ok(file) => file,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
// Ignore files with unparseable version specifiers.
|
// Ignore files with unparsable version specifiers.
|
||||||
warn!("Skipping file for {package_name}: {err}");
|
warn!("Skipping file for {package_name}: {err}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -686,7 +686,7 @@ impl<'a, Provider: ResolverProvider> Resolver<'a, Provider> {
|
||||||
let dist = match candidate.dist() {
|
let dist = match candidate.dist() {
|
||||||
CandidateDist::Compatible(dist) => dist,
|
CandidateDist::Compatible(dist) => dist,
|
||||||
CandidateDist::ExcludeNewer => {
|
CandidateDist::ExcludeNewer => {
|
||||||
// If the version is incomatible because of `exclude_newer`, pretend the versions do not exist
|
// If the version is incompatible because of `exclude_newer`, pretend the versions do not exist
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
CandidateDist::Incompatible(incompatibility) => {
|
CandidateDist::Incompatible(incompatibility) => {
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ use tracing_tree::HierarchicalLayer;
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||||
pub(crate) enum Level {
|
pub(crate) enum Level {
|
||||||
/// Suppress all tracing output by default (overrideable by `RUST_LOG`).
|
/// Suppress all tracing output by default (overridable by `RUST_LOG`).
|
||||||
#[default]
|
#[default]
|
||||||
Default,
|
Default,
|
||||||
/// Show debug messages by default (overrideable by `RUST_LOG`).
|
/// Show debug messages by default (overridable by `RUST_LOG`).
|
||||||
Verbose,
|
Verbose,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,7 @@ fn dependency_excludes_range_of_compatible_versions() {
|
||||||
/// There is a non-contiguous range of compatible versions for the requested package
|
/// There is a non-contiguous range of compatible versions for the requested package
|
||||||
/// `a`, but another dependency `c` excludes the range. This is the same as
|
/// `a`, but another dependency `c` excludes the range. This is the same as
|
||||||
/// `dependency-excludes-range-of-compatible-versions` but some of the versions of
|
/// `dependency-excludes-range-of-compatible-versions` but some of the versions of
|
||||||
/// `a` are incompatible for another reason e.g. dependency on non-existant package
|
/// `a` are incompatible for another reason e.g. dependency on non-existent package
|
||||||
/// `d`.
|
/// `d`.
|
||||||
///
|
///
|
||||||
/// ```text
|
/// ```text
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@ exclude = [
|
||||||
"crates/gourgeist/src/activator/activate_this.py",
|
"crates/gourgeist/src/activator/activate_this.py",
|
||||||
"crates/gourgeist/src/_virtualenv.py"
|
"crates/gourgeist/src/_virtualenv.py"
|
||||||
]
|
]
|
||||||
[per-file-ignores]
|
[lint.per-file-ignores]
|
||||||
"__init__.py" = ["F403", "F405"]
|
"__init__.py" = ["F403", "F405"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue