本文整理汇总了C#中IronPython.Runtime.PythonContext.EnsureModuleException方法的典型用法代码示例。如果您正苦于以下问题:C# PythonContext.EnsureModuleException方法的具体用法?C# PythonContext.EnsureModuleException怎么用?C# PythonContext.EnsureModuleException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Runtime.PythonContext
的用法示例。
在下文中一共展示了PythonContext.EnsureModuleException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
context.EnsureModuleException("PickleError", dict, "PickleError", "cPickle");
context.EnsureModuleException("PicklingError", dict, "PicklingError", "cPickle");
context.EnsureModuleException("UnpicklingError", dict, "UnpicklingError", "cPickle");
context.EnsureModuleException("UnpickleableError", dict, "UnpickleableError", "cPickle");
context.EnsureModuleException("BadPickleGet", dict, "BadPickleGet", "cPickle");
dict["__builtins__"] = context.BuiltinModuleInstance;
dict["compatible_formats"] = PythonOps.MakeList("1.0", "1.1", "1.2", "1.3", "2.0");
}
示例2: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ dict) {
context.EnsureModuleException("PickleError", dict, "PickleError", "cPickle");
context.EnsureModuleException("PicklingError", dict, "PicklingError", "cPickle");
context.EnsureModuleException("UnpicklingError", dict, "UnpicklingError", "cPickle");
context.EnsureModuleException("UnpickleableError", dict, "UnpickleableError", "cPickle");
context.EnsureModuleException("BadPickleGet", dict, "BadPickleGet", "cPickle");
dict[Symbols.Builtins] = context.BuiltinModuleInstance;
dict[SymbolTable.StringToId("compatible_formats")] = PythonOps.MakeList("1.0", "1.1", "1.2", "1.3", "2.0");
}
示例3: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
if (!context.HasModuleState(_defaultTimeoutKey)) {
context.SetModuleState(_defaultTimeoutKey, null);
}
context.SetModuleState(_defaultBufsizeKey, DefaultBufferSize);
PythonType socketErr = GetSocketError(context, dict);
context.EnsureModuleException("socketherror", socketErr, dict, "herror", "socket");
context.EnsureModuleException("socketgaierror", socketErr, dict, "gaierror", "socket");
context.EnsureModuleException("sockettimeout", socketErr, dict, "timeout", "socket");
}
示例4: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ dict) {
if (!context.HasModuleState(_defaultTimeoutKey)) {
context.SetModuleState(_defaultTimeoutKey, null);
}
context.SetModuleState(_defaultBufsizeKey, DefaultBufferSize);
context.EnsureModuleException("sslerror", dict, "sslerror", "socket");
PythonType socketErr = context.EnsureModuleException("socketerror", PythonExceptions.IOError, dict, "error", "socket");
context.EnsureModuleException("socketherror", socketErr, dict, "herror", "socket");
context.EnsureModuleException("socketgaierror", socketErr, dict, "gaierror", "socket");
context.EnsureModuleException("sockettimeout", socketErr, dict, "timeout", "socket");
}
示例5: InitModuleExceptions
private static void InitModuleExceptions(PythonContext context, PythonDictionary dict)
{
Warning = context.EnsureModuleException("sqlite.Warning", PythonExceptions.StandardError, dict, "Warning", "_sqlite3");
Error = context.EnsureModuleException("sqlite.Error", PythonExceptions.StandardError, dict, "Error", "_sqlite3");
InterfaceError = context.EnsureModuleException("sqlite.InterfaceError", Error, dict, "InterfaceError", "_sqlite3");
DatabaseError = context.EnsureModuleException("sqlite.DatabaseError", Error, dict, "DatabaseError", "_sqlite3");
DataError = context.EnsureModuleException("sqlite.DataError", DatabaseError, dict, "DataError", "_sqlite3");
OperationalError = context.EnsureModuleException("sqlite.OperationalError", DatabaseError, dict, "OperationalError", "_sqlite3");
IntegrityError = context.EnsureModuleException("sqlite.IntegrityError", DatabaseError, dict, "IntegrityError", "_sqlite3");
InternalError = context.EnsureModuleException("sqlite.InternalError", DatabaseError, dict, "InternalError", "_sqlite3");
ProgrammingError = context.EnsureModuleException("sqlite.ProgrammingError", DatabaseError, dict, "ProgrammingError", "_sqlite3");
NotSupportedError = context.EnsureModuleException("sqlite.NotSupportedError", DatabaseError, dict, "NotSupportedError", "_sqlite3");
}
示例6: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
var socket = context.GetBuiltinModule("socket");
var socketError = PythonSocket.GetSocketError(context, socket.__dict__);
context.EnsureModuleException("SSLError", socketError, dict, "SSLError", "ssl");
}
示例7: InitModuleExceptions
private static void InitModuleExceptions(PythonContext context,
PythonDictionary dict)
{
ZipImportError = context.EnsureModuleException(
"zipimport.ZipImportError",
PythonExceptions.ImportError,
typeof(PythonExceptions.BaseException),
dict, "ZipImportError", "zipimport",
msg => new ImportException(msg));
}
示例8: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ dict) {
context.EnsureModuleException("ArgumentError", dict, "ArgumentError", "_ctypes");
context.EnsureModuleException("COMError", dict, "COMError", "_ctypes");
// TODO: Provide an implementation which is coordinated with our _refCountTable
context.SystemState.__dict__["getrefcount"] = null;
PythonDictionary pointerTypeCache = new PythonDictionary();
dict[SymbolTable.StringToId("_pointer_type_cache")] = pointerTypeCache;
context.SetModuleState(_pointerTypeCacheKey, pointerTypeCache);
if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
Environment.OSVersion.Platform == PlatformID.Win32S ||
Environment.OSVersion.Platform == PlatformID.Win32Windows ||
Environment.OSVersion.Platform == PlatformID.WinCE) {
context.SetModuleState(_conversion_mode, PythonTuple.MakeTuple("mbcs", "ignore"));
} else {
context.SetModuleState(_conversion_mode, PythonTuple.MakeTuple("ascii", "strict"));
}
}
示例9: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
context.SetModuleState(_stackSizeKey, 0);
context.EnsureModuleException("threaderror", dict, "error", "thread");
}
示例10: GetSocketError
internal static PythonType GetSocketError(PythonContext context, PythonDictionary dict) {
return context.EnsureModuleException("socketerror", PythonExceptions.IOError, dict, "error", "socket");
}
示例11: InitModuleExceptions
private static void InitModuleExceptions(PythonContext context,
PythonDictionary dict)
{
Error = context.EnsureModuleException("csv.Error",
PythonExceptions.StandardError, dict, "Error", "_csv");
}
示例12: InitModuleExceptions
/// <summary>
/// Initialize exception
/// </summary>
/// <param name="context"></param>
/// <param name="dict"></param>
private static void InitModuleExceptions(PythonContext context, PythonDictionary dict)
{
GenericImporterError = context.EnsureModuleException(
"genericimporter.GenericImporterError",
PythonExceptions.ImportError,
typeof(PythonExceptions.BaseException),
dict, "GenericImporterError", "genericimporter",
msg => new ImportException(msg));
}
示例13: PerformModuleReload
public static void PerformModuleReload(PythonContext context, PythonDictionary dict)
{
error = context.EnsureModuleException("zlib.error", PythonExceptions.Exception, dict, "error", "zlib");
}
示例14: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
context.EnsureModuleException("selecterror", dict, "error", "select");
}
示例15: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ dict) {
context.EnsureModuleException("binasciierror", dict, "Error", "binascii");
}