mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-16 00:20:22 +00:00
Harmonise methods for distinguishing different Python source types (#13682)
This commit is contained in:
parent
b9827a4122
commit
5b4afd30ca
9 changed files with 40 additions and 53 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue