MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_paths

Function get_paths

src/settings.rs:440–453  ·  view source on GitHub ↗

Helper function to retrieve a sequence of paths from an environment variable.

(env_variable_name: &str)

Source from the content-addressed store, hash-verified

438
439/// Helper function to retrieve a sequence of paths from an environment variable.
440fn get_paths(env_variable_name: &str) -> impl Iterator<Item = String> + '_ {
441 env::var_os(env_variable_name)
442 .filter(|v| !v.is_empty())
443 .into_iter()
444 .flat_map(move |paths| {
445 split_paths(&paths)
446 .map(|path| {
447 path.into_os_string()
448 .into_string()
449 .unwrap_or_else(|_| panic!("{env_variable_name} isn't valid unicode"))
450 })
451 .collect::<Vec<_>>()
452 })
453}
454
455#[cfg(not(target_os = "wasi"))]
456pub(crate) use env::split_paths;

Callers 1

parse_optsFunction · 0.70

Calls 6

split_pathsFunction · 0.85
into_stringMethod · 0.80
into_iterMethod · 0.45
filterMethod · 0.45
is_emptyMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected