<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 pub.excluding_transformer;

import 'dart:async';

import 'package:barback/barback.dart';

/// Decorates an inner [Transformer] and handles including and excluding
/// primary inputs.
class ExcludingTransformer extends Transformer {
  /// If [includes] or [excludes] is non-null, wraps [inner] in an
  /// [ExcludingTransformer] that handles those.
  ///
  /// Otherwise, just returns [inner] unmodified.
  static Transformer wrap(Transformer inner, Set<String> includes,
      Set<String> excludes) {
    if (includes == null && excludes == null) return inner;

    if (inner is LazyTransformer) {
      return new _LazyExcludingTransformer(
          inner as LazyTransformer, includes, excludes);
    } else if (inner is DeclaringTransformer) {
      return new _DeclaringExcludingTransformer(
          inner as DeclaringTransformer, includes, excludes);
    } else {
      return new ExcludingTransformer._(inner, includes, excludes);
    }
  }

  final Transformer _inner;

  /// The set of asset paths which should be included.<commit_msg>Add a TODO to the code added by r36460.<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 pub.excluding_transformer;

import 'dart:async';

import 'package:barback/barback.dart';

/// Decorates an inner [Transformer] and handles including and excluding
/// primary inputs.
class ExcludingTransformer extends Transformer {
  /// If [includes] or [excludes] is non-null, wraps [inner] in an
  /// [ExcludingTransformer] that handles those.
  ///
  /// Otherwise, just returns [inner] unmodified.
  static Transformer wrap(Transformer inner, Set<String> includes,
      Set<String> excludes) {
    if (includes == null && excludes == null) return inner;

    if (inner is LazyTransformer) {
      // TODO(nweiz): Remove these unnecessary "as"es when issue 19046 is fixed.
      return new _LazyExcludingTransformer(
          inner as LazyTransformer, includes, excludes);
    } else if (inner is DeclaringTransformer) {
      return new _DeclaringExcludingTransformer(
          inner as DeclaringTransformer, includes, excludes);
    } else {
      return new ExcludingTransformer._(inner, includes, excludes);
    }
  }

  final Transformer _inner;

  /// The set of asset paths which should be included.
{'fraction_non_alphanumeric': 0.09002614867388868, 'fraction_numerical': 0.006723944714232349, 'mean_word_length': 3.4782608695652173, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5888972', 'n_tokens_mistral': 772, 'n_tokens_neox': 720, 'n_words': 287}