Opened 7 years ago

Closed 6 years ago

#14119 closed defect (worksforme)

Small bug in import statements

Reported by: chrisjamesberg Owned by: chrisjamesberg
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: misc Keywords: import_statements
Cc: rowland Merged in:
Authors: Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by kcrisman)

Eric Rowland pointed out the following weird behavior with respect to import_statements.

sage: import_statements(digraphs)

from sage.graphs.digraph_generators import <sage.graphs.digraph_generators.DiGraphGenerators instance at 0x115bf4b00>

Change History (5)

comment:1 Changed 7 years ago by kcrisman

  • Authors chrisjamesberg deleted
  • Component changed from PLEASE CHANGE to misc
  • Description modified (diff)
  • Priority changed from major to minor

"Authors" is for author of a patch; you're already the reporter :-)

But

sage: import_statements(DiGraph)
from sage.graphs.digraph import DiGraph

so maybe that's okay?

A few things also give "class" instead of this, a few (colors) give dictionaries, and don't even try copying :-) (since sage: print "%s"%copying ends up printing the entire license statement).


Basically, we probably need a little more uniformity in that some things do not have a __name__. That's what happens here.

sage: qepcad_formula.__module__
'sage.interfaces.qepcad'
sage: qepcad_formula
<sage.interfaces.qepcad.qepcad_formula_factory instance at 0x103b37290>

So this might need a bit more work than just fixing one thing.


I also note that this doesn't actually return a string, but simply prints the imports and then returns None. I don't know if I like that.

Last edited 7 years ago by kcrisman (previous) (diff)

comment:2 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:3 Changed 6 years ago by chapoton

  • Milestone changed from sage-5.12 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

In a vanilla 5.12.beta2, I get

sage: import_statements(digraphs)
from sage.graphs.digraph_generators import digraphs
sage: import_statements(colors)
from sage.plot.colors import colors
sage: import_statements(qepcad_formula)
from sage.interfaces.qepcad import qepcad_formula
sage: import_statements(DiGraph)
from sage.graphs.digraph import DiGraph

which is perfectly ok.

So let me close this as invalid/wontfix

comment:4 Changed 6 years ago by chapoton

  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

comment:5 Changed 6 years ago by jdemeyer

  • Resolution set to worksforme
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.