extract_items

Function extract_items 

Source
pub fn extract_items(import_statement: &str) -> Vec<String>
Expand description

Extract imported items from an import statement

Items are automatically sorted with ALL_CAPS names first, then mixed case alphabetically.

ยงExamples

use py_import_helper::utils::parsing::extract_items;

let items = extract_items("from typing import Any, Optional");
assert_eq!(items, vec!["Any", "Optional"]);

let items = extract_items("from typing import TYPE_CHECKING, Any");
assert_eq!(items, vec!["TYPE_CHECKING", "Any"]);