Skip to content

Commit

Permalink
Flatten red_knot_project import paths (#15616)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Jan 20, 2025
1 parent f82ef32 commit 7379832
Show file tree
Hide file tree
Showing 26 changed files with 553 additions and 566 deletions.
5 changes: 2 additions & 3 deletions crates/red_knot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ use clap::Parser;
use colored::Colorize;
use crossbeam::channel as crossbeam_channel;
use python_version::PythonVersion;
use red_knot_project::db::ProjectDatabase;
use red_knot_project::project::options::{EnvironmentOptions, Options};
use red_knot_project::project::ProjectMetadata;
use red_knot_project::metadata::options::{EnvironmentOptions, Options};
use red_knot_project::watch;
use red_knot_project::watch::ProjectWatcher;
use red_knot_project::{ProjectDatabase, ProjectMetadata};
use red_knot_python_semantic::SitePackages;
use red_knot_server::run_server;
use ruff_db::diagnostic::Diagnostic;
Expand Down
7 changes: 3 additions & 4 deletions crates/red_knot/tests/file_watching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ use std::io::Write;
use std::time::{Duration, Instant};

use anyhow::{anyhow, Context};
use red_knot_project::db::{Db, ProjectDatabase};
use red_knot_project::project::options::{EnvironmentOptions, Options};
use red_knot_project::project::pyproject::{PyProject, Tool};
use red_knot_project::project::ProjectMetadata;
use red_knot_project::metadata::options::{EnvironmentOptions, Options};
use red_knot_project::metadata::pyproject::{PyProject, Tool};
use red_knot_project::watch::{directory_watcher, ChangeEvent, ProjectWatcher};
use red_knot_project::{Db, ProjectDatabase, ProjectMetadata};
use red_knot_python_semantic::{
resolve_module, ModuleName, PythonPlatform, PythonVersion, SitePackages,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl_noop_combine!(String);

#[cfg(test)]
mod tests {
use crate::project::combine::Combine;
use crate::combine::Combine;
use std::collections::HashMap;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions crates/red_knot_project/src/db.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::panic::RefUnwindSafe;
use std::sync::Arc;

use crate::project::{check_file, Project, ProjectMetadata};
use crate::DEFAULT_LINT_REGISTRY;
use crate::{check_file, Project, ProjectMetadata};
use red_knot_python_semantic::lint::{LintRegistry, RuleSelection};
use red_knot_python_semantic::{Db as SemanticDb, Program};
use ruff_db::diagnostic::Diagnostic;
Expand Down Expand Up @@ -179,8 +179,8 @@ pub(crate) mod tests {
use ruff_db::{Db as SourceDb, Upcast};

use crate::db::Db;
use crate::project::{Project, ProjectMetadata};
use crate::DEFAULT_LINT_REGISTRY;
use crate::{Project, ProjectMetadata};

#[salsa::db]
#[derive(Clone)]
Expand Down
4 changes: 2 additions & 2 deletions crates/red_knot_project/src/db/changes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::db::{Db, ProjectDatabase};
use crate::project::options::Options;
use crate::project::{Project, ProjectMetadata};
use crate::metadata::options::Options;
use crate::watch::{ChangeEvent, CreatedKind, DeletedKind};
use crate::{Project, ProjectMetadata};

use red_knot_python_semantic::Program;
use ruff_db::files::{system_path_to_file, File, Files};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use salsa::Setter;
use ruff_db::files::File;

use crate::db::Db;
use crate::project::Project;
use crate::Project;

/// Cheap cloneable hash set of files.
type FileSet = Arc<FxHashSet<File>>;
Expand Down Expand Up @@ -234,8 +234,8 @@ mod tests {

use crate::db::tests::TestDb;
use crate::db::Db;
use crate::project::files::Index;
use crate::project::ProjectMetadata;
use crate::files::Index;
use crate::ProjectMetadata;
use ruff_db::files::system_path_to_file;
use ruff_db::system::{DbWithTestSystem, SystemPathBuf};
use ruff_python_ast::name::Name;
Expand Down
Loading

0 comments on commit 7379832

Please sign in to comment.