public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict) { var exception = context.EnsureModuleException("pyexpaterror", dict, "ExpatError", "xml.parsers.expat"); dict["error"] = exception; dict["ExpatError"] = exception; context.GetOrCreateModuleState(_errorsKey, () => { dict.Add("errors", new PyExpatErrors()); return(dict); }); }
public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict) { context.GetOrCreateModuleState(_keyFields, () => { dict.Add(_keyDefaultAction, "default"); dict.Add(_keyOnceRegistry, new PythonDictionary()); dict.Add(_keyFilters, new List() { // Default filters PythonTuple.MakeTuple("ignore", null, PythonExceptions.PendingDeprecationWarning, null, 0), PythonTuple.MakeTuple("ignore", null, PythonExceptions.ImportWarning, null, 0), PythonTuple.MakeTuple("ignore", null, PythonExceptions.BytesWarning, null, 0) }); return(dict); }); }
public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict) { List defaultFilters = new List(); if (!context.PythonOptions.WarnPython30) { defaultFilters.AddNoLock(PythonTuple.MakeTuple("ignore", null, PythonExceptions.DeprecationWarning, null, 0)); } defaultFilters.AddNoLock(PythonTuple.MakeTuple("ignore", null, PythonExceptions.PendingDeprecationWarning, null, 0)); defaultFilters.AddNoLock(PythonTuple.MakeTuple("ignore", null, PythonExceptions.ImportWarning, null, 0)); defaultFilters.AddNoLock(PythonTuple.MakeTuple("ignore", null, PythonExceptions.BytesWarning, null, 0)); context.GetOrCreateModuleState(_keyFields, () => { dict.Add(_keyDefaultAction, "default"); dict.Add(_keyOnceRegistry, new PythonDictionary()); dict.Add(_keyFilters, defaultFilters); return(dict); }); }
public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict) { PythonList defaultFilters = new PythonList(); defaultFilters.AddNoLock(PythonTuple.MakeTuple("ignore", null, PythonExceptions.DeprecationWarning, null, 0)); defaultFilters.AddNoLock(PythonTuple.MakeTuple("ignore", null, PythonExceptions.PendingDeprecationWarning, null, 0)); defaultFilters.AddNoLock(PythonTuple.MakeTuple("ignore", null, PythonExceptions.ImportWarning, null, 0)); string bytesWarningAction = context.PythonOptions.BytesWarning switch { Severity.Ignore => "ignore", Severity.Warning => "default", _ => "error" }; defaultFilters.AddNoLock(PythonTuple.MakeTuple(bytesWarningAction, null, PythonExceptions.BytesWarning, null, 0)); context.GetOrCreateModuleState(_keyFields, () => { dict.Add(_keyDefaultAction, "default"); dict.Add(_keyOnceRegistry, new PythonDictionary()); dict.Add(_keyFilters, defaultFilters); return(dict); }); }
private static Dictionary <Assembly, TopNamespaceTracker> GetAssemblyMap(PythonContext /*!*/ context) { return(context.GetOrCreateModuleState(_key, () => new Dictionary <Assembly, TopNamespaceTracker>())); }
private static Dictionary<Assembly, TopNamespaceTracker> GetAssemblyMap(PythonContext/*!*/ context) { return context.GetOrCreateModuleState(_key, () => new Dictionary<Assembly, TopNamespaceTracker>()); }