mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00
types.rs
: remove unused is_stdlib_symbol
methods (#14104)
This commit is contained in:
parent
4323512a65
commit
05f97bae73
1 changed files with 0 additions and 25 deletions
|
@ -4,7 +4,6 @@ use ruff_python_ast as ast;
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use crate::module_resolver::file_to_module;
|
|
||||||
use crate::semantic_index::ast_ids::HasScopedAstId;
|
use crate::semantic_index::ast_ids::HasScopedAstId;
|
||||||
use crate::semantic_index::definition::Definition;
|
use crate::semantic_index::definition::Definition;
|
||||||
use crate::semantic_index::symbol::{self as symbol, ScopeId, ScopedSymbolId};
|
use crate::semantic_index::symbol::{self as symbol, ScopeId, ScopedSymbolId};
|
||||||
|
@ -466,14 +465,6 @@ impl<'db> Type<'db> {
|
||||||
matches!(self, Type::LiteralString)
|
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`.
|
/// 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
|
/// [subtype of]: https://typing.readthedocs.io/en/latest/spec/concepts.html#subtype-supertype-and-type-equivalence
|
||||||
|
@ -1862,14 +1853,6 @@ pub struct FunctionType<'db> {
|
||||||
|
|
||||||
#[salsa::tracked]
|
#[salsa::tracked]
|
||||||
impl<'db> FunctionType<'db> {
|
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 {
|
pub fn has_decorator(self, db: &dyn Db, decorator: Type<'_>) -> bool {
|
||||||
self.decorators(db).contains(&decorator)
|
self.decorators(db).contains(&decorator)
|
||||||
}
|
}
|
||||||
|
@ -1950,14 +1933,6 @@ impl<'db> ClassType<'db> {
|
||||||
self.known(db) == Some(known_class)
|
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.
|
/// Return an iterator over the inferred types of this class's *explicit* bases.
|
||||||
///
|
///
|
||||||
/// Note that any class (except for `object`) that has no explicit
|
/// Note that any class (except for `object`) that has no explicit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue