PythonExtensions
Provides extension methods for working with IronPython types and functions.
Методы
public static Type GetDotNetType(PythonType type)
result = PythonExtensions.GetDotNetType(type)
Gets the .NET type corresponding to the specified Python type.
- type
- The Python type.
Возвращает: The underlying .NET type; or Object if not found.
public static string GetName(PythonType type)
result = PythonExtensions.GetName(type)
Gets the name of the specified Python type.
- type
- The Python type.
Возвращает: The name of the Python type.
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.
Возвращает: An enumerable of tuples where each tuple contains the name of the parameter and its corresponding type.
public static PropertyInfo GetPropInfo(ReflectedProperty property)
result = PythonExtensions.GetPropInfo(property)
Gets the underlying property information for the reflected property.
- property
- The reflected property.
Возвращает: The underlying PropertyInfo object.
public static MethodInfo[] GetSetters(ReflectedProperty property)
result = PythonExtensions.GetSetters(property)
Gets the setter methods of the reflected property.
- property
- The reflected property.
Возвращает: An array of setter MethodInfo objects.
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.
Возвращает: An enumerable of Python types contained in the scope.
public static Type GetUnderlyingSystemType(PythonType type)
result = PythonExtensions.GetUnderlyingSystemType(type)
Gets the underlying system type for the specified Python type.
- type
- The Python type.
Возвращает: The underlying .NET type.
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.
Возвращает: true if the Python type is assignable to ; otherwise, false.
public static bool IsPythonObject(object obj)
result = PythonExtensions.IsPythonObject(obj)
Determines whether the specified object is an IronPython object.
- obj
- The object to test.
Возвращает: true if the object implements IPythonObject; otherwise, false.
public static bool IsPythonType(Type type)
result = PythonExtensions.IsPythonType(type)
Determines whether the specified type is an IronPython type.
- type
- The type to test.
Возвращает: true if the type is an IronPython type; otherwise, false.
public static bool IsStatic(PythonFunction function)
result = PythonExtensions.IsStatic(function)
Determines whether the specified Python function is static.
- function
- The Python function.
Возвращает: true if the function is static; otherwise, false.
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.
Возвращает: true if the Python type is assignable to ; otherwise, false.
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.
Возвращает: The corresponding CompilationErrorTypes value.