public static PythonLibraryPath Parse(string s) { if (string.IsNullOrEmpty(s)) { throw new ArgumentNullException("source"); } var parts = s.Split(new[] { '|' }, 3); if (parts.Length < 3) { throw new FormatException(); } var path = parts[0]; var ty = parts[1]; var prefix = parts[2]; PythonLibraryPathType type = PythonLibraryPathType.Unspecified; switch (ty) { case "stdlib": type = PythonLibraryPathType.StdLib; break; case "site": type = PythonLibraryPathType.Site; break; case "pth": type = PythonLibraryPathType.Pth; break; } return(new PythonLibraryPath(path, type, prefix)); }
public PythonLibraryPath(string path, PythonLibraryPathType type = PythonLibraryPathType.Unspecified, string modulePrefix = null) { Path = PathUtils.NormalizePathAndTrim(path); Type = type; ModulePrefix = modulePrefix ?? string.Empty; }