Skip to content

fix(help): finish #381 for RsT to print enum-choices - #438

Merged
minrk merged 2 commits into
ipython:masterfrom
ankostis:enum_rst
Aug 15, 2017
Merged

fix(help): finish #381 for RsT to print enum-choices#438
minrk merged 2 commits into
ipython:masterfrom
ankostis:enum_rst

Conversation

@ankostis

Copy link
Copy Markdown
Contributor

#381 inserted a new line Choices: x, y, z into the help and config messages for all Enum traits, immediately above Default: ... line.
As had been mentioned in that PR, that feature was never added to the RsT documentation produced by Configurable.class_config_rst_doc() classs method.
This PR fixes that neglect.

  • Had to add an optional as_rst=false kwd to allXxxEnum.info() methods.
  • Added TCs for info().

RsT samples for info() method:

  • Enum & UseEnum traits:

    any of ``'red'``|``'Green'``|``'BLUE'``|``'YeLLoW'`` or `None`
    
  • CaselessStrEnum:

    any of ``'red'``|``'Green'``|``'BLUE'``|``'YeLLoW'`` (case-insensitive) or `None`
    
  • FuzzyEnum:

    any case-insensitive prefix of ``'red'``|``'Green'``|``'BLUE'``|``'YeLLoW'`` or `None`
    

+ Had to add `as_rst=false` kwd to all `XxxEnum.info()` methods.
+ Added TCs for `info()`.
Comment thread traitlets/traitlets.py Outdated
choices = repr(list(choices))
return choices

def info(self, as_rst=False):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an as_rst arg is a backward-incompatible change because user traits can have defined .info() accepting no arguments, which must not result in any errors.

Maybe better to define a new .info_rst() method that calls .info() by default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@minrk
minrk merged commit e9acdb5 into ipython:master Aug 15, 2017
@minrk minrk added this to the 5.0 milestone Aug 15, 2017
@Carreau Carreau added 5.0-re-review Need to re-review for potential API impact changes. 5.0-minor rereviewed, minor change need to be put in changelog. and removed 5.0-re-review Need to re-review for potential API impact changes. labels Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.0-minor rereviewed, minor change need to be put in changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants