• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IronPython类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IronPython的典型用法代码示例。如果您正苦于以下问题:C# IronPython类的具体用法?C# IronPython怎么用?C# IronPython使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IronPython类属于命名空间,在下文中一共展示了IronPython类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CodeSpan

 internal CodeSpan(IronPython.Compiler.Location start, IronPython.Compiler.Location end)
 {
     this.startLine = start.Line;
     this.startColumn = start.Column;
     this.endLine = end.Line;
     this.endColumn = end.Column;
 }
开发者ID:FabioNascimento,项目名称:DICommander,代码行数:7,代码来源:CompilerSink.cs


示例2: MakeGroup

 public static DomainEntityCollection<Relationship> MakeGroup(IronPython.Runtime.List lst)
 {
     DomainEntityCollection<Relationship> retval = new DomainEntityCollection<Relationship>();
     foreach (var c in lst)
     {
         retval.Add(new Relationship(null) { Code = (string)c });
     }
     return retval;
 }
开发者ID:amyhickman,项目名称:RapidAgencyDevelopment,代码行数:9,代码来源:Relationship.cs


示例3: PerformModuleReload

        public static void PerformModuleReload(
            IronPython.Runtime.PythonContext context, 
            IronPython.Runtime.PythonDictionary dict)
        {
            context.DomainManager.LoadAssembly(typeof(System.Xml.Linq.XDocument).Assembly);

            dict["FOO"] = "bar";
            System.Console.WriteLine("Module Load");
        }
开发者ID:saveenr,项目名称:saveenr,代码行数:9,代码来源:MyModuleClass.cs


示例4: get_state

        public static object get_state(IronPython.Runtime.CodeContext context, object value)
        {
            object prev_value = null;

            if (context.LanguageContext.HasModuleState(_stateKey))
            {
                prev_value = context.LanguageContext.GetModuleState(_stateKey);
            }

            context.LanguageContext.SetModuleState(_stateKey, value);

            return prev_value;
        }
开发者ID:saveenr,项目名称:saveenr,代码行数:13,代码来源:MyModuleClass.cs


示例5: ILArgumentException

 public IronPython.Runtime.List this[IronPython.Runtime.Slice xslice, IronPython.Runtime.Slice yslice]
 {
     get
     {
         if ((xslice.start == null) || (xslice.stop == null) || (yslice.start == null) || (yslice.stop == null))
         {
             throw new ILArgumentException("mgrid: start and stop of slices must be provided");
         }
         double xStep = 1, yStep = 1, xStart = 0, yStart = 0, xStop = 1, yStop = 1;
         //
         if (xslice.start is int) xStart = (double)(int)(xslice.start);
         if (xslice.start is double) xStart = (double)(xslice.start);
         if (xslice.stop is int) xStop = (double)(int)(xslice.stop);
         if (xslice.stop is double) xStop = (double)(xslice.stop);
         //
         if (yslice.start is int) yStart = (double)(int)(yslice.start);
         if (yslice.start is double) yStart = (double)(yslice.start);
         if (yslice.stop is int) yStop = (double)(int)(yslice.stop);
         if (yslice.stop is double) yStop = (double)(yslice.stop);
         // 
         if (xslice.step == null)
         {
             if (xStop >= xStart) xStep = 1;
             else xStep = -1;
         }
         else
         {
             if (xslice.step is int) xStep = (double)(int)(xslice.step);
             if (xslice.step is double) xStep = (double)(xslice.step);
         }
         if (yslice.step == null)
         {
             if (yStop >= yStart) yStep = 1;
             else yStep = -1;
         }
         else
         {
             if (yslice.step is int) yStep = (double)(int)(yslice.step);
             if (yslice.step is double) yStep = (double)(yslice.step);
         }
         //
         IronPython.Runtime.List list = new IronPython.Runtime.List();
         int nx = (int)Math.Floor((xStop - xStart) / xStep) + 1;
         int ny = (int)Math.Floor((yStop - yStart) / yStep) + 1;
         ILArray<double> x = ILMath.counter(xStart, xStep, nx);
         ILArray<double> y = ILMath.counter(yStart, yStep, ny);
         List<ILArray<double>> meshgrid = ILMath.meshgrid(x, y);
         list.Add(meshgrid[0]); list.Add(meshgrid[1]);
         return list;
     }
 }
开发者ID:wdxa,项目名称:ILNumerics,代码行数:51,代码来源:mgrid.cs


