Opened 6 years ago

Closed 6 years ago

#19675 closed enhancement (fixed)

Move normalize_names() out of CategoryObject

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-6.10
Component: categories Keywords:
Cc: Merged in:
Authors: Jeroen Demeyer Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 280312f (Commits, GitHub, GitLab) Commit: 280312f0d57cb9c85d5333970f4261939f634d7b
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

It makes no sense that normalize_names appears in the TAB-completion of all CategoryObjects. It also makes little sense that it's a method of CategoryObject.

  1. Move normalize_names and _certify_names out of CategoryObject and make them non-method functions.
  1. Remove the redundant parent_gens.normalize_names, parent_gens._certify_names, parent.normalize_names and sage.schemes.toric.variety.certify_names.
  1. Always interpret ngens=-1 as "unknown number of generators" and ngens=0 as "no generators". The previous implementation did this inconsistently.
  1. Add doctests.

Note that many more classes should probably use normalize_names. I didn't fix this here. Example from src/sage/algebras/jordan_algebra.py:

        if names is not None:
            if isinstance(names, str):
                names = names.split(',')
            names = tuple(names)

Change History (10)

comment:1 Changed 6 years ago by jdemeyer

  • Description modified (diff)
  • Summary changed from make CategoryObject.normalize_names private to move normalize_names() out of CategoryObject

comment:2 Changed 6 years ago by jdemeyer

  • Description modified (diff)
  • Summary changed from move normalize_names() out of CategoryObject to Move normalize_names() out of CategoryObject

comment:3 Changed 6 years ago by jdemeyer

  • Description modified (diff)

comment:4 Changed 6 years ago by tscrim

Big +1.

comment:5 Changed 6 years ago by jdemeyer

  • Branch set to u/jdemeyer/make_categoryobject_normalize_names_private

comment:6 Changed 6 years ago by jdemeyer

  • Commit set to 280312f0d57cb9c85d5333970f4261939f634d7b
  • Status changed from new to needs_review

New commits:

280312fMove normalize_names to function in category_object.pyx

comment:7 Changed 6 years ago by jdemeyer

  • Description modified (diff)

comment:8 Changed 6 years ago by jdemeyer

  • Description modified (diff)

comment:9 Changed 6 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

LGTM.

comment:10 Changed 6 years ago by vbraun

  • Branch changed from u/jdemeyer/make_categoryobject_normalize_names_private to 280312f0d57cb9c85d5333970f4261939f634d7b
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.