MCPcopy Create free account
hub / github.com/astral-sh/ruff / init_program_with_python_version

Method init_program_with_python_version

crates/ty_project/src/db.rs:702–727  ·  view source on GitHub ↗
(
            &mut self,
            python_version: PythonVersion,
        )

Source from the content-addressed store, hash-verified

700 }
701
702 pub fn init_program_with_python_version(
703 &mut self,
704 python_version: PythonVersion,
705 ) -> anyhow::Result<()> {
706 let root = self.project().root(self);
707
708 let search_paths = SearchPathSettings::new(vec![root.to_path_buf()])
709 .to_search_paths(self.system(), self.vendored(), &FallibleStrategy)
710 .expect("Valid search path settings");
711
712 self.files().try_add_root(self, root, FileRootKind::Project);
713
714 Program::from_settings(
715 self,
716 ProgramSettings {
717 python_version: PythonVersionWithSource {
718 source: ty_python_semantic::PythonVersionSource::Default,
719 version: python_version,
720 },
721 python_platform: PythonPlatform::default(),
722 search_paths,
723 },
724 );
725
726 Ok(())
727 }
728 }
729
730 impl TestDb {

Callers 3

init_programMethod · 0.80
buildMethod · 0.80
buildMethod · 0.80

Calls 10

OkClass · 0.85
expectMethod · 0.80
try_add_rootMethod · 0.80
defaultFunction · 0.50
rootMethod · 0.45
projectMethod · 0.45
to_search_pathsMethod · 0.45
systemMethod · 0.45
vendoredMethod · 0.45
filesMethod · 0.45

Tested by

no test coverage detected