Struct python_oxidized_importer::PythonResourcesState [−][src]
Expand description
Defines Python resources available for import.
Implementations
Construct an instance from environment state.
Obtain the path of the current executable.
Set the path of the current executable.
Set the source path that relative paths are relative to.
Load resources by parsing a blob.
If an existing entry exists, the new entry will be merged into it. Set fields on the incoming entry will overwrite fields on the existing entry.
If an entry doesn’t exist, the resource will be inserted as-is.
Load resources data from a filesystem path using memory mapped I/O.
Load resources from packed data stored in a PyObject.
The PyObject must conform to the buffer protocol.
Load builtin modules from the Python interpreter.
Load frozen modules from the Python interpreter.
Load resources that are built-in to the Python interpreter.
If this instance’s resources are being used by the sole Python importer, this needs to be called to ensure modules required during interpreter initialization are indexed and loadable by our importer.
Says whether a named resource exists.
Add a resource to the instance.
Memory in the resource must live for at least as long as the lifetime of the resources this instance was created with.
pub fn resolve_importable_module(
&self,
name: &str,
optimize_level: BytecodeOptimizationLevel
) -> Option<ImportablePythonModule<'_, u8>>
pub fn resolve_importable_module(
&self,
name: &str,
optimize_level: BytecodeOptimizationLevel
) -> Option<ImportablePythonModule<'_, u8>>
Attempt to resolve an importable Python module.
Obtain a single named resource in a package.
Err occurs if loading the resource data fails. Ok(None) is returned
if the resource does not exist. Otherwise the returned PyObject
is a file-like object to read the resource data.
Determines whether a specific package + name pair is a known Python package resource.
Obtain the resources available in a Python package, as a Python list.
The names are returned in sorted order.
Whether the given resource name is a directory with resources.
Resolve package resources in a directory.
Attempt to resolve a PyBytes for resource data given a relative path.
Raises OSerror on failure.
This method is meant to be an implementation of ResourceLoader.get_data() and
should only be used for that purpose.
pub fn pkgutil_modules_infos<'p>(
&self,
py: Python<'p>,
package_filter: Option<&str>,
prefix: Option<String>,
optimize_level: BytecodeOptimizationLevel
) -> PyResult<&'p PyList>
pub fn pkgutil_modules_infos<'p>(
&self,
py: Python<'p>,
package_filter: Option<&str>,
prefix: Option<String>,
optimize_level: BytecodeOptimizationLevel
) -> PyResult<&'p PyList>
Obtain a PyList of pkgutil.ModuleInfo for known resources.
This is intended to be used as the implementation for Finder.iter_modules().
package_filter defines the target package to return results for. The
empty string denotes top-level packages only.
Resolve the names of package distributions matching a name filter.
Resolve data belonging to a package distribution resource.
pub fn package_distribution_resource_name_is_directory(
&self,
package: &str,
name: &str
) -> bool
pub fn package_distribution_resource_name_is_directory(
&self,
package: &str,
name: &str
) -> bool
Whether a package distribution resource name is a directory.
Obtain contents in a package distribution resources “directory.”
Resolve content of a shared library to load from memory.
Convert indexed resources to a PyList.