<commit_before>// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Library for creating mock versions of platform and internal libraries.

library mock_libraries;

const DEFAULT_PLATFORM_CONFIG = """
[libraries]
core:core/core.dart
async:async/async.dart
_js_helper:_internal/js_runtime/lib/js_helper.dart
_interceptors:_internal/js_runtime/lib/interceptors.dart
_internal:internal/internal.dart
_isolate_helper:_internal/js_runtime/lib/isolate_helper.dart
""";

String buildLibrarySource(Map<String, String> elementMap,
    [Map<String, String> additionalElementMap = const <String, String>{}]) {
  Map<String, String> map = new Map<String, String>.from(elementMap);
  if (additionalElementMap != null) {
    map.addAll(additionalElementMap);
  }
  StringBuffer sb = new StringBuffer();
  map.values.forEach((String element) {
    sb.write('$element\n');
  });
  return sb.toString();
}

const Map<String, String> DEFAULT_CORE_LIBRARY = const <String, String>{
  '<imports>': '''
import 'dart:_internal' as internal;
''',
  'bool': 'class bool {}',
  'Comparator': 'abstract class Comparator<T> {}',
  'DateTime': r'''
      class DateTime {
        DateTime(year);
        DateTime.utc(year);
      }''',
  'Deprecated': r'''
      class Deprecated extends Object {
        final String expires;
        const Deprecated(this.expires);
      }''',
  'deprecated': 'const Object deprecated = const Deprecated("next release");',
  'double': r'''
      abstract class double extends num {
        static var NAN = 0;
        static parse(s) {}
      }''',
  'Function': r'''
      class Function {
        static apply(Function fn, List positional, [Map named]) => null;
      }''',
  'identical': 'bool identical(Object a, Object b) { return true; }',
  'int': 'abstract class int extends num { }',
  'Iterable': '''
      abstract class Iterable<E> {
          Iterator<E> get iterator => null;
      }''',
  'Iterator': '''
      abstract class Iterator<E> {
          E get current => null;
      }''',
  'LinkedHashMap': r'''
      class LinkedHashMap<K, V> implements Map<K, V> {
      }''',
  'List': r'''
      class List<E> extends Iterable<E> {
        var length;
        List([length]);
        List.filled(length, element);
        E get first => null;
        E get last => null;
        E get single => null;
        E removeLast() => null;
        E removeAt(i) => null;
        E elementAt(i) => null;
        E singleWhere(f) => null;
      }''',
  'Map': 'abstract class Map<K,V> {}',
  'Null': 'class Null {}',
  'num': r'''
      abstract class num {
        operator +(_);
        operator *(_);
        operator -();
      }''',
  'print': 'print(var obj) {}',
  'proxy': 'const proxy = 0;',
  'Object': r'''
      class Object {
        const Object();
        operator ==(other) { return true; }
        get hashCode => throw "Object.hashCode not implemented.";
        String toString() { return null; }
        noSuchMethod(im) { throw im; }
      }''',
  'Resource': 'class Resource {}',
  'StackTrace': 'abstract class StackTrace {}',
  'String': 'class String implements Pattern {}',
  'Symbol': '''
      abstract class Symbol { 
        const factory Symbol(String name) = internal.Symbol; 
      }
      ''',
  'Type': 'class Type {}',
  'Pattern': 'abstract class Pattern {}',
  '_genericNoSuchMethod': '_genericNoSuchMethod(a,b,c,d,e) {}',
  '_unresolvedConstructorError': '_unresolvedConstructorError(a,b,c,d,e) {}',
  '_malformedTypeError': '_malformedTypeError(message) {}',
};
<commit_msg>Remove `Resource` from mock libraries.<commit_after>// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Library for creating mock versions of platform and internal libraries.

library mock_libraries;

const DEFAULT_PLATFORM_CONFIG = """
[libraries]
core:core/core.dart
async:async/async.dart
_js_helper:_internal/js_runtime/lib/js_helper.dart
_interceptors:_internal/js_runtime/lib/interceptors.dart
_internal:internal/internal.dart
_isolate_helper:_internal/js_runtime/lib/isolate_helper.dart
""";

String buildLibrarySource(Map<String, String> elementMap,
    [Map<String, String> additionalElementMap = const <String, String>{}]) {
  Map<String, String> map = new Map<String, String>.from(elementMap);
  if (additionalElementMap != null) {
    map.addAll(additionalElementMap);
  }
  StringBuffer sb = new StringBuffer();
  map.values.forEach((String element) {
    sb.write('$element\n');
  });
  return sb.toString();
}

const Map<String, String> DEFAULT_CORE_LIBRARY = const <String, String>{
  '<imports>': '''
import 'dart:_internal' as internal;
''',
  'bool': 'class bool {}',
  'Comparator': 'abstract class Comparator<T> {}',
  'DateTime': r'''
      class DateTime {
        DateTime(year);
        DateTime.utc(year);
      }''',
  'Deprecated': r'''
      class Deprecated extends Object {
        final String expires;
        const Deprecated(this.expires);
      }''',
  'deprecated': 'const Object deprecated = const Deprecated("next release");',
  'double': r'''
      abstract class double extends num {
        static var NAN = 0;
        static parse(s) {}
      }''',
  'Function': r'''
      class Function {
        static apply(Function fn, List positional, [Map named]) => null;
      }''',
  'identical': 'bool identical(Object a, Object b) { return true; }',
  'int': 'abstract class int extends num { }',
  'Iterable': '''
      abstract class Iterable<E> {
          Iterator<E> get iterator => null;
      }''',
  'Iterator': '''
      abstract class Iterator<E> {
          E get current => null;
      }''',
  'LinkedHashMap': r'''
      class LinkedHashMap<K, V> implements Map<K, V> {
      }''',
  'List': r'''
      class List<E> extends Iterable<E> {
        var length;
        List([length]);
        List.filled(length, element);
        E get first => null;
        E get last => null;
        E get single => null;
        E removeLast() => null;
        E removeAt(i) => null;
        E elementAt(i) => null;
        E singleWhere(f) => null;
      }''',
  'Map': 'abstract class Map<K,V> {}',
  'Null': 'class Null {}',
  'num': r'''
      abstract class num {
        operator +(_);
        operator *(_);
        operator -();
      }''',
  'print': 'print(var obj) {}',
  'proxy': 'const proxy = 0;',
  'Object': r'''
      class Object {
        const Object();
        operator ==(other) { return true; }
        get hashCode => throw "Object.hashCode not implemented.";
        String toString() { return null; }
        noSuchMethod(im) { throw im; }
      }''',
  'StackTrace': 'abstract class StackTrace {}',
  'String': 'class String implements Pattern {}',
  'Symbol': '''
      abstract class Symbol { 
        const factory Symbol(String name) = internal.Symbol; 
      }
      ''',
  'Type': 'class Type {}',
  'Pattern': 'abstract class Pattern {}',
  '_genericNoSuchMethod': '_genericNoSuchMethod(a,b,c,d,e) {}',
  '_unresolvedConstructorError': '_unresolvedConstructorError(a,b,c,d,e) {}',
  '_malformedTypeError': '_malformedTypeError(message) {}',
};

{'fraction_non_alphanumeric': 0.155420054200542, 'fraction_numerical': 0.0016260162601626016, 'mean_word_length': 3.1051167964404893, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 59, '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': '3422531', 'n_tokens_mistral': 2253, 'n_tokens_neox': 2226, 'n_words': 615}