Convert fields from string to preferred format for GAF ver 2.1 and 2.0.
197317
def get_gafvals(self, line):
        """"""
        flds = line.split('\t')

        flds[3] = self._get_qualifier(flds[3])  # 3  Qualifier
        flds[5] = self._get_set(flds[5])     # 5  DB_Reference
        flds[7] = self._get_set(flds[7])     # 7  With_From
        flds[8] = self.aspect2ns[flds[8]]    # 8 GAF Aspect field converted to BP, MF, or CC
        flds[9] = self._get_set(flds[9])     # 9  DB_Name
        flds[10] = self._get_set(flds[10])   # 10 DB_Synonym
        flds[12] = self._do_taxons(flds[12])  # 12 Taxon
        flds[13] = GET_DATE_YYYYMMDD(flds[13]) # self.strptime(flds[13], '%Y%m%d').date(),  # 13 Date   20190406

        # Version 2.x has these additional fields not found in v1.0
        if self.is_long:
            flds[15] = get_extensions(flds[15])  # Extensions (or Annotation_Extension)
            flds[16] = self._get_set(flds[16].rstrip())
        else:
            flds[14] = self._get_set(flds[14].rstrip())
        return flds
373989
function(fields, data) {
    if (!_.isString(fields)) {
      return data;
    }

    // If a field is specified as `foo.bar` or `foo.bar.baz`,
    // Convert it to just `foo`
    var map = {};
    _.forEach(fields.split(','), function(field) {
      map[field.split('.')[0]] = 1;
    });

    var keys = _.keys(map);
    if (_.isArray(data)) {
      data = _.map(data, function(object) {
        return _.pick(object, keys);
      });
    } else if (_.isObject(data)) {
      data = _.pick(data, keys);
    }

    return data;
  }
854155
def _dataToString(self, data):
        
        if self.specialValueText is not None and data == self.minValue:
            return self.specialValueText
        else:
            return "{}{:.{}f}{}".format(self.prefix, data, self.decimals, self.suffix)
1005337
def _get_ascii_field(self, values):
        ''''''

        empty_space = ' '

        # This formats as field[x][y]
        field = [[empty_space for y in range(max(values) + 1)] for x in range(len(values))]

        # Draw graph into field
        for x in range(len(values)):
            y = values[x]
            y_prev = values[x - 1] if x - 1 in range(len(values)) else y
            y_next = values[x + 1] if x + 1 in range(len(values)) else y
            # Fill empty space
            if abs(y_prev - y) > 1:
                # Fill space between y and y_prev
                step = 1 if y_prev - y > 0 else -1

                # We don't want the first item to be inclusive, so we use step instead of y+1 since step can be negative
                for h in range(y + step, y_prev, step):
                    if field[x][h] is empty_space:
                        field[x][h] = '|'

            # Assign the character to be placed into the graph
            char = self._assign_ascii_character(y_prev, y, y_next)

            field[x][y] = char
        return field
734476
def convert_default(self, field, **params):
        """"""
        for klass, ma_field in self.TYPE_MAPPING:
            if isinstance(field, klass):
                return ma_field(**params)
        return fields.Raw(**params)
403337
def convert_serializer_field(field, is_input=True):
    

    graphql_type = get_graphene_type_from_serializer_field(field)

    args = []
    kwargs = {"description": field.help_text, "required": is_input and field.required}

    # if it is a tuple or a list it means that we are returning
    # the graphql type and the child type
    if isinstance(graphql_type, (list, tuple)):
        kwargs["of_type"] = graphql_type[1]
        graphql_type = graphql_type[0]

    if isinstance(field, serializers.ModelSerializer):
        if is_input:
            graphql_type = convert_serializer_to_input_type(field.__class__)
        else:
            global_registry = get_global_registry()
            field_model = field.Meta.model
            args = [global_registry.get_type_for_model(field_model)]
    elif isinstance(field, serializers.ListSerializer):
        field = field.child
        if is_input:
            kwargs["of_type"] = convert_serializer_to_input_type(field.__class__)
        else:
            del kwargs["of_type"]
            global_registry = get_global_registry()
            field_model = field.Meta.model
            args = [global_registry.get_type_for_model(field_model)]

    return graphql_type(*args, **kwargs)
770479
def _convert_list2str(self, fields):
        
        if isinstance(fields, tuple) or isinstance(fields, list):
            return ','.join(fields)
        return fields
79015
def convert_meta(self):
        
        if self.meta_str:
            self.meta_str = regex_meta.findall(self.meta_str + ',')
        if self.meta_str:
            for par in self.meta_str:
                if par[0] is not '':
                    val1 = par[0]
                    val2 = par[1]
                else:
                    val1 = par[2]
                    val2 = par[3]
                val1 = val1.strip()
                val2 = val2.strip()
                if val1 in CRTFParser.valid_global_keys or val1 == 'label':
                    if val1 in ('range', 'corr', 'labeloff'):
                        val2 = val2.split(',')
                        val2 = [x.strip() for x in val2]
                    self.meta[val1] = val2
                else:
                    self._raise_error("'{0}' is not a valid meta key".format(val1))

        self.meta['include'] = self.include != '-'
        self.include = self.meta['include']

        if 'range' in self.meta:
            self.meta['range'] = [u.Quantity(x) for x in self.meta['range']]

        self.meta['type'] = self.type_
141323
def uri_from_fields(prefix, *fields):
        """"""
        string = '_'.join(AlignmentHelper.alpha_numeric(f.strip().lower(), '') for f in fields)

        if len(string) == len(fields) - 1:
            return ''

        return prefix + string
1251121
function convertFieldName (name) {
  const regex = new RegExp(/\.|\(|\)/g)
  return name.replace(regex, '').replace(/\s/g, '_')
}
1365733
def convertfields_old(key_comm, obj, inblock=None):
    """"""
    convinidd = ConvInIDD()
    typefunc = dict(integer=convinidd.integer, real=convinidd.real)
    types = []
    for comm in key_comm:
        types.append(comm.get('type', [None])[0])
    convs = [typefunc.get(typ, convinidd.no_type) for typ in types]
    try:
        inblock = list(inblock)
    except TypeError as e:
        inblock = ['does not start with N'] * len(obj)
    for i, (val, conv, avar) in enumerate(zip(obj, convs, inblock)):
        if i == 0:
            # inblock[0] is the key
            pass
        else:
            val = conv(val, inblock[i])
        obj[i] = val
    return obj
883636
def to_match(self):
        """"""
        self.validate()

        mark_name, field_name = self.location.get_location_name()
        validate_safe_string(mark_name)
        validate_safe_string(field_name)

        stripped_field_type = strip_non_null_from_type(self.field_type)
        if GraphQLDate.is_same_type(stripped_field_type):
            return u'%s.%s.format("%s")' % (mark_name, field_name, STANDARD_DATE_FORMAT)
        elif GraphQLDateTime.is_same_type(stripped_field_type):
            return u'%s.%s.format("%s")' % (mark_name, field_name, STANDARD_DATETIME_FORMAT)
        else:
            return u'%s.%s' % (mark_name, field_name)
1259927
function csvFieldNames (inFields) {
  const fieldNames = _.map(inFields, (field) => {
    return convertFieldName(field)
  })
  return fieldNames
}
717920
def format_field(self, value, format_spec):
        
        if format_spec:
            spec, arg = format_spec[0], format_spec[1:]
            arg = arg or None
        else:
            spec = arg = None
        return self._format_field(spec, arg, value, self.numeric_locale)
1278923
def tail_field(field):
    
    if field == "." or field==None:
        return ".", "."
    elif "." in field:
        if "\\." in field:
            return tuple(k.replace("\a", ".") for k in field.replace("\\.", "\a").split(".", 1))
        else:
            return field.split(".", 1)
    else:
        return field, "."
1063130
function(str){
        var versionArray = str.split(",");//replace with regex
        return {
            "raw":str,
            "major":parseInt(versionArray[0].split(" ")[1], 10),
            "minor":parseInt(versionArray[1], 10),
            "revision":parseInt(versionArray[2], 10),
            "revisionStr":versionArray[2]
        };
    }
1108122
@Support({SQLDialect.POSTGRES})
    public static Field<String> stringAgg(Field<String> field, String delimiter) {
        return DSL.field("string_agg({0}, {1})", field.getDataType(), field, DSL.val(delimiter));
    }