示例6: array

 /// <summary>
 /// Convert IronPython List into ILBaseArray
 /// </summary>
 /// <param name="list">IronPython List (must be filled with Python ints or floats)</param>
 /// <returns>ILBaseArray</returns>
 public static ILBaseArray array(IronPython.Runtime.List list)
 {
     List<int> size = new List<int>();
     Type type = typeof(double);
     PythonListHelper.GetListDimensionsAndType(ref size, list, ref type);
     if (!PythonListHelper.CheckList(ref size, list, 0, ref type))
     {
         throw new ArgumentException("List is not rectangular or not of constant type!");
     }
     if (type == typeof(Double))
     {
         return new ILArray<Double>(list);
     }
     else if (type == typeof(Int32))
     {
         return new ILArray<Int32>(list);
     }
     else throw new ArgumentException("List type is not int or float");
 }
开发者ID:wdxa,项目名称:ILNumerics,代码行数:24,代码来源:array.cs


示例7: List_to_ComplexArray

 internal static ComplexF[] List_to_ComplexArray(IronPython.Runtime.List list_object)
 {
     ComplexF[] _fft = new ComplexF[list_object.Count];
        for (int i = 0 ; i < _fft.Length ; i++)
        {
        try
        {
            if (list_object[i].GetType() == typeof(System.Numerics.Complex))
            {
                System.Numerics.Complex c = (System.Numerics.Complex)list_object[i];
                _fft[i] = new ComplexF((float)c.Real, (float)c.Imaginary);
            }
            else
            {
                _fft[i] = new ComplexF(float.Parse(list_object[i].ToString()), 0);
            }
        } catch (Exception)
        {
            throw;
        }
        }
        return _fft;
 }
开发者ID:devsprasad,项目名称:OpenSignalLib,代码行数:23,代码来源:Misc.cs


示例8: WalkLoopBody

            private void WalkLoopBody(IronPython.Compiler.Ast.Statement body, bool isFinally) {

                bool inLoop = _inLoop;
                bool inFinally = _inFinally;

                int loopId = ++_loopId;
                _inFinally = false;
                _inLoop = true;
                _loopIds.Add(loopId, isFinally);

                body.Walk(this);

                _inLoop = inLoop;
                _inFinally = inFinally;
                LoopOrFinallyIds.Remove(loopId);
            }
开发者ID:shaias,项目名称:ironlangs,代码行数:16,代码来源:FunctionCode.cs


