本文整理汇总了C#中IronPython.Runtime.PythonModule.Get__dict__方法的典型用法代码示例。如果您正苦于以下问题:C# PythonModule.Get__dict__方法的具体用法?C# PythonModule.Get__dict__怎么用?C# PythonModule.Get__dict__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Runtime.PythonModule
的用法示例。
在下文中一共展示了PythonModule.Get__dict__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PyModule_New
PyModule_New(string name)
{
PythonModule module = new PythonModule();
module.Get__dict__()["__name__"] = name;
module.Get__dict__()["__doc__"] = "";
return this.Store(module);
}
示例2: Py_InitModule4
Py_InitModule4(string name, IntPtr methodsPtr, string doc, IntPtr selfPtr, int apiver)
{
name = this.FixImportName(name);
PythonDictionary methodTable = new PythonDictionary();
PythonModule module = new PythonModule();
this.AddModule(name, module);
this.CreateModulesContaining(name);
PythonDictionary __dict__ = module.Get__dict__();
__dict__["__doc__"] = doc;
__dict__["__name__"] = name;
string __file__ = this.importFiles.Peek();
__dict__["__file__"] = __file__;
List __path__ = new List();
if (__file__ != null)
{
__path__.append(Path.GetDirectoryName(__file__));
}
__dict__["__path__"] = __path__;
__dict__["_dispatcher"] = new Dispatcher(this, methodTable, selfPtr);
StringBuilder moduleCode = new StringBuilder();
moduleCode.Append(CodeSnippets.USEFUL_IMPORTS);
CallableBuilder.GenerateFunctions(moduleCode, methodsPtr, methodTable);
this.ExecInModule(moduleCode.ToString(), module);
return this.Store(module);
}
示例3: BuiltinModule
public BuiltinModule(PythonModule module, ProjectState projectState, bool showClr)
: base(new LazyDotNetDict(new object[] { module }, projectState, showClr))
{
object name;
if (!module.Get__dict__().TryGetValue("__name__", out name) || !(name is string)) {
_name = String.Empty;
} else {
_name = name as string;
}
}
示例4: EnumerateMembers
/// <summary>
/// List all of the members in a PythonModule
/// </summary>
/// <param name="module">A reference to the module</param>
/// <param name="name">The name of the module</param>
/// <returns>A list of completion data for the module</returns>
public List<IronPythonCompletionData> EnumerateMembers(PythonModule module, string name)
{
var items = new List<IronPythonCompletionData>();
var d = module.Get__dict__();
foreach (var member in d)
{
if ( member.Value is BuiltinFunction )
{
items.Add(new IronPythonCompletionData( (string) member.Key, name, false, IronPythonCompletionData.CompletionType.METHOD, this));
}
else
{
items.Add(new IronPythonCompletionData((string)member.Key, name, false, IronPythonCompletionData.CompletionType.FIELD, this));
}
}
return items;
}
示例5: CreateModule
CreateModule(string name)
{
PythonModule module = this.GetModule(name);
if (module == null)
{
module = new PythonModule();
module.Get__dict__()["__name__"] = name;
this.AddModule(name, module);
}
return module;
}
示例6: ExecInModule
ExecInModule(string code, PythonModule module)
{
SourceUnit script = this.python.CreateSnippet(code, SourceCodeKind.Statements);
script.Execute(new Scope(module.Get__dict__()));
}