Skip to content

Commit

Permalink
Add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Oct 30, 2023
1 parent 97914c4 commit 8163c04
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/ruff_linter/src/rules/isort/sorting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ type ModuleKey<'a> = (
Option<MemberKey<'a>>,
);

/// Returns a comparable key to capture the desired sorting order for an imported module (e.g.,
/// `foo` in `from foo import bar`).
pub(crate) fn module_key<'a>(
name: Option<&'a str>,
asname: Option<&'a str>,
Expand Down Expand Up @@ -110,6 +112,8 @@ type MemberKey<'a> = (
Option<NatOrdStr<'a>>,
);

/// Returns a comparable key to capture the desired sorting order for an imported member (e.g.,
/// `bar` in `from foo import bar`).
pub(crate) fn member_key<'a>(
name: &'a str,
asname: Option<&'a str>,
Expand All @@ -133,6 +137,7 @@ pub(crate) fn member_key<'a>(
)
}

/// Lowercase the given string, if it contains any uppercase characters.
fn maybe_lowercase(name: &str) -> Cow<'_, str> {
if name.chars().all(char::is_lowercase) {
Cow::Borrowed(name)
Expand Down

0 comments on commit 8163c04

Please sign in to comment.