示例#1
0
        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);
            });
        }
示例#2
0
 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);
     });
 }
示例#3
0
        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);
            });
        }
示例#4
0
        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);
            });
        }
示例#5
0
 private static Dictionary <Assembly, TopNamespaceTracker> GetAssemblyMap(PythonContext /*!*/ context)
 {
     return(context.GetOrCreateModuleState(_key, () => new Dictionary <Assembly, TopNamespaceTracker>()));
 }
示例#6
0
 private static Dictionary<Assembly, TopNamespaceTracker> GetAssemblyMap(PythonContext/*!*/ context) {
     return context.GetOrCreateModuleState(_key, () => new Dictionary<Assembly, TopNamespaceTracker>());
 }