def class_name_factory()

in glean_parser/javascript.py [0:0]


def class_name_factory(platform: str) -> Callable[[str], str]:
    """
    Returns a function that receives an obj_type and
    returns the correct class name for that type in the current platform.
    """

    def class_name(obj_type: str) -> str:
        if obj_type == "ping":
            class_name = "PingType"
        else:
            if obj_type.startswith("labeled_"):
                obj_type = obj_type[8:]
            class_name = util.Camelize(obj_type) + "MetricType"

        if platform == "qt":
            return "Glean.Glean._private." + class_name

        return class_name

    return class_name