Skip to content

use simpler callable check for meta_eval#323

Merged
SylvainCorlay merged 1 commit intoipython:masterfrom
minrk:callable
Sep 23, 2016
Merged

use simpler callable check for meta_eval#323
SylvainCorlay merged 1 commit intoipython:masterfrom
minrk:callable

Conversation

@minrk
Copy link
Copy Markdown
Member

@minrk minrk commented Sep 23, 2016

instead of type() is FunctionType

instead of `is function`
@minrk minrk added this to the 5.0 milestone Sep 23, 2016
@SylvainCorlay SylvainCorlay merged commit b20eb93 into ipython:master Sep 23, 2016
@minrk minrk deleted the callable branch September 26, 2016 12:55
@ankostis
Copy link
Copy Markdown
Contributor

ankostis commented Sep 26, 2016

@minrk now that you are at it, you can change the following docstring to explain that plain-values as filters are also supported?

    def traits(self, **metadata):
        """Get a ``dict`` of all the traits of this class.  The dictionary
        is keyed on the name and the values are the TraitType objects.

        The TraitTypes returned don't know anything about the values
        that the various HasTrait's instances are holding.

        The metadata kwargs allow to filter traits based on metadata values.
        Each keyword might be a callable or a plain value.

        - If it is a callable, the signature must be::

              filter(metadata_value) -> bool

          Return False to skip the trait from the output. If a metadata key
          doesn't exist, None will be passed to the function.

        - Otherwise, the metadata named as the key is checked for equality
          against its value, and included in the output if they match.

          Example:

              ## Fetch only traits with `config == True` metadata.
              has_traits.traits(config=True)
        """

@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. 5.0-no-incidence change that has noincidence on 5.0 compat (eg: doc) and removed 5.0-minor rereviewed, minor change need to be put in changelog. 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-no-incidence change that has noincidence on 5.0 compat (eg: doc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants