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]
|
||||
pub fn pre(&self) -> Option<PreRelease> {
|
||||
match *self.inner {
|
||||
|
|
@ -755,7 +755,7 @@ impl FromStr for Version {
|
|||
/// pre-release numeric value.
|
||||
/// * 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
|
||||
/// "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.
|
||||
///
|
||||
/// The order of the encoding above is significant. For example, the
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ impl Tags {
|
|||
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 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()) {
|
||||
Ok(file) => Some(file),
|
||||
Err(err) => {
|
||||
// Ignore files with unparseable version specifiers.
|
||||
// Ignore files with unparsable version specifiers.
|
||||
warn!("Skipping file in {url}: {err}");
|
||||
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-cp37-none-manylinux2010_x86_64.whl">cuda100/jaxlib-0.1.52+cuda100-cp37-none-manylinux2010_x86_64.whl</a><br>
|
||||
</body>
|
||||
</hmtl>
|
||||
</html>
|
||||
"#;
|
||||
let base = Url::parse("https://storage.googleapis.com/jax-releases/jax_cuda_releases.html")
|
||||
.unwrap();
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ impl FromIterator<CacheControlDirective> for CacheControl {
|
|||
/// 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
|
||||
/// 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.
|
||||
///
|
||||
/// 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,
|
||||
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
|
||||
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
|
||||
(`no-cache`) or even permit the cache to return responses that are explicitly
|
||||
stale (`max-stale`).
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ impl SimpleMetadata {
|
|||
let file = match File::try_from(file, base) {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
// Ignore files with unparseable version specifiers.
|
||||
// Ignore files with unparsable version specifiers.
|
||||
warn!("Skipping file for {package_name}: {err}");
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -686,7 +686,7 @@ impl<'a, Provider: ResolverProvider> Resolver<'a, Provider> {
|
|||
let dist = match candidate.dist() {
|
||||
CandidateDist::Compatible(dist) => dist,
|
||||
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);
|
||||
}
|
||||
CandidateDist::Incompatible(incompatibility) => {
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ use tracing_tree::HierarchicalLayer;
|
|||
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
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,
|
||||
/// Show debug messages by default (overrideable by `RUST_LOG`).
|
||||
/// Show debug messages by default (overridable by `RUST_LOG`).
|
||||
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
|
||||
/// `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
|
||||
/// `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`.
|
||||
///
|
||||
/// ```text
|
||||
|
|
|
|||
Loading…
Reference in New Issue