示例9: AddError

 /// <summary>
 /// Log Errors/Warnings/Messages when the compiler reports them.
 /// </summary>
 /// <param name="path">Path to the file where the error was found (null/empty if N/A)</param>
 /// <param name="message">Text of the error/warning/message</param>
 /// <param name="startLine">First line of the block containing the error (0 if N/A)</param>
 /// <param name="startColumn">First column of the block containing the error (0 if N/A)</param>
 /// <param name="endLine">Last line of the block containing the error (0 if N/A)</param>
 /// <param name="endColumn">Last column of the block containing the error (0 if N/A)</param>
 /// <param name="errorCode">Code corresponding to the error</param>
 /// <param name="severity">Error/Warning/Message</param>
 public override void AddError(string path, string message, string lineText, IronPython.Hosting.CodeSpan location, int errorCode, IronPython.Hosting.Severity severity)
 {
     if (ProjectDirectory != null && !System.IO.Path.IsPathRooted(path))
         path = System.IO.Path.Combine(ProjectDirectory, path);
     // Based on the type of event (error/warning/message), report the corresponding type of problem to MSBuild
     switch(severity)
     {
         case IronPython.Hosting.Severity.Error:
             {
                 buildSucceeded = false;
                 taskLogger.LogError(String.Empty, "PY" + errorCode.ToString(), String.Empty, path, location.StartLine, location.StartColumn, location.EndLine, location.EndColumn, message);
                 break;
             }
         case IronPython.Hosting.Severity.Warning:
             {
                 taskLogger.LogWarning(String.Empty, "PY" + errorCode.ToString(), String.Empty, path, location.StartLine, location.StartColumn, location.EndLine, location.EndColumn, message);
                 break;
             }
         case IronPython.Hosting.Severity.Message:
             {
                 taskLogger.LogMessage(message);
                 break;
             }
     }
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:36,代码来源:CompilerErrorSink.cs


示例10: Analyze

        public void Analyze(IronPython.Compiler.Ast.FunctionDefinition function)
        {
            this.argument = 0;
            this.function = function;

            foreach (Expression param in function.Parameters) {
                param.Walk(this);
                argument++;
            }
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:10,代码来源:Analyzer.cs


示例11: ExperimentalCompiler

 public ExperimentalCompiler(IList<string> sourcesFiles, string outputAssembly, IronPython.Hosting.CompilerSink compilerSink)
 {
     this.sourceFiles = (List<string>)sourcesFiles;
     this.outputAssembly = outputAssembly;
     this.errorSink = compilerSink;
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:6,代码来源:ExperimentalCompiler.cs


示例12: keyword

 internal keyword(IronPython.Compiler.Ast.Arg arg)
     : this() {
     _arg = arg.Name;
     _value = Convert(arg.Expression);
 }
开发者ID:rchandrashekara,项目名称:main,代码行数:5,代码来源:_ast.cs


示例13: FunctionDefinitionInfo

 public FunctionDefinitionInfo(IronPython.Compiler.Ast.FunctionDefinition function)
 {
     this.function = function;
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:4,代码来源:Inferred.cs


示例14: Walk

 public override bool Walk(IronPython.Compiler.Ast.FunctionDefinition node) {
     UpdateLoops(node);
     return base.Walk(node);
 }
开发者ID:shaias,项目名称:ironlangs,代码行数:4,代码来源:FunctionCode.cs


示例15: PostWalk

 public override void PostWalk(IronPython.Compiler.Ast.FunctionDefinition node)
 {
     PopScope();
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:4,代码来源:Analyzer.cs


示例16: Walk

 // FunctionDefinition
 public bool Walk(IronPython.Compiler.Ast.FunctionDefinition node)
 {
     current = node; return Process(node);
 }
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:5,代码来源:Locator.cs


示例17: PostWalk

 public void PostWalk(IronPython.Compiler.Ast.FunctionDefinition node)
 {
     AssertCurrent(node); current = current.Parent;
 }
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:4,代码来源:Locator.cs


示例18: BuildTraceback

 /// <summary>
 /// Recurively builds an stack-trace string from the IronPython traceback.
 /// </summary>
 /// <param name="traceback"></param>
 /// <returns></returns>
 private StringBuilder BuildTraceback(IronPython.Runtime.Exceptions.TraceBack traceback)
 {
     StringBuilder traceBuilder = new StringBuilder();
     if (traceback == null)
         return traceBuilder;
     if (traceback.tb_next != null)
     {
         traceBuilder.AppendFormat("{0}\r\n", BuildTraceback(traceback.tb_next));
     }
     if (traceback.tb_frame != null && traceback.tb_frame is IronPython.Runtime.Exceptions.TraceBackFrame)
     {
         IronPython.Runtime.Exceptions.TraceBackFrame frame = (IronPython.Runtime.Exceptions.TraceBackFrame)traceback.tb_frame;
         if (frame.f_code != null)
         {
             traceBuilder.AppendFormat("at {0} Line {1}",
                                       frame.f_code.co_filename,
                                       traceback.tb_lineno);
         }
     }
     return traceBuilder;
 }
开发者ID:tfaris,项目名称:IronPlugins,代码行数:26,代码来源:PythonPluginException.cs


示例19: FromPythonList

        public static LinkedList<object> FromPythonList(IronPython.Runtime.List pythonList)
        {
            LinkedList<object> list = new LinkedList<object>();

            foreach (object obj in pythonList)
            {
                if (obj is IronPython.Runtime.Dict)
                {
                    list.AddLast(FromPythonDict(obj as IronPython.Runtime.Dict));
                }
                else if (obj is IronPython.Runtime.List)
                {
                    list.AddLast(FromPythonList(obj as IronPython.Runtime.List));
                }
                else if (obj is IronMath.BigInteger)
                {
                    IronMath.BigInteger val = obj as IronMath.BigInteger;
                    list.AddLast(val.ToInt64());
                }
                else
                {
                    list.AddLast(obj);
                }
            }

            return list;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:27,代码来源:MessageTypes.cs


示例20: FromPythonDict

        public static Dictionary<string, object> FromPythonDict(IronPython.Runtime.Dict pythonDict)
        {
            Dictionary<string, object> dict = new Dictionary<string,object>();

            foreach ( object key in pythonDict.Keys)
            {
                string propName = key as string;
                if (propName == null)
                {
                    throw new System.ArgumentException("Property name is not a string");
                }
                object propVal = pythonDict[key];
                if (propVal is IronPython.Runtime.Dict)
                {
                    dict.Add(propName, FromPythonDict(propVal as IronPython.Runtime.Dict));
                }
                else if (propVal is IronPython.Runtime.List)
                {
                    dict.Add(propName, FromPythonList(propVal as IronPython.Runtime.List));
                }
                else if (propVal is IronMath.BigInteger)
                {
                    IronMath.BigInteger val = propVal as IronMath.BigInteger;
                    dict.Add(propName, val.ToInt64());
                }
                else
                {
                    dict.Add(propName, propVal);
                }
            }

            return dict;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:33,代码来源:MessageTypes.cs



注:本文中的IronPython类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IronRuby类代码示例发布时间:2022-05-24
下一篇:
C# IrcUser类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap