Ticket #12543 (closed enhancement: fixed)

Opened 16 months ago

Last modified 4 months ago

improve import_statements

Reported by: aschilling Owned by: sage-combinat
Priority: major Milestone: sage-5.8
Component: misc Keywords: import_statements, development
Cc: sage-combinat Work issues:
Report Upstream: N/A Reviewers: Nicolas M. Thiéry
Authors: Vincent Delecroix Merged in: sage-5.8.beta3
Dependencies: Stopgaps:

Description (last modified by nthiery) (diff)

Currently, import_statements yields a name error if the class is not imported in the Sage interpreter namespace. For example.

   sage: import_statements(ClonableIntArray)
   NameError: name 'ClonableIntArray' is not defined

With this patch, one can specify the object as a string, and the object is looked up in all (imported) Sage modules.

    sage: import_statements("ClonableIntArray")

See the documentation for more examples.

This patch implements several heuristics to better handle ambiguous names.

Attachments

trac_12543-import_statements-vd.patch Download (10.7 KB) - added by nthiery 4 months ago.

Change History

comment:1 Changed 5 months ago by vdelecroix

  • Status changed from new to needs_review
  • Description modified (diff)
  • Authors changed from Nicolas Thiery to Vincent Delecroix
  • Component changed from combinatorics to misc
  • Summary changed from import_statementss combined with search_def to improve import_statements
  • Keywords import_statements, development added

comment:2 Changed 5 months ago by vdelecroix

Now, all function in the module are documented...

Changed 4 months ago by nthiery

comment:3 Changed 4 months ago by nthiery

  • Status changed from needs_review to positive_review
  • Reviewers set to Nicolas M. Thiéry
  • Description modified (diff)

I did some improvements with Vincent watching over my shoulder.

Positive review! Thanks Vincent :-)

comment:4 Changed 4 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-5.8.beta3
Note: See TracTickets for help on using tickets.