Skip to main content

PythonEnvironmentSurface

Trait PythonEnvironmentSurface 

Source
pub trait PythonEnvironmentSurface {
    // Required methods
    fn module_boundary(&self, module_path: &str) -> PythonEnvironmentBoundary;
    fn attribute_boundary(
        &self,
        owner_path: &str,
        member: &str,
    ) -> PythonEnvironmentBoundary;
}
Expand description

The retained Python environment surface a diagnostic request may read.

Every method answers only from state the analyzer already holds. An implementation must never start dependency discovery, read a distribution, or execute Python: a missing answer is PythonEnvironmentBoundary::Incomplete, never a blocking call.

Required Methods§

Source

fn module_boundary(&self, module_path: &str) -> PythonEnvironmentBoundary

Classify the module a namespace import names (import a.b).

Source

fn attribute_boundary( &self, owner_path: &str, member: &str, ) -> PythonEnvironmentBoundary

Classify member on the environment declaration owner_path names. This is one question asked from two places: from a.b import member, and an attribute read through a module binder (a.b.member).

The owner is a module for an import, and either a module or a type for an attribute read: theta.Klass.method reaches here with the owner theta.Klass. An implementation that answers PythonEnvironmentBoundary::Absent for a type owner is claiming to have seen that type’s whole inherited surface.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§