本文整理汇总了C#中IronPython.Runtime.PythonContext.SetModuleState方法的典型用法代码示例。如果您正苦于以下问题:C# PythonContext.SetModuleState方法的具体用法?C# PythonContext.SetModuleState怎么用?C# PythonContext.SetModuleState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Runtime.PythonContext
的用法示例。
在下文中一共展示了PythonContext.SetModuleState方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
}
示例2: 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");
}
示例3: PerformModuleReload
public static void PerformModuleReload(PythonContext context, PythonDictionary dict)
{
if (!context.HasModuleState(_fieldSizeLimitKey))
{
context.SetModuleState(_fieldSizeLimitKey, FieldSizeLimit);
}
if (!context.HasModuleState(_dialectRegistryKey))
{
context.SetModuleState(_dialectRegistryKey,
new DialectRegistry());
}
InitModuleExceptions(context, dict);
}
示例4: PerformModuleReload
public static void PerformModuleReload(PythonContext context, PythonDictionary dict) {
if (!context.HasModuleState(_zip_directory_cache_key))
context.SetModuleState(_zip_directory_cache_key, new PythonDictionary());
dict["_zip_directory_cache"] = context.GetModuleState(_zip_directory_cache_key);
InitModuleExceptions(context, dict);
}
示例5: 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"));
}
}
示例6: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ dict) {
dict.Add(SymbolTable.StringToId(_keyDefaultAction), "default");
dict.Add(SymbolTable.StringToId(_keyOnceRegistry), new PythonDictionary());
dict.Add(SymbolTable.StringToId(_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)
});
context.SetModuleState(_keyFields, dict);
}
示例7: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
context.SetModuleState(_stackSizeKey, 0);
context.EnsureModuleException("threaderror", dict, "error", "thread");
}
示例8: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
PythonSignalState pss = new PythonSignalState(context);
context.SetModuleState(_PythonSignalStateKey, pss);
NativeSignal.SetConsoleCtrlHandler(pss.WinAllSignalsHandlerDelegate, true);
}
示例9: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ dict) {
// set the lock count to zero on the 1st load, don't reset the lock count on reloads
if (!context.HasModuleState(_lockCountKey)) {
context.SetModuleState(_lockCountKey, 0L);
}
}
示例10: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
context.NewObject = (BuiltinFunction)dict["__newobj__"];
context.PythonReconstructor = (BuiltinFunction)dict["_reconstructor"];
PythonDictionary dispatchTable = new PythonDictionary();
dispatchTable[TypeCache.Complex64] = dict["pickle_complex"];
context.SetModuleState(_dispatchTableKey, dict["dispatch_table"] = dispatchTable);
context.SetModuleState(_extensionRegistryKey, dict["_extension_registry"] = new PythonDictionary());
context.SetModuleState(_invertedRegistryKey, dict["_inverted_registry"] = new PythonDictionary());
context.SetModuleState(_extensionCacheKey, dict["_extension_cache"] = new PythonDictionary());
}
示例11: EnsureLocaleInitialized
internal static void EnsureLocaleInitialized(PythonContext context) {
if (!context.HasModuleState(_localeKey)) {
context.SetModuleState(_localeKey, new LocaleInfo(context));
}
}
示例12: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
context.SetModuleState(_threadholdKey, PythonTuple.MakeTuple(64 * 1024, 256 * 1024, 1024 * 1024));
}
示例13: ExecuteInternal
protected override void ExecuteInternal()
{
pythonContext = HostingHelpers.GetLanguageContext(Engine) as PythonContext;
if (pythonContext != null)
{
foreach( var expose in exposeBuffer)
{
pythonContext.BuiltinModuleDict[expose.Key] = expose.Value;
}
pythonContext.SetModuleState(typeof (ScriptEngine), Engine);
base.ExecuteInternal();
}
}
示例14: PerformModuleReload
public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
context.SetModuleState(_PythonSignalStateKey, MakeSignalState(context));
}