private bool CheckModule(string moduleName, PythonTuple fromlist) { if (WhitelistNamespaces?.Any(moduleName.StartsWith) ?? false) { return(true); } if (moduleName.Equals("System") && !fromlist.Any(@from => @from.Equals("IO"))) { return(true); } if (_allowedTypes.Contains(moduleName)) { return(true); } if (WhitelistModules.Contains(moduleName)) { return(true); } string[] parts; return(WhitelistParts.TryGetValue(moduleName, out parts) && fromlist.All(@from => parts.Contains(@from))); }
private bool CheckModule(string moduleName, PythonTuple fromlist) { if (WhitelistNamespaces?.Any(moduleName.StartsWith) ?? false) return true; if (moduleName.Equals("System") && !fromlist.Any(@from => @from.Equals("IO"))) return true; if (_allowedTypes.Contains(moduleName)) return true; if (WhitelistModules.Contains(moduleName)) return true; string[] parts; return WhitelistParts.TryGetValue(moduleName, out parts) && fromlist.All(@from => parts.Contains(@from)); }