Rename ruff_python_semantic's Context struct to SemanticModel (#4565)

This commit is contained in:
Charlie Marsh 2023-05-21 22:35:03 -04:00 committed by GitHub
parent 3238743a7b
commit 19c4b7bee6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
304 changed files with 1253 additions and 1142 deletions

View file

@ -2,7 +2,7 @@ use rustpython_parser::ast::{self, Expr};
use ruff_python_ast::call_path::collect_call_path;
use crate::context::Context;
use crate::model::SemanticModel;
/// Return `true` if the given `Expr` is a potential logging call. Matches
/// `logging.error`, `logger.error`, `self.logger.error`, etc., but not
@ -16,9 +16,9 @@ use crate::context::Context;
/// # This is detected to be a logger candidate
/// bar.error()
/// ```
pub fn is_logger_candidate(context: &Context, func: &Expr) -> bool {
pub fn is_logger_candidate(model: &SemanticModel, func: &Expr) -> bool {
if let Expr::Attribute(ast::ExprAttribute { value, .. }) = func {
let Some(call_path) = (if let Some(call_path) = context.resolve_call_path(value) {
let Some(call_path) = (if let Some(call_path) = model.resolve_call_path(value) {
if call_path.first().map_or(false, |module| *module == "logging") || call_path.as_slice() == ["flask", "current_app", "logger"] {
Some(call_path)
} else {