Skip to content

Commit

Permalink
types.rs: remove unused is_stdlib_symbol methods (astral-sh#14104)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored Nov 5, 2024
1 parent 4323512 commit 05f97ba
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions crates/red_knot_python_semantic/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use ruff_python_ast as ast;

use itertools::Itertools;

use crate::module_resolver::file_to_module;
use crate::semantic_index::ast_ids::HasScopedAstId;
use crate::semantic_index::definition::Definition;
use crate::semantic_index::symbol::{self as symbol, ScopeId, ScopedSymbolId};
Expand Down Expand Up @@ -466,14 +465,6 @@ impl<'db> Type<'db> {
matches!(self, Type::LiteralString)
}

pub fn is_stdlib_symbol(&self, db: &'db dyn Db, module_name: &str, name: &str) -> bool {
match self {
Type::ClassLiteral(class) => class.is_stdlib_symbol(db, module_name, name),
Type::FunctionLiteral(function) => function.is_stdlib_symbol(db, module_name, name),
_ => false,
}
}

/// Return true if this type is a [subtype of] type `target`.
///
/// [subtype of]: https://typing.readthedocs.io/en/latest/spec/concepts.html#subtype-supertype-and-type-equivalence
Expand Down Expand Up @@ -1862,14 +1853,6 @@ pub struct FunctionType<'db> {

#[salsa::tracked]
impl<'db> FunctionType<'db> {
/// Return true if this is a standard library function with given module name and name.
pub(crate) fn is_stdlib_symbol(self, db: &'db dyn Db, module_name: &str, name: &str) -> bool {
name == self.name(db)
&& file_to_module(db, self.body_scope(db).file(db)).is_some_and(|module| {
module.search_path().is_standard_library() && module.name() == module_name
})
}

pub fn has_decorator(self, db: &dyn Db, decorator: Type<'_>) -> bool {
self.decorators(db).contains(&decorator)
}
Expand Down Expand Up @@ -1950,14 +1933,6 @@ impl<'db> ClassType<'db> {
self.known(db) == Some(known_class)
}

/// Return true if this class is a standard library type with given module name and name.
pub(crate) fn is_stdlib_symbol(self, db: &'db dyn Db, module_name: &str, name: &str) -> bool {
name == self.name(db)
&& file_to_module(db, self.body_scope(db).file(db)).is_some_and(|module| {
module.search_path().is_standard_library() && module.name() == module_name
})
}

/// Return an iterator over the inferred types of this class's *explicit* bases.
///
/// Note that any class (except for `object`) that has no explicit
Expand Down

0 comments on commit 05f97ba

Please sign in to comment.