On Monday, 6 March 2017 06:17:32 UTC+10, Denis Akhiyarov wrote:
>
> I just tried adding this in rope_plugin.py, but code completion on live
> .NET/CLR objects is still not working in IDE. In console it works of course.
>
> #TODO: The following preferences should be customizable in the future
> ROPE_PREFS = {'ignore_syntax_errors': True,
> 'ignore_bad_imports': True,
> 'soa_followed_calls': 2,
> 'extension_modules': ["clr"],
> }
>
>
>
>
> On Sunday, March 5, 2017 at 1:57:25 PM UTC-6, Carlos Córdoba wrote:
>>
>> Hi Denis,
>>
>> We never managed to implement this change. Would you like to create a
>> pull request for it?
>>
>>
>> Cheers,
>> Carlos
>>
>> El 05/03/17 a las 14:53, Denis Akhiyarov escribió:
>>
>> @lcorrigan were you able to get code completion for Python.NET with live
>> objects in Spyder? If yes, can you share the changes that you made?
>>
>> For Spyder 3.0 I do not see this setting for extension_modules or
>> ROPE_PREFS in spyderlib/widgets/sourcecode/codeeditor.py
>>
>> Thanks,
>> Denis
>>
>> On Thursday, February 23, 2012 at 8:12:03 AM UTC-6, lcorrigan wrote:
>>>
>>> That worked great, thanks a bunch Carlos!
>>
>> --
>>
>>
For a hacky workaround you can force introspection by iterating over the
types in the assembly:
In [1]: import clr
In [2]: import System
In [3]: clr.AddReference('System.Data')
Out[3]: <System.Reflection.RuntimeAssembly at 0xd2de4e0>
In [4]: dir(System.Data)
Out[4]:
['__class__',
'__delattr__',
'__delete__',
'__dir__',
'__doc__',
'__eq__',
'__file__',
'__format__',
'__ge__',
'__getattribute__',
'__gt__',
'__hash__',
'__init__',
'__le__',
'__lt__',
'__module__',
'__name__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__set__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__']
In [5]: def getattrdot(obj, name, *default):
...: first, *rest = name.split('.', 1)
...: obj = getattr(obj, first, *default)
...: if not rest:
...: return obj
...: return getattrdot(obj, *rest, *default)
...:
In [6]: def AddReference(name):
...: import clr
...: assembly = clr.AddReference(name)
...: pymodule = getattrdot(clr, name)
...: print("Loaded '{}'".format(name))
...: print("Introspecting types...")
...: for t in assembly.GetTypes():
...: getattr(pymodule, t.Name, None)
...:
In [7]: AddReference('System.Data')
Loaded 'System.Data'
Introspecting types...
In [8]: dir(System.Data)
Out[8]:
['AcceptRejectRule',
'CommandBehavior',
'CommandType',
'ConflictOption',
'ConnectionState',
'Constraint',
'ConstraintCollection',
'ConstraintException',
'DBConcurrencyException',
'DataColumn',
'DataColumnChangeEventArgs',
'DataColumnChangeEventHandler',
'DataColumnCollection',
'DataException',
'DataRelation',
'DataRelationCollection',
'DataRow',
'DataRowAction',
'DataRowBuilder',
'DataRowChangeEventArgs',
'DataRowChangeEventHandler',
'DataRowCollection',
'DataRowState',
'DataRowVersion',
'DataRowView',
'DataSet',
'DataSetDateTime',
'DataSetSchemaImporterExtension',
'DataSysDescriptionAttribute',
'DataTable',
'DataTableClearEventArgs',
'DataTableClearEventHandler',
'DataTableCollection',
'DataTableNewRowEventArgs',
'DataTableNewRowEventHandler',
'DataTableReader',
'DataView',
'DataViewManager',
'DataViewRowState',
'DataViewSetting',
'DataViewSettingCollection',
'DbType',
'DeletedRowInaccessibleException',
'DuplicateNameException',
'EvaluateException',
'FillErrorEventArgs',
'FillErrorEventHandler',
'ForeignKeyConstraint',
'IColumnMapping',
'IColumnMappingCollection',
'IDataAdapter',
'IDataParameter',
'IDataParameterCollection',
'IDataReader',
'IDataRecord',
'IDbCommand',
'IDbConnection',
'IDbDataAdapter',
'IDbDataParameter',
'IDbTransaction',
'ITableMapping',
'ITableMappingCollection',
'InRowChangingEventException',
'InternalDataCollectionBase',
'InvalidConstraintException',
'InvalidExpressionException',
'IsolationLevel',
'KeyRestrictionBehavior',
'LoadOption',
'MappingType',
'MergeFailedEventArgs',
'MergeFailedEventHandler',
'MissingMappingAction',
'MissingPrimaryKeyException',
'MissingSchemaAction',
'NoNullAllowedException',
'OperationAbortedException',
'ParameterDirection',
'PropertyAttributes',
'PropertyCollection',
'ReadOnlyException',
'RowNotInTableException',
'Rule',
'SchemaSerializationMode',
'SchemaType',
'SerializationFormat',
'SqlDbType',
'StateChangeEventArgs',
'StateChangeEventHandler',
'StatementCompletedEventArgs',
'StatementCompletedEventHandler',
'StatementType',
'StrongTypingException',
'SyntaxErrorException',
'TypedDataSetGenerator',
'TypedDataSetGeneratorException',
'UniqueConstraint',
'UpdateRowSource',
'UpdateStatus',
'VersionNotFoundException',
'XmlReadMode',
'XmlWriteMode',
'__class__',
'__delattr__',
'__delete__',
'__dir__',
'__doc__',
'__eq__',
'__file__',
'__format__',
'__ge__',
'__getattribute__',
'__gt__',
'__hash__',
'__init__',
'__le__',
'__lt__',
'__module__',
'__name__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__set__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__']
In [9]:
--
You received this message because you are subscribed to the Google Groups
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.