当前位置: 首页>>代码示例>>C#>>正文


C# PythonOperationKind.ToString方法代码示例

本文整理汇总了C#中PythonOperationKind.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# PythonOperationKind.ToString方法的具体用法?C# PythonOperationKind.ToString怎么用?C# PythonOperationKind.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PythonOperationKind的用法示例。


在下文中一共展示了PythonOperationKind.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OperatorToSymbol

        internal static string OperatorToSymbol(PythonOperationKind op) {
            switch (op) {
                #region Generated StringOperatorToSymbol

                // *** BEGIN GENERATED CODE ***
                // generated by function: gen_StringOperatorToSymbol from: generate_ops.py

                case PythonOperationKind.Add: return "__add__";
                case PythonOperationKind.ReverseAdd: return "__radd__";
                case PythonOperationKind.InPlaceAdd: return "__iadd__";
                case PythonOperationKind.Subtract: return "__sub__";
                case PythonOperationKind.ReverseSubtract: return "__rsub__";
                case PythonOperationKind.InPlaceSubtract: return "__isub__";
                case PythonOperationKind.Power: return "__pow__";
                case PythonOperationKind.ReversePower: return "__rpow__";
                case PythonOperationKind.InPlacePower: return "__ipow__";
                case PythonOperationKind.Multiply: return "__mul__";
                case PythonOperationKind.ReverseMultiply: return "__rmul__";
                case PythonOperationKind.InPlaceMultiply: return "__imul__";
                case PythonOperationKind.FloorDivide: return "__floordiv__";
                case PythonOperationKind.ReverseFloorDivide: return "__rfloordiv__";
                case PythonOperationKind.InPlaceFloorDivide: return "__ifloordiv__";
                case PythonOperationKind.Divide: return "__div__";
                case PythonOperationKind.ReverseDivide: return "__rdiv__";
                case PythonOperationKind.InPlaceDivide: return "__idiv__";
                case PythonOperationKind.TrueDivide: return "__truediv__";
                case PythonOperationKind.ReverseTrueDivide: return "__rtruediv__";
                case PythonOperationKind.InPlaceTrueDivide: return "__itruediv__";
                case PythonOperationKind.Mod: return "__mod__";
                case PythonOperationKind.ReverseMod: return "__rmod__";
                case PythonOperationKind.InPlaceMod: return "__imod__";
                case PythonOperationKind.LeftShift: return "__lshift__";
                case PythonOperationKind.ReverseLeftShift: return "__rlshift__";
                case PythonOperationKind.InPlaceLeftShift: return "__ilshift__";
                case PythonOperationKind.RightShift: return "__rshift__";
                case PythonOperationKind.ReverseRightShift: return "__rrshift__";
                case PythonOperationKind.InPlaceRightShift: return "__irshift__";
                case PythonOperationKind.BitwiseAnd: return "__and__";
                case PythonOperationKind.ReverseBitwiseAnd: return "__rand__";
                case PythonOperationKind.InPlaceBitwiseAnd: return "__iand__";
                case PythonOperationKind.BitwiseOr: return "__or__";
                case PythonOperationKind.ReverseBitwiseOr: return "__ror__";
                case PythonOperationKind.InPlaceBitwiseOr: return "__ior__";
                case PythonOperationKind.ExclusiveOr: return "__xor__";
                case PythonOperationKind.ReverseExclusiveOr: return "__rxor__";
                case PythonOperationKind.InPlaceExclusiveOr: return "__ixor__";
                case PythonOperationKind.LessThan: return "__lt__";
                case PythonOperationKind.GreaterThan: return "__gt__";
                case PythonOperationKind.LessThanOrEqual: return "__le__";
                case PythonOperationKind.GreaterThanOrEqual: return "__ge__";
                case PythonOperationKind.Equal: return "__eq__";
                case PythonOperationKind.NotEqual: return "__ne__";
                case PythonOperationKind.LessThanGreaterThan: return "__lg__";

                // *** END GENERATED CODE ***

                #endregion

                // unary operators
                case PythonOperationKind.OnesComplement: return "__invert__";
                case PythonOperationKind.Negate: return "__neg__";
                case PythonOperationKind.Positive: return "__pos__";
                case PythonOperationKind.AbsoluteValue: return "__abs__";
                case PythonOperationKind.DivMod: return "__divmod__";
                case PythonOperationKind.ReverseDivMod: return "__rdivmod__";
                case PythonOperationKind.Compare: return "__cmp__";

                default:
                    throw new InvalidOperationException(op.ToString());
            }
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:71,代码来源:Symbols.Generated.cs

示例2: GetOperatorDisplay

        private static string/*!*/ GetOperatorDisplay(PythonOperationKind op) {
            op = NormalizeOperator(op);

            switch (op) {
                case PythonOperationKind.Add: return "+";
                case PythonOperationKind.Subtract: return "-";
                case PythonOperationKind.Power: return "**";
                case PythonOperationKind.Multiply: return "*";
                case PythonOperationKind.FloorDivide: return "//";
                case PythonOperationKind.Divide: return "/";
                case PythonOperationKind.TrueDivide: return "//";
                case PythonOperationKind.Mod: return "%";
                case PythonOperationKind.LeftShift: return "<<";
                case PythonOperationKind.RightShift: return ">>";
                case PythonOperationKind.BitwiseAnd: return "&";
                case PythonOperationKind.BitwiseOr: return "|";
                case PythonOperationKind.ExclusiveOr: return "^";
                case PythonOperationKind.LessThan: return "<";
                case PythonOperationKind.GreaterThan: return ">";
                case PythonOperationKind.LessThanOrEqual: return "<=";
                case PythonOperationKind.GreaterThanOrEqual: return ">=";
                case PythonOperationKind.Equal: return "==";
                case PythonOperationKind.NotEqual: return "!=";
                case PythonOperationKind.LessThanGreaterThan: return "<>";
                case PythonOperationKind.InPlaceAdd: return "+=";
                case PythonOperationKind.InPlaceSubtract: return "-=";
                case PythonOperationKind.InPlacePower: return "**=";
                case PythonOperationKind.InPlaceMultiply: return "*=";
                case PythonOperationKind.InPlaceFloorDivide: return "/=";
                case PythonOperationKind.InPlaceDivide: return "/=";
                case PythonOperationKind.InPlaceTrueDivide: return "//=";
                case PythonOperationKind.InPlaceMod: return "%=";
                case PythonOperationKind.InPlaceLeftShift: return "<<=";
                case PythonOperationKind.InPlaceRightShift: return ">>=";
                case PythonOperationKind.InPlaceBitwiseAnd: return "&=";
                case PythonOperationKind.InPlaceBitwiseOr: return "|=";
                case PythonOperationKind.InPlaceExclusiveOr: return "^=";
                case PythonOperationKind.ReverseAdd: return "+";
                case PythonOperationKind.ReverseSubtract: return "-";
                case PythonOperationKind.ReversePower: return "**";
                case PythonOperationKind.ReverseMultiply: return "*";
                case PythonOperationKind.ReverseFloorDivide: return "/";
                case PythonOperationKind.ReverseDivide: return "/";
                case PythonOperationKind.ReverseTrueDivide: return "//";
                case PythonOperationKind.ReverseMod: return "%";
                case PythonOperationKind.ReverseLeftShift: return "<<";
                case PythonOperationKind.ReverseRightShift: return ">>";
                case PythonOperationKind.ReverseBitwiseAnd: return "&";
                case PythonOperationKind.ReverseBitwiseOr: return "|";
                case PythonOperationKind.ReverseExclusiveOr: return "^";
                default: return op.ToString();
            }
        }
开发者ID:jdhardy,项目名称:ironpython,代码行数:53,代码来源:PythonProtocol.Operations.cs

示例3: OperatorToSymbol

        // *** END GENERATED CODE ***

        #endregion

        internal static SymbolId OperatorToSymbol(PythonOperationKind op) {
            switch (op) {
                #region Generated StringOperatorToSymbol

                // *** BEGIN GENERATED CODE ***
                // generated by function: gen_StringOperatorToSymbol from: generate_ops.py

                case PythonOperationKind.Add: return Symbols.OperatorAdd;
                case PythonOperationKind.ReverseAdd: return Symbols.OperatorReverseAdd;
                case PythonOperationKind.InPlaceAdd: return Symbols.OperatorInPlaceAdd;
                case PythonOperationKind.Subtract: return Symbols.OperatorSubtract;
                case PythonOperationKind.ReverseSubtract: return Symbols.OperatorReverseSubtract;
                case PythonOperationKind.InPlaceSubtract: return Symbols.OperatorInPlaceSubtract;
                case PythonOperationKind.Power: return Symbols.OperatorPower;
                case PythonOperationKind.ReversePower: return Symbols.OperatorReversePower;
                case PythonOperationKind.InPlacePower: return Symbols.OperatorInPlacePower;
                case PythonOperationKind.Multiply: return Symbols.OperatorMultiply;
                case PythonOperationKind.ReverseMultiply: return Symbols.OperatorReverseMultiply;
                case PythonOperationKind.InPlaceMultiply: return Symbols.OperatorInPlaceMultiply;
                case PythonOperationKind.FloorDivide: return Symbols.OperatorFloorDivide;
                case PythonOperationKind.ReverseFloorDivide: return Symbols.OperatorReverseFloorDivide;
                case PythonOperationKind.InPlaceFloorDivide: return Symbols.OperatorInPlaceFloorDivide;
                case PythonOperationKind.Divide: return Symbols.OperatorDivide;
                case PythonOperationKind.ReverseDivide: return Symbols.OperatorReverseDivide;
                case PythonOperationKind.InPlaceDivide: return Symbols.OperatorInPlaceDivide;
                case PythonOperationKind.TrueDivide: return Symbols.OperatorTrueDivide;
                case PythonOperationKind.ReverseTrueDivide: return Symbols.OperatorReverseTrueDivide;
                case PythonOperationKind.InPlaceTrueDivide: return Symbols.OperatorInPlaceTrueDivide;
                case PythonOperationKind.Mod: return Symbols.OperatorMod;
                case PythonOperationKind.ReverseMod: return Symbols.OperatorReverseMod;
                case PythonOperationKind.InPlaceMod: return Symbols.OperatorInPlaceMod;
                case PythonOperationKind.LeftShift: return Symbols.OperatorLeftShift;
                case PythonOperationKind.ReverseLeftShift: return Symbols.OperatorReverseLeftShift;
                case PythonOperationKind.InPlaceLeftShift: return Symbols.OperatorInPlaceLeftShift;
                case PythonOperationKind.RightShift: return Symbols.OperatorRightShift;
                case PythonOperationKind.ReverseRightShift: return Symbols.OperatorReverseRightShift;
                case PythonOperationKind.InPlaceRightShift: return Symbols.OperatorInPlaceRightShift;
                case PythonOperationKind.BitwiseAnd: return Symbols.OperatorBitwiseAnd;
                case PythonOperationKind.ReverseBitwiseAnd: return Symbols.OperatorReverseBitwiseAnd;
                case PythonOperationKind.InPlaceBitwiseAnd: return Symbols.OperatorInPlaceBitwiseAnd;
                case PythonOperationKind.BitwiseOr: return Symbols.OperatorBitwiseOr;
                case PythonOperationKind.ReverseBitwiseOr: return Symbols.OperatorReverseBitwiseOr;
                case PythonOperationKind.InPlaceBitwiseOr: return Symbols.OperatorInPlaceBitwiseOr;
                case PythonOperationKind.ExclusiveOr: return Symbols.OperatorExclusiveOr;
                case PythonOperationKind.ReverseExclusiveOr: return Symbols.OperatorReverseExclusiveOr;
                case PythonOperationKind.InPlaceExclusiveOr: return Symbols.OperatorInPlaceExclusiveOr;
                case PythonOperationKind.LessThan: return Symbols.OperatorLessThan;
                case PythonOperationKind.GreaterThan: return Symbols.OperatorGreaterThan;
                case PythonOperationKind.LessThanOrEqual: return Symbols.OperatorLessThanOrEqual;
                case PythonOperationKind.GreaterThanOrEqual: return Symbols.OperatorGreaterThanOrEqual;
                case PythonOperationKind.Equal: return Symbols.OperatorEquals;
                case PythonOperationKind.NotEqual: return Symbols.OperatorNotEquals;
                case PythonOperationKind.LessThanGreaterThan: return Symbols.OperatorLessThanGreaterThan;

                // *** END GENERATED CODE ***

                #endregion

                // unary operators
                case PythonOperationKind.OnesComplement: return Symbols.OperatorOnesComplement;
                case PythonOperationKind.Negate: return Symbols.OperatorNegate;
                case PythonOperationKind.Positive: return Symbols.Positive;
                case PythonOperationKind.AbsoluteValue: return Symbols.AbsoluteValue;
                case PythonOperationKind.DivMod: return Symbols.DivMod;
                case PythonOperationKind.ReverseDivMod: return Symbols.ReverseDivMod;
                case PythonOperationKind.Compare: return Symbols.Cmp;

                default:
                    throw new InvalidOperationException(op.ToString());
            }
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:75,代码来源:Symbols.Generated.cs


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