PythonExtensions

Ecng.Compilation.Python

Provides extension methods for working with IronPython types and functions.

Métodos

GetDotNetType
public static Type GetDotNetType(PythonType type)
result = PythonExtensions.GetDotNetType(type)

Gets the .NET type corresponding to the specified Python type.

type
The Python type.

Devuelve: The underlying .NET type; or Object if not found.

GetName
public static string GetName(PythonType type)
result = PythonExtensions.GetName(type)

Gets the name of the specified Python type.

type
The Python type.

Devuelve: The name of the Python type.

GetParams
public static IEnumerable<ValueTuple<string, Type>> GetParams(PythonFunction function)
result = PythonExtensions.GetParams(function)

Retrieves the parameters of the specified Python function along with their corresponding types.

function
The Python function.

Devuelve: An enumerable of tuples where each tuple contains the name of the parameter and its corresponding type.

GetPropInfo
public static PropertyInfo GetPropInfo(ReflectedProperty property)
result = PythonExtensions.GetPropInfo(property)

Gets the underlying property information for the reflected property.

property
The reflected property.

Devuelve: The underlying PropertyInfo object.

GetSetters
public static MethodInfo[] GetSetters(ReflectedProperty property)
result = PythonExtensions.GetSetters(property)

Gets the setter methods of the reflected property.

property
The reflected property.

Devuelve: An array of setter MethodInfo objects.

GetTypes
public static IEnumerable<PythonType> GetTypes(ScriptScope scope)
result = PythonExtensions.GetTypes(scope)

Retrieves all Python types defined in the specified script scope.

scope
The script scope.

Devuelve: An enumerable of Python types contained in the scope.

GetUnderlyingSystemType
public static Type GetUnderlyingSystemType(PythonType type)
result = PythonExtensions.GetUnderlyingSystemType(type)

Gets the underlying system type for the specified Python type.

type
The Python type.

Devuelve: The underlying .NET type.

Is
public static bool Is(PythonType type, Type baseType)
result = PythonExtensions.Is(type, baseType)

Determines whether the specified Python type is assignable to the provided base type.

type
The Python type.
baseType
The base type to check against.

Devuelve: true if the Python type is assignable to ; otherwise, false.

IsPythonObject
public static bool IsPythonObject(object obj)
result = PythonExtensions.IsPythonObject(obj)

Determines whether the specified object is an IronPython object.

obj
The object to test.

Devuelve: true if the object implements IPythonObject; otherwise, false.

IsPythonType
public static bool IsPythonType(Type type)
result = PythonExtensions.IsPythonType(type)

Determines whether the specified type is an IronPython type.

type
The type to test.

Devuelve: true if the type is an IronPython type; otherwise, false.

IsStatic
public static bool IsStatic(PythonFunction function)
result = PythonExtensions.IsStatic(function)

Determines whether the specified Python function is static.

function
The Python function.

Devuelve: true if the function is static; otherwise, false.

Is``1
public static bool Is<TBase>(PythonType type)
result = PythonExtensions.Is(type)

Determines whether the specified Python type is assignable to the base type .

type
The Python type.

Devuelve: true if the Python type is assignable to ; otherwise, false.

ToErrorType
public static CompilationErrorTypes ToErrorType(Severity severity)
result = PythonExtensions.ToErrorType(severity)

Converts a Severity value to its corresponding CompilationErrorTypes.

severity
The severity of the error or warning.

Devuelve: The corresponding CompilationErrorTypes value.