Skip to main content

is_python_stdlib_module

Function is_python_stdlib_module 

Source
pub fn is_python_stdlib_module(module: &str) -> bool
Expand description

Check whether module is a Python standard-library top-level package.

Splits on . to get the root segment, then matches a curated list of stdlib modules. Used by heuristic detectors to skip stdlib imports — e.g. traceback, unittest.mock, logging.config should not surface as “Possible logging library (name heuristic)” or “Testing-related import (heuristic)” since they’re language built-ins, not project-internal nor third-party.

§Examples

use seshat_core::dependency::is_python_stdlib_module;

assert!(is_python_stdlib_module("logging"));
assert!(is_python_stdlib_module("logging.config"));
assert!(is_python_stdlib_module("traceback"));
assert!(is_python_stdlib_module("unittest.mock"));
assert!(!is_python_stdlib_module("loguru"));
assert!(!is_python_stdlib_module("waltchat"));