mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 05:20:49 -05:00
Harmonise methods for distinguishing different Python source types (#13682)
This commit is contained in:
@@ -5,8 +5,7 @@ use rustc_hash::FxHashMap;
|
||||
|
||||
use ruff_python_ast::helpers::from_relative_import;
|
||||
use ruff_python_ast::name::{QualifiedName, UnqualifiedName};
|
||||
use ruff_python_ast::{self as ast, Expr, ExprContext, Operator, Stmt};
|
||||
use ruff_python_stdlib::path::is_python_stub_file;
|
||||
use ruff_python_ast::{self as ast, Expr, ExprContext, Operator, PySourceType, Stmt};
|
||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
|
||||
use crate::binding::{
|
||||
@@ -2246,7 +2245,7 @@ bitflags! {
|
||||
|
||||
impl SemanticModelFlags {
|
||||
pub fn new(path: &Path) -> Self {
|
||||
if is_python_stub_file(path) {
|
||||
if PySourceType::from(path).is_stub() {
|
||||
Self::STUB_FILE
|
||||
} else {
|
||||
Self::default()
|
||||
|
||||
Reference in New Issue
Block a user