mirror of https://github.com/astral-sh/ruff
Delete examples
This commit is contained in:
parent
da8481c97d
commit
b7517d4511
|
|
@ -1,72 +0,0 @@
|
|||
use std::mem::size_of_val;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Export<'a> {
|
||||
/// The names of the bindings exported via `__all__`.
|
||||
pub names: Vec<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Importation<'a> {
|
||||
/// The name to which the import is bound.
|
||||
/// Given `import foo`, `name` would be "foo".
|
||||
/// Given `import foo as bar`, `name` would be "bar".
|
||||
pub name: &'a str,
|
||||
/// The full name of the module being imported.
|
||||
/// Given `import foo`, `full_name` would be "foo".
|
||||
/// Given `import foo as bar`, `full_name` would be "foo".
|
||||
pub full_name: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct FromImportation<'a> {
|
||||
/// The name to which the import is bound.
|
||||
/// Given `from foo import bar`, `name` would be "bar".
|
||||
/// Given `from foo import bar as baz`, `name` would be "baz".
|
||||
pub name: &'a str,
|
||||
/// The full name of the module being imported.
|
||||
/// Given `from foo import bar`, `full_name` would be "foo.bar".
|
||||
/// Given `from foo import bar as baz`, `full_name` would be "foo.bar".
|
||||
pub full_name: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SubmoduleImportation<'a> {
|
||||
/// The parent module imported by the submodule import.
|
||||
/// Given `import foo.bar`, `module` would be "foo".
|
||||
pub name: &'a str,
|
||||
/// The full name of the submodule being imported.
|
||||
/// Given `import foo.bar`, `full_name` would be "foo.bar".
|
||||
pub full_name: &'a str,
|
||||
}
|
||||
|
||||
// If we box, this goes from 48 to 16
|
||||
// If we use a u32 pointer, this goes to 8
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum BindingKind {
|
||||
Annotation,
|
||||
Argument,
|
||||
Assignment,
|
||||
NamedExprAssignment,
|
||||
Binding,
|
||||
LoopVar,
|
||||
Global,
|
||||
Nonlocal,
|
||||
Builtin,
|
||||
ClassDefinition,
|
||||
FunctionDefinition,
|
||||
// 32
|
||||
Export(u32),
|
||||
FutureImportation,
|
||||
// 40
|
||||
Importation(u32),
|
||||
// 48
|
||||
FromImportation(u32),
|
||||
// 48
|
||||
SubmoduleImportation(u32),
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let smart = BindingKind::Assignment;
|
||||
dbg!(size_of_val(&smart));
|
||||
}
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
use ruff_diagnostics::{Diagnostic, Violation};
|
||||
use ruff_macros::{derive_message_formats, violation};
|
||||
use ruff_python_semantic::binding::{
|
||||
Binding, BindingKind, ExecutionContext, FromImportation, Importation, SubmoduleImportation,
|
||||
};
|
||||
use ruff_python_semantic::binding::{Binding, BindingKind, ExecutionContext};
|
||||
|
||||
/// ## What it does
|
||||
/// Checks for runtime imports defined in a type-checking block.
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ use std::path::Path;
|
|||
|
||||
use ruff_diagnostics::{Diagnostic, Violation};
|
||||
use ruff_macros::{derive_message_formats, violation};
|
||||
use ruff_python_semantic::binding::{
|
||||
Binding, BindingKind, ExecutionContext, FromImportation, Importation, SubmoduleImportation,
|
||||
};
|
||||
use ruff_python_semantic::binding::{Binding, BindingKind, ExecutionContext};
|
||||
|
||||
use crate::rules::isort::{categorize, ImportSection, ImportType};
|
||||
use crate::settings::Settings;
|
||||
|
|
@ -160,7 +158,7 @@ impl Violation for TypingOnlyStandardLibraryImport {
|
|||
}
|
||||
|
||||
/// Return `true` if `this` is implicitly loaded via importing `that`.
|
||||
fn is_implicit_import(this: &Binding, that: &Binding) -> bool {
|
||||
fn is_implicit_import(_this: &Binding, _that: &Binding) -> bool {
|
||||
true
|
||||
// match &this.kind {
|
||||
// BindingKind::Importation(Importation {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use rustpython_parser::ast::{Expr, ExprKind};
|
|||
use ruff_diagnostics::Violation;
|
||||
use ruff_diagnostics::{Diagnostic, DiagnosticKind};
|
||||
use ruff_macros::{derive_message_formats, violation};
|
||||
use ruff_python_semantic::binding::{BindingKind, Importation};
|
||||
use ruff_python_semantic::binding::BindingKind;
|
||||
|
||||
use crate::checkers::ast::Checker;
|
||||
use crate::registry::Rule;
|
||||
|
|
|
|||
|
|
@ -11,10 +11,7 @@ use ruff_python_stdlib::path::is_python_stub_file;
|
|||
use ruff_python_stdlib::typing::TYPING_EXTENSIONS;
|
||||
|
||||
use crate::analyze::visibility::{module_visibility, Modifier, VisibleScope};
|
||||
use crate::binding::{
|
||||
Binding, BindingId, BindingKind, Bindings, Exceptions, ExecutionContext, FromImportation,
|
||||
Importation, SubmoduleImportation,
|
||||
};
|
||||
use crate::binding::{Binding, BindingId, BindingKind, Bindings, Exceptions, ExecutionContext};
|
||||
use crate::node::{NodeId, Nodes};
|
||||
use crate::scope::{Scope, ScopeId, ScopeKind, Scopes};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue