<commit_before>import 'get_value.dart';

/// Parses a URI-encoded string into real data! **Wow!**
///
/// Whichever map you provide will be automatically populated from the urlencoded body string you provide.
buildMapFromUri(Map map, String body) {
  RegExp parseArrayRgx = new RegExp(r'^(.+)\[\]$');

  for (String keyValuePair in body.split('&')) {
    if (keyValuePair.contains('=')) {
      var equals = keyValuePair.indexOf('=');
      String key = Uri.decodeQueryComponent(keyValuePair.substring(0, equals));
      String value =
          Uri.decodeQueryComponent(keyValuePair.substring(equals + 1));

      if (parseArrayRgx.hasMatch(key)) {
        Match queryMatch = parseArrayRgx.firstMatch(key);
        key = queryMatch.group(1);
        if (!(map[key] is List)) {
          map[key] = [];
        }

        map[key].add(getValue(value));
      } else if (key.contains('.')) {
        // i.e. map.foo.bar => [map, foo, bar]
        List<String> keys = key.split('.');

        Map targetMap = map[keys[0]] ?? {};
        map[keys[0]] = targetMap;
        for (int i = 1; i < keys.length; i++) {
          if (i < keys.length - 1) {
            targetMap[keys[i]] = targetMap[keys[i]] ?? {};
            targetMap = targetMap[keys[i]] as Map;
          } else {
            targetMap[keys[i]] = getValue(value);
          }
        }
      } else
        map[key] = getValue(value);
    } else
      map[Uri.decodeQueryComponent(keyValuePair)] = true;
  }
}<commit_msg>analyzer error of dynamic variable to Map<commit_after>import 'get_value.dart';

/// Parses a URI-encoded string into real data! **Wow!**
///
/// Whichever map you provide will be automatically populated from the urlencoded body string you provide.
buildMapFromUri(Map map, String body) {
  RegExp parseArrayRgx = new RegExp(r'^(.+)\[\]$');

  for (String keyValuePair in body.split('&')) {
    if (keyValuePair.contains('=')) {
      var equals = keyValuePair.indexOf('=');
      String key = Uri.decodeQueryComponent(keyValuePair.substring(0, equals));
      String value =
          Uri.decodeQueryComponent(keyValuePair.substring(equals + 1));

      if (parseArrayRgx.hasMatch(key)) {
        Match queryMatch = parseArrayRgx.firstMatch(key);
        key = queryMatch.group(1);
        if (!(map[key] is List)) {
          map[key] = [];
        }

        map[key].add(getValue(value));
      } else if (key.contains('.')) {
        // i.e. map.foo.bar => [map, foo, bar]
        List<String> keys = key.split('.');

        Map targetMap = map[keys[0]] != null ? map[keys[0]] as Map : {};
        map[keys[0]] = targetMap;
        for (int i = 1; i < keys.length; i++) {
          if (i < keys.length - 1) {
            targetMap[keys[i]] = targetMap[keys[i]] ?? {};
            targetMap = targetMap[keys[i]] as Map;
          } else {
            targetMap[keys[i]] = getValue(value);
          }
        }
      } else
        map[key] = getValue(value);
    } else
      map[Uri.decodeQueryComponent(keyValuePair)] = true;
  }
}
{'fraction_non_alphanumeric': 0.1608738828202582, 'fraction_numerical': 0.004965243296921549, 'mean_word_length': 2.4146892655367234, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5906197', 'n_tokens_mistral': 971, 'n_tokens_neox': 945, 'n_words': 222}