extract_package

Function extract_package 

Source
pub fn extract_package(import_statement: &str) -> String
Expand description

Extract the package name from an import statement

ยงExamples

use py_import_helper::utils::parsing::extract_package;

assert_eq!(extract_package("from typing import Any"), "typing");
assert_eq!(extract_package("import json"), "json");
assert_eq!(extract_package("from collections.abc import Mapping"), "collections.abc");