mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-16 00:20:22 +00:00
Remove several incorrect uses of map_callable()
(#12580)
This commit is contained in:
parent
459c85ba27
commit
ac1666d6e2
1 changed files with 8 additions and 8 deletions
|
@ -28,23 +28,23 @@ pub fn is_classmethod(decorator_list: &[Decorator], semantic: &SemanticModel) ->
|
||||||
|
|
||||||
/// Returns `true` if a function definition is an `@overload`.
|
/// Returns `true` if a function definition is an `@overload`.
|
||||||
pub fn is_overload(decorator_list: &[Decorator], semantic: &SemanticModel) -> bool {
|
pub fn is_overload(decorator_list: &[Decorator], semantic: &SemanticModel) -> bool {
|
||||||
decorator_list.iter().any(|decorator| {
|
decorator_list
|
||||||
semantic.match_typing_expr(map_callable(&decorator.expression), "overload")
|
.iter()
|
||||||
})
|
.any(|decorator| semantic.match_typing_expr(&decorator.expression, "overload"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if a function definition is an `@override` (PEP 698).
|
/// Returns `true` if a function definition is an `@override` (PEP 698).
|
||||||
pub fn is_override(decorator_list: &[Decorator], semantic: &SemanticModel) -> bool {
|
pub fn is_override(decorator_list: &[Decorator], semantic: &SemanticModel) -> bool {
|
||||||
decorator_list.iter().any(|decorator| {
|
decorator_list
|
||||||
semantic.match_typing_expr(map_callable(&decorator.expression), "override")
|
.iter()
|
||||||
})
|
.any(|decorator| semantic.match_typing_expr(&decorator.expression, "override"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if a function definition is an abstract method based on its decorators.
|
/// Returns `true` if a function definition is an abstract method based on its decorators.
|
||||||
pub fn is_abstract(decorator_list: &[Decorator], semantic: &SemanticModel) -> bool {
|
pub fn is_abstract(decorator_list: &[Decorator], semantic: &SemanticModel) -> bool {
|
||||||
decorator_list.iter().any(|decorator| {
|
decorator_list.iter().any(|decorator| {
|
||||||
semantic
|
semantic
|
||||||
.resolve_qualified_name(map_callable(&decorator.expression))
|
.resolve_qualified_name(&decorator.expression)
|
||||||
.is_some_and(|qualified_name| {
|
.is_some_and(|qualified_name| {
|
||||||
matches!(
|
matches!(
|
||||||
qualified_name.segments(),
|
qualified_name.segments(),
|
||||||
|
@ -86,7 +86,7 @@ pub fn is_property(
|
||||||
pub fn is_final(decorator_list: &[Decorator], semantic: &SemanticModel) -> bool {
|
pub fn is_final(decorator_list: &[Decorator], semantic: &SemanticModel) -> bool {
|
||||||
decorator_list
|
decorator_list
|
||||||
.iter()
|
.iter()
|
||||||
.any(|decorator| semantic.match_typing_expr(map_callable(&decorator.expression), "final"))
|
.any(|decorator| semantic.match_typing_expr(&decorator.expression, "final"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if a function is a "magic method".
|
/// Returns `true` if a function is a "magic method".
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue