def help()

in torchbiggraph/schema.py [0:0]


    def help(cls):
        subschemas = []

        def append_if_subschema(s):
            if isclass(s) and issubclass(s, Schema) and s not in subschemas:
                subschemas.append(s)

        lines = []
        lines.append("%s:" % cls.NAME)
        lines.append("")
        for field in attr.fields(cls):
            type_ = field.type
            lines.append("  %s (%s)" % (field.name, cls.represent_type(type_)))
            help = field.metadata.get("help", None)
            if help is not None:
                lines.append("\t%s" % help)
            try:
                type_ = unpack_optional(type_)
            except TypeError:
                pass
            append_if_subschema(type_)
            if has_origin(type_, list):
                (element_type,) = type_.__args__
                append_if_subschema(element_type)
            elif has_origin(type_, dict):
                _, value_type = type_.__args__
                append_if_subschema(value_type)
        lines.append("")
        lines.append("")

        return list(chain(*(subschema.help() for subschema in subschemas), lines))