Lean
$LEAN_TAG$
|
Base class for Python wrapper classes More...
Classes | |
class | PythonRuntimeChecker |
Set of helper methods to invoke Python methods with runtime checks for return values and out parameter's conversions. More... | |
Public Member Functions | |
BasePythonWrapper (bool validateInterface=true) | |
Creates a new instance of the BasePythonWrapper<TInterface> class More... | |
BasePythonWrapper (PyObject instance, bool validateInterface=true) | |
Creates a new instance of the BasePythonWrapper<TInterface> class with the specified instance More... | |
void | SetPythonInstance (PyObject instance) |
Sets the python instance More... | |
T | GetProperty< T > (string propertyName) |
Gets the Python instance property with the specified name More... | |
PyObject | GetProperty (string propertyName) |
Gets the Python instance property with the specified name More... | |
void | SetProperty (string propertyName, object value) |
Sets the Python instance property with the specified name More... | |
dynamic | GetEvent (string name) |
Gets the Python instance event with the specified name More... | |
bool | HasAttr (string name) |
Determines whether the Python instance has the specified attribute More... | |
PyObject | GetMethod (string methodName) |
Gets the Python instances method with the specified name and caches it More... | |
T | InvokeMethod< T > (string methodName, params object[] args) |
Invokes the specified method with the specified arguments More... | |
PyObject | InvokeMethod (string methodName, params object[] args) |
Invokes the specified method with the specified arguments More... | |
void | InvokeVoidMethod (string methodName, params object[] args) |
Invokes the specified method with the specified arguments without returning a value More... | |
IEnumerable< T > | InvokeMethodAndEnumerate< T > (string methodName, params object[] args) |
Invokes the specified method with the specified arguments and iterates over the returned values More... | |
Dictionary< TKey, TValue > | InvokeMethodAndGetDictionary< TKey, TValue > (string methodName, params object[] args) |
Invokes the specified method with the specified arguments and iterates over the returned values More... | |
T | InvokeMethodWithOutParameters< T > (string methodName, Type[] outParametersTypes, out object[] outParameters, params object[] args) |
Invokes the specified method with the specified arguments and out parameters More... | |
T | InvokeMethodAndWrapResult< T > (string methodName, Func< PyObject, T > wrapResult, params object[] args) |
Invokes the specified method with the specified arguments and wraps the result by calling the given function if the result is not a C# object More... | |
virtual bool | Equals (BasePythonWrapper< TInterface > other) |
Determines whether the specified instance wraps the same Python object reference as this instance, which would indicate that they are equal. More... | |
override bool | Equals (object obj) |
Determines whether the specified object is an instance of BasePythonWrapper<TInterface> and wraps the same Python object reference as this instance, which would indicate that they are equal. More... | |
override int | GetHashCode () |
Gets the hash code for the current instance More... | |
Protected Attributes | |
PyObject | Instance => _instance |
Gets the underlying python instance More... | |
Base class for Python wrapper classes
Definition at line 25 of file BasePythonWrapper.cs.
QuantConnect.Python.BasePythonWrapper< TInterface >.BasePythonWrapper | ( | bool | validateInterface = true | ) |
Creates a new instance of the BasePythonWrapper<TInterface> class
validateInterface | Whether to perform validations for interface implementation |
Definition at line 43 of file BasePythonWrapper.cs.
QuantConnect.Python.BasePythonWrapper< TInterface >.BasePythonWrapper | ( | PyObject | instance, |
bool | validateInterface = true |
||
) |
Creates a new instance of the BasePythonWrapper<TInterface> class with the specified instance
instance | The underlying python instance |
validateInterface | Whether to perform validations for interface implementation |
Definition at line 55 of file BasePythonWrapper.cs.
void QuantConnect.Python.BasePythonWrapper< TInterface >.SetPythonInstance | ( | PyObject | instance | ) |
Sets the python instance
instance | The underlying python instance |
Definition at line 65 of file BasePythonWrapper.cs.
T QuantConnect.Python.BasePythonWrapper< TInterface >.GetProperty< T > | ( | string | propertyName | ) |
Gets the Python instance property with the specified name
propertyName | The name of the property |
Definition at line 81 of file BasePythonWrapper.cs.
PyObject QuantConnect.Python.BasePythonWrapper< TInterface >.GetProperty | ( | string | propertyName | ) |
Gets the Python instance property with the specified name
propertyName | The name of the property |
Definition at line 91 of file BasePythonWrapper.cs.
void QuantConnect.Python.BasePythonWrapper< TInterface >.SetProperty | ( | string | propertyName, |
object | value | ||
) |
Sets the Python instance property with the specified name
propertyName | The name of the property |
value | The property value |
Definition at line 102 of file BasePythonWrapper.cs.
dynamic QuantConnect.Python.BasePythonWrapper< TInterface >.GetEvent | ( | string | name | ) |
Gets the Python instance event with the specified name
name | The name of the event |
Definition at line 112 of file BasePythonWrapper.cs.
bool QuantConnect.Python.BasePythonWrapper< TInterface >.HasAttr | ( | string | name | ) |
Determines whether the Python instance has the specified attribute
name | The attribute name |
Definition at line 123 of file BasePythonWrapper.cs.
PyObject QuantConnect.Python.BasePythonWrapper< TInterface >.GetMethod | ( | string | methodName | ) |
Gets the Python instances method with the specified name and caches it
methodName | The name of the method |
Definition at line 134 of file BasePythonWrapper.cs.
T QuantConnect.Python.BasePythonWrapper< TInterface >.InvokeMethod< T > | ( | string | methodName, |
params object[] | args | ||
) |
Invokes the specified method with the specified arguments
methodName | The name of the method |
args | The arguments to call the method with |
Definition at line 151 of file BasePythonWrapper.cs.
PyObject QuantConnect.Python.BasePythonWrapper< TInterface >.InvokeMethod | ( | string | methodName, |
params object[] | args | ||
) |
Invokes the specified method with the specified arguments
methodName | The name of the method |
args | The arguments to call the method with |
Definition at line 162 of file BasePythonWrapper.cs.
void QuantConnect.Python.BasePythonWrapper< TInterface >.InvokeVoidMethod | ( | string | methodName, |
params object[] | args | ||
) |
Invokes the specified method with the specified arguments without returning a value
methodName | The name of the method |
args | The arguments to call the method with |
Definition at line 174 of file BasePythonWrapper.cs.
IEnumerable<T> QuantConnect.Python.BasePythonWrapper< TInterface >.InvokeMethodAndEnumerate< T > | ( | string | methodName, |
params object[] | args | ||
) |
Invokes the specified method with the specified arguments and iterates over the returned values
methodName | The name of the method |
args | The arguments to call the method with |
Definition at line 185 of file BasePythonWrapper.cs.
Dictionary<TKey, TValue> QuantConnect.Python.BasePythonWrapper< TInterface >.InvokeMethodAndGetDictionary< TKey, TValue > | ( | string | methodName, |
params object[] | args | ||
) |
Invokes the specified method with the specified arguments and iterates over the returned values
methodName | The name of the method |
args | The arguments to call the method with |
Definition at line 197 of file BasePythonWrapper.cs.
T QuantConnect.Python.BasePythonWrapper< TInterface >.InvokeMethodWithOutParameters< T > | ( | string | methodName, |
Type[] | outParametersTypes, | ||
out object[] | outParameters, | ||
params object[] | args | ||
) |
Invokes the specified method with the specified arguments and out parameters
methodName | The name of the method |
outParametersTypes | The types of the out parameters |
outParameters | The out parameters values |
args | The arguments to call the method with |
Definition at line 211 of file BasePythonWrapper.cs.
T QuantConnect.Python.BasePythonWrapper< TInterface >.InvokeMethodAndWrapResult< T > | ( | string | methodName, |
Func< PyObject, T > | wrapResult, | ||
params object[] | args | ||
) |
Invokes the specified method with the specified arguments and wraps the result by calling the given function if the result is not a C# object
methodName | The name of the method |
wrapResult | Method that wraps a Python object in the corresponding Python Wrapper |
args | The arguments to call the method with |
Definition at line 225 of file BasePythonWrapper.cs.
|
virtual |
Determines whether the specified instance wraps the same Python object reference as this instance, which would indicate that they are equal.
other | The other object to compare this with |
Definition at line 294 of file BasePythonWrapper.cs.
override bool QuantConnect.Python.BasePythonWrapper< TInterface >.Equals | ( | object | obj | ) |
Determines whether the specified object is an instance of BasePythonWrapper<TInterface> and wraps the same Python object reference as this instance, which would indicate that they are equal.
obj | The other object to compare this with |
Definition at line 305 of file BasePythonWrapper.cs.
override int QuantConnect.Python.BasePythonWrapper< TInterface >.GetHashCode | ( | ) |
Gets the hash code for the current instance
Definition at line 314 of file BasePythonWrapper.cs.
|
protected |
Gets the underlying python instance
Definition at line 37 of file BasePythonWrapper.cs.