docstring for convertallfields
547358
def convertallfields(data, commdct, block=None):
    """"""
    # import pdbdb; pdb.set_trace()
    for key in list(data.dt.keys()):
        objs = data.dt[key]
        for i, obj in enumerate(objs):
            key_i = data.dtls.index(key)
            key_comm = commdct[key_i]
            try:
                inblock = block[key_i]
            except TypeError as e:
                inblock = None
            obj = convertfields(key_comm, obj, inblock)
            objs[i] = obj
333787
private String _serializeQuery(Query query, Set<Object> done) throws ConverterException {

	// fieldnames
	PageContext pc = ThreadLocalPageContext.get();
	boolean upperCase = false;
	if (pc != null) upperCase = pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !((ConfigWebImpl) pc.getConfig()).preserveCase();

	StringBuilder fn = new StringBuilder();
	Collection.Key[] keys = CollectionUtil.keys(query);
	for (int i = 0; i < keys.length; i++) {
	    if (i > 0) fn.append(',');
	    fn.append(XMLUtil.escapeXMLString(upperCase ? keys[i].getUpperString() : keys[i].getString()));
	}

	StringBuilder sb = new StringBuilder(
		goIn() + "<recordset rowCount=" + del + query.getRecordcount() + del + " fieldNames=" + del + fn + del + " type=" + del + "coldfusion.sql.QueryTable" + del + ">");

	deep++;
	int len = query.getRecordcount();
	for (int i = 0; i < keys.length; i++) {
	    sb.append(goIn() + "<field name=" + del + XMLUtil.escapeXMLString(keys[i].getString()) + del + ">");
	    for (int y = 1; y <= len; y++) {
		try {
		    sb.append(_serialize(query.getAt(keys[i], y), done));
		}
		catch (PageException e) {
		    sb.append(_serialize(e.getMessage(), done));
		}
	    }

	    sb.append(goIn() + "</field>");
	}
	deep--;

	sb.append(goIn() + "</recordset>");
	return sb.toString();
    }
84010
private void exposeExposedFieldsToJs() {
    if (fieldsWithNameExposed.isEmpty()) {
      return;
    }

    MethodSpec.Builder exposeFieldMethod = MethodSpec
        .methodBuilder("vg$ef")
        .addAnnotation(JsMethod.class);

    fieldsWithNameExposed
        .forEach(field -> exposeFieldMethod
            .addStatement("this.$L = $T.v()",
                field.getName(),
                FieldsExposer.class)
        );

    exposeFieldMethod
        .addStatement(
            "$T.e($L)",
            FieldsExposer.class,
            String.join(
                ",",
                fieldsWithNameExposed.stream()
                    .map(ExposedField::getName)
                    .collect(Collectors.toList())
            )
        );
    componentExposedTypeBuilder.addMethod(exposeFieldMethod.build());
  }
369709
public static String convertDocToString(Document doc) throws TransformerException {
        //set up a transformer
        TransformerFactory transfac = TransformerFactory.newInstance();
        Transformer trans = transfac.newTransformer();
        trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, YES);
        trans.setOutputProperty(OutputKeys.INDENT, YES);

        //create string from xml tree
        StringWriter sw = new StringWriter();
        StreamResult result = new StreamResult(sw);
        DOMSource source = new DOMSource(doc);
        trans.transform(source, result);
        return sw.toString();
    }
333169
def model_fields(model, allow_pk=False, only=None, exclude=None,
                 field_args=None, converter=None):
    
    converter = converter or ModelConverter()
    field_args = field_args or {}

    model_fields = list(model._meta.sorted_fields)
    if not allow_pk:
        model_fields.pop(0)

    if only:
        model_fields = [x for x in model_fields if x.name in only]
    elif exclude:
        model_fields = [x for x in model_fields if x.name not in exclude]

    field_dict = {}
    for model_field in model_fields:
        name, field = converter.convert(
            model,
            model_field,
            field_args.get(model_field.name))
        field_dict[name] = field

    return field_dict
27951
function typeToJsDocString(schema) {
  //console.log(schema.type);
  if (schema.docType) {
    return schema.docType;
  }
  
  if (typeof schema.type === 'string') {
    switch (schema.type) {
      /* TODO Implement as @callback
      case 'Function':
      case 'function':
        if (schema.doc && schema.doc.parameters) {
          return 'function'; // + (Object.keys(schema.doc.parameters)).join(', ')
          //    + ')';
        } else {
          return 'function';
        }*/
      case 'any':
        return '*';
      default:
        return schema.type;
    }
  } else if (schema.type === null) {
    return 'schema';
  } else if (schema.type instanceof Object) {
    return 'Object';
  }
}
130549
def construct_docstring(options):
        """"""
        s = "\nParameters\n"
        s += "----------\n\n"
        for key, opt in options.items():
            s += "%s : %s\n      %s [%s]\n" % (key, str(opt[2]),
                                               str(opt[1]), str(opt[0]))
        return s
1207651
def get_all_fields(obj):
    """"""
    fields = []
    for f in obj._meta.fields:
        fname = f.name

        get_choice = "get_" + fname + "_display"
        if hasattr(obj, get_choice):
            value = getattr(obj, get_choice)()
        else:
            try:
                value = getattr(obj, fname)
            except Exception:
                value = None

        if isinstance(value, list):
            value = ",".join(str(v) for v in value)

        if f.editable and value and f.name:
            fields.append(
                {"label": f.verbose_name, "name": f.name, "value": value}
            )

    return fields
80432
def _with_fields(*fields):
    
    dd = {}
    for x in fields:
        dd[x] = _COMMON_FIELDS[x]

    def wrap(cls):
        dd.update(cls.__dict__)
        return type(cls.__name__, cls.__bases__, dd)

    return wrap
738879
def _fieldnames_to_colnames(model_cls, fieldnames):
        """"""
        get_field = model_cls._meta.get_field
        fields = map(get_field, fieldnames)
        return {f.column for f in fields}
770328
def _transform_field(field):
    """"""
    if isinstance(field, bool):
        return TRUE if field else FALSE
    elif isinstance(field, (list, dict)):
        return json.dumps(field, sort_keys=True, ensure_ascii=False)
    else:
        return field
1255585
def __objecthasfields(bunchdt, data, commdct, idfobject, places=7, **kwargs):
    """"""
    for key, value in list(kwargs.items()):
        if not isfieldvalue(
                bunchdt, data, commdct,
                idfobject, key, value, places=places):
            return False
    return True
191607
protected Object convertFieldValue(Schema outputSchema, Field field, GenericRecord inputRecord,
      WorkUnitState workUnit)
      throws DataConversionException {
    if (field.name().equals(payloadField)) {
      return upConvertPayload(inputRecord);
    }
    return inputRecord.get(field.name());
  }
826765
def iterate_over_fields(cls):
        """"""
        for attr in dir(cls):
            clsattr = getattr(cls, attr)
            if isinstance(clsattr, BaseField):
                yield attr, clsattr
1241133
private Map<String, Object> toFieldsMap(Map<String, DocumentField> fields) {
		Map<String, Object> result = new HashMap<>();
		for (Entry<String, DocumentField> entry : fields.entrySet()) {
			if (entry.getValue().getValues().size() > 1) {
				result.put(entry.getKey(), entry.getValue().getValues());
			} else {
				result.put(entry.getKey(), entry.getValue().getValue());
			}

		}
		return result;
	}
661445
def get_convert_dict(fmt):
    """"""
    convdef = {}
    for literal_text, field_name, format_spec, conversion in formatter.parse(fmt):
        if field_name is None:
            continue
        # XXX: Do I need to include 'conversion'?
        convdef[field_name] = format_spec
    return convdef
1074826
private String convertFieldValue(final Field field,
                                     final ExportContainer container) {
        final boolean isArray2D = (container.getType() == FieldContainer.Type.ARRAY_2D);
        if (field.getType().equals(String.class)) {
            return wrapWithComma(container.getExportValue());
        } else if (isTypeTimestampConvertible(field)) {
            return wrapWithComma(String.valueOf(convertFieldValueToTimestamp(field, container)));
        } else if (container.getType() == FieldContainer.Type.ARRAY
                || isArray2D
                || container.getType() == FieldContainer.Type.COLLECTION) {

            final Class<?> componentType = extractType(container.getType(), field);
            final String sqlType = dataTypes.getOrDefault(componentType, "VARCHAR");
            final String result = (sqlType.equals("VARCHAR") || sqlType.equals("CHAR"))
                    ? container.getExportValue().replace("[", "{\"").replace("]", "\"}").replace(",", "\",\"").replace(" ", "")
                    : container.getExportValue().replace("[", "{").replace("]", "}");
            return wrapWithComma(result);
        }

        return container.getExportValue();
    }