Lean  $LEAN_TAG$
QuantConnect.Python.BasePythonWrapper< TInterface > Class Template Reference

Base class for Python wrapper classes More...

Inheritance diagram for QuantConnect.Python.BasePythonWrapper< TInterface >:
[legend]

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...
 
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...
 
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...
 
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...
 

Detailed Description

Base class for Python wrapper classes

Definition at line 25 of file BasePythonWrapper.cs.

Constructor & Destructor Documentation

◆ BasePythonWrapper() [1/2]

QuantConnect.Python.BasePythonWrapper< TInterface >.BasePythonWrapper ( bool  validateInterface = true)

Creates a new instance of the BasePythonWrapper<TInterface> class

Parameters
validateInterfaceWhether to perform validations for interface implementation

Definition at line 43 of file BasePythonWrapper.cs.

◆ BasePythonWrapper() [2/2]

QuantConnect.Python.BasePythonWrapper< TInterface >.BasePythonWrapper ( PyObject  instance,
bool  validateInterface = true 
)

Creates a new instance of the BasePythonWrapper<TInterface> class with the specified instance

Parameters
instanceThe underlying python instance
validateInterfaceWhether to perform validations for interface implementation

Definition at line 55 of file BasePythonWrapper.cs.

Member Function Documentation

◆ SetPythonInstance()

void QuantConnect.Python.BasePythonWrapper< TInterface >.SetPythonInstance ( PyObject  instance)

Sets the python instance

Parameters
instanceThe underlying python instance

Definition at line 65 of file BasePythonWrapper.cs.

Here is the caller graph for this function:

◆ GetProperty< T >()

T QuantConnect.Python.BasePythonWrapper< TInterface >.GetProperty< T > ( string  propertyName)

Gets the Python instance property with the specified name

Parameters
propertyNameThe name of the property

Definition at line 81 of file BasePythonWrapper.cs.

◆ GetProperty()

PyObject QuantConnect.Python.BasePythonWrapper< TInterface >.GetProperty ( string  propertyName)

Gets the Python instance property with the specified name

Parameters
propertyNameThe name of the property

Definition at line 91 of file BasePythonWrapper.cs.

Here is the caller graph for this function:

◆ SetProperty()

void QuantConnect.Python.BasePythonWrapper< TInterface >.SetProperty ( string  propertyName,
object  value 
)

Sets the Python instance property with the specified name

Parameters
propertyNameThe name of the property
valueThe property value

Definition at line 102 of file BasePythonWrapper.cs.

◆ GetEvent()

dynamic QuantConnect.Python.BasePythonWrapper< TInterface >.GetEvent ( string  name)

Gets the Python instance event with the specified name

Parameters
nameThe name of the event

Definition at line 112 of file BasePythonWrapper.cs.

◆ HasAttr()

bool QuantConnect.Python.BasePythonWrapper< TInterface >.HasAttr ( string  name)

Determines whether the Python instance has the specified attribute

Parameters
nameThe attribute name
Returns
Whether the Python instance has the specified attribute

Definition at line 123 of file BasePythonWrapper.cs.

Here is the caller graph for this function:

◆ GetMethod()

PyObject QuantConnect.Python.BasePythonWrapper< TInterface >.GetMethod ( string  methodName)

Gets the Python instances method with the specified name and caches it

Parameters
methodNameThe name of the method
Returns
The matched method

Definition at line 134 of file BasePythonWrapper.cs.

Here is the caller graph for this function:

◆ InvokeMethod< T >()

T QuantConnect.Python.BasePythonWrapper< TInterface >.InvokeMethod< T > ( string  methodName,
params object[]  args 
)

Invokes the specified method with the specified arguments

Parameters
methodNameThe name of the method
argsThe arguments to call the method with
Returns
The returned valued converted to the given type

Definition at line 151 of file BasePythonWrapper.cs.

◆ InvokeMethod()

PyObject QuantConnect.Python.BasePythonWrapper< TInterface >.InvokeMethod ( string  methodName,
params object[]  args 
)

Invokes the specified method with the specified arguments

Parameters
methodNameThe name of the method
argsThe arguments to call the method with

Definition at line 163 of file BasePythonWrapper.cs.

Here is the caller graph for this function:

◆ Equals() [1/2]

virtual bool QuantConnect.Python.BasePythonWrapper< TInterface >.Equals ( BasePythonWrapper< TInterface >  other)
virtual

Determines whether the specified instance wraps the same Python object reference as this instance, which would indicate that they are equal.

Parameters
otherThe other object to compare this with
Returns
True if both instances are equal, that is if both wrap the same Python object reference

Definition at line 233 of file BasePythonWrapper.cs.

Here is the caller graph for this function:

◆ Equals() [2/2]

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.

Parameters
objThe other object to compare this with
Returns
True if both instances are equal, that is if both wrap the same Python object reference

Definition at line 244 of file BasePythonWrapper.cs.

◆ GetHashCode()

override int QuantConnect.Python.BasePythonWrapper< TInterface >.GetHashCode ( )

Gets the hash code for the current instance

Returns
The hash code of the current instance

Definition at line 253 of file BasePythonWrapper.cs.

Member Data Documentation

◆ Instance

PyObject QuantConnect.Python.BasePythonWrapper< TInterface >.Instance => _instance
protected

Gets the underlying python instance

Definition at line 37 of file BasePythonWrapper.cs.


The documentation for this class was generated from the following file: