dfc3f5b456b0a0395ac8cb3b64a3917a2be05c41,src/python/pants/help/help_info_extracter.py,HelpInfoExtracter,compute_default,#,125

Before Change


        typ = kwargs.get("type", str)

        default = ranked_default.value if ranked_default else None
        if default is None:
            return None, "None"

        if is_list_option(kwargs):
            member_type = kwargs.get("member_type", str)
            if inspect.isclass(member_type) and issubclass(member_type, Enum):
                default = []

            def member_str(val):
                return f""{val}"" if member_type == str else str(val)

            default_str = (
                f"\"[{", ".join(member_str(val) for val in default)}]\"" if default else "[]"
            )
        elif is_dict_option(kwargs):
            if default:
                items_str = ", ".join(f""{k}": {v}" for k, v in default.items())
                default_str = f"{{ {items_str} }}"
            else:
                default_str = "{}"
        elif typ == str:
            default_str = default.replace("\n", " ")
        elif inspect.isclass(typ) and issubclass(typ, Enum):
            default_str = default.value
        else:
            default_str = str(default)

After Change


                f"\"[{", ".join(member_str(val) for val in default)}]\"" if default else "[]"
            )
        elif is_dict_option(kwargs):
            default = ranked_default.value if ranked_default else {}
            if default:
                items_str = ", ".join(f""{k}": {v}" for k, v in default.items())
                default_str = f"{{ {items_str} }}"
            else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pantsbuild/pants
Commit Name: dfc3f5b456b0a0395ac8cb3b64a3917a2be05c41
Time: 2020-07-10
Author: benjyw@gmail.com
File Name: src/python/pants/help/help_info_extracter.py
Class Name: HelpInfoExtracter
Method Name: compute_default


Project Name: ray-project/ray
Commit Name: 6373c706615bc94c0a1e7fc564b3d18c3d342d91
Time: 2020-04-30
Author: ed.nmi.oakes@gmail.com
File Name: python/ray/serve/api.py
Class Name:
Method Name: create_backend


Project Name: autonomio/talos
Commit Name: 75edd1e191f7ad38ae71bd31cba87d1faedbb6a1
Time: 2019-02-20
Author: mailme@mikkokotila.com
File Name: talos/utils/string_cols_to_numeric.py
Class Name:
Method Name: string_cols_to_numeric