Skip to content

Tidying up in cli/utils/_plotting #486

@ajjackson

Description

@ajjackson
    from operator import is_none
    from typing import Any
    from toolz.dicttoolz import valfilter

    mapping = {'cmap': 'image.cmap',
               'fontsize': 'font.size',
               'font': 'font.sans-serif',
               'linewidth': 'lines.linewidth',
               'figsize': 'figure.figsize'}

    def is_not_none(item: Any) -> bool:   # Python 3.14 adds this to operator
        return not is_none(item)

    # Explicit args take priority over any other
    args_dict = valfilter(is_not_none, vars(user_args))

    explicit_args = {
        mapping[key]: args_dict[key]
        for key in (args_dict.keys() & mapping.keys())
    }

Let's note that for another PR

Originally posted by @ajjackson in #481 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions