File tree Expand file tree Collapse file tree 2 files changed +3
-13
lines changed
Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -861,7 +861,7 @@ public void SetMarginModel(PyObject pyObject)
861861 /// <param name="pyObject">Python class that represents a custom shortable provider</param>
862862 public void SetShortableProvider ( PyObject pyObject )
863863 {
864- ShortableProvider = PythonUtil . CreateModelOrWrapper < IShortableProvider , ShortableProviderPythonWrapper > ( pyObject , true ) ;
864+ ShortableProvider = PythonUtil . CreateModelOrWrapper < IShortableProvider , ShortableProviderPythonWrapper > ( pyObject ) ;
865865 }
866866
867867 /// <summary>
@@ -880,7 +880,7 @@ public void SetShortableProvider(IShortableProvider shortableProvider)
880880 /// <exception cref="ArgumentException"></exception>
881881 public void SetDataFilter ( PyObject pyObject )
882882 {
883- DataFilter = PythonUtil . CreateModelOrWrapper < ISecurityDataFilter , SecurityDataFilterPythonWrapper > ( pyObject , true ) ;
883+ DataFilter = PythonUtil . CreateModelOrWrapper < ISecurityDataFilter , SecurityDataFilterPythonWrapper > ( pyObject ) ;
884884 }
885885
886886 /// <summary>
Original file line number Diff line number Diff line change @@ -368,12 +368,8 @@ public static IEnumerable<Symbol> ConvertToSymbols(PyObject input)
368368 /// <typeparam name="TInterface">The interface type expected</typeparam>
369369 /// <typeparam name="TWrapper">The Python wrapper type for TInterface</typeparam>
370370 /// <param name="pyObject">The Python object to convert</param>
371- /// <param name="requiresImplementation">True to require Python objects to inherit/implement the model</param>
372371 /// <returns>Either a pure C# instance or a Python wrapper implementing TInterface</returns>
373- /// <exception cref="ArgumentException">Thrown when pyObject is not a valid TInterface</exception>
374- public static TInterface CreateModelOrWrapper < TInterface , TWrapper > (
375- PyObject pyObject ,
376- bool requiresImplementation = false )
372+ public static TInterface CreateModelOrWrapper < TInterface , TWrapper > ( PyObject pyObject )
377373 where TInterface : class
378374 where TWrapper : TInterface
379375 {
@@ -385,12 +381,6 @@ public static TInterface CreateModelOrWrapper<TInterface, TWrapper>(
385381 return model ;
386382 }
387383
388- // If we require the object to implement the model
389- if ( requiresImplementation && ! Extensions . TryConvert < TInterface > ( pyObject , out _ , allowPythonDerivative : true ) )
390- {
391- throw new ArgumentException ( $ "{ typeof ( TInterface ) . Name } : { pyObject . Repr ( ) } is not a valid argument") ;
392- }
393-
394384 // Create the appropriate Python wrapper
395385 return ( TInterface ) Activator . CreateInstance ( typeof ( TWrapper ) , pyObject ) ;
396386 }
You can’t perform that action at this time.
0 commit comments